@fluidframework/tree 2.11.0 → 2.12.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 (537) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/api-report/tree.alpha.api.md +2 -2
  3. package/api-report/tree.beta.api.md +1 -1
  4. package/api-report/tree.legacy.alpha.api.md +1 -1
  5. package/api-report/tree.legacy.public.api.md +1 -1
  6. package/api-report/tree.public.api.md +1 -1
  7. package/dist/core/index.d.ts +2 -2
  8. package/dist/core/index.d.ts.map +1 -1
  9. package/dist/core/index.js +5 -3
  10. package/dist/core/index.js.map +1 -1
  11. package/dist/core/rebase/utils.d.ts.map +1 -1
  12. package/dist/core/rebase/utils.js +2 -9
  13. package/dist/core/rebase/utils.js.map +1 -1
  14. package/dist/core/schema-stored/format.d.ts +0 -3
  15. package/dist/core/schema-stored/format.d.ts.map +1 -1
  16. package/dist/core/schema-stored/format.js.map +1 -1
  17. package/dist/core/schema-stored/schema.d.ts +12 -10
  18. package/dist/core/schema-stored/schema.d.ts.map +1 -1
  19. package/dist/core/schema-stored/schema.js +3 -5
  20. package/dist/core/schema-stored/schema.js.map +1 -1
  21. package/dist/core/schema-view/index.d.ts +1 -1
  22. package/dist/core/schema-view/index.d.ts.map +1 -1
  23. package/dist/core/schema-view/index.js +1 -2
  24. package/dist/core/schema-view/index.js.map +1 -1
  25. package/dist/core/schema-view/view.d.ts +0 -7
  26. package/dist/core/schema-view/view.d.ts.map +1 -1
  27. package/dist/core/schema-view/view.js +1 -12
  28. package/dist/core/schema-view/view.js.map +1 -1
  29. package/dist/{feature-libraries/chunked-forest → core/tree}/chunk.d.ts +2 -1
  30. package/dist/core/tree/chunk.d.ts.map +1 -0
  31. package/dist/{feature-libraries/chunked-forest → core/tree}/chunk.js +2 -2
  32. package/dist/core/tree/chunk.js.map +1 -0
  33. package/dist/core/tree/index.d.ts +1 -0
  34. package/dist/core/tree/index.d.ts.map +1 -1
  35. package/dist/core/tree/index.js +5 -1
  36. package/dist/core/tree/index.js.map +1 -1
  37. package/dist/core/tree/treeTextFormat.d.ts +0 -5
  38. package/dist/core/tree/treeTextFormat.d.ts.map +1 -1
  39. package/dist/core/tree/treeTextFormat.js.map +1 -1
  40. package/dist/core/tree/types.d.ts +0 -5
  41. package/dist/core/tree/types.d.ts.map +1 -1
  42. package/dist/core/tree/types.js +0 -1
  43. package/dist/core/tree/types.js.map +1 -1
  44. package/dist/feature-libraries/chunked-forest/basicChunk.d.ts +1 -2
  45. package/dist/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
  46. package/dist/feature-libraries/chunked-forest/basicChunk.js +14 -14
  47. package/dist/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
  48. package/dist/feature-libraries/chunked-forest/chunkTree.d.ts +1 -2
  49. package/dist/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  50. package/dist/feature-libraries/chunked-forest/chunkTree.js +2 -3
  51. package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  52. package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts +1 -2
  53. package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  54. package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  55. package/dist/feature-libraries/chunked-forest/codec/chunkCodecUtilities.d.ts +1 -2
  56. package/dist/feature-libraries/chunked-forest/codec/chunkCodecUtilities.d.ts.map +1 -1
  57. package/dist/feature-libraries/chunked-forest/codec/chunkCodecUtilities.js.map +1 -1
  58. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +1 -2
  59. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  60. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  61. package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts +1 -1
  62. package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts.map +1 -1
  63. package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
  64. package/dist/feature-libraries/chunked-forest/emptyChunk.d.ts +1 -1
  65. package/dist/feature-libraries/chunked-forest/emptyChunk.d.ts.map +1 -1
  66. package/dist/feature-libraries/chunked-forest/emptyChunk.js +2 -3
  67. package/dist/feature-libraries/chunked-forest/emptyChunk.js.map +1 -1
  68. package/dist/feature-libraries/chunked-forest/index.d.ts +1 -1
  69. package/dist/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  70. package/dist/feature-libraries/chunked-forest/index.js +5 -5
  71. package/dist/feature-libraries/chunked-forest/index.js.map +1 -1
  72. package/dist/feature-libraries/chunked-forest/sequenceChunk.d.ts +1 -1
  73. package/dist/feature-libraries/chunked-forest/sequenceChunk.d.ts.map +1 -1
  74. package/dist/feature-libraries/chunked-forest/sequenceChunk.js +2 -2
  75. package/dist/feature-libraries/chunked-forest/sequenceChunk.js.map +1 -1
  76. package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts +1 -2
  77. package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
  78. package/dist/feature-libraries/chunked-forest/uniformChunk.js +13 -13
  79. package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  80. package/dist/feature-libraries/default-schema/defaultSchema.d.ts.map +1 -1
  81. package/dist/feature-libraries/default-schema/defaultSchema.js +1 -0
  82. package/dist/feature-libraries/default-schema/defaultSchema.js.map +1 -1
  83. package/dist/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
  84. package/dist/feature-libraries/default-schema/schemaChecker.js +2 -1
  85. package/dist/feature-libraries/default-schema/schemaChecker.js.map +1 -1
  86. package/dist/feature-libraries/index.d.ts +1 -1
  87. package/dist/feature-libraries/index.d.ts.map +1 -1
  88. package/dist/feature-libraries/index.js +6 -2
  89. package/dist/feature-libraries/index.js.map +1 -1
  90. package/dist/feature-libraries/indexing/anchorTreeIndex.d.ts +8 -1
  91. package/dist/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -1
  92. package/dist/feature-libraries/indexing/anchorTreeIndex.js +31 -5
  93. package/dist/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
  94. package/dist/feature-libraries/modular-schema/discrepancies.d.ts +84 -24
  95. package/dist/feature-libraries/modular-schema/discrepancies.d.ts.map +1 -1
  96. package/dist/feature-libraries/modular-schema/discrepancies.js +32 -33
  97. package/dist/feature-libraries/modular-schema/discrepancies.js.map +1 -1
  98. package/dist/feature-libraries/modular-schema/index.d.ts +1 -1
  99. package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
  100. package/dist/feature-libraries/modular-schema/index.js +5 -1
  101. package/dist/feature-libraries/modular-schema/index.js.map +1 -1
  102. package/dist/feature-libraries/modular-schema/isNeverTree.d.ts +0 -1
  103. package/dist/feature-libraries/modular-schema/isNeverTree.d.ts.map +1 -1
  104. package/dist/feature-libraries/modular-schema/isNeverTree.js +0 -1
  105. package/dist/feature-libraries/modular-schema/isNeverTree.js.map +1 -1
  106. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts +6 -6
  107. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts.map +1 -1
  108. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts +7 -7
  109. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts.map +1 -1
  110. package/dist/feature-libraries/schema-edits/schemaChangeFormat.d.ts +12 -12
  111. package/dist/feature-libraries/sequence-field/formatV1.d.ts +99 -99
  112. package/dist/feature-libraries/sequence-field/formatV1.d.ts.map +1 -1
  113. package/dist/feature-libraries/sequence-field/formatV2.d.ts +76 -76
  114. package/dist/feature-libraries/sequence-field/formatV2.d.ts.map +1 -1
  115. package/dist/feature-libraries/sequence-field/formatV3.d.ts +54 -54
  116. package/dist/feature-libraries/sequence-field/types.d.ts +0 -1
  117. package/dist/feature-libraries/sequence-field/types.d.ts.map +1 -1
  118. package/dist/feature-libraries/sequence-field/types.js.map +1 -1
  119. package/dist/index.d.ts +4 -5
  120. package/dist/index.d.ts.map +1 -1
  121. package/dist/index.js +1 -14
  122. package/dist/index.js.map +1 -1
  123. package/dist/packageVersion.d.ts +1 -1
  124. package/dist/packageVersion.js +1 -1
  125. package/dist/packageVersion.js.map +1 -1
  126. package/dist/shared-tree/index.d.ts +1 -1
  127. package/dist/shared-tree/index.d.ts.map +1 -1
  128. package/dist/shared-tree/index.js.map +1 -1
  129. package/dist/shared-tree/schematizeTree.d.ts +1 -1
  130. package/dist/shared-tree/schematizeTree.d.ts.map +1 -1
  131. package/dist/shared-tree/schematizeTree.js +6 -6
  132. package/dist/shared-tree/schematizeTree.js.map +1 -1
  133. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  134. package/dist/shared-tree/schematizingTreeView.js +8 -12
  135. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  136. package/dist/shared-tree/sharedTree.d.ts +25 -7
  137. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  138. package/dist/shared-tree/sharedTree.js +104 -15
  139. package/dist/shared-tree/sharedTree.js.map +1 -1
  140. package/dist/shared-tree/treeCheckout.d.ts +35 -12
  141. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  142. package/dist/shared-tree/treeCheckout.js +159 -127
  143. package/dist/shared-tree/treeCheckout.js.map +1 -1
  144. package/dist/shared-tree-core/branch.d.ts +13 -35
  145. package/dist/shared-tree-core/branch.d.ts.map +1 -1
  146. package/dist/shared-tree-core/branch.js +12 -77
  147. package/dist/shared-tree-core/branch.js.map +1 -1
  148. package/dist/shared-tree-core/branchCommitEnricher.d.ts +7 -1
  149. package/dist/shared-tree-core/branchCommitEnricher.d.ts.map +1 -1
  150. package/dist/shared-tree-core/branchCommitEnricher.js +16 -18
  151. package/dist/shared-tree-core/branchCommitEnricher.js.map +1 -1
  152. package/dist/shared-tree-core/editManager.d.ts.map +1 -1
  153. package/dist/shared-tree-core/editManager.js +2 -2
  154. package/dist/shared-tree-core/editManager.js.map +1 -1
  155. package/dist/shared-tree-core/index.d.ts +3 -3
  156. package/dist/shared-tree-core/index.d.ts.map +1 -1
  157. package/dist/shared-tree-core/index.js +2 -2
  158. package/dist/shared-tree-core/index.js.map +1 -1
  159. package/dist/shared-tree-core/sharedTreeCore.d.ts +2 -9
  160. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  161. package/dist/shared-tree-core/sharedTreeCore.js +4 -16
  162. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  163. package/dist/shared-tree-core/transaction.d.ts +38 -0
  164. package/dist/shared-tree-core/transaction.d.ts.map +1 -1
  165. package/dist/shared-tree-core/transaction.js +118 -6
  166. package/dist/shared-tree-core/transaction.js.map +1 -1
  167. package/dist/simple-tree/api/conciseTree.d.ts.map +1 -1
  168. package/dist/simple-tree/api/conciseTree.js +1 -1
  169. package/dist/simple-tree/api/conciseTree.js.map +1 -1
  170. package/dist/simple-tree/api/create.d.ts.map +1 -1
  171. package/dist/simple-tree/api/create.js +5 -1
  172. package/dist/simple-tree/api/create.js.map +1 -1
  173. package/dist/simple-tree/api/customTree.d.ts +14 -2
  174. package/dist/simple-tree/api/customTree.d.ts.map +1 -1
  175. package/dist/simple-tree/api/customTree.js +53 -3
  176. package/dist/simple-tree/api/customTree.js.map +1 -1
  177. package/dist/simple-tree/api/index.d.ts +2 -2
  178. package/dist/simple-tree/api/index.d.ts.map +1 -1
  179. package/dist/simple-tree/api/index.js +4 -1
  180. package/dist/simple-tree/api/index.js.map +1 -1
  181. package/dist/simple-tree/api/schemaFactory.d.ts +48 -0
  182. package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
  183. package/dist/simple-tree/api/schemaFactory.js +5 -2
  184. package/dist/simple-tree/api/schemaFactory.js.map +1 -1
  185. package/dist/simple-tree/api/simpleSchema.d.ts +3 -1
  186. package/dist/simple-tree/api/simpleSchema.d.ts.map +1 -1
  187. package/dist/simple-tree/api/simpleSchema.js.map +1 -1
  188. package/dist/simple-tree/api/simpleTreeIndex.js +3 -1
  189. package/dist/simple-tree/api/simpleTreeIndex.js.map +1 -1
  190. package/dist/simple-tree/api/storedSchema.d.ts +4 -4
  191. package/dist/simple-tree/api/storedSchema.d.ts.map +1 -1
  192. package/dist/simple-tree/api/storedSchema.js +8 -21
  193. package/dist/simple-tree/api/storedSchema.js.map +1 -1
  194. package/dist/simple-tree/api/tree.d.ts +1 -0
  195. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  196. package/dist/simple-tree/api/tree.js.map +1 -1
  197. package/dist/simple-tree/api/verboseTree.js +1 -1
  198. package/dist/simple-tree/api/verboseTree.js.map +1 -1
  199. package/dist/simple-tree/api/view.d.ts +14 -9
  200. package/dist/simple-tree/api/view.d.ts.map +1 -1
  201. package/dist/simple-tree/api/view.js +129 -40
  202. package/dist/simple-tree/api/view.js.map +1 -1
  203. package/dist/simple-tree/index.d.ts +2 -2
  204. package/dist/simple-tree/index.d.ts.map +1 -1
  205. package/dist/simple-tree/index.js +5 -2
  206. package/dist/simple-tree/index.js.map +1 -1
  207. package/dist/simple-tree/leafNodeSchema.d.ts +0 -15
  208. package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
  209. package/dist/simple-tree/leafNodeSchema.js +0 -15
  210. package/dist/simple-tree/leafNodeSchema.js.map +1 -1
  211. package/dist/simple-tree/objectNode.d.ts +8 -3
  212. package/dist/simple-tree/objectNode.d.ts.map +1 -1
  213. package/dist/simple-tree/objectNode.js +18 -2
  214. package/dist/simple-tree/objectNode.js.map +1 -1
  215. package/dist/simple-tree/objectNodeTypes.d.ts +4 -0
  216. package/dist/simple-tree/objectNodeTypes.d.ts.map +1 -1
  217. package/dist/simple-tree/objectNodeTypes.js.map +1 -1
  218. package/dist/simple-tree/schemaTypes.d.ts +4 -2
  219. package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
  220. package/dist/simple-tree/schemaTypes.js.map +1 -1
  221. package/dist/simple-tree/toStoredSchema.d.ts.map +1 -1
  222. package/dist/simple-tree/toStoredSchema.js +18 -13
  223. package/dist/simple-tree/toStoredSchema.js.map +1 -1
  224. package/dist/util/brand.d.ts +0 -2
  225. package/dist/util/brand.d.ts.map +1 -1
  226. package/dist/util/brand.js +0 -1
  227. package/dist/util/brand.js.map +1 -1
  228. package/dist/util/index.d.ts +1 -1
  229. package/dist/util/index.d.ts.map +1 -1
  230. package/dist/util/index.js +2 -1
  231. package/dist/util/index.js.map +1 -1
  232. package/dist/util/typeCheck.d.ts +0 -2
  233. package/dist/util/typeCheck.d.ts.map +1 -1
  234. package/dist/util/typeCheck.js.map +1 -1
  235. package/dist/util/utils.d.ts +13 -0
  236. package/dist/util/utils.d.ts.map +1 -1
  237. package/dist/util/utils.js +23 -1
  238. package/dist/util/utils.js.map +1 -1
  239. package/lib/core/index.d.ts +2 -2
  240. package/lib/core/index.d.ts.map +1 -1
  241. package/lib/core/index.js +2 -2
  242. package/lib/core/index.js.map +1 -1
  243. package/lib/core/rebase/utils.d.ts.map +1 -1
  244. package/lib/core/rebase/utils.js +3 -10
  245. package/lib/core/rebase/utils.js.map +1 -1
  246. package/lib/core/schema-stored/format.d.ts +0 -3
  247. package/lib/core/schema-stored/format.d.ts.map +1 -1
  248. package/lib/core/schema-stored/format.js.map +1 -1
  249. package/lib/core/schema-stored/schema.d.ts +12 -10
  250. package/lib/core/schema-stored/schema.d.ts.map +1 -1
  251. package/lib/core/schema-stored/schema.js +3 -5
  252. package/lib/core/schema-stored/schema.js.map +1 -1
  253. package/lib/core/schema-view/index.d.ts +1 -1
  254. package/lib/core/schema-view/index.d.ts.map +1 -1
  255. package/lib/core/schema-view/index.js +1 -1
  256. package/lib/core/schema-view/index.js.map +1 -1
  257. package/lib/core/schema-view/view.d.ts +0 -7
  258. package/lib/core/schema-view/view.d.ts.map +1 -1
  259. package/lib/core/schema-view/view.js +0 -11
  260. package/lib/core/schema-view/view.js.map +1 -1
  261. package/lib/{feature-libraries/chunked-forest → core/tree}/chunk.d.ts +2 -1
  262. package/lib/core/tree/chunk.d.ts.map +1 -0
  263. package/lib/{feature-libraries/chunked-forest → core/tree}/chunk.js +1 -1
  264. package/lib/core/tree/chunk.js.map +1 -0
  265. package/lib/core/tree/index.d.ts +1 -0
  266. package/lib/core/tree/index.d.ts.map +1 -1
  267. package/lib/core/tree/index.js +1 -0
  268. package/lib/core/tree/index.js.map +1 -1
  269. package/lib/core/tree/treeTextFormat.d.ts +0 -5
  270. package/lib/core/tree/treeTextFormat.d.ts.map +1 -1
  271. package/lib/core/tree/treeTextFormat.js.map +1 -1
  272. package/lib/core/tree/types.d.ts +0 -5
  273. package/lib/core/tree/types.d.ts.map +1 -1
  274. package/lib/core/tree/types.js +0 -1
  275. package/lib/core/tree/types.js.map +1 -1
  276. package/lib/feature-libraries/chunked-forest/basicChunk.d.ts +1 -2
  277. package/lib/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
  278. package/lib/feature-libraries/chunked-forest/basicChunk.js +1 -1
  279. package/lib/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
  280. package/lib/feature-libraries/chunked-forest/chunkTree.d.ts +1 -2
  281. package/lib/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  282. package/lib/feature-libraries/chunked-forest/chunkTree.js +1 -2
  283. package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  284. package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts +1 -2
  285. package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  286. package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  287. package/lib/feature-libraries/chunked-forest/codec/chunkCodecUtilities.d.ts +1 -2
  288. package/lib/feature-libraries/chunked-forest/codec/chunkCodecUtilities.d.ts.map +1 -1
  289. package/lib/feature-libraries/chunked-forest/codec/chunkCodecUtilities.js.map +1 -1
  290. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +1 -2
  291. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  292. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  293. package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts +1 -1
  294. package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts.map +1 -1
  295. package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
  296. package/lib/feature-libraries/chunked-forest/emptyChunk.d.ts +1 -1
  297. package/lib/feature-libraries/chunked-forest/emptyChunk.d.ts.map +1 -1
  298. package/lib/feature-libraries/chunked-forest/emptyChunk.js +1 -2
  299. package/lib/feature-libraries/chunked-forest/emptyChunk.js.map +1 -1
  300. package/lib/feature-libraries/chunked-forest/index.d.ts +1 -1
  301. package/lib/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  302. package/lib/feature-libraries/chunked-forest/index.js +1 -1
  303. package/lib/feature-libraries/chunked-forest/index.js.map +1 -1
  304. package/lib/feature-libraries/chunked-forest/sequenceChunk.d.ts +1 -1
  305. package/lib/feature-libraries/chunked-forest/sequenceChunk.d.ts.map +1 -1
  306. package/lib/feature-libraries/chunked-forest/sequenceChunk.js +1 -1
  307. package/lib/feature-libraries/chunked-forest/sequenceChunk.js.map +1 -1
  308. package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts +1 -2
  309. package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
  310. package/lib/feature-libraries/chunked-forest/uniformChunk.js +1 -1
  311. package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  312. package/lib/feature-libraries/default-schema/defaultSchema.d.ts.map +1 -1
  313. package/lib/feature-libraries/default-schema/defaultSchema.js +1 -0
  314. package/lib/feature-libraries/default-schema/defaultSchema.js.map +1 -1
  315. package/lib/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
  316. package/lib/feature-libraries/default-schema/schemaChecker.js +2 -1
  317. package/lib/feature-libraries/default-schema/schemaChecker.js.map +1 -1
  318. package/lib/feature-libraries/index.d.ts +1 -1
  319. package/lib/feature-libraries/index.d.ts.map +1 -1
  320. package/lib/feature-libraries/index.js +1 -1
  321. package/lib/feature-libraries/index.js.map +1 -1
  322. package/lib/feature-libraries/indexing/anchorTreeIndex.d.ts +8 -1
  323. package/lib/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -1
  324. package/lib/feature-libraries/indexing/anchorTreeIndex.js +31 -5
  325. package/lib/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
  326. package/lib/feature-libraries/modular-schema/discrepancies.d.ts +84 -24
  327. package/lib/feature-libraries/modular-schema/discrepancies.d.ts.map +1 -1
  328. package/lib/feature-libraries/modular-schema/discrepancies.js +25 -28
  329. package/lib/feature-libraries/modular-schema/discrepancies.js.map +1 -1
  330. package/lib/feature-libraries/modular-schema/index.d.ts +1 -1
  331. package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
  332. package/lib/feature-libraries/modular-schema/index.js +1 -1
  333. package/lib/feature-libraries/modular-schema/index.js.map +1 -1
  334. package/lib/feature-libraries/modular-schema/isNeverTree.d.ts +0 -1
  335. package/lib/feature-libraries/modular-schema/isNeverTree.d.ts.map +1 -1
  336. package/lib/feature-libraries/modular-schema/isNeverTree.js +0 -1
  337. package/lib/feature-libraries/modular-schema/isNeverTree.js.map +1 -1
  338. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts +6 -6
  339. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts.map +1 -1
  340. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts +7 -7
  341. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts.map +1 -1
  342. package/lib/feature-libraries/schema-edits/schemaChangeFormat.d.ts +12 -12
  343. package/lib/feature-libraries/sequence-field/formatV1.d.ts +99 -99
  344. package/lib/feature-libraries/sequence-field/formatV1.d.ts.map +1 -1
  345. package/lib/feature-libraries/sequence-field/formatV2.d.ts +76 -76
  346. package/lib/feature-libraries/sequence-field/formatV2.d.ts.map +1 -1
  347. package/lib/feature-libraries/sequence-field/formatV3.d.ts +54 -54
  348. package/lib/feature-libraries/sequence-field/types.d.ts +0 -1
  349. package/lib/feature-libraries/sequence-field/types.d.ts.map +1 -1
  350. package/lib/feature-libraries/sequence-field/types.js.map +1 -1
  351. package/lib/index.d.ts +4 -5
  352. package/lib/index.d.ts.map +1 -1
  353. package/lib/index.js +2 -3
  354. package/lib/index.js.map +1 -1
  355. package/lib/packageVersion.d.ts +1 -1
  356. package/lib/packageVersion.js +1 -1
  357. package/lib/packageVersion.js.map +1 -1
  358. package/lib/shared-tree/index.d.ts +1 -1
  359. package/lib/shared-tree/index.d.ts.map +1 -1
  360. package/lib/shared-tree/index.js.map +1 -1
  361. package/lib/shared-tree/schematizeTree.d.ts +1 -1
  362. package/lib/shared-tree/schematizeTree.d.ts.map +1 -1
  363. package/lib/shared-tree/schematizeTree.js +7 -7
  364. package/lib/shared-tree/schematizeTree.js.map +1 -1
  365. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  366. package/lib/shared-tree/schematizingTreeView.js +10 -14
  367. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  368. package/lib/shared-tree/sharedTree.d.ts +25 -7
  369. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  370. package/lib/shared-tree/sharedTree.js +105 -16
  371. package/lib/shared-tree/sharedTree.js.map +1 -1
  372. package/lib/shared-tree/treeCheckout.d.ts +35 -12
  373. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  374. package/lib/shared-tree/treeCheckout.js +161 -129
  375. package/lib/shared-tree/treeCheckout.js.map +1 -1
  376. package/lib/shared-tree-core/branch.d.ts +13 -35
  377. package/lib/shared-tree-core/branch.d.ts.map +1 -1
  378. package/lib/shared-tree-core/branch.js +12 -76
  379. package/lib/shared-tree-core/branch.js.map +1 -1
  380. package/lib/shared-tree-core/branchCommitEnricher.d.ts +7 -1
  381. package/lib/shared-tree-core/branchCommitEnricher.d.ts.map +1 -1
  382. package/lib/shared-tree-core/branchCommitEnricher.js +16 -18
  383. package/lib/shared-tree-core/branchCommitEnricher.js.map +1 -1
  384. package/lib/shared-tree-core/editManager.d.ts.map +1 -1
  385. package/lib/shared-tree-core/editManager.js +3 -3
  386. package/lib/shared-tree-core/editManager.js.map +1 -1
  387. package/lib/shared-tree-core/index.d.ts +3 -3
  388. package/lib/shared-tree-core/index.d.ts.map +1 -1
  389. package/lib/shared-tree-core/index.js +2 -2
  390. package/lib/shared-tree-core/index.js.map +1 -1
  391. package/lib/shared-tree-core/sharedTreeCore.d.ts +2 -9
  392. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  393. package/lib/shared-tree-core/sharedTreeCore.js +4 -16
  394. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  395. package/lib/shared-tree-core/transaction.d.ts +38 -0
  396. package/lib/shared-tree-core/transaction.d.ts.map +1 -1
  397. package/lib/shared-tree-core/transaction.js +112 -1
  398. package/lib/shared-tree-core/transaction.js.map +1 -1
  399. package/lib/simple-tree/api/conciseTree.d.ts.map +1 -1
  400. package/lib/simple-tree/api/conciseTree.js +2 -2
  401. package/lib/simple-tree/api/conciseTree.js.map +1 -1
  402. package/lib/simple-tree/api/create.d.ts.map +1 -1
  403. package/lib/simple-tree/api/create.js +5 -1
  404. package/lib/simple-tree/api/create.js.map +1 -1
  405. package/lib/simple-tree/api/customTree.d.ts +14 -2
  406. package/lib/simple-tree/api/customTree.d.ts.map +1 -1
  407. package/lib/simple-tree/api/customTree.js +50 -2
  408. package/lib/simple-tree/api/customTree.js.map +1 -1
  409. package/lib/simple-tree/api/index.d.ts +2 -2
  410. package/lib/simple-tree/api/index.d.ts.map +1 -1
  411. package/lib/simple-tree/api/index.js +2 -1
  412. package/lib/simple-tree/api/index.js.map +1 -1
  413. package/lib/simple-tree/api/schemaFactory.d.ts +48 -0
  414. package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
  415. package/lib/simple-tree/api/schemaFactory.js +4 -1
  416. package/lib/simple-tree/api/schemaFactory.js.map +1 -1
  417. package/lib/simple-tree/api/simpleSchema.d.ts +3 -1
  418. package/lib/simple-tree/api/simpleSchema.d.ts.map +1 -1
  419. package/lib/simple-tree/api/simpleSchema.js.map +1 -1
  420. package/lib/simple-tree/api/simpleTreeIndex.js +3 -1
  421. package/lib/simple-tree/api/simpleTreeIndex.js.map +1 -1
  422. package/lib/simple-tree/api/storedSchema.d.ts +4 -4
  423. package/lib/simple-tree/api/storedSchema.d.ts.map +1 -1
  424. package/lib/simple-tree/api/storedSchema.js +5 -18
  425. package/lib/simple-tree/api/storedSchema.js.map +1 -1
  426. package/lib/simple-tree/api/tree.d.ts +1 -0
  427. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  428. package/lib/simple-tree/api/tree.js.map +1 -1
  429. package/lib/simple-tree/api/verboseTree.js +2 -2
  430. package/lib/simple-tree/api/verboseTree.js.map +1 -1
  431. package/lib/simple-tree/api/view.d.ts +14 -9
  432. package/lib/simple-tree/api/view.d.ts.map +1 -1
  433. package/lib/simple-tree/api/view.js +131 -42
  434. package/lib/simple-tree/api/view.js.map +1 -1
  435. package/lib/simple-tree/index.d.ts +2 -2
  436. package/lib/simple-tree/index.d.ts.map +1 -1
  437. package/lib/simple-tree/index.js +2 -2
  438. package/lib/simple-tree/index.js.map +1 -1
  439. package/lib/simple-tree/leafNodeSchema.d.ts +0 -15
  440. package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
  441. package/lib/simple-tree/leafNodeSchema.js +0 -15
  442. package/lib/simple-tree/leafNodeSchema.js.map +1 -1
  443. package/lib/simple-tree/objectNode.d.ts +8 -3
  444. package/lib/simple-tree/objectNode.d.ts.map +1 -1
  445. package/lib/simple-tree/objectNode.js +16 -1
  446. package/lib/simple-tree/objectNode.js.map +1 -1
  447. package/lib/simple-tree/objectNodeTypes.d.ts +4 -0
  448. package/lib/simple-tree/objectNodeTypes.d.ts.map +1 -1
  449. package/lib/simple-tree/objectNodeTypes.js.map +1 -1
  450. package/lib/simple-tree/schemaTypes.d.ts +4 -2
  451. package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
  452. package/lib/simple-tree/schemaTypes.js.map +1 -1
  453. package/lib/simple-tree/toStoredSchema.d.ts.map +1 -1
  454. package/lib/simple-tree/toStoredSchema.js +19 -14
  455. package/lib/simple-tree/toStoredSchema.js.map +1 -1
  456. package/lib/util/brand.d.ts +0 -2
  457. package/lib/util/brand.d.ts.map +1 -1
  458. package/lib/util/brand.js +0 -1
  459. package/lib/util/brand.js.map +1 -1
  460. package/lib/util/index.d.ts +1 -1
  461. package/lib/util/index.d.ts.map +1 -1
  462. package/lib/util/index.js +1 -1
  463. package/lib/util/index.js.map +1 -1
  464. package/lib/util/typeCheck.d.ts +0 -2
  465. package/lib/util/typeCheck.d.ts.map +1 -1
  466. package/lib/util/typeCheck.js.map +1 -1
  467. package/lib/util/utils.d.ts +13 -0
  468. package/lib/util/utils.d.ts.map +1 -1
  469. package/lib/util/utils.js +21 -0
  470. package/lib/util/utils.js.map +1 -1
  471. package/package.json +22 -22
  472. package/src/core/index.ts +5 -1
  473. package/src/core/rebase/utils.ts +17 -20
  474. package/src/core/schema-stored/format.ts +0 -3
  475. package/src/core/schema-stored/schema.ts +13 -10
  476. package/src/core/schema-view/index.ts +0 -1
  477. package/src/core/schema-view/view.ts +0 -11
  478. package/src/{feature-libraries/chunked-forest → core/tree}/chunk.ts +4 -4
  479. package/src/core/tree/index.ts +8 -0
  480. package/src/core/tree/treeTextFormat.ts +0 -5
  481. package/src/core/tree/types.ts +0 -5
  482. package/src/feature-libraries/chunked-forest/basicChunk.ts +4 -2
  483. package/src/feature-libraries/chunked-forest/chunkTree.ts +2 -1
  484. package/src/feature-libraries/chunked-forest/chunkedForest.ts +2 -1
  485. package/src/feature-libraries/chunked-forest/codec/chunkCodecUtilities.ts +1 -2
  486. package/src/feature-libraries/chunked-forest/codec/chunkDecoding.ts +6 -2
  487. package/src/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.ts +1 -1
  488. package/src/feature-libraries/chunked-forest/emptyChunk.ts +4 -2
  489. package/src/feature-libraries/chunked-forest/index.ts +1 -1
  490. package/src/feature-libraries/chunked-forest/sequenceChunk.ts +1 -1
  491. package/src/feature-libraries/chunked-forest/uniformChunk.ts +4 -1
  492. package/src/feature-libraries/default-schema/defaultSchema.ts +1 -0
  493. package/src/feature-libraries/default-schema/schemaChecker.ts +4 -1
  494. package/src/feature-libraries/index.ts +13 -0
  495. package/src/feature-libraries/indexing/anchorTreeIndex.ts +34 -5
  496. package/src/feature-libraries/modular-schema/discrepancies.ts +76 -38
  497. package/src/feature-libraries/modular-schema/index.ts +13 -0
  498. package/src/feature-libraries/modular-schema/isNeverTree.ts +0 -2
  499. package/src/feature-libraries/sequence-field/types.ts +0 -1
  500. package/src/index.ts +1 -29
  501. package/src/packageVersion.ts +1 -1
  502. package/src/shared-tree/index.ts +1 -0
  503. package/src/shared-tree/schematizeTree.ts +6 -10
  504. package/src/shared-tree/schematizingTreeView.ts +11 -21
  505. package/src/shared-tree/sharedTree.ts +173 -41
  506. package/src/shared-tree/treeCheckout.ts +224 -175
  507. package/src/shared-tree-core/branch.ts +29 -122
  508. package/src/shared-tree-core/branchCommitEnricher.ts +19 -20
  509. package/src/shared-tree-core/editManager.ts +3 -8
  510. package/src/shared-tree-core/index.ts +2 -1
  511. package/src/shared-tree-core/sharedTreeCore.ts +8 -19
  512. package/src/shared-tree-core/transaction.ts +145 -0
  513. package/src/simple-tree/api/conciseTree.ts +2 -2
  514. package/src/simple-tree/api/create.ts +5 -1
  515. package/src/simple-tree/api/customTree.ts +69 -1
  516. package/src/simple-tree/api/index.ts +12 -2
  517. package/src/simple-tree/api/schemaFactory.ts +62 -1
  518. package/src/simple-tree/api/simpleSchema.ts +3 -1
  519. package/src/simple-tree/api/simpleTreeIndex.ts +2 -0
  520. package/src/simple-tree/api/storedSchema.ts +7 -22
  521. package/src/simple-tree/api/tree.ts +6 -0
  522. package/src/simple-tree/api/verboseTree.ts +2 -2
  523. package/src/simple-tree/api/view.ts +197 -51
  524. package/src/simple-tree/index.ts +6 -0
  525. package/src/simple-tree/leafNodeSchema.ts +0 -19
  526. package/src/simple-tree/objectNode.ts +26 -2
  527. package/src/simple-tree/objectNodeTypes.ts +5 -0
  528. package/src/simple-tree/schemaTypes.ts +7 -2
  529. package/src/simple-tree/toStoredSchema.ts +25 -19
  530. package/src/util/brand.ts +0 -2
  531. package/src/util/index.ts +1 -0
  532. package/src/util/typeCheck.ts +0 -2
  533. package/src/util/utils.ts +26 -0
  534. package/dist/feature-libraries/chunked-forest/chunk.d.ts.map +0 -1
  535. package/dist/feature-libraries/chunked-forest/chunk.js.map +0 -1
  536. package/lib/feature-libraries/chunked-forest/chunk.d.ts.map +0 -1
  537. package/lib/feature-libraries/chunked-forest/chunk.js.map +0 -1
