@fluidframework/tree 2.50.0 → 2.51.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (636) hide show
  1. package/.eslintrc.cjs +3 -2
  2. package/.vscode/Tree.code-workspace +14 -1
  3. package/.vscode/settings.json +16 -0
  4. package/CHANGELOG.md +51 -2
  5. package/api-report/tree.alpha.api.md +7 -7
  6. package/dist/core/schema-stored/schema.d.ts +14 -1
  7. package/dist/core/schema-stored/schema.d.ts.map +1 -1
  8. package/dist/core/schema-stored/schema.js.map +1 -1
  9. package/dist/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
  10. package/dist/feature-libraries/default-schema/schemaChecker.js +3 -0
  11. package/dist/feature-libraries/default-schema/schemaChecker.js.map +1 -1
  12. package/dist/feature-libraries/flex-tree/context.d.ts +7 -2
  13. package/dist/feature-libraries/flex-tree/context.d.ts.map +1 -1
  14. package/dist/feature-libraries/flex-tree/context.js +4 -4
  15. package/dist/feature-libraries/flex-tree/context.js.map +1 -1
  16. package/dist/feature-libraries/flex-tree/index.d.ts +1 -0
  17. package/dist/feature-libraries/flex-tree/index.d.ts.map +1 -1
  18. package/dist/feature-libraries/flex-tree/index.js +3 -1
  19. package/dist/feature-libraries/flex-tree/index.js.map +1 -1
  20. package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  21. package/dist/feature-libraries/flex-tree/lazyField.js +5 -5
  22. package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
  23. package/dist/feature-libraries/flex-tree/lazyNode.d.ts +3 -1
  24. package/dist/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  25. package/dist/feature-libraries/flex-tree/lazyNode.js +5 -3
  26. package/dist/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  27. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  28. package/dist/feature-libraries/forest-summary/forestSummarizer.js +3 -4
  29. package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  30. package/dist/feature-libraries/index.d.ts +2 -2
  31. package/dist/feature-libraries/index.d.ts.map +1 -1
  32. package/dist/feature-libraries/index.js +3 -8
  33. package/dist/feature-libraries/index.js.map +1 -1
  34. package/dist/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
  35. package/dist/feature-libraries/modular-schema/comparison.js +0 -3
  36. package/dist/feature-libraries/modular-schema/comparison.js.map +1 -1
  37. package/dist/feature-libraries/modular-schema/index.d.ts +0 -1
  38. package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
  39. package/dist/feature-libraries/modular-schema/index.js +1 -8
  40. package/dist/feature-libraries/modular-schema/index.js.map +1 -1
  41. package/dist/packageVersion.d.ts +1 -1
  42. package/dist/packageVersion.js +1 -1
  43. package/dist/packageVersion.js.map +1 -1
  44. package/dist/shared-tree/index.d.ts +0 -1
  45. package/dist/shared-tree/index.d.ts.map +1 -1
  46. package/dist/shared-tree/index.js +1 -3
  47. package/dist/shared-tree/index.js.map +1 -1
  48. package/dist/shared-tree/schematizeTree.d.ts +1 -1
  49. package/dist/shared-tree/schematizeTree.d.ts.map +1 -1
  50. package/dist/shared-tree/schematizeTree.js +7 -10
  51. package/dist/shared-tree/schematizeTree.js.map +1 -1
  52. package/dist/shared-tree/schematizingTreeView.d.ts +11 -13
  53. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  54. package/dist/shared-tree/schematizingTreeView.js +60 -83
  55. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  56. package/dist/shared-tree/sharedTreeChangeTypes.d.ts +1 -1
  57. package/dist/shared-tree/sharedTreeChangeTypes.js.map +1 -1
  58. package/dist/shared-tree/tree.d.ts.map +1 -1
  59. package/dist/shared-tree/tree.js +4 -3
  60. package/dist/shared-tree/tree.js.map +1 -1
  61. package/dist/shared-tree/treeAlpha.d.ts +7 -1
  62. package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
  63. package/dist/shared-tree/treeAlpha.js.map +1 -1
  64. package/dist/shared-tree/treeCheckout.d.ts +7 -2
  65. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  66. package/dist/shared-tree/treeCheckout.js +4 -1
  67. package/dist/shared-tree/treeCheckout.js.map +1 -1
  68. package/dist/simple-tree/api/conciseTree.d.ts +1 -1
  69. package/dist/simple-tree/api/conciseTree.d.ts.map +1 -1
  70. package/dist/simple-tree/api/conciseTree.js.map +1 -1
  71. package/dist/simple-tree/api/configuration.d.ts +1 -1
  72. package/dist/simple-tree/api/configuration.d.ts.map +1 -1
  73. package/dist/simple-tree/api/configuration.js +5 -5
  74. package/dist/simple-tree/api/configuration.js.map +1 -1
  75. package/dist/simple-tree/api/create.d.ts +3 -1
  76. package/dist/simple-tree/api/create.d.ts.map +1 -1
  77. package/dist/simple-tree/api/create.js +2 -0
  78. package/dist/simple-tree/api/create.js.map +1 -1
  79. package/dist/simple-tree/api/customTree.d.ts +1 -2
  80. package/dist/simple-tree/api/customTree.d.ts.map +1 -1
  81. package/dist/simple-tree/api/customTree.js.map +1 -1
  82. package/dist/simple-tree/api/getJsonSchema.d.ts +1 -1
  83. package/dist/simple-tree/api/getJsonSchema.d.ts.map +1 -1
  84. package/dist/simple-tree/api/getJsonSchema.js.map +1 -1
  85. package/dist/simple-tree/api/getSimpleSchema.d.ts +1 -1
  86. package/dist/simple-tree/api/getSimpleSchema.js.map +1 -1
  87. package/dist/simple-tree/api/identifierIndex.d.ts +1 -1
  88. package/dist/simple-tree/api/identifierIndex.js +2 -2
  89. package/dist/simple-tree/api/identifierIndex.js.map +1 -1
  90. package/dist/simple-tree/api/index.d.ts +1 -1
  91. package/dist/simple-tree/api/index.d.ts.map +1 -1
  92. package/dist/simple-tree/api/index.js.map +1 -1
  93. package/dist/simple-tree/api/schemaCompatibilityTester.d.ts +4 -19
  94. package/dist/simple-tree/api/schemaCompatibilityTester.d.ts.map +1 -1
  95. package/dist/simple-tree/api/schemaCompatibilityTester.js +31 -82
  96. package/dist/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
  97. package/dist/simple-tree/api/schemaCreationUtilities.d.ts +14 -2
  98. package/dist/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -1
  99. package/dist/simple-tree/api/schemaCreationUtilities.js +41 -4
  100. package/dist/simple-tree/api/schemaCreationUtilities.js.map +1 -1
  101. package/dist/simple-tree/api/schemaFactory.d.ts +36 -3
  102. package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
  103. package/dist/simple-tree/api/schemaFactory.js +18 -18
  104. package/dist/simple-tree/api/schemaFactory.js.map +1 -1
  105. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +16 -16
  106. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  107. package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  108. package/dist/simple-tree/api/schemaFactoryRecursive.d.ts +2 -2
  109. package/dist/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
  110. package/dist/simple-tree/api/schemaFactoryRecursive.js +2 -2
  111. package/dist/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
  112. package/dist/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
  113. package/dist/simple-tree/api/schemaFromSimple.js +4 -4
  114. package/dist/simple-tree/api/schemaFromSimple.js.map +1 -1
  115. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js +2 -2
  116. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  117. package/dist/simple-tree/api/simpleTreeIndex.d.ts +2 -2
  118. package/dist/simple-tree/api/simpleTreeIndex.d.ts.map +1 -1
  119. package/dist/simple-tree/api/simpleTreeIndex.js +1 -1
  120. package/dist/simple-tree/api/simpleTreeIndex.js.map +1 -1
  121. package/dist/simple-tree/api/storedSchema.d.ts +1 -1
  122. package/dist/simple-tree/api/storedSchema.d.ts.map +1 -1
  123. package/dist/simple-tree/api/storedSchema.js +2 -2
  124. package/dist/simple-tree/api/storedSchema.js.map +1 -1
  125. package/dist/simple-tree/api/tree.d.ts +2 -1
  126. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  127. package/dist/simple-tree/api/tree.js.map +1 -1
  128. package/dist/simple-tree/api/treeBeta.d.ts +4 -1
  129. package/dist/simple-tree/api/treeBeta.d.ts.map +1 -1
  130. package/dist/simple-tree/api/treeBeta.js.map +1 -1
  131. package/dist/simple-tree/api/treeNodeApi.d.ts +1 -2
  132. package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  133. package/dist/simple-tree/api/treeNodeApi.js +3 -3
  134. package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
  135. package/dist/simple-tree/api/typesUnsafe.d.ts +2 -3
  136. package/dist/simple-tree/api/typesUnsafe.d.ts.map +1 -1
  137. package/dist/simple-tree/api/typesUnsafe.js.map +1 -1
  138. package/dist/simple-tree/api/verboseTree.d.ts +2 -1
  139. package/dist/simple-tree/api/verboseTree.d.ts.map +1 -1
  140. package/dist/simple-tree/api/verboseTree.js.map +1 -1
  141. package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts +1 -1
  142. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js +2 -2
  143. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
  144. package/dist/simple-tree/core/allowedTypes.d.ts +316 -0
  145. package/dist/simple-tree/core/allowedTypes.d.ts.map +1 -0
  146. package/dist/simple-tree/core/allowedTypes.js +173 -0
  147. package/dist/simple-tree/core/allowedTypes.js.map +1 -0
  148. package/dist/simple-tree/core/context.d.ts +3 -9
  149. package/dist/simple-tree/core/context.d.ts.map +1 -1
  150. package/dist/simple-tree/core/context.js +3 -11
  151. package/dist/simple-tree/core/context.js.map +1 -1
  152. package/dist/simple-tree/core/flexList.d.ts.map +1 -0
  153. package/dist/simple-tree/core/flexList.js.map +1 -0
  154. package/dist/simple-tree/core/getOrCreateNode.d.ts +1 -1
  155. package/dist/simple-tree/core/getOrCreateNode.d.ts.map +1 -1
  156. package/dist/simple-tree/core/getOrCreateNode.js.map +1 -1
  157. package/dist/simple-tree/core/index.d.ts +9 -3
  158. package/dist/simple-tree/core/index.d.ts.map +1 -1
  159. package/dist/simple-tree/core/index.js +19 -3
  160. package/dist/simple-tree/core/index.js.map +1 -1
  161. package/dist/simple-tree/core/treeNodeKernel.d.ts +8 -1
  162. package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  163. package/dist/simple-tree/core/treeNodeKernel.js +24 -20
  164. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
  165. package/dist/simple-tree/core/treeNodeSchema.d.ts +182 -39
  166. package/dist/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  167. package/dist/simple-tree/core/treeNodeSchema.js +47 -17
  168. package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
  169. package/{lib/simple-tree → dist/simple-tree/core}/treeNodeValid.d.ts +18 -4
  170. package/dist/simple-tree/core/treeNodeValid.d.ts.map +1 -0
  171. package/dist/simple-tree/{treeNodeValid.js → core/treeNodeValid.js} +41 -11
  172. package/dist/simple-tree/core/treeNodeValid.js.map +1 -0
  173. package/dist/simple-tree/core/unhydratedFlexTree.d.ts +1 -1
  174. package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  175. package/dist/simple-tree/core/walkSchema.d.ts +2 -1
  176. package/dist/simple-tree/core/walkSchema.d.ts.map +1 -1
  177. package/dist/simple-tree/core/walkSchema.js +6 -2
  178. package/dist/simple-tree/core/walkSchema.js.map +1 -1
  179. package/dist/simple-tree/createContext.d.ts +6 -2
  180. package/dist/simple-tree/createContext.d.ts.map +1 -1
  181. package/dist/simple-tree/createContext.js +15 -3
  182. package/dist/simple-tree/createContext.js.map +1 -1
  183. package/dist/{feature-libraries/modular-schema → simple-tree}/discrepancies.d.ts +22 -29
  184. package/dist/simple-tree/discrepancies.d.ts.map +1 -0
  185. package/dist/simple-tree/discrepancies.js +382 -0
  186. package/dist/simple-tree/discrepancies.js.map +1 -0
  187. package/dist/simple-tree/fieldSchema.d.ts +423 -0
  188. package/dist/simple-tree/fieldSchema.d.ts.map +1 -0
  189. package/dist/simple-tree/{schemaTypes.js → fieldSchema.js} +5 -195
  190. package/dist/simple-tree/fieldSchema.js.map +1 -0
  191. package/dist/simple-tree/index.d.ts +7 -6
  192. package/dist/simple-tree/index.d.ts.map +1 -1
  193. package/dist/simple-tree/index.js +17 -11
  194. package/dist/simple-tree/index.js.map +1 -1
  195. package/dist/simple-tree/leafNodeSchema.d.ts +14 -5
  196. package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
  197. package/dist/simple-tree/leafNodeSchema.js +117 -2
  198. package/dist/simple-tree/leafNodeSchema.js.map +1 -1
  199. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts +3 -4
  200. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  201. package/dist/simple-tree/node-kinds/array/arrayNode.js +97 -26
  202. package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  203. package/dist/simple-tree/node-kinds/array/arrayNodeTypes.d.ts +2 -2
  204. package/dist/simple-tree/node-kinds/array/arrayNodeTypes.d.ts.map +1 -1
  205. package/dist/simple-tree/node-kinds/array/arrayNodeTypes.js.map +1 -1
  206. package/dist/simple-tree/node-kinds/common.d.ts +16 -0
  207. package/dist/simple-tree/node-kinds/common.d.ts.map +1 -0
  208. package/dist/simple-tree/node-kinds/common.js +42 -0
  209. package/dist/simple-tree/node-kinds/common.js.map +1 -0
  210. package/dist/simple-tree/node-kinds/index.d.ts +1 -1
  211. package/dist/simple-tree/node-kinds/index.d.ts.map +1 -1
  212. package/dist/simple-tree/node-kinds/index.js.map +1 -1
  213. package/dist/simple-tree/node-kinds/map/mapNode.d.ts +2 -3
  214. package/dist/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
  215. package/dist/simple-tree/node-kinds/map/mapNode.js +64 -26
  216. package/dist/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  217. package/dist/simple-tree/node-kinds/map/mapNodeTypes.d.ts +2 -2
  218. package/dist/simple-tree/node-kinds/map/mapNodeTypes.d.ts.map +1 -1
  219. package/dist/simple-tree/node-kinds/map/mapNodeTypes.js.map +1 -1
  220. package/dist/simple-tree/node-kinds/object/index.d.ts +2 -2
  221. package/dist/simple-tree/node-kinds/object/index.d.ts.map +1 -1
  222. package/dist/simple-tree/node-kinds/object/index.js.map +1 -1
  223. package/dist/simple-tree/node-kinds/object/objectNode.d.ts +19 -5
  224. package/dist/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  225. package/dist/simple-tree/node-kinds/object/objectNode.js +131 -27
  226. package/dist/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  227. package/dist/simple-tree/node-kinds/object/objectNodeTypes.d.ts +11 -4
  228. package/dist/simple-tree/node-kinds/object/objectNodeTypes.d.ts.map +1 -1
  229. package/dist/simple-tree/node-kinds/object/objectNodeTypes.js.map +1 -1
  230. package/dist/simple-tree/node-kinds/record/recordNode.d.ts +2 -2
  231. package/dist/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
  232. package/dist/simple-tree/node-kinds/record/recordNode.js +41 -13
  233. package/dist/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  234. package/dist/simple-tree/node-kinds/record/recordNodeTypes.d.ts +2 -2
  235. package/dist/simple-tree/node-kinds/record/recordNodeTypes.d.ts.map +1 -1
  236. package/dist/simple-tree/node-kinds/record/recordNodeTypes.js.map +1 -1
  237. package/dist/simple-tree/prepareForInsertion.d.ts +2 -2
  238. package/dist/simple-tree/prepareForInsertion.d.ts.map +1 -1
  239. package/dist/simple-tree/prepareForInsertion.js +3 -3
  240. package/dist/simple-tree/prepareForInsertion.js.map +1 -1
  241. package/dist/simple-tree/simpleSchema.d.ts +2 -2
  242. package/dist/simple-tree/simpleSchema.d.ts.map +1 -1
  243. package/dist/simple-tree/simpleSchema.js.map +1 -1
  244. package/dist/simple-tree/toStoredSchema.d.ts +1 -1
  245. package/dist/simple-tree/toStoredSchema.d.ts.map +1 -1
  246. package/dist/simple-tree/toStoredSchema.js +6 -7
  247. package/dist/simple-tree/toStoredSchema.js.map +1 -1
  248. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.d.ts +5 -11
  249. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
  250. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js +25 -395
  251. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
  252. package/dist/simple-tree/unsafeUnknownSchema.d.ts +52 -0
  253. package/dist/simple-tree/unsafeUnknownSchema.d.ts.map +1 -0
  254. package/dist/simple-tree/unsafeUnknownSchema.js +13 -0
  255. package/dist/simple-tree/unsafeUnknownSchema.js.map +1 -0
  256. package/dist/simple-tree/walkFieldSchema.d.ts +1 -1
  257. package/dist/simple-tree/walkFieldSchema.js +2 -2
  258. package/dist/simple-tree/walkFieldSchema.js.map +1 -1
  259. package/dist/tableSchema.d.ts +12 -12
  260. package/dist/treeFactory.d.ts +0 -1
  261. package/dist/treeFactory.d.ts.map +1 -1
  262. package/dist/treeFactory.js +0 -1
  263. package/dist/treeFactory.js.map +1 -1
  264. package/lib/core/schema-stored/schema.d.ts +14 -1
  265. package/lib/core/schema-stored/schema.d.ts.map +1 -1
  266. package/lib/core/schema-stored/schema.js.map +1 -1
  267. package/lib/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
  268. package/lib/feature-libraries/default-schema/schemaChecker.js +3 -0
  269. package/lib/feature-libraries/default-schema/schemaChecker.js.map +1 -1
  270. package/lib/feature-libraries/flex-tree/context.d.ts +7 -2
  271. package/lib/feature-libraries/flex-tree/context.d.ts.map +1 -1
  272. package/lib/feature-libraries/flex-tree/context.js +4 -4
  273. package/lib/feature-libraries/flex-tree/context.js.map +1 -1
  274. package/lib/feature-libraries/flex-tree/index.d.ts +1 -0
  275. package/lib/feature-libraries/flex-tree/index.d.ts.map +1 -1
  276. package/lib/feature-libraries/flex-tree/index.js +1 -0
  277. package/lib/feature-libraries/flex-tree/index.js.map +1 -1
  278. package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  279. package/lib/feature-libraries/flex-tree/lazyField.js +6 -6
  280. package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
  281. package/lib/feature-libraries/flex-tree/lazyNode.d.ts +3 -1
  282. package/lib/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  283. package/lib/feature-libraries/flex-tree/lazyNode.js +3 -1
  284. package/lib/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  285. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  286. package/lib/feature-libraries/forest-summary/forestSummarizer.js +1 -2
  287. package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  288. package/lib/feature-libraries/index.d.ts +2 -2
  289. package/lib/feature-libraries/index.d.ts.map +1 -1
  290. package/lib/feature-libraries/index.js +2 -2
  291. package/lib/feature-libraries/index.js.map +1 -1
  292. package/lib/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
  293. package/lib/feature-libraries/modular-schema/comparison.js +0 -3
  294. package/lib/feature-libraries/modular-schema/comparison.js.map +1 -1
  295. package/lib/feature-libraries/modular-schema/index.d.ts +0 -1
  296. package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
  297. package/lib/feature-libraries/modular-schema/index.js +0 -1
  298. package/lib/feature-libraries/modular-schema/index.js.map +1 -1
  299. package/lib/packageVersion.d.ts +1 -1
  300. package/lib/packageVersion.js +1 -1
  301. package/lib/packageVersion.js.map +1 -1
  302. package/lib/shared-tree/index.d.ts +0 -1
  303. package/lib/shared-tree/index.d.ts.map +1 -1
  304. package/lib/shared-tree/index.js +0 -1
  305. package/lib/shared-tree/index.js.map +1 -1
  306. package/lib/shared-tree/schematizeTree.d.ts +1 -1
  307. package/lib/shared-tree/schematizeTree.d.ts.map +1 -1
  308. package/lib/shared-tree/schematizeTree.js +5 -8
  309. package/lib/shared-tree/schematizeTree.js.map +1 -1
  310. package/lib/shared-tree/schematizingTreeView.d.ts +11 -13
  311. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  312. package/lib/shared-tree/schematizingTreeView.js +61 -83
  313. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  314. package/lib/shared-tree/sharedTreeChangeTypes.d.ts +1 -1
  315. package/lib/shared-tree/sharedTreeChangeTypes.js.map +1 -1
  316. package/lib/shared-tree/tree.d.ts.map +1 -1
  317. package/lib/shared-tree/tree.js +4 -3
  318. package/lib/shared-tree/tree.js.map +1 -1
  319. package/lib/shared-tree/treeAlpha.d.ts +7 -1
  320. package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
  321. package/lib/shared-tree/treeAlpha.js.map +1 -1
  322. package/lib/shared-tree/treeCheckout.d.ts +7 -2
  323. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  324. package/lib/shared-tree/treeCheckout.js +5 -2
  325. package/lib/shared-tree/treeCheckout.js.map +1 -1
  326. package/lib/simple-tree/api/conciseTree.d.ts +1 -1
  327. package/lib/simple-tree/api/conciseTree.d.ts.map +1 -1
  328. package/lib/simple-tree/api/conciseTree.js.map +1 -1
  329. package/lib/simple-tree/api/configuration.d.ts +1 -1
  330. package/lib/simple-tree/api/configuration.d.ts.map +1 -1
  331. package/lib/simple-tree/api/configuration.js +2 -2
  332. package/lib/simple-tree/api/configuration.js.map +1 -1
  333. package/lib/simple-tree/api/create.d.ts +3 -1
  334. package/lib/simple-tree/api/create.d.ts.map +1 -1
  335. package/lib/simple-tree/api/create.js +2 -0
  336. package/lib/simple-tree/api/create.js.map +1 -1
  337. package/lib/simple-tree/api/customTree.d.ts +1 -2
  338. package/lib/simple-tree/api/customTree.d.ts.map +1 -1
  339. package/lib/simple-tree/api/customTree.js.map +1 -1
  340. package/lib/simple-tree/api/getJsonSchema.d.ts +1 -1
  341. package/lib/simple-tree/api/getJsonSchema.d.ts.map +1 -1
  342. package/lib/simple-tree/api/getJsonSchema.js.map +1 -1
  343. package/lib/simple-tree/api/getSimpleSchema.d.ts +1 -1
  344. package/lib/simple-tree/api/getSimpleSchema.js.map +1 -1
  345. package/lib/simple-tree/api/identifierIndex.d.ts +1 -1
  346. package/lib/simple-tree/api/identifierIndex.js +1 -1
  347. package/lib/simple-tree/api/identifierIndex.js.map +1 -1
  348. package/lib/simple-tree/api/index.d.ts +1 -1
  349. package/lib/simple-tree/api/index.d.ts.map +1 -1
  350. package/lib/simple-tree/api/index.js.map +1 -1
  351. package/lib/simple-tree/api/schemaCompatibilityTester.d.ts +4 -19
  352. package/lib/simple-tree/api/schemaCompatibilityTester.d.ts.map +1 -1
  353. package/lib/simple-tree/api/schemaCompatibilityTester.js +25 -76
  354. package/lib/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
  355. package/lib/simple-tree/api/schemaCreationUtilities.d.ts +14 -2
  356. package/lib/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -1
  357. package/lib/simple-tree/api/schemaCreationUtilities.js +40 -4
  358. package/lib/simple-tree/api/schemaCreationUtilities.js.map +1 -1
  359. package/lib/simple-tree/api/schemaFactory.d.ts +36 -3
  360. package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
  361. package/lib/simple-tree/api/schemaFactory.js +2 -2
  362. package/lib/simple-tree/api/schemaFactory.js.map +1 -1
  363. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +16 -16
  364. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  365. package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  366. package/lib/simple-tree/api/schemaFactoryRecursive.d.ts +2 -2
  367. package/lib/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
  368. package/lib/simple-tree/api/schemaFactoryRecursive.js +1 -1
  369. package/lib/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
  370. package/lib/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
  371. package/lib/simple-tree/api/schemaFromSimple.js +1 -1
  372. package/lib/simple-tree/api/schemaFromSimple.js.map +1 -1
  373. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js +1 -1
  374. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  375. package/lib/simple-tree/api/simpleTreeIndex.d.ts +2 -2
  376. package/lib/simple-tree/api/simpleTreeIndex.d.ts.map +1 -1
  377. package/lib/simple-tree/api/simpleTreeIndex.js +2 -2
  378. package/lib/simple-tree/api/simpleTreeIndex.js.map +1 -1
  379. package/lib/simple-tree/api/storedSchema.d.ts +1 -1
  380. package/lib/simple-tree/api/storedSchema.d.ts.map +1 -1
  381. package/lib/simple-tree/api/storedSchema.js +2 -2
  382. package/lib/simple-tree/api/storedSchema.js.map +1 -1
  383. package/lib/simple-tree/api/tree.d.ts +2 -1
  384. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  385. package/lib/simple-tree/api/tree.js.map +1 -1
  386. package/lib/simple-tree/api/treeBeta.d.ts +4 -1
  387. package/lib/simple-tree/api/treeBeta.d.ts.map +1 -1
  388. package/lib/simple-tree/api/treeBeta.js.map +1 -1
  389. package/lib/simple-tree/api/treeNodeApi.d.ts +1 -2
  390. package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  391. package/lib/simple-tree/api/treeNodeApi.js +2 -2
  392. package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
  393. package/lib/simple-tree/api/typesUnsafe.d.ts +2 -3
  394. package/lib/simple-tree/api/typesUnsafe.d.ts.map +1 -1
  395. package/lib/simple-tree/api/typesUnsafe.js.map +1 -1
  396. package/lib/simple-tree/api/verboseTree.d.ts +2 -1
  397. package/lib/simple-tree/api/verboseTree.d.ts.map +1 -1
  398. package/lib/simple-tree/api/verboseTree.js.map +1 -1
  399. package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts +1 -1
  400. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js +1 -1
  401. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
  402. package/lib/simple-tree/core/allowedTypes.d.ts +316 -0
  403. package/lib/simple-tree/core/allowedTypes.d.ts.map +1 -0
  404. package/lib/simple-tree/core/allowedTypes.js +162 -0
  405. package/lib/simple-tree/core/allowedTypes.js.map +1 -0
  406. package/lib/simple-tree/core/context.d.ts +3 -9
  407. package/lib/simple-tree/core/context.d.ts.map +1 -1
  408. package/lib/simple-tree/core/context.js +0 -8
  409. package/lib/simple-tree/core/context.js.map +1 -1
  410. package/lib/simple-tree/core/flexList.d.ts.map +1 -0
  411. package/lib/simple-tree/core/flexList.js.map +1 -0
  412. package/lib/simple-tree/core/getOrCreateNode.d.ts +1 -1
  413. package/lib/simple-tree/core/getOrCreateNode.d.ts.map +1 -1
  414. package/lib/simple-tree/core/getOrCreateNode.js.map +1 -1
  415. package/lib/simple-tree/core/index.d.ts +9 -3
  416. package/lib/simple-tree/core/index.d.ts.map +1 -1
  417. package/lib/simple-tree/core/index.js +6 -3
  418. package/lib/simple-tree/core/index.js.map +1 -1
  419. package/lib/simple-tree/core/treeNodeKernel.d.ts +8 -1
  420. package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  421. package/lib/simple-tree/core/treeNodeKernel.js +10 -6
  422. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
  423. package/lib/simple-tree/core/treeNodeSchema.d.ts +182 -39
  424. package/lib/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  425. package/lib/simple-tree/core/treeNodeSchema.js +44 -14
  426. package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
  427. package/{dist/simple-tree → lib/simple-tree/core}/treeNodeValid.d.ts +18 -4
  428. package/lib/simple-tree/core/treeNodeValid.d.ts.map +1 -0
  429. package/lib/simple-tree/{treeNodeValid.js → core/treeNodeValid.js} +31 -3
  430. package/lib/simple-tree/core/treeNodeValid.js.map +1 -0
  431. package/lib/simple-tree/core/unhydratedFlexTree.d.ts +1 -1
  432. package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  433. package/lib/simple-tree/core/walkSchema.d.ts +2 -1
  434. package/lib/simple-tree/core/walkSchema.d.ts.map +1 -1
  435. package/lib/simple-tree/core/walkSchema.js +7 -3
  436. package/lib/simple-tree/core/walkSchema.js.map +1 -1
  437. package/lib/simple-tree/createContext.d.ts +6 -2
  438. package/lib/simple-tree/createContext.d.ts.map +1 -1
  439. package/lib/simple-tree/createContext.js +13 -2
  440. package/lib/simple-tree/createContext.js.map +1 -1
  441. package/lib/{feature-libraries/modular-schema → simple-tree}/discrepancies.d.ts +22 -29
  442. package/lib/simple-tree/discrepancies.d.ts.map +1 -0
  443. package/lib/simple-tree/discrepancies.js +376 -0
  444. package/lib/simple-tree/discrepancies.js.map +1 -0
  445. package/lib/simple-tree/fieldSchema.d.ts +423 -0
  446. package/lib/simple-tree/fieldSchema.d.ts.map +1 -0
  447. package/lib/simple-tree/{schemaTypes.js → fieldSchema.js} +3 -183
  448. package/lib/simple-tree/fieldSchema.js.map +1 -0
  449. package/lib/simple-tree/index.d.ts +7 -6
  450. package/lib/simple-tree/index.d.ts.map +1 -1
  451. package/lib/simple-tree/index.js +4 -3
  452. package/lib/simple-tree/index.js.map +1 -1
  453. package/lib/simple-tree/leafNodeSchema.d.ts +14 -5
  454. package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
  455. package/lib/simple-tree/leafNodeSchema.js +117 -3
  456. package/lib/simple-tree/leafNodeSchema.js.map +1 -1
  457. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts +3 -4
  458. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  459. package/lib/simple-tree/node-kinds/array/arrayNode.js +86 -15
  460. package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  461. package/lib/simple-tree/node-kinds/array/arrayNodeTypes.d.ts +2 -2
  462. package/lib/simple-tree/node-kinds/array/arrayNodeTypes.d.ts.map +1 -1
  463. package/lib/simple-tree/node-kinds/array/arrayNodeTypes.js +1 -1
  464. package/lib/simple-tree/node-kinds/array/arrayNodeTypes.js.map +1 -1
  465. package/lib/simple-tree/node-kinds/common.d.ts +16 -0
  466. package/lib/simple-tree/node-kinds/common.d.ts.map +1 -0
  467. package/lib/simple-tree/node-kinds/common.js +38 -0
  468. package/lib/simple-tree/node-kinds/common.js.map +1 -0
  469. package/lib/simple-tree/node-kinds/index.d.ts +1 -1
  470. package/lib/simple-tree/node-kinds/index.d.ts.map +1 -1
  471. package/lib/simple-tree/node-kinds/index.js.map +1 -1
  472. package/lib/simple-tree/node-kinds/map/mapNode.d.ts +2 -3
  473. package/lib/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
  474. package/lib/simple-tree/node-kinds/map/mapNode.js +51 -13
  475. package/lib/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  476. package/lib/simple-tree/node-kinds/map/mapNodeTypes.d.ts +2 -2
  477. package/lib/simple-tree/node-kinds/map/mapNodeTypes.d.ts.map +1 -1
  478. package/lib/simple-tree/node-kinds/map/mapNodeTypes.js +1 -1
  479. package/lib/simple-tree/node-kinds/map/mapNodeTypes.js.map +1 -1
  480. package/lib/simple-tree/node-kinds/object/index.d.ts +2 -2
  481. package/lib/simple-tree/node-kinds/object/index.d.ts.map +1 -1
  482. package/lib/simple-tree/node-kinds/object/index.js.map +1 -1
  483. package/lib/simple-tree/node-kinds/object/objectNode.d.ts +19 -5
  484. package/lib/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  485. package/lib/simple-tree/node-kinds/object/objectNode.js +116 -14
  486. package/lib/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  487. package/lib/simple-tree/node-kinds/object/objectNodeTypes.d.ts +11 -4
  488. package/lib/simple-tree/node-kinds/object/objectNodeTypes.d.ts.map +1 -1
  489. package/lib/simple-tree/node-kinds/object/objectNodeTypes.js +1 -1
  490. package/lib/simple-tree/node-kinds/object/objectNodeTypes.js.map +1 -1
  491. package/lib/simple-tree/node-kinds/record/recordNode.d.ts +2 -2
  492. package/lib/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
  493. package/lib/simple-tree/node-kinds/record/recordNode.js +40 -12
  494. package/lib/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  495. package/lib/simple-tree/node-kinds/record/recordNodeTypes.d.ts +2 -2
  496. package/lib/simple-tree/node-kinds/record/recordNodeTypes.d.ts.map +1 -1
  497. package/lib/simple-tree/node-kinds/record/recordNodeTypes.js +1 -1
  498. package/lib/simple-tree/node-kinds/record/recordNodeTypes.js.map +1 -1
  499. package/lib/simple-tree/prepareForInsertion.d.ts +2 -2
  500. package/lib/simple-tree/prepareForInsertion.d.ts.map +1 -1
  501. package/lib/simple-tree/prepareForInsertion.js +2 -2
  502. package/lib/simple-tree/prepareForInsertion.js.map +1 -1
  503. package/lib/simple-tree/simpleSchema.d.ts +2 -2
  504. package/lib/simple-tree/simpleSchema.d.ts.map +1 -1
  505. package/lib/simple-tree/simpleSchema.js.map +1 -1
  506. package/lib/simple-tree/toStoredSchema.d.ts +1 -1
  507. package/lib/simple-tree/toStoredSchema.d.ts.map +1 -1
  508. package/lib/simple-tree/toStoredSchema.js +2 -3
  509. package/lib/simple-tree/toStoredSchema.js.map +1 -1
  510. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.d.ts +5 -11
  511. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
  512. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js +10 -381
  513. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
  514. package/lib/simple-tree/unsafeUnknownSchema.d.ts +52 -0
  515. package/lib/simple-tree/unsafeUnknownSchema.d.ts.map +1 -0
  516. package/lib/simple-tree/unsafeUnknownSchema.js +10 -0
  517. package/lib/simple-tree/unsafeUnknownSchema.js.map +1 -0
  518. package/lib/simple-tree/walkFieldSchema.d.ts +1 -1
  519. package/lib/simple-tree/walkFieldSchema.js +1 -1
  520. package/lib/simple-tree/walkFieldSchema.js.map +1 -1
  521. package/lib/tableSchema.d.ts +12 -12
  522. package/lib/treeFactory.d.ts +0 -1
  523. package/lib/treeFactory.d.ts.map +1 -1
  524. package/lib/treeFactory.js +0 -1
  525. package/lib/treeFactory.js.map +1 -1
  526. package/package.json +22 -23
  527. package/src/core/schema-stored/schema.ts +14 -1
  528. package/src/feature-libraries/default-schema/schemaChecker.ts +3 -0
  529. package/src/feature-libraries/flex-tree/context.ts +10 -5
  530. package/src/feature-libraries/flex-tree/index.ts +2 -0
  531. package/src/feature-libraries/flex-tree/lazyField.ts +10 -6
  532. package/src/feature-libraries/flex-tree/lazyNode.ts +6 -1
  533. package/src/feature-libraries/forest-summary/forestSummarizer.ts +1 -2
  534. package/src/feature-libraries/index.ts +1 -15
  535. package/src/feature-libraries/modular-schema/comparison.ts +0 -4
  536. package/src/feature-libraries/modular-schema/index.ts +0 -17
  537. package/src/packageVersion.ts +1 -1
  538. package/src/shared-tree/index.ts +0 -2
  539. package/src/shared-tree/schematizeTree.ts +5 -9
  540. package/src/shared-tree/schematizingTreeView.ts +75 -113
  541. package/src/shared-tree/sharedTreeChangeTypes.ts +1 -1
  542. package/src/shared-tree/tree.ts +4 -3
  543. package/src/shared-tree/treeAlpha.ts +7 -1
  544. package/src/shared-tree/treeCheckout.ts +15 -2
  545. package/src/simple-tree/api/conciseTree.ts +1 -2
  546. package/src/simple-tree/api/configuration.ts +7 -4
  547. package/src/simple-tree/api/create.ts +3 -1
  548. package/src/simple-tree/api/customTree.ts +1 -2
  549. package/src/simple-tree/api/getJsonSchema.ts +1 -1
  550. package/src/simple-tree/api/getSimpleSchema.ts +1 -1
  551. package/src/simple-tree/api/identifierIndex.ts +1 -1
  552. package/src/simple-tree/api/index.ts +2 -0
  553. package/src/simple-tree/api/schemaCompatibilityTester.ts +38 -128
  554. package/src/simple-tree/api/schemaCreationUtilities.ts +50 -5
  555. package/src/simple-tree/api/schemaFactory.ts +45 -10
  556. package/src/simple-tree/api/schemaFactoryAlpha.ts +4 -7
  557. package/src/simple-tree/api/schemaFactoryRecursive.ts +9 -4
  558. package/src/simple-tree/api/schemaFromSimple.ts +2 -3
  559. package/src/simple-tree/api/simpleSchemaToJsonSchema.ts +1 -1
  560. package/src/simple-tree/api/simpleTreeIndex.ts +8 -3
  561. package/src/simple-tree/api/storedSchema.ts +1 -2
  562. package/src/simple-tree/api/tree.ts +2 -2
  563. package/src/simple-tree/api/treeBeta.ts +4 -1
  564. package/src/simple-tree/api/treeNodeApi.ts +5 -8
  565. package/src/simple-tree/api/typesUnsafe.ts +5 -4
  566. package/src/simple-tree/api/verboseTree.ts +3 -6
  567. package/src/simple-tree/api/viewSchemaToSimpleSchema.ts +1 -1
  568. package/src/simple-tree/core/README.md +1 -1
  569. package/src/simple-tree/core/allowedTypes.ts +496 -0
  570. package/src/simple-tree/core/context.ts +3 -10
  571. package/src/simple-tree/core/getOrCreateNode.ts +1 -1
  572. package/src/simple-tree/core/index.ts +62 -9
  573. package/src/simple-tree/core/treeNodeKernel.ts +12 -6
  574. package/src/simple-tree/core/treeNodeSchema.ts +247 -63
  575. package/src/simple-tree/{treeNodeValid.ts → core/treeNodeValid.ts} +59 -15
  576. package/src/simple-tree/core/unhydratedFlexTree.ts +1 -1
  577. package/src/simple-tree/core/walkSchema.ts +9 -5
  578. package/src/simple-tree/createContext.ts +26 -2
  579. package/src/simple-tree/discrepancies.ts +648 -0
  580. package/src/simple-tree/fieldSchema.ts +734 -0
  581. package/src/simple-tree/index.ts +41 -31
  582. package/src/simple-tree/leafNodeSchema.ts +137 -5
  583. package/src/simple-tree/node-kinds/array/arrayNode.ts +141 -30
  584. package/src/simple-tree/node-kinds/array/arrayNodeTypes.ts +5 -7
  585. package/src/simple-tree/node-kinds/common.ts +60 -0
  586. package/src/simple-tree/node-kinds/index.ts +2 -0
  587. package/src/simple-tree/node-kinds/map/mapNode.ts +91 -33
  588. package/src/simple-tree/node-kinds/map/mapNodeTypes.ts +5 -7
  589. package/src/simple-tree/node-kinds/object/index.ts +2 -0
  590. package/src/simple-tree/node-kinds/object/objectNode.ts +205 -25
  591. package/src/simple-tree/node-kinds/object/objectNodeTypes.ts +22 -5
  592. package/src/simple-tree/node-kinds/record/recordNode.ts +68 -26
  593. package/src/simple-tree/node-kinds/record/recordNodeTypes.ts +6 -8
  594. package/src/simple-tree/prepareForInsertion.ts +7 -6
  595. package/src/simple-tree/simpleSchema.ts +2 -2
  596. package/src/simple-tree/toStoredSchema.ts +2 -3
  597. package/src/simple-tree/unhydratedFlexTreeFromInsertable.ts +12 -494
  598. package/src/simple-tree/unsafeUnknownSchema.ts +70 -0
  599. package/src/simple-tree/walkFieldSchema.ts +1 -1
  600. package/src/treeFactory.ts +0 -1
  601. package/dist/feature-libraries/modular-schema/discrepancies.d.ts.map +0 -1
  602. package/dist/feature-libraries/modular-schema/discrepancies.js +0 -361
  603. package/dist/feature-libraries/modular-schema/discrepancies.js.map +0 -1
  604. package/dist/shared-tree/checkoutFlexTreeView.d.ts +0 -58
  605. package/dist/shared-tree/checkoutFlexTreeView.d.ts.map +0 -1
  606. package/dist/shared-tree/checkoutFlexTreeView.js +0 -77
  607. package/dist/shared-tree/checkoutFlexTreeView.js.map +0 -1
  608. package/dist/simple-tree/flexList.d.ts.map +0 -1
  609. package/dist/simple-tree/flexList.js.map +0 -1
  610. package/dist/simple-tree/schemaTypes.d.ts +0 -856
  611. package/dist/simple-tree/schemaTypes.d.ts.map +0 -1
  612. package/dist/simple-tree/schemaTypes.js.map +0 -1
  613. package/dist/simple-tree/treeNodeValid.d.ts.map +0 -1
  614. package/dist/simple-tree/treeNodeValid.js.map +0 -1
  615. package/lib/feature-libraries/modular-schema/discrepancies.d.ts.map +0 -1
  616. package/lib/feature-libraries/modular-schema/discrepancies.js +0 -354
  617. package/lib/feature-libraries/modular-schema/discrepancies.js.map +0 -1
  618. package/lib/shared-tree/checkoutFlexTreeView.d.ts +0 -58
  619. package/lib/shared-tree/checkoutFlexTreeView.d.ts.map +0 -1
  620. package/lib/shared-tree/checkoutFlexTreeView.js +0 -72
  621. package/lib/shared-tree/checkoutFlexTreeView.js.map +0 -1
  622. package/lib/simple-tree/flexList.d.ts.map +0 -1
  623. package/lib/simple-tree/flexList.js.map +0 -1
  624. package/lib/simple-tree/schemaTypes.d.ts +0 -856
  625. package/lib/simple-tree/schemaTypes.d.ts.map +0 -1
  626. package/lib/simple-tree/schemaTypes.js.map +0 -1
  627. package/lib/simple-tree/treeNodeValid.d.ts.map +0 -1
  628. package/lib/simple-tree/treeNodeValid.js.map +0 -1
  629. package/src/feature-libraries/modular-schema/discrepancies.ts +0 -567
  630. package/src/shared-tree/checkoutFlexTreeView.ts +0 -100
  631. package/src/simple-tree/schemaTypes.ts +0 -1420
  632. /package/dist/simple-tree/{flexList.d.ts → core/flexList.d.ts} +0 -0
  633. /package/dist/simple-tree/{flexList.js → core/flexList.js} +0 -0
  634. /package/lib/simple-tree/{flexList.d.ts → core/flexList.d.ts} +0 -0
  635. /package/lib/simple-tree/{flexList.js → core/flexList.js} +0 -0
  636. /package/src/simple-tree/{flexList.ts → core/flexList.ts} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"customTree.js","sourceRoot":"","sources":["../../../src/simple-tree/api/customTree.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,qCAAqC,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAEtE,OAAO,EACN,QAAQ,EACR,YAAY,EACZ,aAAa,EACb,oBAAoB,EACpB,cAAc,EACd,sBAAsB,GAKtB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACjF,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,OAAO,EACN,aAAa,EACb,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,YAAY,GACZ,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC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BAAsB,EAAE,CAAC;QAC9C,MAAM,KAAK,GAAG,MAAM,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;QAC9C,IAAI,KAAK,CAAC,IAAI,KAAK,UAAU,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC;YACnD,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,IAAI,KAAK,CAAC,EAAE,KAAK,CAAC,oBAAoB,CAAC,CAAC;YACvE,OAAO,KAAK,CAAC,KAAK,CAAC;QACpB,CAAC;IACF,CAAC;AACF,CAAC;AAUD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,cAAc,CAAI,IAAa,EAAE,QAA4B;IAC5E,OAAO,qBAAqB,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;QACrD,kDAAkD;QAClD,IAAI,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC;YAC1B,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QACjD,CAAC;aAAM,CAAC;YACP,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;QAC/B,CAAC;IACF,CAAC,CAAC,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAY;IAC5C,MAAM,IAAI,UAAU,CACnB,kDAAkD,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,wCAAwC,CAC9G,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport { assert, fail } from \"@fluidframework/core-utils/internal\";\nimport { isFluidHandle } from \"@fluidframework/runtime-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\tEmptyKey,\n\tforEachField,\n\tinCursorField,\n\tLeafNodeStoredSchema,\n\tmapCursorField,\n\tObjectNodeStoredSchema,\n\ttype FieldKey,\n\ttype ITreeCursor,\n\ttype TreeNodeSchemaIdentifier,\n\ttype TreeNodeStoredSchema,\n} from \"../../core/index.js\";\nimport { FieldKinds, valueSchemaAllows } from \"../../feature-libraries/index.js\";\nimport { cloneWithReplacements } from \"../../util/index.js\";\nimport type { TreeNodeSchema } from \"../core/index.js\";\nimport {\n\tbooleanSchema,\n\thandleSchema,\n\tnullSchema,\n\tnumberSchema,\n\tstringSchema,\n} from \"../leafNodeSchema.js\";\nimport { isArrayNodeSchema, isObjectNodeSchema } from \"../node-kinds/index.js\";\nimport type { TreeLeafValue } from \"../schemaTypes.js\";\n\n/**\n * Options for how to interpret or encode a tree when schema information is available.\n * @alpha\n */\nexport interface TreeEncodingOptions {\n\t/**\n\t * If true, use the stored keys of object nodes.\n\t * If false, use the property keys.\n\t * @remarks\n\t * Has no effect on {@link NodeKind}s other than {@link NodeKind.Object}.\n\t * @defaultValue false.\n\t */\n\treadonly useStoredKeys?: boolean;\n}\n\n/**\n * Options for how to interpret a `ConciseTree<TCustom>` without relying on schema.\n */\nexport interface SchemalessParseOptions {\n\t/**\n\t * Converts stored keys into whatever key the tree is using in its encoding.\n\t */\n\tkeyConverter?: {\n\t\tparse(type: string, inputKey: string): FieldKey;\n\t\tencode(type: string, key: FieldKey): string;\n\t};\n}\n\n/**\n * Tree representation with fields as properties and customized handle and child representations.\n */\nexport type CustomTree<TChild> = CustomTreeNode<TChild> | CustomTreeValue;\n\n/**\n * TreeLeafValue except the handle type is customized.\n */\nexport type CustomTreeValue = TreeLeafValue;\n\n/**\n * Tree node representation with fields as properties and customized child representation.\n */\nexport type CustomTreeNode<TChild> = TChild[] | { [key: string]: TChild };\n\n/**\n * Builds an {@link CustomTree} from a cursor in Nodes mode.\n */\nexport function customFromCursor<TChild>(\n\treader: ITreeCursor,\n\toptions: Required<TreeEncodingOptions>,\n\tschema: ReadonlyMap<string, TreeNodeSchema>,\n\tchildHandler: (\n\t\treader: ITreeCursor,\n\t\toptions: Required<TreeEncodingOptions>,\n\t\tschema: ReadonlyMap<string, TreeNodeSchema>,\n\t) => TChild,\n): CustomTree<TChild> {\n\tconst type = reader.type;\n\tconst nodeSchema = schema.get(type) ?? fail(0xb2e /* missing schema for type in cursor */);\n\n\tswitch (type) {\n\t\tcase numberSchema.identifier:\n\t\tcase booleanSchema.identifier:\n\t\tcase nullSchema.identifier:\n\t\tcase stringSchema.identifier:\n\t\t\tassert(reader.value !== undefined, 0xa50 /* out of schema: missing value */);\n\t\t\tassert(!isFluidHandle(reader.value), 0xa51 /* out of schema: unexpected FluidHandle */);\n\t\t\treturn reader.value;\n\t\tcase handleSchema.identifier:\n\t\t\tassert(reader.value !== undefined, 0xa52 /* out of schema: missing value */);\n\t\t\tassert(isFluidHandle(reader.value), 0xa53 /* out of schema: expected FluidHandle */);\n\t\t\treturn reader.value;\n\t\tdefault: {\n\t\t\tassert(reader.value === undefined, 0xa54 /* out of schema: unexpected value */);\n\t\t\tif (isArrayNodeSchema(nodeSchema)) {\n\t\t\t\tconst fields = inCursorField(reader, EmptyKey, () =>\n\t\t\t\t\tmapCursorField(reader, () => childHandler(reader, options, schema)),\n\t\t\t\t);\n\t\t\t\treturn fields;\n\t\t\t} else {\n\t\t\t\tconst fields: Record<string, TChild> = {};\n\t\t\t\tforEachField(reader, () => {\n\t\t\t\t\tconst children = mapCursorField(reader, () => childHandler(reader, options, schema));\n\t\t\t\t\tif (children.length === 1) {\n\t\t\t\t\t\tconst storedKey = reader.getFieldKey();\n\t\t\t\t\t\tconst key =\n\t\t\t\t\t\t\tisObjectNodeSchema(nodeSchema) && !options.useStoredKeys\n\t\t\t\t\t\t\t\t? (nodeSchema.storedKeyToPropertyKey.get(storedKey) ??\n\t\t\t\t\t\t\t\t\tfail(0xb2f /* missing property key */))\n\t\t\t\t\t\t\t\t: storedKey;\n\t\t\t\t\t\t// Length is checked above.\n\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\t\t\tfields[key] = children[0]!;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tassert(children.length === 0, 0xa19 /* invalid children number */);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\treturn fields;\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * Builds an {@link CustomTree} from a cursor in Nodes mode.\n * @remarks\n * Uses stored keys and stored schema.\n */\nexport function customFromCursorStored<TChild>(\n\treader: ITreeCursor,\n\tschema: ReadonlyMap<TreeNodeSchemaIdentifier, TreeNodeStoredSchema>,\n\tchildHandler: (\n\t\treader: ITreeCursor,\n\t\tschema: ReadonlyMap<TreeNodeSchemaIdentifier, TreeNodeStoredSchema>,\n\t) => TChild,\n): CustomTree<TChild> {\n\tconst type = reader.type;\n\tconst nodeSchema = schema.get(type) ?? fail(0xb30 /* missing schema for type in cursor */);\n\n\tif (nodeSchema instanceof LeafNodeStoredSchema) {\n\t\tassert(valueSchemaAllows(nodeSchema.leafValue, reader.value), 0xa9c /* invalid value */);\n\t\treturn reader.value;\n\t}\n\n\tassert(reader.value === undefined, 0xa9d /* out of schema: unexpected value */);\n\n\tconst arrayTypes = tryStoredSchemaAsArray(nodeSchema);\n\tif (arrayTypes !== undefined) {\n\t\tconst field = inCursorField(reader, EmptyKey, () =>\n\t\t\tmapCursorField(reader, () => childHandler(reader, schema)),\n\t\t);\n\t\treturn field;\n\t}\n\n\tconst fields: Record<string, TChild> = {};\n\tforEachField(reader, () => {\n\t\tconst children = mapCursorField(reader, () => childHandler(reader, schema));\n\t\tif (children.length === 1) {\n\t\t\tconst storedKey = reader.getFieldKey();\n\t\t\t// Length is checked above.\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tfields[storedKey] = children[0]!;\n\t\t} else {\n\t\t\tassert(children.length === 0, 0xa9e /* invalid children number */);\n\t\t}\n\t});\n\treturn fields;\n}\n\n/**\n * Assumes `schema` corresponds to a simple-tree schema.\n * If it is an array schema, returns the allowed types for the array field.\n * Otherwise returns `undefined`.\n */\nexport function tryStoredSchemaAsArray(\n\tschema: TreeNodeStoredSchema,\n): ReadonlySet<string> | undefined {\n\tif (schema instanceof ObjectNodeStoredSchema) {\n\t\tconst empty = schema.getFieldSchema(EmptyKey);\n\t\tif (empty.kind === FieldKinds.sequence.identifier) {\n\t\t\tassert(schema.objectNodeFields.size === 1, 0xa9f /* invalid schema */);\n\t\t\treturn empty.types;\n\t\t}\n\t}\n}\n\n/**\n * Options for how to transcode handles.\n * @remarks\n * Can be applied using {@link replaceHandles}.\n * @alpha\n */\nexport type HandleConverter<TCustom> = (data: IFluidHandle) => TCustom;\n\n/**\n * Clones tree, replacing any handles.\n * @remarks\n * This can be useful converting data containing handles to JSON compatible formats,\n * or just asserting that data does not contain handles.\n *\n * Reversing this replacement depends on how the replacer encodes handles, and can often be impossible if the replacer\n * does not have all the necessary context to restore the handles\n * (e.g. if the handles are something insufficiently descriptive,\n * if data referenced by the handle got garbage collected,\n * if the encoded form of the handle can't be differentiated from other data,\n * or the replacer doesn't have access to the correct Fluid container to to restore them from).\n *\n * Code attempting to reverse this replacement may want to use {@link cloneWithReplacements}.\n * @alpha\n */\nexport function replaceHandles<T>(tree: unknown, replacer: HandleConverter<T>): unknown {\n\treturn cloneWithReplacements(tree, \"\", (key, value) => {\n\t\t// eslint-disable-next-line unicorn/prefer-ternary\n\t\tif (isFluidHandle(value)) {\n\t\t\treturn { clone: false, value: replacer(value) };\n\t\t} else {\n\t\t\treturn { clone: true, value };\n\t\t}\n\t});\n}\n\n/**\n * Throws a `UsageError` indicating that a type is unknown in the current context.\n */\nexport function unknownTypeError(type: string): never {\n\tthrow new UsageError(\n\t\t`Failed to parse tree due to occurrence of type ${JSON.stringify(type)} which is not defined in this context.`,\n\t);\n}\n"]}
