@fluidframework/tree 2.53.1 → 2.60.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 (424) hide show
  1. package/.eslintrc.cjs +0 -19
  2. package/.mocharc.customBenchmarks.cjs +1 -9
  3. package/CHANGELOG.md +56 -0
  4. package/api-report/tree.alpha.api.md +50 -36
  5. package/api-report/tree.beta.api.md +15 -1
  6. package/api-report/{tree.legacy.alpha.api.md → tree.legacy.beta.api.md} +5 -5
  7. package/api-report/tree.legacy.public.api.md +1 -1
  8. package/api-report/tree.public.api.md +1 -1
  9. package/dist/alpha.d.ts +8 -2
  10. package/dist/beta.d.ts +3 -0
  11. package/dist/codec/codec.d.ts +43 -6
  12. package/dist/codec/codec.d.ts.map +1 -1
  13. package/dist/codec/codec.js +22 -2
  14. package/dist/codec/codec.js.map +1 -1
  15. package/dist/codec/index.d.ts +1 -1
  16. package/dist/codec/index.d.ts.map +1 -1
  17. package/dist/codec/index.js +4 -1
  18. package/dist/codec/index.js.map +1 -1
  19. package/dist/external-utilities/index.d.ts +1 -1
  20. package/dist/external-utilities/index.d.ts.map +1 -1
  21. package/dist/external-utilities/index.js +2 -1
  22. package/dist/external-utilities/index.js.map +1 -1
  23. package/dist/external-utilities/typeboxValidator.d.ts +6 -1
  24. package/dist/external-utilities/typeboxValidator.d.ts.map +1 -1
  25. package/dist/external-utilities/typeboxValidator.js +7 -1
  26. package/dist/external-utilities/typeboxValidator.js.map +1 -1
  27. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +10 -1
  28. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  29. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js +28 -5
  30. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  31. package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts +19 -2
  32. package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts.map +1 -1
  33. package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js +10 -2
  34. package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
  35. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts +59 -4
  36. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  37. package/dist/feature-libraries/chunked-forest/codec/codecs.js +9 -2
  38. package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  39. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +46 -8
  40. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
  41. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +91 -16
  42. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  43. package/dist/feature-libraries/chunked-forest/codec/format.d.ts +14 -0
  44. package/dist/feature-libraries/chunked-forest/codec/format.d.ts.map +1 -1
  45. package/dist/feature-libraries/chunked-forest/codec/format.js +10 -1
  46. package/dist/feature-libraries/chunked-forest/codec/format.js.map +1 -1
  47. package/dist/feature-libraries/chunked-forest/codec/index.d.ts +1 -1
  48. package/dist/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
  49. package/dist/feature-libraries/chunked-forest/codec/index.js.map +1 -1
  50. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts +8 -3
  51. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -1
  52. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +17 -6
  53. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
  54. package/dist/feature-libraries/chunked-forest/index.d.ts +1 -1
  55. package/dist/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  56. package/dist/feature-libraries/chunked-forest/index.js.map +1 -1
  57. package/dist/feature-libraries/forest-summary/codec.d.ts.map +1 -1
  58. package/dist/feature-libraries/forest-summary/codec.js +3 -0
  59. package/dist/feature-libraries/forest-summary/codec.js.map +1 -1
  60. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts +13 -8
  61. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  62. package/dist/feature-libraries/forest-summary/forestSummarizer.js +76 -38
  63. package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  64. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts +178 -0
  65. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts.map +1 -0
  66. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js +322 -0
  67. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -0
  68. package/dist/feature-libraries/forest-summary/index.d.ts +1 -1
  69. package/dist/feature-libraries/forest-summary/index.d.ts.map +1 -1
  70. package/dist/feature-libraries/forest-summary/index.js +2 -1
  71. package/dist/feature-libraries/forest-summary/index.js.map +1 -1
  72. package/dist/feature-libraries/index.d.ts +1 -1
  73. package/dist/feature-libraries/index.d.ts.map +1 -1
  74. package/dist/feature-libraries/index.js +2 -1
  75. package/dist/feature-libraries/index.js.map +1 -1
  76. package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts +2 -2
  77. package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  78. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js +1 -1
  79. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  80. package/dist/feature-libraries/modular-schema/modularChangeFormat.d.ts +6 -9
  81. package/dist/feature-libraries/modular-schema/modularChangeFormat.d.ts.map +1 -1
  82. package/dist/feature-libraries/treeCompressionUtils.d.ts +15 -0
  83. package/dist/feature-libraries/treeCompressionUtils.d.ts.map +1 -1
  84. package/dist/feature-libraries/treeCompressionUtils.js +16 -1
  85. package/dist/feature-libraries/treeCompressionUtils.js.map +1 -1
  86. package/dist/index.d.ts +3 -3
  87. package/dist/index.d.ts.map +1 -1
  88. package/dist/index.js +6 -2
  89. package/dist/index.js.map +1 -1
  90. package/dist/jsonDomainSchema.d.ts +1 -1
  91. package/dist/jsonDomainSchema.d.ts.map +1 -1
  92. package/dist/packageVersion.d.ts +1 -1
  93. package/dist/packageVersion.js +1 -1
  94. package/dist/packageVersion.js.map +1 -1
  95. package/dist/shared-tree/schematizingTreeView.d.ts +1 -1
  96. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  97. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  98. package/dist/shared-tree/sharedTree.d.ts +23 -6
  99. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  100. package/dist/shared-tree/sharedTree.js +4 -1
  101. package/dist/shared-tree/sharedTree.js.map +1 -1
  102. package/dist/shared-tree/sharedTreeChangeFamily.d.ts +2 -2
  103. package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  104. package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  105. package/dist/shared-tree/tree.d.ts.map +1 -1
  106. package/dist/shared-tree/tree.js +3 -0
  107. package/dist/shared-tree/tree.js.map +1 -1
  108. package/dist/shared-tree/treeAlpha.d.ts +9 -11
  109. package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
  110. package/dist/shared-tree/treeAlpha.js.map +1 -1
  111. package/dist/shared-tree/treeCheckout.d.ts +2 -2
  112. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  113. package/dist/shared-tree/treeCheckout.js.map +1 -1
  114. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  115. package/dist/shared-tree-core/sharedTreeCore.js +13 -0
  116. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  117. package/dist/sharedTreeAttributes.d.ts +2 -2
  118. package/dist/sharedTreeAttributes.js +2 -2
  119. package/dist/sharedTreeAttributes.js.map +1 -1
  120. package/dist/simple-tree/api/conciseTree.d.ts.map +1 -1
  121. package/dist/simple-tree/api/conciseTree.js +1 -1
  122. package/dist/simple-tree/api/conciseTree.js.map +1 -1
  123. package/dist/simple-tree/api/customTree.d.ts +39 -11
  124. package/dist/simple-tree/api/customTree.d.ts.map +1 -1
  125. package/dist/simple-tree/api/customTree.js +79 -19
  126. package/dist/simple-tree/api/customTree.js.map +1 -1
  127. package/dist/simple-tree/api/getJsonSchema.d.ts +7 -2
  128. package/dist/simple-tree/api/getJsonSchema.d.ts.map +1 -1
  129. package/dist/simple-tree/api/getJsonSchema.js +1 -0
  130. package/dist/simple-tree/api/getJsonSchema.js.map +1 -1
  131. package/dist/simple-tree/api/index.d.ts +2 -1
  132. package/dist/simple-tree/api/index.d.ts.map +1 -1
  133. package/dist/simple-tree/api/index.js +4 -1
  134. package/dist/simple-tree/api/index.js.map +1 -1
  135. package/dist/simple-tree/api/schemaCreationUtilities.d.ts +1 -1
  136. package/dist/simple-tree/api/schemaCreationUtilities.js +1 -1
  137. package/dist/simple-tree/api/schemaCreationUtilities.js.map +1 -1
  138. package/dist/simple-tree/api/schemaFactory.d.ts +9 -6
  139. package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
  140. package/dist/simple-tree/api/schemaFactory.js +8 -7
  141. package/dist/simple-tree/api/schemaFactory.js.map +1 -1
  142. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +13 -17
  143. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  144. package/dist/simple-tree/api/schemaFactoryAlpha.js +21 -25
  145. package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  146. package/dist/simple-tree/api/schemaFactoryBeta.d.ts +20 -0
  147. package/dist/simple-tree/api/schemaFactoryBeta.d.ts.map +1 -0
  148. package/dist/simple-tree/api/schemaFactoryBeta.js +26 -0
  149. package/dist/simple-tree/api/schemaFactoryBeta.js.map +1 -0
  150. package/dist/simple-tree/api/simpleSchemaToJsonSchema.d.ts +0 -2
  151. package/dist/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -1
  152. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js +6 -3
  153. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  154. package/dist/simple-tree/api/transactionTypes.d.ts +1 -0
  155. package/dist/simple-tree/api/transactionTypes.d.ts.map +1 -1
  156. package/dist/simple-tree/api/transactionTypes.js.map +1 -1
  157. package/dist/simple-tree/api/tree.d.ts +68 -74
  158. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  159. package/dist/simple-tree/api/tree.js.map +1 -1
  160. package/dist/simple-tree/api/verboseTree.d.ts.map +1 -1
  161. package/dist/simple-tree/api/verboseTree.js +3 -3
  162. package/dist/simple-tree/api/verboseTree.js.map +1 -1
  163. package/dist/simple-tree/core/simpleNodeSchemaBase.d.ts +6 -0
  164. package/dist/simple-tree/core/simpleNodeSchemaBase.d.ts.map +1 -1
  165. package/dist/simple-tree/core/simpleNodeSchemaBase.js.map +1 -1
  166. package/dist/simple-tree/fieldSchema.d.ts +3 -4
  167. package/dist/simple-tree/fieldSchema.d.ts.map +1 -1
  168. package/dist/simple-tree/fieldSchema.js +0 -3
  169. package/dist/simple-tree/fieldSchema.js.map +1 -1
  170. package/dist/simple-tree/index.d.ts +1 -1
  171. package/dist/simple-tree/index.d.ts.map +1 -1
  172. package/dist/simple-tree/index.js +4 -2
  173. package/dist/simple-tree/index.js.map +1 -1
  174. package/dist/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
  175. package/dist/simple-tree/node-kinds/record/recordNode.js +2 -3
  176. package/dist/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  177. package/dist/simple-tree/simpleSchema.d.ts +12 -0
  178. package/dist/simple-tree/simpleSchema.d.ts.map +1 -1
  179. package/dist/simple-tree/simpleSchema.js.map +1 -1
  180. package/dist/simple-tree/toStoredSchema.d.ts +0 -3
  181. package/dist/simple-tree/toStoredSchema.d.ts.map +1 -1
  182. package/dist/simple-tree/toStoredSchema.js +0 -3
  183. package/dist/simple-tree/toStoredSchema.js.map +1 -1
  184. package/dist/tableSchema.d.ts +11 -80
  185. package/dist/tableSchema.d.ts.map +1 -1
  186. package/dist/tableSchema.js +200 -117
  187. package/dist/tableSchema.js.map +1 -1
  188. package/dist/treeFactory.d.ts +1 -2
  189. package/dist/treeFactory.d.ts.map +1 -1
  190. package/dist/treeFactory.js +1 -2
  191. package/dist/treeFactory.js.map +1 -1
  192. package/lib/alpha.d.ts +8 -2
  193. package/lib/beta.d.ts +3 -0
  194. package/lib/codec/codec.d.ts +43 -6
  195. package/lib/codec/codec.d.ts.map +1 -1
  196. package/lib/codec/codec.js +19 -1
  197. package/lib/codec/codec.js.map +1 -1
  198. package/lib/codec/index.d.ts +1 -1
  199. package/lib/codec/index.d.ts.map +1 -1
  200. package/lib/codec/index.js +1 -1
  201. package/lib/codec/index.js.map +1 -1
  202. package/lib/external-utilities/index.d.ts +1 -1
  203. package/lib/external-utilities/index.d.ts.map +1 -1
  204. package/lib/external-utilities/index.js +1 -1
  205. package/lib/external-utilities/index.js.map +1 -1
  206. package/lib/external-utilities/typeboxValidator.d.ts +6 -1
  207. package/lib/external-utilities/typeboxValidator.d.ts.map +1 -1
  208. package/lib/external-utilities/typeboxValidator.js +6 -0
  209. package/lib/external-utilities/typeboxValidator.js.map +1 -1
  210. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +10 -1
  211. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  212. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js +27 -5
  213. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  214. package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts +19 -2
  215. package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts.map +1 -1
  216. package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js +10 -2
  217. package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
  218. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts +59 -4
  219. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  220. package/lib/feature-libraries/chunked-forest/codec/codecs.js +10 -3
  221. package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  222. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +46 -8
  223. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
  224. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +87 -14
  225. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  226. package/lib/feature-libraries/chunked-forest/codec/format.d.ts +14 -0
  227. package/lib/feature-libraries/chunked-forest/codec/format.d.ts.map +1 -1
  228. package/lib/feature-libraries/chunked-forest/codec/format.js +9 -0
  229. package/lib/feature-libraries/chunked-forest/codec/format.js.map +1 -1
  230. package/lib/feature-libraries/chunked-forest/codec/index.d.ts +1 -1
  231. package/lib/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
  232. package/lib/feature-libraries/chunked-forest/codec/index.js.map +1 -1
  233. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts +8 -3
  234. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -1
  235. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +18 -7
  236. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
  237. package/lib/feature-libraries/chunked-forest/index.d.ts +1 -1
  238. package/lib/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  239. package/lib/feature-libraries/chunked-forest/index.js.map +1 -1
  240. package/lib/feature-libraries/forest-summary/codec.d.ts.map +1 -1
  241. package/lib/feature-libraries/forest-summary/codec.js +3 -0
  242. package/lib/feature-libraries/forest-summary/codec.js.map +1 -1
  243. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts +13 -8
  244. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  245. package/lib/feature-libraries/forest-summary/forestSummarizer.js +75 -37
  246. package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  247. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts +178 -0
  248. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts.map +1 -0
  249. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js +318 -0
  250. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -0
  251. package/lib/feature-libraries/forest-summary/index.d.ts +1 -1
  252. package/lib/feature-libraries/forest-summary/index.d.ts.map +1 -1
  253. package/lib/feature-libraries/forest-summary/index.js +1 -1
  254. package/lib/feature-libraries/forest-summary/index.js.map +1 -1
  255. package/lib/feature-libraries/index.d.ts +1 -1
  256. package/lib/feature-libraries/index.d.ts.map +1 -1
  257. package/lib/feature-libraries/index.js +1 -1
  258. package/lib/feature-libraries/index.js.map +1 -1
  259. package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts +2 -2
  260. package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  261. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js +3 -3
  262. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  263. package/lib/feature-libraries/modular-schema/modularChangeFormat.d.ts +6 -9
  264. package/lib/feature-libraries/modular-schema/modularChangeFormat.d.ts.map +1 -1
  265. package/lib/feature-libraries/treeCompressionUtils.d.ts +15 -0
  266. package/lib/feature-libraries/treeCompressionUtils.d.ts.map +1 -1
  267. package/lib/feature-libraries/treeCompressionUtils.js +15 -0
  268. package/lib/feature-libraries/treeCompressionUtils.js.map +1 -1
  269. package/lib/index.d.ts +3 -3
  270. package/lib/index.d.ts.map +1 -1
  271. package/lib/index.js +4 -4
  272. package/lib/index.js.map +1 -1
  273. package/lib/jsonDomainSchema.d.ts +1 -1
  274. package/lib/jsonDomainSchema.d.ts.map +1 -1
  275. package/lib/packageVersion.d.ts +1 -1
  276. package/lib/packageVersion.js +1 -1
  277. package/lib/packageVersion.js.map +1 -1
  278. package/lib/shared-tree/schematizingTreeView.d.ts +1 -1
  279. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  280. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  281. package/lib/shared-tree/sharedTree.d.ts +23 -6
  282. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  283. package/lib/shared-tree/sharedTree.js +4 -1
  284. package/lib/shared-tree/sharedTree.js.map +1 -1
  285. package/lib/shared-tree/sharedTreeChangeFamily.d.ts +2 -2
  286. package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  287. package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  288. package/lib/shared-tree/tree.d.ts.map +1 -1
  289. package/lib/shared-tree/tree.js +3 -0
  290. package/lib/shared-tree/tree.js.map +1 -1
  291. package/lib/shared-tree/treeAlpha.d.ts +9 -11
  292. package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
  293. package/lib/shared-tree/treeAlpha.js.map +1 -1
  294. package/lib/shared-tree/treeCheckout.d.ts +2 -2
  295. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  296. package/lib/shared-tree/treeCheckout.js.map +1 -1
  297. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  298. package/lib/shared-tree-core/sharedTreeCore.js +13 -0
  299. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  300. package/lib/sharedTreeAttributes.d.ts +2 -2
  301. package/lib/sharedTreeAttributes.js +2 -2
  302. package/lib/sharedTreeAttributes.js.map +1 -1
  303. package/lib/simple-tree/api/conciseTree.d.ts.map +1 -1
  304. package/lib/simple-tree/api/conciseTree.js +2 -2
  305. package/lib/simple-tree/api/conciseTree.js.map +1 -1
  306. package/lib/simple-tree/api/customTree.d.ts +39 -11
  307. package/lib/simple-tree/api/customTree.d.ts.map +1 -1
  308. package/lib/simple-tree/api/customTree.js +79 -19
  309. package/lib/simple-tree/api/customTree.js.map +1 -1
  310. package/lib/simple-tree/api/getJsonSchema.d.ts +7 -2
  311. package/lib/simple-tree/api/getJsonSchema.d.ts.map +1 -1
  312. package/lib/simple-tree/api/getJsonSchema.js +1 -0
  313. package/lib/simple-tree/api/getJsonSchema.js.map +1 -1
  314. package/lib/simple-tree/api/index.d.ts +2 -1
  315. package/lib/simple-tree/api/index.d.ts.map +1 -1
  316. package/lib/simple-tree/api/index.js +2 -1
  317. package/lib/simple-tree/api/index.js.map +1 -1
  318. package/lib/simple-tree/api/schemaCreationUtilities.d.ts +1 -1
  319. package/lib/simple-tree/api/schemaCreationUtilities.js +1 -1
  320. package/lib/simple-tree/api/schemaCreationUtilities.js.map +1 -1
  321. package/lib/simple-tree/api/schemaFactory.d.ts +9 -6
  322. package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
  323. package/lib/simple-tree/api/schemaFactory.js +6 -6
  324. package/lib/simple-tree/api/schemaFactory.js.map +1 -1
  325. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +13 -17
  326. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  327. package/lib/simple-tree/api/schemaFactoryAlpha.js +22 -26
  328. package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  329. package/lib/simple-tree/api/schemaFactoryBeta.d.ts +20 -0
  330. package/lib/simple-tree/api/schemaFactoryBeta.d.ts.map +1 -0
  331. package/lib/simple-tree/api/schemaFactoryBeta.js +22 -0
  332. package/lib/simple-tree/api/schemaFactoryBeta.js.map +1 -0
  333. package/lib/simple-tree/api/simpleSchemaToJsonSchema.d.ts +0 -2
  334. package/lib/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -1
  335. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js +6 -3
  336. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  337. package/lib/simple-tree/api/transactionTypes.d.ts +1 -0
  338. package/lib/simple-tree/api/transactionTypes.d.ts.map +1 -1
  339. package/lib/simple-tree/api/transactionTypes.js.map +1 -1
  340. package/lib/simple-tree/api/tree.d.ts +68 -74
  341. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  342. package/lib/simple-tree/api/tree.js.map +1 -1
  343. package/lib/simple-tree/api/verboseTree.d.ts.map +1 -1
  344. package/lib/simple-tree/api/verboseTree.js +4 -4
  345. package/lib/simple-tree/api/verboseTree.js.map +1 -1
  346. package/lib/simple-tree/core/simpleNodeSchemaBase.d.ts +6 -0
  347. package/lib/simple-tree/core/simpleNodeSchemaBase.d.ts.map +1 -1
  348. package/lib/simple-tree/core/simpleNodeSchemaBase.js.map +1 -1
  349. package/lib/simple-tree/fieldSchema.d.ts +3 -4
  350. package/lib/simple-tree/fieldSchema.d.ts.map +1 -1
  351. package/lib/simple-tree/fieldSchema.js +0 -3
  352. package/lib/simple-tree/fieldSchema.js.map +1 -1
  353. package/lib/simple-tree/index.d.ts +1 -1
  354. package/lib/simple-tree/index.d.ts.map +1 -1
  355. package/lib/simple-tree/index.js +1 -1
  356. package/lib/simple-tree/index.js.map +1 -1
  357. package/lib/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
  358. package/lib/simple-tree/node-kinds/record/recordNode.js +2 -3
  359. package/lib/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  360. package/lib/simple-tree/simpleSchema.d.ts +12 -0
  361. package/lib/simple-tree/simpleSchema.d.ts.map +1 -1
  362. package/lib/simple-tree/simpleSchema.js.map +1 -1
  363. package/lib/simple-tree/toStoredSchema.d.ts +0 -3
  364. package/lib/simple-tree/toStoredSchema.d.ts.map +1 -1
  365. package/lib/simple-tree/toStoredSchema.js +0 -3
  366. package/lib/simple-tree/toStoredSchema.js.map +1 -1
  367. package/lib/tableSchema.d.ts +11 -80
  368. package/lib/tableSchema.d.ts.map +1 -1
  369. package/lib/tableSchema.js +201 -118
  370. package/lib/tableSchema.js.map +1 -1
  371. package/lib/treeFactory.d.ts +1 -2
  372. package/lib/treeFactory.d.ts.map +1 -1
  373. package/lib/treeFactory.js +1 -2
  374. package/lib/treeFactory.js.map +1 -1
  375. package/package.json +21 -21
  376. package/src/codec/codec.ts +52 -7
  377. package/src/codec/index.ts +4 -0
  378. package/src/external-utilities/index.ts +1 -1
  379. package/src/external-utilities/typeboxValidator.ts +7 -1
  380. package/src/feature-libraries/chunked-forest/codec/chunkDecoding.ts +38 -4
  381. package/src/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.ts +10 -3
  382. package/src/feature-libraries/chunked-forest/codec/codecs.ts +96 -8
  383. package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +123 -19
  384. package/src/feature-libraries/chunked-forest/codec/format.ts +11 -0
  385. package/src/feature-libraries/chunked-forest/codec/index.ts +4 -0
  386. package/src/feature-libraries/chunked-forest/codec/schemaBasedEncode.ts +28 -3
  387. package/src/feature-libraries/chunked-forest/index.ts +2 -0
  388. package/src/feature-libraries/forest-summary/codec.ts +3 -0
  389. package/src/feature-libraries/forest-summary/forestSummarizer.ts +118 -50
  390. package/src/feature-libraries/forest-summary/incrementalSummaryBuilder.ts +511 -0
  391. package/src/feature-libraries/forest-summary/index.ts +1 -1
  392. package/src/feature-libraries/index.ts +5 -1
  393. package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +8 -4
  394. package/src/feature-libraries/treeCompressionUtils.ts +19 -0
  395. package/src/index.ts +6 -1
  396. package/src/packageVersion.ts +1 -1
  397. package/src/shared-tree/schematizingTreeView.ts +1 -1
  398. package/src/shared-tree/sharedTree.ts +37 -4
  399. package/src/shared-tree/sharedTreeChangeFamily.ts +2 -2
  400. package/src/shared-tree/tree.ts +3 -0
  401. package/src/shared-tree/treeAlpha.ts +10 -11
  402. package/src/shared-tree/treeCheckout.ts +2 -2
  403. package/src/shared-tree-core/sharedTreeCore.ts +17 -0
  404. package/src/sharedTreeAttributes.ts +2 -2
  405. package/src/simple-tree/api/conciseTree.ts +2 -1
  406. package/src/simple-tree/api/customTree.ts +102 -32
  407. package/src/simple-tree/api/getJsonSchema.ts +7 -2
  408. package/src/simple-tree/api/index.ts +3 -0
  409. package/src/simple-tree/api/schemaCreationUtilities.ts +1 -1
  410. package/src/simple-tree/api/schemaFactory.ts +21 -14
  411. package/src/simple-tree/api/schemaFactoryAlpha.ts +29 -30
  412. package/src/simple-tree/api/schemaFactoryBeta.ts +28 -0
  413. package/src/simple-tree/api/simpleSchemaToJsonSchema.ts +7 -3
  414. package/src/simple-tree/api/transactionTypes.ts +1 -0
  415. package/src/simple-tree/api/tree.ts +75 -81
  416. package/src/simple-tree/api/verboseTree.ts +42 -39
  417. package/src/simple-tree/core/simpleNodeSchemaBase.ts +6 -0
  418. package/src/simple-tree/fieldSchema.ts +3 -4
  419. package/src/simple-tree/index.ts +3 -0
  420. package/src/simple-tree/node-kinds/record/recordNode.ts +2 -3
  421. package/src/simple-tree/simpleSchema.ts +12 -0
  422. package/src/simple-tree/toStoredSchema.ts +0 -3
  423. package/src/tableSchema.ts +261 -243
  424. package/src/treeFactory.ts +1 -2
