@fluidframework/tree 2.32.0 → 2.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (339) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/api-report/tree.alpha.api.md +169 -192
  3. package/api-report/tree.beta.api.md +135 -164
  4. package/api-report/tree.legacy.alpha.api.md +138 -167
  5. package/api-report/tree.legacy.public.api.md +135 -164
  6. package/api-report/tree.public.api.md +135 -164
  7. package/dist/alpha.d.ts +3 -11
  8. package/dist/beta.d.ts +2 -11
  9. package/dist/core/index.d.ts +1 -1
  10. package/dist/core/index.d.ts.map +1 -1
  11. package/dist/core/index.js +1 -2
  12. package/dist/core/index.js.map +1 -1
  13. package/dist/core/schema-stored/index.d.ts +1 -1
  14. package/dist/core/schema-stored/index.d.ts.map +1 -1
  15. package/dist/core/schema-stored/index.js +1 -2
  16. package/dist/core/schema-stored/index.js.map +1 -1
  17. package/dist/core/schema-stored/schema.d.ts +4 -11
  18. package/dist/core/schema-stored/schema.d.ts.map +1 -1
  19. package/dist/core/schema-stored/schema.js +7 -14
  20. package/dist/core/schema-stored/schema.js.map +1 -1
  21. package/dist/core/tree/anchorSet.d.ts.map +1 -1
  22. package/dist/core/tree/anchorSet.js +31 -24
  23. package/dist/core/tree/anchorSet.js.map +1 -1
  24. package/dist/core/tree/deltaUtil.d.ts +1 -4
  25. package/dist/core/tree/deltaUtil.d.ts.map +1 -1
  26. package/dist/core/tree/deltaUtil.js +1 -13
  27. package/dist/core/tree/deltaUtil.js.map +1 -1
  28. package/dist/core/tree/visitDelta.d.ts +6 -29
  29. package/dist/core/tree/visitDelta.d.ts.map +1 -1
  30. package/dist/core/tree/visitDelta.js +11 -50
  31. package/dist/core/tree/visitDelta.js.map +1 -1
  32. package/dist/core/tree/visitorUtils.d.ts +12 -9
  33. package/dist/core/tree/visitorUtils.d.ts.map +1 -1
  34. package/dist/core/tree/visitorUtils.js +19 -32
  35. package/dist/core/tree/visitorUtils.js.map +1 -1
  36. package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  37. package/dist/feature-libraries/chunked-forest/chunkedForest.js +6 -11
  38. package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  39. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +1 -1
  40. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
  41. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  42. package/dist/feature-libraries/chunked-forest/codec/nodeShape.d.ts +41 -5
  43. package/dist/feature-libraries/chunked-forest/codec/nodeShape.d.ts.map +1 -1
  44. package/dist/feature-libraries/chunked-forest/codec/nodeShape.js +43 -26
  45. package/dist/feature-libraries/chunked-forest/codec/nodeShape.js.map +1 -1
  46. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +1 -1
  47. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
  48. package/dist/feature-libraries/flex-tree/context.d.ts +5 -0
  49. package/dist/feature-libraries/flex-tree/context.d.ts.map +1 -1
  50. package/dist/feature-libraries/flex-tree/context.js +4 -0
  51. package/dist/feature-libraries/flex-tree/context.js.map +1 -1
  52. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts +8 -0
  53. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  54. package/dist/feature-libraries/flex-tree/flexTreeTypes.js +8 -0
  55. package/dist/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  56. package/dist/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -1
  57. package/dist/feature-libraries/indexing/anchorTreeIndex.js +15 -22
  58. package/dist/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
  59. package/dist/feature-libraries/node-identifier/nodeIdentifierManager.d.ts.map +1 -1
  60. package/dist/feature-libraries/node-identifier/nodeIdentifierManager.js +29 -25
  61. package/dist/feature-libraries/node-identifier/nodeIdentifierManager.js.map +1 -1
  62. package/dist/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  63. package/dist/feature-libraries/object-forest/objectForest.js +1 -7
  64. package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
  65. package/dist/feature-libraries/schema-index/codec.d.ts.map +1 -1
  66. package/dist/feature-libraries/schema-index/codec.js +1 -1
  67. package/dist/feature-libraries/schema-index/codec.js.map +1 -1
  68. package/dist/index.d.ts +1 -1
  69. package/dist/index.d.ts.map +1 -1
  70. package/dist/index.js +3 -2
  71. package/dist/index.js.map +1 -1
  72. package/dist/internalTypes.d.ts +1 -1
  73. package/dist/internalTypes.d.ts.map +1 -1
  74. package/dist/internalTypes.js.map +1 -1
  75. package/dist/jsonDomainSchema.d.ts +6 -6
  76. package/dist/jsonDomainSchema.d.ts.map +1 -1
  77. package/dist/jsonDomainSchema.js.map +1 -1
  78. package/dist/legacy.d.ts +2 -11
  79. package/dist/packageVersion.d.ts +1 -1
  80. package/dist/packageVersion.js +1 -1
  81. package/dist/packageVersion.js.map +1 -1
  82. package/dist/public.d.ts +2 -11
  83. package/dist/serializableDomainSchema.d.ts +5 -5
  84. package/dist/shared-tree/checkoutFlexTreeView.d.ts +1 -0
  85. package/dist/shared-tree/checkoutFlexTreeView.d.ts.map +1 -1
  86. package/dist/shared-tree/checkoutFlexTreeView.js +4 -0
  87. package/dist/shared-tree/checkoutFlexTreeView.js.map +1 -1
  88. package/dist/shared-tree/index.d.ts +3 -2
  89. package/dist/shared-tree/index.d.ts.map +1 -1
  90. package/dist/shared-tree/index.js +2 -2
  91. package/dist/shared-tree/index.js.map +1 -1
  92. package/dist/shared-tree/sharedTree.d.ts +4 -35
  93. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  94. package/dist/shared-tree/sharedTree.js +4 -54
  95. package/dist/shared-tree/sharedTree.js.map +1 -1
  96. package/dist/simple-tree/api/index.d.ts +2 -1
  97. package/dist/simple-tree/api/index.d.ts.map +1 -1
  98. package/dist/simple-tree/api/index.js +3 -1
  99. package/dist/simple-tree/api/index.js.map +1 -1
  100. package/dist/simple-tree/api/schemaFactory.d.ts +28 -28
  101. package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
  102. package/dist/simple-tree/api/schemaFactory.js +11 -11
  103. package/dist/simple-tree/api/schemaFactory.js.map +1 -1
  104. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +6 -7
  105. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  106. package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  107. package/dist/simple-tree/api/schemaFactoryRecursive.d.ts +24 -5
  108. package/dist/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
  109. package/dist/simple-tree/api/schemaFactoryRecursive.js +14 -1
  110. package/dist/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
  111. package/dist/simple-tree/api/testRecursiveDomain.d.ts +10 -10
  112. package/dist/simple-tree/api/tree.d.ts +1 -14
  113. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  114. package/dist/simple-tree/api/tree.js.map +1 -1
  115. package/dist/simple-tree/api/typesUnsafe.d.ts +237 -220
  116. package/dist/simple-tree/api/typesUnsafe.d.ts.map +1 -1
  117. package/dist/simple-tree/api/typesUnsafe.js.map +1 -1
  118. package/dist/simple-tree/arrayNode.d.ts +2 -2
  119. package/dist/simple-tree/arrayNode.d.ts.map +1 -1
  120. package/dist/simple-tree/arrayNode.js.map +1 -1
  121. package/dist/simple-tree/core/treeNodeKernel.d.ts +9 -2
  122. package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  123. package/dist/simple-tree/core/treeNodeKernel.js +39 -24
  124. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
  125. package/dist/simple-tree/core/types.d.ts +14 -4
  126. package/dist/simple-tree/core/types.d.ts.map +1 -1
  127. package/dist/simple-tree/core/types.js +14 -4
  128. package/dist/simple-tree/core/types.js.map +1 -1
  129. package/dist/simple-tree/core/unhydratedFlexTree.d.ts +2 -1
  130. package/dist/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  131. package/dist/simple-tree/core/unhydratedFlexTree.js +3 -0
  132. package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  133. package/dist/simple-tree/index.d.ts +1 -1
  134. package/dist/simple-tree/index.d.ts.map +1 -1
  135. package/dist/simple-tree/index.js +3 -2
  136. package/dist/simple-tree/index.js.map +1 -1
  137. package/dist/simple-tree/objectNode.d.ts +9 -2
  138. package/dist/simple-tree/objectNode.d.ts.map +1 -1
  139. package/dist/simple-tree/objectNode.js +3 -0
  140. package/dist/simple-tree/objectNode.js.map +1 -1
  141. package/dist/simple-tree/schemaTypes.d.ts +10 -5
  142. package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
  143. package/dist/simple-tree/schemaTypes.js +5 -2
  144. package/dist/simple-tree/schemaTypes.js.map +1 -1
  145. package/dist/tableSchema.d.ts +78 -26
  146. package/dist/tableSchema.d.ts.map +1 -1
  147. package/dist/tableSchema.js +53 -24
  148. package/dist/tableSchema.js.map +1 -1
  149. package/dist/treeFactory.d.ts +6 -12
  150. package/dist/treeFactory.d.ts.map +1 -1
  151. package/dist/treeFactory.js +56 -5
  152. package/dist/treeFactory.js.map +1 -1
  153. package/lib/alpha.d.ts +3 -11
  154. package/lib/beta.d.ts +2 -11
  155. package/lib/core/index.d.ts +1 -1
  156. package/lib/core/index.d.ts.map +1 -1
  157. package/lib/core/index.js +1 -1
  158. package/lib/core/index.js.map +1 -1
  159. package/lib/core/schema-stored/index.d.ts +1 -1
  160. package/lib/core/schema-stored/index.d.ts.map +1 -1
  161. package/lib/core/schema-stored/index.js +1 -1
  162. package/lib/core/schema-stored/index.js.map +1 -1
  163. package/lib/core/schema-stored/schema.d.ts +4 -11
  164. package/lib/core/schema-stored/schema.d.ts.map +1 -1
  165. package/lib/core/schema-stored/schema.js +6 -12
  166. package/lib/core/schema-stored/schema.js.map +1 -1
  167. package/lib/core/tree/anchorSet.d.ts.map +1 -1
  168. package/lib/core/tree/anchorSet.js +31 -24
  169. package/lib/core/tree/anchorSet.js.map +1 -1
  170. package/lib/core/tree/deltaUtil.d.ts +1 -4
  171. package/lib/core/tree/deltaUtil.d.ts.map +1 -1
  172. package/lib/core/tree/deltaUtil.js +0 -9
  173. package/lib/core/tree/deltaUtil.js.map +1 -1
  174. package/lib/core/tree/visitDelta.d.ts +6 -29
  175. package/lib/core/tree/visitDelta.d.ts.map +1 -1
  176. package/lib/core/tree/visitDelta.js +12 -51
  177. package/lib/core/tree/visitDelta.js.map +1 -1
  178. package/lib/core/tree/visitorUtils.d.ts +12 -9
  179. package/lib/core/tree/visitorUtils.d.ts.map +1 -1
  180. package/lib/core/tree/visitorUtils.js +19 -32
  181. package/lib/core/tree/visitorUtils.js.map +1 -1
  182. package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  183. package/lib/feature-libraries/chunked-forest/chunkedForest.js +6 -11
  184. package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  185. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +1 -1
  186. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
  187. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  188. package/lib/feature-libraries/chunked-forest/codec/nodeShape.d.ts +41 -5
  189. package/lib/feature-libraries/chunked-forest/codec/nodeShape.d.ts.map +1 -1
  190. package/lib/feature-libraries/chunked-forest/codec/nodeShape.js +43 -26
  191. package/lib/feature-libraries/chunked-forest/codec/nodeShape.js.map +1 -1
  192. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +1 -1
  193. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
  194. package/lib/feature-libraries/flex-tree/context.d.ts +5 -0
  195. package/lib/feature-libraries/flex-tree/context.d.ts.map +1 -1
  196. package/lib/feature-libraries/flex-tree/context.js +5 -1
  197. package/lib/feature-libraries/flex-tree/context.js.map +1 -1
  198. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts +8 -0
  199. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  200. package/lib/feature-libraries/flex-tree/flexTreeTypes.js +8 -0
  201. package/lib/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  202. package/lib/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -1
  203. package/lib/feature-libraries/indexing/anchorTreeIndex.js +15 -22
  204. package/lib/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
  205. package/lib/feature-libraries/node-identifier/nodeIdentifierManager.d.ts.map +1 -1
  206. package/lib/feature-libraries/node-identifier/nodeIdentifierManager.js +28 -24
  207. package/lib/feature-libraries/node-identifier/nodeIdentifierManager.js.map +1 -1
  208. package/lib/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  209. package/lib/feature-libraries/object-forest/objectForest.js +1 -7
  210. package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
  211. package/lib/feature-libraries/schema-index/codec.d.ts.map +1 -1
  212. package/lib/feature-libraries/schema-index/codec.js +2 -2
  213. package/lib/feature-libraries/schema-index/codec.js.map +1 -1
  214. package/lib/index.d.ts +1 -1
  215. package/lib/index.d.ts.map +1 -1
  216. package/lib/index.js +1 -1
  217. package/lib/index.js.map +1 -1
  218. package/lib/internalTypes.d.ts +1 -1
  219. package/lib/internalTypes.d.ts.map +1 -1
  220. package/lib/internalTypes.js.map +1 -1
  221. package/lib/jsonDomainSchema.d.ts +6 -6
  222. package/lib/jsonDomainSchema.d.ts.map +1 -1
  223. package/lib/jsonDomainSchema.js.map +1 -1
  224. package/lib/legacy.d.ts +2 -11
  225. package/lib/packageVersion.d.ts +1 -1
  226. package/lib/packageVersion.js +1 -1
  227. package/lib/packageVersion.js.map +1 -1
  228. package/lib/public.d.ts +2 -11
  229. package/lib/serializableDomainSchema.d.ts +5 -5
  230. package/lib/shared-tree/checkoutFlexTreeView.d.ts +1 -0
  231. package/lib/shared-tree/checkoutFlexTreeView.d.ts.map +1 -1
  232. package/lib/shared-tree/checkoutFlexTreeView.js +4 -0
  233. package/lib/shared-tree/checkoutFlexTreeView.js.map +1 -1
  234. package/lib/shared-tree/index.d.ts +3 -2
  235. package/lib/shared-tree/index.d.ts.map +1 -1
  236. package/lib/shared-tree/index.js +1 -1
  237. package/lib/shared-tree/index.js.map +1 -1
  238. package/lib/shared-tree/sharedTree.d.ts +4 -35
  239. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  240. package/lib/shared-tree/sharedTree.js +2 -51
  241. package/lib/shared-tree/sharedTree.js.map +1 -1
  242. package/lib/simple-tree/api/index.d.ts +2 -1
  243. package/lib/simple-tree/api/index.d.ts.map +1 -1
  244. package/lib/simple-tree/api/index.js +1 -0
  245. package/lib/simple-tree/api/index.js.map +1 -1
  246. package/lib/simple-tree/api/schemaFactory.d.ts +28 -28
  247. package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
  248. package/lib/simple-tree/api/schemaFactory.js +11 -11
  249. package/lib/simple-tree/api/schemaFactory.js.map +1 -1
  250. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +6 -7
  251. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  252. package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  253. package/lib/simple-tree/api/schemaFactoryRecursive.d.ts +24 -5
  254. package/lib/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
  255. package/lib/simple-tree/api/schemaFactoryRecursive.js +12 -0
  256. package/lib/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
  257. package/lib/simple-tree/api/testRecursiveDomain.d.ts +10 -10
  258. package/lib/simple-tree/api/tree.d.ts +1 -14
  259. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  260. package/lib/simple-tree/api/tree.js.map +1 -1
  261. package/lib/simple-tree/api/typesUnsafe.d.ts +237 -220
  262. package/lib/simple-tree/api/typesUnsafe.d.ts.map +1 -1
  263. package/lib/simple-tree/api/typesUnsafe.js.map +1 -1
  264. package/lib/simple-tree/arrayNode.d.ts +2 -2
  265. package/lib/simple-tree/arrayNode.d.ts.map +1 -1
  266. package/lib/simple-tree/arrayNode.js.map +1 -1
  267. package/lib/simple-tree/core/treeNodeKernel.d.ts +9 -2
  268. package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  269. package/lib/simple-tree/core/treeNodeKernel.js +40 -25
  270. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
  271. package/lib/simple-tree/core/types.d.ts +14 -4
  272. package/lib/simple-tree/core/types.d.ts.map +1 -1
  273. package/lib/simple-tree/core/types.js +14 -4
  274. package/lib/simple-tree/core/types.js.map +1 -1
  275. package/lib/simple-tree/core/unhydratedFlexTree.d.ts +2 -1
  276. package/lib/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  277. package/lib/simple-tree/core/unhydratedFlexTree.js +3 -0
  278. package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  279. package/lib/simple-tree/index.d.ts +1 -1
  280. package/lib/simple-tree/index.d.ts.map +1 -1
  281. package/lib/simple-tree/index.js +1 -1
  282. package/lib/simple-tree/index.js.map +1 -1
  283. package/lib/simple-tree/objectNode.d.ts +9 -2
  284. package/lib/simple-tree/objectNode.d.ts.map +1 -1
  285. package/lib/simple-tree/objectNode.js +4 -1
  286. package/lib/simple-tree/objectNode.js.map +1 -1
  287. package/lib/simple-tree/schemaTypes.d.ts +10 -5
  288. package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
  289. package/lib/simple-tree/schemaTypes.js +5 -2
  290. package/lib/simple-tree/schemaTypes.js.map +1 -1
  291. package/lib/tableSchema.d.ts +78 -26
  292. package/lib/tableSchema.d.ts.map +1 -1
  293. package/lib/tableSchema.js +53 -24
  294. package/lib/tableSchema.js.map +1 -1
  295. package/lib/treeFactory.d.ts +6 -12
  296. package/lib/treeFactory.d.ts.map +1 -1
  297. package/lib/treeFactory.js +55 -3
  298. package/lib/treeFactory.js.map +1 -1
  299. package/lib/tsdoc-metadata.json +1 -1
  300. package/package.json +22 -23
  301. package/src/core/index.ts +0 -2
  302. package/src/core/schema-stored/index.ts +0 -2
  303. package/src/core/schema-stored/schema.ts +10 -29
  304. package/src/core/tree/anchorSet.ts +32 -24
  305. package/src/core/tree/deltaUtil.ts +1 -13
  306. package/src/core/tree/visitDelta.ts +24 -81
  307. package/src/core/tree/visitorUtils.ts +43 -53
  308. package/src/feature-libraries/chunked-forest/chunkedForest.ts +7 -22
  309. package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +1 -1
  310. package/src/feature-libraries/chunked-forest/codec/nodeShape.ts +45 -27
  311. package/src/feature-libraries/chunked-forest/codec/schemaBasedEncode.ts +1 -1
  312. package/src/feature-libraries/flex-tree/context.ts +11 -1
  313. package/src/feature-libraries/flex-tree/flexTreeTypes.ts +8 -0
  314. package/src/feature-libraries/indexing/anchorTreeIndex.ts +17 -28
  315. package/src/feature-libraries/node-identifier/nodeIdentifierManager.ts +39 -38
  316. package/src/feature-libraries/object-forest/objectForest.ts +1 -18
  317. package/src/feature-libraries/schema-index/codec.ts +1 -2
  318. package/src/index.ts +3 -11
  319. package/src/internalTypes.ts +0 -19
  320. package/src/jsonDomainSchema.ts +1 -3
  321. package/src/packageVersion.ts +1 -1
  322. package/src/shared-tree/checkoutFlexTreeView.ts +6 -0
  323. package/src/shared-tree/index.ts +8 -3
  324. package/src/shared-tree/sharedTree.ts +5 -133
  325. package/src/simple-tree/api/index.ts +2 -22
  326. package/src/simple-tree/api/schemaFactory.ts +40 -54
  327. package/src/simple-tree/api/schemaFactoryAlpha.ts +9 -14
  328. package/src/simple-tree/api/schemaFactoryRecursive.ts +25 -5
  329. package/src/simple-tree/api/tree.ts +1 -14
  330. package/src/simple-tree/api/typesUnsafe.ts +359 -341
  331. package/src/simple-tree/arrayNode.ts +2 -2
  332. package/src/simple-tree/core/treeNodeKernel.ts +46 -28
  333. package/src/simple-tree/core/types.ts +14 -4
  334. package/src/simple-tree/core/unhydratedFlexTree.ts +5 -1
  335. package/src/simple-tree/index.ts +2 -22
  336. package/src/simple-tree/objectNode.ts +13 -4
  337. package/src/simple-tree/schemaTypes.ts +11 -7
  338. package/src/tableSchema.ts +190 -63
  339. package/src/treeFactory.ts +151 -8