1
+ {"version":3,"file":"customTree.js","sourceRoot":"","sources":["../../../src/simple-tree/api/customTree.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,MAA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,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;QAC/B,CAAC;IACF,CAAC,CAAC,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAY;IAC5C,MAAM,IAAI,UAAU,CACnB,kDAAkD,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,wCAAwC,CAC9G,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport { assert, fail } from \"@fluidframework/core-utils/internal\";\nimport { isFluidHandle } from \"@fluidframework/runtime-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\tEmptyKey,\n\tforEachField,\n\tinCursorField,\n\tLeafNodeStoredSchema,\n\tmapCursorField,\n\tObjectNodeStoredSchema,\n\ttype FieldKey,\n\ttype ITreeCursor,\n\ttype TreeNodeSchemaIdentifier,\n\ttype TreeNodeStoredSchema,\n} from \"../../core/index.js\";\nimport { FieldKinds, valueSchemaAllows } from \"../../feature-libraries/index.js\";\nimport { cloneWithReplacements } from \"../../util/index.js\";\nimport type { TreeNodeSchema, TreeLeafValue } from \"../core/index.js\";\nimport {\n\tbooleanSchema,\n\thandleSchema,\n\tnullSchema,\n\tnumberSchema,\n\tstringSchema,\n} from \"../leafNodeSchema.js\";\nimport { isArrayNodeSchema, isObjectNodeSchema } from \"../node-kinds/index.js\";\n\n/**\n * Options for how to interpret or encode a tree when schema information is available.\n * @alpha\n */\nexport interface TreeEncodingOptions {\n\t/**\n\t * If true, use the stored keys of object nodes.\n\t * If false, use the property keys.\n\t * @remarks\n\t * Has no effect on {@link NodeKind}s other than {@link NodeKind.Object}.\n\t * @defaultValue false.\n\t */\n\treadonly useStoredKeys?: boolean;\n}\n\n/**\n * Options for how to interpret a `ConciseTree<TCustom>` without relying on schema.\n */\nexport interface SchemalessParseOptions {\n\t/**\n\t * Converts stored keys into whatever key the tree is using in its encoding.\n\t */\n\tkeyConverter?: {\n\t\tparse(type: string, inputKey: string): FieldKey;\n\t\tencode(type: string, key: FieldKey): string;\n\t};\n}\n\n/**\n * Tree representation with fields as properties and customized handle and child representations.\n */\nexport type CustomTree<TChild> = CustomTreeNode<TChild> | CustomTreeValue;\n\n/**\n * TreeLeafValue except the handle type is customized.\n */\nexport type CustomTreeValue = TreeLeafValue;\n\n/**\n * Tree node representation with fields as properties and customized child representation.\n */\nexport type CustomTreeNode<TChild> = TChild[] | { [key: string]: TChild };\n\n/**\n * Builds an {@link CustomTree} from a cursor in Nodes mode.\n */\nexport function customFromCursor<TChild>(\n\treader: ITreeCursor,\n\toptions: Required<TreeEncodingOptions>,\n\tschema: ReadonlyMap<string, TreeNodeSchema>,\n\tchildHandler: (\n\t\treader: ITreeCursor,\n\t\toptions: Required<TreeEncodingOptions>,\n\t\tschema: ReadonlyMap<string, TreeNodeSchema>,\n\t) => TChild,\n): CustomTree<TChild> {\n\tconst type = reader.type;\n\tconst nodeSchema = schema.get(type) ?? fail(0xb2e /* missing schema for type in cursor */);\n\n\tswitch (type) {\n\t\tcase numberSchema.identifier:\n\t\tcase booleanSchema.identifier:\n\t\tcase nullSchema.identifier:\n\t\tcase stringSchema.identifier:\n\t\t\tassert(reader.value !== undefined, 0xa50 /* out of schema: missing value */);\n\t\t\tassert(!isFluidHandle(reader.value), 0xa51 /* out of schema: unexpected FluidHandle */);\n\t\t\treturn reader.value;\n\t\tcase handleSchema.identifier:\n\t\t\tassert(reader.value !== undefined, 0xa52 /* out of schema: missing value */);\n\t\t\tassert(isFluidHandle(reader.value), 0xa53 /* out of schema: expected FluidHandle */);\n\t\t\treturn reader.value;\n\t\tdefault: {\n\t\t\tassert(reader.value === undefined, 0xa54 /* out of schema: unexpected value */);\n\t\t\tif (isArrayNodeSchema(nodeSchema)) {\n\t\t\t\tconst fields = inCursorField(reader, EmptyKey, () =>\n\t\t\t\t\tmapCursorField(reader, () => childHandler(reader, options, schema)),\n\t\t\t\t);\n\t\t\t\treturn fields;\n\t\t\t} else {\n\t\t\t\tconst fields: Record<string, TChild> = {};\n\t\t\t\tforEachField(reader, () => {\n\t\t\t\t\tconst children = mapCursorField(reader, () => childHandler(reader, options, schema));\n\t\t\t\t\tif (children.length === 1) {\n\t\t\t\t\t\tconst storedKey = reader.getFieldKey();\n\t\t\t\t\t\tconst key =\n\t\t\t\t\t\t\tisObjectNodeSchema(nodeSchema) && !options.useStoredKeys\n\t\t\t\t\t\t\t\t? (nodeSchema.storedKeyToPropertyKey.get(storedKey) ??\n\t\t\t\t\t\t\t\t\tfail(0xb2f /* missing property key */))\n\t\t\t\t\t\t\t\t: storedKey;\n\t\t\t\t\t\t// Length is checked above.\n\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\t\t\tfields[key] = children[0]!;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tassert(children.length === 0, 0xa19 /* invalid children number */);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\treturn fields;\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * Builds an {@link CustomTree} from a cursor in Nodes mode.\n * @remarks\n * Uses stored keys and stored schema.\n */\nexport function customFromCursorStored<TChild>(\n\treader: ITreeCursor,\n\tschema: ReadonlyMap<TreeNodeSchemaIdentifier, TreeNodeStoredSchema>,\n\tchildHandler: (\n\t\treader: ITreeCursor,\n\t\tschema: ReadonlyMap<TreeNodeSchemaIdentifier, TreeNodeStoredSchema>,\n\t) => TChild,\n): CustomTree<TChild> {\n\tconst type = reader.type;\n\tconst nodeSchema = schema.get(type) ?? fail(0xb30 /* missing schema for type in cursor */);\n\n\tif (nodeSchema instanceof LeafNodeStoredSchema) {\n\t\tassert(valueSchemaAllows(nodeSchema.leafValue, reader.value), 0xa9c /* invalid value */);\n\t\treturn reader.value;\n\t}\n\n\tassert(reader.value === undefined, 0xa9d /* out of schema: unexpected value */);\n\n\tconst arrayTypes = tryStoredSchemaAsArray(nodeSchema);\n\tif (arrayTypes !== undefined) {\n\t\tconst field = inCursorField(reader, EmptyKey, () =>\n\t\t\tmapCursorField(reader, () => childHandler(reader, schema)),\n\t\t);\n\t\treturn field;\n\t}\n\n\tconst fields: Record<string, TChild> = {};\n\tforEachField(reader, () => {\n\t\tconst children = mapCursorField(reader, () => childHandler(reader, schema));\n\t\tif (children.length === 1) {\n\t\t\tconst storedKey = reader.getFieldKey();\n\t\t\t// Length is checked above.\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tfields[storedKey] = children[0]!;\n\t\t} else {\n\t\t\tassert(children.length === 0, 0xa9e /* invalid children number */);\n\t\t}\n\t});\n\treturn fields;\n}\n\n/**\n * Assumes `schema` corresponds to a simple-tree schema.\n * If it is an array schema, returns the allowed types for the array field.\n * Otherwise returns `undefined`.\n */\nexport function tryStoredSchemaAsArray(\n\tschema: TreeNodeStoredSchema,\n): ReadonlySet<string> | undefined {\n\tif (schema instanceof ObjectNodeStoredSchema) {\n\t\tconst empty = schema.getFieldSchema(EmptyKey);\n\t\tif (empty.kind === FieldKinds.sequence.identifier) {\n\t\t\tassert(schema.objectNodeFields.size === 1, 0xa9f /* invalid schema */);\n\t\t\treturn empty.types;\n\t\t}\n\t}\n}\n\n/**\n * Options for how to transcode handles.\n * @remarks\n * Can be applied using {@link replaceHandles}.\n * @alpha\n */\nexport type HandleConverter<TCustom> = (data: IFluidHandle) => TCustom;\n\n/**\n * Clones tree, replacing any handles.\n * @remarks\n * This can be useful converting data containing handles to JSON compatible formats,\n * or just asserting that data does not contain handles.\n *\n * Reversing this replacement depends on how the replacer encodes handles, and can often be impossible if the replacer\n * does not have all the necessary context to restore the handles\n * (e.g. if the handles are something insufficiently descriptive,\n * if data referenced by the handle got garbage collected,\n * if the encoded form of the handle can't be differentiated from other data,\n * or the replacer doesn't have access to the correct Fluid container to to restore them from).\n *\n * Code attempting to reverse this replacement may want to use {@link cloneWithReplacements}.\n * @alpha\n */\nexport function replaceHandles<T>(tree: unknown, replacer: HandleConverter<T>): unknown {\n\treturn cloneWithReplacements(tree, \"\", (key, value) => {\n\t\t// eslint-disable-next-line unicorn/prefer-ternary\n\t\tif (isFluidHandle(value)) {\n\t\t\treturn { clone: false, value: replacer(value) };\n\t\t} else {\n\t\t\treturn { clone: true, value };\n\t\t}\n\t});\n}\n\n/**\n * Throws a `UsageError` indicating that a type is unknown in the current context.\n */\nexport function unknownTypeError(type: string): never {\n\tthrow new UsageError(\n\t\t`Failed to parse tree due to occurrence of type ${JSON.stringify(type)} which is not defined in this context.`,\n\t);\n}\n"]}
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import type { JsonTreeSchema } from "./jsonSchema.js";
6
- import type { ImplicitAllowedTypes } from "../schemaTypes.js";
6
+ import type { ImplicitAllowedTypes } from "../core/index.js";
7
7
  import type { TreeEncodingOptions } from "./customTree.js";