@@ -17,6 +17,7 @@ export declare function schemaFromValue(value: TreeValue): TreeNodeSchema;
17
17
  /**
18
18
  * Options when declaring an {@link SchemaFactory.object|object node}'s schema
19
19
  *
20
+ * @input
20
21
  * @alpha
21
22
  */
22
23
  export interface SchemaFactoryObjectOptions<TCustomMetadata = unknown> extends NodeSchemaOptionsAlpha<TCustomMetadata> {
@@ -65,7 +66,7 @@ export interface SchemaFactoryObjectOptions<TCustomMetadata = unknown> extends N
65
66
  * It's only when application code reaches into a node
66
67
  * (either by accessing its fields, spreading it, or some other means) that this problem arises.
67
68
  */
68
- allowUnknownOptionalFields?: boolean;
69
+ readonly allowUnknownOptionalFields?: boolean;
69
70
  }
70
71
  /**
71
72
  * Default options for Object node schema creation.
@@ -266,7 +267,6 @@ export declare class SchemaFactory<out TScope extends string | undefined = strin
266
267
  * ```
267
268
  */
268
269
  scope: TScope);
269
- private scoped;
270
270
  /**
271
271
  * {@inheritDoc SchemaStatics.string}
272
272
  */
@@ -403,7 +403,7 @@ export declare class SchemaFactory<out TScope extends string | undefined = strin
403
403
  */