@@ -11,7 +11,7 @@ import type { NodeKind, WithType, TreeNodeSchema, TreeNodeSchemaClass, TreeNodeS
11
11
  import { type TreeArrayNode } from "../arrayNode.js";
12
12
  import { type InsertableObjectFromSchemaRecord, type TreeObjectNode } from "../objectNode.js";
13
13
  import { type MapNodeInsertableData, type TreeMapNode } from "../mapNode.js";
14
- import type { FieldSchemaUnsafe, InsertableObjectFromSchemaRecordUnsafe, InsertableTreeNodeFromImplicitAllowedTypesUnsafe, TreeArrayNodeUnsafe, TreeMapNodeUnsafe, TreeObjectNodeUnsafe, ImplicitAllowedTypesUnsafe, ImplicitFieldSchemaUnsafe, FieldSchemaAlphaUnsafe } from "./typesUnsafe.js";
14
+ import type { System_Unsafe, FieldSchemaAlphaUnsafe } from "./typesUnsafe.js";
15
15
  /**
16
16
  * Gets the leaf domain schema compatible with a given {@link TreeValue}.
17
17
  */
@@ -168,7 +168,7 @@ export interface SchemaStatics {
168
168
  * This version of {@link SchemaStatics.optional} has fewer type constraints to work around TypeScript limitations, see {@link Unenforced}.
169
169
  * See {@link ValidateRecursiveSchema} for additional information about using recursive schema.
170
170
  */
171
- readonly optionalRecursive: <const T extends ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider">) => FieldSchemaUnsafe<FieldKind.Optional, T, TCustomMetadata>;
171
+ readonly optionalRecursive: <const T extends System_Unsafe.ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider">) => System_Unsafe.FieldSchemaUnsafe<FieldKind.Optional, T, TCustomMetadata>;
172
172
  /**
173
173
  * {@link SchemaStatics.required} except tweaked to work better for recursive types.
174
174
  * Use with {@link ValidateRecursiveSchema} for improved type safety.
@@ -176,7 +176,7 @@ export interface SchemaStatics {
176
176
  * This version of {@link SchemaStatics.required} has fewer type constraints to work around TypeScript limitations, see {@link Unenforced}.
177
177
  * See {@link ValidateRecursiveSchema} for additional information about using recursive schema.
178
178
  */
179
- readonly requiredRecursive: <const T extends ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider">) => FieldSchemaUnsafe<FieldKind.Required, T, TCustomMetadata>;
179
+ readonly requiredRecursive: <const T extends System_Unsafe.ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider">) => System_Unsafe.FieldSchemaUnsafe<FieldKind.Required, T, TCustomMetadata>;
180
180
  }
181
181
  /**
182
182
  * Implementation of {@link SchemaStatics}.
@@ -193,8 +193,8 @@ export declare const schemaStaticsBase: {
193
193
  readonly leaves: readonly [LeafSchema<"string", string> & import("../simpleSchema.js").SimpleLeafNodeSchema, LeafSchema<"number", number> & import("../simpleSchema.js").SimpleLeafNodeSchema, LeafSchema<"boolean", boolean> & import("../simpleSchema.js").SimpleLeafNodeSchema, LeafSchema<"null", null> & import("../simpleSchema.js").SimpleLeafNodeSchema, LeafSchema<"handle", IFluidHandle<unknown>> & import("../simpleSchema.js").SimpleLeafNodeSchema];
194
194
  readonly optional: <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider">) => FieldSchemaAlpha<FieldKind.Optional, T, TCustomMetadata>;
195
195
  readonly required: <const T_1 extends ImplicitAllowedTypes, const TCustomMetadata_1 = unknown>(t: T_1, props?: Omit<FieldProps<TCustomMetadata_1>, "defaultProvider"> | undefined) => FieldSchemaAlpha<FieldKind.Required, T_1, TCustomMetadata_1>;
196
- readonly optionalRecursive: <const T_2 extends ImplicitAllowedTypesUnsafe, const TCustomMetadata_2 = unknown>(t: T_2, props?: Omit<FieldProps<TCustomMetadata_2>, "defaultProvider"> | undefined) => FieldSchemaAlphaUnsafe<FieldKind.Optional, T_2, TCustomMetadata_2>;
197
- readonly requiredRecursive: <const T_3 extends ImplicitAllowedTypesUnsafe, const TCustomMetadata_3 = unknown>(t: T_3, props?: Omit<FieldProps<TCustomMetadata_3>, "defaultProvider"> | undefined) => FieldSchemaAlphaUnsafe<FieldKind.Required, T_3, TCustomMetadata_3>;
196
+ readonly optionalRecursive: <const T_2 extends System_Unsafe.ImplicitAllowedTypesUnsafe, const TCustomMetadata_2 = unknown>(t: T_2, props?: Omit<FieldProps<TCustomMetadata_2>, "defaultProvider"> | undefined) => FieldSchemaAlphaUnsafe<FieldKind.Optional, T_2, TCustomMetadata_2>;
197
+ readonly requiredRecursive: <const T_3 extends System_Unsafe.ImplicitAllowedTypesUnsafe, const TCustomMetadata_3 = unknown>(t: T_3, props?: Omit<FieldProps<TCustomMetadata_3>, "defaultProvider"> | undefined) => FieldSchemaAlphaUnsafe<FieldKind.Required, T_3, TCustomMetadata_3>;
198
198
  };
199
199
  /**
200
200
  * Unstable extensions to {@link schemaStaticsBase}.
@@ -209,8 +209,8 @@ export declare const schemaStatics: {
209
209
  readonly leaves: readonly [LeafSchema<"string", string> & import("../simpleSchema.js").SimpleLeafNodeSchema, LeafSchema<"number", number> & import("../simpleSchema.js").SimpleLeafNodeSchema, LeafSchema<"boolean", boolean> & import("../simpleSchema.js").SimpleLeafNodeSchema, LeafSchema<"null", null> & import("../simpleSchema.js").SimpleLeafNodeSchema, LeafSchema<"handle", IFluidHandle<unknown>> & import("../simpleSchema.js").SimpleLeafNodeSchema];
210
210
  readonly optional: <const T extends ImplicitAllowedTypes, const TCustomMetadata_1 = unknown>(t: T, props?: Omit<FieldProps<TCustomMetadata_1>, "defaultProvider"> | undefined) => FieldSchemaAlpha<FieldKind.Optional, T, TCustomMetadata_1>;
211
211
  readonly required: <const T_1 extends ImplicitAllowedTypes, const TCustomMetadata_2 = unknown>(t: T_1, props?: Omit<FieldProps<TCustomMetadata_2>, "defaultProvider"> | undefined) => FieldSchemaAlpha<FieldKind.Required, T_1, TCustomMetadata_2>;
212
- readonly optionalRecursive: <const T_2 extends ImplicitAllowedTypesUnsafe, const TCustomMetadata_3 = unknown>(t: T_2, props?: Omit<FieldProps<TCustomMetadata_3>, "defaultProvider"> | undefined) => FieldSchemaAlphaUnsafe<FieldKind.Optional, T_2, TCustomMetadata_3>;
213
- readonly requiredRecursive: <const T_3 extends ImplicitAllowedTypesUnsafe, const TCustomMetadata_4 = unknown>(t: T_3, props?: Omit<FieldProps<TCustomMetadata_4>, "defaultProvider"> | undefined) => FieldSchemaAlphaUnsafe<FieldKind.Required, T_3, TCustomMetadata_4>;
212
+ readonly optionalRecursive: <const T_2 extends System_Unsafe.ImplicitAllowedTypesUnsafe, const TCustomMetadata_3 = unknown>(t: T_2, props?: Omit<FieldProps<TCustomMetadata_3>, "defaultProvider"> | undefined) => FieldSchemaAlphaUnsafe<FieldKind.Optional, T_2, TCustomMetadata_3>;
213
+ readonly requiredRecursive: <const T_3 extends System_Unsafe.ImplicitAllowedTypesUnsafe, const TCustomMetadata_4 = unknown>(t: T_3, props?: Omit<FieldProps<TCustomMetadata_4>, "defaultProvider"> | undefined) => FieldSchemaAlphaUnsafe<FieldKind.Required, T_3, TCustomMetadata_4>;
214
214
  };
215
215
  /**
216
216
  * Creates various types of {@link TreeNodeSchema|schema} for {@link TreeNode}s.
@@ -567,11 +567,11 @@ export declare class SchemaFactory<out TScope extends string | undefined = strin
567
567
  /**
568
568
  * {@inheritDoc SchemaStatics.optionalRecursive}
569
569
  */
570
- readonly optionalRecursive: <const T extends ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider"> | undefined) => FieldSchemaUnsafe<FieldKind.Optional, T, TCustomMetadata>;
570
+ readonly optionalRecursive: <const T extends System_Unsafe.ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider"> | undefined) => System_Unsafe.FieldSchemaUnsafe<FieldKind.Optional, T, TCustomMetadata>;
571
571
  /**
572
572
  * {@inheritDoc SchemaStatics.requiredRecursive}
573
573
  */
574
- readonly requiredRecursive: <const T extends ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider"> | undefined) => FieldSchemaUnsafe<FieldKind.Required, T, TCustomMetadata>;
574
+ readonly requiredRecursive: <const T extends System_Unsafe.ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider"> | undefined) => System_Unsafe.FieldSchemaUnsafe<FieldKind.Required, T, TCustomMetadata>;
575
575
  /**
576
576
  * {@inheritDoc SchemaStatics.optional}
577
577
  */
@@ -583,30 +583,30 @@ export declare class SchemaFactory<out TScope extends string | undefined = strin
583
583
  /**
584
584
  * {@inheritDoc SchemaStatics.optionalRecursive}
585
585
  */
586
- static readonly optionalRecursive: <const T extends ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider"> | undefined) => FieldSchemaUnsafe<FieldKind.Optional, T, TCustomMetadata>;
586
+ static readonly optionalRecursive: <const T extends System_Unsafe.ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider"> | undefined) => System_Unsafe.FieldSchemaUnsafe<FieldKind.Optional, T, TCustomMetadata>;
587
587
  /**
588
588
  * {@inheritDoc SchemaStatics.requiredRecursive}
589
589
  */
590
- static readonly requiredRecursive: <const T extends ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider"> | undefined) => FieldSchemaUnsafe<FieldKind.Required, T, TCustomMetadata>;
590
+ static readonly requiredRecursive: <const T extends System_Unsafe.ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider"> | undefined) => System_Unsafe.FieldSchemaUnsafe<FieldKind.Required, T, TCustomMetadata>;
591
591
  /**
592
- * A special field which holds a unique identifier for an object node.
592
+ * A special readonly field which holds an identifier string for an object node.
593
593
  * @remarks
594
- * The value of this field, a "node identifier", uniquely identifies a node among all other nodes in the tree.
594
+ * The value of this field, a "node identifier", is a string which identifies a node (or nodes) among all nodes in the tree.
595
595
  * Node identifiers are strings, and can therefore be used as lookup keys in maps or written to a database.
596
- * When the node is constructed, the identifier field does not need to be populated.
597
- * The SharedTree will provide an identifier for the node automatically.
598
- * An identifier provided automatically by the SharedTree has the following properties:
599
- * - It is a UUID.
596
+ * When the node is constructed, the identifier field does not need to be specified.
597
+ * When an identifier is not provided, the SharedTree will generate an identifier for the node automatically.
598
+ * The identifier generated by the SharedTree has the following properties:
599
+ *
600
+ * - It is a UUID which will not collide with other generated UUIDs.
600
601
  * - It is compressed to a space-efficient representation when stored in the document.
601
- * - A compressed form of the identifier can be accessed at runtime via the `Tree.shortId()` API.
602
- * - It will error if read (and will not be present in the object's iterable properties) before the node has been inserted into the tree.
602
+ * - A compressed form of the identifier can be accessed at runtime via the {@link TreeNodeApi.shortId|Tree.shortId()} API.
603
+ * - It will error if read (and will not be present in the object's iterable properties) before the node has been inserted into a tree.
603
604
  *
604
605
  * However, a user may alternatively supply their own string as the identifier if desired (for example, if importing identifiers from another system).
605
- * In that case, it is up to the user to ensure that the identifier is unique within the current tree - no other node should have the same identifier at the same time.
606
- * If the identifier is not unique, it may be read, but may cause libraries or features which operate over node identifiers to misbehave.
606
+ * In that case, if the user requires it to be unique, it is up to them to ensure uniqueness.
607
607
  * User-supplied identifiers may be read immediately, even before insertion into the tree.
608
608
  *
609
- * A node may have more than one identifier field (though note that this precludes the use of the `Tree.shortId()` API).
609
+ * A node may have more than one identifier field (though note that this precludes the use of the {@link TreeNodeApi.shortId|Tree.shortId()} API).
610
610
  */
611
611
  get identifier(): FieldSchema<FieldKind.Identifier, typeof this.string>;
612
612
  /**
@@ -620,7 +620,7 @@ export declare class SchemaFactory<out TScope extends string | undefined = strin
620
620
  * `error TS2589: Type instantiation is excessively deep and possibly infinite.`
621
621
  * which otherwise gets reported at sometimes incorrect source locations that vary based on incremental builds.
622
622
  */
623
- objectRecursive<const Name extends TName, const T extends RestrictiveStringRecord<ImplicitFieldSchemaUnsafe>>(name: Name, t: T): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Object, TreeObjectNodeUnsafe<T, ScopedSchemaName<TScope, Name>>, object & InsertableObjectFromSchemaRecordUnsafe<T>, false, T>;
623
+ objectRecursive<const Name extends TName, const T extends RestrictiveStringRecord<System_Unsafe.ImplicitFieldSchemaUnsafe>>(name: Name, t: T): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Object, System_Unsafe.TreeObjectNodeUnsafe<T, ScopedSchemaName<TScope, Name>>, object & System_Unsafe.InsertableObjectFromSchemaRecordUnsafe<T>, false, T>;
624
624
  /**
625
625
  * `SchemaFactory.array` except tweaked to work better for recursive types.
626
626
  * Use with {@link ValidateRecursiveSchema} for improved type safety.
@@ -628,7 +628,7 @@ export declare class SchemaFactory<out TScope extends string | undefined = strin
628
628
  * This version of `SchemaFactory.array` uses the same workarounds as {@link SchemaFactory.objectRecursive}.
629
629
  * See {@link ValidateRecursiveSchema} for additional information about using recursive schema.
630
630
  */
631
- arrayRecursive<const Name extends TName, const T extends ImplicitAllowedTypesUnsafe>(name: Name, allowedTypes: T): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Array, TreeArrayNodeUnsafe<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Array, unknown>, {
631
+ arrayRecursive<const Name extends TName, const T extends System_Unsafe.ImplicitAllowedTypesUnsafe>(name: Name, allowedTypes: T): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Array, System_Unsafe.TreeArrayNodeUnsafe<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Array, unknown>, {
632
632
  /**
633
633
  * Iterator for the iterable of content for this node.
634
634
  * @privateRemarks
@@ -640,7 +640,7 @@ export declare class SchemaFactory<out TScope extends string | undefined = strin
640
640
  * If this workaround is kept, ideally this comment would be deduplicated with the other instance of it.
641
641
  * Unfortunately attempts to do this failed to avoid the compile error this was introduced to solve.
642
642
  */
643
- [Symbol.iterator](): Iterator<InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>>;
643
+ [Symbol.iterator](): Iterator<System_Unsafe.InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>>;
644
644
  }, false, T, undefined>;
645
645
  /**
646
646
  * `SchemaFactory.map` except tweaked to work better for recursive types.
@@ -649,7 +649,7 @@ export declare class SchemaFactory<out TScope extends string | undefined = strin
649
649
  * This version of `SchemaFactory.map` uses the same workarounds as {@link SchemaFactory.objectRecursive}.
650
650
  * See {@link ValidateRecursiveSchema} for additional information about using recursive schema.
651
651
  */
652
- mapRecursive<Name extends TName, const T extends ImplicitAllowedTypesUnsafe>(name: Name, allowedTypes: T): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Map, TreeMapNodeUnsafe<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Map, unknown>, {
652
+ mapRecursive<Name extends TName, const T extends System_Unsafe.ImplicitAllowedTypesUnsafe>(name: Name, allowedTypes: T): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Map, System_Unsafe.TreeMapNodeUnsafe<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Map, unknown>, {
653
653
  /**
654
654
  * Iterator for the iterable of content for this node.
655
655
  * @privateRemarks
@@ -663,10 +663,10 @@ export declare class SchemaFactory<out TScope extends string | undefined = strin
663
663
  */
664
664
  [Symbol.iterator](): Iterator<[
665
665
  string,
666
- InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>
666
+ System_Unsafe.InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>
667
667
  ]>;
668
668
  } | {
669
- readonly [x: string]: InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>;
669
+ readonly [x: string]: System_Unsafe.InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>;
670
670
  }, false, T, undefined>;
671
671
  }
672
672
  export declare function structuralName<const T extends string>(collectionName: T, allowedTypes: TreeNodeSchema | readonly TreeNodeSchema[]): `${T}<${string}>`;
@@ -1 +1 @@
1
- {"version":3,"file":"schemaFactory.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/schemaFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAGpE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,EACN,KAAK,uBAAuB,EAG5B,MAAM,qBAAqB,CAAC;AAK7B,OAAO,EAKN,YAAY,EACZ,KAAK,UAAU,EACf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACN,SAAS,EACT,KAAK,WAAW,EAChB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,0CAA0C,EAC/C,KAAK,UAAU,EAIf,KAAK,iBAAiB,EAEtB,KAAK,gBAAgB,EACrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EACX,QAAQ,EACR,QAAQ,EACR,cAAc,EACd,mBAAmB,EACnB,sBAAsB,EAEtB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,KAAK,aAAa,EAAe,MAAM,iBAAiB,CAAC;AAClE,OAAO,EACN,KAAK,gCAAgC,EACrC,KAAK,cAAc,EAEnB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,KAAK,qBAAqB,EAAE,KAAK,WAAW,EAAa,MAAM,eAAe,CAAC;AACxF,OAAO,KAAK,EACX,iBAAiB,EASjB,sCAAsC,EACtC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D;IAeD;;;;;;OAMG;IAEI,cAAc,CACpB,KAAK,CAAC,IAAI,SAAS,KAAK,EACxB,KAAK,CAAC,CAAC,SAAS,aAAa,CAAC,0BAA0B,EACvD,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;QAc1B;;;;;;;;;;WAUG;6BACkB,SACpB,cAAc,gDAAgD,CAAC,CAAC,CAAC,CACjE;;IAQJ;;;;;;OAMG;IAEI,YAAY,CAClB,IAAI,SAAS,KAAK,EAClB,KAAK,CAAC,CAAC,SAAS,aAAa,CAAC,0BAA0B,EACvD,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;QAgBzB;;;;;;;;;;WAUG;6BACkB,SACpB;YAAC,MAAM;YAAE,cAAc,gDAAgD,CAAC,CAAC,CAAC;SAAC,CAC3E;;;;CAcL;AAED,wBAAgB,cAAc,CAAC,KAAK,CAAC,CAAC,SAAS,MAAM,EACpD,cAAc,EAAE,CAAC,EACjB,YAAY,EAAE,cAAc,GAAG,SAAS,cAAc,EAAE,GACtD,GAAG,CAAC,IAAI,MAAM,GAAG,CAmBnB"}
@@ -348,24 +348,24 @@ export class SchemaFactory {
348
348
  return arraySchema(this.scoped(name), allowedTypes, implicitlyConstructable, customizable);
349
349
  }
350
350
  /**
351
- * A special field which holds a unique identifier for an object node.
351
+ * A special readonly field which holds an identifier string for an object node.
352
352
  * @remarks
353
- * The value of this field, a "node identifier", uniquely identifies a node among all other nodes in the tree.
353
+ * The value of this field, a "node identifier", is a string which identifies a node (or nodes) among all nodes in the tree.
354
354
  * Node identifiers are strings, and can therefore be used as lookup keys in maps or written to a database.
355
- * When the node is constructed, the identifier field does not need to be populated.
356
- * The SharedTree will provide an identifier for the node automatically.
357
- * An identifier provided automatically by the SharedTree has the following properties:
358
- * - It is a UUID.
355
+ * When the node is constructed, the identifier field does not need to be specified.
356
+ * When an identifier is not provided, the SharedTree will generate an identifier for the node automatically.
357
+ * The identifier generated by the SharedTree has the following properties:
358
+ *
359
+ * - It is a UUID which will not collide with other generated UUIDs.
359
360
  * - It is compressed to a space-efficient representation when stored in the document.
360
- * - A compressed form of the identifier can be accessed at runtime via the `Tree.shortId()` API.
361
- * - It will error if read (and will not be present in the object's iterable properties) before the node has been inserted into the tree.
361
+ * - A compressed form of the identifier can be accessed at runtime via the {@link TreeNodeApi.shortId|Tree.shortId()} API.
362
+ * - It will error if read (and will not be present in the object's iterable properties) before the node has been inserted into a tree.
362
363
  *
363
364
  * However, a user may alternatively supply their own string as the identifier if desired (for example, if importing identifiers from another system).
364
- * In that case, it is up to the user to ensure that the identifier is unique within the current tree - no other node should have the same identifier at the same time.
365
- * If the identifier is not unique, it may be read, but may cause libraries or features which operate over node identifiers to misbehave.
365
+ * In that case, if the user requires it to be unique, it is up to them to ensure uniqueness.
366
366
  * User-supplied identifiers may be read immediately, even before insertion into the tree.
367
367
  *
368
- * A node may have more than one identifier field (though note that this precludes the use of the `Tree.shortId()` API).
368
+ * A node may have more than one identifier field (though note that this precludes the use of the {@link TreeNodeApi.shortId|Tree.shortId()} API).
369
369
  */
370
370
  get identifier() {
371
371
  const defaultIdentifierProvider = getDefaultProvider((nodeKeyManager) => {
@@ -1 +1 @@
1
- {"version":3,"file":"schemaFactory.js","sourceRoot":"","sources":["../../../src/simple-tree/api/schemaFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAE9E,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAIvE,OAAO,EAEN,WAAW,EACX,eAAe,GACf,MAAM,qBAAqB,CAAC;AAK7B,OAAO,EACN,aAAa,EACb,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,YAAY,GAEZ,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACN,SAAS,EAMT,iBAAiB,EAEjB,kBAAkB,EAElB,qBAAqB,GAErB,MAAM,mBAAmB,CAAC;AAS3B,OAAO,EAAsB,WAAW,EAAE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Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport type { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport { isFluidHandle } from \"@fluidframework/runtime-utils/internal\";\n\nimport type { TreeValue } from \"../../core/index.js\";\nimport type { NodeIdentifierManager } from \"../../feature-libraries/index.js\";\nimport {\n\ttype RestrictiveStringRecord,\n\tgetOrCreate,\n\tisReadonlyArray,\n} from \"../../util/index.js\";\n// This import is required for intellisense in @link doc comments on mouseover in VSCode.\n// eslint-disable-next-line unused-imports/no-unused-imports, @typescript-eslint/no-unused-vars\nimport type { TreeAlpha } from \"../../shared-tree/index.js\";\n\nimport {\n\tbooleanSchema,\n\thandleSchema,\n\tnullSchema,\n\tnumberSchema,\n\tstringSchema,\n\ttype LeafSchema,\n} from \"../leafNodeSchema.js\";\nimport {\n\tFieldKind,\n\ttype FieldSchema,\n\ttype ImplicitAllowedTypes,\n\ttype ImplicitFieldSchema,\n\ttype InsertableTreeNodeFromImplicitAllowedTypes,\n\ttype FieldProps,\n\tcreateFieldSchema,\n\ttype DefaultProvider,\n\tgetDefaultProvider,\n\ttype NodeSchemaOptions,\n\tmarkSchemaMostDerived,\n\ttype FieldSchemaAlpha,\n} from \"../schemaTypes.js\";\nimport type {\n\tNodeKind,\n\tWithType,\n\tTreeNodeSchema,\n\tTreeNodeSchemaClass,\n\tTreeNodeSchemaNonClass,\n\tTreeNodeSchemaBoth,\n} from \"../core/index.js\";\nimport { type TreeArrayNode, arraySchema } from \"../arrayNode.js\";\nimport {\n\ttype InsertableObjectFromSchemaRecord,\n\ttype TreeObjectNode,\n\tobjectSchema,\n} from \"../objectNode.js\";\nimport { type MapNodeInsertableData, type TreeMapNode, mapSchema } from \"../mapNode.js\";\nimport type {\n\tFieldSchemaUnsafe,\n\t// Adding these unused imports makes the generated d.ts file produced by TypeScript stop breaking API-Extractor's rollup generation.\n\t// Without this import, TypeScript generates inline `import(\"../..\")` statements in the d.ts file,\n\t// which API-Extractor leaves as is when generating the rollup, leaving them pointing at the wrong directory.\n\t// API-Extractor issue: https://github.com/microsoft/rushstack/issues/4507\n\t// eslint-disable-next-line unused-imports/no-unused-imports, @typescript-eslint/no-unused-vars\n\tFieldHasDefaultUnsafe,\n\t// eslint-disable-next-line unused-imports/no-unused-imports, @typescript-eslint/no-unused-vars\n\tInsertableTreeFieldFromImplicitFieldUnsafe,\n\tInsertableObjectFromSchemaRecordUnsafe,\n\tInsertableTreeNodeFromImplicitAllowedTypesUnsafe,\n\tTreeArrayNodeUnsafe,\n\tTreeMapNodeUnsafe,\n\tTreeObjectNodeUnsafe,\n\tImplicitAllowedTypesUnsafe,\n\tImplicitFieldSchemaUnsafe,\n\tFieldSchemaAlphaUnsafe,\n} from \"./typesUnsafe.js\";\nimport { createFieldSchemaUnsafe } from \"./schemaFactoryRecursive.js\";\nimport { isLazy } from \"../flexList.js\";\n\n/**\n * Gets the leaf domain schema compatible with a given {@link TreeValue}.\n */\nexport function schemaFromValue(value: TreeValue): TreeNodeSchema {\n\tswitch (typeof value) {\n\t\tcase \"boolean\":\n\t\t\treturn booleanSchema;\n\t\tcase \"number\":\n\t\t\treturn numberSchema;\n\t\tcase \"string\":\n\t\t\treturn stringSchema;\n\t\tcase \"object\": {\n\t\t\tif (value === null) {\n\t\t\t\treturn nullSchema;\n\t\t\t}\n\t\t\tassert(isFluidHandle(value), 0x87e /* invalid TreeValue */);\n\t\t\treturn handleSchema;\n\t\t}\n\t\tdefault:\n\t\t\tunreachableCase(value);\n\t}\n}\n\n/**\n * Options when declaring an {@link SchemaFactory.object|object node}'s schema\n *\n * @alpha\n */\nexport interface SchemaFactoryObjectOptions<TCustomMetadata = unknown>\n\textends NodeSchemaOptions<TCustomMetadata> {\n\t/**\n\t * Allow nodes typed with this object node schema to contain optional fields that are not present in the schema declaration.\n\t * Such nodes can come into existence either via import APIs (see remarks) or by way of collaboration with another client\n\t * that has upgraded the document's schema to include those optional fields.\n\t *\n\t * @defaultValue `false`\n\t * @remarks\n\t * The advantage of enabling this option is that it allows an application ecosystem with staged rollout to more quickly\n\t * upgrade documents to include schema for new optional features.\n\t *\n\t * However, it does come with trade-offs that applications should weigh carefully when it comes to interactions between\n\t * code and documents.\n\t * When opening such documents, the API presented is still determined by the view schema.\n\t * This can have implications on the behavior of edits or code which uses portions of the view schema,\n\t * since this may inadvertently drop data which is present in those optional fields in the document schema.\n\t *\n\t * Consider the following example:\n\t *\n\t * ```typescript\n\t * const sf = new SchemaFactory(\"com.example\");\n\t * class PersonView extends sf.object(\"Person\", { name: sf.string }, { allowUnknownOptionalFields: true }) {}\n\t * class PersonStored extends sf.object(\"Person\", { name: sf.string, nickname: sf.optional(sf.string) }) {}\n\t *\n\t * // Say we have a document which uses `PersonStored` in its schema, and application code constructs\n\t * // a tree view using `PersonView`. If the application for some reason had implemented a function like this:\n\t * function clonePerson(a: PersonView): PersonView {\n\t * \treturn new PersonView({ name: a.name });\n\t * }\n\t * // ...or even like this:\n\t * function clonePerson(a: PersonView): PersonView {\n\t * return new PersonView({ ...a})\n\t * }\n\t * // Then the alleged clone wouldn't actually clone the entire person in either case, it would drop the nickname.\n\t * ```\n\t *\n\t * If an application wants to be particularly careful to preserve all data on a node when editing it, it can use\n\t * {@link TreeAlpha.importVerbose|import}/{@link TreeAlpha.exportVerbose|export} APIs with persistent keys.\n\t *\n\t * Note that public API methods which operate on entire nodes (such as `moveTo`, `moveToEnd`, etc. on arrays) do not encounter\n\t * this problem as SharedTree's implementation stores the entire node in its lower layers. It's only when application code\n\t * reaches into a node (either by accessing its fields, spreading it, or some other means) that this problem arises.\n\t */\n\tallowUnknownOptionalFields?: boolean;\n}\n\nexport const defaultSchemaFactoryObjectOptions: Required<\n\tOmit<SchemaFactoryObjectOptions, \"metadata\">\n> = {\n\tallowUnknownOptionalFields: false,\n};\n\n/**\n * The name of a schema produced by {@link SchemaFactory}, including its optional scope prefix.\n *\n * @system @public\n */\nexport type ScopedSchemaName<\n\tTScope extends string | undefined,\n\tTName extends number | string,\n> = TScope extends undefined ? `${TName}` : `${TScope}.${TName}`;\n// > = `${TScope extends undefined ? \"\" : `${TScope}.`}${TName}`;\n\n/**\n * Stateless APIs exposed via {@link SchemaFactory} as both instance properties and as statics.\n * @privateRemarks\n * We have no way to make linkable members which exist both as statics and instance properties since API-Extractor does not support this.\n * As a workaround, we have this type as a third place which can be linked.\n * @system @sealed @public\n */\nexport interface SchemaStatics {\n\t/**\n\t * {@link TreeNodeSchema} for holding a JavaScript `string`.\n\t *\n\t * @remarks\n\t * Strings containing unpaired UTF-16 surrogate pair code units may not be handled correctly.\n\t *\n\t * These limitations come from the use of UTF-8 encoding of the strings, which requires them to be valid unicode.\n\t * JavaScript does not make this requirement for its strings so not all possible JavaScript strings are supported.\n\t * @privateRemarks\n\t * TODO:\n\t * We should be much more clear about what happens if you use problematic values.\n\t * We should validate and/or normalize them when inserting content.\n\t */\n\treadonly string: LeafSchema<\"string\", string>;\n\n\t/**\n\t * {@link TreeNodeSchema} for holding a JavaScript `number`.\n\t *\n\t * @remarks\n\t * The number is a {@link https://en.wikipedia.org/wiki/Double-precision_floating-point_format | double-precision 64-bit binary format IEEE 754} value, however there are some exceptions:\n\t * - `NaN`, and the infinities are converted to `null` (and may therefore only be used where `null` is allowed by the schema).\n\t * - `-0` may be converted to `0` in some cases.\n\t *\n\t * These limitations match the limitations of JSON.\n\t * @privateRemarks\n\t * TODO:\n\t * We should be much more clear about what happens if you use problematic values.\n\t * We should validate and/or normalize them when inserting content.\n\t */\n\treadonly number: LeafSchema<\"number\", number>;\n\n\t/**\n\t * {@link TreeNodeSchema} for holding a boolean.\n\t */\n\treadonly boolean: LeafSchema<\"boolean\", boolean>;\n\n\t/**\n\t * {@link TreeNodeSchema} for JavaScript `null`.\n\t *\n\t * @remarks\n\t * There are good {@link https://www.npmjs.com/package/%40rushstack/eslint-plugin#rushstackno-new-null | reasons to avoid using null} in JavaScript, however sometimes it is desired.\n\t * This {@link TreeNodeSchema} node provides the option to include nulls in trees when desired.\n\t * Unless directly inter-operating with existing data using null, consider other approaches, like wrapping the value in an optional field, or using a more specifically named empty object node.\n\t */\n\t// eslint-disable-next-line @rushstack/no-new-null\n\treadonly null: LeafSchema<\"null\", null>;\n\n\t/**\n\t * {@link TreeNodeSchema} for holding an {@link @fluidframework/core-interfaces#(IFluidHandle:interface)}.\n\t */\n\treadonly handle: LeafSchema<\"handle\", IFluidHandle>;\n\n\t/**\n\t * {@link AllowedTypes} for holding any of the leaf types.\n\t */\n\treadonly leaves: readonly [\n\t\tSchemaStatics[\"string\"],\n\t\tSchemaStatics[\"number\"],\n\t\tSchemaStatics[\"boolean\"],\n\t\tSchemaStatics[\"null\"],\n\t\tSchemaStatics[\"handle\"],\n\t];\n\n\t/**\n\t * Make a field optional instead of the default, which is required.\n\t *\n\t * @param t - The types allowed under the field.\n\t * @param props - Optional properties to associate with the field.\n\t *\n\t * @typeParam TCustomMetadata - Custom metadata properties to associate with the field.\n\t * See {@link FieldSchemaMetadata.custom}.\n\t */\n\treadonly optional: <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(\n\t\tt: T,\n\t\tprops?: Omit<FieldProps<TCustomMetadata>, \"defaultProvider\">,\n\t) => FieldSchema<FieldKind.Optional, T, TCustomMetadata>;\n\n\t/**\n\t * Make a field explicitly required.\n\t *\n\t * @param t - The types allowed under the field.\n\t * @param props - Optional properties to associate with the field.\n\t *\n\t * @remarks\n\t * Fields are required by default, but this API can be used to make the required nature explicit in the schema,\n\t * and allows associating custom {@link FieldProps | properties} with the field.\n\t *\n\t * @typeParam TCustomMetadata - Custom metadata properties to associate with the field.\n\t * See {@link FieldSchemaMetadata.custom}.\n\t */\n\treadonly required: <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(\n\t\tt: T,\n\t\tprops?: Omit<FieldProps<TCustomMetadata>, \"defaultProvider\">,\n\t) => FieldSchema<FieldKind.Required, T, TCustomMetadata>;\n\n\t/**\n\t * {@link SchemaStatics.optional} except tweaked to work better for recursive types.\n\t * Use with {@link ValidateRecursiveSchema} for improved type safety.\n\t * @remarks\n\t * This version of {@link SchemaStatics.optional} has fewer type constraints to work around TypeScript limitations, see {@link Unenforced}.\n\t * See {@link ValidateRecursiveSchema} for additional information about using recursive schema.\n\t */\n\treadonly optionalRecursive: <\n\t\tconst T extends ImplicitAllowedTypesUnsafe,\n\t\tconst TCustomMetadata = unknown,\n\t>(\n\t\tt: T,\n\t\tprops?: Omit<FieldProps<TCustomMetadata>, \"defaultProvider\">,\n\t) => FieldSchemaUnsafe<FieldKind.Optional, T, TCustomMetadata>;\n\n\t/**\n\t * {@link SchemaStatics.required} except tweaked to work better for recursive types.\n\t * Use with {@link ValidateRecursiveSchema} for improved type safety.\n\t * @remarks\n\t * This version of {@link SchemaStatics.required} has fewer type constraints to work around TypeScript limitations, see {@link Unenforced}.\n\t * See {@link ValidateRecursiveSchema} for additional information about using recursive schema.\n\t */\n\treadonly requiredRecursive: <\n\t\tconst T extends ImplicitAllowedTypesUnsafe,\n\t\tconst TCustomMetadata = unknown,\n\t>(\n\t\tt: T,\n\t\tprops?: Omit<FieldProps<TCustomMetadata>, \"defaultProvider\">,\n\t) => FieldSchemaUnsafe<FieldKind.Required, T, TCustomMetadata>;\n}\n\nconst defaultOptionalProvider: DefaultProvider = getDefaultProvider(() => {\n\treturn undefined;\n});\n\n/**\n * Implementation of {@link SchemaStatics}.\n * @remarks\n * Entries can use more specific types than {@link SchemaStatics} requires to be more useful for non-public consumers.\n * Additional non-public members are in {@link schemaStatics}.\n */\nexport const schemaStaticsBase = {\n\tstring: stringSchema,\n\tnumber: numberSchema,\n\tboolean: booleanSchema,\n\tnull: nullSchema,\n\thandle: handleSchema,\n\tleaves: [stringSchema, numberSchema, booleanSchema, nullSchema, handleSchema],\n\n\toptional: <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(\n\t\tt: T,\n\t\tprops?: Omit<FieldProps<TCustomMetadata>, \"defaultProvider\">,\n\t): FieldSchemaAlpha<FieldKind.Optional, T, TCustomMetadata> => {\n\t\treturn createFieldSchema(FieldKind.Optional, t, {\n\t\t\tdefaultProvider: defaultOptionalProvider,\n\t\t\t...props,\n\t\t});\n\t},\n\n\trequired: <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(\n\t\tt: T,\n\t\tprops?: Omit<FieldProps<TCustomMetadata>, \"defaultProvider\">,\n\t): FieldSchemaAlpha<FieldKind.Required, T, TCustomMetadata> => {\n\t\treturn createFieldSchema(FieldKind.Required, t, props);\n\t},\n\n\toptionalRecursive: <\n\t\tconst T extends ImplicitAllowedTypesUnsafe,\n\t\tconst TCustomMetadata = unknown,\n\t>(\n\t\tt: T,\n\t\tprops?: Omit<FieldProps<TCustomMetadata>, \"defaultProvider\">,\n\t): FieldSchemaAlphaUnsafe<FieldKind.Optional, T, TCustomMetadata> => {\n\t\treturn createFieldSchemaUnsafe(FieldKind.Optional, t, {\n\t\t\tdefaultProvider: defaultOptionalProvider,\n\t\t\t...props,\n\t\t});\n\t},\n\n\trequiredRecursive: <\n\t\tconst T extends ImplicitAllowedTypesUnsafe,\n\t\tconst TCustomMetadata = unknown,\n\t>(\n\t\tt: T,\n\t\tprops?: Omit<FieldProps<TCustomMetadata>, \"defaultProvider\">,\n\t): FieldSchemaAlphaUnsafe<FieldKind.Required, T, TCustomMetadata> => {\n\t\treturn createFieldSchemaUnsafe(FieldKind.Required, t, props);\n\t},\n} as const satisfies SchemaStatics;\n\n/**\n * Unstable extensions to {@link schemaStaticsBase}.\n */\nexport const schemaStatics = {\n\t...schemaStaticsBase,\n\tidentifier: <const TCustomMetadata = unknown>(\n\t\tprops?: Omit<FieldProps<TCustomMetadata>, \"defaultProvider\">,\n\t): FieldSchemaAlpha<FieldKind.Identifier, typeof stringSchema, TCustomMetadata> => {\n\t\treturn createFieldSchema(FieldKind.Identifier, stringSchema, props);\n\t},\n} as const;\n\nconst schemaStaticsPublic: SchemaStatics = schemaStatics;\n\n// TODO:\n// SchemaFactory.array references should link to the correct overloads, however the syntax for this does not seems to work currently for methods unless the they are not qualified with the class.\n// API-Extractor requires such links to be qualified with the class, so it can't work.\n// Since linking the overload set as a whole also doesn't work, these have been made non-links for now.\n/**\n * Creates various types of {@link TreeNodeSchema|schema} for {@link TreeNode}s.\n *\n * @typeParam TScope - Scope added as a prefix to the name of every schema produced by this factory.\n * @typeParam TName - Type of names used to identify each schema produced in this factory.\n * Typically this is just `string` but it is also possible to use `string` or `number` based enums if you prefer to identify your types that way.\n *\n * @remarks\n * For details related to inputting data constrained by schema (including via assignment), and how non-exact schema types are handled in general refer to {@link Input}.\n * For information about recursive schema support, see methods postfixed with \"recursive\" and {@link ValidateRecursiveSchema}.\n * To apply schema defined with this factory to a tree, see {@link ViewableTree.viewWith} and {@link TreeViewConfiguration}.\n *\n * All schema produced by this factory get a {@link TreeNodeSchemaCore.identifier|unique identifier} by combining the {@link SchemaFactory.scope} with the schema's `Name`.\n * The `Name` part may be explicitly provided as a parameter, or inferred as a structural combination of the provided types.\n * The APIs which use this second approach, structural naming, also deduplicate all equivalent calls.\n * Therefor two calls to `array(allowedTypes)` with the same allowedTypes will return the same {@link TreeNodeSchema} instance.\n * On the other hand, two calls to `array(name, allowedTypes)` will always return different {@link TreeNodeSchema} instances\n * and it is an error to use both in the same tree (since their identifiers are not unique).\n *\n * For \"customizable\" schema (those which can be subclassed to customize them, see details below) some additional rules must be followed:\n *\n * 1. Only a single {@link TreeNodeSchema|schema} can be used from the class hierarchy deriving from the base class produced by this factory.\n * It is legal to subclass the returned class, and even subclass that class,\n * but only a single class from that class hierarchy can ever be instantiated or passed to any API as a {@link TreeNodeSchema|schema}.\n * These base classes can be used with `instanceof`, but not with schema based APIs like `Tree.is`.\n * 2. If overriding the constructor, the constructor must accept the same argument as the base constructor `super` and forward it to `super` unchanged.\n * 3. Properties for fields defined in the schema should not be overridden.\n * 4. Additional static members added to schema should pick relatively unique keys to reduce the risk of colliding with implementation details what are not exposed in the API.\n * 5. If exporting the schema from a package which uses API-Extractor, export the base class and derived class separately to work around [a known limitation](https://github.com/microsoft/rushstack/issues/4429).\n *\n * Note:\n * POJO stands for Plain Old JavaScript Object.\n * This means an object that works like a `{}` style object literal.\n * In this case it means the prototype is `Object.prototype` and acts like a set of key value pairs (data, not methods).\n * The usage below generalizes this to include array and map like objects as well.\n *\n * There are two ways to use these APIs:\n *\n * Customizable Approach:\n *\n * 1. Declaration: `class X extends schemaFactory.object(\"x\", {}) {}`\n *\n * 2. Allows adding \"local\" (non-persisted) members: Yes. Members (including methods) can be added to the class.\n *\n * 3. Prototype: The user-defined class.\n *\n * 4. Structurally named Schema: Not Supported.\n *\n * 5. Explicitly named Objects: Supported.\n *\n * 6. Explicitly named Maps and Arrays: Supported: Both declaration approaches can be used.\n *\n * 7. Node.js `assert.deepEqual`: Compares like class instances: equal to other nodes of the same type with the same content, including custom local fields.\n *\n * 8. IntelliSense: Shows and links to user-defined class by name: `X`.\n *\n * 9. Recursion: Supported with special declaration patterns.\n *\n * POJO Emulation Approach:\n *\n * 1. Declaration: `const X = schemaFactory.object(\"x\", {}); type X = NodeFromSchema<typeof X>;`\n *\n * 2. Allows adding \"local\" (non-persisted) members: No. Attempting to set non-field members will result in an error.\n *\n * 3. Prototype: `Object.prototype`, `Map.prototype`, or `Array.prototype` depending on node kind.\n *\n * 4. Structurally named Schema: Supported.\n *\n * 5. Explicitly named Objects: Supported.\n *\n * 6. Explicitly named Maps and Arrays: Not Supported.\n *\n * 7. Node.js `assert.deepEqual`: Compares like plain objects: equal to plain JavaScript objects with the same fields, and other nodes with the same fields, even if the types are different.\n *\n * 8. IntelliSense: Shows internal type generation logic: `object & TreeNode & ObjectFromSchemaRecord<{}> & WithType<\"test.x\">`.\n *\n * 9. Recursion: Unsupported: [Generated `.d.ts` files replace recursive references with `any`](https://github.com/microsoft/TypeScript/issues/55832),\n * breaking the use of recursive schema across compilation boundaries.\n *\n * Note that while \"POJO Emulation\" nodes act a lot like POJO objects, they are not true POJO objects:\n *\n * - Adding new arbitrary fields will error, as well some cases of invalid edits.\n *\n * - They are implemented using proxies.\n *\n * - They have state that is not exposed via enumerable own properties, including a {@link TreeNodeSchema}.\n * This makes libraries like node.js `assert.deepEqual` fail to detect differences in type.\n *\n * - Assigning members has side effects (in this case editing the persisted/shared tree).\n *\n * - Not all operations implied by the prototype will work correctly: stick to the APIs explicitly declared in the TypeScript types.\n *\n * @privateRemarks\n * It's perfectly possible to make `POJO Emulation` mode (or even just hiding the prototype) selectable even when using the custom user class declaration syntax.\n * When doing this, it's still possible to make `instanceof` perform correctly.\n * Allowing (or banning) custom/out-of-schema properties on the class is also possible in both modes: it could be orthogonal.\n * Also for consistency, if keeping the current approach to detecting `POJO Emulation` mode it might make sense to make explicitly named Maps and Arrays do the detection the same as how object does it.\n *\n * Note: the comparison between the customizable and POJO modes is not done in a table because TSDoc does not currently have support for embedded markdown.\n *\n * @see {@link SchemaFactoryAlpha}\n *\n * @sealed @public\n */\nexport class SchemaFactory<\n\tout TScope extends string | undefined = string | undefined,\n\tTName extends number | string = string,\n> implements SchemaStatics\n{\n\t/**\n\t * TODO:\n\t * If users of this generate the same name because two different schema with the same identifier were used,\n\t * the second use can get a cache hit, and reference the wrong schema.\n\t * Such usage should probably return a distinct type or error but currently does not.\n\t * The use of markSchemaMostDerived in structuralName at least ensure an error in the case where the collision is from two types extending the same schema factor class.\n\t */\n\tprivate readonly structuralTypes: Map<string, TreeNodeSchema> = new Map();\n\n\t/**\n\t * Construct a SchemaFactory with a given {@link SchemaFactory.scope|scope}.\n\t * @remarks\n\t * There are no restrictions on mixing schema from different schema factories.\n\t * Typically each library will create one or more SchemaFactories and use them to define its schema.\n\t */\n\tpublic constructor(\n\t\t/**\n\t\t * Prefix appended to the identifiers of all {@link TreeNodeSchema} produced by this builder.\n\t\t *\n\t\t * @remarks\n\t\t * Generally each independently developed library\n\t\t * (possibly a package, but could also be part of a package or multiple packages developed together)\n\t\t * should get its own unique `scope`.\n\t\t * Then each schema in the library get a name which is unique within the library.\n\t\t * The scope and name are joined (with a period) to form the {@link TreeNodeSchemaCore.identifier|schema identifier}.\n\t\t * Following this pattern allows a single application to depend on multiple libraries which define their own schema, and use them together in a single tree without risk of collisions.\n\t\t * If a library logically contains sub-libraries with their own schema, they can be given a scope nested inside the parent scope, such as \"ParentScope.ChildScope\".\n\t\t *\n\t\t * To avoid collisions between the scopes of libraries\n\t\t * it is recommended that the libraries use {@link https://en.wikipedia.org/wiki/Reverse_domain_name_notation | Reverse domain name notation} or a UUIDv4 for their scope.\n\t\t * If this pattern is followed, application can safely use third party libraries without risk of the schema in them colliding.\n\t\t *\n\t\t * You may opt out of using a scope by passing `undefined`, but note that this increases the risk of collisions.\n\t\t *\n\t\t * @example\n\t\t * Fluid Framework follows this pattern, placing the schema for the built in leaf types in the `com.fluidframework.leaf` scope.\n\t\t * If Fluid Framework publishes more schema in the future, they would be under some other `com.fluidframework` scope.\n\t\t * This ensures that any schema defined by any other library will not conflict with Fluid Framework's schema\n\t\t * as long as the library uses the recommended patterns for how to scope its schema..\n\t\t *\n\t\t * @example\n\t\t * A library could generate a random UUIDv4, like `242c4397-49ed-47e6-8dd0-d5c3bc31778b` and use that as the scope.\n\t\t * Note: do not use this UUID: a new one must be randomly generated when needed to ensure collision resistance.\n\t\t * ```typescript\n\t\t * const factory = new SchemaFactory(\"242c4397-49ed-47e6-8dd0-d5c3bc31778b\");\n\t\t * ```\n\t\t */\n\t\tpublic readonly scope: TScope,\n\t) {}\n\n\tprivate scoped<Name extends TName | string>(name: Name): ScopedSchemaName<TScope, Name> {\n\t\treturn (\n\t\t\tthis.scope === undefined ? `${name}` : `${this.scope}.${name}`\n\t\t) as ScopedSchemaName<TScope, Name>;\n\t}\n\n\t/**\n\t * {@inheritDoc SchemaStatics.string}\n\t */\n\tpublic readonly string = schemaStaticsPublic.string;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.number}\n\t */\n\tpublic readonly number = schemaStaticsPublic.number;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.boolean}\n\t */\n\tpublic readonly boolean = schemaStaticsPublic.boolean;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.null}\n\t */\n\tpublic readonly null = schemaStaticsPublic.null;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.handle}\n\t */\n\tpublic readonly handle = schemaStaticsPublic.handle;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.leaves}\n\t */\n\tpublic readonly leaves = schemaStaticsPublic.leaves;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.string}\n\t */\n\tpublic static readonly string = schemaStaticsPublic.string;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.number}\n\t */\n\tpublic static readonly number = schemaStaticsPublic.number;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.boolean}\n\t */\n\tpublic static readonly boolean = schemaStaticsPublic.boolean;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.null}\n\t */\n\tpublic static readonly null = schemaStaticsPublic.null;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.handle}\n\t */\n\tpublic static readonly handle = schemaStaticsPublic.handle;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.leaves}\n\t */\n\tpublic static readonly leaves = schemaStaticsPublic.leaves;\n\n\t/**\n\t * Define a {@link TreeNodeSchemaClass} for a {@link TreeObjectNode}.\n\t *\n\t * @param name - Unique identifier for this schema within this factory's scope.\n\t * @param fields - Schema for fields of the object node's schema. Defines what children can be placed under each key.\n\t */\n\tpublic object<\n\t\tconst Name extends TName,\n\t\tconst T extends RestrictiveStringRecord<ImplicitFieldSchema>,\n\t>(\n\t\tname: Name,\n\t\tfields: T,\n\t): TreeNodeSchemaClass<\n\t\tScopedSchemaName<TScope, Name>,\n\t\tNodeKind.Object,\n\t\tTreeObjectNode<T, ScopedSchemaName<TScope, Name>>,\n\t\tobject & InsertableObjectFromSchemaRecord<T>,\n\t\ttrue,\n\t\tT\n\t> {\n\t\treturn objectSchema(\n\t\t\tthis.scoped(name),\n\t\t\tfields,\n\t\t\ttrue,\n\t\t\tdefaultSchemaFactoryObjectOptions.allowUnknownOptionalFields,\n\t\t);\n\t}\n\n\t/**\n\t * Define a structurally typed {@link TreeNodeSchema} for a {@link TreeMapNode}.\n\t *\n\t * @param allowedTypes - The types that may appear as values in the map.\n\t *\n\t * @remarks\n\t * The unique identifier for this Map is defined as a function of the provided types.\n\t * It is still scoped to this SchemaBuilder, but multiple calls with the same arguments will return the same schema object, providing somewhat structural typing.\n\t * This does not support recursive types.\n\t *\n\t * If using these structurally named maps, other types in this schema builder should avoid names of the form `Map<${string}>`.\n\t *\n\t * @example\n\t * The returned schema should be used as a schema directly:\n\t * ```typescript\n\t * const MyMap = factory.map(factory.number);\n\t * type MyMap = NodeFromSchema<typeof MyMap>;\n\t * ```\n\t * Or inline:\n\t * ```typescript\n\t * factory.object(\"Foo\", {myMap: factory.map(factory.number)});\n\t * ```\n\t * @privateRemarks\n\t * See note on array.\n\t */\n\tpublic map<const T extends TreeNodeSchema | readonly TreeNodeSchema[]>(\n\t\tallowedTypes: T,\n\t): TreeNodeSchemaNonClass<\n\t\tScopedSchemaName<TScope, `Map<${string}>`>,\n\t\tNodeKind.Map,\n\t\tTreeMapNode<T> & WithType<ScopedSchemaName<TScope, `Map<${string}>`>, NodeKind.Map>,\n\t\tMapNodeInsertableData<T>,\n\t\ttrue,\n\t\tT,\n\t\tundefined\n\t>;\n\n\t/**\n\t * Define a {@link TreeNodeSchema} for a {@link TreeMapNode}.\n\t *\n\t * @param name - Unique identifier for this schema within this factory's scope.\n\t * @param allowedTypes - The types that may appear as values in the map.\n\t *\n\t * @example\n\t * ```typescript\n\t * class NamedMap extends factory.map(\"name\", factory.number) {}\n\t * ```\n\t */\n\tpublic map<Name extends TName, const T extends ImplicitAllowedTypes>(\n\t\tname: Name,\n\t\tallowedTypes: T,\n\t): TreeNodeSchemaClass<\n\t\tScopedSchemaName<TScope, Name>,\n\t\tNodeKind.Map,\n\t\tTreeMapNode<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Map>,\n\t\tMapNodeInsertableData<T>,\n\t\ttrue,\n\t\tT,\n\t\tundefined\n\t>;\n\n\t/**\n\t * {@link SchemaFactory.map} implementation.\n\t *\n\t * @privateRemarks\n\t * This should return `TreeNodeSchemaBoth`, however TypeScript gives an error if one of the overloads implicitly up-casts the return type of the implementation.\n\t * This seems like a TypeScript bug getting variance backwards for overload return types since it's erroring when the relation between the overload\n\t * and the implementation is type safe, and forcing an unsafe typing instead.\n\t */\n\tpublic map<const T extends ImplicitAllowedTypes>(\n\t\tnameOrAllowedTypes: TName | ((T & TreeNodeSchema) | readonly TreeNodeSchema[]),\n\t\tallowedTypes?: T,\n\t): TreeNodeSchema<string, NodeKind.Map, TreeMapNode<T>, MapNodeInsertableData<T>, true, T> {\n\t\tif (allowedTypes === undefined) {\n\t\t\tconst types = nameOrAllowedTypes as (T & TreeNodeSchema) | readonly TreeNodeSchema[];\n\t\t\tconst fullName = structuralName(\"Map\", types);\n\t\t\treturn getOrCreate(\n\t\t\t\tthis.structuralTypes,\n\t\t\t\tfullName,\n\t\t\t\t() =>\n\t\t\t\t\tthis.namedMap(\n\t\t\t\t\t\tfullName as TName,\n\t\t\t\t\t\tnameOrAllowedTypes as T,\n\t\t\t\t\t\tfalse,\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t) as TreeNodeSchema,\n\t\t\t) as TreeNodeSchemaBoth<\n\t\t\t\tstring,\n\t\t\t\tNodeKind.Map,\n\t\t\t\tTreeMapNode<T>,\n\t\t\t\tMapNodeInsertableData<T>,\n\t\t\t\ttrue,\n\t\t\t\tT,\n\t\t\t\tundefined\n\t\t\t>;\n\t\t}\n\t\t// To actually have type safety, assign to the type this method should return before implicitly upcasting when returning.\n\t\tconst out: TreeNodeSchemaBoth<\n\t\t\tstring,\n\t\t\tNodeKind.Map,\n\t\t\tTreeMapNode<T>,\n\t\t\tMapNodeInsertableData<T>,\n\t\t\ttrue,\n\t\t\tT,\n\t\t\tundefined\n\t\t> = this.namedMap(nameOrAllowedTypes as TName, allowedTypes, true, true);\n\t\treturn out;\n\t}\n\n\t/**\n\t * Define a {@link TreeNodeSchema} for a {@link (TreeMapNode:interface)}.\n\t *\n\t * @param name - Unique identifier for this schema within this factory's scope.\n\t */\n\tprivate namedMap<\n\t\tName extends TName | string,\n\t\tconst T extends ImplicitAllowedTypes,\n\t\tconst ImplicitlyConstructable extends boolean,\n\t>(\n\t\tname: Name,\n\t\tallowedTypes: T,\n\t\tcustomizable: boolean,\n\t\timplicitlyConstructable: ImplicitlyConstructable,\n\t): TreeNodeSchemaBoth<\n\t\tScopedSchemaName<TScope, Name>,\n\t\tNodeKind.Map,\n\t\tTreeMapNode<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Map>,\n\t\tMapNodeInsertableData<T>,\n\t\tImplicitlyConstructable,\n\t\tT,\n\t\tundefined\n\t> {\n\t\treturn mapSchema(\n\t\t\tthis.scoped(name),\n\t\t\tallowedTypes,\n\t\t\timplicitlyConstructable,\n\t\t\t// The current policy is customizable nodes don't get fake prototypes.\n\t\t\t!customizable,\n\t\t\tundefined,\n\t\t);\n\t}\n\n\t/**\n\t * Define a structurally typed {@link TreeNodeSchema} for a {@link (TreeArrayNode:interface)}.\n\t *\n\t * @param allowedTypes - The types that may appear in the array.\n\t *\n\t * @remarks\n\t * The identifier for this Array is defined as a function of the provided types.\n\t * It is still scoped to this SchemaFactory, but multiple calls with the same arguments will return the same schema object, providing somewhat structural typing.\n\t * This does not support recursive types.\n\t *\n\t * If using these structurally named arrays, other types in this schema builder should avoid names of the form `Array<${string}>`.\n\t *\n\t * @example\n\t * The returned schema should be used as a schema directly:\n\t * ```typescript\n\t * const MyArray = factory.array(factory.number);\n\t * type MyArray = NodeFromSchema<typeof MyArray>;\n\t * ```\n\t * Or inline:\n\t * ```typescript\n\t * factory.object(\"Foo\", {myArray: factory.array(factory.number)});\n\t * ```\n\t * @privateRemarks\n\t * The name produced at the type level here is not as specific as it could be, however doing type level sorting and escaping is a real mess.\n\t * There are cases where not having this full type provided will be less than ideal since TypeScript's structural types.\n\t * For example attempts to narrow unions of structural arrays by name won't work.\n\t * Planned future changes to move to a class based schema system as well as factor function based node construction should mostly avoid these issues,\n\t * though there may still be some problematic cases even after that work is done.\n\t *\n\t * The return value is a class, but its the type is intentionally not specific enough to indicate it is a class.\n\t * This prevents callers of this from sub-classing it, which is unlikely to work well (due to the ease of accidentally giving two different calls o this different subclasses)\n\t * when working with structural typing.\n\t *\n\t * {@label STRUCTURAL}\n\t */\n\tpublic array<const T extends TreeNodeSchema | readonly TreeNodeSchema[]>(\n\t\tallowedTypes: T,\n\t): TreeNodeSchemaNonClass<\n\t\tScopedSchemaName<TScope, `Array<${string}>`>,\n\t\tNodeKind.Array,\n\t\tTreeArrayNode<T> & WithType<ScopedSchemaName<TScope, `Array<${string}>`>, NodeKind.Array>,\n\t\tIterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>,\n\t\ttrue,\n\t\tT,\n\t\tundefined\n\t>;\n\n\t/**\n\t * Define (and add to this library) a {@link TreeNodeSchemaClass} for a {@link (TreeArrayNode:interface)}.\n\t *\n\t * @param name - Unique identifier for this schema within this factory's scope.\n\t * @param allowedTypes - The types that may appear in the array.\n\t *\n\t * @example\n\t * ```typescript\n\t * class NamedArray extends factory.array(\"name\", factory.number) {}\n\t * ```\n\t *\n\t * {@label NAMED}\n\t */\n\tpublic array<const Name extends TName, const T extends ImplicitAllowedTypes>(\n\t\tname: Name,\n\t\tallowedTypes: T,\n\t): TreeNodeSchemaClass<\n\t\tScopedSchemaName<TScope, Name>,\n\t\tNodeKind.Array,\n\t\tTreeArrayNode<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Array>,\n\t\tIterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>,\n\t\ttrue,\n\t\tT,\n\t\tundefined\n\t>;\n\n\t/**\n\t * {@link SchemaFactory.array} implementation.\n\t *\n\t * @privateRemarks\n\t * This should return TreeNodeSchemaBoth: see note on \"map\" implementation for details.\n\t */\n\tpublic array<const T extends ImplicitAllowedTypes>(\n\t\tnameOrAllowedTypes: TName | ((T & TreeNodeSchema) | readonly TreeNodeSchema[]),\n\t\tallowedTypes?: T,\n\t): TreeNodeSchema<\n\t\tScopedSchemaName<TScope, string>,\n\t\tNodeKind.Array,\n\t\tTreeArrayNode<T>,\n\t\tIterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>,\n\t\ttrue,\n\t\tT\n\t> {\n\t\tif (allowedTypes === undefined) {\n\t\t\tconst types = nameOrAllowedTypes as (T & TreeNodeSchema) | readonly TreeNodeSchema[];\n\t\t\tconst fullName = structuralName(\"Array\", types);\n\t\t\treturn getOrCreate(this.structuralTypes, fullName, () =>\n\t\t\t\tthis.namedArray(fullName, nameOrAllowedTypes as T, false, true),\n\t\t\t) as TreeNodeSchemaClass<\n\t\t\t\tScopedSchemaName<TScope, string>,\n\t\t\t\tNodeKind.Array,\n\t\t\t\tTreeArrayNode<T>,\n\t\t\t\tIterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>,\n\t\t\t\ttrue,\n\t\t\t\tT,\n\t\t\t\tundefined\n\t\t\t>;\n\t\t}\n\t\tconst out: TreeNodeSchemaBoth<\n\t\t\tScopedSchemaName<TScope, string>,\n\t\t\tNodeKind.Array,\n\t\t\tTreeArrayNode<T>,\n\t\t\tIterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>,\n\t\t\ttrue,\n\t\t\tT,\n\t\t\tundefined\n\t\t> = this.namedArray(nameOrAllowedTypes as TName, allowedTypes, true, true);\n\t\treturn out;\n\t}\n\n\t/**\n\t * Define a {@link TreeNodeSchema} for a {@link (TreeArrayNode:interface)}.\n\t *\n\t * @param name - Unique identifier for this schema within this factory's scope.\n\t *\n\t * @remarks\n\t * This is not intended to be used directly, use the overload of `array` which takes a name instead.\n\t * This is only public to work around a compiler limitation.\n\t */\n\tprivate namedArray<\n\t\tName extends TName | string,\n\t\tconst T extends ImplicitAllowedTypes,\n\t\tconst ImplicitlyConstructable extends boolean,\n\t>(\n\t\tname: Name,\n\t\tallowedTypes: T,\n\t\tcustomizable: boolean,\n\t\timplicitlyConstructable: ImplicitlyConstructable,\n\t): TreeNodeSchemaBoth<\n\t\tScopedSchemaName<TScope, Name>,\n\t\tNodeKind.Array,\n\t\tTreeArrayNode<T> & WithType<ScopedSchemaName<TScope, string>, NodeKind.Array>,\n\t\tIterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>,\n\t\tImplicitlyConstructable,\n\t\tT,\n\t\tundefined\n\t> {\n\t\treturn arraySchema(this.scoped(name), allowedTypes, implicitlyConstructable, customizable);\n\t}\n\n\t/**\n\t * {@inheritDoc SchemaStatics.optional}\n\t */\n\tpublic readonly optional = schemaStaticsPublic.optional;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.required}\n\t */\n\tpublic readonly required = schemaStaticsPublic.required;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.optionalRecursive}\n\t */\n\tpublic readonly optionalRecursive = schemaStaticsPublic.optionalRecursive;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.requiredRecursive}\n\t */\n\tpublic readonly requiredRecursive = schemaStaticsPublic.requiredRecursive;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.optional}\n\t */\n\tpublic static readonly optional = schemaStaticsPublic.optional;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.required}\n\t */\n\tpublic static readonly required = schemaStaticsPublic.required;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.optionalRecursive}\n\t */\n\tpublic static readonly optionalRecursive = schemaStaticsPublic.optionalRecursive;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.requiredRecursive}\n\t */\n\tpublic static readonly requiredRecursive = schemaStaticsPublic.requiredRecursive;\n\n\t/**\n\t * A special field which holds a unique identifier for an object node.\n\t * @remarks\n\t * The value of this field, a \"node identifier\", uniquely identifies a node among all other nodes in the tree.\n\t * Node identifiers are strings, and can therefore be used as lookup keys in maps or written to a database.\n\t * When the node is constructed, the identifier field does not need to be populated.\n\t * The SharedTree will provide an identifier for the node automatically.\n\t * An identifier provided automatically by the SharedTree has the following properties:\n\t * - It is a UUID.\n\t * - It is compressed to a space-efficient representation when stored in the document.\n\t * - A compressed form of the identifier can be accessed at runtime via the `Tree.shortId()` API.\n\t * - It will error if read (and will not be present in the object's iterable properties) before the node has been inserted into the tree.\n\t *\n\t * However, a user may alternatively supply their own string as the identifier if desired (for example, if importing identifiers from another system).\n\t * In that case, it is up to the user to ensure that the identifier is unique within the current tree - no other node should have the same identifier at the same time.\n\t * If the identifier is not unique, it may be read, but may cause libraries or features which operate over node identifiers to misbehave.\n\t * User-supplied identifiers may be read immediately, even before insertion into the tree.\n\t *\n\t * A node may have more than one identifier field (though note that this precludes the use of the `Tree.shortId()` API).\n\t */\n\tpublic get identifier(): FieldSchema<FieldKind.Identifier, typeof this.string> {\n\t\tconst defaultIdentifierProvider: DefaultProvider = getDefaultProvider(\n\t\t\t(nodeKeyManager: NodeIdentifierManager) => {\n\t\t\t\treturn nodeKeyManager.stabilizeNodeIdentifier(\n\t\t\t\t\tnodeKeyManager.generateLocalNodeIdentifier(),\n\t\t\t\t);\n\t\t\t},\n\t\t);\n\t\treturn createFieldSchema(FieldKind.Identifier, this.string, {\n\t\t\tdefaultProvider: defaultIdentifierProvider,\n\t\t});\n\t}\n\n\t/**\n\t * {@link SchemaFactory.object} except tweaked to work better for recursive types.\n\t * Use with {@link ValidateRecursiveSchema} for improved type safety.\n\t * @remarks\n\t * This version of {@link SchemaFactory.object} has fewer type constraints to work around TypeScript limitations, see {@link Unenforced}.\n\t * See {@link ValidateRecursiveSchema} for additional information about using recursive schema.\n\t *\n\t * Additionally `ImplicitlyConstructable` is disabled (forcing use of constructor) to avoid\n\t * `error TS2589: Type instantiation is excessively deep and possibly infinite.`\n\t * which otherwise gets reported at sometimes incorrect source locations that vary based on incremental builds.\n\t */\n\tpublic objectRecursive<\n\t\tconst Name extends TName,\n\t\tconst T extends RestrictiveStringRecord<ImplicitFieldSchemaUnsafe>,\n\t>(\n\t\tname: Name,\n\t\tt: T,\n\t): TreeNodeSchemaClass<\n\t\tScopedSchemaName<TScope, Name>,\n\t\tNodeKind.Object,\n\t\tTreeObjectNodeUnsafe<T, ScopedSchemaName<TScope, Name>>,\n\t\tobject & InsertableObjectFromSchemaRecordUnsafe<T>,\n\t\tfalse,\n\t\tT\n\t> {\n\t\ttype TScopedName = ScopedSchemaName<TScope, Name>;\n\t\treturn this.object(\n\t\t\tname,\n\t\t\tt as T & RestrictiveStringRecord<ImplicitFieldSchema>,\n\t\t) as unknown as TreeNodeSchemaClass<\n\t\t\tTScopedName,\n\t\t\tNodeKind.Object,\n\t\t\tTreeObjectNodeUnsafe<T, TScopedName>,\n\t\t\tobject & InsertableObjectFromSchemaRecordUnsafe<T>,\n\t\t\tfalse,\n\t\t\tT\n\t\t>;\n\t}\n\n\t/**\n\t * `SchemaFactory.array` except tweaked to work better for recursive types.\n\t * Use with {@link ValidateRecursiveSchema} for improved type safety.\n\t * @remarks\n\t * This version of `SchemaFactory.array` uses the same workarounds as {@link SchemaFactory.objectRecursive}.\n\t * See {@link ValidateRecursiveSchema} for additional information about using recursive schema.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n\tpublic arrayRecursive<const Name extends TName, const T extends ImplicitAllowedTypesUnsafe>(\n\t\tname: Name,\n\t\tallowedTypes: T,\n\t) {\n\t\tconst RecursiveArray = this.namedArray(\n\t\t\tname,\n\t\t\tallowedTypes as T & ImplicitAllowedTypes,\n\t\t\ttrue,\n\t\t\tfalse,\n\t\t);\n\n\t\treturn RecursiveArray as TreeNodeSchemaClass<\n\t\t\tScopedSchemaName<TScope, Name>,\n\t\t\tNodeKind.Array,\n\t\t\tTreeArrayNodeUnsafe<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Array>,\n\t\t\t{\n\t\t\t\t/**\n\t\t\t\t * Iterator for the iterable of content for this node.\n\t\t\t\t * @privateRemarks\n\t\t\t\t * Wrapping the constructor parameter for recursive arrays and maps in an inlined object type avoids (for unknown reasons)\n\t\t\t\t * the following compile error when declaring the recursive schema:\n\t\t\t\t * `Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions.`\n\t\t\t\t * To benefit from this without impacting the API, the definition of `Iterable` has been inlined as such an object.\n\t\t\t\t *\n\t\t\t\t * If this workaround is kept, ideally this comment would be deduplicated with the other instance of it.\n\t\t\t\t * Unfortunately attempts to do this failed to avoid the compile error this was introduced to solve.\n\t\t\t\t */\n\t\t\t\t[Symbol.iterator](): Iterator<InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>>;\n\t\t\t},\n\t\t\tfalse,\n\t\t\tT,\n\t\t\tundefined\n\t\t>;\n\t}\n\n\t/**\n\t * `SchemaFactory.map` except tweaked to work better for recursive types.\n\t * Use with {@link ValidateRecursiveSchema} for improved type safety.\n\t * @remarks\n\t * This version of `SchemaFactory.map` uses the same workarounds as {@link SchemaFactory.objectRecursive}.\n\t * See {@link ValidateRecursiveSchema} for additional information about using recursive schema.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n\tpublic mapRecursive<Name extends TName, const T extends ImplicitAllowedTypesUnsafe>(\n\t\tname: Name,\n\t\tallowedTypes: T,\n\t) {\n\t\tconst MapSchema = this.namedMap(\n\t\t\tname,\n\t\t\tallowedTypes as T & ImplicitAllowedTypes,\n\t\t\ttrue,\n\t\t\t// Setting this (implicitlyConstructable) to true seems to work ok currently, but not for other node kinds.\n\t\t\t// Supporting this could be fragile and might break other future changes, so it's being kept as false for now.\n\t\t\tfalse,\n\t\t);\n\n\t\treturn MapSchema as TreeNodeSchemaClass<\n\t\t\tScopedSchemaName<TScope, Name>,\n\t\t\tNodeKind.Map,\n\t\t\tTreeMapNodeUnsafe<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Map>,\n\t\t\t| {\n\t\t\t\t\t/**\n\t\t\t\t\t * Iterator for the iterable of content for this node.\n\t\t\t\t\t * @privateRemarks\n\t\t\t\t\t * Wrapping the constructor parameter for recursive arrays and maps in an inlined object type avoids (for unknown reasons)\n\t\t\t\t\t * the following compile error when declaring the recursive schema:\n\t\t\t\t\t * `Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions.`\n\t\t\t\t\t * To benefit from this without impacting the API, the definition of `Iterable` has been inlined as such an object.\n\t\t\t\t\t *\n\t\t\t\t\t * If this workaround is kept, ideally this comment would be deduplicated with the other instance of it.\n\t\t\t\t\t * Unfortunately attempts to do this failed to avoid the compile error this was introduced to solve.\n\t\t\t\t\t */\n\t\t\t\t\t[Symbol.iterator](): Iterator<\n\t\t\t\t\t\t[string, InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>]\n\t\t\t\t\t>;\n\t\t\t }\n\t\t\t// Ideally this would be\n\t\t\t// RestrictiveStringRecord<InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>>,\n\t\t\t// but doing so breaks recursive types.\n\t\t\t// Instead we do a less nice version:\n\t\t\t| {\n\t\t\t\t\treadonly [P in string]: InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>;\n\t\t\t },\n\t\t\tfalse,\n\t\t\tT,\n\t\t\tundefined\n\t\t>;\n\t}\n}\n\nexport function structuralName<const T extends string>(\n\tcollectionName: T,\n\tallowedTypes: TreeNodeSchema | readonly TreeNodeSchema[],\n): `${T}<${string}>` {\n\tlet inner: string;\n\tif (!isReadonlyArray(allowedTypes)) {\n\t\treturn structuralName(collectionName, [allowedTypes]);\n\t} else {\n\t\tconst names = allowedTypes.map((t): string => {\n\t\t\t// Ensure that lazy types (functions) don't slip through here.\n\t\t\tassert(!isLazy(t), 0x83d /* invalid type provided */);\n\t\t\tmarkSchemaMostDerived(t);\n\t\t\treturn t.identifier;\n\t\t});\n\t\t// Ensure name is order independent\n\t\tnames.sort();\n\t\t// Ensure name can't have collisions by quoting and escaping any quotes in the names of types.\n\t\t// Using JSON is a simple way to accomplish this.\n\t\t// The outer `[]` around the result were needed so that a single type name \"Any\" would not collide with the \"any\" case which used to exist.\n\t\tinner = JSON.stringify(names);\n\t}\n\treturn `${collectionName}<${inner}>`;\n}\n"]}
1
+ {"version":3,"file":"schemaFactory.js","sourceRoot":"","sources":["../../../src/simple-tree/api/schemaFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAE9E,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAIvE,OAAO,EAEN,WAAW,EACX,eAAe,GACf,MAAM,qBAAqB,CAAC;AAK7B,OAAO,EACN,aAAa,EACb,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,YAAY,GAEZ,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACN,SAAS,EAMT,iBAAiB,EAEjB,kBAAkB,EAElB,qBAAqB,GAErB,MAAM,mBAAmB,CAAC;AAS3B,OAAO,EAAsB,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,EAGN,YAAY,GACZ,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAgD,SAAS,EAAE,MAAM,eAAe,CAAC;AAExF,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExC;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,KAAgB;IAC/C,QAAQ,OAAO,KAAK,EAAE,CAAC;QACtB,KAAK,SAAS;YACb,OAAO,aAAa,CAAC;QACtB,KAAK,QAAQ;YACZ,OAAO,YAAY,CAAC;QACrB,KAAK,QAAQ;YACZ,OAAO,YAAY,CAAC;QACrB,KAAK,QAAQ,CAAC,CAAC,CAAC;YACf,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;gBACpB,OAAO,UAAU,CAAC;YACnB,CAAC;YACD,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,uBAAuB,CAAC,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AO,cAAc,CAAC,cAAc,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;IACvD,CAAC;SAAM,CAAC;QACP,MAAM,KAAK,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,EAAU,EAAE;YAC5C,8DAA8D;YAC9D,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,2BAA2B,CAAC,CAAC;YACtD,qBAAqB,CAAC,CAAC,CAAC,CAAC;YACzB,OAAO,CAAC,CAAC,UAAU,CAAC;QACrB,CAAC,CAAC,CAAC;QACH,mCAAmC;QACnC,KAAK,CAAC,IAAI,EAAE,CAAC;QACb,8FAA8F;QAC9F,iDAAiD;QACjD,2IAA2I;QAC3I,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;IACD,OAAO,GAAG,cAAc,IAAI,KAAK,GAAG,CAAC;AACtC,CAAC","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 type { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport { isFluidHandle } from \"@fluidframework/runtime-utils/internal\";\n\nimport type { TreeValue } from \"../../core/index.js\";\nimport type { NodeIdentifierManager } from \"../../feature-libraries/index.js\";\nimport {\n\ttype RestrictiveStringRecord,\n\tgetOrCreate,\n\tisReadonlyArray,\n} from \"../../util/index.js\";\n// This import is required for intellisense in @link doc comments on mouseover in VSCode.\n// eslint-disable-next-line unused-imports/no-unused-imports, @typescript-eslint/no-unused-vars\nimport type { TreeAlpha } from \"../../shared-tree/index.js\";\n\nimport {\n\tbooleanSchema,\n\thandleSchema,\n\tnullSchema,\n\tnumberSchema,\n\tstringSchema,\n\ttype LeafSchema,\n} from \"../leafNodeSchema.js\";\nimport {\n\tFieldKind,\n\ttype FieldSchema,\n\ttype ImplicitAllowedTypes,\n\ttype ImplicitFieldSchema,\n\ttype InsertableTreeNodeFromImplicitAllowedTypes,\n\ttype FieldProps,\n\tcreateFieldSchema,\n\ttype DefaultProvider,\n\tgetDefaultProvider,\n\ttype NodeSchemaOptions,\n\tmarkSchemaMostDerived,\n\ttype FieldSchemaAlpha,\n} from \"../schemaTypes.js\";\nimport type {\n\tNodeKind,\n\tWithType,\n\tTreeNodeSchema,\n\tTreeNodeSchemaClass,\n\tTreeNodeSchemaNonClass,\n\tTreeNodeSchemaBoth,\n} from \"../core/index.js\";\nimport { type TreeArrayNode, arraySchema } from \"../arrayNode.js\";\nimport {\n\ttype InsertableObjectFromSchemaRecord,\n\ttype TreeObjectNode,\n\tobjectSchema,\n} from \"../objectNode.js\";\nimport { type MapNodeInsertableData, type TreeMapNode, mapSchema } from \"../mapNode.js\";\nimport type { System_Unsafe, FieldSchemaAlphaUnsafe } from \"./typesUnsafe.js\";\nimport { createFieldSchemaUnsafe } from \"./schemaFactoryRecursive.js\";\nimport { isLazy } from \"../flexList.js\";\n\n/**\n * Gets the leaf domain schema compatible with a given {@link TreeValue}.\n */\nexport function schemaFromValue(value: TreeValue): TreeNodeSchema {\n\tswitch (typeof value) {\n\t\tcase \"boolean\":\n\t\t\treturn booleanSchema;\n\t\tcase \"number\":\n\t\t\treturn numberSchema;\n\t\tcase \"string\":\n\t\t\treturn stringSchema;\n\t\tcase \"object\": {\n\t\t\tif (value === null) {\n\t\t\t\treturn nullSchema;\n\t\t\t}\n\t\t\tassert(isFluidHandle(value), 0x87e /* invalid TreeValue */);\n\t\t\treturn handleSchema;\n\t\t}\n\t\tdefault:\n\t\t\tunreachableCase(value);\n\t}\n}\n\n/**\n * Options when declaring an {@link SchemaFactory.object|object node}'s schema\n *\n * @alpha\n */\nexport interface SchemaFactoryObjectOptions<TCustomMetadata = unknown>\n\textends NodeSchemaOptions<TCustomMetadata> {\n\t/**\n\t * Allow nodes typed with this object node schema to contain optional fields that are not present in the schema declaration.\n\t * Such nodes can come into existence either via import APIs (see remarks) or by way of collaboration with another client\n\t * that has upgraded the document's schema to include those optional fields.\n\t *\n\t * @defaultValue `false`\n\t * @remarks\n\t * The advantage of enabling this option is that it allows an application ecosystem with staged rollout to more quickly\n\t * upgrade documents to include schema for new optional features.\n\t *\n\t * However, it does come with trade-offs that applications should weigh carefully when it comes to interactions between\n\t * code and documents.\n\t * When opening such documents, the API presented is still determined by the view schema.\n\t * This can have implications on the behavior of edits or code which uses portions of the view schema,\n\t * since this may inadvertently drop data which is present in those optional fields in the document schema.\n\t *\n\t * Consider the following example:\n\t *\n\t * ```typescript\n\t * const sf = new SchemaFactory(\"com.example\");\n\t * class PersonView extends sf.object(\"Person\", { name: sf.string }, { allowUnknownOptionalFields: true }) {}\n\t * class PersonStored extends sf.object(\"Person\", { name: sf.string, nickname: sf.optional(sf.string) }) {}\n\t *\n\t * // Say we have a document which uses `PersonStored` in its schema, and application code constructs\n\t * // a tree view using `PersonView`. If the application for some reason had implemented a function like this:\n\t * function clonePerson(a: PersonView): PersonView {\n\t * \treturn new PersonView({ name: a.name });\n\t * }\n\t * // ...or even like this:\n\t * function clonePerson(a: PersonView): PersonView {\n\t * return new PersonView({ ...a})\n\t * }\n\t * // Then the alleged clone wouldn't actually clone the entire person in either case, it would drop the nickname.\n\t * ```\n\t *\n\t * If an application wants to be particularly careful to preserve all data on a node when editing it, it can use\n\t * {@link TreeAlpha.importVerbose|import}/{@link TreeAlpha.exportVerbose|export} APIs with persistent keys.\n\t *\n\t * Note that public API methods which operate on entire nodes (such as `moveTo`, `moveToEnd`, etc. on arrays) do not encounter\n\t * this problem as SharedTree's implementation stores the entire node in its lower layers. It's only when application code\n\t * reaches into a node (either by accessing its fields, spreading it, or some other means) that this problem arises.\n\t */\n\tallowUnknownOptionalFields?: boolean;\n}\n\nexport const defaultSchemaFactoryObjectOptions: Required<\n\tOmit<SchemaFactoryObjectOptions, \"metadata\">\n> = {\n\tallowUnknownOptionalFields: false,\n};\n\n/**\n * The name of a schema produced by {@link SchemaFactory}, including its optional scope prefix.\n *\n * @system @public\n */\nexport type ScopedSchemaName<\n\tTScope extends string | undefined,\n\tTName extends number | string,\n> = TScope extends undefined ? `${TName}` : `${TScope}.${TName}`;\n// > = `${TScope extends undefined ? \"\" : `${TScope}.`}${TName}`;\n\n/**\n * Stateless APIs exposed via {@link SchemaFactory} as both instance properties and as statics.\n * @privateRemarks\n * We have no way to make linkable members which exist both as statics and instance properties since API-Extractor does not support this.\n * As a workaround, we have this type as a third place which can be linked.\n * @system @sealed @public\n */\nexport interface SchemaStatics {\n\t/**\n\t * {@link TreeNodeSchema} for holding a JavaScript `string`.\n\t *\n\t * @remarks\n\t * Strings containing unpaired UTF-16 surrogate pair code units may not be handled correctly.\n\t *\n\t * These limitations come from the use of UTF-8 encoding of the strings, which requires them to be valid unicode.\n\t * JavaScript does not make this requirement for its strings so not all possible JavaScript strings are supported.\n\t * @privateRemarks\n\t * TODO:\n\t * We should be much more clear about what happens if you use problematic values.\n\t * We should validate and/or normalize them when inserting content.\n\t */\n\treadonly string: LeafSchema<\"string\", string>;\n\n\t/**\n\t * {@link TreeNodeSchema} for holding a JavaScript `number`.\n\t *\n\t * @remarks\n\t * The number is a {@link https://en.wikipedia.org/wiki/Double-precision_floating-point_format | double-precision 64-bit binary format IEEE 754} value, however there are some exceptions:\n\t * - `NaN`, and the infinities are converted to `null` (and may therefore only be used where `null` is allowed by the schema).\n\t * - `-0` may be converted to `0` in some cases.\n\t *\n\t * These limitations match the limitations of JSON.\n\t * @privateRemarks\n\t * TODO:\n\t * We should be much more clear about what happens if you use problematic values.\n\t * We should validate and/or normalize them when inserting content.\n\t */\n\treadonly number: LeafSchema<\"number\", number>;\n\n\t/**\n\t * {@link TreeNodeSchema} for holding a boolean.\n\t */\n\treadonly boolean: LeafSchema<\"boolean\", boolean>;\n\n\t/**\n\t * {@link TreeNodeSchema} for JavaScript `null`.\n\t *\n\t * @remarks\n\t * There are good {@link https://www.npmjs.com/package/%40rushstack/eslint-plugin#rushstackno-new-null | reasons to avoid using null} in JavaScript, however sometimes it is desired.\n\t * This {@link TreeNodeSchema} node provides the option to include nulls in trees when desired.\n\t * Unless directly inter-operating with existing data using null, consider other approaches, like wrapping the value in an optional field, or using a more specifically named empty object node.\n\t */\n\t// eslint-disable-next-line @rushstack/no-new-null\n\treadonly null: LeafSchema<\"null\", null>;\n\n\t/**\n\t * {@link TreeNodeSchema} for holding an {@link @fluidframework/core-interfaces#(IFluidHandle:interface)}.\n\t */\n\treadonly handle: LeafSchema<\"handle\", IFluidHandle>;\n\n\t/**\n\t * {@link AllowedTypes} for holding any of the leaf types.\n\t */\n\treadonly leaves: readonly [\n\t\tSchemaStatics[\"string\"],\n\t\tSchemaStatics[\"number\"],\n\t\tSchemaStatics[\"boolean\"],\n\t\tSchemaStatics[\"null\"],\n\t\tSchemaStatics[\"handle\"],\n\t];\n\n\t/**\n\t * Make a field optional instead of the default, which is required.\n\t *\n\t * @param t - The types allowed under the field.\n\t * @param props - Optional properties to associate with the field.\n\t *\n\t * @typeParam TCustomMetadata - Custom metadata properties to associate with the field.\n\t * See {@link FieldSchemaMetadata.custom}.\n\t */\n\treadonly optional: <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(\n\t\tt: T,\n\t\tprops?: Omit<FieldProps<TCustomMetadata>, \"defaultProvider\">,\n\t) => FieldSchema<FieldKind.Optional, T, TCustomMetadata>;\n\n\t/**\n\t * Make a field explicitly required.\n\t *\n\t * @param t - The types allowed under the field.\n\t * @param props - Optional properties to associate with the field.\n\t *\n\t * @remarks\n\t * Fields are required by default, but this API can be used to make the required nature explicit in the schema,\n\t * and allows associating custom {@link FieldProps | properties} with the field.\n\t *\n\t * @typeParam TCustomMetadata - Custom metadata properties to associate with the field.\n\t * See {@link FieldSchemaMetadata.custom}.\n\t */\n\treadonly required: <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(\n\t\tt: T,\n\t\tprops?: Omit<FieldProps<TCustomMetadata>, \"defaultProvider\">,\n\t) => FieldSchema<FieldKind.Required, T, TCustomMetadata>;\n\n\t/**\n\t * {@link SchemaStatics.optional} except tweaked to work better for recursive types.\n\t * Use with {@link ValidateRecursiveSchema} for improved type safety.\n\t * @remarks\n\t * This version of {@link SchemaStatics.optional} has fewer type constraints to work around TypeScript limitations, see {@link Unenforced}.\n\t * See {@link ValidateRecursiveSchema} for additional information about using recursive schema.\n\t */\n\treadonly optionalRecursive: <\n\t\tconst T extends System_Unsafe.ImplicitAllowedTypesUnsafe,\n\t\tconst TCustomMetadata = unknown,\n\t>(\n\t\tt: T,\n\t\tprops?: Omit<FieldProps<TCustomMetadata>, \"defaultProvider\">,\n\t) => System_Unsafe.FieldSchemaUnsafe<FieldKind.Optional, T, TCustomMetadata>;\n\n\t/**\n\t * {@link SchemaStatics.required} except tweaked to work better for recursive types.\n\t * Use with {@link ValidateRecursiveSchema} for improved type safety.\n\t * @remarks\n\t * This version of {@link SchemaStatics.required} has fewer type constraints to work around TypeScript limitations, see {@link Unenforced}.\n\t * See {@link ValidateRecursiveSchema} for additional information about using recursive schema.\n\t */\n\treadonly requiredRecursive: <\n\t\tconst T extends System_Unsafe.ImplicitAllowedTypesUnsafe,\n\t\tconst TCustomMetadata = unknown,\n\t>(\n\t\tt: T,\n\t\tprops?: Omit<FieldProps<TCustomMetadata>, \"defaultProvider\">,\n\t) => System_Unsafe.FieldSchemaUnsafe<FieldKind.Required, T, TCustomMetadata>;\n}\n\nconst defaultOptionalProvider: DefaultProvider = getDefaultProvider(() => {\n\treturn undefined;\n});\n\n/**\n * Implementation of {@link SchemaStatics}.\n * @remarks\n * Entries can use more specific types than {@link SchemaStatics} requires to be more useful for non-public consumers.\n * Additional non-public members are in {@link schemaStatics}.\n */\nexport const schemaStaticsBase = {\n\tstring: stringSchema,\n\tnumber: numberSchema,\n\tboolean: booleanSchema,\n\tnull: nullSchema,\n\thandle: handleSchema,\n\tleaves: [stringSchema, numberSchema, booleanSchema, nullSchema, handleSchema],\n\n\toptional: <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(\n\t\tt: T,\n\t\tprops?: Omit<FieldProps<TCustomMetadata>, \"defaultProvider\">,\n\t): FieldSchemaAlpha<FieldKind.Optional, T, TCustomMetadata> => {\n\t\treturn createFieldSchema(FieldKind.Optional, t, {\n\t\t\tdefaultProvider: defaultOptionalProvider,\n\t\t\t...props,\n\t\t});\n\t},\n\n\trequired: <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(\n\t\tt: T,\n\t\tprops?: Omit<FieldProps<TCustomMetadata>, \"defaultProvider\">,\n\t): FieldSchemaAlpha<FieldKind.Required, T, TCustomMetadata> => {\n\t\treturn createFieldSchema(FieldKind.Required, t, props);\n\t},\n\n\toptionalRecursive: <\n\t\tconst T extends System_Unsafe.ImplicitAllowedTypesUnsafe,\n\t\tconst TCustomMetadata = unknown,\n\t>(\n\t\tt: T,\n\t\tprops?: Omit<FieldProps<TCustomMetadata>, \"defaultProvider\">,\n\t): FieldSchemaAlphaUnsafe<FieldKind.Optional, T, TCustomMetadata> => {\n\t\treturn createFieldSchemaUnsafe(FieldKind.Optional, t, {\n\t\t\tdefaultProvider: defaultOptionalProvider,\n\t\t\t...props,\n\t\t});\n\t},\n\n\trequiredRecursive: <\n\t\tconst T extends System_Unsafe.ImplicitAllowedTypesUnsafe,\n\t\tconst TCustomMetadata = unknown,\n\t>(\n\t\tt: T,\n\t\tprops?: Omit<FieldProps<TCustomMetadata>, \"defaultProvider\">,\n\t): FieldSchemaAlphaUnsafe<FieldKind.Required, T, TCustomMetadata> => {\n\t\treturn createFieldSchemaUnsafe(FieldKind.Required, t, props);\n\t},\n} as const satisfies SchemaStatics;\n\n/**\n * Unstable extensions to {@link schemaStaticsBase}.\n */\nexport const schemaStatics = {\n\t...schemaStaticsBase,\n\tidentifier: <const TCustomMetadata = unknown>(\n\t\tprops?: Omit<FieldProps<TCustomMetadata>, \"defaultProvider\">,\n\t): FieldSchemaAlpha<FieldKind.Identifier, typeof stringSchema, TCustomMetadata> => {\n\t\treturn createFieldSchema(FieldKind.Identifier, stringSchema, props);\n\t},\n} as const;\n\nconst schemaStaticsPublic: SchemaStatics = schemaStatics;\n\n// TODO:\n// SchemaFactory.array references should link to the correct overloads, however the syntax for this does not seems to work currently for methods unless the they are not qualified with the class.\n// API-Extractor requires such links to be qualified with the class, so it can't work.\n// Since linking the overload set as a whole also doesn't work, these have been made non-links for now.\n/**\n * Creates various types of {@link TreeNodeSchema|schema} for {@link TreeNode}s.\n *\n * @typeParam TScope - Scope added as a prefix to the name of every schema produced by this factory.\n * @typeParam TName - Type of names used to identify each schema produced in this factory.\n * Typically this is just `string` but it is also possible to use `string` or `number` based enums if you prefer to identify your types that way.\n *\n * @remarks\n * For details related to inputting data constrained by schema (including via assignment), and how non-exact schema types are handled in general refer to {@link Input}.\n * For information about recursive schema support, see methods postfixed with \"recursive\" and {@link ValidateRecursiveSchema}.\n * To apply schema defined with this factory to a tree, see {@link ViewableTree.viewWith} and {@link TreeViewConfiguration}.\n *\n * All schema produced by this factory get a {@link TreeNodeSchemaCore.identifier|unique identifier} by combining the {@link SchemaFactory.scope} with the schema's `Name`.\n * The `Name` part may be explicitly provided as a parameter, or inferred as a structural combination of the provided types.\n * The APIs which use this second approach, structural naming, also deduplicate all equivalent calls.\n * Therefor two calls to `array(allowedTypes)` with the same allowedTypes will return the same {@link TreeNodeSchema} instance.\n * On the other hand, two calls to `array(name, allowedTypes)` will always return different {@link TreeNodeSchema} instances\n * and it is an error to use both in the same tree (since their identifiers are not unique).\n *\n * For \"customizable\" schema (those which can be subclassed to customize them, see details below) some additional rules must be followed:\n *\n * 1. Only a single {@link TreeNodeSchema|schema} can be used from the class hierarchy deriving from the base class produced by this factory.\n * It is legal to subclass the returned class, and even subclass that class,\n * but only a single class from that class hierarchy can ever be instantiated or passed to any API as a {@link TreeNodeSchema|schema}.\n * These base classes can be used with `instanceof`, but not with schema based APIs like `Tree.is`.\n * 2. If overriding the constructor, the constructor must accept the same argument as the base constructor `super` and forward it to `super` unchanged.\n * 3. Properties for fields defined in the schema should not be overridden.\n * 4. Additional static members added to schema should pick relatively unique keys to reduce the risk of colliding with implementation details what are not exposed in the API.\n * 5. If exporting the schema from a package which uses API-Extractor, export the base class and derived class separately to work around [a known limitation](https://github.com/microsoft/rushstack/issues/4429).\n *\n * Note:\n * POJO stands for Plain Old JavaScript Object.\n * This means an object that works like a `{}` style object literal.\n * In this case it means the prototype is `Object.prototype` and acts like a set of key value pairs (data, not methods).\n * The usage below generalizes this to include array and map like objects as well.\n *\n * There are two ways to use these APIs:\n *\n * Customizable Approach:\n *\n * 1. Declaration: `class X extends schemaFactory.object(\"x\", {}) {}`\n *\n * 2. Allows adding \"local\" (non-persisted) members: Yes. Members (including methods) can be added to the class.\n *\n * 3. Prototype: The user-defined class.\n *\n * 4. Structurally named Schema: Not Supported.\n *\n * 5. Explicitly named Objects: Supported.\n *\n * 6. Explicitly named Maps and Arrays: Supported: Both declaration approaches can be used.\n *\n * 7. Node.js `assert.deepEqual`: Compares like class instances: equal to other nodes of the same type with the same content, including custom local fields.\n *\n * 8. IntelliSense: Shows and links to user-defined class by name: `X`.\n *\n * 9. Recursion: Supported with special declaration patterns.\n *\n * POJO Emulation Approach:\n *\n * 1. Declaration: `const X = schemaFactory.object(\"x\", {}); type X = NodeFromSchema<typeof X>;`\n *\n * 2. Allows adding \"local\" (non-persisted) members: No. Attempting to set non-field members will result in an error.\n *\n * 3. Prototype: `Object.prototype`, `Map.prototype`, or `Array.prototype` depending on node kind.\n *\n * 4. Structurally named Schema: Supported.\n *\n * 5. Explicitly named Objects: Supported.\n *\n * 6. Explicitly named Maps and Arrays: Not Supported.\n *\n * 7. Node.js `assert.deepEqual`: Compares like plain objects: equal to plain JavaScript objects with the same fields, and other nodes with the same fields, even if the types are different.\n *\n * 8. IntelliSense: Shows internal type generation logic: `object & TreeNode & ObjectFromSchemaRecord<{}> & WithType<\"test.x\">`.\n *\n * 9. Recursion: Unsupported: [Generated `.d.ts` files replace recursive references with `any`](https://github.com/microsoft/TypeScript/issues/55832),\n * breaking the use of recursive schema across compilation boundaries.\n *\n * Note that while \"POJO Emulation\" nodes act a lot like POJO objects, they are not true POJO objects:\n *\n * - Adding new arbitrary fields will error, as well some cases of invalid edits.\n *\n * - They are implemented using proxies.\n *\n * - They have state that is not exposed via enumerable own properties, including a {@link TreeNodeSchema}.\n * This makes libraries like node.js `assert.deepEqual` fail to detect differences in type.\n *\n * - Assigning members has side effects (in this case editing the persisted/shared tree).\n *\n * - Not all operations implied by the prototype will work correctly: stick to the APIs explicitly declared in the TypeScript types.\n *\n * @privateRemarks\n * It's perfectly possible to make `POJO Emulation` mode (or even just hiding the prototype) selectable even when using the custom user class declaration syntax.\n * When doing this, it's still possible to make `instanceof` perform correctly.\n * Allowing (or banning) custom/out-of-schema properties on the class is also possible in both modes: it could be orthogonal.\n * Also for consistency, if keeping the current approach to detecting `POJO Emulation` mode it might make sense to make explicitly named Maps and Arrays do the detection the same as how object does it.\n *\n * Note: the comparison between the customizable and POJO modes is not done in a table because TSDoc does not currently have support for embedded markdown.\n *\n * @see {@link SchemaFactoryAlpha}\n *\n * @sealed @public\n */\nexport class SchemaFactory<\n\tout TScope extends string | undefined = string | undefined,\n\tTName extends number | string = string,\n> implements SchemaStatics\n{\n\t/**\n\t * TODO:\n\t * If users of this generate the same name because two different schema with the same identifier were used,\n\t * the second use can get a cache hit, and reference the wrong schema.\n\t * Such usage should probably return a distinct type or error but currently does not.\n\t * The use of markSchemaMostDerived in structuralName at least ensure an error in the case where the collision is from two types extending the same schema factor class.\n\t */\n\tprivate readonly structuralTypes: Map<string, TreeNodeSchema> = new Map();\n\n\t/**\n\t * Construct a SchemaFactory with a given {@link SchemaFactory.scope|scope}.\n\t * @remarks\n\t * There are no restrictions on mixing schema from different schema factories.\n\t * Typically each library will create one or more SchemaFactories and use them to define its schema.\n\t */\n\tpublic constructor(\n\t\t/**\n\t\t * Prefix appended to the identifiers of all {@link TreeNodeSchema} produced by this builder.\n\t\t *\n\t\t * @remarks\n\t\t * Generally each independently developed library\n\t\t * (possibly a package, but could also be part of a package or multiple packages developed together)\n\t\t * should get its own unique `scope`.\n\t\t * Then each schema in the library get a name which is unique within the library.\n\t\t * The scope and name are joined (with a period) to form the {@link TreeNodeSchemaCore.identifier|schema identifier}.\n\t\t * Following this pattern allows a single application to depend on multiple libraries which define their own schema, and use them together in a single tree without risk of collisions.\n\t\t * If a library logically contains sub-libraries with their own schema, they can be given a scope nested inside the parent scope, such as \"ParentScope.ChildScope\".\n\t\t *\n\t\t * To avoid collisions between the scopes of libraries\n\t\t * it is recommended that the libraries use {@link https://en.wikipedia.org/wiki/Reverse_domain_name_notation | Reverse domain name notation} or a UUIDv4 for their scope.\n\t\t * If this pattern is followed, application can safely use third party libraries without risk of the schema in them colliding.\n\t\t *\n\t\t * You may opt out of using a scope by passing `undefined`, but note that this increases the risk of collisions.\n\t\t *\n\t\t * @example\n\t\t * Fluid Framework follows this pattern, placing the schema for the built in leaf types in the `com.fluidframework.leaf` scope.\n\t\t * If Fluid Framework publishes more schema in the future, they would be under some other `com.fluidframework` scope.\n\t\t * This ensures that any schema defined by any other library will not conflict with Fluid Framework's schema\n\t\t * as long as the library uses the recommended patterns for how to scope its schema..\n\t\t *\n\t\t * @example\n\t\t * A library could generate a random UUIDv4, like `242c4397-49ed-47e6-8dd0-d5c3bc31778b` and use that as the scope.\n\t\t * Note: do not use this UUID: a new one must be randomly generated when needed to ensure collision resistance.\n\t\t * ```typescript\n\t\t * const factory = new SchemaFactory(\"242c4397-49ed-47e6-8dd0-d5c3bc31778b\");\n\t\t * ```\n\t\t */\n\t\tpublic readonly scope: TScope,\n\t) {}\n\n\tprivate scoped<Name extends TName | string>(name: Name): ScopedSchemaName<TScope, Name> {\n\t\treturn (\n\t\t\tthis.scope === undefined ? `${name}` : `${this.scope}.${name}`\n\t\t) as ScopedSchemaName<TScope, Name>;\n\t}\n\n\t/**\n\t * {@inheritDoc SchemaStatics.string}\n\t */\n\tpublic readonly string = schemaStaticsPublic.string;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.number}\n\t */\n\tpublic readonly number = schemaStaticsPublic.number;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.boolean}\n\t */\n\tpublic readonly boolean = schemaStaticsPublic.boolean;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.null}\n\t */\n\tpublic readonly null = schemaStaticsPublic.null;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.handle}\n\t */\n\tpublic readonly handle = schemaStaticsPublic.handle;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.leaves}\n\t */\n\tpublic readonly leaves = schemaStaticsPublic.leaves;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.string}\n\t */\n\tpublic static readonly string = schemaStaticsPublic.string;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.number}\n\t */\n\tpublic static readonly number = schemaStaticsPublic.number;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.boolean}\n\t */\n\tpublic static readonly boolean = schemaStaticsPublic.boolean;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.null}\n\t */\n\tpublic static readonly null = schemaStaticsPublic.null;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.handle}\n\t */\n\tpublic static readonly handle = schemaStaticsPublic.handle;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.leaves}\n\t */\n\tpublic static readonly leaves = schemaStaticsPublic.leaves;\n\n\t/**\n\t * Define a {@link TreeNodeSchemaClass} for a {@link TreeObjectNode}.\n\t *\n\t * @param name - Unique identifier for this schema within this factory's scope.\n\t * @param fields - Schema for fields of the object node's schema. Defines what children can be placed under each key.\n\t */\n\tpublic object<\n\t\tconst Name extends TName,\n\t\tconst T extends RestrictiveStringRecord<ImplicitFieldSchema>,\n\t>(\n\t\tname: Name,\n\t\tfields: T,\n\t): TreeNodeSchemaClass<\n\t\tScopedSchemaName<TScope, Name>,\n\t\tNodeKind.Object,\n\t\tTreeObjectNode<T, ScopedSchemaName<TScope, Name>>,\n\t\tobject & InsertableObjectFromSchemaRecord<T>,\n\t\ttrue,\n\t\tT\n\t> {\n\t\treturn objectSchema(\n\t\t\tthis.scoped(name),\n\t\t\tfields,\n\t\t\ttrue,\n\t\t\tdefaultSchemaFactoryObjectOptions.allowUnknownOptionalFields,\n\t\t);\n\t}\n\n\t/**\n\t * Define a structurally typed {@link TreeNodeSchema} for a {@link TreeMapNode}.\n\t *\n\t * @param allowedTypes - The types that may appear as values in the map.\n\t *\n\t * @remarks\n\t * The unique identifier for this Map is defined as a function of the provided types.\n\t * It is still scoped to this SchemaBuilder, but multiple calls with the same arguments will return the same schema object, providing somewhat structural typing.\n\t * This does not support recursive types.\n\t *\n\t * If using these structurally named maps, other types in this schema builder should avoid names of the form `Map<${string}>`.\n\t *\n\t * @example\n\t * The returned schema should be used as a schema directly:\n\t * ```typescript\n\t * const MyMap = factory.map(factory.number);\n\t * type MyMap = NodeFromSchema<typeof MyMap>;\n\t * ```\n\t * Or inline:\n\t * ```typescript\n\t * factory.object(\"Foo\", {myMap: factory.map(factory.number)});\n\t * ```\n\t * @privateRemarks\n\t * See note on array.\n\t */\n\tpublic map<const T extends TreeNodeSchema | readonly TreeNodeSchema[]>(\n\t\tallowedTypes: T,\n\t): TreeNodeSchemaNonClass<\n\t\tScopedSchemaName<TScope, `Map<${string}>`>,\n\t\tNodeKind.Map,\n\t\tTreeMapNode<T> & WithType<ScopedSchemaName<TScope, `Map<${string}>`>, NodeKind.Map>,\n\t\tMapNodeInsertableData<T>,\n\t\ttrue,\n\t\tT,\n\t\tundefined\n\t>;\n\n\t/**\n\t * Define a {@link TreeNodeSchema} for a {@link TreeMapNode}.\n\t *\n\t * @param name - Unique identifier for this schema within this factory's scope.\n\t * @param allowedTypes - The types that may appear as values in the map.\n\t *\n\t * @example\n\t * ```typescript\n\t * class NamedMap extends factory.map(\"name\", factory.number) {}\n\t * ```\n\t */\n\tpublic map<Name extends TName, const T extends ImplicitAllowedTypes>(\n\t\tname: Name,\n\t\tallowedTypes: T,\n\t): TreeNodeSchemaClass<\n\t\tScopedSchemaName<TScope, Name>,\n\t\tNodeKind.Map,\n\t\tTreeMapNode<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Map>,\n\t\tMapNodeInsertableData<T>,\n\t\ttrue,\n\t\tT,\n\t\tundefined\n\t>;\n\n\t/**\n\t * {@link SchemaFactory.map} implementation.\n\t *\n\t * @privateRemarks\n\t * This should return `TreeNodeSchemaBoth`, however TypeScript gives an error if one of the overloads implicitly up-casts the return type of the implementation.\n\t * This seems like a TypeScript bug getting variance backwards for overload return types since it's erroring when the relation between the overload\n\t * and the implementation is type safe, and forcing an unsafe typing instead.\n\t */\n\tpublic map<const T extends ImplicitAllowedTypes>(\n\t\tnameOrAllowedTypes: TName | ((T & TreeNodeSchema) | readonly TreeNodeSchema[]),\n\t\tallowedTypes?: T,\n\t): TreeNodeSchema<string, NodeKind.Map, TreeMapNode<T>, MapNodeInsertableData<T>, true, T> {\n\t\tif (allowedTypes === undefined) {\n\t\t\tconst types = nameOrAllowedTypes as (T & TreeNodeSchema) | readonly TreeNodeSchema[];\n\t\t\tconst fullName = structuralName(\"Map\", types);\n\t\t\treturn getOrCreate(\n\t\t\t\tthis.structuralTypes,\n\t\t\t\tfullName,\n\t\t\t\t() =>\n\t\t\t\t\tthis.namedMap(\n\t\t\t\t\t\tfullName as TName,\n\t\t\t\t\t\tnameOrAllowedTypes as T,\n\t\t\t\t\t\tfalse,\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t) as TreeNodeSchema,\n\t\t\t) as TreeNodeSchemaBoth<\n\t\t\t\tstring,\n\t\t\t\tNodeKind.Map,\n\t\t\t\tTreeMapNode<T>,\n\t\t\t\tMapNodeInsertableData<T>,\n\t\t\t\ttrue,\n\t\t\t\tT,\n\t\t\t\tundefined\n\t\t\t>;\n\t\t}\n\t\t// To actually have type safety, assign to the type this method should return before implicitly upcasting when returning.\n\t\tconst out: TreeNodeSchemaBoth<\n\t\t\tstring,\n\t\t\tNodeKind.Map,\n\t\t\tTreeMapNode<T>,\n\t\t\tMapNodeInsertableData<T>,\n\t\t\ttrue,\n\t\t\tT,\n\t\t\tundefined\n\t\t> = this.namedMap(nameOrAllowedTypes as TName, allowedTypes, true, true);\n\t\treturn out;\n\t}\n\n\t/**\n\t * Define a {@link TreeNodeSchema} for a {@link (TreeMapNode:interface)}.\n\t *\n\t * @param name - Unique identifier for this schema within this factory's scope.\n\t */\n\tprivate namedMap<\n\t\tName extends TName | string,\n\t\tconst T extends ImplicitAllowedTypes,\n\t\tconst ImplicitlyConstructable extends boolean,\n\t>(\n\t\tname: Name,\n\t\tallowedTypes: T,\n\t\tcustomizable: boolean,\n\t\timplicitlyConstructable: ImplicitlyConstructable,\n\t): TreeNodeSchemaBoth<\n\t\tScopedSchemaName<TScope, Name>,\n\t\tNodeKind.Map,\n\t\tTreeMapNode<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Map>,\n\t\tMapNodeInsertableData<T>,\n\t\tImplicitlyConstructable,\n\t\tT,\n\t\tundefined\n\t> {\n\t\treturn mapSchema(\n\t\t\tthis.scoped(name),\n\t\t\tallowedTypes,\n\t\t\timplicitlyConstructable,\n\t\t\t// The current policy is customizable nodes don't get fake prototypes.\n\t\t\t!customizable,\n\t\t\tundefined,\n\t\t);\n\t}\n\n\t/**\n\t * Define a structurally typed {@link TreeNodeSchema} for a {@link (TreeArrayNode:interface)}.\n\t *\n\t * @param allowedTypes - The types that may appear in the array.\n\t *\n\t * @remarks\n\t * The identifier for this Array is defined as a function of the provided types.\n\t * It is still scoped to this SchemaFactory, but multiple calls with the same arguments will return the same schema object, providing somewhat structural typing.\n\t * This does not support recursive types.\n\t *\n\t * If using these structurally named arrays, other types in this schema builder should avoid names of the form `Array<${string}>`.\n\t *\n\t * @example\n\t * The returned schema should be used as a schema directly:\n\t * ```typescript\n\t * const MyArray = factory.array(factory.number);\n\t * type MyArray = NodeFromSchema<typeof MyArray>;\n\t * ```\n\t * Or inline:\n\t * ```typescript\n\t * factory.object(\"Foo\", {myArray: factory.array(factory.number)});\n\t * ```\n\t * @privateRemarks\n\t * The name produced at the type level here is not as specific as it could be, however doing type level sorting and escaping is a real mess.\n\t * There are cases where not having this full type provided will be less than ideal since TypeScript's structural types.\n\t * For example attempts to narrow unions of structural arrays by name won't work.\n\t * Planned future changes to move to a class based schema system as well as factor function based node construction should mostly avoid these issues,\n\t * though there may still be some problematic cases even after that work is done.\n\t *\n\t * The return value is a class, but its the type is intentionally not specific enough to indicate it is a class.\n\t * This prevents callers of this from sub-classing it, which is unlikely to work well (due to the ease of accidentally giving two different calls o this different subclasses)\n\t * when working with structural typing.\n\t *\n\t * {@label STRUCTURAL}\n\t */\n\tpublic array<const T extends TreeNodeSchema | readonly TreeNodeSchema[]>(\n\t\tallowedTypes: T,\n\t): TreeNodeSchemaNonClass<\n\t\tScopedSchemaName<TScope, `Array<${string}>`>,\n\t\tNodeKind.Array,\n\t\tTreeArrayNode<T> & WithType<ScopedSchemaName<TScope, `Array<${string}>`>, NodeKind.Array>,\n\t\tIterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>,\n\t\ttrue,\n\t\tT,\n\t\tundefined\n\t>;\n\n\t/**\n\t * Define (and add to this library) a {@link TreeNodeSchemaClass} for a {@link (TreeArrayNode:interface)}.\n\t *\n\t * @param name - Unique identifier for this schema within this factory's scope.\n\t * @param allowedTypes - The types that may appear in the array.\n\t *\n\t * @example\n\t * ```typescript\n\t * class NamedArray extends factory.array(\"name\", factory.number) {}\n\t * ```\n\t *\n\t * {@label NAMED}\n\t */\n\tpublic array<const Name extends TName, const T extends ImplicitAllowedTypes>(\n\t\tname: Name,\n\t\tallowedTypes: T,\n\t): TreeNodeSchemaClass<\n\t\tScopedSchemaName<TScope, Name>,\n\t\tNodeKind.Array,\n\t\tTreeArrayNode<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Array>,\n\t\tIterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>,\n\t\ttrue,\n\t\tT,\n\t\tundefined\n\t>;\n\n\t/**\n\t * {@link SchemaFactory.array} implementation.\n\t *\n\t * @privateRemarks\n\t * This should return TreeNodeSchemaBoth: see note on \"map\" implementation for details.\n\t */\n\tpublic array<const T extends ImplicitAllowedTypes>(\n\t\tnameOrAllowedTypes: TName | ((T & TreeNodeSchema) | readonly TreeNodeSchema[]),\n\t\tallowedTypes?: T,\n\t): TreeNodeSchema<\n\t\tScopedSchemaName<TScope, string>,\n\t\tNodeKind.Array,\n\t\tTreeArrayNode<T>,\n\t\tIterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>,\n\t\ttrue,\n\t\tT\n\t> {\n\t\tif (allowedTypes === undefined) {\n\t\t\tconst types = nameOrAllowedTypes as (T & TreeNodeSchema) | readonly TreeNodeSchema[];\n\t\t\tconst fullName = structuralName(\"Array\", types);\n\t\t\treturn getOrCreate(this.structuralTypes, fullName, () =>\n\t\t\t\tthis.namedArray(fullName, nameOrAllowedTypes as T, false, true),\n\t\t\t) as TreeNodeSchemaClass<\n\t\t\t\tScopedSchemaName<TScope, string>,\n\t\t\t\tNodeKind.Array,\n\t\t\t\tTreeArrayNode<T>,\n\t\t\t\tIterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>,\n\t\t\t\ttrue,\n\t\t\t\tT,\n\t\t\t\tundefined\n\t\t\t>;\n\t\t}\n\t\tconst out: TreeNodeSchemaBoth<\n\t\t\tScopedSchemaName<TScope, string>,\n\t\t\tNodeKind.Array,\n\t\t\tTreeArrayNode<T>,\n\t\t\tIterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>,\n\t\t\ttrue,\n\t\t\tT,\n\t\t\tundefined\n\t\t> = this.namedArray(nameOrAllowedTypes as TName, allowedTypes, true, true);\n\t\treturn out;\n\t}\n\n\t/**\n\t * Define a {@link TreeNodeSchema} for a {@link (TreeArrayNode:interface)}.\n\t *\n\t * @param name - Unique identifier for this schema within this factory's scope.\n\t *\n\t * @remarks\n\t * This is not intended to be used directly, use the overload of `array` which takes a name instead.\n\t * This is only public to work around a compiler limitation.\n\t */\n\tprivate namedArray<\n\t\tName extends TName | string,\n\t\tconst T extends ImplicitAllowedTypes,\n\t\tconst ImplicitlyConstructable extends boolean,\n\t>(\n\t\tname: Name,\n\t\tallowedTypes: T,\n\t\tcustomizable: boolean,\n\t\timplicitlyConstructable: ImplicitlyConstructable,\n\t): TreeNodeSchemaBoth<\n\t\tScopedSchemaName<TScope, Name>,\n\t\tNodeKind.Array,\n\t\tTreeArrayNode<T> & WithType<ScopedSchemaName<TScope, string>, NodeKind.Array>,\n\t\tIterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>,\n\t\tImplicitlyConstructable,\n\t\tT,\n\t\tundefined\n\t> {\n\t\treturn arraySchema(this.scoped(name), allowedTypes, implicitlyConstructable, customizable);\n\t}\n\n\t/**\n\t * {@inheritDoc SchemaStatics.optional}\n\t */\n\tpublic readonly optional = schemaStaticsPublic.optional;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.required}\n\t */\n\tpublic readonly required = schemaStaticsPublic.required;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.optionalRecursive}\n\t */\n\tpublic readonly optionalRecursive = schemaStaticsPublic.optionalRecursive;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.requiredRecursive}\n\t */\n\tpublic readonly requiredRecursive = schemaStaticsPublic.requiredRecursive;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.optional}\n\t */\n\tpublic static readonly optional = schemaStaticsPublic.optional;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.required}\n\t */\n\tpublic static readonly required = schemaStaticsPublic.required;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.optionalRecursive}\n\t */\n\tpublic static readonly optionalRecursive = schemaStaticsPublic.optionalRecursive;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.requiredRecursive}\n\t */\n\tpublic static readonly requiredRecursive = schemaStaticsPublic.requiredRecursive;\n\n\t/**\n\t * A special readonly field which holds an identifier string for an object node.\n\t * @remarks\n\t * The value of this field, a \"node identifier\", is a string which identifies a node (or nodes) among all nodes in the tree.\n\t * Node identifiers are strings, and can therefore be used as lookup keys in maps or written to a database.\n\t * When the node is constructed, the identifier field does not need to be specified.\n\t * When an identifier is not provided, the SharedTree will generate an identifier for the node automatically.\n\t * The identifier generated by the SharedTree has the following properties:\n\t *\n\t * - It is a UUID which will not collide with other generated UUIDs.\n\t * - It is compressed to a space-efficient representation when stored in the document.\n\t * - A compressed form of the identifier can be accessed at runtime via the {@link TreeNodeApi.shortId|Tree.shortId()} API.\n\t * - It will error if read (and will not be present in the object's iterable properties) before the node has been inserted into a tree.\n\t *\n\t * However, a user may alternatively supply their own string as the identifier if desired (for example, if importing identifiers from another system).\n\t * In that case, if the user requires it to be unique, it is up to them to ensure uniqueness.\n\t * User-supplied identifiers may be read immediately, even before insertion into the tree.\n\t *\n\t * A node may have more than one identifier field (though note that this precludes the use of the {@link TreeNodeApi.shortId|Tree.shortId()} API).\n\t */\n\tpublic get identifier(): FieldSchema<FieldKind.Identifier, typeof this.string> {\n\t\tconst defaultIdentifierProvider: DefaultProvider = getDefaultProvider(\n\t\t\t(nodeKeyManager: NodeIdentifierManager) => {\n\t\t\t\treturn nodeKeyManager.stabilizeNodeIdentifier(\n\t\t\t\t\tnodeKeyManager.generateLocalNodeIdentifier(),\n\t\t\t\t);\n\t\t\t},\n\t\t);\n\t\treturn createFieldSchema(FieldKind.Identifier, this.string, {\n\t\t\tdefaultProvider: defaultIdentifierProvider,\n\t\t});\n\t}\n\n\t/**\n\t * {@link SchemaFactory.object} except tweaked to work better for recursive types.\n\t * Use with {@link ValidateRecursiveSchema} for improved type safety.\n\t * @remarks\n\t * This version of {@link SchemaFactory.object} has fewer type constraints to work around TypeScript limitations, see {@link Unenforced}.\n\t * See {@link ValidateRecursiveSchema} for additional information about using recursive schema.\n\t *\n\t * Additionally `ImplicitlyConstructable` is disabled (forcing use of constructor) to avoid\n\t * `error TS2589: Type instantiation is excessively deep and possibly infinite.`\n\t * which otherwise gets reported at sometimes incorrect source locations that vary based on incremental builds.\n\t */\n\tpublic objectRecursive<\n\t\tconst Name extends TName,\n\t\tconst T extends RestrictiveStringRecord<System_Unsafe.ImplicitFieldSchemaUnsafe>,\n\t>(\n\t\tname: Name,\n\t\tt: T,\n\t): TreeNodeSchemaClass<\n\t\tScopedSchemaName<TScope, Name>,\n\t\tNodeKind.Object,\n\t\tSystem_Unsafe.TreeObjectNodeUnsafe<T, ScopedSchemaName<TScope, Name>>,\n\t\tobject & System_Unsafe.InsertableObjectFromSchemaRecordUnsafe<T>,\n\t\tfalse,\n\t\tT\n\t> {\n\t\ttype TScopedName = ScopedSchemaName<TScope, Name>;\n\t\treturn this.object(\n\t\t\tname,\n\t\t\tt as T & RestrictiveStringRecord<ImplicitFieldSchema>,\n\t\t) as unknown as TreeNodeSchemaClass<\n\t\t\tTScopedName,\n\t\t\tNodeKind.Object,\n\t\t\tSystem_Unsafe.TreeObjectNodeUnsafe<T, TScopedName>,\n\t\t\tobject & System_Unsafe.InsertableObjectFromSchemaRecordUnsafe<T>,\n\t\t\tfalse,\n\t\t\tT\n\t\t>;\n\t}\n\n\t/**\n\t * `SchemaFactory.array` except tweaked to work better for recursive types.\n\t * Use with {@link ValidateRecursiveSchema} for improved type safety.\n\t * @remarks\n\t * This version of `SchemaFactory.array` uses the same workarounds as {@link SchemaFactory.objectRecursive}.\n\t * See {@link ValidateRecursiveSchema} for additional information about using recursive schema.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n\tpublic arrayRecursive<\n\t\tconst Name extends TName,\n\t\tconst T extends System_Unsafe.ImplicitAllowedTypesUnsafe,\n\t>(name: Name, allowedTypes: T) {\n\t\tconst RecursiveArray = this.namedArray(\n\t\t\tname,\n\t\t\tallowedTypes as T & ImplicitAllowedTypes,\n\t\t\ttrue,\n\t\t\tfalse,\n\t\t);\n\n\t\treturn RecursiveArray as TreeNodeSchemaClass<\n\t\t\tScopedSchemaName<TScope, Name>,\n\t\t\tNodeKind.Array,\n\t\t\tSystem_Unsafe.TreeArrayNodeUnsafe<T> &\n\t\t\t\tWithType<ScopedSchemaName<TScope, Name>, NodeKind.Array>,\n\t\t\t{\n\t\t\t\t/**\n\t\t\t\t * Iterator for the iterable of content for this node.\n\t\t\t\t * @privateRemarks\n\t\t\t\t * Wrapping the constructor parameter for recursive arrays and maps in an inlined object type avoids (for unknown reasons)\n\t\t\t\t * the following compile error when declaring the recursive schema:\n\t\t\t\t * `Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions.`\n\t\t\t\t * To benefit from this without impacting the API, the definition of `Iterable` has been inlined as such an object.\n\t\t\t\t *\n\t\t\t\t * If this workaround is kept, ideally this comment would be deduplicated with the other instance of it.\n\t\t\t\t * Unfortunately attempts to do this failed to avoid the compile error this was introduced to solve.\n\t\t\t\t */\n\t\t\t\t[Symbol.iterator](): Iterator<\n\t\t\t\t\tSystem_Unsafe.InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>\n\t\t\t\t>;\n\t\t\t},\n\t\t\tfalse,\n\t\t\tT,\n\t\t\tundefined\n\t\t>;\n\t}\n\n\t/**\n\t * `SchemaFactory.map` except tweaked to work better for recursive types.\n\t * Use with {@link ValidateRecursiveSchema} for improved type safety.\n\t * @remarks\n\t * This version of `SchemaFactory.map` uses the same workarounds as {@link SchemaFactory.objectRecursive}.\n\t * See {@link ValidateRecursiveSchema} for additional information about using recursive schema.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n\tpublic mapRecursive<\n\t\tName extends TName,\n\t\tconst T extends System_Unsafe.ImplicitAllowedTypesUnsafe,\n\t>(name: Name, allowedTypes: T) {\n\t\tconst MapSchema = this.namedMap(\n\t\t\tname,\n\t\t\tallowedTypes as T & ImplicitAllowedTypes,\n\t\t\ttrue,\n\t\t\t// Setting this (implicitlyConstructable) to true seems to work ok currently, but not for other node kinds.\n\t\t\t// Supporting this could be fragile and might break other future changes, so it's being kept as false for now.\n\t\t\tfalse,\n\t\t);\n\n\t\treturn MapSchema as TreeNodeSchemaClass<\n\t\t\tScopedSchemaName<TScope, Name>,\n\t\t\tNodeKind.Map,\n\t\t\tSystem_Unsafe.TreeMapNodeUnsafe<T> &\n\t\t\t\tWithType<ScopedSchemaName<TScope, Name>, NodeKind.Map>,\n\t\t\t| {\n\t\t\t\t\t/**\n\t\t\t\t\t * Iterator for the iterable of content for this node.\n\t\t\t\t\t * @privateRemarks\n\t\t\t\t\t * Wrapping the constructor parameter for recursive arrays and maps in an inlined object type avoids (for unknown reasons)\n\t\t\t\t\t * the following compile error when declaring the recursive schema:\n\t\t\t\t\t * `Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions.`\n\t\t\t\t\t * To benefit from this without impacting the API, the definition of `Iterable` has been inlined as such an object.\n\t\t\t\t\t *\n\t\t\t\t\t * If this workaround is kept, ideally this comment would be deduplicated with the other instance of it.\n\t\t\t\t\t * Unfortunately attempts to do this failed to avoid the compile error this was introduced to solve.\n\t\t\t\t\t */\n\t\t\t\t\t[Symbol.iterator](): Iterator<\n\t\t\t\t\t\t[string, System_Unsafe.InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>]\n\t\t\t\t\t>;\n\t\t\t }\n\t\t\t// Ideally this would be\n\t\t\t// RestrictiveStringRecord<InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>>,\n\t\t\t// but doing so breaks recursive types.\n\t\t\t// Instead we do a less nice version:\n\t\t\t| {\n\t\t\t\t\treadonly [P in string]: System_Unsafe.InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>;\n\t\t\t },\n\t\t\tfalse,\n\t\t\tT,\n\t\t\tundefined\n\t\t>;\n\t}\n}\n\nexport function structuralName<const T extends string>(\n\tcollectionName: T,\n\tallowedTypes: TreeNodeSchema | readonly TreeNodeSchema[],\n): `${T}<${string}>` {\n\tlet inner: string;\n\tif (!isReadonlyArray(allowedTypes)) {\n\t\treturn structuralName(collectionName, [allowedTypes]);\n\t} else {\n\t\tconst names = allowedTypes.map((t): string => {\n\t\t\t// Ensure that lazy types (functions) don't slip through here.\n\t\t\tassert(!isLazy(t), 0x83d /* invalid type provided */);\n\t\t\tmarkSchemaMostDerived(t);\n\t\t\treturn t.identifier;\n\t\t});\n\t\t// Ensure name is order independent\n\t\tnames.sort();\n\t\t// Ensure name can't have collisions by quoting and escaping any quotes in the names of types.\n\t\t// Using JSON is a simple way to accomplish this.\n\t\t// The outer `[]` around the result were needed so that a single type name \"Any\" would not collide with the \"any\" case which used to exist.\n\t\tinner = JSON.stringify(names);\n\t}\n\treturn `${collectionName}<${inner}>`;\n}\n"]}
@@ -2,12 +2,11 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import type { ScopedSchemaName, TreeObjectNodeUnsafe, InsertableObjectFromSchemaRecordUnsafe } from "../../internalTypes.js";
6
- import { SchemaFactory, type SchemaFactoryObjectOptions } from "./schemaFactory.js";
5
+ import { SchemaFactory, type SchemaFactoryObjectOptions, type ScopedSchemaName } from "./schemaFactory.js";
7
6
  import type { ImplicitAllowedTypes, ImplicitFieldSchema, NodeSchemaOptions } from "../schemaTypes.js";
8
7
  import type { RestrictiveStringRecord } from "../../util/index.js";
9
8
  import type { NodeKind, TreeNodeSchemaClass } from "../core/index.js";
10
- import type { ImplicitAllowedTypesUnsafe, ImplicitFieldSchemaUnsafe, ArrayNodeCustomizableSchemaUnsafe, MapNodeCustomizableSchemaUnsafe } from "./typesUnsafe.js";
9
+ import type { ArrayNodeCustomizableSchemaUnsafe, MapNodeCustomizableSchemaUnsafe, System_Unsafe } from "./typesUnsafe.js";
11
10
  import type { ObjectNodeSchema } from "../objectNodeTypes.js";
12
11
  import type { SimpleObjectNodeSchema } from "../simpleSchema.js";
13
12
  import type { ArrayNodeCustomizableSchema } from "../arrayNodeTypes.js";
@@ -46,7 +45,7 @@ export declare class SchemaFactoryAlpha<out TScope extends string | undefined =
46
45
  /**
47
46
  * {@inheritdoc SchemaFactory.objectRecursive}
48
47
  */
49
- objectRecursive<const Name extends TName, const T extends RestrictiveStringRecord<ImplicitFieldSchemaUnsafe>, const TCustomMetadata = unknown>(name: Name, t: T, options?: SchemaFactoryObjectOptions<TCustomMetadata>): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Object, TreeObjectNodeUnsafe<T, ScopedSchemaName<TScope, Name>>, object & InsertableObjectFromSchemaRecordUnsafe<T>, false, T, never, TCustomMetadata> & SimpleObjectNodeSchema<TCustomMetadata> & Pick<ObjectNodeSchema, "fields">;
48
+ objectRecursive<const Name extends TName, const T extends RestrictiveStringRecord<System_Unsafe.ImplicitFieldSchemaUnsafe>, const TCustomMetadata = unknown>(name: Name, t: T, options?: SchemaFactoryObjectOptions<TCustomMetadata>): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Object, System_Unsafe.TreeObjectNodeUnsafe<T, ScopedSchemaName<TScope, Name>>, object & System_Unsafe.InsertableObjectFromSchemaRecordUnsafe<T>, false, T, never, TCustomMetadata> & SimpleObjectNodeSchema<TCustomMetadata> & Pick<ObjectNodeSchema, "fields">;
50
49
  /**
51
50
  * {@inheritDoc SchemaStatics.optional}
52
51
  */
@@ -62,7 +61,7 @@ export declare class SchemaFactoryAlpha<out TScope extends string | undefined =
62
61
  /**
63
62
  * {@inheritDoc SchemaStatics.optionalRecursive}
64
63
  */
65
- static readonly optionalRecursive: <const T extends ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(t: T, props?: Omit<import("../schemaTypes.js").FieldProps<TCustomMetadata>, "defaultProvider"> | undefined) => import("./typesUnsafe.js").FieldSchemaAlphaUnsafe<import("../schemaTypes.js").FieldKind.Optional, T, TCustomMetadata>;
64
+ static readonly optionalRecursive: <const T extends System_Unsafe.ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(t: T, props?: Omit<import("../schemaTypes.js").FieldProps<TCustomMetadata>, "defaultProvider"> | undefined) => import("./typesUnsafe.js").FieldSchemaAlphaUnsafe<import("../schemaTypes.js").FieldKind.Optional, T, TCustomMetadata>;
66
65
  /**
67
66
  * Like {@link SchemaFactory.identifier} but static and a factory function that can be provided {@link FieldProps}.
68
67
  */
@@ -85,7 +84,7 @@ export declare class SchemaFactoryAlpha<out TScope extends string | undefined =
85
84
  /**
86
85
  * {@inheritDoc SchemaFactory.objectRecursive}
87
86
  */
88
- mapRecursive<Name extends TName, const T extends ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(name: Name, allowedTypes: T, options?: NodeSchemaOptions<TCustomMetadata>): MapNodeCustomizableSchemaUnsafe<ScopedSchemaName<TScope, Name>, T, TCustomMetadata>;
87
+ mapRecursive<Name extends TName, const T extends System_Unsafe.ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(name: Name, allowedTypes: T, options?: NodeSchemaOptions<TCustomMetadata>): MapNodeCustomizableSchemaUnsafe<ScopedSchemaName<TScope, Name>, T, TCustomMetadata>;
89
88
  /**
90
89
  * Define (and add to this library) a {@link TreeNodeSchemaClass} for a {@link (TreeArrayNode:interface)}.
91
90
  *
@@ -102,7 +101,7 @@ export declare class SchemaFactoryAlpha<out TScope extends string | undefined =
102
101
  /**
103
102
  * {@inheritDoc SchemaFactory.objectRecursive}
104
103
  */
105
- arrayRecursive<const Name extends TName, const T extends ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(name: Name, allowedTypes: T, options?: NodeSchemaOptions<TCustomMetadata>): ArrayNodeCustomizableSchemaUnsafe<ScopedSchemaName<TScope, Name>, T, TCustomMetadata>;
104
+ arrayRecursive<const Name extends TName, const T extends System_Unsafe.ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(name: Name, allowedTypes: T, options?: NodeSchemaOptions<TCustomMetadata>): ArrayNodeCustomizableSchemaUnsafe<ScopedSchemaName<TScope, Name>, T, TCustomMetadata>;
106
105
  /**
107
106
  * Create a {@link SchemaFactory} with a {@link SchemaFactory.scope|scope} which is a combination of this factory's scope and the provided name.
108
107
  * @remarks
@@ -1 +1 @@
1
- {"version":3,"file":"schemaFactoryAlpha.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/schemaFactoryAlpha.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,gBAAgB,EAChB,oBAAoB,EACpB,sCAAsC,EACtC,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAEN,aAAa,EAEb,KAAK,0BAA0B,EAC/B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EACX,oBAAoB,EACpB,mBAAmB,EACnB,iBAAiB,EACjB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,KAAK,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,KAAK,EACX,0BAA0B,EAC1B,yBAAyB,EACzB,iCAAiC,EACjC,+BAA+B,EAC/B,MAAM,kBAAkB,CAAC;AAG1B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAEpE;;;;;;;;GAQG;AACH,qBAAa,kBAAkB,CAC9B,GAAG,CAAC,MAAM,SAAS,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,EAC1D,KAAK,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,CACrC,SAAQ,aAAa,CAAC,MAAM,EAAE,KAAK,CAAC;IACrC,OAAO,CAAC,OAAO;IAMf;;;;;;OAMG;IACa,MAAM,CACrB,KAAK,CAAC,IAAI,SAAS,KAAK,EACxB,KAAK,CAAC,CAAC,SAAS,uBAAuB,CAAC,mBAAmB,CAAC,EAC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