8
8
  /**
9
9
  * Options for how to interpret or encode a tree when schema information is available.
@@ -1 +1 @@
1
- {"version":3,"file":"getJsonSchema.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/getJsonSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAE9D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAG3D;;;GAGG;AACH,MAAM,WAAW,yBAA0B,SAAQ,mBAAmB;IACrE;;;;;;OAMG;IACH,QAAQ,CAAC,yBAAyB,CAAC,EAAE,OAAO,CAAC;CAC7C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AACH,wBAAgB,aAAa,CAC5B,MAAM,EAAE,oBAAoB,EAC5B,OAAO,EAAE,QAAQ,CAAC,yBAAyB,CAAC,GAC1C,cAAc,CAGhB"}
1
+ {"version":3,"file":"getJsonSchema.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/getJsonSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAE7D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAG3D;;;GAGG;AACH,MAAM,WAAW,yBAA0B,SAAQ,mBAAmB;IACrE;;;;;;OAMG;IACH,QAAQ,CAAC,yBAAyB,CAAC,EAAE,OAAO,CAAC;CAC7C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AACH,wBAAgB,aAAa,CAC5B,MAAM,EAAE,oBAAoB,EAC5B,OAAO,EAAE,QAAQ,CAAC,yBAAyB,CAAC,GAC1C,cAAc,CAGhB"}
@@ -1 +1 @@
1
- {"version":3,"file":"getJsonSchema.js","sourceRoot":"","sources":["../../../src/simple-tree/api/getJsonSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAE7D,OAAO,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAiBhE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AACH,MAAM,UAAU,aAAa,CAC5B,MAA4B,EAC5B,OAA4C;IAE5C,MAAM,UAAU,GAAG,IAAI,0BAA0B,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;IAC9D,OAAO,YAAY,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;AAC1C,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { JsonTreeSchema } from \"./jsonSchema.js\";\nimport type { ImplicitAllowedTypes } from \"../schemaTypes.js\";\nimport { toJsonSchema } from \"./simpleSchemaToJsonSchema.js\";\nimport type { TreeEncodingOptions } from \"./customTree.js\";\nimport { TreeViewConfigurationAlpha } from \"./configuration.js\";\n\n/**\n * Options for how to interpret or encode a tree when schema information is available.\n * @alpha\n */\nexport interface TreeSchemaEncodingOptions extends TreeEncodingOptions {\n\t/**\n\t * If true, fields with default providers (like {@link SchemaFactory.identifier}) will be required.\n\t * If false, they will be optional.\n\t * @remarks\n\t * Has no effect on {@link NodeKind}s other than {@link NodeKind.Object}.\n\t * @defaultValue false.\n\t */\n\treadonly requireFieldsWithDefaults?: boolean;\n}\n\n/**\n * Creates a {@link https://json-schema.org/ | JSON Schema} representation of the provided {@link TreeNodeSchema}.\n *\n * @remarks\n * Useful when communicating the schema to external libraries or services.\n * Caches the result for future calls.\n *\n * @example\n *\n * A Shared Tree schema like the following:\n *\n * ```typescript\n * class MyObject extends schemaFactory.object(\"MyObject\", {\n * \tfoo: schemaFactory.number,\n * \tbar: schemaFactory.optional(schemaFactory.string),\n * });\n * ```\n *\n * Will yield JSON Schema like the following:\n *\n * ```json\n * {\n * \t\"$defs\": {\n * \t\t\"com.fluidframework.leaf.string\": {\n * \t\t\t\"type\": \"string\",\n * \t\t},\n * \t\t\"com.fluidframework.leaf.number\": {\n * \t\t\t\"type\": \"number\",\n * \t\t},\n * \t\t\"com.myapp.MyObject\": {\n * \t\t\t\"type\": \"object\",\n * \t\t\t\"properties\": {\n * \t\t\t\t\"foo\": { \"$ref\": \"com.fluidframework.leaf.number\" },\n * \t\t\t\t\"bar\": { \"$ref\": \"com.fluidframework.leaf.string\" },\n * \t\t\t},\n * \t\t\t\"required\": [\"foo\"],\n * \t\t},\n * \t},\n * \t\"$ref\": \"#/$defs/com.myapp.MyObject\",\n * }\n * ```\n *\n * @privateRemarks In the future, we may wish to move this to a more discoverable API location.\n * For now, while still an experimental API, it is surfaced as a free function.\n *\n * TODO:\n * This API should allow generating JSON schema for the whole matrix of combinations:\n *\n * 1. VerboseTree and (Done) ConciseTree\n * 2. (Done) With and without requiring values with defaults (for insertion vs reading)\n * 3. (Done) Using stored keys and property keys.\n *\n * This takes in `ImplicitAllowedTypes` since underlying `toJsonSchema` can't handle optional roots.\n *\n * @alpha\n */\nexport function getJsonSchema(\n\tschema: ImplicitAllowedTypes,\n\toptions: Required<TreeSchemaEncodingOptions>,\n): JsonTreeSchema {\n\tconst treeSchema = new TreeViewConfigurationAlpha({ schema });\n\treturn toJsonSchema(treeSchema, options);\n}\n"]}
1
+ {"version":3,"file":"getJsonSchema.js","sourceRoot":"","sources":["../../../src/simple-tree/api/getJsonSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAE7D,OAAO,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAiBhE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AACH,MAAM,UAAU,aAAa,CAC5B,MAA4B,EAC5B,OAA4C;IAE5C,MAAM,UAAU,GAAG,IAAI,0BAA0B,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;IAC9D,OAAO,YAAY,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;AAC1C,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { JsonTreeSchema } from \"./jsonSchema.js\";\nimport type { ImplicitAllowedTypes } from \"../core/index.js\";\nimport { toJsonSchema } from \"./simpleSchemaToJsonSchema.js\";\nimport type { TreeEncodingOptions } from \"./customTree.js\";\nimport { TreeViewConfigurationAlpha } from \"./configuration.js\";\n\n/**\n * Options for how to interpret or encode a tree when schema information is available.\n * @alpha\n */\nexport interface TreeSchemaEncodingOptions extends TreeEncodingOptions {\n\t/**\n\t * If true, fields with default providers (like {@link SchemaFactory.identifier}) will be required.\n\t * If false, they will be optional.\n\t * @remarks\n\t * Has no effect on {@link NodeKind}s other than {@link NodeKind.Object}.\n\t * @defaultValue false.\n\t */\n\treadonly requireFieldsWithDefaults?: boolean;\n}\n\n/**\n * Creates a {@link https://json-schema.org/ | JSON Schema} representation of the provided {@link TreeNodeSchema}.\n *\n * @remarks\n * Useful when communicating the schema to external libraries or services.\n * Caches the result for future calls.\n *\n * @example\n *\n * A Shared Tree schema like the following:\n *\n * ```typescript\n * class MyObject extends schemaFactory.object(\"MyObject\", {\n * \tfoo: schemaFactory.number,\n * \tbar: schemaFactory.optional(schemaFactory.string),\n * });\n * ```\n *\n * Will yield JSON Schema like the following:\n *\n * ```json\n * {\n * \t\"$defs\": {\n * \t\t\"com.fluidframework.leaf.string\": {\n * \t\t\t\"type\": \"string\",\n * \t\t},\n * \t\t\"com.fluidframework.leaf.number\": {\n * \t\t\t\"type\": \"number\",\n * \t\t},\n * \t\t\"com.myapp.MyObject\": {\n * \t\t\t\"type\": \"object\",\n * \t\t\t\"properties\": {\n * \t\t\t\t\"foo\": { \"$ref\": \"com.fluidframework.leaf.number\" },\n * \t\t\t\t\"bar\": { \"$ref\": \"com.fluidframework.leaf.string\" },\n * \t\t\t},\n * \t\t\t\"required\": [\"foo\"],\n * \t\t},\n * \t},\n * \t\"$ref\": \"#/$defs/com.myapp.MyObject\",\n * }\n * ```\n *\n * @privateRemarks In the future, we may wish to move this to a more discoverable API location.\n * For now, while still an experimental API, it is surfaced as a free function.\n *\n * TODO:\n * This API should allow generating JSON schema for the whole matrix of combinations:\n *\n * 1. VerboseTree and (Done) ConciseTree\n * 2. (Done) With and without requiring values with defaults (for insertion vs reading)\n * 3. (Done) Using stored keys and property keys.\n *\n * This takes in `ImplicitAllowedTypes` since underlying `toJsonSchema` can't handle optional roots.\n *\n * @alpha\n */\nexport function getJsonSchema(\n\tschema: ImplicitAllowedTypes,\n\toptions: Required<TreeSchemaEncodingOptions>,\n): JsonTreeSchema {\n\tconst treeSchema = new TreeViewConfigurationAlpha({ schema });\n\treturn toJsonSchema(treeSchema, options);\n}\n"]}
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import type { ImplicitFieldSchema } from "../schemaTypes.js";
5
+ import type { ImplicitFieldSchema } from "../fieldSchema.js";
6
6
  import type { SimpleTreeSchema } from "../simpleSchema.js";