404
404
  array<const T extends TreeNodeSchema | readonly TreeNodeSchema[]>(allowedTypes: T): TreeNodeSchemaNonClass<ScopedSchemaName<TScope, `Array<${string}>`>, NodeKind.Array, TreeArrayNode<T> & WithType<ScopedSchemaName<TScope, `Array<${string}>`>, NodeKind.Array>, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>, true, T, undefined>;
405
405
  /**
406
- * Define (and add to this library) a {@link TreeNodeSchemaClass} for a {@link (TreeArrayNode:interface)}.
406
+ * Define a {@link TreeNodeSchemaClass} for a {@link (TreeArrayNode:interface)}.
407
407
  *
408
408
  * @param name - Unique identifier for this schema within this factory's scope.
409
409
  * @param allowedTypes - The types that may appear in the array.
@@ -554,13 +554,14 @@ export declare class SchemaFactory<out TScope extends string | undefined = strin
554
554
  }, false, T, undefined>;
555
555
  }
556
556
  export declare function structuralName<const T extends string>(collectionName: T, allowedTypes: TreeNodeSchema | readonly TreeNodeSchema[]): `${T}<${string}>`;
557
+ export declare function scoped<TScope extends string | undefined, TName extends number | string, Name extends TName | string>(factory: SchemaFactory<TScope, TName>, name: Name): ScopedSchemaName<TScope, Name>;
557
558
  /**
558
559
  * Additional information to provide to Node Schema creation.
559
560
  *
560
561
  * @typeParam TCustomMetadata - Custom metadata properties to associate with the Node Schema.
561
562
  * See {@link NodeSchemaMetadata.custom}.
562
563
  *
563
- * @sealed
564
+ * @input
564
565
  * @public
565
566
  */