@@ -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;AAK9E,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAIvE,OAAO,EAEN,WAAW,EACX,eAAe,GACf,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACN,aAAa,EACb,YAAY,EACZ,cAAc,EACd,UAAU,EACV,YAAY,EACZ,YAAY,GACZ,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACN,SAAS,EAMT,iBAAiB,EAEjB,kBAAkB,GAClB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AASpD,OAAO,EAAsB,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,EAGN,YAAY,GACZ,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAgD,SAAS,EAAE,MAAM,eA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,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;;;;;;GAMG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAAsB;IAC3D,IAAI,MAAM,YAAY,cAAc,EAAE,CAAC;QACtC,OAAO;IACR,CAAC;IAED,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,aAAa,CAAC,EAAE,CAAC;QAC9C,4DAA4D;QAC5D,MAAM,IAAI,UAAU,CACnB,cAAc,IAAI,CAAC,SAAS,CAC3B,MAAM,CAAC,UAAU,CACjB,oEAAoE,CACrE,CAAC;IACH,CAAC;IAEA,MAAgD,CAAC,eAAe,EAAE,CAAC;AACrE,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\";\n// Include this unused import to avoid TypeScript generating an inline import for IFluidHandle in the d.ts file\n// which degrades the API-Extractor report quality since API-Extractor can not tell the inline import is the same as the non-inline one.\n// eslint-disable-next-line unused-imports/no-unused-imports\nimport type { IFluidHandle as _dummyImport } from \"@fluidframework/core-interfaces\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\nimport { isFluidHandle } from \"@fluidframework/runtime-utils/internal\";\n\nimport type { TreeValue } from \"../../core/index.js\";\nimport type { NodeKeyManager } from \"../../feature-libraries/index.js\";\nimport {\n\ttype RestrictiveStringRecord,\n\tgetOrCreate,\n\tisReadonlyArray,\n} from \"../../util/index.js\";\n\nimport {\n\tbooleanSchema,\n\thandleSchema,\n\tLeafNodeSchema,\n\tnullSchema,\n\tnumberSchema,\n\tstringSchema,\n} from \"../leafNodeSchema.js\";\nimport {\n\tFieldKind,\n\ttype FieldSchema,\n\ttype ImplicitAllowedTypes,\n\ttype ImplicitFieldSchema,\n\ttype InsertableTreeNodeFromImplicitAllowedTypes,\n\ttype FieldProps,\n\tcreateFieldSchema,\n\ttype DefaultProvider,\n\tgetDefaultProvider,\n} from \"../schemaTypes.js\";\nimport { inPrototypeChain } from \"../core/index.js\";\nimport type {\n\tNodeKind,\n\tWithType,\n\tTreeNodeSchema,\n\tTreeNodeSchemaClass,\n\tTreeNodeSchemaNonClass,\n\tTreeNodeSchemaBoth,\n} from \"../core/index.js\";\nimport { type TreeArrayNode, arraySchema } from \"../arrayNode.js\";\nimport {\n\ttype InsertableObjectFromSchemaRecord,\n\ttype TreeObjectNode,\n\tobjectSchema,\n} from \"../objectNode.js\";\nimport { type MapNodeInsertableData, type TreeMapNode, mapSchema } from \"../mapNode.js\";\nimport type {\n\tFieldSchemaUnsafe,\n\t// Adding these unused imports makes the generated d.ts file produced by TypeScript stop breaking API-Extractor's rollup generation.\n\t// Without this import, TypeScript generates inline `import(\"../..\")` statements in the d.ts file,\n\t// which API-Extractor leaves as is when generating the rollup, leaving them pointing at the wrong directory.\n\t// API-Extractor issue: https://github.com/microsoft/rushstack/issues/4507\n\t// eslint-disable-next-line unused-imports/no-unused-imports, @typescript-eslint/no-unused-vars\n\tFieldHasDefaultUnsafe,\n\t// eslint-disable-next-line unused-imports/no-unused-imports, @typescript-eslint/no-unused-vars\n\tInsertableTreeFieldFromImplicitFieldUnsafe,\n\tInsertableObjectFromSchemaRecordUnsafe,\n\tInsertableTreeNodeFromImplicitAllowedTypesUnsafe,\n\tTreeArrayNodeUnsafe,\n\tTreeMapNodeUnsafe,\n\tTreeObjectNodeUnsafe,\n\tUnenforced,\n} from \"./typesUnsafe.js\";\nimport { createFieldSchemaUnsafe } from \"./schemaFactoryRecursive.js\";\nimport { TreeNodeValid } from \"../treeNodeValid.js\";\nimport { isLazy } from \"../flexList.js\";\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 * The name of a schema produced by {@link SchemaFactory}, including its optional scope prefix.\n *\n * @system @public\n */\nexport type ScopedSchemaName<\n\tTScope extends string | undefined,\n\tTName extends number | string,\n> = TScope extends undefined ? `${TName}` : `${TScope}.${TName}`;\n// > = `${TScope extends undefined ? \"\" : `${TScope}.`}${TName}`;\n\n// 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 * 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`, 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 * @sealed @public\n */\nexport class SchemaFactory<\n\tout TScope extends string | undefined = string | undefined,\n\tTName extends number | string = string,\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 * {@link TreeNodeSchema} for holding a JavaScript `string`.\n\t *\n\t * @remarks\n\t * Strings containing unpaired UTF-16 surrogate pair code units may not be handled correctly.\n\t *\n\t * These limitations come from the use of UTF-8 encoding of the strings, which requires them to be valid unicode.\n\t * JavaScript does not make this requirement for its strings so not all possible JavaScript strings are supported.\n\t * @privateRemarks\n\t * TODO:\n\t * We should be much more clear about what happens if you use problematic values.\n\t * We should validate and/or normalize them when inserting content.\n\t */\n\tpublic readonly string = stringSchema;\n\n\t/**\n\t * {@link TreeNodeSchema} for holding a JavaScript `number`.\n\t *\n\t * @remarks\n\t * The number is a [double-precision 64-bit binary format IEEE 754](https://en.wikipedia.org/wiki/Double-precision_floating-point_format) value, however there are some exceptions:\n\t * - `NaN`, and the infinities are converted to `null` (and may therefore only be used where `null` is allowed by the schema).\n\t * - `-0` may be converted to `0` in some cases.\n\t *\n\t * These limitations match the limitations of JSON.\n\t * @privateRemarks\n\t * TODO:\n\t * We should be much more clear about what happens if you use problematic values.\n\t * We should validate and/or normalize them when inserting content.\n\t */\n\tpublic readonly number = numberSchema;\n\n\t/**\n\t * {@link TreeNodeSchema} for holding a boolean.\n\t */\n\tpublic readonly boolean = booleanSchema;\n\n\t/**\n\t * {@link TreeNodeSchema} for JavaScript `null`.\n\t *\n\t * @remarks\n\t * There are good [reasons to avoid using null](https://www.npmjs.com/package/%40rushstack/eslint-plugin#rushstackno-new-null) in JavaScript, however sometimes it is desired.\n\t * This {@link TreeNodeSchema} node provides the option to include nulls in trees when desired.\n\t * Unless directly inter-operating with existing data using null, consider other approaches, like wrapping the value in an optional field, or using a more specifically named empty object node.\n\t */\n\tpublic readonly null = nullSchema;\n\n\t/**\n\t * {@link TreeNodeSchema} for holding an {@link @fluidframework/core-interfaces#(IFluidHandle:interface)}.\n\t */\n\tpublic readonly handle = handleSchema;\n\n\t/**\n\t * Define a {@link TreeNodeSchemaClass} for a {@link TreeObjectNode}.\n\t *\n\t * @param name - Unique identifier for this schema within this factory's scope.\n\t * @param fields - Schema for fields of the object node's schema. Defines what children can be placed under each key.\n\t */\n\tpublic object<\n\t\tconst Name extends TName,\n\t\tconst T extends RestrictiveStringRecord<ImplicitFieldSchema>,\n\t>(\n\t\tname: Name,\n\t\tfields: T,\n\t): TreeNodeSchemaClass<\n\t\tScopedSchemaName<TScope, Name>,\n\t\tNodeKind.Object,\n\t\tTreeObjectNode<T, ScopedSchemaName<TScope, Name>>,\n\t\tobject & InsertableObjectFromSchemaRecord<T>,\n\t\ttrue,\n\t\tT\n\t> {\n\t\treturn objectSchema(this.scoped(name), fields, true);\n\t}\n\n\t/**\n\t * Define a structurally typed {@link TreeNodeSchema} for a {@link TreeMapNode}.\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 *\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 * @privateRemarks\n\t * This should return `TreeNodeSchemaBoth`, however TypeScript gives an error if one of the overloads implicitly up-casts the return type of the implementation.\n\t * This seems like a TypeScript bug getting variance backwards for overload return types since it's erroring when the relation between the overload\n\t * and the implementation is type safe, and forcing an unsafe typing instead.\n\t */\n\tpublic map<const T extends ImplicitAllowedTypes>(\n\t\tnameOrAllowedTypes: TName | ((T & TreeNodeSchema) | readonly TreeNodeSchema[]),\n\t\tallowedTypes?: T,\n\t): TreeNodeSchema<string, NodeKind.Map, TreeMapNode<T>, MapNodeInsertableData<T>, true, T> {\n\t\tif (allowedTypes === undefined) {\n\t\t\tconst types = nameOrAllowedTypes as (T & TreeNodeSchema) | readonly TreeNodeSchema[];\n\t\t\tconst fullName = structuralName(\"Map\", types);\n\t\t\treturn getOrCreate(\n\t\t\t\tthis.structuralTypes,\n\t\t\t\tfullName,\n\t\t\t\t() =>\n\t\t\t\t\tthis.namedMap(\n\t\t\t\t\t\tfullName as TName,\n\t\t\t\t\t\tnameOrAllowedTypes as T,\n\t\t\t\t\t\tfalse,\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t) as TreeNodeSchema,\n\t\t\t) as TreeNodeSchemaBoth<\n\t\t\t\tstring,\n\t\t\t\tNodeKind.Map,\n\t\t\t\tTreeMapNode<T>,\n\t\t\t\tMapNodeInsertableData<T>,\n\t\t\t\ttrue,\n\t\t\t\tT,\n\t\t\t\tundefined\n\t\t\t>;\n\t\t}\n\t\t// To actually have type safety, assign to the type this method should return before implicitly upcasting when returning.\n\t\tconst out: TreeNodeSchemaBoth<\n\t\t\tstring,\n\t\t\tNodeKind.Map,\n\t\t\tTreeMapNode<T>,\n\t\t\tMapNodeInsertableData<T>,\n\t\t\ttrue,\n\t\t\tT,\n\t\t\tundefined\n\t\t> = this.namedMap(nameOrAllowedTypes as TName, allowedTypes, true, true);\n\t\treturn out;\n\t}\n\n\t/**\n\t * Define a {@link TreeNodeSchema} for a {@link (TreeMapNode:interface)}.\n\t *\n\t * @param name - Unique identifier for this schema within this factory's scope.\n\t */\n\tprivate namedMap<\n\t\tName extends TName | string,\n\t\tconst T extends ImplicitAllowedTypes,\n\t\tconst ImplicitlyConstructable extends boolean,\n\t>(\n\t\tname: Name,\n\t\tallowedTypes: T,\n\t\tcustomizable: boolean,\n\t\timplicitlyConstructable: ImplicitlyConstructable,\n\t): TreeNodeSchemaBoth<\n\t\tScopedSchemaName<TScope, Name>,\n\t\tNodeKind.Map,\n\t\tTreeMapNode<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Map>,\n\t\tMapNodeInsertableData<T>,\n\t\tImplicitlyConstructable,\n\t\tT,\n\t\tundefined\n\t> {\n\t\treturn mapSchema(\n\t\t\tthis.scoped(name),\n\t\t\tallowedTypes,\n\t\t\timplicitlyConstructable,\n\t\t\t// The current policy is customizable nodes don't get fake prototypes.\n\t\t\t!customizable,\n\t\t);\n\t}\n\n\t/**\n\t * Define a structurally typed {@link TreeNodeSchema} for a {@link (TreeArrayNode:interface)}.\n\t *\n\t * @remarks\n\t * The identifier for this Array is defined as a function of the provided types.\n\t * It is still scoped to this SchemaFactory, but multiple calls with the same arguments will return the same schema object, providing somewhat structural typing.\n\t * This does not support recursive types.\n\t *\n\t * If using these structurally named arrays, other types in this schema builder should avoid names of the form `Array<${string}>`.\n\t *\n\t * @example\n\t * The returned schema should be used as a schema directly:\n\t * ```typescript\n\t * const MyArray = factory.array(factory.number);\n\t * type MyArray = NodeFromSchema<typeof MyArray>;\n\t * ```\n\t * Or inline:\n\t * ```typescript\n\t * factory.object(\"Foo\", {myArray: factory.array(factory.number)});\n\t * ```\n\t * @privateRemarks\n\t * The name produced at the type level here is not as specific as it could be, however doing type level sorting and escaping is a real mess.\n\t * There are cases where not having this full type provided will be less than ideal since TypeScript's structural types.\n\t * For example attempts to narrow unions of structural arrays by name won't work.\n\t * Planned future changes to move to a class based schema system as well as factor function based node construction should mostly avoid these issues,\n\t * though there may still be some problematic cases even after that work is done.\n\t *\n\t * The return value is a class, but its the type is intentionally not specific enough to indicate it is a class.\n\t * This prevents callers of this from sub-classing it, which is unlikely to work well (due to the ease of accidentally giving two different calls o this different subclasses)\n\t * when working with structural typing.\n\t *\n\t * {@label STRUCTURAL}\n\t */\n\tpublic array<const T extends TreeNodeSchema | readonly TreeNodeSchema[]>(\n\t\tallowedTypes: T,\n\t): TreeNodeSchemaNonClass<\n\t\tScopedSchemaName<TScope, `Array<${string}>`>,\n\t\tNodeKind.Array,\n\t\tTreeArrayNode<T> & WithType<ScopedSchemaName<TScope, `Array<${string}>`>, NodeKind.Array>,\n\t\tIterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>,\n\t\ttrue,\n\t\tT,\n\t\tundefined\n\t>;\n\n\t/**\n\t * Define (and add to this library) a {@link TreeNodeSchemaClass} for a {@link (TreeArrayNode:interface)}.\n\t *\n\t * @param name - Unique identifier for this schema within this factory's scope.\n\t *\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 * @privateRemarks\n\t * This should return TreeNodeSchemaBoth: see note on \"map\" implementation for details.\n\t */\n\tpublic array<const T extends ImplicitAllowedTypes>(\n\t\tnameOrAllowedTypes: TName | ((T & TreeNodeSchema) | readonly TreeNodeSchema[]),\n\t\tallowedTypes?: T,\n\t): TreeNodeSchema<\n\t\tScopedSchemaName<TScope, string>,\n\t\tNodeKind.Array,\n\t\tTreeArrayNode<T>,\n\t\tIterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>,\n\t\ttrue,\n\t\tT\n\t> {\n\t\tif (allowedTypes === undefined) {\n\t\t\tconst types = nameOrAllowedTypes as (T & TreeNodeSchema) | readonly TreeNodeSchema[];\n\t\t\tconst fullName = structuralName(\"Array\", types);\n\t\t\treturn getOrCreate(this.structuralTypes, fullName, () =>\n\t\t\t\tthis.namedArray(fullName, nameOrAllowedTypes as T, false, true),\n\t\t\t) as TreeNodeSchemaClass<\n\t\t\t\tScopedSchemaName<TScope, string>,\n\t\t\t\tNodeKind.Array,\n\t\t\t\tTreeArrayNode<T>,\n\t\t\t\tIterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>,\n\t\t\t\ttrue,\n\t\t\t\tT,\n\t\t\t\tundefined\n\t\t\t>;\n\t\t}\n\t\tconst out: TreeNodeSchemaBoth<\n\t\t\tScopedSchemaName<TScope, string>,\n\t\t\tNodeKind.Array,\n\t\t\tTreeArrayNode<T>,\n\t\t\tIterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>,\n\t\t\ttrue,\n\t\t\tT,\n\t\t\tundefined\n\t\t> = this.namedArray(nameOrAllowedTypes as TName, allowedTypes, true, true);\n\t\treturn out;\n\t}\n\n\t/**\n\t * Define a {@link TreeNodeSchema} for a {@link (TreeArrayNode:interface)}.\n\t *\n\t * @param name - Unique identifier for this schema within this factory's scope.\n\t *\n\t * @remarks\n\t * This is not intended to be used directly, use the overload of `array` which takes a name instead.\n\t * This is only public to work around a compiler limitation.\n\t */\n\tprivate namedArray<\n\t\tName extends TName | string,\n\t\tconst T extends ImplicitAllowedTypes,\n\t\tconst ImplicitlyConstructable extends boolean,\n\t>(\n\t\tname: Name,\n\t\tallowedTypes: T,\n\t\tcustomizable: boolean,\n\t\timplicitlyConstructable: ImplicitlyConstructable,\n\t): TreeNodeSchemaBoth<\n\t\tScopedSchemaName<TScope, Name>,\n\t\tNodeKind.Array,\n\t\tTreeArrayNode<T> & WithType<ScopedSchemaName<TScope, string>, NodeKind.Array>,\n\t\tIterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>,\n\t\tImplicitlyConstructable,\n\t\tT,\n\t\tundefined\n\t> {\n\t\treturn arraySchema(this.scoped(name), allowedTypes, implicitlyConstructable, customizable);\n\t}\n\n\t/**\n\t * Make a field optional instead of the default, which is required.\n\t *\n\t * @param t - The types allowed under the field.\n\t * @param props - Optional properties to associate with the field.\n\t *\n\t * @typeParam TCustomMetadata - Custom metadata properties to associate with the field.\n\t * See {@link FieldSchemaMetadata.custom}.\n\t */\n\tpublic optional<const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(\n\t\tt: T,\n\t\tprops?: Omit<FieldProps<TCustomMetadata>, \"defaultProvider\">,\n\t): FieldSchema<FieldKind.Optional, T, TCustomMetadata> {\n\t\tconst defaultOptionalProvider: DefaultProvider = getDefaultProvider(() => {\n\t\t\treturn undefined;\n\t\t});\n\t\treturn createFieldSchema(FieldKind.Optional, t, {\n\t\t\tdefaultProvider: defaultOptionalProvider,\n\t\t\t...props,\n\t\t});\n\t}\n\n\t/**\n\t * Make a field explicitly required.\n\t *\n\t * @param t - The types allowed under the field.\n\t * @param props - Optional properties to associate with the field.\n\t *\n\t * @remarks\n\t * Fields are required by default, but this API can be used to make the required nature explicit in the schema,\n\t * and allows associating custom {@link FieldProps | properties} with the field.\n\t *\n\t * @typeParam TCustomMetadata - Custom metadata properties to associate with the field.\n\t * See {@link FieldSchemaMetadata.custom}.\n\t */\n\tpublic required<const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(\n\t\tt: T,\n\t\tprops?: Omit<FieldProps<TCustomMetadata>, \"defaultProvider\">,\n\t): FieldSchema<FieldKind.Required, T, TCustomMetadata> {\n\t\treturn createFieldSchema(FieldKind.Required, t, props);\n\t}\n\n\t/**\n\t * {@link SchemaFactory.optional} except tweaked to work better for recursive types.\n\t * Use with {@link ValidateRecursiveSchema} for improved type safety.\n\t * @remarks\n\t * This version of {@link SchemaFactory.optional} has fewer type constraints to work around TypeScript limitations, see {@link Unenforced}.\n\t * See {@link ValidateRecursiveSchema} for additional information about using recursive schema.\n\t */\n\tpublic optionalRecursive<const T extends Unenforced<ImplicitAllowedTypes>>(\n\t\tt: T,\n\t\tprops?: Omit<FieldProps, \"defaultProvider\">,\n\t): FieldSchemaUnsafe<FieldKind.Optional, T> {\n\t\treturn createFieldSchemaUnsafe(FieldKind.Optional, t, props);\n\t}\n\n\t/**\n\t * {@link SchemaFactory.required} except tweaked to work better for recursive types.\n\t * Use with {@link ValidateRecursiveSchema} for improved type safety.\n\t * @remarks\n\t * This version of {@link SchemaFactory.required} has fewer type constraints to work around TypeScript limitations, see {@link Unenforced}.\n\t * See {@link ValidateRecursiveSchema} for additional information about using recursive schema.\n\t */\n\tpublic requiredRecursive<const T extends Unenforced<ImplicitAllowedTypes>>(\n\t\tt: T,\n\t\tprops?: Omit<FieldProps, \"defaultProvider\">,\n\t): FieldSchemaUnsafe<FieldKind.Required, T> {\n\t\treturn createFieldSchemaUnsafe(FieldKind.Required, t, props);\n\t}\n\n\t/**\n\t * A special field which holds a unique identifier for an object node.\n\t * @remarks\n\t * The value of this field, a \"node identifier\", uniquely identifies a node among all other nodes in the tree.\n\t * Node identifiers are strings, and can therefore be used as lookup keys in maps or written to a database.\n\t * When the node is constructed, the identifier field does not need to be populated.\n\t * The SharedTree will provide an identifier for the node automatically.\n\t * An identifier provided automatically by the SharedTree has the following properties:\n\t * - It is a UUID.\n\t * - It is compressed to a space-efficient representation when stored in the document.\n\t * - A compressed form of the identifier can be accessed at runtime via the `Tree.shortId()` API.\n\t * - It will error if read (and will not be present in the object's iterable properties) before the node has been inserted into the tree.\n\t *\n\t * However, a user may alternatively supply their own string as the identifier if desired (for example, if importing identifiers from another system).\n\t * In that case, it is up to the user to ensure that the identifier is unique within the current tree - no other node should have the same identifier at the same time.\n\t * If the identifier is not unique, it may be read, but may cause libraries or features which operate over node identifiers to misbehave.\n\t * User-supplied identifiers may be read immediately, even before insertion into the tree.\n\t *\n\t * A node may have more than one identifier field (though note that this precludes the use of the `Tree.shortId()` API).\n\t */\n\tpublic get identifier(): FieldSchema<FieldKind.Identifier, typeof this.string> {\n\t\tconst defaultIdentifierProvider: DefaultProvider = getDefaultProvider(\n\t\t\t(nodeKeyManager: NodeKeyManager) => {\n\t\t\t\treturn nodeKeyManager.stabilizeNodeKey(nodeKeyManager.generateLocalNodeKey());\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\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n\tpublic objectRecursive<\n\t\tconst Name extends TName,\n\t\tconst T extends Unenforced<RestrictiveStringRecord<ImplicitFieldSchema>>,\n\t>(name: Name, t: T) {\n\t\ttype TScopedName = ScopedSchemaName<TScope, Name>;\n\t\treturn this.object(\n\t\t\tname,\n\t\t\tt as T & RestrictiveStringRecord<ImplicitFieldSchema>,\n\t\t) as unknown as TreeNodeSchemaClass<\n\t\t\tTScopedName,\n\t\t\tNodeKind.Object,\n\t\t\tTreeObjectNodeUnsafe<T, TScopedName>,\n\t\t\tobject & InsertableObjectFromSchemaRecordUnsafe<T>,\n\t\t\tfalse,\n\t\t\tT\n\t\t>;\n\t}\n\n\t/**\n\t * `SchemaFactory.array` except tweaked to work better for recursive types.\n\t * Use with {@link ValidateRecursiveSchema} for improved type safety.\n\t * @remarks\n\t * This version of `SchemaFactory.array` uses the same workarounds as {@link SchemaFactory.objectRecursive}.\n\t * See {@link ValidateRecursiveSchema} for additional information about using recursive schema.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n\tpublic arrayRecursive<\n\t\tconst Name extends TName,\n\t\tconst T extends Unenforced<ImplicitAllowedTypes>,\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\tTreeArrayNodeUnsafe<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Array>,\n\t\t\t{\n\t\t\t\t/**\n\t\t\t\t * Iterator for the iterable of content for this node.\n\t\t\t\t * @privateRemarks\n\t\t\t\t * Wrapping the constructor parameter for recursive arrays and maps in an inlined object type avoids (for unknown reasons)\n\t\t\t\t * the following compile error when declaring the recursive schema:\n\t\t\t\t * `Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions.`\n\t\t\t\t * To benefit from this without impacting the API, the definition of `Iterable` has been inlined as such an object.\n\t\t\t\t *\n\t\t\t\t * If this workaround is kept, ideally this comment would be deduplicated with the other instance of it.\n\t\t\t\t * Unfortunately attempts to do this failed to avoid the compile error this was introduced to solve.\n\t\t\t\t */\n\t\t\t\t[Symbol.iterator](): Iterator<InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>>;\n\t\t\t},\n\t\t\tfalse,\n\t\t\tT,\n\t\t\tundefined\n\t\t>;\n\t}\n\n\t/**\n\t * `SchemaFactory.map` except tweaked to work better for recursive types.\n\t * Use with {@link ValidateRecursiveSchema} for improved type safety.\n\t * @remarks\n\t * This version of `SchemaFactory.map` uses the same workarounds as {@link SchemaFactory.objectRecursive}.\n\t * See {@link ValidateRecursiveSchema} for additional information about using recursive schema.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n\tpublic mapRecursive<Name extends TName, const T extends Unenforced<ImplicitAllowedTypes>>(\n\t\tname: Name,\n\t\tallowedTypes: T,\n\t) {\n\t\tconst MapSchema = this.namedMap(\n\t\t\tname,\n\t\t\tallowedTypes as T & ImplicitAllowedTypes,\n\t\t\ttrue,\n\t\t\t// Setting this (implicitlyConstructable) to true seems to work ok currently, but not for other node kinds.\n\t\t\t// Supporting this could be fragile and might break other future changes, so it's being kept as false for now.\n\t\t\tfalse,\n\t\t);\n\n\t\treturn MapSchema as TreeNodeSchemaClass<\n\t\t\tScopedSchemaName<TScope, Name>,\n\t\t\tNodeKind.Map,\n\t\t\tTreeMapNodeUnsafe<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Map>,\n\t\t\t| {\n\t\t\t\t\t/**\n\t\t\t\t\t * Iterator for the iterable of content for this node.\n\t\t\t\t\t * @privateRemarks\n\t\t\t\t\t * Wrapping the constructor parameter for recursive arrays and maps in an inlined object type avoids (for unknown reasons)\n\t\t\t\t\t * the following compile error when declaring the recursive schema:\n\t\t\t\t\t * `Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions.`\n\t\t\t\t\t * To benefit from this without impacting the API, the definition of `Iterable` has been inlined as such an object.\n\t\t\t\t\t *\n\t\t\t\t\t * If this workaround is kept, ideally this comment would be deduplicated with the other instance of it.\n\t\t\t\t\t * Unfortunately attempts to do this failed to avoid the compile error this was introduced to solve.\n\t\t\t\t\t */\n\t\t\t\t\t[Symbol.iterator](): Iterator<\n\t\t\t\t\t\t[string, InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>]\n\t\t\t\t\t>;\n\t\t\t }\n\t\t\t// Ideally this would be\n\t\t\t// RestrictiveStringRecord<InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>>,\n\t\t\t// but doing so breaks recursive types.\n\t\t\t// Instead we do a less nice version:\n\t\t\t| {\n\t\t\t\t\treadonly [P in string]: InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>;\n\t\t\t },\n\t\t\tfalse,\n\t\t\tT,\n\t\t\tundefined\n\t\t>;\n\t}\n}\n\nexport function structuralName<const T extends string>(\n\tcollectionName: T,\n\tallowedTypes: TreeNodeSchema | readonly TreeNodeSchema[],\n): `${T}<${string}>` {\n\tlet inner: string;\n\tif (!isReadonlyArray(allowedTypes)) {\n\t\treturn structuralName(collectionName, [allowedTypes]);\n\t} else {\n\t\tconst names = allowedTypes.map((t): string => {\n\t\t\t// Ensure that lazy types (functions) don't slip through here.\n\t\t\tassert(!isLazy(t), 0x83d /* invalid type provided */);\n\t\t\tmarkSchemaMostDerived(t);\n\t\t\treturn t.identifier;\n\t\t});\n\t\t// Ensure name is order independent\n\t\tnames.sort();\n\t\t// Ensure name can't have collisions by quoting and escaping any quotes in the names of types.\n\t\t// Using JSON is a simple way to accomplish this.\n\t\t// The outer `[]` around the result were needed so that a single type name \"Any\" would not collide with the \"any\" case which used to exist.\n\t\tinner = JSON.stringify(names);\n\t}\n\treturn `${collectionName}<${inner}>`;\n}\n\n/**\n * Indicates that a schema is the \"most derived\" version which is allowed to be used, see {@link MostDerivedData}.\n * Calling helps with error messages about invalid schema usage (using more than one type from single schema factor produced type,\n * and thus calling this for one than one subclass).\n * @remarks\n * Helper for invoking {@link TreeNodeValid.markMostDerived} for any {@link TreeNodeSchema} if it needed.\n */\nexport function markSchemaMostDerived(schema: TreeNodeSchema): void {\n\tif (schema instanceof LeafNodeSchema) {\n\t\treturn;\n\t}\n\n\tif (!inPrototypeChain(schema, TreeNodeValid)) {\n\t\t// Use JSON.stringify to quote and escape identifier string.\n\t\tthrow new UsageError(\n\t\t\t`Schema for ${JSON.stringify(\n\t\t\t\tschema.identifier,\n\t\t\t)} does not extend a SchemaFactory generated class. This is invalid.`,\n\t\t);\n\t}\n\n\t(schema as typeof TreeNodeValid & TreeNodeSchema).markMostDerived();\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;AAK9E,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAIvE,OAAO,EAEN,WAAW,EACX,eAAe,GACf,MAAM,qBAAqB,CAAC;AAK7B,OAAO,EACN,aAAa,EACb,YAAY,EACZ,cAAc,EACd,UAAU,EACV,YAAY,EACZ,YAAY,GACZ,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACN,SAAS,EAMT,iBAAiB,EAEjB,kBAAkB,GAClB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AASpD,OAAO,EAAsB,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,EAGN,YA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Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, unreachableCase } from \"@fluidframework/core-utils/internal\";\n// Include this unused import to avoid TypeScript generating an inline import for IFluidHandle in the d.ts file\n// which degrades the API-Extractor report quality since API-Extractor can not tell the inline import is the same as the non-inline one.\n// eslint-disable-next-line unused-imports/no-unused-imports\nimport type { IFluidHandle as _dummyImport } from \"@fluidframework/core-interfaces\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\nimport { isFluidHandle } from \"@fluidframework/runtime-utils/internal\";\n\nimport type { TreeValue } from \"../../core/index.js\";\nimport type { NodeKeyManager } from \"../../feature-libraries/index.js\";\nimport {\n\ttype RestrictiveStringRecord,\n\tgetOrCreate,\n\tisReadonlyArray,\n} from \"../../util/index.js\";\n// This import is required for intellisense in @link doc comments on mouseover in VSCode.\n// eslint-disable-next-line unused-imports/no-unused-imports, @typescript-eslint/no-unused-vars\nimport type { TreeAlpha } from \"../../shared-tree/index.js\";\n\nimport {\n\tbooleanSchema,\n\thandleSchema,\n\tLeafNodeSchema,\n\tnullSchema,\n\tnumberSchema,\n\tstringSchema,\n} from \"../leafNodeSchema.js\";\nimport {\n\tFieldKind,\n\ttype FieldSchema,\n\ttype ImplicitAllowedTypes,\n\ttype ImplicitFieldSchema,\n\ttype InsertableTreeNodeFromImplicitAllowedTypes,\n\ttype FieldProps,\n\tcreateFieldSchema,\n\ttype DefaultProvider,\n\tgetDefaultProvider,\n} from \"../schemaTypes.js\";\nimport { inPrototypeChain } from \"../core/index.js\";\nimport type {\n\tNodeKind,\n\tWithType,\n\tTreeNodeSchema,\n\tTreeNodeSchemaClass,\n\tTreeNodeSchemaNonClass,\n\tTreeNodeSchemaBoth,\n} from \"../core/index.js\";\nimport { type TreeArrayNode, arraySchema } from \"../arrayNode.js\";\nimport {\n\ttype InsertableObjectFromSchemaRecord,\n\ttype TreeObjectNode,\n\tobjectSchema,\n} from \"../objectNode.js\";\nimport { type MapNodeInsertableData, type TreeMapNode, mapSchema } from \"../mapNode.js\";\nimport type {\n\tFieldSchemaUnsafe,\n\t// Adding these unused imports makes the generated d.ts file produced by TypeScript stop breaking API-Extractor's rollup generation.\n\t// Without this import, TypeScript generates inline `import(\"../..\")` statements in the d.ts file,\n\t// which API-Extractor leaves as is when generating the rollup, leaving them pointing at the wrong directory.\n\t// API-Extractor issue: https://github.com/microsoft/rushstack/issues/4507\n\t// eslint-disable-next-line unused-imports/no-unused-imports, @typescript-eslint/no-unused-vars\n\tFieldHasDefaultUnsafe,\n\t// eslint-disable-next-line unused-imports/no-unused-imports, @typescript-eslint/no-unused-vars\n\tInsertableTreeFieldFromImplicitFieldUnsafe,\n\tInsertableObjectFromSchemaRecordUnsafe,\n\tInsertableTreeNodeFromImplicitAllowedTypesUnsafe,\n\tTreeArrayNodeUnsafe,\n\tTreeMapNodeUnsafe,\n\tTreeObjectNodeUnsafe,\n\tUnenforced,\n} from \"./typesUnsafe.js\";\nimport { createFieldSchemaUnsafe } from \"./schemaFactoryRecursive.js\";\nimport { TreeNodeValid } from \"../treeNodeValid.js\";\nimport { isLazy } from \"../flexList.js\";\n\n/**\n * Gets the leaf domain schema compatible with a given {@link TreeValue}.\n */\nexport function schemaFromValue(value: TreeValue): TreeNodeSchema {\n\tswitch (typeof value) {\n\t\tcase \"boolean\":\n\t\t\treturn booleanSchema;\n\t\tcase \"number\":\n\t\t\treturn numberSchema;\n\t\tcase \"string\":\n\t\t\treturn stringSchema;\n\t\tcase \"object\": {\n\t\t\tif (value === null) {\n\t\t\t\treturn nullSchema;\n\t\t\t}\n\t\t\tassert(isFluidHandle(value), 0x87e /* invalid TreeValue */);\n\t\t\treturn handleSchema;\n\t\t}\n\t\tdefault:\n\t\t\tunreachableCase(value);\n\t}\n}\n\n/**\n * Options when declaring an {@link SchemaFactory.object|object node}'s schema\n */\nexport interface SchemaFactoryObjectOptions {\n\t/**\n\t * Opt in to viewing documents which have unknown optional fields for this object's identifier, i.e. optional fields\n\t * in the document schema which are not present in this object schema declaration.\n\t *\n\t * @defaultValue `false`\n\t * @remarks\n\t * The advantage of enabling this option is that it allows an application ecosystem with staged rollout to more quickly\n\t * upgrade documents to include schema for new optional features.\n\t *\n\t * However, it does come with trade-offs that applications should weigh carefully when it comes to interactions between\n\t * code and documents.\n\t * When opening such documents, the API presented is still determined by the view schema.\n\t * This can have implications on the behavior of edits or code which uses portions of the view schema,\n\t * since this may inadvertently drop data which is present in those optional fields in the document schema.\n\t *\n\t * Consider the following example:\n\t *\n\t * ```typescript\n\t * const sf = new SchemaFactory(\"com.example\");\n\t * class PersonView extends sf.object(\"Person\", { name: sf.string }, { allowUnknownOptionalFields: true }) {}\n\t * class PersonStored extends sf.object(\"Person\", { name: sf.string, nickname: sf.optional(sf.string) }) {}\n\t *\n\t * // Say we have a document which uses `PersonStored` in its schema, and application code constructs\n\t * // a tree view using `PersonView`. If the application for some reason had implemented a function like this:\n\t * function clonePerson(a: PersonView): PersonView {\n\t * \treturn new PersonView({ name: a.name });\n\t * }\n\t * // ...or even like this:\n\t * function clonePerson(a: PersonView): PersonView {\n\t * return new PersonView({ ...a})\n\t * }\n\t * // Then the alleged clone wouldn't actually clone the entire person in either case, it would drop the nickname.\n\t * ```\n\t *\n\t * If an application wants to be particularly careful to preserve all data on a node when editing it, it can use\n\t * {@link TreeAlpha.(importVerbose:2)|import}/{@link TreeAlpha.(exportVerbose:2)|export} APIs with persistent keys.\n\t *\n\t * Note that public API methods which operate on entire nodes (such as `moveTo`, `moveToEnd`, etc. on arrays) do not encounter\n\t * this problem as SharedTree's implementation stores the entire node in its lower layers. It's only when application code\n\t * reaches into a node (either by accessing its fields, spreading it, or some other means) that this problem arises.\n\t */\n\tallowUnknownOptionalFields?: boolean;\n}\n\nexport const defaultSchemaFactoryObjectOptions: Required<SchemaFactoryObjectOptions> = {\n\tallowUnknownOptionalFields: false,\n};\n\n/**\n * The name of a schema produced by {@link SchemaFactory}, including its optional scope prefix.\n *\n * @system @public\n */\nexport type ScopedSchemaName<\n\tTScope extends string | undefined,\n\tTName extends number | string,\n> = TScope extends undefined ? `${TName}` : `${TScope}.${TName}`;\n// > = `${TScope extends undefined ? \"\" : `${TScope}.`}${TName}`;\n\n// 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 * 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`, 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 * @sealed @public\n */\nexport class SchemaFactory<\n\tout TScope extends string | undefined = string | undefined,\n\tTName extends number | string = string,\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 * {@link TreeNodeSchema} for holding a JavaScript `string`.\n\t *\n\t * @remarks\n\t * Strings containing unpaired UTF-16 surrogate pair code units may not be handled correctly.\n\t *\n\t * These limitations come from the use of UTF-8 encoding of the strings, which requires them to be valid unicode.\n\t * JavaScript does not make this requirement for its strings so not all possible JavaScript strings are supported.\n\t * @privateRemarks\n\t * TODO:\n\t * We should be much more clear about what happens if you use problematic values.\n\t * We should validate and/or normalize them when inserting content.\n\t */\n\tpublic readonly string = stringSchema;\n\n\t/**\n\t * {@link TreeNodeSchema} for holding a JavaScript `number`.\n\t *\n\t * @remarks\n\t * The number is a [double-precision 64-bit binary format IEEE 754](https://en.wikipedia.org/wiki/Double-precision_floating-point_format) value, however there are some exceptions:\n\t * - `NaN`, and the infinities are converted to `null` (and may therefore only be used where `null` is allowed by the schema).\n\t * - `-0` may be converted to `0` in some cases.\n\t *\n\t * These limitations match the limitations of JSON.\n\t * @privateRemarks\n\t * TODO:\n\t * We should be much more clear about what happens if you use problematic values.\n\t * We should validate and/or normalize them when inserting content.\n\t */\n\tpublic readonly number = numberSchema;\n\n\t/**\n\t * {@link TreeNodeSchema} for holding a boolean.\n\t */\n\tpublic readonly boolean = booleanSchema;\n\n\t/**\n\t * {@link TreeNodeSchema} for JavaScript `null`.\n\t *\n\t * @remarks\n\t * There are good [reasons to avoid using null](https://www.npmjs.com/package/%40rushstack/eslint-plugin#rushstackno-new-null) in JavaScript, however sometimes it is desired.\n\t * This {@link TreeNodeSchema} node provides the option to include nulls in trees when desired.\n\t * Unless directly inter-operating with existing data using null, consider other approaches, like wrapping the value in an optional field, or using a more specifically named empty object node.\n\t */\n\tpublic readonly null = nullSchema;\n\n\t/**\n\t * {@link TreeNodeSchema} for holding an {@link @fluidframework/core-interfaces#(IFluidHandle:interface)}.\n\t */\n\tpublic readonly handle = handleSchema;\n\n\t/**\n\t * Define a {@link TreeNodeSchemaClass} for a {@link TreeObjectNode}.\n\t *\n\t * @param name - Unique identifier for this schema within this factory's scope.\n\t * @param fields - Schema for fields of the object node's schema. Defines what children can be placed under each key.\n\t */\n\tpublic object<\n\t\tconst Name extends TName,\n\t\tconst T extends RestrictiveStringRecord<ImplicitFieldSchema>,\n\t>(\n\t\tname: Name,\n\t\tfields: T,\n\t): TreeNodeSchemaClass<\n\t\tScopedSchemaName<TScope, Name>,\n\t\tNodeKind.Object,\n\t\tTreeObjectNode<T, ScopedSchemaName<TScope, Name>>,\n\t\tobject & InsertableObjectFromSchemaRecord<T>,\n\t\ttrue,\n\t\tT\n\t> {\n\t\treturn objectSchema(\n\t\t\tthis.scoped(name),\n\t\t\tfields,\n\t\t\ttrue,\n\t\t\tdefaultSchemaFactoryObjectOptions.allowUnknownOptionalFields,\n\t\t);\n\t}\n\n\t/**\n\t * Define a structurally typed {@link TreeNodeSchema} for a {@link TreeMapNode}.\n\t *\n\t * @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 *\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 * @privateRemarks\n\t * This should return `TreeNodeSchemaBoth`, however TypeScript gives an error if one of the overloads implicitly up-casts the return type of the implementation.\n\t * This seems like a TypeScript bug getting variance backwards for overload return types since it's erroring when the relation between the overload\n\t * and the implementation is type safe, and forcing an unsafe typing instead.\n\t */\n\tpublic map<const T extends ImplicitAllowedTypes>(\n\t\tnameOrAllowedTypes: TName | ((T & TreeNodeSchema) | readonly TreeNodeSchema[]),\n\t\tallowedTypes?: T,\n\t): TreeNodeSchema<string, NodeKind.Map, TreeMapNode<T>, MapNodeInsertableData<T>, true, T> {\n\t\tif (allowedTypes === undefined) {\n\t\t\tconst types = nameOrAllowedTypes as (T & TreeNodeSchema) | readonly TreeNodeSchema[];\n\t\t\tconst fullName = structuralName(\"Map\", types);\n\t\t\treturn getOrCreate(\n\t\t\t\tthis.structuralTypes,\n\t\t\t\tfullName,\n\t\t\t\t() =>\n\t\t\t\t\tthis.namedMap(\n\t\t\t\t\t\tfullName as TName,\n\t\t\t\t\t\tnameOrAllowedTypes as T,\n\t\t\t\t\t\tfalse,\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t) as TreeNodeSchema,\n\t\t\t) as TreeNodeSchemaBoth<\n\t\t\t\tstring,\n\t\t\t\tNodeKind.Map,\n\t\t\t\tTreeMapNode<T>,\n\t\t\t\tMapNodeInsertableData<T>,\n\t\t\t\ttrue,\n\t\t\t\tT,\n\t\t\t\tundefined\n\t\t\t>;\n\t\t}\n\t\t// To actually have type safety, assign to the type this method should return before implicitly upcasting when returning.\n\t\tconst out: TreeNodeSchemaBoth<\n\t\t\tstring,\n\t\t\tNodeKind.Map,\n\t\t\tTreeMapNode<T>,\n\t\t\tMapNodeInsertableData<T>,\n\t\t\ttrue,\n\t\t\tT,\n\t\t\tundefined\n\t\t> = this.namedMap(nameOrAllowedTypes as TName, allowedTypes, true, true);\n\t\treturn out;\n\t}\n\n\t/**\n\t * Define a {@link TreeNodeSchema} for a {@link (TreeMapNode:interface)}.\n\t *\n\t * @param name - Unique identifier for this schema within this factory's scope.\n\t */\n\tprivate namedMap<\n\t\tName extends TName | string,\n\t\tconst T extends ImplicitAllowedTypes,\n\t\tconst ImplicitlyConstructable extends boolean,\n\t>(\n\t\tname: Name,\n\t\tallowedTypes: T,\n\t\tcustomizable: boolean,\n\t\timplicitlyConstructable: ImplicitlyConstructable,\n\t): TreeNodeSchemaBoth<\n\t\tScopedSchemaName<TScope, Name>,\n\t\tNodeKind.Map,\n\t\tTreeMapNode<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Map>,\n\t\tMapNodeInsertableData<T>,\n\t\tImplicitlyConstructable,\n\t\tT,\n\t\tundefined\n\t> {\n\t\treturn mapSchema(\n\t\t\tthis.scoped(name),\n\t\t\tallowedTypes,\n\t\t\timplicitlyConstructable,\n\t\t\t// The current policy is customizable nodes don't get fake prototypes.\n\t\t\t!customizable,\n\t\t);\n\t}\n\n\t/**\n\t * Define a structurally typed {@link TreeNodeSchema} for a {@link (TreeArrayNode:interface)}.\n\t *\n\t * @remarks\n\t * The identifier for this Array is defined as a function of the provided types.\n\t * It is still scoped to this SchemaFactory, but multiple calls with the same arguments will return the same schema object, providing somewhat structural typing.\n\t * This does not support recursive types.\n\t *\n\t * If using these structurally named arrays, other types in this schema builder should avoid names of the form `Array<${string}>`.\n\t *\n\t * @example\n\t * The returned schema should be used as a schema directly:\n\t * ```typescript\n\t * const MyArray = factory.array(factory.number);\n\t * type MyArray = NodeFromSchema<typeof MyArray>;\n\t * ```\n\t * Or inline:\n\t * ```typescript\n\t * factory.object(\"Foo\", {myArray: factory.array(factory.number)});\n\t * ```\n\t * @privateRemarks\n\t * The name produced at the type level here is not as specific as it could be, however doing type level sorting and escaping is a real mess.\n\t * There are cases where not having this full type provided will be less than ideal since TypeScript's structural types.\n\t * For example attempts to narrow unions of structural arrays by name won't work.\n\t * Planned future changes to move to a class based schema system as well as factor function based node construction should mostly avoid these issues,\n\t * though there may still be some problematic cases even after that work is done.\n\t *\n\t * The return value is a class, but its the type is intentionally not specific enough to indicate it is a class.\n\t * This prevents callers of this from sub-classing it, which is unlikely to work well (due to the ease of accidentally giving two different calls o this different subclasses)\n\t * when working with structural typing.\n\t *\n\t * {@label STRUCTURAL}\n\t */\n\tpublic array<const T extends TreeNodeSchema | readonly TreeNodeSchema[]>(\n\t\tallowedTypes: T,\n\t): TreeNodeSchemaNonClass<\n\t\tScopedSchemaName<TScope, `Array<${string}>`>,\n\t\tNodeKind.Array,\n\t\tTreeArrayNode<T> & WithType<ScopedSchemaName<TScope, `Array<${string}>`>, NodeKind.Array>,\n\t\tIterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>,\n\t\ttrue,\n\t\tT,\n\t\tundefined\n\t>;\n\n\t/**\n\t * Define (and add to this library) a {@link TreeNodeSchemaClass} for a {@link (TreeArrayNode:interface)}.\n\t *\n\t * @param name - Unique identifier for this schema within this factory's scope.\n\t *\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 * @privateRemarks\n\t * This should return TreeNodeSchemaBoth: see note on \"map\" implementation for details.\n\t */\n\tpublic array<const T extends ImplicitAllowedTypes>(\n\t\tnameOrAllowedTypes: TName | ((T & TreeNodeSchema) | readonly TreeNodeSchema[]),\n\t\tallowedTypes?: T,\n\t): TreeNodeSchema<\n\t\tScopedSchemaName<TScope, string>,\n\t\tNodeKind.Array,\n\t\tTreeArrayNode<T>,\n\t\tIterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>,\n\t\ttrue,\n\t\tT\n\t> {\n\t\tif (allowedTypes === undefined) {\n\t\t\tconst types = nameOrAllowedTypes as (T & TreeNodeSchema) | readonly TreeNodeSchema[];\n\t\t\tconst fullName = structuralName(\"Array\", types);\n\t\t\treturn getOrCreate(this.structuralTypes, fullName, () =>\n\t\t\t\tthis.namedArray(fullName, nameOrAllowedTypes as T, false, true),\n\t\t\t) as TreeNodeSchemaClass<\n\t\t\t\tScopedSchemaName<TScope, string>,\n\t\t\t\tNodeKind.Array,\n\t\t\t\tTreeArrayNode<T>,\n\t\t\t\tIterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>,\n\t\t\t\ttrue,\n\t\t\t\tT,\n\t\t\t\tundefined\n\t\t\t>;\n\t\t}\n\t\tconst out: TreeNodeSchemaBoth<\n\t\t\tScopedSchemaName<TScope, string>,\n\t\t\tNodeKind.Array,\n\t\t\tTreeArrayNode<T>,\n\t\t\tIterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>,\n\t\t\ttrue,\n\t\t\tT,\n\t\t\tundefined\n\t\t> = this.namedArray(nameOrAllowedTypes as TName, allowedTypes, true, true);\n\t\treturn out;\n\t}\n\n\t/**\n\t * Define a {@link TreeNodeSchema} for a {@link (TreeArrayNode:interface)}.\n\t *\n\t * @param name - Unique identifier for this schema within this factory's scope.\n\t *\n\t * @remarks\n\t * This is not intended to be used directly, use the overload of `array` which takes a name instead.\n\t * This is only public to work around a compiler limitation.\n\t */\n\tprivate namedArray<\n\t\tName extends TName | string,\n\t\tconst T extends ImplicitAllowedTypes,\n\t\tconst ImplicitlyConstructable extends boolean,\n\t>(\n\t\tname: Name,\n\t\tallowedTypes: T,\n\t\tcustomizable: boolean,\n\t\timplicitlyConstructable: ImplicitlyConstructable,\n\t): TreeNodeSchemaBoth<\n\t\tScopedSchemaName<TScope, Name>,\n\t\tNodeKind.Array,\n\t\tTreeArrayNode<T> & WithType<ScopedSchemaName<TScope, string>, NodeKind.Array>,\n\t\tIterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>,\n\t\tImplicitlyConstructable,\n\t\tT,\n\t\tundefined\n\t> {\n\t\treturn arraySchema(this.scoped(name), allowedTypes, implicitlyConstructable, customizable);\n\t}\n\n\t/**\n\t * Make a field optional instead of the default, which is required.\n\t *\n\t * @param t - The types allowed under the field.\n\t * @param props - Optional properties to associate with the field.\n\t *\n\t * @typeParam TCustomMetadata - Custom metadata properties to associate with the field.\n\t * See {@link FieldSchemaMetadata.custom}.\n\t */\n\tpublic optional<const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(\n\t\tt: T,\n\t\tprops?: Omit<FieldProps<TCustomMetadata>, \"defaultProvider\">,\n\t): FieldSchema<FieldKind.Optional, T, TCustomMetadata> {\n\t\tconst defaultOptionalProvider: DefaultProvider = getDefaultProvider(() => {\n\t\t\treturn undefined;\n\t\t});\n\t\treturn createFieldSchema(FieldKind.Optional, t, {\n\t\t\tdefaultProvider: defaultOptionalProvider,\n\t\t\t...props,\n\t\t});\n\t}\n\n\t/**\n\t * Make a field explicitly required.\n\t *\n\t * @param t - The types allowed under the field.\n\t * @param props - Optional properties to associate with the field.\n\t *\n\t * @remarks\n\t * Fields are required by default, but this API can be used to make the required nature explicit in the schema,\n\t * and allows associating custom {@link FieldProps | properties} with the field.\n\t *\n\t * @typeParam TCustomMetadata - Custom metadata properties to associate with the field.\n\t * See {@link FieldSchemaMetadata.custom}.\n\t */\n\tpublic required<const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(\n\t\tt: T,\n\t\tprops?: Omit<FieldProps<TCustomMetadata>, \"defaultProvider\">,\n\t): FieldSchema<FieldKind.Required, T, TCustomMetadata> {\n\t\treturn createFieldSchema(FieldKind.Required, t, props);\n\t}\n\n\t/**\n\t * {@link SchemaFactory.optional} except tweaked to work better for recursive types.\n\t * Use with {@link ValidateRecursiveSchema} for improved type safety.\n\t * @remarks\n\t * This version of {@link SchemaFactory.optional} has fewer type constraints to work around TypeScript limitations, see {@link Unenforced}.\n\t * See {@link ValidateRecursiveSchema} for additional information about using recursive schema.\n\t */\n\tpublic optionalRecursive<const T extends Unenforced<ImplicitAllowedTypes>>(\n\t\tt: T,\n\t\tprops?: Omit<FieldProps, \"defaultProvider\">,\n\t): FieldSchemaUnsafe<FieldKind.Optional, T> {\n\t\treturn createFieldSchemaUnsafe(FieldKind.Optional, t, props);\n\t}\n\n\t/**\n\t * {@link SchemaFactory.required} except tweaked to work better for recursive types.\n\t * Use with {@link ValidateRecursiveSchema} for improved type safety.\n\t * @remarks\n\t * This version of {@link SchemaFactory.required} has fewer type constraints to work around TypeScript limitations, see {@link Unenforced}.\n\t * See {@link ValidateRecursiveSchema} for additional information about using recursive schema.\n\t */\n\tpublic requiredRecursive<const T extends Unenforced<ImplicitAllowedTypes>>(\n\t\tt: T,\n\t\tprops?: Omit<FieldProps, \"defaultProvider\">,\n\t): FieldSchemaUnsafe<FieldKind.Required, T> {\n\t\treturn createFieldSchemaUnsafe(FieldKind.Required, t, props);\n\t}\n\n\t/**\n\t * A special field which holds a unique identifier for an object node.\n\t * @remarks\n\t * The value of this field, a \"node identifier\", uniquely identifies a node among all other nodes in the tree.\n\t * Node identifiers are strings, and can therefore be used as lookup keys in maps or written to a database.\n\t * When the node is constructed, the identifier field does not need to be populated.\n\t * The SharedTree will provide an identifier for the node automatically.\n\t * An identifier provided automatically by the SharedTree has the following properties:\n\t * - It is a UUID.\n\t * - It is compressed to a space-efficient representation when stored in the document.\n\t * - A compressed form of the identifier can be accessed at runtime via the `Tree.shortId()` API.\n\t * - It will error if read (and will not be present in the object's iterable properties) before the node has been inserted into the tree.\n\t *\n\t * However, a user may alternatively supply their own string as the identifier if desired (for example, if importing identifiers from another system).\n\t * In that case, it is up to the user to ensure that the identifier is unique within the current tree - no other node should have the same identifier at the same time.\n\t * If the identifier is not unique, it may be read, but may cause libraries or features which operate over node identifiers to misbehave.\n\t * User-supplied identifiers may be read immediately, even before insertion into the tree.\n\t *\n\t * A node may have more than one identifier field (though note that this precludes the use of the `Tree.shortId()` API).\n\t */\n\tpublic get identifier(): FieldSchema<FieldKind.Identifier, typeof this.string> {\n\t\tconst defaultIdentifierProvider: DefaultProvider = getDefaultProvider(\n\t\t\t(nodeKeyManager: NodeKeyManager) => {\n\t\t\t\treturn nodeKeyManager.stabilizeNodeKey(nodeKeyManager.generateLocalNodeKey());\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\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n\tpublic objectRecursive<\n\t\tconst Name extends TName,\n\t\tconst T extends Unenforced<RestrictiveStringRecord<ImplicitFieldSchema>>,\n\t>(name: Name, t: T) {\n\t\ttype TScopedName = ScopedSchemaName<TScope, Name>;\n\t\treturn this.object(\n\t\t\tname,\n\t\t\tt as T & RestrictiveStringRecord<ImplicitFieldSchema>,\n\t\t) as unknown as TreeNodeSchemaClass<\n\t\t\tTScopedName,\n\t\t\tNodeKind.Object,\n\t\t\tTreeObjectNodeUnsafe<T, TScopedName>,\n\t\t\tobject & InsertableObjectFromSchemaRecordUnsafe<T>,\n\t\t\tfalse,\n\t\t\tT\n\t\t>;\n\t}\n\n\t/**\n\t * `SchemaFactory.array` except tweaked to work better for recursive types.\n\t * Use with {@link ValidateRecursiveSchema} for improved type safety.\n\t * @remarks\n\t * This version of `SchemaFactory.array` uses the same workarounds as {@link SchemaFactory.objectRecursive}.\n\t * See {@link ValidateRecursiveSchema} for additional information about using recursive schema.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n\tpublic arrayRecursive<\n\t\tconst Name extends TName,\n\t\tconst T extends Unenforced<ImplicitAllowedTypes>,\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\tTreeArrayNodeUnsafe<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Array>,\n\t\t\t{\n\t\t\t\t/**\n\t\t\t\t * Iterator for the iterable of content for this node.\n\t\t\t\t * @privateRemarks\n\t\t\t\t * Wrapping the constructor parameter for recursive arrays and maps in an inlined object type avoids (for unknown reasons)\n\t\t\t\t * the following compile error when declaring the recursive schema:\n\t\t\t\t * `Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions.`\n\t\t\t\t * To benefit from this without impacting the API, the definition of `Iterable` has been inlined as such an object.\n\t\t\t\t *\n\t\t\t\t * If this workaround is kept, ideally this comment would be deduplicated with the other instance of it.\n\t\t\t\t * Unfortunately attempts to do this failed to avoid the compile error this was introduced to solve.\n\t\t\t\t */\n\t\t\t\t[Symbol.iterator](): Iterator<InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>>;\n\t\t\t},\n\t\t\tfalse,\n\t\t\tT,\n\t\t\tundefined\n\t\t>;\n\t}\n\n\t/**\n\t * `SchemaFactory.map` except tweaked to work better for recursive types.\n\t * Use with {@link ValidateRecursiveSchema} for improved type safety.\n\t * @remarks\n\t * This version of `SchemaFactory.map` uses the same workarounds as {@link SchemaFactory.objectRecursive}.\n\t * See {@link ValidateRecursiveSchema} for additional information about using recursive schema.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n\tpublic mapRecursive<Name extends TName, const T extends Unenforced<ImplicitAllowedTypes>>(\n\t\tname: Name,\n\t\tallowedTypes: T,\n\t) {\n\t\tconst MapSchema = this.namedMap(\n\t\t\tname,\n\t\t\tallowedTypes as T & ImplicitAllowedTypes,\n\t\t\ttrue,\n\t\t\t// Setting this (implicitlyConstructable) to true seems to work ok currently, but not for other node kinds.\n\t\t\t// Supporting this could be fragile and might break other future changes, so it's being kept as false for now.\n\t\t\tfalse,\n\t\t);\n\n\t\treturn MapSchema as TreeNodeSchemaClass<\n\t\t\tScopedSchemaName<TScope, Name>,\n\t\t\tNodeKind.Map,\n\t\t\tTreeMapNodeUnsafe<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Map>,\n\t\t\t| {\n\t\t\t\t\t/**\n\t\t\t\t\t * Iterator for the iterable of content for this node.\n\t\t\t\t\t * @privateRemarks\n\t\t\t\t\t * Wrapping the constructor parameter for recursive arrays and maps in an inlined object type avoids (for unknown reasons)\n\t\t\t\t\t * the following compile error when declaring the recursive schema:\n\t\t\t\t\t * `Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions.`\n\t\t\t\t\t * To benefit from this without impacting the API, the definition of `Iterable` has been inlined as such an object.\n\t\t\t\t\t *\n\t\t\t\t\t * If this workaround is kept, ideally this comment would be deduplicated with the other instance of it.\n\t\t\t\t\t * Unfortunately attempts to do this failed to avoid the compile error this was introduced to solve.\n\t\t\t\t\t */\n\t\t\t\t\t[Symbol.iterator](): Iterator<\n\t\t\t\t\t\t[string, InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>]\n\t\t\t\t\t>;\n\t\t\t }\n\t\t\t// Ideally this would be\n\t\t\t// RestrictiveStringRecord<InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>>,\n\t\t\t// but doing so breaks recursive types.\n\t\t\t// Instead we do a less nice version:\n\t\t\t| {\n\t\t\t\t\treadonly [P in string]: InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>;\n\t\t\t },\n\t\t\tfalse,\n\t\t\tT,\n\t\t\tundefined\n\t\t>;\n\t}\n}\n\nexport function structuralName<const T extends string>(\n\tcollectionName: T,\n\tallowedTypes: TreeNodeSchema | readonly TreeNodeSchema[],\n): `${T}<${string}>` {\n\tlet inner: string;\n\tif (!isReadonlyArray(allowedTypes)) {\n\t\treturn structuralName(collectionName, [allowedTypes]);\n\t} else {\n\t\tconst names = allowedTypes.map((t): string => {\n\t\t\t// Ensure that lazy types (functions) don't slip through here.\n\t\t\tassert(!isLazy(t), 0x83d /* invalid type provided */);\n\t\t\tmarkSchemaMostDerived(t);\n\t\t\treturn t.identifier;\n\t\t});\n\t\t// Ensure name is order independent\n\t\tnames.sort();\n\t\t// Ensure name can't have collisions by quoting and escaping any quotes in the names of types.\n\t\t// Using JSON is a simple way to accomplish this.\n\t\t// The outer `[]` around the result were needed so that a single type name \"Any\" would not collide with the \"any\" case which used to exist.\n\t\tinner = JSON.stringify(names);\n\t}\n\treturn `${collectionName}<${inner}>`;\n}\n\n/**\n * Indicates that a schema is the \"most derived\" version which is allowed to be used, see {@link MostDerivedData}.\n * Calling helps with error messages about invalid schema usage (using more than one type from single schema factor produced type,\n * and thus calling this for one than one subclass).\n * @remarks\n * Helper for invoking {@link TreeNodeValid.markMostDerived} for any {@link TreeNodeSchema} if it needed.\n */\nexport function markSchemaMostDerived(schema: TreeNodeSchema): void {\n\tif (schema instanceof LeafNodeSchema) {\n\t\treturn;\n\t}\n\n\tif (!inPrototypeChain(schema, TreeNodeValid)) {\n\t\t// Use JSON.stringify to quote and escape identifier string.\n\t\tthrow new UsageError(\n\t\t\t`Schema for ${JSON.stringify(\n\t\t\t\tschema.identifier,\n\t\t\t)} does not extend a SchemaFactory generated class. This is invalid.`,\n\t\t);\n\t}\n\n\t(schema as typeof TreeNodeValid & TreeNodeSchema).markMostDerived();\n}\n"]}
@@ -27,7 +27,9 @@ export interface SimpleNodeSchemaBase<TNodeKind extends NodeKind> {
27
27
  */
28
28
  export interface SimpleObjectNodeSchema extends SimpleNodeSchemaBase<NodeKind.Object> {
29
29
  /**
30
- * Schemas for each of the object's fields, keyed off of schema's property keys.
30
+ * Schemas for each of the object's fields, keyed off of schema's keys.
31
+ * @remarks
32
+ * Depending on how this schema was exported, the string keys may be either the property keys or the stored keys.
31
33
  */
32
34
  readonly fields: Record<string, SimpleFieldSchema>;
33
35
  }
@@ -1 +1 @@
1
- {"version":3,"file":"simpleSchema.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/simpleSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExE;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB,CAAC,SAAS,SAAS,QAAQ;IAC/D;;;;OAIG;IACH,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;CACzB;AAED;;;;;GAKG;AACH,MAAM,WAAW,sBAAuB,SAAQ,oBAAoB,CAAC,QAAQ,CAAC,MAAM,CAAC;IACpF;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;CACnD;AAED;;;;;GAKG;AACH,MAAM,WAAW,qBAAsB,SAAQ,oBAAoB,CAAC,QAAQ,CAAC,KAAK,CAAC;IAClF;;;;;OAKG;IACH,QAAQ,CAAC,YAAY,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAC3C;AAED;;;;;GAKG;AACH,MAAM,WAAW,mBAAoB,SAAQ,oBAAoB,CAAC,QAAQ,CAAC,GAAG,CAAC;IAC9E;;;;;OAKG;IACH,QAAQ,CAAC,YAAY,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAC3C;AAED;;;;;GAKG;AACH,MAAM,WAAW,oBAAqB,SAAQ,oBAAoB,CAAC,QAAQ,CAAC,IAAI,CAAC;IAChF;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,WAAW,CA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
1
- {"version":3,"file":"simpleSchema.js","sourceRoot":"","sources":["../../../src/simple-tree/api/simpleSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ValueSchema } from \"../../core/index.js\";\nimport type { NodeKind } from \"../core/index.js\";\nimport type { FieldKind, FieldSchemaMetadata } from \"../schemaTypes.js\";\n\n/**\n * Base interface for all {@link SimpleNodeSchema} implementations.\n *\n * @internal\n * @sealed\n */\nexport interface SimpleNodeSchemaBase<TNodeKind extends NodeKind> {\n\t/**\n\t * The kind of {@link SimpleNodeSchema}.\n\t *\n\t * @remarks can be used to type-switch between implementations.\n\t */\n\treadonly kind: TNodeKind;\n}\n\n/**\n * A {@link SimpleNodeSchema} for an object node.\n *\n * @internal\n * @sealed\n */\nexport interface SimpleObjectNodeSchema extends SimpleNodeSchemaBase<NodeKind.Object> {\n\t/**\n\t * Schemas for each of the object's fields, keyed off of schema's property keys.\n\t */\n\treadonly fields: Record<string, SimpleFieldSchema>;\n}\n\n/**\n * A {@link SimpleNodeSchema} for an array node.\n *\n * @internal\n * @sealed\n */\nexport interface SimpleArrayNodeSchema extends SimpleNodeSchemaBase<NodeKind.Array> {\n\t/**\n\t * The types allowed in the array.\n\t *\n\t * @remarks Refers to the types by identifier.\n\t * A {@link SimpleTreeSchema} is needed to resolve these identifiers to their schema {@link SimpleTreeSchema.definitions}.\n\t */\n\treadonly allowedTypes: ReadonlySet<string>;\n}\n\n/**\n * A {@link SimpleNodeSchema} for a map node.\n *\n * @internal\n * @sealed\n */\nexport interface SimpleMapNodeSchema extends SimpleNodeSchemaBase<NodeKind.Map> {\n\t/**\n\t * The types allowed as values in the map.\n\t *\n\t * @remarks Refers to the types by identifier.\n\t * A {@link SimpleTreeSchema} is needed to resolve these identifiers to their schema {@link SimpleTreeSchema.definitions}.\n\t */\n\treadonly allowedTypes: ReadonlySet<string>;\n}\n\n/**\n * A {@link SimpleNodeSchema} for a leaf node.\n *\n * @internal\n * @sealed\n */\nexport interface SimpleLeafNodeSchema extends SimpleNodeSchemaBase<NodeKind.Leaf> {\n\t/**\n\t * The kind of leaf node.\n\t */\n\treadonly leafKind: ValueSchema;\n}\n\n/**\n * A simple, shallow representation of a schema for a node.\n *\n * @remarks This definition is incomplete, and references child types by identifiers.\n * To be useful, this generally needs to be used as a part of a complete {@link SimpleTreeSchema}, which\n * contains backing {@link SimpleTreeSchema.definitions} for each referenced identifier.\n *\n * @internal\n */\nexport type SimpleNodeSchema =\n\t| SimpleLeafNodeSchema\n\t| SimpleMapNodeSchema\n\t| SimpleArrayNodeSchema\n\t| SimpleObjectNodeSchema;\n\n/**\n * A simple, shallow representation of a schema for a field.\n *\n * @remarks This definition is incomplete, and references child types by identifiers.\n * To be useful, this generally needs to be used as a part of a complete {@link SimpleTreeSchema}, which\n * contains backing {@link SimpleTreeSchema.definitions} for each referenced identifier.\n *\n * @internal\n * @sealed\n */\nexport interface SimpleFieldSchema {\n\t/**\n\t * The kind of tree field.\n\t */\n\treadonly kind: FieldKind;\n\n\t/**\n\t * The types allowed under the field.\n\t *\n\t * @remarks Refers to the types by identifier.\n\t * A {@link SimpleTreeSchema} is needed to resolve these identifiers to their schema {@link SimpleTreeSchema.definitions}.\n\t */\n\treadonly allowedTypes: ReadonlySet<string>;\n\n\t/**\n\t * {@inheritDoc FieldSchemaMetadata}\n\t */\n\treadonly metadata?: FieldSchemaMetadata | undefined;\n}\n\n/**\n * A simplified representation of a schema for a tree.\n *\n * @remarks Contains the complete set of schema {@link SimpleTreeSchema.definitions} required to resolve references,\n * which are represented inline with identifiers.\n *\n * @internal\n * @sealed\n */\nexport interface SimpleTreeSchema extends SimpleFieldSchema {\n\t/**\n\t * The kind of tree field representing the root of the tree.\n\t */\n\treadonly kind: FieldKind;\n\n\t/**\n\t * The types allowed under the tree root.\n\t *\n\t * @remarks Refers to the types by identifier.\n\t * Can be resolved via {@link SimpleTreeSchema.definitions}.\n\t */\n\treadonly allowedTypes: ReadonlySet<string>;\n\n\t/**\n\t * The complete set of node schema definitions recursively referenced by the tree's {@link SimpleTreeSchema.allowedTypes}.\n\t *\n\t * @remarks the keys are the schemas' {@link TreeNodeSchemaCore.identifier | identifiers}.\n\t */\n\treadonly definitions: ReadonlyMap<string, SimpleNodeSchema>;\n}\n"]}
1
+ {"version":3,"file":"simpleSchema.js","sourceRoot":"","sources":["../../../src/simple-tree/api/simpleSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ValueSchema } from \"../../core/index.js\";\nimport type { NodeKind } from \"../core/index.js\";\nimport type { FieldKind, FieldSchemaMetadata } from \"../schemaTypes.js\";\n\n/**\n * Base interface for all {@link SimpleNodeSchema} implementations.\n *\n * @internal\n * @sealed\n */\nexport interface SimpleNodeSchemaBase<TNodeKind extends NodeKind> {\n\t/**\n\t * The kind of {@link SimpleNodeSchema}.\n\t *\n\t * @remarks can be used to type-switch between implementations.\n\t */\n\treadonly kind: TNodeKind;\n}\n\n/**\n * A {@link SimpleNodeSchema} for an object node.\n *\n * @internal\n * @sealed\n */\nexport interface SimpleObjectNodeSchema extends SimpleNodeSchemaBase<NodeKind.Object> {\n\t/**\n\t * Schemas for each of the object's fields, keyed off of schema's keys.\n\t * @remarks\n\t * Depending on how this schema was exported, the string keys may be either the property keys or the stored keys.\n\t */\n\treadonly fields: Record<string, SimpleFieldSchema>;\n}\n\n/**\n * A {@link SimpleNodeSchema} for an array node.\n *\n * @internal\n * @sealed\n */\nexport interface SimpleArrayNodeSchema extends SimpleNodeSchemaBase<NodeKind.Array> {\n\t/**\n\t * The types allowed in the array.\n\t *\n\t * @remarks Refers to the types by identifier.\n\t * A {@link SimpleTreeSchema} is needed to resolve these identifiers to their schema {@link SimpleTreeSchema.definitions}.\n\t */\n\treadonly allowedTypes: ReadonlySet<string>;\n}\n\n/**\n * A {@link SimpleNodeSchema} for a map node.\n *\n * @internal\n * @sealed\n */\nexport interface SimpleMapNodeSchema extends SimpleNodeSchemaBase<NodeKind.Map> {\n\t/**\n\t * The types allowed as values in the map.\n\t *\n\t * @remarks Refers to the types by identifier.\n\t * A {@link SimpleTreeSchema} is needed to resolve these identifiers to their schema {@link SimpleTreeSchema.definitions}.\n\t */\n\treadonly allowedTypes: ReadonlySet<string>;\n}\n\n/**\n * A {@link SimpleNodeSchema} for a leaf node.\n *\n * @internal\n * @sealed\n */\nexport interface SimpleLeafNodeSchema extends SimpleNodeSchemaBase<NodeKind.Leaf> {\n\t/**\n\t * The kind of leaf node.\n\t */\n\treadonly leafKind: ValueSchema;\n}\n\n/**\n * A simple, shallow representation of a schema for a node.\n *\n * @remarks This definition is incomplete, and references child types by identifiers.\n * To be useful, this generally needs to be used as a part of a complete {@link SimpleTreeSchema}, which\n * contains backing {@link SimpleTreeSchema.definitions} for each referenced identifier.\n *\n * @internal\n */\nexport type SimpleNodeSchema =\n\t| SimpleLeafNodeSchema\n\t| SimpleMapNodeSchema\n\t| SimpleArrayNodeSchema\n\t| SimpleObjectNodeSchema;\n\n/**\n * A simple, shallow representation of a schema for a field.\n *\n * @remarks This definition is incomplete, and references child types by identifiers.\n * To be useful, this generally needs to be used as a part of a complete {@link SimpleTreeSchema}, which\n * contains backing {@link SimpleTreeSchema.definitions} for each referenced identifier.\n *\n * @internal\n * @sealed\n */\nexport interface SimpleFieldSchema {\n\t/**\n\t * The kind of tree field.\n\t */\n\treadonly kind: FieldKind;\n\n\t/**\n\t * The types allowed under the field.\n\t *\n\t * @remarks Refers to the types by identifier.\n\t * A {@link SimpleTreeSchema} is needed to resolve these identifiers to their schema {@link SimpleTreeSchema.definitions}.\n\t */\n\treadonly allowedTypes: ReadonlySet<string>;\n\n\t/**\n\t * {@inheritDoc FieldSchemaMetadata}\n\t */\n\treadonly metadata?: FieldSchemaMetadata | undefined;\n}\n\n/**\n * A simplified representation of a schema for a tree.\n *\n * @remarks Contains the complete set of schema {@link SimpleTreeSchema.definitions} required to resolve references,\n * which are represented inline with identifiers.\n *\n * @internal\n * @sealed\n */\nexport interface SimpleTreeSchema extends SimpleFieldSchema {\n\t/**\n\t * The kind of tree field representing the root of the tree.\n\t */\n\treadonly kind: FieldKind;\n\n\t/**\n\t * The types allowed under the tree root.\n\t *\n\t * @remarks Refers to the types by identifier.\n\t * Can be resolved via {@link SimpleTreeSchema.definitions}.\n\t */\n\treadonly allowedTypes: ReadonlySet<string>;\n\n\t/**\n\t * The complete set of node schema definitions recursively referenced by the tree's {@link SimpleTreeSchema.allowedTypes}.\n\t *\n\t * @remarks the keys are the schemas' {@link TreeNodeSchemaCore.identifier | identifiers}.\n\t */\n\treadonly definitions: ReadonlyMap<string, SimpleNodeSchema>;\n}\n"]}
@@ -63,7 +63,9 @@ export function createSimpleTreeIndex(view, indexer, getValue, isKeyValid, index
63
63
  if (!isTreeValue(simpleTree)) {
64
64
  return treeNodeApi.status(simpleTree);
65
65
  }
66
- });
66
+ },
67
+ // simple tree indexes are shallow indexes, indicating so allows for a performance optimization
68
+ true);
67
69
  // all the type checking guarantees that we put nodes of the correct type in the index