7
7
  /**
8
8
  * Copies data from {@link ImplicitFieldSchema} to create a {@link SimpleTreeSchema} out of new plain JavaScript objects, Sets and Maps.
@@ -1 +1 @@
1
- {"version":3,"file":"getSimpleSchema.js","sourceRoot":"","sources":["../../../src/simple-tree/api/getSimpleSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAEnE;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,eAAe,CAAC,MAA2B;IAC1D,OAAO,kBAAkB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AACzC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ImplicitFieldSchema } from \"../schemaTypes.js\";\nimport type { SimpleTreeSchema } from \"../simpleSchema.js\";\n\nimport { toSimpleTreeSchema } from \"./viewSchemaToSimpleSchema.js\";\n\n/**\n * Copies data from {@link ImplicitFieldSchema} to create a {@link SimpleTreeSchema} out of new plain JavaScript objects, Sets and Maps.\n *\n * @remarks\n * See also {@link TreeViewConfigurationAlpha} which implements {@link SimpleTreeSchema} as a way to get a `SimpleTreeSchema` without copying the node and field schema and without losing as much type information.\n *\n * @privateRemarks\n * In the future, we may wish to move this to a more discoverable API location.\n * For now, while still an experimental API, it is surfaced as a free function.\n *\n * Note that all TreeNodeSchema get a {@link Context} cached on them as part of one time initialization which contains a map from identifier to all transitively referenced schema.\n * Perhaps exposing access to that would cover this use-case as well.\n *\n * @alpha\n */\nexport function getSimpleSchema(schema: ImplicitFieldSchema): SimpleTreeSchema {\n\treturn toSimpleTreeSchema(schema, true);\n}\n"]}
1
+ {"version":3,"file":"getSimpleSchema.js","sourceRoot":"","sources":["../../../src/simple-tree/api/getSimpleSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAEnE;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,eAAe,CAAC,MAA2B;IAC1D,OAAO,kBAAkB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AACzC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ImplicitFieldSchema } from \"../fieldSchema.js\";\nimport type { SimpleTreeSchema } from \"../simpleSchema.js\";\n\nimport { toSimpleTreeSchema } from \"./viewSchemaToSimpleSchema.js\";\n\n/**\n * Copies data from {@link ImplicitFieldSchema} to create a {@link SimpleTreeSchema} out of new plain JavaScript objects, Sets and Maps.\n *\n * @remarks\n * See also {@link TreeViewConfigurationAlpha} which implements {@link SimpleTreeSchema} as a way to get a `SimpleTreeSchema` without copying the node and field schema and without losing as much type information.\n *\n * @privateRemarks\n * In the future, we may wish to move this to a more discoverable API location.\n * For now, while still an experimental API, it is surfaced as a free function.\n *\n * Note that all TreeNodeSchema get a {@link Context} cached on them as part of one time initialization which contains a map from identifier to all transitively referenced schema.\n * Perhaps exposing access to that would cover this use-case as well.\n *\n * @alpha\n */\nexport function getSimpleSchema(schema: ImplicitFieldSchema): SimpleTreeSchema {\n\treturn toSimpleTreeSchema(schema, true);\n}\n"]}
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { type ImplicitFieldSchema } from "../schemaTypes.js";
5
+ import { type ImplicitFieldSchema } from "../fieldSchema.js";
6
6
  import type { TreeNode } from "../core/index.js";