566
567
  export interface NodeSchemaOptions<out TCustomMetadata = unknown> {
@@ -568,8 +569,7 @@ export interface NodeSchemaOptions<out TCustomMetadata = unknown> {
568
569
  * Optional metadata to associate with the Node Schema.
569
570
  *
570
571
  * @remarks
571
- * Note: this metadata is not persisted nor made part of the collaborative state; it is strictly client-local.
572
- * Different clients in the same collaborative session may see different metadata for the same field.
572
+ * This specifies {@link SimpleNodeSchemaBase.metadata} which has more details about its use.
573
573
  */
574
574
  readonly metadata?: NodeSchemaMetadata<TCustomMetadata> | undefined;
575
575
  }
@@ -579,11 +579,14 @@ export interface NodeSchemaOptions<out TCustomMetadata = unknown> {
579
579
  * @typeParam TCustomMetadata - Custom metadata properties to associate with the Node Schema.
580
580
  * See {@link NodeSchemaMetadata.custom}.
581
581
  *
582
+ * @input
582
583
  * @alpha
583
584
  */
584
585
  export interface NodeSchemaOptionsAlpha<out TCustomMetadata = unknown> extends NodeSchemaOptions<TCustomMetadata> {
585
586
  /**
586
587
  * The persisted metadata for this schema element.
588
+ * @remarks
589
+ * This gets exposed via {@link SimpleNodeSchemaBaseAlpha.persistedMetadata}.
587
590
  */
588
591
  readonly persistedMetadata?: JsonCompatibleReadOnlyObject | undefined;
589
592
  }
@@ -1 +1 @@
1
- {"version":3,"file":"schemaFactory.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/schemaFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAIrD,OAAO,EACN,KAAK,4BAA4B,EACjC,KAAK,uBAAuB,EAI5B,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EACX,QAAQ,EACR,QAAQ,EACR,cAAc,EACd,mBAAmB,EACnB,sBAAsB,EAGtB,kBAAkB,EAElB,oBAAoB,EACpB,0CAA0C,EAC1C,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAQN,KAAK,UAAU,EACf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAEN,KAAK,qBAAqB,EAG1B,KAAK,aAAa,EAClB,KAAK,gCAAgC,EACrC,KAAK,WAAW,EAChB,KAAK,cAAc,EAEnB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACN,SAAS,EACT,KAAK,WAAW,EAChB,KAAK,mBAAmB,EAGxB,KAAK,UAAU,EAIf,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAKtD,OAAO,EAAE,KAAK,aAAa,EAAiB,MAAM,oBAAoB,CAAC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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;AAED,wBAAgB,MAAM,CACrB,MAAM,SAAS,MAAM,GAAG,SAAS,EACjC,KAAK,SAAS,MAAM,GAAG,MAAM,EAC7B,IAAI,SAAS,KAAK,GAAG,MAAM,EAC1B,OAAO,EAAE,aAAa,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,IAAI,EAAE,IAAI,GAAG,gBAAgB,CAAC,MAAM,EAAE,IAAI,CAAC,CAInF;AAUD;;;;;;;;GAQG;AACH,MAAM,WAAW,iBAAiB,CAAC,GAAG,CAAC,eAAe,GAAG,OAAO;IAC/D;;;;;OAKG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,kBAAkB,CAAC,eAAe,CAAC,GAAG,SAAS,CAAC;CACpE;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,sBAAsB,CAAC,GAAG,CAAC,eAAe,GAAG,OAAO,CACpE,SAAQ,iBAAiB,CAAC,eAAe,CAAC;IAC1C;;;;OAIG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,4BAA4B,GAAG,SAAS,CAAC;CACtE"}
@@ -246,9 +246,6 @@ export class SchemaFactory {
246
246
  */
247
247
  this.requiredRecursive = schemaStaticsPublic.requiredRecursive;
248
248
  }
249
- scoped(name) {
250
- return (this.scope === undefined ? `${name}` : `${this.scope}.${name}`);
251
- }
252
249
  /**
253
250
  * Define a {@link TreeNodeSchemaClass} for a {@link TreeObjectNode}.
254
251
  *
@@ -257,7 +254,7 @@ export class SchemaFactory {
257
254
  */
258
255
  object(name, fields) {
259
256
  // The compiler can't infer that UnannotateSchemaRecord<T> is equal to T so we have to do a bunch of typing to make the error go away.
260
- const object = objectSchema(this.scoped(name), fields, true, defaultSchemaFactoryObjectOptions.allowUnknownOptionalFields);
257
+ const object = objectSchema(scoped(this, name), fields, true, defaultSchemaFactoryObjectOptions.allowUnknownOptionalFields);
261
258
  return object;
262
259
  }
263
260
  /**
@@ -285,7 +282,7 @@ export class SchemaFactory {
285
282
  */
286
283
  namedMap(name, allowedTypes, customizable, implicitlyConstructable) {
287
284
  // The compiler can't infer that UnannotateImplicitAllowedTypes<T> is equal to T so we have to do a bunch of typing to make the error go away.
288
- const map = mapSchema(this.scoped(name), allowedTypes, implicitlyConstructable,
285
+ const map = mapSchema(scoped(this, name), allowedTypes, implicitlyConstructable,
289
286
  // The current policy is customizable nodes don't get fake prototypes.
290
287
  !customizable, undefined);
291
288
  return map;
@@ -335,7 +332,7 @@ export class SchemaFactory {
335
332
  * This is only public to work around a compiler limitation.
336
333
  */
337
334
  namedArray(name, allowedTypes, customizable, implicitlyConstructable) {
338
- const array = arraySchema(this.scoped(name), allowedTypes, implicitlyConstructable, customizable);
335
+ const array = arraySchema(scoped(this, name), allowedTypes, implicitlyConstructable, customizable);
339
336
  return array;
340
337
  }
341
338
  /**
@@ -476,6 +473,9 @@ export function structuralName(collectionName, allowedTypes) {
476
473
  }
477
474
  return `${collectionName}<${inner}>`;
478
475
  }
476
+ export function scoped(factory, name) {
477
+ return (factory.scope === undefined ? `${name}` : `${factory.scope}.${name}`);
478
+ }
479
479
  /**
480
480
  * Used to allocate default identifiers for unhydrated nodes when no context is available.
481
481
  * @remarks
@@ -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;AAC9E,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AACvE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AAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;IACD,OAAO,GAAG,cAAc,IAAI,KAAK,GAAG,CAAC;AACtC,CAAC;AAED;;;;;GAKG;AACH,MAAM,yBAAyB,GAAkB,kBAAkB,EAAE,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 { isFluidHandle } from \"@fluidframework/runtime-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport type { TreeValue } from \"../../core/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\";\nimport {\n\ttype JsonCompatibleReadOnlyObject,\n\ttype RestrictiveStringRecord,\n\tcompareSets,\n\tgetOrCreate,\n\tisReadonlyArray,\n} from \"../../util/index.js\";\nimport { normalizeAllowedTypes, markSchemaMostDerived, isLazy } from \"../core/index.js\";\nimport type {\n\tNodeKind,\n\tWithType,\n\tTreeNodeSchema,\n\tTreeNodeSchemaClass,\n\tTreeNodeSchemaNonClass,\n\tTreeNodeSchemaBoth,\n\tUnhydratedFlexTreeNode,\n\tNodeSchemaMetadata,\n\tUnannotateImplicitAllowedTypes,\n\tImplicitAllowedTypes,\n\tInsertableTreeNodeFromImplicitAllowedTypes,\n} from \"../core/index.js\";\nimport {\n\tbooleanSchema,\n\thandleSchema,\n\tnullSchema,\n\tnumberSchema,\n\tstringSchema,\n\t// This import prevents a large number of LeafSchema references in the API reports from showing up as LeafSchema_2.\n\t// eslint-disable-next-line unused-imports/no-unused-imports, @typescript-eslint/no-unused-vars\n\ttype LeafSchema,\n} from \"../leafNodeSchema.js\";\nimport {\n\tarraySchema,\n\ttype MapNodeInsertableData,\n\tmapSchema,\n\tobjectSchema,\n\ttype TreeArrayNode,\n\ttype InsertableObjectFromSchemaRecord,\n\ttype TreeMapNode,\n\ttype TreeObjectNode,\n\ttype UnannotateSchemaRecord,\n} from \"../node-kinds/index.js\";\nimport {\n\tFieldKind,\n\ttype FieldSchema,\n\ttype ImplicitFieldSchema,\n\t// This import prevents a large number of FieldProps references in the API reports from showing up as FieldProps_2.\n\t// eslint-disable-next-line unused-imports/no-unused-imports, @typescript-eslint/no-unused-vars\n\ttype FieldProps,\n\tcreateFieldSchema,\n\ttype DefaultProvider,\n\tgetDefaultProvider,\n} from \"../fieldSchema.js\";\n\nimport type { System_Unsafe } from \"./typesUnsafe.js\";\nimport type { IIdCompressor } from \"@fluidframework/id-compressor\";\nimport { createIdCompressor } from \"@fluidframework/id-compressor/internal\";\nimport type { FlexTreeHydratedContextMinimal } from \"../../feature-libraries/index.js\";\nimport { unhydratedFlexTreeFromInsertable } from \"../unhydratedFlexTreeFromInsertable.js\";\nimport { type SchemaStatics, schemaStatics } from \"./schemaStatics.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 NodeSchemaOptionsAlpha<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 * The existing import and export APIs have similar problems.\n\t * For example currently the {@link (TreeAlpha:interface).exportVerbose|exportVerbose} API with stored keys preserves unknown optional fields,\n\t * but {@link Unhydrated} nodes produced by {@link TreeNode} constructors, insertable content, and {@link (TreeAlpha:interface).importVerbose|importVerbose} do not.\n\t * {@link (TreeBeta:interface).clone} however can be used to clone a node preserving unknown optional fields.\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.\n\t * It's only when application code reaches into a node\n\t * (either by accessing its fields, spreading it, or some other means) that this problem arises.\n\t */\n\tallowUnknownOptionalFields?: boolean;\n}\n\n/**\n * Default options for Object node schema creation.\n * @remarks Omits parameters that are not relevant for common use cases.\n */\nexport const defaultSchemaFactoryObjectOptions: Required<\n\tOmit<SchemaFactoryObjectOptions, \"metadata\" | \"persistedMetadata\">\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\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 *\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 *\n * 3. Properties for fields defined in the schema should not be overridden.\n *\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 *\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\t// The compiler can't infer that UnannotateSchemaRecord<T> is equal to T so we have to do a bunch of typing to make the error go away.\n\t\tconst object: TreeNodeSchemaClass<\n\t\t\tScopedSchemaName<TScope, Name>,\n\t\t\tNodeKind.Object,\n\t\t\tTreeObjectNode<UnannotateSchemaRecord<T>, ScopedSchemaName<TScope, Name>>,\n\t\t\tobject & InsertableObjectFromSchemaRecord<UnannotateSchemaRecord<T>>,\n\t\t\ttrue,\n\t\t\tT\n\t\t> = objectSchema(\n\t\t\tthis.scoped(name),\n\t\t\tfields,\n\t\t\ttrue,\n\t\t\tdefaultSchemaFactoryObjectOptions.allowUnknownOptionalFields,\n\t\t);\n\n\t\treturn object as TreeNodeSchemaClass<\n\t\t\tScopedSchemaName<TScope, Name>,\n\t\t\tNodeKind.Object,\n\t\t\tTreeObjectNode<RestrictiveStringRecord<ImplicitFieldSchema>>,\n\t\t\tunknown,\n\t\t\ttrue,\n\t\t\tT\n\t\t> as TreeNodeSchemaClass<\n\t\t\tScopedSchemaName<TScope, Name>,\n\t\t\tNodeKind.Object,\n\t\t\tTreeObjectNode<T, ScopedSchemaName<TScope, Name>>,\n\t\t\tobject & InsertableObjectFromSchemaRecord<T>,\n\t\t\ttrue,\n\t\t\tT\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 this.getStructuralType(fullName, types, () =>\n\t\t\t\tthis.namedMap(fullName, nameOrAllowedTypes as T, false, true),\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 up-casting 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\t// The compiler can't infer that UnannotateImplicitAllowedTypes<T> is equal to T so we have to do a bunch of typing to make the error go away.\n\t\tconst map: TreeNodeSchemaBoth<\n\t\t\tScopedSchemaName<TScope, Name>,\n\t\t\tNodeKind.Map,\n\t\t\tTreeMapNode<UnannotateImplicitAllowedTypes<T>> &\n\t\t\t\tWithType<ScopedSchemaName<TScope, Name>, NodeKind.Map>,\n\t\t\tMapNodeInsertableData<UnannotateImplicitAllowedTypes<T>>,\n\t\t\tImplicitlyConstructable,\n\t\t\tT,\n\t\t\tundefined\n\t\t> = 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\n\t\treturn map as TreeNodeSchemaBoth<\n\t\t\tScopedSchemaName<TScope, Name>,\n\t\t\tNodeKind.Map,\n\t\t\tTreeMapNode<UnannotateImplicitAllowedTypes<T>> &\n\t\t\t\tWithType<ScopedSchemaName<TScope, Name>, NodeKind.Map>,\n\t\t\tMapNodeInsertableData<ImplicitAllowedTypes>,\n\t\t\tImplicitlyConstructable,\n\t\t\tT,\n\t\t\tundefined\n\t\t> as TreeNodeSchemaBoth<\n\t\t\tScopedSchemaName<TScope, Name>,\n\t\t\tNodeKind.Map,\n\t\t\tTreeMapNode<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Map>,\n\t\t\tMapNodeInsertableData<T>,\n\t\t\tImplicitlyConstructable,\n\t\t\tT,\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 will allow assignment between runtime incompatible types at compile time.\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 this.getStructuralType(fullName, types, () =>\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 * Retrieves or creates a structural {@link TreeNodeSchema} with the specified name and types.\n\t *\n\t * @param fullName - The name for the structural schema.\n\t * @param types - The input schema(s) used to define the structural schema.\n\t * @param builder - A function that builds the schema if it does not already exist.\n\t * @returns The structural {@link TreeNodeSchema} associated with the given name and types.\n\t * @throws `UsageError` if a schema structurally named schema with the same name is cached in `structuralTypes` but had different input types.\n\t */\n\tprotected getStructuralType(\n\t\tfullName: string,\n\t\ttypes: TreeNodeSchema | readonly TreeNodeSchema[],\n\t\tbuilder: () => TreeNodeSchema,\n\t): TreeNodeSchema {\n\t\tconst structural = getOrCreate(this.structuralTypes, fullName, builder);\n\t\tconst inputTypes = new Set(normalizeAllowedTypes(types));\n\t\tconst outputTypes = new Set(\n\t\t\tnormalizeAllowedTypes(structural.info as TreeNodeSchema | readonly TreeNodeSchema[]),\n\t\t);\n\t\t// If our cached value had a different set of types then were requested, the user must have caused a collision.\n\t\tconst same = compareSets({ a: inputTypes, b: outputTypes });\n\t\tif (!same) {\n\t\t\tthrow new UsageError(\n\t\t\t\t`Structurally named schema collision: two schema named \"${fullName}\" were defined with different input schema.`,\n\t\t\t);\n\t\t}\n\t\treturn structural;\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\tconst array = arraySchema(\n\t\t\tthis.scoped(name),\n\t\t\tallowedTypes,\n\t\t\timplicitlyConstructable,\n\t\t\tcustomizable,\n\t\t);\n\n\t\treturn array as TreeNodeSchemaBoth<\n\t\t\tScopedSchemaName<TScope, Name>,\n\t\t\tNodeKind.Array,\n\t\t\tTreeArrayNode<T> & WithType<ScopedSchemaName<TScope, string>, NodeKind.Array>,\n\t\t\tIterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>,\n\t\t\tImplicitlyConstructable,\n\t\t\tT,\n\t\t\tundefined\n\t\t>;\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 *\n\t * - It is compressed to a space-efficient representation when stored in the document.\n\t * Reading the identifier before inserting the node into a tree prevents the identifier from being stored in its compressed form,\n\t * resulting in a larger storage footprint.\n\t *\n\t * - A compressed form of the identifier can be accessed at runtime via the {@link TreeNodeApi.shortId|Tree.shortId()} API.\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(\n\t\t\t\tcontext: FlexTreeHydratedContextMinimal | \"UseGlobalContext\",\n\t\t\t): UnhydratedFlexTreeNode[] => {\n\t\t\t\tconst id =\n\t\t\t\t\tcontext === \"UseGlobalContext\"\n\t\t\t\t\t\t? globalIdentifierAllocator.decompress(\n\t\t\t\t\t\t\t\tglobalIdentifierAllocator.generateCompressedId(),\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t: context.nodeKeyManager.stabilizeNodeIdentifier(\n\t\t\t\t\t\t\t\tcontext.nodeKeyManager.generateLocalNodeIdentifier(),\n\t\t\t\t\t\t\t);\n\n\t\t\t\treturn [unhydratedFlexTreeFromInsertable(id, this.string)];\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 * See also {@link FixRecursiveArraySchema} for additional information specific to recursive arrays schema exports.\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\n/**\n * Used to allocate default identifiers for unhydrated nodes when no context is available.\n * @remarks\n * The identifiers allocated by this will never be compressed to Short Ids.\n * Using this is only better than creating fully random V4 UUIDs because it reduces the entropy making it possible for things like text compression to work slightly better.\n */\nconst globalIdentifierAllocator: IIdCompressor = createIdCompressor();\n\n/**\n * Additional information to provide to Node Schema creation.\n *\n * @typeParam TCustomMetadata - Custom metadata properties to associate with the Node Schema.\n * See {@link NodeSchemaMetadata.custom}.\n *\n * @sealed\n * @public\n */\nexport interface NodeSchemaOptions<out TCustomMetadata = unknown> {\n\t/**\n\t * Optional metadata to associate with the Node Schema.\n\t *\n\t * @remarks\n\t * Note: this metadata is not persisted nor made part of the collaborative state; it is strictly client-local.\n\t * Different clients in the same collaborative session may see different metadata for the same field.\n\t */\n\treadonly metadata?: NodeSchemaMetadata<TCustomMetadata> | undefined;\n}\n\n/**\n * Additional information to provide to Node Schema creation. Includes fields for alpha features.\n *\n * @typeParam TCustomMetadata - Custom metadata properties to associate with the Node Schema.\n * See {@link NodeSchemaMetadata.custom}.\n *\n * @alpha\n */\nexport interface NodeSchemaOptionsAlpha<out TCustomMetadata = unknown>\n\textends NodeSchemaOptions<TCustomMetadata> {\n\t/**\n\t * The persisted metadata for this schema element.\n\t */\n\treadonly persistedMetadata?: JsonCompatibleReadOnlyObject | undefined;\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;AAC9E,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAMtE,OAAO,EAGN,WAAW,EACX,WAAW,EACX,eAAe,GACf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAcxF,OAAO,EACN,aAAa,EACb,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,YAAY,GAIZ,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACN,WAAW,EAEX,SAAS,EACT,YAAY,GAMZ,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACN,SAAS,EAMT,iBAAiB,EAE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AiB,AAAxC,CAAyC;AA6LlF,MAAM,UAAU,cAAc,CAC7B,cAAiB,EACjB,YAAwD;IAExD,IAAI,KAAa,CAAC;IAClB,IAAI,CAAC,eAAe,CAAC,YAAY,CAAC,EAAE,CAAC;QACpC,OAAO,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;AAED,MAAM,UAAU,MAAM,CAIpB,OAAqC,EAAE,IAAU;IAClD,OAAO,CACN,OAAO,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,KAAK,IAAI,IAAI,EAAE,CAClC,CAAC;AACrC,CAAC;AAED;;;;;GAKG;AACH,MAAM,yBAAyB,GAAkB,kBAAkB,EAAE,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 { isFluidHandle } from \"@fluidframework/runtime-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport type { TreeValue } from \"../../core/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\";\nimport {\n\ttype JsonCompatibleReadOnlyObject,\n\ttype RestrictiveStringRecord,\n\tcompareSets,\n\tgetOrCreate,\n\tisReadonlyArray,\n} from \"../../util/index.js\";\nimport { normalizeAllowedTypes, markSchemaMostDerived, isLazy } from \"../core/index.js\";\nimport type {\n\tNodeKind,\n\tWithType,\n\tTreeNodeSchema,\n\tTreeNodeSchemaClass,\n\tTreeNodeSchemaNonClass,\n\tTreeNodeSchemaBoth,\n\tUnhydratedFlexTreeNode,\n\tNodeSchemaMetadata,\n\tUnannotateImplicitAllowedTypes,\n\tImplicitAllowedTypes,\n\tInsertableTreeNodeFromImplicitAllowedTypes,\n} from \"../core/index.js\";\nimport {\n\tbooleanSchema,\n\thandleSchema,\n\tnullSchema,\n\tnumberSchema,\n\tstringSchema,\n\t// This import prevents a large number of LeafSchema references in the API reports from showing up as LeafSchema_2.\n\t// eslint-disable-next-line unused-imports/no-unused-imports, @typescript-eslint/no-unused-vars\n\ttype LeafSchema,\n} from \"../leafNodeSchema.js\";\nimport {\n\tarraySchema,\n\ttype MapNodeInsertableData,\n\tmapSchema,\n\tobjectSchema,\n\ttype TreeArrayNode,\n\ttype InsertableObjectFromSchemaRecord,\n\ttype TreeMapNode,\n\ttype TreeObjectNode,\n\ttype UnannotateSchemaRecord,\n} from \"../node-kinds/index.js\";\nimport {\n\tFieldKind,\n\ttype FieldSchema,\n\ttype ImplicitFieldSchema,\n\t// This import prevents a large number of FieldProps references in the API reports from showing up as FieldProps_2.\n\t// eslint-disable-next-line unused-imports/no-unused-imports, @typescript-eslint/no-unused-vars\n\ttype FieldProps,\n\tcreateFieldSchema,\n\ttype DefaultProvider,\n\tgetDefaultProvider,\n} from \"../fieldSchema.js\";\n\nimport type { System_Unsafe } from \"./typesUnsafe.js\";\nimport type { IIdCompressor } from \"@fluidframework/id-compressor\";\nimport { createIdCompressor } from \"@fluidframework/id-compressor/internal\";\nimport type { FlexTreeHydratedContextMinimal } from \"../../feature-libraries/index.js\";\nimport { unhydratedFlexTreeFromInsertable } from \"../unhydratedFlexTreeFromInsertable.js\";\nimport { type SchemaStatics, schemaStatics } from \"./schemaStatics.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 * @input\n * @alpha\n */\nexport interface SchemaFactoryObjectOptions<TCustomMetadata = unknown>\n\textends NodeSchemaOptionsAlpha<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 * The existing import and export APIs have similar problems.\n\t * For example currently the {@link (TreeAlpha:interface).exportVerbose|exportVerbose} API with stored keys preserves unknown optional fields,\n\t * but {@link Unhydrated} nodes produced by {@link TreeNode} constructors, insertable content, and {@link (TreeAlpha:interface).importVerbose|importVerbose} do not.\n\t * {@link (TreeBeta:interface).clone} however can be used to clone a node preserving unknown optional fields.\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.\n\t * It's only when application code reaches into a node\n\t * (either by accessing its fields, spreading it, or some other means) that this problem arises.\n\t */\n\treadonly allowUnknownOptionalFields?: boolean;\n}\n\n/**\n * Default options for Object node schema creation.\n * @remarks Omits parameters that are not relevant for common use cases.\n */\nexport const defaultSchemaFactoryObjectOptions: Required<\n\tOmit<SchemaFactoryObjectOptions, \"metadata\" | \"persistedMetadata\">\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\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 *\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 *\n * 3. Properties for fields defined in the schema should not be overridden.\n *\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 *\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\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\t// The compiler can't infer that UnannotateSchemaRecord<T> is equal to T so we have to do a bunch of typing to make the error go away.\n\t\tconst object: TreeNodeSchemaClass<\n\t\t\tScopedSchemaName<TScope, Name>,\n\t\t\tNodeKind.Object,\n\t\t\tTreeObjectNode<UnannotateSchemaRecord<T>, ScopedSchemaName<TScope, Name>>,\n\t\t\tobject & InsertableObjectFromSchemaRecord<UnannotateSchemaRecord<T>>,\n\t\t\ttrue,\n\t\t\tT\n\t\t> = objectSchema(\n\t\t\tscoped(this, name),\n\t\t\tfields,\n\t\t\ttrue,\n\t\t\tdefaultSchemaFactoryObjectOptions.allowUnknownOptionalFields,\n\t\t);\n\n\t\treturn object as TreeNodeSchemaClass<\n\t\t\tScopedSchemaName<TScope, Name>,\n\t\t\tNodeKind.Object,\n\t\t\tTreeObjectNode<RestrictiveStringRecord<ImplicitFieldSchema>>,\n\t\t\tunknown,\n\t\t\ttrue,\n\t\t\tT\n\t\t> as TreeNodeSchemaClass<\n\t\t\tScopedSchemaName<TScope, Name>,\n\t\t\tNodeKind.Object,\n\t\t\tTreeObjectNode<T, ScopedSchemaName<TScope, Name>>,\n\t\t\tobject & InsertableObjectFromSchemaRecord<T>,\n\t\t\ttrue,\n\t\t\tT\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 this.getStructuralType(fullName, types, () =>\n\t\t\t\tthis.namedMap(fullName, nameOrAllowedTypes as T, false, true),\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 up-casting 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\t// The compiler can't infer that UnannotateImplicitAllowedTypes<T> is equal to T so we have to do a bunch of typing to make the error go away.\n\t\tconst map: TreeNodeSchemaBoth<\n\t\t\tScopedSchemaName<TScope, Name>,\n\t\t\tNodeKind.Map,\n\t\t\tTreeMapNode<UnannotateImplicitAllowedTypes<T>> &\n\t\t\t\tWithType<ScopedSchemaName<TScope, Name>, NodeKind.Map>,\n\t\t\tMapNodeInsertableData<UnannotateImplicitAllowedTypes<T>>,\n\t\t\tImplicitlyConstructable,\n\t\t\tT,\n\t\t\tundefined\n\t\t> = mapSchema(\n\t\t\tscoped(this, 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\n\t\treturn map as TreeNodeSchemaBoth<\n\t\t\tScopedSchemaName<TScope, Name>,\n\t\t\tNodeKind.Map,\n\t\t\tTreeMapNode<UnannotateImplicitAllowedTypes<T>> &\n\t\t\t\tWithType<ScopedSchemaName<TScope, Name>, NodeKind.Map>,\n\t\t\tMapNodeInsertableData<ImplicitAllowedTypes>,\n\t\t\tImplicitlyConstructable,\n\t\t\tT,\n\t\t\tundefined\n\t\t> as TreeNodeSchemaBoth<\n\t\t\tScopedSchemaName<TScope, Name>,\n\t\t\tNodeKind.Map,\n\t\t\tTreeMapNode<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Map>,\n\t\t\tMapNodeInsertableData<T>,\n\t\t\tImplicitlyConstructable,\n\t\t\tT,\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 will allow assignment between runtime incompatible types at compile time.\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 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 this.getStructuralType(fullName, types, () =>\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 * Retrieves or creates a structural {@link TreeNodeSchema} with the specified name and types.\n\t *\n\t * @param fullName - The name for the structural schema.\n\t * @param types - The input schema(s) used to define the structural schema.\n\t * @param builder - A function that builds the schema if it does not already exist.\n\t * @returns The structural {@link TreeNodeSchema} associated with the given name and types.\n\t * @throws `UsageError` if a schema structurally named schema with the same name is cached in `structuralTypes` but had different input types.\n\t */\n\tprotected getStructuralType(\n\t\tfullName: string,\n\t\ttypes: TreeNodeSchema | readonly TreeNodeSchema[],\n\t\tbuilder: () => TreeNodeSchema,\n\t): TreeNodeSchema {\n\t\tconst structural = getOrCreate(this.structuralTypes, fullName, builder);\n\t\tconst inputTypes = new Set(normalizeAllowedTypes(types));\n\t\tconst outputTypes = new Set(\n\t\t\tnormalizeAllowedTypes(structural.info as TreeNodeSchema | readonly TreeNodeSchema[]),\n\t\t);\n\t\t// If our cached value had a different set of types then were requested, the user must have caused a collision.\n\t\tconst same = compareSets({ a: inputTypes, b: outputTypes });\n\t\tif (!same) {\n\t\t\tthrow new UsageError(\n\t\t\t\t`Structurally named schema collision: two schema named \"${fullName}\" were defined with different input schema.`,\n\t\t\t);\n\t\t}\n\t\treturn structural;\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\tconst array = arraySchema(\n\t\t\tscoped(this, name),\n\t\t\tallowedTypes,\n\t\t\timplicitlyConstructable,\n\t\t\tcustomizable,\n\t\t);\n\n\t\treturn array as TreeNodeSchemaBoth<\n\t\t\tScopedSchemaName<TScope, Name>,\n\t\t\tNodeKind.Array,\n\t\t\tTreeArrayNode<T> & WithType<ScopedSchemaName<TScope, string>, NodeKind.Array>,\n\t\t\tIterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>,\n\t\t\tImplicitlyConstructable,\n\t\t\tT,\n\t\t\tundefined\n\t\t>;\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 *\n\t * - It is compressed to a space-efficient representation when stored in the document.\n\t * Reading the identifier before inserting the node into a tree prevents the identifier from being stored in its compressed form,\n\t * resulting in a larger storage footprint.\n\t *\n\t * - A compressed form of the identifier can be accessed at runtime via the {@link TreeNodeApi.shortId|Tree.shortId()} API.\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(\n\t\t\t\tcontext: FlexTreeHydratedContextMinimal | \"UseGlobalContext\",\n\t\t\t): UnhydratedFlexTreeNode[] => {\n\t\t\t\tconst id =\n\t\t\t\t\tcontext === \"UseGlobalContext\"\n\t\t\t\t\t\t? globalIdentifierAllocator.decompress(\n\t\t\t\t\t\t\t\tglobalIdentifierAllocator.generateCompressedId(),\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t: context.nodeKeyManager.stabilizeNodeIdentifier(\n\t\t\t\t\t\t\t\tcontext.nodeKeyManager.generateLocalNodeIdentifier(),\n\t\t\t\t\t\t\t);\n\n\t\t\t\treturn [unhydratedFlexTreeFromInsertable(id, this.string)];\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 * See also {@link FixRecursiveArraySchema} for additional information specific to recursive arrays schema exports.\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\nexport function scoped<\n\tTScope extends string | undefined,\n\tTName extends number | string,\n\tName extends TName | string,\n>(factory: SchemaFactory<TScope, TName>, name: Name): ScopedSchemaName<TScope, Name> {\n\treturn (\n\t\tfactory.scope === undefined ? `${name}` : `${factory.scope}.${name}`\n\t) as ScopedSchemaName<TScope, Name>;\n}\n\n/**\n * Used to allocate default identifiers for unhydrated nodes when no context is available.\n * @remarks\n * The identifiers allocated by this will never be compressed to Short Ids.\n * Using this is only better than creating fully random V4 UUIDs because it reduces the entropy making it possible for things like text compression to work slightly better.\n */\nconst globalIdentifierAllocator: IIdCompressor = createIdCompressor();\n\n/**\n * Additional information to provide to Node Schema creation.\n *\n * @typeParam TCustomMetadata - Custom metadata properties to associate with the Node Schema.\n * See {@link NodeSchemaMetadata.custom}.\n *\n * @input\n * @public\n */\nexport interface NodeSchemaOptions<out TCustomMetadata = unknown> {\n\t/**\n\t * Optional metadata to associate with the Node Schema.\n\t *\n\t * @remarks\n\t * This specifies {@link SimpleNodeSchemaBase.metadata} which has more details about its use.\n\t */\n\treadonly metadata?: NodeSchemaMetadata<TCustomMetadata> | undefined;\n}\n\n/**\n * Additional information to provide to Node Schema creation. Includes fields for alpha features.\n *\n * @typeParam TCustomMetadata - Custom metadata properties to associate with the Node Schema.\n * See {@link NodeSchemaMetadata.custom}.\n *\n * @input\n * @alpha\n */\nexport interface NodeSchemaOptionsAlpha<out TCustomMetadata = unknown>\n\textends NodeSchemaOptions<TCustomMetadata> {\n\t/**\n\t * The persisted metadata for this schema element.\n\t * @remarks\n\t * This gets exposed via {@link SimpleNodeSchemaBaseAlpha.persistedMetadata}.\n\t */\n\treadonly persistedMetadata?: JsonCompatibleReadOnlyObject | undefined;\n}\n"]}
@@ -3,12 +3,13 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { type ArrayNodeCustomizableSchema, type MapNodeCustomizableSchema, type ObjectNodeSchema, type RecordNodeCustomizableSchema, type RecordNodeInsertableData, type TreeRecordNode } from "../node-kinds/index.js";
6
- import { SchemaFactory, type NodeSchemaOptionsAlpha, type SchemaFactoryObjectOptions, type ScopedSchemaName } from "./schemaFactory.js";
6
+ import { type NodeSchemaOptionsAlpha, type SchemaFactoryObjectOptions, type ScopedSchemaName } from "./schemaFactory.js";
7
7
  import type { ImplicitAnnotatedFieldSchema } from "../fieldSchema.js";
8
8
  import type { RestrictiveStringRecord } from "../../util/index.js";
9
9
  import type { NodeKind, TreeNodeSchema, TreeNodeSchemaClass, TreeNodeSchemaNonClass, WithType, ImplicitAllowedTypes, ImplicitAnnotatedAllowedTypes, AnnotatedAllowedType, LazyItem } from "../core/index.js";
10
10
  import type { ArrayNodeCustomizableSchemaUnsafe, MapNodeCustomizableSchemaUnsafe, System_Unsafe, TreeRecordNodeUnsafe } from "./typesUnsafe.js";
11
11
  import type { SimpleObjectNodeSchema } from "../simpleSchema.js";
12
+ import { SchemaFactoryBeta } from "./schemaFactoryBeta.js";
12
13
  import type { FieldProps, FieldSchemaAlpha, FieldPropsAlpha, FieldKind } from "../fieldSchema.js";
13
14
  import type { LeafSchema } from "../leafNodeSchema.js";
14
15
  import type { SimpleLeafNodeSchema } from "../simpleSchema.js";
@@ -147,12 +148,11 @@ export interface SchemaStaticsAlpha {
147
148
  *
148
149
  * @alpha
149
150
  * @privateRemarks
150
- *
151
- * Some private methods on `SchemaFactory` are intentionally duplicated here to avoid increasing their exposure to `protected`.
152
- * If we were to do so, they would be exposed on the public API surface of `SchemaFactory`.
151
+ * When building schema, when `options` is not provided, `TCustomMetadata` is inferred as `unknown`.
152
+ * If desired, this could be made to infer `undefined` instead by adding overloads for everything,
153
+ * but currently it is not worth the maintenance overhead as there is no use case which this is known to be helpful for.
153
154
  */
154
- export declare class SchemaFactoryAlpha<out TScope extends string | undefined = string | undefined, TName extends number | string = string> extends SchemaFactory<TScope, TName> {
155
- private scoped2;
155
+ export declare class SchemaFactoryAlpha<out TScope extends string | undefined = string | undefined, TName extends number | string = string> extends SchemaFactoryBeta<TScope, TName> {
156
156
  /**
157
157
  * Define a {@link TreeNodeSchemaClass} for a {@link TreeObjectNode}.
158
158
  *
@@ -261,7 +261,7 @@ export declare class SchemaFactoryAlpha<out TScope extends string | undefined =
261
261
  */
262
262
  mapRecursive<Name extends TName, const T extends System_Unsafe.ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(name: Name, allowedTypes: T, options?: NodeSchemaOptionsAlpha<TCustomMetadata>): MapNodeCustomizableSchemaUnsafe<ScopedSchemaName<TScope, Name>, T, TCustomMetadata>;
263
263
  /**
264
- * Define (and add to this library) a {@link TreeNodeSchemaClass} for a {@link (TreeArrayNode:interface)}.
264
+ * Define a {@link TreeNodeSchemaClass} for a {@link (TreeArrayNode:interface)}.
265
265
  *
266
266
  * @param name - Unique identifier for this schema within this factory's scope.
267
267
  * @param allowedTypes - The types that may appear in the array.
@@ -339,13 +339,12 @@ export declare class SchemaFactoryAlpha<out TScope extends string | undefined =
339
339
  */
340
340
  record<const Name extends TName, const T extends ImplicitAllowedTypes>(name: Name, allowedTypes: T): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Record, TreeRecordNode<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Record>, RecordNodeInsertableData<T>, true, T, undefined>;
341
341
  /**
342
- * Define a {@link TreeNodeSchema} for a {@link (TreeArrayNode:interface)}.
342
+ * Define a {@link TreeNodeSchema} for a {@link (TreeRecordNode:interface)}.
343
343
  *
344
344
  * @param name - Unique identifier for this schema within this factory's scope.
345
345
  *
346
346
  * @remarks
347
- * This is not intended to be used directly, use the overload of `array` which takes a name instead.
348
- * This is only public to work around a compiler limitation.
347
+ * This is not intended to be used directly, use the overload of `record` which takes a name instead.
349
348
  */
350
349
  private namedRecord;
351
350
  /**
@@ -368,15 +367,12 @@ export declare class SchemaFactoryAlpha<out TScope extends string | undefined =
368
367
  * This version of `SchemaFactory.record` uses the same workarounds as {@link SchemaFactory.objectRecursive}.
369
368
  * See {@link ValidateRecursiveSchema} for additional information about using recursive schema.
370
369
  */
371
- recordRecursive<Name extends TName, const T extends System_Unsafe.ImplicitAllowedTypesUnsafe>(name: Name, allowedTypes: T): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Record, TreeRecordNodeUnsafe<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Record, unknown>, {
370
+ recordRecursive<Name extends TName, const T extends System_Unsafe.ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(name: Name, allowedTypes: T, options?: NodeSchemaOptionsAlpha<TCustomMetadata>): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Record, TreeRecordNodeUnsafe<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Record, unknown>, {
372
371
  readonly [x: string]: System_Unsafe.InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>;
373
- }, false, T, undefined>;
372
+ }, false, T, undefined, TCustomMetadata>;
374
373
  /**
375
- * Create a {@link SchemaFactory} with a {@link SchemaFactory.scope|scope} which is a combination of this factory's scope and the provided name.
376
- * @remarks
377
- * The main use-case for this is when creating a collection of related schema (for example using a function that creates multiple schema).
378
- * Creating such related schema using a sub-scope helps ensure they won't collide with other schema in the parent scope.
374
+ * {@inheritDoc SchemaFactoryBeta.scopedFactory}
379
375
  */
380
- scopedFactory<const T extends TName, TNameInner extends number | string = string>(name: T): SchemaFactoryAlpha<ScopedSchemaName<TScope, T>, TNameInner>;
376
+ scopedFactoryAlpha<const T extends TName, TNameInner extends number | string = string>(name: T): SchemaFactoryAlpha<ScopedSchemaName<TScope, T>, TNameInner>;
381
377
  }
382
378
  //# sourceMappingURL=schemaFactoryAlpha.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schemaFactoryAlpha.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/schemaFactoryAlpha.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,2BAA2B,EAEhC,KAAK,yBAAyB,EAE9B,KAAK,gBAAgB,EAErB,KAAK,4BAA4B,EACjC,KAAK,wBAAwB,EAE7B,KAAK,cAAc,EACnB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAEN,aAAa,EAEb,KAAK,sBAAsB,EAC3B,KAAK,0BAA0B,EAC/B,KAAK,gBAAgB,EACrB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,KAAK,EAAE,4BAA4B,EAAuB,MAAM,mBAAmB,CAAC;AAC3F,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,KAAK,EACX,QAAQ,EACR,cAAc,EAEd,mBAAmB,EACnB,sBAAsB,EACtB,QAAQ,EACR,oBAAoB,EACpB,6BAA6B,EAC7B,oBAAoB,EACpB,QAAQ,EACR,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EACX,iCAAiC,EACjC,+BAA+B,EAC/B,aAAa,EACb,oBAAoB,EACpB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAIjE,OAAO,KAAK,EACX,UAAU,EACV,gBAAgB,EAChB,eAAe,EACf,SAAS,EACT,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,UAA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