68
70
  // but it's not captured in the type system
69
71
  return index;
@@ -1 +1 @@
1
- {"version":3,"file":"simpleTreeIndex.js","sourceRoot":"","sources":["../../../src/simple-tree/api/simpleTreeIndex.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,OAAO,EACN,eAAe,EACf,WAAW,EAEX,UAAU,GAIV,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAElD,OAAO,EAAE,kBAAkB,EAAsC,MAAM,kBAAkB,CAAC;AAC1F,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAoGxD;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CAKpC,IAA4B,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CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QAC5B,MAAM,CAAC,SAAS,EAAE,CAAC;QACnB,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;QAC3B,MAAM,CAAC,QAAQ,EAAE,CAAC;QAClB,MAAM,CAAC,SAAS,EAAE,CAAC;QAEnB,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACzB,IAAI,CAAC,oCAAoC,CAAC,CAAC;QAC5C,CAAC;QAED,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;YACxB,IAAI,CAAC,+BAA+B,CAAC,CAAC;QACvC,CAAC;QAED,OAAO,KAAK,CAAC;IACd,CAAC,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tAnchorNode,\n\tFieldKey,\n\tITreeSubscriptionCursor,\n\tTreeNodeSchemaIdentifier,\n} from \"../../core/index.js\";\nimport {\n\tAnchorTreeIndex,\n\tisTreeValue,\n\ttype TreeIndexNodes,\n\thasElement,\n\ttype TreeIndex,\n\ttype TreeIndexKey,\n\ttype KeyFinder,\n} from \"../../feature-libraries/index.js\";\nimport { brand, fail } from \"../../util/index.js\";\nimport type { ImplicitFieldSchema, NodeFromSchema } from \"../schemaTypes.js\";\nimport { treeNodeFromAnchor, type TreeNode, type TreeNodeSchema } from \"../core/index.js\";\nimport { treeNodeApi } from \"./treeNodeApi.js\";\nimport type { TreeView } from \"./tree.js\";\nimport { walkFieldSchema } from \"../walkFieldSchema.js\";\nimport type { SchematizingSimpleTreeView } from \"../../shared-tree/index.js\";\n\n/**\n * A {@link TreeIndex} that returns tree nodes given their associated keys.\n *\n * @alpha\n */\nexport type SimpleTreeIndex<TKey extends TreeIndexKey, TValue> = TreeIndex<TKey, TValue>;\n\n/**\n * Creates a {@link SimpleTreeIndex} with a specified indexer.\n *\n * @param view - the view for the tree being indexed\n * @param indexer - a function that takes in a {@link TreeNodeSchema} and returns the field name that all nodes of the given schema\n * should be keyed on, must be pure and functional\n * @param getValue - given at least one {@link TreeNode}, returns an associated value\n * @param isKeyValid - function for verifying the validity of the key retrieved based on the information given by the indexer\n *\n * @alpha\n */\nexport function createSimpleTreeIndex<\n\tTFieldSchema extends ImplicitFieldSchema,\n\tTKey extends TreeIndexKey,\n\tTValue,\n>(\n\tview: TreeView<TFieldSchema>,\n\tindexer: (schema: TreeNodeSchema) => string | undefined,\n\tgetValue: (nodes: TreeIndexNodes<TreeNode>) => TValue,\n\tisKeyValid: (key: TreeIndexKey) => key is TKey,\n): SimpleTreeIndex<TKey, TValue>;\n/**\n * Creates a {@link SimpleTreeIndex} with a specified indexer.\n *\n * @param view - the view for the tree being indexed\n * @param indexer - a function that takes in a {@link TreeNodeSchema} and returns the field name that all nodes of the given schema\n * should be keyed on, must be pure and functional\n * @param getValue - given at least one {@link TreeNode}, returns an associated value\n * @param isKeyValid - function for verifying the validity of the key retrieved based on the information given by the indexer\n * @param indexableSchema - a list of all the schema types that can be indexed\n *\n * @alpha\n */\nexport function createSimpleTreeIndex<\n\tTFieldSchema extends ImplicitFieldSchema,\n\tTKey extends TreeIndexKey,\n\tTValue,\n\tTSchema extends TreeNodeSchema,\n>(\n\tview: TreeView<TFieldSchema>,\n\tindexer: (schema: TSchema) => string | undefined,\n\tgetValue: (nodes: TreeIndexNodes<NodeFromSchema<TSchema>>) => TValue,\n\tisKeyValid: (key: TreeIndexKey) => key is TKey,\n\tindexableSchema: readonly TSchema[],\n): SimpleTreeIndex<TKey, TValue>;\n/**\n * Creates a {@link SimpleTreeIndex} with a specified indexer.\n *\n * @param view - the view for the tree being indexed\n * @param indexer - a map from {@link TreeNodeSchema} to the field name that all nodes of the given schema\n * should be keyed on\n * @param getValue - given at least one {@link TreeNode}, returns an associated value\n * @param isKeyValid - function for verifying the validity of the key retrieved based on the information given by the indexer\n *\n * @alpha\n */\nexport function createSimpleTreeIndex<\n\tTFieldSchema extends ImplicitFieldSchema,\n\tTKey extends TreeIndexKey,\n\tTValue,\n>(\n\tview: TreeView<TFieldSchema>,\n\tindexer: Map<TreeNodeSchema, string>,\n\tgetValue: (nodes: TreeIndexNodes<TreeNode>) => TValue,\n\tisKeyValid: (key: TreeIndexKey) => key is TKey,\n): SimpleTreeIndex<TKey, TValue>;\n/**\n * Creates a {@link SimpleTreeIndex} with a specified indexer.\n *\n * @param view - the view for the tree being indexed\n * @param indexer - a map from {@link TreeNodeSchema} to the field name that all nodes of the given schema\n * should be keyed on\n * @param getValue - given at least one {@link TreeNode}, returns an associated value\n * @param isKeyValid - function for verifying the validity of the key retrieved based on the information given by the indexer\n * @param indexableSchema - a list of all the schema types that can be indexed\n *\n * @alpha\n */\nexport function createSimpleTreeIndex<\n\tTFieldSchema extends ImplicitFieldSchema,\n\tTKey extends TreeIndexKey,\n\tTValue,\n\tTSchema extends TreeNodeSchema,\n>(\n\tview: TreeView<TFieldSchema>,\n\tindexer: Map<TreeNodeSchema, string>,\n\tgetValue: (nodes: TreeIndexNodes<NodeFromSchema<TSchema>>) => TValue,\n\tisKeyValid: (key: TreeIndexKey) => key is TKey,\n\tindexableSchema: readonly TSchema[],\n): SimpleTreeIndex<TKey, TValue>;\n/**\n * Creates a {@link SimpleTreeIndex} with a specified indexer.\n *\n * @alpha\n */\nexport function createSimpleTreeIndex<\n\tTFieldSchema extends ImplicitFieldSchema,\n\tTKey extends TreeIndexKey,\n\tTValue,\n>(\n\tview: TreeView<TFieldSchema>,\n\tindexer: ((schema: TreeNodeSchema) => string | undefined) | Map<TreeNodeSchema, string>,\n\tgetValue:\n\t\t| ((nodes: TreeIndexNodes<TreeNode>) => TValue)\n\t\t| ((nodes: TreeIndexNodes<NodeFromSchema<TreeNodeSchema>>) => TValue),\n\tisKeyValid: (key: TreeIndexKey) => key is TKey,\n\tindexableSchema?: readonly TreeNodeSchema[],\n): SimpleTreeIndex<TKey, TValue> {\n\tconst indexableSchemaMap = new Map();\n\tif (indexableSchema !== undefined) {\n\t\tfor (const schemus of indexableSchema) {\n\t\t\tindexableSchemaMap.set(schemus.identifier, schemus);\n\t\t}\n\t} else {\n\t\twalkFieldSchema(view.schema, {\n\t\t\tnode: (schemus) => indexableSchemaMap.set(schemus.identifier, schemus),\n\t\t});\n\t}\n\n\tconst schemaIndexer =\n\t\tindexableSchema === undefined\n\t\t\t? (schemaIdentifier: TreeNodeSchemaIdentifier) => {\n\t\t\t\t\t// if indexable schema isn't provided, we check if the node is in schema\n\t\t\t\t\tconst schemus = indexableSchemaMap.get(schemaIdentifier);\n\t\t\t\t\tif (schemus !== undefined) {\n\t\t\t\t\t\tconst keyLocation =\n\t\t\t\t\t\t\ttypeof indexer === \"function\" ? indexer(schemus) : indexer.get(schemus);\n\t\t\t\t\t\tif (keyLocation !== undefined) {\n\t\t\t\t\t\t\treturn makeGenericKeyFinder<TKey>(brand(keyLocation), isKeyValid);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tfail(\"node is out of schema\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t: (schemaIdentifier: TreeNodeSchemaIdentifier) => {\n\t\t\t\t\tconst schemus = indexableSchemaMap.get(schemaIdentifier);\n\t\t\t\t\tif (schemus !== undefined) {\n\t\t\t\t\t\tconst keyLocation =\n\t\t\t\t\t\t\ttypeof indexer === \"function\" ? indexer(schemus) : indexer.get(schemus);\n\t\t\t\t\t\tif (keyLocation !== undefined) {\n\t\t\t\t\t\t\treturn makeGenericKeyFinder<TKey>(brand(keyLocation), isKeyValid);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t};\n\n\tconst index = new AnchorTreeIndex<TKey, TValue>(\n\t\t(view as SchematizingSimpleTreeView<TFieldSchema>).getView().checkout.forest,\n\t\tschemaIndexer,\n\t\t(anchorNodes) => {\n\t\t\tconst simpleTreeNodes: TreeNode[] = [];\n\t\t\tfor (const anchorNode of anchorNodes) {\n\t\t\t\tconst simpleTree = treeNodeFromAnchor(anchorNode);\n\t\t\t\tif (!isTreeValue(simpleTree)) {\n\t\t\t\t\tsimpleTreeNodes.push(simpleTree);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (hasElement(simpleTreeNodes)) {\n\t\t\t\treturn getValue(simpleTreeNodes);\n\t\t\t}\n\t\t},\n\t\t(anchorNode: AnchorNode) => {\n\t\t\tconst simpleTree = treeNodeFromAnchor(anchorNode);\n\t\t\tif (!isTreeValue(simpleTree)) {\n\t\t\t\treturn treeNodeApi.status(simpleTree);\n\t\t\t}\n\t\t},\n\t);\n\n\t// all the type checking guarantees that we put nodes of the correct type in the index\n\t// but it's not captured in the type system\n\treturn index as SimpleTreeIndex<TKey, TValue>;\n}\n\nfunction makeGenericKeyFinder<TKey extends TreeIndexKey>(\n\tkeyField: FieldKey,\n\tisKeyValid: (key: TreeIndexKey) => key is TKey,\n): KeyFinder<TKey> {\n\treturn (cursor: ITreeSubscriptionCursor) => {\n\t\tcursor.enterField(keyField);\n\t\tcursor.firstNode();\n\t\tconst value = cursor.value;\n\t\tcursor.exitNode();\n\t\tcursor.exitField();\n\n\t\tif (value === undefined) {\n\t\t\tfail(\"a value for the key does not exist\");\n\t\t}\n\n\t\tif (!isKeyValid(value)) {\n\t\t\tfail(\"the key is an unexpected type\");\n\t\t}\n\n\t\treturn value;\n\t};\n}\n"]}
1
+ {"version":3,"file":"simpleTreeIndex.js","sourceRoot":"","sources":["../../../src/simple-tree/api/simpleTreeIndex.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,OAAO,EACN,eAAe,EACf,WAAW,EAEX,UAAU,GAIV,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAElD,OAAO,EAAE,kBAAkB,EAAsC,MAAM,kBAAkB,CAAC;AAC1F,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAoGxD;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C5B,QAAkB,EAClB,UAA8C;IAE9C,OAAO,CAAC,MAA+B,EAAE,EAAE;QAC1C,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QAC5B,MAAM,CAAC,SAAS,EAAE,CAAC;QACnB,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;QAC3B,MAAM,CAAC,QAAQ,EAAE,CAAC;QAClB,MAAM,CAAC,SAAS,EAAE,CAAC;QAEnB,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACzB,IAAI,CAAC,oCAAoC,CAAC,CAAC;QAC5C,CAAC;QAED,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;YACxB,IAAI,CAAC,+BAA+B,CAAC,CAAC;QACvC,CAAC;QAED,OAAO,KAAK,CAAC;IACd,CAAC,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tAnchorNode,\n\tFieldKey,\n\tITreeSubscriptionCursor,\n\tTreeNodeSchemaIdentifier,\n} from \"../../core/index.js\";\nimport {\n\tAnchorTreeIndex,\n\tisTreeValue,\n\ttype TreeIndexNodes,\n\thasElement,\n\ttype TreeIndex,\n\ttype TreeIndexKey,\n\ttype KeyFinder,\n} from \"../../feature-libraries/index.js\";\nimport { brand, fail } from \"../../util/index.js\";\nimport type { ImplicitFieldSchema, NodeFromSchema } from \"../schemaTypes.js\";\nimport { treeNodeFromAnchor, type TreeNode, type TreeNodeSchema } from \"../core/index.js\";\nimport { treeNodeApi } from \"./treeNodeApi.js\";\nimport type { TreeView } from \"./tree.js\";\nimport { walkFieldSchema } from \"../walkFieldSchema.js\";\nimport type { SchematizingSimpleTreeView } from \"../../shared-tree/index.js\";\n\n/**\n * A {@link TreeIndex} that returns tree nodes given their associated keys.\n *\n * @alpha\n */\nexport type SimpleTreeIndex<TKey extends TreeIndexKey, TValue> = TreeIndex<TKey, TValue>;\n\n/**\n * Creates a {@link SimpleTreeIndex} with a specified indexer.\n *\n * @param view - the view for the tree being indexed\n * @param indexer - a function that takes in a {@link TreeNodeSchema} and returns the field name that all nodes of the given schema\n * should be keyed on, must be pure and functional\n * @param getValue - given at least one {@link TreeNode}, returns an associated value\n * @param isKeyValid - function for verifying the validity of the key retrieved based on the information given by the indexer\n *\n * @alpha\n */\nexport function createSimpleTreeIndex<\n\tTFieldSchema extends ImplicitFieldSchema,\n\tTKey extends TreeIndexKey,\n\tTValue,\n>(\n\tview: TreeView<TFieldSchema>,\n\tindexer: (schema: TreeNodeSchema) => string | undefined,\n\tgetValue: (nodes: TreeIndexNodes<TreeNode>) => TValue,\n\tisKeyValid: (key: TreeIndexKey) => key is TKey,\n): SimpleTreeIndex<TKey, TValue>;\n/**\n * Creates a {@link SimpleTreeIndex} with a specified indexer.\n *\n * @param view - the view for the tree being indexed\n * @param indexer - a function that takes in a {@link TreeNodeSchema} and returns the field name that all nodes of the given schema\n * should be keyed on, must be pure and functional\n * @param getValue - given at least one {@link TreeNode}, returns an associated value\n * @param isKeyValid - function for verifying the validity of the key retrieved based on the information given by the indexer\n * @param indexableSchema - a list of all the schema types that can be indexed\n *\n * @alpha\n */\nexport function createSimpleTreeIndex<\n\tTFieldSchema extends ImplicitFieldSchema,\n\tTKey extends TreeIndexKey,\n\tTValue,\n\tTSchema extends TreeNodeSchema,\n>(\n\tview: TreeView<TFieldSchema>,\n\tindexer: (schema: TSchema) => string | undefined,\n\tgetValue: (nodes: TreeIndexNodes<NodeFromSchema<TSchema>>) => TValue,\n\tisKeyValid: (key: TreeIndexKey) => key is TKey,\n\tindexableSchema: readonly TSchema[],\n): SimpleTreeIndex<TKey, TValue>;\n/**\n * Creates a {@link SimpleTreeIndex} with a specified indexer.\n *\n * @param view - the view for the tree being indexed\n * @param indexer - a map from {@link TreeNodeSchema} to the field name that all nodes of the given schema\n * should be keyed on\n * @param getValue - given at least one {@link TreeNode}, returns an associated value\n * @param isKeyValid - function for verifying the validity of the key retrieved based on the information given by the indexer\n *\n * @alpha\n */\nexport function createSimpleTreeIndex<\n\tTFieldSchema extends ImplicitFieldSchema,\n\tTKey extends TreeIndexKey,\n\tTValue,\n>(\n\tview: TreeView<TFieldSchema>,\n\tindexer: Map<TreeNodeSchema, string>,\n\tgetValue: (nodes: TreeIndexNodes<TreeNode>) => TValue,\n\tisKeyValid: (key: TreeIndexKey) => key is TKey,\n): SimpleTreeIndex<TKey, TValue>;\n/**\n * Creates a {@link SimpleTreeIndex} with a specified indexer.\n *\n * @param view - the view for the tree being indexed\n * @param indexer - a map from {@link TreeNodeSchema} to the field name that all nodes of the given schema\n * should be keyed on\n * @param getValue - given at least one {@link TreeNode}, returns an associated value\n * @param isKeyValid - function for verifying the validity of the key retrieved based on the information given by the indexer\n * @param indexableSchema - a list of all the schema types that can be indexed\n *\n * @alpha\n */\nexport function createSimpleTreeIndex<\n\tTFieldSchema extends ImplicitFieldSchema,\n\tTKey extends TreeIndexKey,\n\tTValue,\n\tTSchema extends TreeNodeSchema,\n>(\n\tview: TreeView<TFieldSchema>,\n\tindexer: Map<TreeNodeSchema, string>,\n\tgetValue: (nodes: TreeIndexNodes<NodeFromSchema<TSchema>>) => TValue,\n\tisKeyValid: (key: TreeIndexKey) => key is TKey,\n\tindexableSchema: readonly TSchema[],\n): SimpleTreeIndex<TKey, TValue>;\n/**\n * Creates a {@link SimpleTreeIndex} with a specified indexer.\n *\n * @alpha\n */\nexport function createSimpleTreeIndex<\n\tTFieldSchema extends ImplicitFieldSchema,\n\tTKey extends TreeIndexKey,\n\tTValue,\n>(\n\tview: TreeView<TFieldSchema>,\n\tindexer: ((schema: TreeNodeSchema) => string | undefined) | Map<TreeNodeSchema, string>,\n\tgetValue:\n\t\t| ((nodes: TreeIndexNodes<TreeNode>) => TValue)\n\t\t| ((nodes: TreeIndexNodes<NodeFromSchema<TreeNodeSchema>>) => TValue),\n\tisKeyValid: (key: TreeIndexKey) => key is TKey,\n\tindexableSchema?: readonly TreeNodeSchema[],\n): SimpleTreeIndex<TKey, TValue> {\n\tconst indexableSchemaMap = new Map();\n\tif (indexableSchema !== undefined) {\n\t\tfor (const schemus of indexableSchema) {\n\t\t\tindexableSchemaMap.set(schemus.identifier, schemus);\n\t\t}\n\t} else {\n\t\twalkFieldSchema(view.schema, {\n\t\t\tnode: (schemus) => indexableSchemaMap.set(schemus.identifier, schemus),\n\t\t});\n\t}\n\n\tconst schemaIndexer =\n\t\tindexableSchema === undefined\n\t\t\t? (schemaIdentifier: TreeNodeSchemaIdentifier) => {\n\t\t\t\t\t// if indexable schema isn't provided, we check if the node is in schema\n\t\t\t\t\tconst schemus = indexableSchemaMap.get(schemaIdentifier);\n\t\t\t\t\tif (schemus !== undefined) {\n\t\t\t\t\t\tconst keyLocation =\n\t\t\t\t\t\t\ttypeof indexer === \"function\" ? indexer(schemus) : indexer.get(schemus);\n\t\t\t\t\t\tif (keyLocation !== undefined) {\n\t\t\t\t\t\t\treturn makeGenericKeyFinder<TKey>(brand(keyLocation), isKeyValid);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tfail(\"node is out of schema\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t: (schemaIdentifier: TreeNodeSchemaIdentifier) => {\n\t\t\t\t\tconst schemus = indexableSchemaMap.get(schemaIdentifier);\n\t\t\t\t\tif (schemus !== undefined) {\n\t\t\t\t\t\tconst keyLocation =\n\t\t\t\t\t\t\ttypeof indexer === \"function\" ? indexer(schemus) : indexer.get(schemus);\n\t\t\t\t\t\tif (keyLocation !== undefined) {\n\t\t\t\t\t\t\treturn makeGenericKeyFinder<TKey>(brand(keyLocation), isKeyValid);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t};\n\n\tconst index = new AnchorTreeIndex<TKey, TValue>(\n\t\t(view as SchematizingSimpleTreeView<TFieldSchema>).getView().checkout.forest,\n\t\tschemaIndexer,\n\t\t(anchorNodes) => {\n\t\t\tconst simpleTreeNodes: TreeNode[] = [];\n\t\t\tfor (const anchorNode of anchorNodes) {\n\t\t\t\tconst simpleTree = treeNodeFromAnchor(anchorNode);\n\t\t\t\tif (!isTreeValue(simpleTree)) {\n\t\t\t\t\tsimpleTreeNodes.push(simpleTree);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (hasElement(simpleTreeNodes)) {\n\t\t\t\treturn getValue(simpleTreeNodes);\n\t\t\t}\n\t\t},\n\t\t(anchorNode: AnchorNode) => {\n\t\t\tconst simpleTree = treeNodeFromAnchor(anchorNode);\n\t\t\tif (!isTreeValue(simpleTree)) {\n\t\t\t\treturn treeNodeApi.status(simpleTree);\n\t\t\t}\n\t\t},\n\t\t// simple tree indexes are shallow indexes, indicating so allows for a performance optimization\n\t\ttrue,\n\t);\n\n\t// all the type checking guarantees that we put nodes of the correct type in the index\n\t// but it's not captured in the type system\n\treturn index as SimpleTreeIndex<TKey, TValue>;\n}\n\nfunction makeGenericKeyFinder<TKey extends TreeIndexKey>(\n\tkeyField: FieldKey,\n\tisKeyValid: (key: TreeIndexKey) => key is TKey,\n): KeyFinder<TKey> {\n\treturn (cursor: ITreeSubscriptionCursor) => {\n\t\tcursor.enterField(keyField);\n\t\tcursor.firstNode();\n\t\tconst value = cursor.value;\n\t\tcursor.exitNode();\n\t\tcursor.exitField();\n\n\t\tif (value === undefined) {\n\t\t\tfail(\"a value for the key does not exist\");\n\t\t}\n\n\t\tif (!isKeyValid(value)) {\n\t\t\tfail(\"the key is an unexpected type\");\n\t\t}\n\n\t\treturn value;\n\t};\n}\n"]}
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import type { ICodecOptions } from "../../codec/index.js";
6
- import { type TreeStoredSchema } from "../../core/index.js";
6
+ import type { TreeStoredSchema } from "../../core/index.js";
7
7
  import type { JsonCompatible } from "../../util/index.js";