7
7
  import type { TreeView } from "./tree.js";
8
8
  import { type SimpleTreeIndex } from "./simpleTreeIndex.js";
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { UsageError } from "@fluidframework/telemetry-utils/internal";
6
- import { FieldKind } from "../schemaTypes.js";
6
+ import { FieldKind } from "../fieldSchema.js";
7
7
  import { ObjectNodeSchema } from "../node-kinds/index.js";
8
8
  import { walkFieldSchema } from "../walkFieldSchema.js";
9
9
  import { createSimpleTreeIndex } from "./simpleTreeIndex.js";
@@ -1 +1 @@
1
- {"version":3,"file":"identifierIndex.js","sourceRoot":"","sources":["../../../src/simple-tree/api/identifierIndex.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAEtE,OAAO,EAAE,SAAS,EAA4B,MAAM,mBAAmB,CAAC;AAExE,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAwB,MAAM,sBAAsB,CAAC;AASnF,SAAS,WAAW,CAAC,GAAiB;IACrC,OAAO,OAAO,GAAG,KAAK,QAAQ,CAAC;AAChC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CACpC,IAAuB;IAEvB,4EAA4E;IAC5E,yEAAyE;IACzE,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAAkB,CAAC;IACnD,eAAe,CAAC,IAAI,CAAC,MAAM,EAAE;QAC5B,IAAI,EAAE,CAAC,OAAO,EAAE,EAAE;YACjB,IAAI,OAAO,YAAY,gBAAgB,EAAE,CAAC;gBACzC,KAAK,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,CAAC;oBAChE,IAAI,WAAW,CAAC,IAAI,KAAK,SAAS,CAAC,UAAU,EAAE,CAAC;wBAC/C,gBAAgB,CAAC,GAAG,CAAC,OAAO,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;wBACnD,MAAM;oBACP,CAAC;gBACF,CAAC;YACF,CAAC;QACF,CAAC;KACD,CAAC,CAAC;IAEH,OAAO,qBAAqB,CAC3B,IAAI,EACJ,CAAC,OAAO,EAAE,EAAE,CAAC,gBAAgB,CAAC,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC,EACrD,CAAC,KAAK,EAAE,EAAE;QACT,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACtB,MAAM,IAAI,UAAU,CACnB,oFAAoF,CACpF,CAAC;QACH,CAAC;QAED,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC;IACjB,CAAC,EACD,WAAW,CACX,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\nimport type { TreeIndexKey } from \"../../feature-libraries/index.js\";\nimport { FieldKind, type ImplicitFieldSchema } from \"../schemaTypes.js\";\nimport type { TreeNode } from \"../core/index.js\";\nimport { ObjectNodeSchema } from \"../node-kinds/index.js\";\nimport type { TreeView } from \"./tree.js\";\nimport { walkFieldSchema } from \"../walkFieldSchema.js\";\nimport { createSimpleTreeIndex, type SimpleTreeIndex } from \"./simpleTreeIndex.js\";\n\n/**\n * An index that returns tree nodes given their associated identifiers.\n *\n * @alpha\n */\nexport type IdentifierIndex = SimpleTreeIndex<string, TreeNode>;\n\nfunction isStringKey(key: TreeIndexKey): key is string {\n\treturn typeof key === \"string\";\n}\n\n/**\n * Creates an {@link IdentifierIndex} for a given {@link TreeView}.\n *\n * @alpha\n */\nexport function createIdentifierIndex<TSchema extends ImplicitFieldSchema>(\n\tview: TreeView<TSchema>,\n): IdentifierIndex {\n\t// For each node schema, find which field key the identifier field is under.\n\t// This can be done easily because identifiers are their own field kinds.\n\tconst identifierFields = new Map<string, string>();\n\twalkFieldSchema(view.schema, {\n\t\tnode: (schemus) => {\n\t\t\tif (schemus instanceof ObjectNodeSchema) {\n\t\t\t\tfor (const [fieldKey, fieldSchema] of schemus.fields.entries()) {\n\t\t\t\t\tif (fieldSchema.kind === FieldKind.Identifier) {\n\t\t\t\t\t\tidentifierFields.set(schemus.identifier, fieldKey);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t});\n\n\treturn createSimpleTreeIndex(\n\t\tview,\n\t\t(schemus) => identifierFields.get(schemus.identifier),\n\t\t(nodes) => {\n\t\t\tif (nodes.length > 1) {\n\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\"cannot retrieve node from index: there are multiple nodes with the same identifier\",\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn nodes[0];\n\t\t},\n\t\tisStringKey,\n\t);\n}\n"]}
1
+ {"version":3,"file":"identifierIndex.js","sourceRoot":"","sources":["../../../src/simple-tree/api/identifierIndex.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAEtE,OAAO,EAAE,SAAS,EAA4B,MAAM,mBAAmB,CAAC;AAExE,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAwB,MAAM,sBAAsB,CAAC;AASnF,SAAS,WAAW,CAAC,GAAiB;IACrC,OAAO,OAAO,GAAG,KAAK,QAAQ,CAAC;AAChC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CACpC,IAAuB;IAEvB,4EAA4E;IAC5E,yEAAyE;IACzE,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAAkB,CAAC;IACnD,eAAe,CAAC,IAAI,CAAC,MAAM,EAAE;QAC5B,IAAI,EAAE,CAAC,OAAO,EAAE,EAAE;YACjB,IAAI,OAAO,YAAY,gBAAgB,EAAE,CAAC;gBACzC,KAAK,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,CAAC;oBAChE,IAAI,WAAW,CAAC,IAAI,KAAK,SAAS,CAAC,UAAU,EAAE,CAAC;wBAC/C,gBAAgB,CAAC,GAAG,CAAC,OAAO,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;wBACnD,MAAM;oBACP,CAAC;gBACF,CAAC;YACF,CAAC;QACF,CAAC;KACD,CAAC,CAAC;IAEH,OAAO,qBAAqB,CAC3B,IAAI,EACJ,CAAC,OAAO,EAAE,EAAE,CAAC,gBAAgB,CAAC,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC,EACrD,CAAC,KAAK,EAAE,EAAE;QACT,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACtB,MAAM,IAAI,UAAU,CACnB,oFAAoF,CACpF,CAAC;QACH,CAAC;QAED,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC;IACjB,CAAC,EACD,WAAW,CACX,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\nimport type { TreeIndexKey } from \"../../feature-libraries/index.js\";\nimport { FieldKind, type ImplicitFieldSchema } from \"../fieldSchema.js\";\nimport type { TreeNode } from \"../core/index.js\";\nimport { ObjectNodeSchema } from \"../node-kinds/index.js\";\nimport type { TreeView } from \"./tree.js\";\nimport { walkFieldSchema } from \"../walkFieldSchema.js\";\nimport { createSimpleTreeIndex, type SimpleTreeIndex } from \"./simpleTreeIndex.js\";\n\n/**\n * An index that returns tree nodes given their associated identifiers.\n *\n * @alpha\n */\nexport type IdentifierIndex = SimpleTreeIndex<string, TreeNode>;\n\nfunction isStringKey(key: TreeIndexKey): key is string {\n\treturn typeof key === \"string\";\n}\n\n/**\n * Creates an {@link IdentifierIndex} for a given {@link TreeView}.\n *\n * @alpha\n */\nexport function createIdentifierIndex<TSchema extends ImplicitFieldSchema>(\n\tview: TreeView<TSchema>,\n): IdentifierIndex {\n\t// For each node schema, find which field key the identifier field is under.\n\t// This can be done easily because identifiers are their own field kinds.\n\tconst identifierFields = new Map<string, string>();\n\twalkFieldSchema(view.schema, {\n\t\tnode: (schemus) => {\n\t\t\tif (schemus instanceof ObjectNodeSchema) {\n\t\t\t\tfor (const [fieldKey, fieldSchema] of schemus.fields.entries()) {\n\t\t\t\t\tif (fieldSchema.kind === FieldKind.Identifier) {\n\t\t\t\t\t\tidentifierFields.set(schemus.identifier, fieldKey);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t});\n\n\treturn createSimpleTreeIndex(\n\t\tview,\n\t\t(schemus) => identifierFields.get(schemus.identifier),\n\t\t(nodes) => {\n\t\t\tif (nodes.length > 1) {\n\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\"cannot retrieve node from index: there are multiple nodes with the same identifier\",\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn nodes[0];\n\t\t},\n\t\tisStringKey,\n\t);\n}\n"]}
@@ -6,7 +6,7 @@ export type { TreeSchema, ITreeViewConfiguration, ITreeConfigurationOptions, } f
6
6
  export { TreeViewConfiguration, TreeViewConfigurationAlpha, } from "./configuration.js";
7
7
  export type { ITree, TreeView, ViewableTree, TreeViewEvents, SchemaCompatibilityStatus, TreeViewAlpha, TreeBranch, TreeBranchEvents, ITreeAlpha, } from "./tree.js";
8
8
  export { asTreeViewAlpha } from "./tree.js";
9
- export { SchemaFactory, type ScopedSchemaName, type SchemaFactoryObjectOptions, type SchemaStatics, schemaStatics, } from "./schemaFactory.js";
9
+ export { SchemaFactory, type ScopedSchemaName, type SchemaFactoryObjectOptions, type SchemaStatics, schemaStatics, type NodeSchemaOptions, type NodeSchemaOptionsAlpha, } from "./schemaFactory.js";
10
10
  export { SchemaFactoryAlpha } from "./schemaFactoryAlpha.js";
11
11
  export type { ValidateRecursiveSchema, FixRecursiveArraySchema, ValidateRecursiveSchemaTemplate, FixRecursiveRecursionLimit, } from "./schemaFactoryRecursive.js";
12
12
  export { allowUnused } from "./schemaFactoryRecursive.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,YAAY,EACX,UAAU,EACV,sBAAsB,EACtB,yBAAyB,GACzB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACN,qBAAqB,EACrB,0BAA0B,GAC1B,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACX,KAAK,EACL,QAAQ,EACR,YAAY,EACZ,cAAc,EACd,yBAAyB,EACzB,aAAa,EACb,UAAU,EACV,gBAAgB,EAChB,UAAU,GACV,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EACN,aAAa,EACb,KAAK,gBAAgB,EACrB,KAAK,0BAA0B,EAC/B,KAAK,aAAa,EAClB,aAAa,GACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,YAAY,EACX,uBAAuB,EACvB,uBAAuB,EACvB,+BAA+B,EAC/B,0BAA0B,GAC1B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EACN,SAAS,EACT,eAAe,EACf,eAAe,GACf,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACN,qBAAqB,EACrB,2BAA2B,EAC3B,YAAY,EACZ,WAAW,EACX,KAAK,WAAW,EAChB,YAAY,GACZ,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;A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AAM,8BAA8B,CAAC;AACtC,OAAO,EACN,qBAAqB,EACrB,2BAA2B,EAC3B,YAAY,EACZ,WAAW,EAEX,YAAY,GACZ,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAmB/C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAU3E,OAAO,EAGN,0BAA0B,EAC1B,iBAAiB,EACjB,iBAAiB,EACjB,yBAAyB,GACzB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAEN,sBAAsB,EAGtB,sBAAsB,EACtB,cAAc,GAEd,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAEN,iBAAiB,EACjB,yBAAyB,GACzB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,QAAQ,EAAmD,MAAM,eAAe,CAAC;AAC1F,OAAO,EAAE,qBAAqB,EAAwB,MAAM,sBAAsB,CAAC;AACnF,OAAO,EACN,qBAAqB,GAErB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACN,sBAAsB,EACtB,sBAAsB,GACtB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAUN,QAAQ,GACR,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,8BAA8B,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport type {\n\tTreeSchema,\n\tITreeViewConfiguration,\n\tITreeConfigurationOptions,\n} from \"./configuration.js\";\nexport {\n\tTreeViewConfiguration,\n\tTreeViewConfigurationAlpha,\n} from \"./configuration.js\";\nexport type {\n\tITree,\n\tTreeView,\n\tViewableTree,\n\tTreeViewEvents,\n\tSchemaCompatibilityStatus,\n\tTreeViewAlpha,\n\tTreeBranch,\n\tTreeBranchEvents,\n\tITreeAlpha,\n} from \"./tree.js\";\nexport { asTreeViewAlpha } from \"./tree.js\";\nexport {\n\tSchemaFactory,\n\ttype ScopedSchemaName,\n\ttype SchemaFactoryObjectOptions,\n\ttype SchemaStatics,\n\tschemaStatics,\n} from \"./schemaFactory.js\";\nexport { SchemaFactoryAlpha } from \"./schemaFactoryAlpha.js\";\nexport type {\n\tValidateRecursiveSchema,\n\tFixRecursiveArraySchema,\n\tValidateRecursiveSchemaTemplate,\n\tFixRecursiveRecursionLimit,\n} from \"./schemaFactoryRecursive.js\";\nexport { allowUnused } from \"./schemaFactoryRecursive.js\";\nexport {\n\tadaptEnum,\n\tenumFromStrings,\n\tsingletonSchema,\n} from \"./schemaCreationUtilities.js\";\nexport {\n\tgetIdentifierFromNode,\n\tgetPropertyKeyFromStoredKey,\n\tgetStoredKey,\n\ttreeNodeApi,\n\ttype TreeNodeApi,\n\ttryGetSchema,\n} from \"./treeNodeApi.js\";\nexport { createFromCursor } from \"./create.js\";\nexport {\n\ttype JsonSchemaId,\n\ttype JsonSchemaType,\n\ttype JsonObjectNodeSchema,\n\ttype JsonArrayNodeSchema,\n\ttype JsonMapNodeSchema,\n\ttype JsonLeafNodeSchema,\n\ttype JsonSchemaRef,\n\ttype JsonRefPath,\n\ttype JsonNodeSchema,\n\ttype JsonNodeSchemaBase,\n\ttype JsonTreeSchema,\n\ttype JsonFieldSchema,\n\ttype JsonLeafSchemaType,\n\ttype JsonRecordNodeSchema,\n\ttype JsonStringKeyPatternProperties,\n} from \"./jsonSchema.js\";\nexport type { TreeSchemaEncodingOptions } from \"./getJsonSchema.js\";\nexport { getJsonSchema } from \"./getJsonSchema.js\";\nexport { getSimpleSchema } from \"./getSimpleSchema.js\";\nexport { SchemaCompatibilityTester } from \"./schemaCompatibilityTester.js\";\nexport type {\n\tUnenforced,\n\tFieldSchemaAlphaUnsafe,\n\tArrayNodeCustomizableSchemaUnsafe,\n\tMapNodeCustomizableSchemaUnsafe,\n\tSystem_Unsafe,\n\tTreeRecordNodeUnsafe,\n} from \"./typesUnsafe.js\";\n\nexport {\n\ttype VerboseTreeNode,\n\ttype VerboseTree,\n\tapplySchemaToParserOptions,\n\tcursorFromVerbose,\n\tverboseFromCursor,\n\treplaceVerboseTreeHandles,\n} from \"./verboseTree.js\";\n\nexport {\n\ttype TreeEncodingOptions,\n\tcustomFromCursorStored,\n\ttype CustomTreeNode,\n\ttype CustomTreeValue,\n\ttryStoredSchemaAsArray,\n\treplaceHandles,\n\ttype HandleConverter,\n} from \"./customTree.js\";\n\nexport {\n\ttype ConciseTree,\n\tconciseFromCursor,\n\treplaceConciseTreeHandles,\n} from \"./conciseTree.js\";\n\nexport { TreeBeta, type NodeChangedData, type TreeChangeEventsBeta } from \"./treeBeta.js\";\nexport { createSimpleTreeIndex, type SimpleTreeIndex } from \"./simpleTreeIndex.js\";\nexport {\n\tcreateIdentifierIndex,\n\ttype IdentifierIndex,\n} from \"./identifierIndex.js\";\n\nexport {\n\textractPersistedSchema,\n\tcomparePersistedSchema,\n} from \"./storedSchema.js\";\n\nexport {\n\ttype TransactionConstraint,\n\ttype NodeInDocumentConstraint,\n\ttype RunTransactionParams,\n\ttype VoidTransactionCallbackStatus,\n\ttype TransactionCallbackStatus,\n\ttype TransactionResult,\n\ttype TransactionResultExt,\n\ttype TransactionResultSuccess,\n\ttype TransactionResultFailed,\n\trollback,\n} from \"./transactionTypes.js\";\n\nexport { generateSchemaFromSimpleSchema } from \"./schemaFromSimple.js\";\nexport { toSimpleTreeSchema } from \"./viewSchemaToSimpleSchema.js\";\nexport type { TreeChangeEvents } from \"./treeChangeEvents.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/simple-tree/api/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,EACN,qBAAqB,EACrB,0BAA0B,GAC1B,MAAM,oBAAoB,CAAC;AAY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ourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport type {\n\tTreeSchema,\n\tITreeViewConfiguration,\n\tITreeConfigurationOptions,\n} from \"./configuration.js\";\nexport {\n\tTreeViewConfiguration,\n\tTreeViewConfigurationAlpha,\n} from \"./configuration.js\";\nexport type {\n\tITree,\n\tTreeView,\n\tViewableTree,\n\tTreeViewEvents,\n\tSchemaCompatibilityStatus,\n\tTreeViewAlpha,\n\tTreeBranch,\n\tTreeBranchEvents,\n\tITreeAlpha,\n} from \"./tree.js\";\nexport { asTreeViewAlpha } from \"./tree.js\";\nexport {\n\tSchemaFactory,\n\ttype ScopedSchemaName,\n\ttype SchemaFactoryObjectOptions,\n\ttype SchemaStatics,\n\tschemaStatics,\n\ttype NodeSchemaOptions,\n\ttype NodeSchemaOptionsAlpha,\n} from \"./schemaFactory.js\";\nexport { SchemaFactoryAlpha } from \"./schemaFactoryAlpha.js\";\nexport type {\n\tValidateRecursiveSchema,\n\tFixRecursiveArraySchema,\n\tValidateRecursiveSchemaTemplate,\n\tFixRecursiveRecursionLimit,\n} from \"./schemaFactoryRecursive.js\";\nexport { allowUnused } from \"./schemaFactoryRecursive.js\";\nexport {\n\tadaptEnum,\n\tenumFromStrings,\n\tsingletonSchema,\n} from \"./schemaCreationUtilities.js\";\nexport {\n\tgetIdentifierFromNode,\n\tgetPropertyKeyFromStoredKey,\n\tgetStoredKey,\n\ttreeNodeApi,\n\ttype TreeNodeApi,\n\ttryGetSchema,\n} from \"./treeNodeApi.js\";\nexport { createFromCursor } from \"./create.js\";\nexport {\n\ttype JsonSchemaId,\n\ttype JsonSchemaType,\n\ttype JsonObjectNodeSchema,\n\ttype JsonArrayNodeSchema,\n\ttype JsonMapNodeSchema,\n\ttype JsonLeafNodeSchema,\n\ttype JsonSchemaRef,\n\ttype JsonRefPath,\n\ttype JsonNodeSchema,\n\ttype JsonNodeSchemaBase,\n\ttype JsonTreeSchema,\n\ttype JsonFieldSchema,\n\ttype JsonLeafSchemaType,\n\ttype JsonRecordNodeSchema,\n\ttype JsonStringKeyPatternProperties,\n} from \"./jsonSchema.js\";\nexport type { TreeSchemaEncodingOptions } from \"./getJsonSchema.js\";\nexport { getJsonSchema } from \"./getJsonSchema.js\";\nexport { getSimpleSchema } from \"./getSimpleSchema.js\";\nexport { SchemaCompatibilityTester } from \"./schemaCompatibilityTester.js\";\nexport type {\n\tUnenforced,\n\tFieldSchemaAlphaUnsafe,\n\tArrayNodeCustomizableSchemaUnsafe,\n\tMapNodeCustomizableSchemaUnsafe,\n\tSystem_Unsafe,\n\tTreeRecordNodeUnsafe,\n} from \"./typesUnsafe.js\";\n\nexport {\n\ttype VerboseTreeNode,\n\ttype VerboseTree,\n\tapplySchemaToParserOptions,\n\tcursorFromVerbose,\n\tverboseFromCursor,\n\treplaceVerboseTreeHandles,\n} from \"./verboseTree.js\";\n\nexport {\n\ttype TreeEncodingOptions,\n\tcustomFromCursorStored,\n\ttype CustomTreeNode,\n\ttype CustomTreeValue,\n\ttryStoredSchemaAsArray,\n\treplaceHandles,\n\ttype HandleConverter,\n} from \"./customTree.js\";\n\nexport {\n\ttype ConciseTree,\n\tconciseFromCursor,\n\treplaceConciseTreeHandles,\n} from \"./conciseTree.js\";\n\nexport { TreeBeta, type NodeChangedData, type TreeChangeEventsBeta } from \"./treeBeta.js\";\nexport { createSimpleTreeIndex, type SimpleTreeIndex } from \"./simpleTreeIndex.js\";\nexport {\n\tcreateIdentifierIndex,\n\ttype IdentifierIndex,\n} from \"./identifierIndex.js\";\n\nexport {\n\textractPersistedSchema,\n\tcomparePersistedSchema,\n} from \"./storedSchema.js\";\n\nexport {\n\ttype TransactionConstraint,\n\ttype NodeInDocumentConstraint,\n\ttype RunTransactionParams,\n\ttype VoidTransactionCallbackStatus,\n\ttype TransactionCallbackStatus,\n\ttype TransactionResult,\n\ttype TransactionResultExt,\n\ttype TransactionResultSuccess,\n\ttype TransactionResultFailed,\n\trollback,\n} from \"./transactionTypes.js\";\n\nexport { generateSchemaFromSimpleSchema } from \"./schemaFromSimple.js\";\nexport { toSimpleTreeSchema } from \"./viewSchemaToSimpleSchema.js\";\nexport type { TreeChangeEvents } from \"./treeChangeEvents.js\";\n"]}
@@ -2,9 +2,9 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { AdaptedViewSchema, type Adapters, type TreeStoredSchema } from "../../core/index.js";
5
+ import type { TreeStoredSchema } from "../../core/index.js";
6
6
  import { type FullSchemaPolicy } from "../../feature-libraries/index.js";
7
- import type { FieldSchema } from "../schemaTypes.js";
7
+ import type { FieldSchema } from "../fieldSchema.js";
8
8
  import type { SchemaCompatibilityStatus } from "./tree.js";
9
9
  /**
10
10
  * A collection of View information for schema, including policy.
@@ -13,15 +13,11 @@ import type { SchemaCompatibilityStatus } from "./tree.js";
13
13
  */
14
14
  export declare class SchemaCompatibilityTester {
15
15
  readonly policy: FullSchemaPolicy;
16
- readonly adapters: Adapters;
17
- /**
18
- * Cached conversion of the view schema in the stored schema format.
19
- */
20
- readonly viewSchemaAsStored: TreeStoredSchema;
16
+ readonly viewSchemaRoot: FieldSchema;
21
17
  /**
22
18
  * @param viewSchemaRoot - Schema for the root field.
23
19
  */
24
- constructor(policy: FullSchemaPolicy, adapters: Adapters, viewSchemaRoot: FieldSchema);
20
+ constructor(policy: FullSchemaPolicy, viewSchemaRoot: FieldSchema);
25
21
  /**
26
22
  * Determines the compatibility of a stored document
27
23
  * (based on its stored schema) with a viewer (based on its view schema).
@@ -33,16 +29,5 @@ export declare class SchemaCompatibilityTester {
33
29
  * It should be wrapped with (or replaced by) a parse style API.
34
30
  */
35
31
  checkCompatibility(stored: TreeStoredSchema): Omit<SchemaCompatibilityStatus, "canInitialize">;
36
- /**
37
- * Compute a schema that `original` could be viewed as using adapters as needed.
38
- *
39
- * TODO: have a way for callers to get invalidated on schema updates.
40
- */
41
- adaptRepo(stored: TreeStoredSchema): AdaptedViewSchema;
42
- /**
43
- * Adapt original such that it allows member types which can be adapted to its specified types.
44
- */
45
- private adaptField;
46
- private adaptTree;
47
32
  }
48
33
  //# sourceMappingURL=schemaCompatibilityTester.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schemaCompatibilityTester.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/schemaCompatibilityTester.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EACN,iBAAiB,EAEjB,KAAK,QAAQ,EAGb,KAAK,gBAAgB,EACrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAEN,KAAK,gBAAgB,EAOrB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AAE3D;;;;GAIG;AACH,qBAAa,yBAAyB;aAUpB,MAAM,EAAE,gBAAgB;aACxB,QAAQ,EAAE,QAAQ;IAVnC;;OAEG;IACH,SAAgB,kBAAkB,EAAE,gBAAgB,CAAC;IAErD;;OAEG;gBAEc,MAAM,EAAE,gBAAgB,EACxB,QAAQ,EAAE,QAAQ,EAClC,cAAc,EAAE,WAAW;IAK5B;;;;;;;;;OASG;IACI,kBAAkB,CACxB,MAAM,EAAE,gBAAgB,GACtB,IAAI,CAAC,yBAAyB,EAAE,eAAe,CAAC;IAkKnD;;;;OAIG;IACI,SAAS,CAAC,MAAM,EAAE,gBAAgB,GAAG,iBAAiB;IAiC7D;;OAEG;IACH,OAAO,CAAC,UAAU;IAelB,OAAO,CAAC,SAAS;CAIjB"}
1
+ {"version":3,"file":"schemaCompatibilityTester.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/schemaCompatibilityTester.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAGN,KAAK,gBAAgB,EAErB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AAU3D;;;;GAIG;AACH,qBAAa,yBAAyB;aAKpB,MAAM,EAAE,gBAAgB;aACxB,cAAc,EAAE,WAAW;IAL5C;;OAEG;gBAEc,MAAM,EAAE,gBAAgB,EACxB,cAAc,EAAE,WAAW;IAG5C;;;;;;;;;OASG;IACI,kBAAkB,CACxB,MAAM,EAAE,gBAAgB,GACtB,IAAI,CAAC,yBAAyB,EAAE,eAAe,CAAC;CAgJnD"}
@@ -2,9 +2,9 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { unreachableCase, fail } from "@fluidframework/core-utils/internal";
6
- import { AdaptedViewSchema, } from "../../core/index.js";
7
- import { FieldKinds, getAllowedContentDiscrepancies, isNeverTree, PosetComparisonResult, fieldRealizer, comparePosetElements, } from "../../feature-libraries/index.js";
5
+ import { assert, unreachableCase } from "@fluidframework/core-utils/internal";
6
+ import { allowsRepoSuperset, FieldKinds, isNeverTree, } from "../../feature-libraries/index.js";
7
+ import { comparePosetElements, fieldRealizer, getAllowedContentDiscrepancies, PosetComparisonResult, } from "../discrepancies.js";
8
8
  import { toStoredSchema } from "../toStoredSchema.js";
9
9
  /**
10
10
  * A collection of View information for schema, including policy.
@@ -15,10 +15,9 @@ export class SchemaCompatibilityTester {
15
15
  /**
16
16
  * @param viewSchemaRoot - Schema for the root field.
17
17
  */