8
8
  import type { ImplicitFieldSchema } from "../schemaTypes.js";
9
9
  import type { SchemaCompatibilityStatus } from "./tree.js";
@@ -45,7 +45,7 @@ export declare function extractPersistedSchema(schema: ImplicitFieldSchema): Jso
45
45
  * opening a document that used the `persisted` schema and provided `view` to {@link ViewableTree.viewWith}.
46
46
  *
47
47
  * @param persisted - Schema persisted for a document. Typically persisted alongside the data and assumed to describe that data.
48
- * @param view - Schema which would be used to view persisted content. Use {@link extractPersistedSchema} to convert the view schema into this format.
48
+ * @param view - Schema which would be used to view persisted content.
49
49
  * @param options - {@link ICodecOptions} used when parsing the provided schema.
50
50
  * @param canInitialize - Passed through to the return value unchanged and otherwise unused.
51
51
  * @returns The {@link SchemaCompatibilityStatus} a {@link TreeView} would report for this combination of schema.
@@ -61,7 +61,7 @@ export declare function extractPersistedSchema(schema: ImplicitFieldSchema): Jso
61
61
  * assert(
62
62
  * comparePersistedSchema(
63
63
  * require("./schema.json"),
64
- * extractPersistedSchema(MySchema),
64
+ * MySchema,
65
65
  * { jsonValidator: typeboxValidator },
66
66
  * false,
67
67
  * ).canUpgrade,
@@ -69,7 +69,7 @@ export declare function extractPersistedSchema(schema: ImplicitFieldSchema): Jso
69
69
  * ```
70
70
  * @alpha
71
71
  */
72
- export declare function comparePersistedSchema(persisted: JsonCompatible, view: JsonCompatible, options: ICodecOptions, canInitialize: boolean): SchemaCompatibilityStatus;
72
+ export declare function comparePersistedSchema(persisted: JsonCompatible, view: ImplicitFieldSchema, options: ICodecOptions, canInitialize: boolean): SchemaCompatibilityStatus;
73
73
  /**
74
74
  * Compute compatibility for viewing a document with `stored` schema using `viewSchema`.
75
75
  * `canInitialize` is passed through to the return value unchanged and otherwise unused.
@@ -1 +1 @@
1
- {"version":3,"file":"storedSchema.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/storedSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAiB,KAAK,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAQ3E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,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AgB,sBAAsB,CACrC,SAAS,EAAE,cAAc,EACzB,IAAI,EAAE,mBAAmB,EACzB,OAAO,EAAE,aAAa,EACtB,aAAa,EAAE,OAAO,GACpB,yBAAyB,CAK3B;AAED;;;GAGG;AACH,wBAAgB,8BAA8B,CAC7C,MAAM,EAAE,gBAAgB,EACxB,UAAU,EAAE,UAAU,EACtB,aAAa,EAAE,OAAO,GACpB,yBAAyB,CAK3B"}
@@ -2,7 +2,6 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { Compatibility } from "../../core/index.js";
6
5
  import { defaultSchemaPolicy, encodeTreeSchema, makeSchemaCodec, } from "../../feature-libraries/index.js";
7
6
  import { toStoredSchema } from "../toStoredSchema.js";
8
7
  import { ViewSchema } from "./view.js";
@@ -46,7 +45,7 @@ export function extractPersistedSchema(schema) {
46
45
  * opening a document that used the `persisted` schema and provided `view` to {@link ViewableTree.viewWith}.
47
46
  *
48
47
  * @param persisted - Schema persisted for a document. Typically persisted alongside the data and assumed to describe that data.
49
- * @param view - Schema which would be used to view persisted content. Use {@link extractPersistedSchema} to convert the view schema into this format.
48
+ * @param view - Schema which would be used to view persisted content.
50
49
  * @param options - {@link ICodecOptions} used when parsing the provided schema.
51
50
  * @param canInitialize - Passed through to the return value unchanged and otherwise unused.
52
51
  * @returns The {@link SchemaCompatibilityStatus} a {@link TreeView} would report for this combination of schema.
@@ -62,7 +61,7 @@ export function extractPersistedSchema(schema) {
62
61
  * assert(
63
62
  * comparePersistedSchema(
64
63
  * require("./schema.json"),
65
- * extractPersistedSchema(MySchema),
64
+ * MySchema,
66
65
  * { jsonValidator: typeboxValidator },
67
66
  * false,
68
67
  * ).canUpgrade,
@@ -73,8 +72,7 @@ export function extractPersistedSchema(schema) {
73
72
  export function comparePersistedSchema(persisted, view, options, canInitialize) {
74
73
  const schemaCodec = makeSchemaCodec(options);
75
74
  const stored = schemaCodec.decode(persisted);
76
- const viewParsed = schemaCodec.decode(view);
77
- const viewSchema = new ViewSchema(defaultSchemaPolicy, {}, viewParsed);
75
+ const viewSchema = new ViewSchema(defaultSchemaPolicy, {}, view);
78
76
  return comparePersistedSchemaInternal(stored, viewSchema, canInitialize);
79
77
  }
80
78
  /**
@@ -82,20 +80,9 @@ export function comparePersistedSchema(persisted, view, options, canInitialize)
82
80
  * `canInitialize` is passed through to the return value unchanged and otherwise unused.
83
81
  */
84
82
  export function comparePersistedSchemaInternal(stored, viewSchema, canInitialize) {
85
- const result = viewSchema.checkCompatibility(stored);
86
- // TODO: AB#8121: Weaken this check to support viewing under additional circumstances.
87
- // In the near term, this should support viewing documents with additional optional fields in their schema on object types.
88
- // Longer-term (as demand arises), we could also add APIs to constructing view schema to allow for more flexibility
89
- // (e.g. out-of-schema content handlers could allow support for viewing docs which have extra allowed types in a particular field)
90
- const canView = result.write === Compatibility.Compatible && result.read === Compatibility.Compatible;
91
- const canUpgrade = result.read === Compatibility.Compatible;
92
- const isEquivalent = canView && canUpgrade;
93
- const compatibility = {
94
- canView,
95
- canUpgrade,
96
- isEquivalent,
83
+ return {
84
+ ...viewSchema.checkCompatibility(stored),
97
85
  canInitialize,
98
86
  };
99
- return compatibility;
100
87
  }
101
88
  //# sourceMappingURL=storedSchema.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"storedSchema.js","sourceRoot":"","sources":["../../../src/simple-tree/api/storedSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,aAAa,EAAyB,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EACN,mBAAmB,EACnB,gBAAgB,EAChB,eAAe,GACf,MAAM,kCAAkC,CAAC;AAK1C,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,UAAU,sBAAsB,CAAC,MAA2B;IACjE,MAAM,MAAM,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;IACtC,OAAO,gBAAgB,CAAC,MAAM,CAAC,CAAC;AACjC,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,UAAU,sBAAsB,CACrC,SAAyB,EACzB,IAAoB,EACpB,OAAsB,EACtB,aAAsB;IAEtB,MAAM,WAAW,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;IAC7C,MAAM,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,SAAmB,CAAC,CAAC;IACvD,MAAM,UAAU,GAAG,WAAW,CAAC,MAAM,CAAC,IAAc,CAAC,CAAC;IACtD,MAAM,UAAU,GAAG,IAAI,UAAU,CAAC,mBAAmB,EAAE,EAAE,EAAE,UAAU,CAAC,CAAC;IACvE,OAAO,8BAA8B,CAAC,MAAM,EAAE,UAAU,EAAE,aAAa,CAAC,CAAC;AAC1E,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,8BAA8B,CAC7C,MAAwB,EACxB,UAAsB,EACtB,aAAsB;IAEtB,MAAM,MAAM,GAAG,UAAU,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAErD,sFAAsF;IACtF,2HAA2H;IAC3H,mHAAmH;IACnH,kIAAkI;IAClI,MAAM,OAAO,GACZ,MAAM,CAAC,KAAK,KAAK,aAAa,CAAC,UAAU,IAAI,MAAM,CAAC,IAAI,KAAK,aAAa,CAAC,UAAU,CAAC;IACvF,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,KAAK,aAAa,CAAC,UAAU,CAAC;IAC5D,MAAM,YAAY,GAAG,OAAO,IAAI,UAAU,CAAC;IAC3C,MAAM,aAAa,GAA8B;QAChD,OAAO;QACP,UAAU;QACV,YAAY;QACZ,aAAa;KACb,CAAC;IAEF,OAAO,aAAa,CAAC;AACtB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ICodecOptions } from \"../../codec/index.js\";\nimport { Compatibility, type TreeStoredSchema } from \"../../core/index.js\";\nimport {\n\tdefaultSchemaPolicy,\n\tencodeTreeSchema,\n\tmakeSchemaCodec,\n} from \"../../feature-libraries/index.js\";\n// eslint-disable-next-line import/no-internal-modules\nimport type { Format } from \"../../feature-libraries/schema-index/index.js\";\nimport type { JsonCompatible } from \"../../util/index.js\";\nimport type { ImplicitFieldSchema } from \"../schemaTypes.js\";\nimport { toStoredSchema } from \"../toStoredSchema.js\";\nimport type { SchemaCompatibilityStatus } from \"./tree.js\";\nimport { ViewSchema } from \"./view.js\";\n\n/**\n * Dumps the \"persisted\" schema subset of the provided `schema` into a deterministic JSON-compatible, semi-human-readable, but unspecified format.\n *\n * @remarks\n * This can be used to help inspect schema for debugging, and to save a snapshot of schema to help detect and review changes to an applications schema.\n *\n * This format may change across major versions of this package: such changes are considered breaking.\n * Beyond that, no compatibility guarantee is provided for this format: it should never be relied upon to load data, it should only be used for comparing outputs from this function.\n *\n * This only includes the \"persisted\" subset of schema information, which means the portion which gets included in documents.\n * It thus uses \"persisted\" keys, see {@link FieldProps.key}.\n *\n * If two schema have identical \"persisted\" schema, then they are considered {@link SchemaCompatibilityStatus.isEquivalent|equivalent}.\n *\n * See also {@link comparePersistedSchema}.\n *\n * @example\n * An application could use this API to generate a `schema.json` file when it first releases,\n * then test that the schema is sill compatible with documents from that version with a test like :\n * ```typescript\n * assert.deepEqual(extractPersistedSchema(MySchema), require(\"./schema.json\"));\n * ```\n *\n * @privateRemarks\n * This currently uses the schema summary format, but that could be changed to something more human readable (particularly if the encoded format becomes less human readable).\n * This intentionally does not leak the format types in the API.\n *\n * Public API surface uses \"persisted\" terminology while internally we use \"stored\".\n * @alpha\n */\nexport function extractPersistedSchema(schema: ImplicitFieldSchema): JsonCompatible {\n\tconst stored = toStoredSchema(schema);\n\treturn encodeTreeSchema(stored);\n}\n\n/**\n * Compares two schema extracted using {@link extractPersistedSchema}.\n * Reports the same compatibility that {@link TreeView.compatibility} would report if\n * opening a document that used the `persisted` schema and provided `view` to {@link ViewableTree.viewWith}.\n *\n * @param persisted - Schema persisted for a document. Typically persisted alongside the data and assumed to describe that data.\n * @param view - Schema which would be used to view persisted content. Use {@link extractPersistedSchema} to convert the view schema into this format.\n * @param options - {@link ICodecOptions} used when parsing the provided schema.\n * @param canInitialize - Passed through to the return value unchanged and otherwise unused.\n * @returns The {@link SchemaCompatibilityStatus} a {@link TreeView} would report for this combination of schema.\n *\n * @remarks\n * This uses the persisted formats for schema, meaning it only includes data which impacts compatibility.\n * It also uses the persisted format so that this API can be used in tests to compare against saved schema from previous versions of the application.\n *\n * @example\n * An application could use {@link extractPersistedSchema} to generate a `schema.json` file for various versions of the app,\n * then test that documents using those schema can be upgraded to work with the current schema using a test like:\n * ```typescript\n * assert(\n * \tcomparePersistedSchema(\n * \t\trequire(\"./schema.json\"),\n * \t\textractPersistedSchema(MySchema),\n * \t\t{ jsonValidator: typeboxValidator },\n * \t\tfalse,\n * \t).canUpgrade,\n * );\n * ```\n * @alpha\n */\nexport function comparePersistedSchema(\n\tpersisted: JsonCompatible,\n\tview: JsonCompatible,\n\toptions: ICodecOptions,\n\tcanInitialize: boolean,\n): SchemaCompatibilityStatus {\n\tconst schemaCodec = makeSchemaCodec(options);\n\tconst stored = schemaCodec.decode(persisted as Format);\n\tconst viewParsed = schemaCodec.decode(view as Format);\n\tconst viewSchema = new ViewSchema(defaultSchemaPolicy, {}, viewParsed);\n\treturn comparePersistedSchemaInternal(stored, viewSchema, canInitialize);\n}\n\n/**\n * Compute compatibility for viewing a document with `stored` schema using `viewSchema`.\n * `canInitialize` is passed through to the return value unchanged and otherwise unused.\n */\nexport function comparePersistedSchemaInternal(\n\tstored: TreeStoredSchema,\n\tviewSchema: ViewSchema,\n\tcanInitialize: boolean,\n): SchemaCompatibilityStatus {\n\tconst result = viewSchema.checkCompatibility(stored);\n\n\t// TODO: AB#8121: Weaken this check to support viewing under additional circumstances.\n\t// In the near term, this should support viewing documents with additional optional fields in their schema on object types.\n\t// Longer-term (as demand arises), we could also add APIs to constructing view schema to allow for more flexibility\n\t// (e.g. out-of-schema content handlers could allow support for viewing docs which have extra allowed types in a particular field)\n\tconst canView =\n\t\tresult.write === Compatibility.Compatible && result.read === Compatibility.Compatible;\n\tconst canUpgrade = result.read === Compatibility.Compatible;\n\tconst isEquivalent = canView && canUpgrade;\n\tconst compatibility: SchemaCompatibilityStatus = {\n\t\tcanView,\n\t\tcanUpgrade,\n\t\tisEquivalent,\n\t\tcanInitialize,\n\t};\n\n\treturn compatibility;\n}\n"]}
1
+ {"version":3,"file":"storedSchema.js","sourceRoot":"","sources":["../../../src/simple-tree/api/storedSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EACN,mBAAmB,EACnB,gBAAgB,EAChB,eAAe,GACf,MAAM,kCAAkC,CAAC;AAK1C,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,UAAU,sBAAsB,CAAC,MAA2B;IACjE,MAAM,MAAM,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;IACtC,OAAO,gBAAgB,CAAC,MAAM,CAAC,CAAC;AACjC,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,UAAU,sBAAsB,CACrC,SAAyB,EACzB,IAAyB,EACzB,OAAsB,EACtB,aAAsB;IAEtB,MAAM,WAAW,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;IAC7C,MAAM,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,SAAmB,CAAC,CAAC;IACvD,MAAM,UAAU,GAAG,IAAI,UAAU,CAAC,mBAAmB,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;IACjE,OAAO,8BAA8B,CAAC,MAAM,EAAE,UAAU,EAAE,aAAa,CAAC,CAAC;AAC1E,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,8BAA8B,CAC7C,MAAwB,EACxB,UAAsB,EACtB,aAAsB;IAEtB,OAAO;QACN,GAAG,UAAU,CAAC,kBAAkB,CAAC,MAAM,CAAC;QACxC,aAAa;KACb,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ICodecOptions } from \"../../codec/index.js\";\nimport type { TreeStoredSchema } from \"../../core/index.js\";\nimport {\n\tdefaultSchemaPolicy,\n\tencodeTreeSchema,\n\tmakeSchemaCodec,\n} from \"../../feature-libraries/index.js\";\n// eslint-disable-next-line import/no-internal-modules\nimport type { Format } from \"../../feature-libraries/schema-index/index.js\";\nimport type { JsonCompatible } from \"../../util/index.js\";\nimport type { ImplicitFieldSchema } from \"../schemaTypes.js\";\nimport { toStoredSchema } from \"../toStoredSchema.js\";\nimport type { SchemaCompatibilityStatus } from \"./tree.js\";\nimport { ViewSchema } from \"./view.js\";\n\n/**\n * Dumps the \"persisted\" schema subset of the provided `schema` into a deterministic JSON-compatible, semi-human-readable, but unspecified format.\n *\n * @remarks\n * This can be used to help inspect schema for debugging, and to save a snapshot of schema to help detect and review changes to an applications schema.\n *\n * This format may change across major versions of this package: such changes are considered breaking.\n * Beyond that, no compatibility guarantee is provided for this format: it should never be relied upon to load data, it should only be used for comparing outputs from this function.\n *\n * This only includes the \"persisted\" subset of schema information, which means the portion which gets included in documents.\n * It thus uses \"persisted\" keys, see {@link FieldProps.key}.\n *\n * If two schema have identical \"persisted\" schema, then they are considered {@link SchemaCompatibilityStatus.isEquivalent|equivalent}.\n *\n * See also {@link comparePersistedSchema}.\n *\n * @example\n * An application could use this API to generate a `schema.json` file when it first releases,\n * then test that the schema is sill compatible with documents from that version with a test like :\n * ```typescript\n * assert.deepEqual(extractPersistedSchema(MySchema), require(\"./schema.json\"));\n * ```\n *\n * @privateRemarks\n * This currently uses the schema summary format, but that could be changed to something more human readable (particularly if the encoded format becomes less human readable).\n * This intentionally does not leak the format types in the API.\n *\n * Public API surface uses \"persisted\" terminology while internally we use \"stored\".\n * @alpha\n */\nexport function extractPersistedSchema(schema: ImplicitFieldSchema): JsonCompatible {\n\tconst stored = toStoredSchema(schema);\n\treturn encodeTreeSchema(stored);\n}\n\n/**\n * Compares two schema extracted using {@link extractPersistedSchema}.\n * Reports the same compatibility that {@link TreeView.compatibility} would report if\n * opening a document that used the `persisted` schema and provided `view` to {@link ViewableTree.viewWith}.\n *\n * @param persisted - Schema persisted for a document. Typically persisted alongside the data and assumed to describe that data.\n * @param view - Schema which would be used to view persisted content.\n * @param options - {@link ICodecOptions} used when parsing the provided schema.\n * @param canInitialize - Passed through to the return value unchanged and otherwise unused.\n * @returns The {@link SchemaCompatibilityStatus} a {@link TreeView} would report for this combination of schema.\n *\n * @remarks\n * This uses the persisted formats for schema, meaning it only includes data which impacts compatibility.\n * It also uses the persisted format so that this API can be used in tests to compare against saved schema from previous versions of the application.\n *\n * @example\n * An application could use {@link extractPersistedSchema} to generate a `schema.json` file for various versions of the app,\n * then test that documents using those schema can be upgraded to work with the current schema using a test like:\n * ```typescript\n * assert(\n * \tcomparePersistedSchema(\n * \t\trequire(\"./schema.json\"),\n * \t\tMySchema,\n * \t\t{ jsonValidator: typeboxValidator },\n * \t\tfalse,\n * \t).canUpgrade,\n * );\n * ```\n * @alpha\n */\nexport function comparePersistedSchema(\n\tpersisted: JsonCompatible,\n\tview: ImplicitFieldSchema,\n\toptions: ICodecOptions,\n\tcanInitialize: boolean,\n): SchemaCompatibilityStatus {\n\tconst schemaCodec = makeSchemaCodec(options);\n\tconst stored = schemaCodec.decode(persisted as Format);\n\tconst viewSchema = new ViewSchema(defaultSchemaPolicy, {}, view);\n\treturn comparePersistedSchemaInternal(stored, viewSchema, canInitialize);\n}\n\n/**\n * Compute compatibility for viewing a document with `stored` schema using `viewSchema`.\n * `canInitialize` is passed through to the return value unchanged and otherwise unused.\n */\nexport function comparePersistedSchemaInternal(\n\tstored: TreeStoredSchema,\n\tviewSchema: ViewSchema,\n\tcanInitialize: boolean,\n): SchemaCompatibilityStatus {\n\treturn {\n\t\t...viewSchema.checkCompatibility(stored),\n\t\tcanInitialize,\n\t};\n}\n"]}
@@ -17,6 +17,7 @@ import type { MakeNominal } from "../../util/index.js";
17
17
  * Maybe rename "exportJsonSchema" to align on "concise" terminology.
18
18
  * Ensure schema exporting APIs here align and reference APIs for exporting view schema to the same formats (which should include stored vs property key choice).
19
19
  * Make sure users of independentView can use these export APIs (maybe provide a reference back to the ViewableTree from the TreeView to accomplish that).
20
+ * Some of these APIs are on ISharedTree and can get moved here.
20
21
  * @system @sealed @public
21
22
  */
22
23
  export interface ViewableTree {
@@ -1 +1 @@
1
- {"version":3,"file":"tree.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/tree.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAG/F,OAAO,KAAK,EACX,cAAc,EACd,sBAAsB,EACtB,iBAAiB,EACjB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACN,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,oCAAoC,EACzC,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,0BAA0B,EAC/B,KAAK,mBAAmB,EAExB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAOjE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,YAAY;IAC5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+BG;IACH,QAAQ,CAAC,KAAK,SAAS,mBAAmB,EACzC,MAAM,EAAE,qBAAqB,CAAC,KAAK,CAAC,GAClC,QAAQ,CAAC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