18
- constructor(policy, adapters, viewSchemaRoot) {
18
+ constructor(policy, viewSchemaRoot) {
19
19
  this.policy = policy;
20
- this.adapters = adapters;
21
- this.viewSchemaAsStored = toStoredSchema(viewSchemaRoot);
20
+ this.viewSchemaRoot = viewSchemaRoot;
22
21
  }
23
22
  /**
24
23
  * Determines the compatibility of a stored document
@@ -31,8 +30,6 @@ export class SchemaCompatibilityTester {
31
30
  * It should be wrapped with (or replaced by) a parse style API.
32
31
  */
33
32
  checkCompatibility(stored) {
34
- // TODO: support adapters
35
- // const adapted = this.adaptRepo(stored);
36
33
  // View schema allows a subset of documents that stored schema does, and the discrepancies are allowed by policy
37
34
  // determined by the view schema (i.e. objects with extra optional fields in the stored schema have opted into allowing this.
38
35
  // In the future, this would also include things like:
@@ -52,7 +49,7 @@ export class SchemaCompatibilityTester {
52
49
  canUpgrade = false;
53
50
  canView = false;
54
51
  }
55
- if (discrepancy.view.some((identifier) => !isNeverTree(this.policy, this.viewSchemaAsStored, this.viewSchemaAsStored.nodeSchema.get(identifier)))) {
52
+ if (discrepancy.view.length > 0) {
56
53
  // View schema has extra allowed types that the stored schema does not.
57
54
  canView = false;
58
55
  }
@@ -92,25 +89,23 @@ export class SchemaCompatibilityTester {
92
89
  unreachableCase(discrepancy);
93
90
  }
94
91
  };
95
- for (const discrepancy of getAllowedContentDiscrepancies(this.viewSchemaAsStored, stored)) {
92
+ for (const discrepancy of getAllowedContentDiscrepancies(this.viewSchemaRoot, stored)) {
96
93
  if (!canView && !canUpgrade) {
97
94
  break;
98
95
  }
99
96
  switch (discrepancy.mismatch) {
100
97
  case "nodeKind": {
101
- const viewNodeSchema = this.viewSchemaAsStored.nodeSchema.get(discrepancy.identifier);
102
98
  const storedNodeSchema = stored.nodeSchema.get(discrepancy.identifier);
103
99
  // We conservatively do not allow node types to change.
104
100
  // The only time this might be valid in the sense that the data canonically converts is converting an object node
105
101
  // to a map node over the union of all the object fields' types.
106
102
  if (discrepancy.stored === undefined) {
107
- const viewIsNever = viewNodeSchema !== undefined
108
- ? isNeverTree(this.policy, this.viewSchemaAsStored, viewNodeSchema)
109
- : true;
110
- if (!viewIsNever) {
111
- // View schema has added a node type that the stored schema doesn't know about.
112
- canView = false;
113
- }
103
+ // View schema has added a node type that the stored schema doesn't know about.
104
+ // Note that all cases which trigger this should also trigger an AllowedTypeDiscrepancy (where the type is used).
105
+ // This means this case should be redundant and could be removed in the future if there is a reason to do so
106
+ // (like simplifying enablable type support).
107
+ // See the TODO in getAllowedContentDiscrepancies.
108
+ canView = false;
114
109
  }
115
110
  else if (discrepancy.view === undefined) {
116
111
  const storedIsNever = storedNodeSchema !== undefined
@@ -118,21 +113,19 @@ export class SchemaCompatibilityTester {
118
113
  : true;
119
114
  if (!storedIsNever) {
120
115
  // Stored schema has a node type that the view schema doesn't know about.
116
+ // The design of allowUnknownOptionalFields allows adding new optional content to types,
117
+ // and the new optional content can use new types.
118
+ // Therefore this case needs to be supported for viewing.
119
+ // However, it is not supported for upgrade as the stored document must be newer (or at least more general) than the view in this case.
120
+ // The fact that there might be removed trees with a root of this type which only appears in the stored schema is why this must set canUpgrade to false.
121
121
  canUpgrade = false;
122
122
  }
123
123
  }
124
124
  else {
125
- // Node type exists in both schemas but has changed. We conservatively never allow this.
126
- const storedIsNever = storedNodeSchema !== undefined
127
- ? isNeverTree(this.policy, stored, storedNodeSchema)
128
- : true;
129
- const viewIsNever = viewNodeSchema !== undefined
130
- ? isNeverTree(this.policy, this.viewSchemaAsStored, viewNodeSchema)
131
- : true;
132
- if (!storedIsNever || !viewIsNever) {
133
- canView = false;
134
- canUpgrade = false;
135
- }
125
+ // Node type exists in both schemas but kind has changed. We conservatively never allow this.
126
+ // See note above about cases where this could be allowed if needed.
127
+ canView = false;
128
+ canUpgrade = false;
136
129
  }
137
130
  break;
138
131
  }
@@ -149,58 +142,14 @@ export class SchemaCompatibilityTester {
149
142
  // No default
150
143
  }
151
144
  }
145
+ if (canUpgrade) {
146
+ assert(allowsRepoSuperset(this.policy, stored, toStoredSchema(this.viewSchemaRoot)), 0xbf2 /* View schema must be a superset of the stored schema to allow upgrade */);
147
+ }
152
148
  return {
153
149
  canView,
154
150
  canUpgrade,
155
151
  isEquivalent: canView && canUpgrade,
156
152
  };
157
153
  }
158
- /**
159
- * Compute a schema that `original` could be viewed as using adapters as needed.
160
- *
161
- * TODO: have a way for callers to get invalidated on schema updates.
162
- */
163
- adaptRepo(stored) {
164
- // Sanity check on adapters:
165
- // it's probably a bug if they use the never types,
166
- // since there never is a reason to have a never type as an adapter input,
167
- // and its impossible for an adapter to be correctly implemented if its output type is never
168
- // (unless its input is also never).
169
- for (const adapter of this.adapters?.tree ?? []) {
170
- if (isNeverTree(this.policy, this.viewSchemaAsStored, this.viewSchemaAsStored.nodeSchema.get(adapter.output))) {
171
- fail(0xb3d /* tree adapter for stored adapter.output should not be never */);
172
- }
173
- }
174
- const adapted = {
175
- rootFieldSchema: this.adaptField(stored.rootFieldSchema),
176
- nodeSchema: new Map(),
177
- };
178
- for (const [key, schema] of stored.nodeSchema) {
179
- const adapatedTree = this.adaptTree(schema);
180
- adapted.nodeSchema.set(key, adapatedTree);
181
- }
182
- // TODO: subset these adapters to the ones that were needed/used.
183
- return new AdaptedViewSchema(this.adapters, adapted);
184
- }
185
- /**
186
- * Adapt original such that it allows member types which can be adapted to its specified types.
187
- */
188
- adaptField(original) {
189
- if (original.types !== undefined) {
190
- const types = new Set(original.types);
191
- for (const treeAdapter of this.adapters?.tree ?? []) {
192
- if (types.has(treeAdapter.input)) {
193
- types.delete(treeAdapter.input);
194
- types.add(treeAdapter.output);
195
- }
196
- }
197
- return { kind: original.kind, types, persistedMetadata: undefined };
198
- }
199
- return original;
200
- }
201
- adaptTree(original) {
202
- // TODO: support adapters like missing field adapters.
203
- return original;
204
- }
205
154
  }
206
155
  //# sourceMappingURL=schemaCompatibilityTester.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"schemaCompatibilityTester.js","sourceRoot":"","sources":["../../../src/simple-tree/api/schemaCompatibilityTester.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,qCAAqC,CAAC;AAE5E,OAAO,EACN,iBAAiB,GAMjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACN,UAAU,EAGV,8BAA8B,EAC9B,WAAW,EACX,qBAAqB,EACrB,aA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e,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,eAAe,CAAC;YACxD,UAAU,EAAE,IAAI,GAAG,EAAkD;SACrE,CAAC;QAEF,KAAK,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;YAC/C,MAAM,YAAY,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;YAC5C,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;QAC3C,CAAC;QAED,iEAAiE;QACjE,OAAO,IAAI,iBAAiB,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACtD,CAAC;IAED;;OAEG;IACK,UAAU,CAAC,QAA+B;QACjD,IAAI,QAAQ,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;YAClC,MAAM,KAAK,GAAkC,IAAI,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;YACrE,KAAK,MAAM,WAAW,IAAI,IAAI,CAAC,QAAQ,EAAE,IAAI,IAAI,EAAE,EAAE,CAAC;gBACrD,IAAI,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC;oBAClC,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;oBAChC,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;gBAC/B,CAAC;YACF,CAAC;YAED,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,CAAC;QACrE,CAAC;QACD,OAAO,QAAQ,CAAC;IACjB,CAAC;IAEO,SAAS,CAAC,QAA8B;QAC/C,sDAAsD;QACtD,OAAO,QAAQ,CAAC;IACjB,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { unreachableCase, fail } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\tAdaptedViewSchema,\n\ttype TreeNodeStoredSchema,\n\ttype Adapters,\n\ttype TreeFieldStoredSchema,\n\ttype TreeNodeSchemaIdentifier,\n\ttype TreeStoredSchema,\n} from \"../../core/index.js\";\nimport {\n\tFieldKinds,\n\ttype FullSchemaPolicy,\n\ttype FieldDiscrepancy,\n\tgetAllowedContentDiscrepancies,\n\tisNeverTree,\n\tPosetComparisonResult,\n\tfieldRealizer,\n\tcomparePosetElements,\n} from \"../../feature-libraries/index.js\";\nimport type { FieldSchema } from \"../schemaTypes.js\";\nimport { toStoredSchema } from \"../toStoredSchema.js\";\n\nimport type { SchemaCompatibilityStatus } from \"./tree.js\";\n\n/**\n * A collection of View information for schema, including policy.\n * @remarks\n * This contains everything needed to determine compatibility with a given stored schema.\n */\nexport class SchemaCompatibilityTester {\n\t/**\n\t * Cached conversion of the view schema in the stored schema format.\n\t */\n\tpublic readonly viewSchemaAsStored: TreeStoredSchema;\n\n\t/**\n\t * @param viewSchemaRoot - Schema for the root field.\n\t */\n\tpublic constructor(\n\t\tpublic readonly policy: FullSchemaPolicy,\n\t\tpublic readonly adapters: Adapters,\n\t\tviewSchemaRoot: FieldSchema,\n\t) {\n\t\tthis.viewSchemaAsStored = toStoredSchema(viewSchemaRoot);\n\t}\n\n\t/**\n\t * Determines the compatibility of a stored document\n\t * (based on its stored schema) with a viewer (based on its view schema).\n\t *\n\t * Adapters can be provided to handle differences between the two schema.\n\t * Adapters should only use to types in the `view` SchemaRepository.\n\t *\n\t * TODO: this API violates the parse don't validate design philosophy.\n\t * It should be wrapped with (or replaced by) a parse style API.\n\t */\n\tpublic checkCompatibility(\n\t\tstored: TreeStoredSchema,\n\t): Omit<SchemaCompatibilityStatus, \"canInitialize\"> {\n\t\t// TODO: support adapters\n\t\t// const adapted = this.adaptRepo(stored);\n\n\t\t// View schema allows a subset of documents that stored schema does, and the discrepancies are allowed by policy\n\t\t// determined by the view schema (i.e. objects with extra optional fields in the stored schema have opted into allowing this.\n\t\t// In the future, this would also include things like:\n\t\t// - fields with more allowed types in the stored schema than in the view schema have out-of-schema \"unknown content\" adapters\n\t\tlet canView = true;\n\t\t// View schema allows a superset of documents that stored schema does, hence the document could be upgraded to use a persisted version\n\t\t// of this view schema as its stored schema.\n\t\tlet canUpgrade = true;\n\n\t\tconst updateCompatibilityFromFieldDiscrepancy = (discrepancy: FieldDiscrepancy): void => {\n\t\t\tswitch (discrepancy.mismatch) {\n\t\t\t\tcase \"allowedTypes\": {\n\t\t\t\t\t// Since we only track the symmetric difference between the allowed types in the view and\n\t\t\t\t\t// stored schemas, it's sufficient to check if any extra allowed types still exist in the\n\t\t\t\t\t// stored schema.\n\t\t\t\t\tif (\n\t\t\t\t\t\tdiscrepancy.stored.some(\n\t\t\t\t\t\t\t(identifier) =>\n\t\t\t\t\t\t\t\t!isNeverTree(this.policy, stored, stored.nodeSchema.get(identifier)),\n\t\t\t\t\t\t)\n\t\t\t\t\t) {\n\t\t\t\t\t\t// Stored schema has extra allowed types that the view schema does not.\n\t\t\t\t\t\tcanUpgrade = false;\n\t\t\t\t\t\tcanView = false;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (\n\t\t\t\t\t\tdiscrepancy.view.some(\n\t\t\t\t\t\t\t(identifier) =>\n\t\t\t\t\t\t\t\t!isNeverTree(\n\t\t\t\t\t\t\t\t\tthis.policy,\n\t\t\t\t\t\t\t\t\tthis.viewSchemaAsStored,\n\t\t\t\t\t\t\t\t\tthis.viewSchemaAsStored.nodeSchema.get(identifier),\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t)\n\t\t\t\t\t) {\n\t\t\t\t\t\t// View schema has extra allowed types that the stored schema does not.\n\t\t\t\t\t\tcanView = false;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"fieldKind\": {\n\t\t\t\t\tconst result = comparePosetElements(\n\t\t\t\t\t\tdiscrepancy.stored,\n\t\t\t\t\t\tdiscrepancy.view,\n\t\t\t\t\t\tfieldRealizer,\n\t\t\t\t\t);\n\n\t\t\t\t\tif (result === PosetComparisonResult.Greater) {\n\t\t\t\t\t\t// Stored schema is more relaxed than view schema.\n\t\t\t\t\t\tcanUpgrade = false;\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tdiscrepancy.view === FieldKinds.forbidden.identifier &&\n\t\t\t\t\t\t\tdiscrepancy.identifier !== undefined &&\n\t\t\t\t\t\t\tthis.policy.allowUnknownOptionalFields(discrepancy.identifier)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t// When the application has opted into it, we allow viewing documents which have additional\n\t\t\t\t\t\t\t// optional fields in the stored schema that are not present in the view schema.\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tcanView = false;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (result === PosetComparisonResult.Less) {\n\t\t\t\t\t\t// View schema is more relaxed than stored schema.\n\t\t\t\t\t\tcanView = false;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (result === PosetComparisonResult.Incomparable) {\n\t\t\t\t\t\tcanUpgrade = false;\n\t\t\t\t\t\tcanView = false;\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"valueSchema\": {\n\t\t\t\t\tcanView = false;\n\t\t\t\t\tcanUpgrade = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tunreachableCase(discrepancy);\n\t\t\t}\n\t\t};\n\n\t\tfor (const discrepancy of getAllowedContentDiscrepancies(\n\t\t\tthis.viewSchemaAsStored,\n\t\t\tstored,\n\t\t)) {\n\t\t\tif (!canView && !canUpgrade) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tswitch (discrepancy.mismatch) {\n\t\t\t\tcase \"nodeKind\": {\n\t\t\t\t\tconst viewNodeSchema = this.viewSchemaAsStored.nodeSchema.get(\n\t\t\t\t\t\tdiscrepancy.identifier,\n\t\t\t\t\t);\n\t\t\t\t\tconst storedNodeSchema = stored.nodeSchema.get(discrepancy.identifier);\n\t\t\t\t\t// We conservatively do not allow node types to change.\n\t\t\t\t\t// The only time this might be valid in the sense that the data canonically converts is converting an object node\n\t\t\t\t\t// to a map node over the union of all the object fields' types.\n\t\t\t\t\tif (discrepancy.stored === undefined) {\n\t\t\t\t\t\tconst viewIsNever =\n\t\t\t\t\t\t\tviewNodeSchema !== undefined\n\t\t\t\t\t\t\t\t? isNeverTree(this.policy, this.viewSchemaAsStored, viewNodeSchema)\n\t\t\t\t\t\t\t\t: true;\n\t\t\t\t\t\tif (!viewIsNever) {\n\t\t\t\t\t\t\t// View schema has added a node type that the stored schema doesn't know about.\n\t\t\t\t\t\t\tcanView = false;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (discrepancy.view === undefined) {\n\t\t\t\t\t\tconst storedIsNever =\n\t\t\t\t\t\t\tstoredNodeSchema !== undefined\n\t\t\t\t\t\t\t\t? isNeverTree(this.policy, stored, storedNodeSchema)\n\t\t\t\t\t\t\t\t: true;\n\t\t\t\t\t\tif (!storedIsNever) {\n\t\t\t\t\t\t\t// Stored schema has a node type that the view schema doesn't know about.\n\t\t\t\t\t\t\tcanUpgrade = false;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Node type exists in both schemas but has changed. We conservatively never allow this.\n\t\t\t\t\t\tconst storedIsNever =\n\t\t\t\t\t\t\tstoredNodeSchema !== undefined\n\t\t\t\t\t\t\t\t? isNeverTree(this.policy, stored, storedNodeSchema)\n\t\t\t\t\t\t\t\t: true;\n\t\t\t\t\t\tconst viewIsNever =\n\t\t\t\t\t\t\tviewNodeSchema !== undefined\n\t\t\t\t\t\t\t\t? isNeverTree(this.policy, this.viewSchemaAsStored, viewNodeSchema)\n\t\t\t\t\t\t\t\t: true;\n\t\t\t\t\t\tif (!storedIsNever || !viewIsNever) {\n\t\t\t\t\t\t\tcanView = false;\n\t\t\t\t\t\t\tcanUpgrade = false;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"valueSchema\":\n\t\t\t\tcase \"allowedTypes\":\n\t\t\t\tcase \"fieldKind\": {\n\t\t\t\t\tupdateCompatibilityFromFieldDiscrepancy(discrepancy);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"fields\": {\n\t\t\t\t\tdiscrepancy.differences.forEach(updateCompatibilityFromFieldDiscrepancy);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t// No default\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\tcanView,\n\t\t\tcanUpgrade,\n\t\t\tisEquivalent: canView && canUpgrade,\n\t\t};\n\t}\n\n\t/**\n\t * Compute a schema that `original` could be viewed as using adapters as needed.\n\t *\n\t * TODO: have a way for callers to get invalidated on schema updates.\n\t */\n\tpublic adaptRepo(stored: TreeStoredSchema): AdaptedViewSchema {\n\t\t// Sanity check on adapters:\n\t\t// it's probably a bug if they use the never types,\n\t\t// since there never is a reason to have a never type as an adapter input,\n\t\t// and its impossible for an adapter to be correctly implemented if its output type is never\n\t\t// (unless its input is also never).\n\n\t\tfor (const adapter of this.adapters?.tree ?? []) {\n\t\t\tif (\n\t\t\t\tisNeverTree(\n\t\t\t\t\tthis.policy,\n\t\t\t\t\tthis.viewSchemaAsStored,\n\t\t\t\t\tthis.viewSchemaAsStored.nodeSchema.get(adapter.output),\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\tfail(0xb3d /* tree adapter for stored adapter.output should not be never */);\n\t\t\t}\n\t\t}\n\n\t\tconst adapted = {\n\t\t\trootFieldSchema: this.adaptField(stored.rootFieldSchema),\n\t\t\tnodeSchema: new Map<TreeNodeSchemaIdentifier, TreeNodeStoredSchema>(),\n\t\t};\n\n\t\tfor (const [key, schema] of stored.nodeSchema) {\n\t\t\tconst adapatedTree = this.adaptTree(schema);\n\t\t\tadapted.nodeSchema.set(key, adapatedTree);\n\t\t}\n\n\t\t// TODO: subset these adapters to the ones that were needed/used.\n\t\treturn new AdaptedViewSchema(this.adapters, adapted);\n\t}\n\n\t/**\n\t * Adapt original such that it allows member types which can be adapted to its specified types.\n\t */\n\tprivate adaptField(original: TreeFieldStoredSchema): TreeFieldStoredSchema {\n\t\tif (original.types !== undefined) {\n\t\t\tconst types: Set<TreeNodeSchemaIdentifier> = new Set(original.types);\n\t\t\tfor (const treeAdapter of this.adapters?.tree ?? []) {\n\t\t\t\tif (types.has(treeAdapter.input)) {\n\t\t\t\t\ttypes.delete(treeAdapter.input);\n\t\t\t\t\ttypes.add(treeAdapter.output);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn { kind: original.kind, types, persistedMetadata: undefined };\n\t\t}\n\t\treturn original;\n\t}\n\n\tprivate adaptTree(original: TreeNodeStoredSchema): TreeNodeStoredSchema {\n\t\t// TODO: support adapters like missing field adapters.\n\t\treturn original;\n\t}\n}\n"]}
1
+ {"version":3,"file":"schemaCompatibilityTester.js","sourceRoot":"","sources":["../../../src/simple-tree/api/schemaCompatibilityTester.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAG9E,OAAO,EACN,kBAAkB,EAClB,UAAU,EAEV,WAAW,GACX,MAAM,kCAAkC,CAAC;AAI1C,OAAO,EACN,oBAAoB,EACpB,aAAa,EACb,8BAA8B,EAC9B,qBAAqB,GAErB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD;;;;GAIG;AACH,MAAM,OAAO,yBAAyB;IACrC;;OAEG;IACH,YACiB,MAAwB,EACxB,cAA2B;QAD3B,WAAM,GAAN,MAAM,CAAkB;QACxB,mBAAc,GAAd,cAAc,CAAa;IACzC,CAAC;IAEJ;;;;;;;;;OASG;IACI,kBAAkB,CACxB,MAAwB;Q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BAAgB,KAAK,SAAS;4BAC7B,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,gBAAgB,CAAC;4BACpD,CAAC,CAAC,IAAI,CAAC;wBACT,IAAI,CAAC,aAAa,EAAE,CAAC;4BACpB,yEAAyE;4BACzE,wFAAwF;4BACxF,kDAAkD;4BAClD,yDAAyD;4BACzD,uIAAuI;4BACvI,wJAAwJ;4BACxJ,UAAU,GAAG,KAAK,CAAC;wBACpB,CAAC;oBACF,CAAC;yBAAM,CAAC;wBACP,6FAA6F;wBAC7F,oEAAoE;wBACpE,OAAO,GAAG,KAAK,CAAC;wBAChB,UAAU,GAAG,KAAK,CAAC;oBACpB,CAAC;oBACD,MAAM;gBACP,CAAC;gBACD,KAAK,aAAa,CAAC;gBACnB,KAAK,cAAc,CAAC;gBACpB,KAAK,WAAW,CAAC,CAAC,CAAC;oBAClB,uCAAuC,CAAC,WAAW,CAAC,CAAC;oBACrD,MAAM;gBACP,CAAC;gBACD,KAAK,QAAQ,CAAC,CAAC,CAAC;oBACf,WAAW,CAAC,WAAW,CAAC,OAAO,CAAC,uCAAuC,CAAC,CAAC;oBACzE,MAAM;gBACP,CAAC;gBACD,aAAa;YACd,CAAC;QACF,CAAC;QAED,IAAI,UAAU,EAAE,CAAC;YAChB,MAAM,CACL,kBAAkB,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,cAAc,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,EAC5E,KAAK,CAAC,0EAA0E,CAChF,CAAC;QACH,CAAC;QAED,OAAO;YACN,OAAO;YACP,UAAU;YACV,YAAY,EAAE,OAAO,IAAI,UAAU;SACnC,CAAC;IACH,CAAC;CACD","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\nimport type { TreeStoredSchema } from \"../../core/index.js\";\nimport {\n\tallowsRepoSuperset,\n\tFieldKinds,\n\ttype FullSchemaPolicy,\n\tisNeverTree,\n} from \"../../feature-libraries/index.js\";\nimport type { FieldSchema } from \"../fieldSchema.js\";\n\nimport type { SchemaCompatibilityStatus } from \"./tree.js\";\nimport {\n\tcomparePosetElements,\n\tfieldRealizer,\n\tgetAllowedContentDiscrepancies,\n\tPosetComparisonResult,\n\ttype FieldDiscrepancy,\n} from \"../discrepancies.js\";\nimport { toStoredSchema } from \"../toStoredSchema.js\";\n\n/**\n * A collection of View information for schema, including policy.\n * @remarks\n * This contains everything needed to determine compatibility with a given stored schema.\n */\nexport class SchemaCompatibilityTester {\n\t/**\n\t * @param viewSchemaRoot - Schema for the root field.\n\t */\n\tpublic constructor(\n\t\tpublic readonly policy: FullSchemaPolicy,\n\t\tpublic readonly viewSchemaRoot: FieldSchema,\n\t) {}\n\n\t/**\n\t * Determines the compatibility of a stored document\n\t * (based on its stored schema) with a viewer (based on its view schema).\n\t *\n\t * Adapters can be provided to handle differences between the two schema.\n\t * Adapters should only use to types in the `view` SchemaRepository.\n\t *\n\t * TODO: this API violates the parse don't validate design philosophy.\n\t * It should be wrapped with (or replaced by) a parse style API.\n\t */\n\tpublic checkCompatibility(\n\t\tstored: TreeStoredSchema,\n\t): Omit<SchemaCompatibilityStatus, \"canInitialize\"> {\n\t\t// View schema allows a subset of documents that stored schema does, and the discrepancies are allowed by policy\n\t\t// determined by the view schema (i.e. objects with extra optional fields in the stored schema have opted into allowing this.\n\t\t// In the future, this would also include things like:\n\t\t// - fields with more allowed types in the stored schema than in the view schema have out-of-schema \"unknown content\" adapters\n\t\tlet canView = true;\n\t\t// View schema allows a superset of documents that stored schema does, hence the document could be upgraded to use a persisted version\n\t\t// of this view schema as its stored schema.\n\t\tlet canUpgrade = true;\n\n\t\tconst updateCompatibilityFromFieldDiscrepancy = (discrepancy: FieldDiscrepancy): void => {\n\t\t\tswitch (discrepancy.mismatch) {\n\t\t\t\tcase \"allowedTypes\": {\n\t\t\t\t\t// Since we only track the symmetric difference between the allowed types in the view and\n\t\t\t\t\t// stored schemas, it's sufficient to check if any extra allowed types still exist in the\n\t\t\t\t\t// stored schema.\n\t\t\t\t\tif (\n\t\t\t\t\t\tdiscrepancy.stored.some(\n\t\t\t\t\t\t\t(identifier) =>\n\t\t\t\t\t\t\t\t!isNeverTree(this.policy, stored, stored.nodeSchema.get(identifier)),\n\t\t\t\t\t\t)\n\t\t\t\t\t) {\n\t\t\t\t\t\t// Stored schema has extra allowed types that the view schema does not.\n\t\t\t\t\t\tcanUpgrade = false;\n\t\t\t\t\t\tcanView = false;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (discrepancy.view.length > 0) {\n\t\t\t\t\t\t// View schema has extra allowed types that the stored schema does not.\n\t\t\t\t\t\tcanView = false;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"fieldKind\": {\n\t\t\t\t\tconst result = comparePosetElements(\n\t\t\t\t\t\tdiscrepancy.stored,\n\t\t\t\t\t\tdiscrepancy.view,\n\t\t\t\t\t\tfieldRealizer,\n\t\t\t\t\t);\n\n\t\t\t\t\tif (result === PosetComparisonResult.Greater) {\n\t\t\t\t\t\t// Stored schema is more relaxed than view schema.\n\t\t\t\t\t\tcanUpgrade = false;\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tdiscrepancy.view === FieldKinds.forbidden.identifier &&\n\t\t\t\t\t\t\tdiscrepancy.identifier !== undefined &&\n\t\t\t\t\t\t\tthis.policy.allowUnknownOptionalFields(discrepancy.identifier)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t// When the application has opted into it, we allow viewing documents which have additional\n\t\t\t\t\t\t\t// optional fields in the stored schema that are not present in the view schema.\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tcanView = false;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (result === PosetComparisonResult.Less) {\n\t\t\t\t\t\t// View schema is more relaxed than stored schema.\n\t\t\t\t\t\tcanView = false;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (result === PosetComparisonResult.Incomparable) {\n\t\t\t\t\t\tcanUpgrade = false;\n\t\t\t\t\t\tcanView = false;\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"valueSchema\": {\n\t\t\t\t\tcanView = false;\n\t\t\t\t\tcanUpgrade = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tunreachableCase(discrepancy);\n\t\t\t}\n\t\t};\n\n\t\tfor (const discrepancy of getAllowedContentDiscrepancies(this.viewSchemaRoot, stored)) {\n\t\t\tif (!canView && !canUpgrade) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tswitch (discrepancy.mismatch) {\n\t\t\t\tcase \"nodeKind\": {\n\t\t\t\t\tconst storedNodeSchema = stored.nodeSchema.get(discrepancy.identifier);\n\t\t\t\t\t// We conservatively do not allow node types to change.\n\t\t\t\t\t// The only time this might be valid in the sense that the data canonically converts is converting an object node\n\t\t\t\t\t// to a map node over the union of all the object fields' types.\n\t\t\t\t\tif (discrepancy.stored === undefined) {\n\t\t\t\t\t\t// View schema has added a node type that the stored schema doesn't know about.\n\t\t\t\t\t\t// Note that all cases which trigger this should also trigger an AllowedTypeDiscrepancy (where the type is used).\n\t\t\t\t\t\t// This means this case should be redundant and could be removed in the future if there is a reason to do so\n\t\t\t\t\t\t// (like simplifying enablable type support).\n\t\t\t\t\t\t// See the TODO in getAllowedContentDiscrepancies.\n\t\t\t\t\t\tcanView = false;\n\t\t\t\t\t} else if (discrepancy.view === undefined) {\n\t\t\t\t\t\tconst storedIsNever =\n\t\t\t\t\t\t\tstoredNodeSchema !== undefined\n\t\t\t\t\t\t\t\t? isNeverTree(this.policy, stored, storedNodeSchema)\n\t\t\t\t\t\t\t\t: true;\n\t\t\t\t\t\tif (!storedIsNever) {\n\t\t\t\t\t\t\t// Stored schema has a node type that the view schema doesn't know about.\n\t\t\t\t\t\t\t// The design of allowUnknownOptionalFields allows adding new optional content to types,\n\t\t\t\t\t\t\t// and the new optional content can use new types.\n\t\t\t\t\t\t\t// Therefore this case needs to be supported for viewing.\n\t\t\t\t\t\t\t// However, it is not supported for upgrade as the stored document must be newer (or at least more general) than the view in this case.\n\t\t\t\t\t\t\t// The fact that there might be removed trees with a root of this type which only appears in the stored schema is why this must set canUpgrade to false.\n\t\t\t\t\t\t\tcanUpgrade = false;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Node type exists in both schemas but kind has changed. We conservatively never allow this.\n\t\t\t\t\t\t// See note above about cases where this could be allowed if needed.\n\t\t\t\t\t\tcanView = false;\n\t\t\t\t\t\tcanUpgrade = false;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"valueSchema\":\n\t\t\t\tcase \"allowedTypes\":\n\t\t\t\tcase \"fieldKind\": {\n\t\t\t\t\tupdateCompatibilityFromFieldDiscrepancy(discrepancy);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"fields\": {\n\t\t\t\t\tdiscrepancy.differences.forEach(updateCompatibilityFromFieldDiscrepancy);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t// No default\n\t\t\t}\n\t\t}\n\n\t\tif (canUpgrade) {\n\t\t\tassert(\n\t\t\t\tallowsRepoSuperset(this.policy, stored, toStoredSchema(this.viewSchemaRoot)),\n\t\t\t\t0xbf2 /* View schema must be a superset of the stored schema to allow upgrade */,\n\t\t\t);\n\t\t}\n\n\t\treturn {\n\t\t\tcanView,\n\t\t\tcanUpgrade,\n\t\t\tisEquivalent: canView && canUpgrade,\n\t\t};\n\t}\n}\n"]}
@@ -18,10 +18,16 @@ export declare function singletonSchema<TScope extends string, TName extends str
18
18
  }, Record<string, never>, true, Record<string, never>, undefined>;
19
19
  /**
20
20
  * Converts an enum into a collection of schema which can be used in a union.
21
+ *
22
+ * @typeParam TScope - The scope of the provided factory.
23
+ * There is a known issue where if a factory is provided that is typed as a {@link SchemaFactoryAlpha}, and its scope contains a "." character,
24
+ * the inferred type for the scope will end up as a union of the scope up to the first "." character and the scope as it should be.
25
+ * This can be mitigated by explicitly providing the TScope type parameter or by typing the provided factory as a {@link SchemaFactory} instead of a {@link SchemaFactoryAlpha}.
26
+ *
21
27
  * @remarks
22
28
  * The string value of the enum is used as the name of the schema: callers must ensure that it is stable and unique.
23
29
  * Numeric enums values have the value implicitly converted into a string.
24
- * Consider making a dedicated schema factory with a nested scope to avoid the enum members colliding with other schema.
30
+ * Consider making a dedicated schema factory with a nested scope (for example using {@link SchemaFactoryAlpha.scopedFactory}) to avoid the enum members colliding with other schema.
25
31
  * @example
26
32
  * ```typescript
27
33
  * const schemaFactory = new SchemaFactory("com.myApp");
@@ -52,7 +58,8 @@ export declare function singletonSchema<TScope extends string, TName extends str
52
58
  * }
53
59
  * ```
54
60
  * @privateRemarks
55
- * Maybe provide `SchemaFactory.nested` to ease creating nested scopes?
61
+ * TODO: AB#43345: see TScope known issue above, and other references to this work item.
62
+ *
56
63
  * @see {@link enumFromStrings} for a similar function that works on arrays of strings instead of an enum.
57
64
  * @beta
58
65
  */
@@ -65,6 +72,11 @@ export declare function adaptEnum<TScope extends string, const TEnum extends Rec
65
72
  readonly value: TEnum[Property];
66
73
  }, Record<string, never>, true, Record<string, never>, undefined>; }[keyof TEnum]>;
67
74
  };
75
+ /**
76
+ * Returns en "entries" (like Object.entries) for an enum object, omitting the
77
+ * {@link https://www.typescriptlang.org/docs/handbook/enums.html#reverse-mappings|reverse mappings}
78
+ */
79
+ export declare function enumEntries(enumObject: Record<string, string | number>): [string, string | number][];
68
80
  /**
69
81
  * Converts an array of distinct strings into a collection of schema which can be used like an enum style union.
70
82
  * @remarks
@@ -1 +1 @@
1
- {"version":3,"file":"schemaCreationUtilities.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/schemaCreationUtilities.ts"],"names":[],"mappings":"AAAA;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