@fluidframework/tree 2.50.0 → 2.51.0-347100

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 (597) hide show
  1. package/.vscode/Tree.code-workspace +14 -1
  2. package/.vscode/settings.json +16 -0
  3. package/CHANGELOG.md +2 -2
  4. package/api-report/tree.alpha.api.md +7 -7
  5. package/dist/core/schema-stored/schema.d.ts +14 -1
  6. package/dist/core/schema-stored/schema.d.ts.map +1 -1
  7. package/dist/core/schema-stored/schema.js.map +1 -1
  8. package/dist/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
  9. package/dist/feature-libraries/default-schema/schemaChecker.js +3 -0
  10. package/dist/feature-libraries/default-schema/schemaChecker.js.map +1 -1
  11. package/dist/feature-libraries/flex-tree/context.d.ts +7 -2
  12. package/dist/feature-libraries/flex-tree/context.d.ts.map +1 -1
  13. package/dist/feature-libraries/flex-tree/context.js +4 -4
  14. package/dist/feature-libraries/flex-tree/context.js.map +1 -1
  15. package/dist/feature-libraries/flex-tree/index.d.ts +1 -0
  16. package/dist/feature-libraries/flex-tree/index.d.ts.map +1 -1
  17. package/dist/feature-libraries/flex-tree/index.js +3 -1
  18. package/dist/feature-libraries/flex-tree/index.js.map +1 -1
  19. package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  20. package/dist/feature-libraries/flex-tree/lazyField.js +5 -5
  21. package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
  22. package/dist/feature-libraries/flex-tree/lazyNode.d.ts +3 -1
  23. package/dist/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  24. package/dist/feature-libraries/flex-tree/lazyNode.js +5 -3
  25. package/dist/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  26. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  27. package/dist/feature-libraries/forest-summary/forestSummarizer.js +3 -4
  28. package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  29. package/dist/feature-libraries/index.d.ts +1 -1
  30. package/dist/feature-libraries/index.d.ts.map +1 -1
  31. package/dist/feature-libraries/index.js +2 -1
  32. package/dist/feature-libraries/index.js.map +1 -1
  33. package/dist/packageVersion.d.ts +1 -1
  34. package/dist/packageVersion.d.ts.map +1 -1
  35. package/dist/packageVersion.js +1 -1
  36. package/dist/packageVersion.js.map +1 -1
  37. package/dist/shared-tree/index.d.ts +0 -1
  38. package/dist/shared-tree/index.d.ts.map +1 -1
  39. package/dist/shared-tree/index.js +1 -3
  40. package/dist/shared-tree/index.js.map +1 -1
  41. package/dist/shared-tree/schematizeTree.d.ts.map +1 -1
  42. package/dist/shared-tree/schematizeTree.js +2 -6
  43. package/dist/shared-tree/schematizeTree.js.map +1 -1
  44. package/dist/shared-tree/schematizingTreeView.d.ts +11 -13
  45. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  46. package/dist/shared-tree/schematizingTreeView.js +58 -81
  47. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  48. package/dist/shared-tree/sharedTreeChangeTypes.d.ts +1 -1
  49. package/dist/shared-tree/sharedTreeChangeTypes.js.map +1 -1
  50. package/dist/shared-tree/tree.d.ts.map +1 -1
  51. package/dist/shared-tree/tree.js +4 -3
  52. package/dist/shared-tree/tree.js.map +1 -1
  53. package/dist/shared-tree/treeAlpha.d.ts +7 -1
  54. package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
  55. package/dist/shared-tree/treeAlpha.js.map +1 -1
  56. package/dist/shared-tree/treeCheckout.d.ts +7 -2
  57. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  58. package/dist/shared-tree/treeCheckout.js +4 -1
  59. package/dist/shared-tree/treeCheckout.js.map +1 -1
  60. package/dist/simple-tree/api/conciseTree.d.ts +1 -1
  61. package/dist/simple-tree/api/conciseTree.d.ts.map +1 -1
  62. package/dist/simple-tree/api/conciseTree.js.map +1 -1
  63. package/dist/simple-tree/api/configuration.d.ts +1 -1
  64. package/dist/simple-tree/api/configuration.d.ts.map +1 -1
  65. package/dist/simple-tree/api/configuration.js +5 -5
  66. package/dist/simple-tree/api/configuration.js.map +1 -1
  67. package/dist/simple-tree/api/create.d.ts +3 -1
  68. package/dist/simple-tree/api/create.d.ts.map +1 -1
  69. package/dist/simple-tree/api/create.js +2 -0
  70. package/dist/simple-tree/api/create.js.map +1 -1
  71. package/dist/simple-tree/api/customTree.d.ts +1 -2
  72. package/dist/simple-tree/api/customTree.d.ts.map +1 -1
  73. package/dist/simple-tree/api/customTree.js.map +1 -1
  74. package/dist/simple-tree/api/getJsonSchema.d.ts +1 -1
  75. package/dist/simple-tree/api/getJsonSchema.d.ts.map +1 -1
  76. package/dist/simple-tree/api/getJsonSchema.js.map +1 -1
  77. package/dist/simple-tree/api/getSimpleSchema.d.ts +1 -1
  78. package/dist/simple-tree/api/getSimpleSchema.js.map +1 -1
  79. package/dist/simple-tree/api/identifierIndex.d.ts +1 -1
  80. package/dist/simple-tree/api/identifierIndex.js +2 -2
  81. package/dist/simple-tree/api/identifierIndex.js.map +1 -1
  82. package/dist/simple-tree/api/index.d.ts +1 -1
  83. package/dist/simple-tree/api/index.d.ts.map +1 -1
  84. package/dist/simple-tree/api/index.js.map +1 -1
  85. package/dist/simple-tree/api/schemaCompatibilityTester.d.ts +1 -1
  86. package/dist/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
  87. package/dist/simple-tree/api/schemaCreationUtilities.d.ts +14 -2
  88. package/dist/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -1
  89. package/dist/simple-tree/api/schemaCreationUtilities.js +41 -4
  90. package/dist/simple-tree/api/schemaCreationUtilities.js.map +1 -1
  91. package/dist/simple-tree/api/schemaFactory.d.ts +36 -3
  92. package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
  93. package/dist/simple-tree/api/schemaFactory.js +18 -18
  94. package/dist/simple-tree/api/schemaFactory.js.map +1 -1
  95. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +16 -16
  96. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  97. package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  98. package/dist/simple-tree/api/schemaFactoryRecursive.d.ts +2 -2
  99. package/dist/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
  100. package/dist/simple-tree/api/schemaFactoryRecursive.js +2 -2
  101. package/dist/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
  102. package/dist/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
  103. package/dist/simple-tree/api/schemaFromSimple.js +4 -4
  104. package/dist/simple-tree/api/schemaFromSimple.js.map +1 -1
  105. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js +2 -2
  106. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  107. package/dist/simple-tree/api/simpleTreeIndex.d.ts +2 -2
  108. package/dist/simple-tree/api/simpleTreeIndex.d.ts.map +1 -1
  109. package/dist/simple-tree/api/simpleTreeIndex.js +1 -1
  110. package/dist/simple-tree/api/simpleTreeIndex.js.map +1 -1
  111. package/dist/simple-tree/api/storedSchema.d.ts +1 -1
  112. package/dist/simple-tree/api/storedSchema.js +2 -2
  113. package/dist/simple-tree/api/storedSchema.js.map +1 -1
  114. package/dist/simple-tree/api/tree.d.ts +2 -1
  115. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  116. package/dist/simple-tree/api/tree.js.map +1 -1
  117. package/dist/simple-tree/api/treeBeta.d.ts +4 -1
  118. package/dist/simple-tree/api/treeBeta.d.ts.map +1 -1
  119. package/dist/simple-tree/api/treeBeta.js.map +1 -1
  120. package/dist/simple-tree/api/treeNodeApi.d.ts +1 -2
  121. package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  122. package/dist/simple-tree/api/treeNodeApi.js +3 -3
  123. package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
  124. package/dist/simple-tree/api/typesUnsafe.d.ts +2 -3
  125. package/dist/simple-tree/api/typesUnsafe.d.ts.map +1 -1
  126. package/dist/simple-tree/api/typesUnsafe.js.map +1 -1
  127. package/dist/simple-tree/api/verboseTree.d.ts +2 -1
  128. package/dist/simple-tree/api/verboseTree.d.ts.map +1 -1
  129. package/dist/simple-tree/api/verboseTree.js.map +1 -1
  130. package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts +1 -1
  131. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js +2 -2
  132. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
  133. package/dist/simple-tree/core/allowedTypes.d.ts +316 -0
  134. package/dist/simple-tree/core/allowedTypes.d.ts.map +1 -0
  135. package/dist/simple-tree/core/allowedTypes.js +173 -0
  136. package/dist/simple-tree/core/allowedTypes.js.map +1 -0
  137. package/dist/simple-tree/core/context.d.ts +3 -9
  138. package/dist/simple-tree/core/context.d.ts.map +1 -1
  139. package/dist/simple-tree/core/context.js +3 -11
  140. package/dist/simple-tree/core/context.js.map +1 -1
  141. package/dist/simple-tree/core/flexList.d.ts.map +1 -0
  142. package/dist/simple-tree/core/flexList.js.map +1 -0
  143. package/dist/simple-tree/core/getOrCreateNode.d.ts +1 -1
  144. package/dist/simple-tree/core/getOrCreateNode.d.ts.map +1 -1
  145. package/dist/simple-tree/core/getOrCreateNode.js.map +1 -1
  146. package/dist/simple-tree/core/index.d.ts +9 -3
  147. package/dist/simple-tree/core/index.d.ts.map +1 -1
  148. package/dist/simple-tree/core/index.js +19 -3
  149. package/dist/simple-tree/core/index.js.map +1 -1
  150. package/dist/simple-tree/core/treeNodeKernel.d.ts +8 -1
  151. package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  152. package/dist/simple-tree/core/treeNodeKernel.js +24 -20
  153. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
  154. package/dist/simple-tree/core/treeNodeSchema.d.ts +182 -39
  155. package/dist/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  156. package/dist/simple-tree/core/treeNodeSchema.js +47 -17
  157. package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
  158. package/dist/simple-tree/{treeNodeValid.d.ts → core/treeNodeValid.d.ts} +18 -4
  159. package/dist/simple-tree/core/treeNodeValid.d.ts.map +1 -0
  160. package/dist/simple-tree/{treeNodeValid.js → core/treeNodeValid.js} +41 -11
  161. package/dist/simple-tree/core/treeNodeValid.js.map +1 -0
  162. package/dist/simple-tree/core/unhydratedFlexTree.d.ts +1 -1
  163. package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  164. package/dist/simple-tree/core/walkSchema.d.ts +2 -1
  165. package/dist/simple-tree/core/walkSchema.d.ts.map +1 -1
  166. package/dist/simple-tree/core/walkSchema.js +6 -2
  167. package/dist/simple-tree/core/walkSchema.js.map +1 -1
  168. package/dist/simple-tree/createContext.d.ts +6 -2
  169. package/dist/simple-tree/createContext.d.ts.map +1 -1
  170. package/dist/simple-tree/createContext.js +15 -3
  171. package/dist/simple-tree/createContext.js.map +1 -1
  172. package/dist/simple-tree/fieldSchema.d.ts +423 -0
  173. package/dist/simple-tree/fieldSchema.d.ts.map +1 -0
  174. package/dist/simple-tree/{schemaTypes.js → fieldSchema.js} +5 -195
  175. package/dist/simple-tree/fieldSchema.js.map +1 -0
  176. package/dist/simple-tree/index.d.ts +5 -5
  177. package/dist/simple-tree/index.d.ts.map +1 -1
  178. package/dist/simple-tree/index.js +11 -11
  179. package/dist/simple-tree/index.js.map +1 -1
  180. package/dist/simple-tree/leafNodeSchema.d.ts +14 -5
  181. package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
  182. package/dist/simple-tree/leafNodeSchema.js +117 -2
  183. package/dist/simple-tree/leafNodeSchema.js.map +1 -1
  184. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts +3 -4
  185. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  186. package/dist/simple-tree/node-kinds/array/arrayNode.js +97 -26
  187. package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  188. package/dist/simple-tree/node-kinds/array/arrayNodeTypes.d.ts +2 -2
  189. package/dist/simple-tree/node-kinds/array/arrayNodeTypes.d.ts.map +1 -1
  190. package/dist/simple-tree/node-kinds/array/arrayNodeTypes.js.map +1 -1
  191. package/dist/simple-tree/node-kinds/common.d.ts +16 -0
  192. package/dist/simple-tree/node-kinds/common.d.ts.map +1 -0
  193. package/dist/simple-tree/node-kinds/common.js +42 -0
  194. package/dist/simple-tree/node-kinds/common.js.map +1 -0
  195. package/dist/simple-tree/node-kinds/index.d.ts +1 -1
  196. package/dist/simple-tree/node-kinds/index.d.ts.map +1 -1
  197. package/dist/simple-tree/node-kinds/index.js.map +1 -1
  198. package/dist/simple-tree/node-kinds/map/mapNode.d.ts +2 -3
  199. package/dist/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
  200. package/dist/simple-tree/node-kinds/map/mapNode.js +64 -26
  201. package/dist/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  202. package/dist/simple-tree/node-kinds/map/mapNodeTypes.d.ts +2 -2
  203. package/dist/simple-tree/node-kinds/map/mapNodeTypes.d.ts.map +1 -1
  204. package/dist/simple-tree/node-kinds/map/mapNodeTypes.js.map +1 -1
  205. package/dist/simple-tree/node-kinds/object/index.d.ts +1 -1
  206. package/dist/simple-tree/node-kinds/object/index.d.ts.map +1 -1
  207. package/dist/simple-tree/node-kinds/object/index.js.map +1 -1
  208. package/dist/simple-tree/node-kinds/object/objectNode.d.ts +19 -5
  209. package/dist/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  210. package/dist/simple-tree/node-kinds/object/objectNode.js +131 -27
  211. package/dist/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  212. package/dist/simple-tree/node-kinds/object/objectNodeTypes.d.ts +11 -4
  213. package/dist/simple-tree/node-kinds/object/objectNodeTypes.d.ts.map +1 -1
  214. package/dist/simple-tree/node-kinds/object/objectNodeTypes.js.map +1 -1
  215. package/dist/simple-tree/node-kinds/record/recordNode.d.ts +2 -2
  216. package/dist/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
  217. package/dist/simple-tree/node-kinds/record/recordNode.js +41 -13
  218. package/dist/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  219. package/dist/simple-tree/node-kinds/record/recordNodeTypes.d.ts +2 -2
  220. package/dist/simple-tree/node-kinds/record/recordNodeTypes.d.ts.map +1 -1
  221. package/dist/simple-tree/node-kinds/record/recordNodeTypes.js.map +1 -1
  222. package/dist/simple-tree/prepareForInsertion.d.ts +2 -2
  223. package/dist/simple-tree/prepareForInsertion.d.ts.map +1 -1
  224. package/dist/simple-tree/prepareForInsertion.js +3 -3
  225. package/dist/simple-tree/prepareForInsertion.js.map +1 -1
  226. package/dist/simple-tree/simpleSchema.d.ts +2 -2
  227. package/dist/simple-tree/simpleSchema.d.ts.map +1 -1
  228. package/dist/simple-tree/simpleSchema.js.map +1 -1
  229. package/dist/simple-tree/toStoredSchema.d.ts +1 -1
  230. package/dist/simple-tree/toStoredSchema.d.ts.map +1 -1
  231. package/dist/simple-tree/toStoredSchema.js +6 -7
  232. package/dist/simple-tree/toStoredSchema.js.map +1 -1
  233. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.d.ts +5 -11
  234. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
  235. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js +25 -395
  236. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
  237. package/dist/simple-tree/unsafeUnknownSchema.d.ts +52 -0
  238. package/dist/simple-tree/unsafeUnknownSchema.d.ts.map +1 -0
  239. package/dist/simple-tree/unsafeUnknownSchema.js +13 -0
  240. package/dist/simple-tree/unsafeUnknownSchema.js.map +1 -0
  241. package/dist/simple-tree/walkFieldSchema.d.ts +1 -1
  242. package/dist/simple-tree/walkFieldSchema.js +2 -2
  243. package/dist/simple-tree/walkFieldSchema.js.map +1 -1
  244. package/dist/tableSchema.d.ts +12 -12
  245. package/dist/treeFactory.d.ts +0 -1
  246. package/dist/treeFactory.d.ts.map +1 -1
  247. package/dist/treeFactory.js +0 -1
  248. package/dist/treeFactory.js.map +1 -1
  249. package/lib/core/schema-stored/schema.d.ts +14 -1
  250. package/lib/core/schema-stored/schema.d.ts.map +1 -1
  251. package/lib/core/schema-stored/schema.js.map +1 -1
  252. package/lib/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
  253. package/lib/feature-libraries/default-schema/schemaChecker.js +3 -0
  254. package/lib/feature-libraries/default-schema/schemaChecker.js.map +1 -1
  255. package/lib/feature-libraries/flex-tree/context.d.ts +7 -2
  256. package/lib/feature-libraries/flex-tree/context.d.ts.map +1 -1
  257. package/lib/feature-libraries/flex-tree/context.js +4 -4
  258. package/lib/feature-libraries/flex-tree/context.js.map +1 -1
  259. package/lib/feature-libraries/flex-tree/index.d.ts +1 -0
  260. package/lib/feature-libraries/flex-tree/index.d.ts.map +1 -1
  261. package/lib/feature-libraries/flex-tree/index.js +1 -0
  262. package/lib/feature-libraries/flex-tree/index.js.map +1 -1
  263. package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  264. package/lib/feature-libraries/flex-tree/lazyField.js +6 -6
  265. package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
  266. package/lib/feature-libraries/flex-tree/lazyNode.d.ts +3 -1
  267. package/lib/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  268. package/lib/feature-libraries/flex-tree/lazyNode.js +3 -1
  269. package/lib/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  270. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  271. package/lib/feature-libraries/forest-summary/forestSummarizer.js +1 -2
  272. package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  273. package/lib/feature-libraries/index.d.ts +1 -1
  274. package/lib/feature-libraries/index.d.ts.map +1 -1
  275. package/lib/feature-libraries/index.js +1 -1
  276. package/lib/feature-libraries/index.js.map +1 -1
  277. package/lib/packageVersion.d.ts +1 -1
  278. package/lib/packageVersion.d.ts.map +1 -1
  279. package/lib/packageVersion.js +1 -1
  280. package/lib/packageVersion.js.map +1 -1
  281. package/lib/shared-tree/index.d.ts +0 -1
  282. package/lib/shared-tree/index.d.ts.map +1 -1
  283. package/lib/shared-tree/index.js +0 -1
  284. package/lib/shared-tree/index.js.map +1 -1
  285. package/lib/shared-tree/schematizeTree.d.ts.map +1 -1
  286. package/lib/shared-tree/schematizeTree.js +2 -6
  287. package/lib/shared-tree/schematizeTree.js.map +1 -1
  288. package/lib/shared-tree/schematizingTreeView.d.ts +11 -13
  289. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  290. package/lib/shared-tree/schematizingTreeView.js +59 -81
  291. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  292. package/lib/shared-tree/sharedTreeChangeTypes.d.ts +1 -1
  293. package/lib/shared-tree/sharedTreeChangeTypes.js.map +1 -1
  294. package/lib/shared-tree/tree.d.ts.map +1 -1
  295. package/lib/shared-tree/tree.js +4 -3
  296. package/lib/shared-tree/tree.js.map +1 -1
  297. package/lib/shared-tree/treeAlpha.d.ts +7 -1
  298. package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
  299. package/lib/shared-tree/treeAlpha.js.map +1 -1
  300. package/lib/shared-tree/treeCheckout.d.ts +7 -2
  301. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  302. package/lib/shared-tree/treeCheckout.js +5 -2
  303. package/lib/shared-tree/treeCheckout.js.map +1 -1
  304. package/lib/simple-tree/api/conciseTree.d.ts +1 -1
  305. package/lib/simple-tree/api/conciseTree.d.ts.map +1 -1
  306. package/lib/simple-tree/api/conciseTree.js.map +1 -1
  307. package/lib/simple-tree/api/configuration.d.ts +1 -1
  308. package/lib/simple-tree/api/configuration.d.ts.map +1 -1
  309. package/lib/simple-tree/api/configuration.js +2 -2
  310. package/lib/simple-tree/api/configuration.js.map +1 -1
  311. package/lib/simple-tree/api/create.d.ts +3 -1
  312. package/lib/simple-tree/api/create.d.ts.map +1 -1
  313. package/lib/simple-tree/api/create.js +2 -0
  314. package/lib/simple-tree/api/create.js.map +1 -1
  315. package/lib/simple-tree/api/customTree.d.ts +1 -2
  316. package/lib/simple-tree/api/customTree.d.ts.map +1 -1
  317. package/lib/simple-tree/api/customTree.js.map +1 -1
  318. package/lib/simple-tree/api/getJsonSchema.d.ts +1 -1
  319. package/lib/simple-tree/api/getJsonSchema.d.ts.map +1 -1
  320. package/lib/simple-tree/api/getJsonSchema.js.map +1 -1
  321. package/lib/simple-tree/api/getSimpleSchema.d.ts +1 -1
  322. package/lib/simple-tree/api/getSimpleSchema.js.map +1 -1
  323. package/lib/simple-tree/api/identifierIndex.d.ts +1 -1
  324. package/lib/simple-tree/api/identifierIndex.js +1 -1
  325. package/lib/simple-tree/api/identifierIndex.js.map +1 -1
  326. package/lib/simple-tree/api/index.d.ts +1 -1
  327. package/lib/simple-tree/api/index.d.ts.map +1 -1
  328. package/lib/simple-tree/api/index.js.map +1 -1
  329. package/lib/simple-tree/api/schemaCompatibilityTester.d.ts +1 -1
  330. package/lib/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
  331. package/lib/simple-tree/api/schemaCreationUtilities.d.ts +14 -2
  332. package/lib/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -1
  333. package/lib/simple-tree/api/schemaCreationUtilities.js +40 -4
  334. package/lib/simple-tree/api/schemaCreationUtilities.js.map +1 -1
  335. package/lib/simple-tree/api/schemaFactory.d.ts +36 -3
  336. package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
  337. package/lib/simple-tree/api/schemaFactory.js +2 -2
  338. package/lib/simple-tree/api/schemaFactory.js.map +1 -1
  339. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +16 -16
  340. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  341. package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  342. package/lib/simple-tree/api/schemaFactoryRecursive.d.ts +2 -2
  343. package/lib/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
  344. package/lib/simple-tree/api/schemaFactoryRecursive.js +1 -1
  345. package/lib/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
  346. package/lib/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
  347. package/lib/simple-tree/api/schemaFromSimple.js +1 -1
  348. package/lib/simple-tree/api/schemaFromSimple.js.map +1 -1
  349. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js +1 -1
  350. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  351. package/lib/simple-tree/api/simpleTreeIndex.d.ts +2 -2
  352. package/lib/simple-tree/api/simpleTreeIndex.d.ts.map +1 -1
  353. package/lib/simple-tree/api/simpleTreeIndex.js +2 -2
  354. package/lib/simple-tree/api/simpleTreeIndex.js.map +1 -1
  355. package/lib/simple-tree/api/storedSchema.d.ts +1 -1
  356. package/lib/simple-tree/api/storedSchema.js +1 -1
  357. package/lib/simple-tree/api/storedSchema.js.map +1 -1
  358. package/lib/simple-tree/api/tree.d.ts +2 -1
  359. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  360. package/lib/simple-tree/api/tree.js.map +1 -1
  361. package/lib/simple-tree/api/treeBeta.d.ts +4 -1
  362. package/lib/simple-tree/api/treeBeta.d.ts.map +1 -1
  363. package/lib/simple-tree/api/treeBeta.js.map +1 -1
  364. package/lib/simple-tree/api/treeNodeApi.d.ts +1 -2
  365. package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  366. package/lib/simple-tree/api/treeNodeApi.js +2 -2
  367. package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
  368. package/lib/simple-tree/api/typesUnsafe.d.ts +2 -3
  369. package/lib/simple-tree/api/typesUnsafe.d.ts.map +1 -1
  370. package/lib/simple-tree/api/typesUnsafe.js.map +1 -1
  371. package/lib/simple-tree/api/verboseTree.d.ts +2 -1
  372. package/lib/simple-tree/api/verboseTree.d.ts.map +1 -1
  373. package/lib/simple-tree/api/verboseTree.js.map +1 -1
  374. package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts +1 -1
  375. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js +1 -1
  376. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
  377. package/lib/simple-tree/core/allowedTypes.d.ts +316 -0
  378. package/lib/simple-tree/core/allowedTypes.d.ts.map +1 -0
  379. package/lib/simple-tree/core/allowedTypes.js +162 -0
  380. package/lib/simple-tree/core/allowedTypes.js.map +1 -0
  381. package/lib/simple-tree/core/context.d.ts +3 -9
  382. package/lib/simple-tree/core/context.d.ts.map +1 -1
  383. package/lib/simple-tree/core/context.js +0 -8
  384. package/lib/simple-tree/core/context.js.map +1 -1
  385. package/lib/simple-tree/core/flexList.d.ts.map +1 -0
  386. package/lib/simple-tree/core/flexList.js.map +1 -0
  387. package/lib/simple-tree/core/getOrCreateNode.d.ts +1 -1
  388. package/lib/simple-tree/core/getOrCreateNode.d.ts.map +1 -1
  389. package/lib/simple-tree/core/getOrCreateNode.js.map +1 -1
  390. package/lib/simple-tree/core/index.d.ts +9 -3
  391. package/lib/simple-tree/core/index.d.ts.map +1 -1
  392. package/lib/simple-tree/core/index.js +6 -3
  393. package/lib/simple-tree/core/index.js.map +1 -1
  394. package/lib/simple-tree/core/treeNodeKernel.d.ts +8 -1
  395. package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  396. package/lib/simple-tree/core/treeNodeKernel.js +10 -6
  397. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
  398. package/lib/simple-tree/core/treeNodeSchema.d.ts +182 -39
  399. package/lib/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  400. package/lib/simple-tree/core/treeNodeSchema.js +44 -14
  401. package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
  402. package/lib/simple-tree/{treeNodeValid.d.ts → core/treeNodeValid.d.ts} +18 -4
  403. package/lib/simple-tree/core/treeNodeValid.d.ts.map +1 -0
  404. package/lib/simple-tree/{treeNodeValid.js → core/treeNodeValid.js} +31 -3
  405. package/lib/simple-tree/core/treeNodeValid.js.map +1 -0
  406. package/lib/simple-tree/core/unhydratedFlexTree.d.ts +1 -1
  407. package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  408. package/lib/simple-tree/core/walkSchema.d.ts +2 -1
  409. package/lib/simple-tree/core/walkSchema.d.ts.map +1 -1
  410. package/lib/simple-tree/core/walkSchema.js +7 -3
  411. package/lib/simple-tree/core/walkSchema.js.map +1 -1
  412. package/lib/simple-tree/createContext.d.ts +6 -2
  413. package/lib/simple-tree/createContext.d.ts.map +1 -1
  414. package/lib/simple-tree/createContext.js +13 -2
  415. package/lib/simple-tree/createContext.js.map +1 -1
  416. package/lib/simple-tree/fieldSchema.d.ts +423 -0
  417. package/lib/simple-tree/fieldSchema.d.ts.map +1 -0
  418. package/lib/simple-tree/{schemaTypes.js → fieldSchema.js} +3 -183
  419. package/lib/simple-tree/fieldSchema.js.map +1 -0
  420. package/lib/simple-tree/index.d.ts +5 -5
  421. package/lib/simple-tree/index.d.ts.map +1 -1
  422. package/lib/simple-tree/index.js +2 -2
  423. package/lib/simple-tree/index.js.map +1 -1
  424. package/lib/simple-tree/leafNodeSchema.d.ts +14 -5
  425. package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
  426. package/lib/simple-tree/leafNodeSchema.js +117 -3
  427. package/lib/simple-tree/leafNodeSchema.js.map +1 -1
  428. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts +3 -4
  429. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  430. package/lib/simple-tree/node-kinds/array/arrayNode.js +86 -15
  431. package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  432. package/lib/simple-tree/node-kinds/array/arrayNodeTypes.d.ts +2 -2
  433. package/lib/simple-tree/node-kinds/array/arrayNodeTypes.d.ts.map +1 -1
  434. package/lib/simple-tree/node-kinds/array/arrayNodeTypes.js +1 -1
  435. package/lib/simple-tree/node-kinds/array/arrayNodeTypes.js.map +1 -1
  436. package/lib/simple-tree/node-kinds/common.d.ts +16 -0
  437. package/lib/simple-tree/node-kinds/common.d.ts.map +1 -0
  438. package/lib/simple-tree/node-kinds/common.js +38 -0
  439. package/lib/simple-tree/node-kinds/common.js.map +1 -0
  440. package/lib/simple-tree/node-kinds/index.d.ts +1 -1
  441. package/lib/simple-tree/node-kinds/index.d.ts.map +1 -1
  442. package/lib/simple-tree/node-kinds/index.js.map +1 -1
  443. package/lib/simple-tree/node-kinds/map/mapNode.d.ts +2 -3
  444. package/lib/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
  445. package/lib/simple-tree/node-kinds/map/mapNode.js +51 -13
  446. package/lib/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  447. package/lib/simple-tree/node-kinds/map/mapNodeTypes.d.ts +2 -2
  448. package/lib/simple-tree/node-kinds/map/mapNodeTypes.d.ts.map +1 -1
  449. package/lib/simple-tree/node-kinds/map/mapNodeTypes.js +1 -1
  450. package/lib/simple-tree/node-kinds/map/mapNodeTypes.js.map +1 -1
  451. package/lib/simple-tree/node-kinds/object/index.d.ts +1 -1
  452. package/lib/simple-tree/node-kinds/object/index.d.ts.map +1 -1
  453. package/lib/simple-tree/node-kinds/object/index.js.map +1 -1
  454. package/lib/simple-tree/node-kinds/object/objectNode.d.ts +19 -5
  455. package/lib/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  456. package/lib/simple-tree/node-kinds/object/objectNode.js +116 -14
  457. package/lib/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  458. package/lib/simple-tree/node-kinds/object/objectNodeTypes.d.ts +11 -4
  459. package/lib/simple-tree/node-kinds/object/objectNodeTypes.d.ts.map +1 -1
  460. package/lib/simple-tree/node-kinds/object/objectNodeTypes.js +1 -1
  461. package/lib/simple-tree/node-kinds/object/objectNodeTypes.js.map +1 -1
  462. package/lib/simple-tree/node-kinds/record/recordNode.d.ts +2 -2
  463. package/lib/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
  464. package/lib/simple-tree/node-kinds/record/recordNode.js +40 -12
  465. package/lib/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  466. package/lib/simple-tree/node-kinds/record/recordNodeTypes.d.ts +2 -2
  467. package/lib/simple-tree/node-kinds/record/recordNodeTypes.d.ts.map +1 -1
  468. package/lib/simple-tree/node-kinds/record/recordNodeTypes.js +1 -1
  469. package/lib/simple-tree/node-kinds/record/recordNodeTypes.js.map +1 -1
  470. package/lib/simple-tree/prepareForInsertion.d.ts +2 -2
  471. package/lib/simple-tree/prepareForInsertion.d.ts.map +1 -1
  472. package/lib/simple-tree/prepareForInsertion.js +2 -2
  473. package/lib/simple-tree/prepareForInsertion.js.map +1 -1
  474. package/lib/simple-tree/simpleSchema.d.ts +2 -2
  475. package/lib/simple-tree/simpleSchema.d.ts.map +1 -1
  476. package/lib/simple-tree/simpleSchema.js.map +1 -1
  477. package/lib/simple-tree/toStoredSchema.d.ts +1 -1
  478. package/lib/simple-tree/toStoredSchema.d.ts.map +1 -1
  479. package/lib/simple-tree/toStoredSchema.js +2 -3
  480. package/lib/simple-tree/toStoredSchema.js.map +1 -1
  481. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.d.ts +5 -11
  482. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
  483. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js +10 -381
  484. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
  485. package/lib/simple-tree/unsafeUnknownSchema.d.ts +52 -0
  486. package/lib/simple-tree/unsafeUnknownSchema.d.ts.map +1 -0
  487. package/lib/simple-tree/unsafeUnknownSchema.js +10 -0
  488. package/lib/simple-tree/unsafeUnknownSchema.js.map +1 -0
  489. package/lib/simple-tree/walkFieldSchema.d.ts +1 -1
  490. package/lib/simple-tree/walkFieldSchema.js +1 -1
  491. package/lib/simple-tree/walkFieldSchema.js.map +1 -1
  492. package/lib/tableSchema.d.ts +12 -12
  493. package/lib/treeFactory.d.ts +0 -1
  494. package/lib/treeFactory.d.ts.map +1 -1
  495. package/lib/treeFactory.js +0 -1
  496. package/lib/treeFactory.js.map +1 -1
  497. package/package.json +22 -23
  498. package/src/core/schema-stored/schema.ts +14 -1
  499. package/src/feature-libraries/default-schema/schemaChecker.ts +3 -0
  500. package/src/feature-libraries/flex-tree/context.ts +10 -5
  501. package/src/feature-libraries/flex-tree/index.ts +2 -0
  502. package/src/feature-libraries/flex-tree/lazyField.ts +10 -6
  503. package/src/feature-libraries/flex-tree/lazyNode.ts +6 -1
  504. package/src/feature-libraries/forest-summary/forestSummarizer.ts +1 -2
  505. package/src/feature-libraries/index.ts +1 -0
  506. package/src/packageVersion.ts +1 -1
  507. package/src/shared-tree/index.ts +0 -2
  508. package/src/shared-tree/schematizeTree.ts +2 -6
  509. package/src/shared-tree/schematizingTreeView.ts +72 -107
  510. package/src/shared-tree/sharedTreeChangeTypes.ts +1 -1
  511. package/src/shared-tree/tree.ts +4 -3
  512. package/src/shared-tree/treeAlpha.ts +7 -1
  513. package/src/shared-tree/treeCheckout.ts +15 -2
  514. package/src/simple-tree/api/conciseTree.ts +1 -2
  515. package/src/simple-tree/api/configuration.ts +7 -4
  516. package/src/simple-tree/api/create.ts +3 -1
  517. package/src/simple-tree/api/customTree.ts +1 -2
  518. package/src/simple-tree/api/getJsonSchema.ts +1 -1
  519. package/src/simple-tree/api/getSimpleSchema.ts +1 -1
  520. package/src/simple-tree/api/identifierIndex.ts +1 -1
  521. package/src/simple-tree/api/index.ts +2 -0
  522. package/src/simple-tree/api/schemaCompatibilityTester.ts +1 -1
  523. package/src/simple-tree/api/schemaCreationUtilities.ts +47 -5
  524. package/src/simple-tree/api/schemaFactory.ts +45 -10
  525. package/src/simple-tree/api/schemaFactoryAlpha.ts +4 -7
  526. package/src/simple-tree/api/schemaFactoryRecursive.ts +9 -4
  527. package/src/simple-tree/api/schemaFromSimple.ts +2 -3
  528. package/src/simple-tree/api/simpleSchemaToJsonSchema.ts +1 -1
  529. package/src/simple-tree/api/simpleTreeIndex.ts +8 -3
  530. package/src/simple-tree/api/storedSchema.ts +1 -1
  531. package/src/simple-tree/api/tree.ts +2 -2
  532. package/src/simple-tree/api/treeBeta.ts +4 -1
  533. package/src/simple-tree/api/treeNodeApi.ts +5 -8
  534. package/src/simple-tree/api/typesUnsafe.ts +5 -4
  535. package/src/simple-tree/api/verboseTree.ts +3 -6
  536. package/src/simple-tree/api/viewSchemaToSimpleSchema.ts +1 -1
  537. package/src/simple-tree/core/README.md +1 -1
  538. package/src/simple-tree/core/allowedTypes.ts +496 -0
  539. package/src/simple-tree/core/context.ts +3 -10
  540. package/src/simple-tree/core/getOrCreateNode.ts +1 -1
  541. package/src/simple-tree/core/index.ts +62 -9
  542. package/src/simple-tree/core/treeNodeKernel.ts +12 -6
  543. package/src/simple-tree/core/treeNodeSchema.ts +247 -63
  544. package/src/simple-tree/{treeNodeValid.ts → core/treeNodeValid.ts} +59 -15
  545. package/src/simple-tree/core/unhydratedFlexTree.ts +1 -1
  546. package/src/simple-tree/core/walkSchema.ts +9 -5
  547. package/src/simple-tree/createContext.ts +26 -2
  548. package/src/simple-tree/fieldSchema.ts +734 -0
  549. package/src/simple-tree/index.ts +32 -30
  550. package/src/simple-tree/leafNodeSchema.ts +137 -5
  551. package/src/simple-tree/node-kinds/array/arrayNode.ts +141 -30
  552. package/src/simple-tree/node-kinds/array/arrayNodeTypes.ts +5 -7
  553. package/src/simple-tree/node-kinds/common.ts +60 -0
  554. package/src/simple-tree/node-kinds/index.ts +1 -0
  555. package/src/simple-tree/node-kinds/map/mapNode.ts +91 -33
  556. package/src/simple-tree/node-kinds/map/mapNodeTypes.ts +5 -7
  557. package/src/simple-tree/node-kinds/object/index.ts +1 -0
  558. package/src/simple-tree/node-kinds/object/objectNode.ts +205 -25
  559. package/src/simple-tree/node-kinds/object/objectNodeTypes.ts +22 -5
  560. package/src/simple-tree/node-kinds/record/recordNode.ts +68 -26
  561. package/src/simple-tree/node-kinds/record/recordNodeTypes.ts +6 -8
  562. package/src/simple-tree/prepareForInsertion.ts +7 -6
  563. package/src/simple-tree/simpleSchema.ts +2 -2
  564. package/src/simple-tree/toStoredSchema.ts +2 -3
  565. package/src/simple-tree/unhydratedFlexTreeFromInsertable.ts +12 -494
  566. package/src/simple-tree/unsafeUnknownSchema.ts +70 -0
  567. package/src/simple-tree/walkFieldSchema.ts +1 -1
  568. package/src/treeFactory.ts +0 -1
  569. package/dist/shared-tree/checkoutFlexTreeView.d.ts +0 -58
  570. package/dist/shared-tree/checkoutFlexTreeView.d.ts.map +0 -1
  571. package/dist/shared-tree/checkoutFlexTreeView.js +0 -77
  572. package/dist/shared-tree/checkoutFlexTreeView.js.map +0 -1
  573. package/dist/simple-tree/flexList.d.ts.map +0 -1
  574. package/dist/simple-tree/flexList.js.map +0 -1
  575. package/dist/simple-tree/schemaTypes.d.ts +0 -856
  576. package/dist/simple-tree/schemaTypes.d.ts.map +0 -1
  577. package/dist/simple-tree/schemaTypes.js.map +0 -1
  578. package/dist/simple-tree/treeNodeValid.d.ts.map +0 -1
  579. package/dist/simple-tree/treeNodeValid.js.map +0 -1
  580. package/lib/shared-tree/checkoutFlexTreeView.d.ts +0 -58
  581. package/lib/shared-tree/checkoutFlexTreeView.d.ts.map +0 -1
  582. package/lib/shared-tree/checkoutFlexTreeView.js +0 -72
  583. package/lib/shared-tree/checkoutFlexTreeView.js.map +0 -1
  584. package/lib/simple-tree/flexList.d.ts.map +0 -1
  585. package/lib/simple-tree/flexList.js.map +0 -1
  586. package/lib/simple-tree/schemaTypes.d.ts +0 -856
  587. package/lib/simple-tree/schemaTypes.d.ts.map +0 -1
  588. package/lib/simple-tree/schemaTypes.js.map +0 -1
  589. package/lib/simple-tree/treeNodeValid.d.ts.map +0 -1
  590. package/lib/simple-tree/treeNodeValid.js.map +0 -1
  591. package/src/shared-tree/checkoutFlexTreeView.ts +0 -100
  592. package/src/simple-tree/schemaTypes.ts +0 -1420
  593. /package/dist/simple-tree/{flexList.d.ts → core/flexList.d.ts} +0 -0
  594. /package/dist/simple-tree/{flexList.js → core/flexList.js} +0 -0
  595. /package/lib/simple-tree/{flexList.d.ts → core/flexList.d.ts} +0 -0
  596. /package/lib/simple-tree/{flexList.js → core/flexList.js} +0 -0
  597. /package/src/simple-tree/{flexList.ts → core/flexList.ts} +0 -0
@@ -17,6 +17,19 @@
17
17
  "**/node_modules/**/@fluid*/*-previous/*"
18
18
  ],
19
19
  "typescript.preferences.importModuleSpecifier": "project-relative",
20
- "typescript.preferences.preferTypeOnlyAutoImports": true
20
+ "typescript.preferences.preferTypeOnlyAutoImports": true,
21
+ "typescript.preferences.autoImportSpecifierExcludeRegexes": [
22
+ // Avoid suggesting imports from parent index file, which almost always is a mistake which creates a cyclic dependency.
23
+ // Importers in almost all cases should import it from a sibling instead (the same place the index file imports it from).
24
+ "^\\.\\/index\\.js$",
25
+ // Same justification as the ./index.js case, but catches imports from parents further up the directory hierarchy.
26
+ // Rejects cases like ../index.js and ../../index.js.
27
+ "\\.\\.\\/index\\.js$",
28
+ // Avoid suggesting imports which reach into a directory, unless the import is for the index file.
29
+ // Often tests for a specific file will want to violate this, so violating this could occasionally be useful,
30
+ // but removing it from an auto-import suggestion in all other cases is helpful.
31
+ // Rejects cases like ./core/treeNodeSchema.js while allowing ./core/index.js, ../util.js and ./util.js.
32
+ "\\/[^.]*\\/(?!index\\.js$)"
33
+ ]
21
34
  }
22
35
  }
@@ -16,6 +16,9 @@
16
16
  // mocha test config isn't sufficient; it also needs to be enabled here.
17
17
  "mochaExplorer.nodeArgv": ["--conditions", "allow-ff-test-exports"],
18
18
  "cSpell.words": [
19
+ "branchable",
20
+ "chunker",
21
+ "clonable",
19
22
  "contravariance",
20
23
  "contravariantly",
21
24
  "covariantly",
@@ -24,11 +27,24 @@
24
27
  "endregion",
25
28
  "fluidframework",
26
29
  "insertable",
30
+ "jsonable",
27
31
  "parameterizing",
32
+ "Poset",
33
+ "rebaser",
34
+ "reconnections",
28
35
  "reentrantly",
36
+ "revertibles",
37
+ "rushstack",
38
+ "Stringifier",
39
+ "summarizable",
40
+ "summarizables",
41
+ "typebox",
29
42
  "typeparam",
30
43
  "unannotate",
44
+ "undoable",
31
45
  "unhydrated",
46
+ "unioned",
47
+ "unparented",
32
48
  ],
33
49
 
34
50
  // Enable biome as default formatter, and disable rules that disagree with it
package/CHANGELOG.md CHANGED
@@ -807,7 +807,7 @@
807
807
  Adds an `ITreeAlpha` interface (which `ITree` can be down-casted to) that provides access to both the tree content and the schema.
808
808
  This allows inspecting the content saved in a SharedTree in a generic way that can work on any SharedTree.
809
809
 
810
- This can be combined with the existing `generateSchemaFromSimpleSchema` to generate a schema that can be used with [`IIree.viewWith`](https://fluidframework.com/docs/api/fluid-framework/viewabletree-interface#viewwith-methodsignature) to allow constructing a [`TreeView`](https://fluidframework.com/docs/api/fluid-framework/treeview-interface) for any SharedTree, regardless of its schema.
810
+ This can be combined with the existing `generateSchemaFromSimpleSchema` to generate a schema that can be used with [`ITree.viewWith`](https://fluidframework.com/docs/api/fluid-framework/viewabletree-interface#viewwith-methodsignature) to allow constructing a [`TreeView`](https://fluidframework.com/docs/api/fluid-framework/treeview-interface) for any SharedTree, regardless of its schema.
811
811
 
812
812
  Note that the resulting TypeScript typing for such a view will not be friendly: the `TreeView` APIs are designed for statically known schema. Using them is possible with care and a lot of type casts but not recommended if it can be avoided: see disclaimer on `generateSchemaFromSimpleSchema`.
813
813
  Example using `ITreeAlpha` and `generateSchemaFromSimpleSchema`:
@@ -2822,7 +2822,7 @@ Dependency updates only.
2822
2822
 
2823
2823
  The 'type' field for @fluid-experimental/tree2's exported `IChannelFactory`s has been changed to not overlap with @fluid-experimental/tree's channel type.
2824
2824
  This breaks existing tree2 documents: upon loading them, an error with message "Channel Factory SharedTree not registered" will be thrown.
2825
- If using the typed-tree API, the message will instead be "Channel Factory SharedTree:<subtype> not registered" where <subtype> is the subtype used by
2825
+ If using the typed-tree API, the message will instead be "Channel Factory SharedTree:<subtype\> not registered" where <subtype\> is the subtype used by
2826
2826
  the application when constructing their `TypedTreeFactory`.
2827
2827
 
2828
2828
  Applications which want to support such documents could add an explicit registry entry to their `ISharedObjectRegistry` which maps the type shown in the error message to a factory producing @fluid-experimental/tree2.
@@ -992,7 +992,7 @@ export namespace System_TableSchema {
992
992
  // @sealed
993
993
  export function createRowSchema<const TInputScope extends string | undefined, const TCellSchema extends ImplicitAllowedTypes, const TPropsSchema extends ImplicitAnnotatedFieldSchema>(inputSchemaFactory: SchemaFactoryAlpha<TInputScope>, cellSchema: TCellSchema, propsSchema: TPropsSchema): TreeNodeSchemaClass<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Row">, NodeKind.Object, TreeNode & TableSchema.Row<TCellSchema, TPropsSchema> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Row">, NodeKind, unknown>, object & {
994
994
  readonly id?: string | undefined;
995
- readonly cells: (InsertableTypedNode_2<TreeNodeSchemaClass<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Row.cells">, NodeKind.Record, TreeRecordNode_2<TCellSchema> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Row.cells">, NodeKind.Record, unknown>, RecordNodeInsertableData_2<TCellSchema>, true, TCellSchema, undefined>, TreeNodeSchemaCore_2<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Row.cells">, NodeKind.Record, true, TCellSchema, RecordNodeInsertableData_2<TCellSchema>, unknown> & (new (data?: InternalTreeNode | RecordNodeInsertableData_2<TCellSchema> | undefined) => TreeRecordNode_2<TCellSchema> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Row.cells">, NodeKind.Record, unknown>)> | undefined) & InsertableTypedNode_2<TreeNodeSchemaClass<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Row.cells">, NodeKind.Record, TreeRecordNode_2<TCellSchema> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Row.cells">, NodeKind.Record, unknown>, RecordNodeInsertableData_2<TCellSchema>, true, TCellSchema, undefined>, TreeNodeSchemaCore_2<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Row.cells">, NodeKind.Record, true, TCellSchema, RecordNodeInsertableData_2<TCellSchema>, unknown> & (new (data?: InternalTreeNode | RecordNodeInsertableData_2<TCellSchema> | undefined) => TreeRecordNode_2<TCellSchema> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Row.cells">, NodeKind.Record, unknown>)>;
995
+ readonly cells: (InsertableTypedNode_2<TreeNodeSchemaClass<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Row.cells">, NodeKind.Record, TreeRecordNode_2<TCellSchema> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Row.cells">, NodeKind.Record, unknown>, RecordNodeInsertableData_2<TCellSchema>, true, TCellSchema, undefined>> | undefined) & InsertableTypedNode_2<TreeNodeSchemaClass<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Row.cells">, NodeKind.Record, TreeRecordNode_2<TCellSchema> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Row.cells">, NodeKind.Record, unknown>, RecordNodeInsertableData_2<TCellSchema>, true, TCellSchema, undefined>>;
996
996
  } & (FieldHasDefault<UnannotateImplicitFieldSchema<TPropsSchema>> extends true ? {
997
997
  props?: InsertableTreeFieldFromImplicitField<UnannotateImplicitFieldSchema<TPropsSchema>> | undefined;
998
998
  } : {
@@ -1007,15 +1007,15 @@ export namespace System_TableSchema {
1007
1007
  readonly rows: TreeNodeSchemaClass<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, TreeArrayNode<TRowSchema, [TRowSchema] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TRowSchema> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TRowSchema] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema> : never, ReadonlyArrayNode_2<TreeNode | TreeLeafValue_2>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, unknown>, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema>>, true, TRowSchema, undefined>;
1008
1008
  readonly columns: TreeNodeSchemaClass<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, TreeArrayNode<TColumnSchema, [TColumnSchema] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TColumnSchema> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TColumnSchema] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema> : never, ReadonlyArrayNode_2<TreeNode | TreeLeafValue_2>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, unknown>, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema>>, true, TColumnSchema, undefined>;
1009
1009
  }, object & {
1010
- readonly rows: (InsertableTypedNode_2<TreeNodeSchemaCore_2<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, true, TRowSchema, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema>>, unknown> & (new (data?: InternalTreeNode | Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema>> | undefined) => TreeArrayNode<TRowSchema, [TRowSchema] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TRowSchema> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TRowSchema] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema> : never, ReadonlyArrayNode_2<TreeNode | TreeLeafValue_2>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, unknown>), TreeNodeSchemaCore_2<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, true, TRowSchema, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema>>, unknown> & (new (data?: InternalTreeNode | Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema>> | undefined) => TreeArrayNode<TRowSchema, [TRowSchema] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TRowSchema> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TRowSchema] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema> : never, ReadonlyArrayNode_2<TreeNode | TreeLeafValue_2>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, unknown>)> | undefined) & InsertableTypedNode_2<TreeNodeSchemaCore_2<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, true, TRowSchema, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema>>, unknown> & (new (data?: InternalTreeNode | Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema>> | undefined) => TreeArrayNode<TRowSchema, [TRowSchema] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TRowSchema> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TRowSchema] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema> : never, ReadonlyArrayNode_2<TreeNode | TreeLeafValue_2>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, unknown>), TreeNodeSchemaCore_2<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, true, TRowSchema, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema>>, unknown> & (new (data?: InternalTreeNode | Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema>> | undefined) => TreeArrayNode<TRowSchema, [TRowSchema] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TRowSchema> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TRowSchema] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema> : never, ReadonlyArrayNode_2<TreeNode | TreeLeafValue_2>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, unknown>)>;
1011
- readonly columns: (InsertableTypedNode_2<TreeNodeSchemaCore_2<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, true, TColumnSchema, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema>>, unknown> & (new (data?: InternalTreeNode | Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema>> | undefined) => TreeArrayNode<TColumnSchema, [TColumnSchema] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TColumnSchema> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TColumnSchema] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema> : never, ReadonlyArrayNode_2<TreeNode | TreeLeafValue_2>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, unknown>), TreeNodeSchemaCore_2<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, true, TColumnSchema, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema>>, unknown> & (new (data?: InternalTreeNode | Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema>> | undefined) => TreeArrayNode<TColumnSchema, [TColumnSchema] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TColumnSchema> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TColumnSchema] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema> : never, ReadonlyArrayNode_2<TreeNode | TreeLeafValue_2>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, unknown>)> | undefined) & InsertableTypedNode_2<TreeNodeSchemaCore_2<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, true, TColumnSchema, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema>>, unknown> & (new (data?: InternalTreeNode | Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema>> | undefined) => TreeArrayNode<TColumnSchema, [TColumnSchema] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TColumnSchema> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TColumnSchema] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema> : never, ReadonlyArrayNode_2<TreeNode | TreeLeafValue_2>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, unknown>), TreeNodeSchemaCore_2<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, true, TColumnSchema, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema>>, unknown> & (new (data?: InternalTreeNode | Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema>> | undefined) => TreeArrayNode<TColumnSchema, [TColumnSchema] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TColumnSchema> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TColumnSchema] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema> : never, ReadonlyArrayNode_2<TreeNode | TreeLeafValue_2>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, unknown>)>;
1010
+ readonly rows: (InsertableTypedNode_2<TreeNodeSchemaCore_2<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, true, TRowSchema, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema>>, unknown> & (new (data?: InternalTreeNode | Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema>> | undefined) => TreeArrayNode<TRowSchema, [TRowSchema] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TRowSchema> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TRowSchema] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema> : never, ReadonlyArrayNode_2<TreeNode | TreeLeafValue_2>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, unknown>)> | undefined) & InsertableTypedNode_2<TreeNodeSchemaCore_2<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, true, TRowSchema, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema>>, unknown> & (new (data?: InternalTreeNode | Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema>> | undefined) => TreeArrayNode<TRowSchema, [TRowSchema] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TRowSchema> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TRowSchema] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema> : never, ReadonlyArrayNode_2<TreeNode | TreeLeafValue_2>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, unknown>)>;
1011
+ readonly columns: (InsertableTypedNode_2<TreeNodeSchemaCore_2<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, true, TColumnSchema, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema>>, unknown> & (new (data?: InternalTreeNode | Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema>> | undefined) => TreeArrayNode<TColumnSchema, [TColumnSchema] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TColumnSchema> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TColumnSchema] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema> : never, ReadonlyArrayNode_2<TreeNode | TreeLeafValue_2>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, unknown>)> | undefined) & InsertableTypedNode_2<TreeNodeSchemaCore_2<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, true, TColumnSchema, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema>>, unknown> & (new (data?: InternalTreeNode | Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema>> | undefined) => TreeArrayNode<TColumnSchema, [TColumnSchema] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TColumnSchema> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TColumnSchema] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema> : never, ReadonlyArrayNode_2<TreeNode | TreeLeafValue_2>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, unknown>)>;
1012
1012
  }, unknown> & (new (data: InternalTreeNode | (object & {
1013
- readonly rows: (InsertableTypedNode_2<TreeNodeSchemaCore_2<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, true, TRowSchema, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema>>, unknown> & (new (data?: InternalTreeNode | Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema>> | undefined) => TreeArrayNode<TRowSchema, [TRowSchema] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TRowSchema> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TRowSchema] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema> : never, ReadonlyArrayNode_2<TreeNode | TreeLeafValue_2>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, unknown>), TreeNodeSchemaCore_2<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, true, TRowSchema, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema>>, unknown> & (new (data?: InternalTreeNode | Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema>> | undefined) => TreeArrayNode<TRowSchema, [TRowSchema] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TRowSchema> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TRowSchema] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema> : never, ReadonlyArrayNode_2<TreeNode | TreeLeafValue_2>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, unknown>)> | undefined) & InsertableTypedNode_2<TreeNodeSchemaCore_2<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, true, TRowSchema, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema>>, unknown> & (new (data?: InternalTreeNode | Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema>> | undefined) => TreeArrayNode<TRowSchema, [TRowSchema] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TRowSchema> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TRowSchema] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema> : never, ReadonlyArrayNode_2<TreeNode | TreeLeafValue_2>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, unknown>), TreeNodeSchemaCore_2<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, true, TRowSchema, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema>>, unknown> & (new (data?: InternalTreeNode | Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema>> | undefined) => TreeArrayNode<TRowSchema, [TRowSchema] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TRowSchema> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TRowSchema] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema> : never, ReadonlyArrayNode_2<TreeNode | TreeLeafValue_2>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, unknown>)>;
1014
- readonly columns: (InsertableTypedNode_2<TreeNodeSchemaCore_2<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, true, TColumnSchema, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema>>, unknown> & (new (data?: InternalTreeNode | Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema>> | undefined) => TreeArrayNode<TColumnSchema, [TColumnSchema] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TColumnSchema> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TColumnSchema] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema> : never, ReadonlyArrayNode_2<TreeNode | TreeLeafValue_2>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, unknown>), TreeNodeSchemaCore_2<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, true, TColumnSchema, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema>>, unknown> & (new (data?: InternalTreeNode | Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema>> | undefined) => TreeArrayNode<TColumnSchema, [TColumnSchema] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TColumnSchema> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TColumnSchema] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema> : never, ReadonlyArrayNode_2<TreeNode | TreeLeafValue_2>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, unknown>)> | undefined) & InsertableTypedNode_2<TreeNodeSchemaCore_2<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, true, TColumnSchema, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema>>, unknown> & (new (data?: InternalTreeNode | Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema>> | undefined) => TreeArrayNode<TColumnSchema, [TColumnSchema] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TColumnSchema> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TColumnSchema] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema> : never, ReadonlyArrayNode_2<TreeNode | TreeLeafValue_2>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, unknown>), TreeNodeSchemaCore_2<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, true, TColumnSchema, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema>>, unknown> & (new (data?: InternalTreeNode | Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema>> | undefined) => TreeArrayNode<TColumnSchema, [TColumnSchema] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TColumnSchema> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TColumnSchema] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema> : never, ReadonlyArrayNode_2<TreeNode | TreeLeafValue_2>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, unknown>)>;
1013
+ readonly rows: (InsertableTypedNode_2<TreeNodeSchemaCore_2<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, true, TRowSchema, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema>>, unknown> & (new (data?: InternalTreeNode | Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema>> | undefined) => TreeArrayNode<TRowSchema, [TRowSchema] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TRowSchema> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TRowSchema] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema> : never, ReadonlyArrayNode_2<TreeNode | TreeLeafValue_2>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, unknown>)> | undefined) & InsertableTypedNode_2<TreeNodeSchemaCore_2<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, true, TRowSchema, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema>>, unknown> & (new (data?: InternalTreeNode | Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema>> | undefined) => TreeArrayNode<TRowSchema, [TRowSchema] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TRowSchema> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TRowSchema] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema> : never, ReadonlyArrayNode_2<TreeNode | TreeLeafValue_2>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, unknown>)>;
1014
+ readonly columns: (InsertableTypedNode_2<TreeNodeSchemaCore_2<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, true, TColumnSchema, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema>>, unknown> & (new (data?: InternalTreeNode | Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema>> | undefined) => TreeArrayNode<TColumnSchema, [TColumnSchema] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TColumnSchema> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TColumnSchema] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema> : never, ReadonlyArrayNode_2<TreeNode | TreeLeafValue_2>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, unknown>)> | undefined) & InsertableTypedNode_2<TreeNodeSchemaCore_2<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, true, TColumnSchema, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema>>, unknown> & (new (data?: InternalTreeNode | Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema>> | undefined) => TreeArrayNode<TColumnSchema, [TColumnSchema] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TColumnSchema> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TColumnSchema] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema> : never, ReadonlyArrayNode_2<TreeNode | TreeLeafValue_2>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, unknown>)>;
1015
1015
  })) => TreeNode & TableSchema.Table<TInputScope, TCellSchema, TColumnSchema, TRowSchema> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table">, NodeKind, unknown>) & {
1016
1016
  empty<TThis extends new (data: {
1017
- readonly rows: (InsertableTypedNode_2<TreeNodeSchemaCore_2<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, true, TRowSchema, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema>>, unknown> & (new (data?: InternalTreeNode | Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema>> | undefined) => TreeArrayNode<TRowSchema, [TRowSchema] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TRowSchema> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TRowSchema] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema> : never, ReadonlyArrayNode_2<TreeNode | TreeLeafValue_2>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, unknown>), TreeNodeSchemaCore_2<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, true, TRowSchema, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema>>, unknown> & (new (data?: InternalTreeNode | Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema>> | undefined) => TreeArrayNode<TRowSchema, [TRowSchema] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TRowSchema> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TRowSchema] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema> : never, ReadonlyArrayNode_2<TreeNode | TreeLeafValue_2>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, unknown>)> | undefined) & InsertableTypedNode_2<TreeNodeSchemaCore_2<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, true, TRowSchema, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema>>, unknown> & (new (data?: InternalTreeNode | Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema>> | undefined) => TreeArrayNode<TRowSchema, [TRowSchema] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TRowSchema> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TRowSchema] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema> : never, ReadonlyArrayNode_2<TreeNode | TreeLeafValue_2>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, unknown>), TreeNodeSchemaCore_2<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, true, TRowSchema, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema>>, unknown> & (new (data?: InternalTreeNode | Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema>> | undefined) => TreeArrayNode<TRowSchema, [TRowSchema] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TRowSchema> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TRowSchema] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema> : never, ReadonlyArrayNode_2<TreeNode | TreeLeafValue_2>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, unknown>)>;
1018
- readonly columns: (InsertableTypedNode_2<TreeNodeSchemaCore_2<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, true, TColumnSchema, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema>>, unknown> & (new (data?: InternalTreeNode | Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema>> | undefined) => TreeArrayNode<TColumnSchema, [TColumnSchema] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TColumnSchema> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TColumnSchema] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema> : never, ReadonlyArrayNode_2<TreeNode | TreeLeafValue_2>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, unknown>), TreeNodeSchemaCore_2<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, true, TColumnSchema, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema>>, unknown> & (new (data?: InternalTreeNode | Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema>> | undefined) => TreeArrayNode<TColumnSchema, [TColumnSchema] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TColumnSchema> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TColumnSchema] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema> : never, ReadonlyArrayNode_2<TreeNode | TreeLeafValue_2>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, unknown>)> | undefined) & InsertableTypedNode_2<TreeNodeSchemaCore_2<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, true, TColumnSchema, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema>>, unknown> & (new (data?: InternalTreeNode | Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema>> | undefined) => TreeArrayNode<TColumnSchema, [TColumnSchema] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TColumnSchema> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TColumnSchema] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema> : never, ReadonlyArrayNode_2<TreeNode | TreeLeafValue_2>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, unknown>), TreeNodeSchemaCore_2<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, true, TColumnSchema, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema>>, unknown> & (new (data?: InternalTreeNode | Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema>> | undefined) => TreeArrayNode<TColumnSchema, [TColumnSchema] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TColumnSchema> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TColumnSchema] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema> : never, ReadonlyArrayNode_2<TreeNode | TreeLeafValue_2>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, unknown>)>;
1017
+ readonly rows: (InsertableTypedNode_2<TreeNodeSchemaCore_2<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, true, TRowSchema, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema>>, unknown> & (new (data?: InternalTreeNode | Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema>> | undefined) => TreeArrayNode<TRowSchema, [TRowSchema] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TRowSchema> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TRowSchema] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema> : never, ReadonlyArrayNode_2<TreeNode | TreeLeafValue_2>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, unknown>)> | undefined) & InsertableTypedNode_2<TreeNodeSchemaCore_2<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, true, TRowSchema, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema>>, unknown> & (new (data?: InternalTreeNode | Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema>> | undefined) => TreeArrayNode<TRowSchema, [TRowSchema] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TRowSchema> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TRowSchema] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema> : never, ReadonlyArrayNode_2<TreeNode | TreeLeafValue_2>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, unknown>)>;
1018
+ readonly columns: (InsertableTypedNode_2<TreeNodeSchemaCore_2<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, true, TColumnSchema, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema>>, unknown> & (new (data?: InternalTreeNode | Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema>> | undefined) => TreeArrayNode<TColumnSchema, [TColumnSchema] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TColumnSchema> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TColumnSchema] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema> : never, ReadonlyArrayNode_2<TreeNode | TreeLeafValue_2>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, unknown>)> | undefined) & InsertableTypedNode_2<TreeNodeSchemaCore_2<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, true, TColumnSchema, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema>>, unknown> & (new (data?: InternalTreeNode | Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema>> | undefined) => TreeArrayNode<TColumnSchema, [TColumnSchema] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TColumnSchema> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TColumnSchema] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema> : never, ReadonlyArrayNode_2<TreeNode | TreeLeafValue_2>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, unknown>)>;
1019
1019
  }) => TreeNode & TableSchema.Table<TInputScope, TCellSchema, TColumnSchema, TRowSchema> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table">, NodeKind, unknown>>(this: TThis): InstanceType<TThis>;
1020
1020
  };
1021
1021
  // @system
@@ -76,7 +76,14 @@ export interface SchemaAndPolicy {
76
76
  readonly policy: SchemaPolicy;
77
77
  }
78
78
  /**
79
- * Extra data needed to interpret schema.
79
+ * Extra data needed to interpret stored schema.
80
+ * @remarks
81
+ * This contains information that describes the semantics of things which can be referenced in stored schema.
82
+ * For example, field kind identifiers refer to specific field kinds, which imply specific rules around what is valid in a given field (the multiplicity).
83
+ * This structure provides such information, allowing it to be possible to determine if a given tree complies with a particular stored schema.
84
+ *
85
+ * TODO: AB#43546
86
+ * Some additional data which is not needed to define compatibility with a given stored schema is currently included here, and should be removed.
80
87
  */
81
88
  export interface SchemaPolicy {
82
89
  /**
@@ -89,6 +96,8 @@ export interface SchemaPolicy {
89
96
  readonly fieldKinds: ReadonlyMap<FieldKindIdentifier, FieldKindData>;
90
97
  /**
91
98
  * If true, new content inserted into the tree should be validated against the stored schema.
99
+ * @remarks
100
+ * TODO: AB#43546: This is not information used to interpret the stored schema: this configuration should be moved elsewhere.
92
101
  */
93
102
  readonly validateSchema: boolean;
94
103
  /**
@@ -98,6 +107,10 @@ export interface SchemaPolicy {
98
107
  * @privateRemarks
99
108
  * Plumbing this in via `SchemaPolicy` avoids needing to walk the view schema representation repeatedly in places
100
109
  * that need it (schema validation, view vs stored compatibility checks).
110
+ *
111
+ * TODO: AB#43546
112
+ * This is not information used to interpret the stored schema: it is instead about view schema, and how compatible they are with a stored schema.
113
+ * SchemaCompatibilityTester should be updated to not store this table in here, and then this field should be removed.
101
114
  */
102
115
  allowUnknownOptionalFields(identifier: TreeNodeSchemaIdentifier): boolean;
103
116
  }
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/core/schema-stored/schema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EACN,KAAK,4BAA4B,EACjC,KAAK,WAAW,EAGhB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACN,KAAK,QAAQ,EACb,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,IAAI,mBAAmB,EAE7C,KAAK,wBAAwB,IAAI,0BAA0B,EAC3D,KAAK,wBAAwB,EAC7B,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EACX,iBAAiB,IAAI,mBAAmB,EACxC,uBAAuB,EACvB,yBAAyB,EACzB,wBAAwB,IAAI,0BAA0B,EACtD,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD;;GAEG;AACH,oBAAY,aAAa;IACxB,EAAE,IAAI;IACN;;OAEG;IACH,EAAE,IAAI;CACN;AAID;;;;;;;;GAQG;AACH,oBAAY,WAAW;IACtB,MAAM,IAAA;IACN,MAAM,IAAA;IACN,OAAO,IAAA;IACP,WAAW,IAAA;IACX,IAAI,IAAA;CACJ;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,MAAM,WAAW,GAAG,WAAW,CAAC,wBAAwB,CAAC,CAAC;AAEhE;;;;;GAKG;AACH,MAAM,WAAW,aAA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GAAG,qBAAqB,CAQpF;AAED;;;;;;GAMG;AACH,MAAM,WAAW,gBAAiB,SAAQ,sBAAsB;IAC/D;;OAEG;IACH,QAAQ,CAAC,eAAe,EAAE,qBAAqB,CAAC;CAChD;AAED;;;;;;GAMG;AACH,MAAM,WAAW,sBAAsB;IACtC;;OAEG;IACH,QAAQ,CAAC,UAAU,EAAE,WAAW,CAAC,wBAAwB,EAAE,oBAAoB,CAAC,CAAC;CACjF"}
@@ -1 +1 @@
1
- {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/core/schema-stored/schema.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA2D;AAE3D,mDAAoE;AACpE,kDAK6B;AAE7B,+CAOuB;AASvB;;GAEG;AACH,IAAY,aAMX;AAND,WAAY,aAAa;IACxB,6CAAM,CAAA;IACN;;OAEG;IACH,6CAAM,CAAA;AACP,CAAC,EANW,aAAa,6BAAb,aAAa,QAMxB;AAID;;;;;;;;GAQG;AACH,IAAY,WAMX;AAND,WAAY,WAAW;IACtB,iDAAM,CAAA;IACN,iDAAM,CAAA;IACN,mDAAO,CAAA;IACP,2DAAW,CAAA;IACX,6CAAI,CAAA;AACL,CAAC,EANW,WAAW,2BAAX,WAAW,QAMtB;AAmGD;;;;;;;;;GASG;AACU,QAAA,4BAA4B,GAAG,WAAW,CAAC;AAExD;;;GAGG;AACU,QAAA,sBAAsB,GAA0B;IAC5D,4CAA4C;IAC5C,IAAI,EAAE,IAAA,gBAAK,EAAC,oCAA4B,CAAC;IACzC,qFAAqF;IACrF,KAAK,EAAE,IAAI,GAAG,EAAE;IAChB,iBAAiB,EAAE,SAAS;CAC5B,CAAC;AAEF;;GAEG;AACU,QAAA,6BAA6B,GAAG,YAAY,CAAC;AAE1D,MAAsB,oBAAoB;IAGzC;;;OAGG;IACH,YAAmC,QAA6C;QAA7C,aAAQ,GAAR,QAAQ,CAAqC;IAAG,CAAC;CAiBpF;AAxBD,oDAwBC;AAED,MAAa,sBAAuB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8B;IACxD,OAAO,iBAAiB,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,IAAA,eAAI,EAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC;AACjF,CAAC;AAED,SAAgB,mBAAmB,CAAC,MAA6B;IAChE,OAAO;QACN,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,iHAAiH;QACjH,KAAK,EAAE,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE;KAC/B,CAAC;AACH,CAAC;AAND,kDAMC;AAED,SAAgB,mBAAmB,CAAC,MAA6B;IAChE,MAAM,WAAW,GAAwB,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAErE,mDAAmD;IACnD,OAAO,MAAM,CAAC,iBAAiB,KAAK,SAAS;QAC5C,CAAC,CAAC,EAAE,GAAG,WAAW,EAAE,QAAQ,EAAE,MAAM,CAAC,iBAAiB,EAAE;QACxD,CAAC,CAAC,EAAE,GAAG,WAAW,EAAE,CAAC;AACvB,CAAC;AAPD,kDAOC;AAED,SAAgB,iBAAiB,CAAC,MAA2B;IAC5D,MAAM,GAAG,GAA0B;QAClC,kFAAkF;QAClF,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,KAAK,EAAE,IAAI,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC;QAC5B,iBAAiB,EAAE,MAAM,CAAC,QAAQ;KAClC,CAAC;IACF,OAAO,GAAG,CAAC;AACZ,CAAC;AARD,8CAQC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { fail } from \"@fluidframework/core-utils/internal\";\n\nimport { DiscriminatedUnionDispatcher } from \"../../codec/index.js\";\nimport {\n\ttype JsonCompatibleReadOnlyObject,\n\ttype MakeNominal,\n\tbrand,\n\tinvertMap,\n} from \"../../util/index.js\";\n\nimport {\n\ttype FieldKey,\n\ttype FieldKindIdentifier,\n\ttype FieldSchemaFormat as FieldSchemaFormatV1,\n\tPersistedValueSchema,\n\ttype TreeNodeSchemaDataFormat as TreeNodeSchemaDataFormatV1,\n\ttype TreeNodeSchemaIdentifier,\n} from \"./formatV1.js\";\nimport type {\n\tFieldSchemaFormat as FieldSchemaFormatV2,\n\tPersistedMetadataFormat,\n\tTreeNodeSchemaUnionFormat,\n\tTreeNodeSchemaDataFormat as TreeNodeSchemaDataFormatV2,\n} from \"./formatV2.js\";\nimport type { Multiplicity } from \"./multiplicity.js\";\n\n/**\n * The format version for the schema.\n */\nexport enum SchemaVersion {\n\tv1 = 1,\n\t/**\n\t * Adds persisted metadata to the node schema and field schema.\n\t */\n\tv2 = 2,\n}\n\ntype FieldSchemaFormat = FieldSchemaFormatV1 | FieldSchemaFormatV2;\n\n/**\n * Schema for what {@link TreeLeafValue} is allowed on a Leaf node.\n * @privateRemarks\n * See also {@link TreeValue}.\n * If further stabilizing this,\n * consider the implications of how this might prevent adding of new leaf types in the future.\n * Maybe add a disclaimer that it might be extended like on {@link NodeKind}?\n * @alpha\n */\nexport enum ValueSchema {\n\tNumber,\n\tString,\n\tBoolean,\n\tFluidHandle,\n\tNull,\n}\n\n/**\n * Set of allowed tree types.\n * Providing multiple values here allows polymorphism, tagged union style.\n *\n * In the future, this could be extended to allow inlining a TreeNodeStoredSchema here\n * (or some similar structural schema system).\n * For structural types which could go here, there are a few interesting options:\n *\n * - Allow replacing the whole set with a structural type for terminal / non-tree data,\n * and use this as a replacement for values on the tree nodes.\n *\n * - Allow expression structural constraints for child trees, for example requiring specific traits\n * (ex: via TreeNodeStoredSchema), instead of by type.\n *\n * There are two ways this could work:\n *\n * - Constrain the child nodes based on their shape:\n * this makes schema safe editing difficult because nodes would incur extra editing constraints to prevent them\n * from going out of schema based on their location in such a field.\n *\n * - Constrain the types allowed based on which types guarantee their data will always meet the constraints.\n *\n * Care would need to be taken to make sure this is sound for the schema updating mechanisms.\n */\nexport type TreeTypeSet = ReadonlySet<TreeNodeSchemaIdentifier>;\n\n/**\n * Declarative portion of a Field Kind.\n *\n * @remarks\n * Enough info about a field kind to know if a given tree is is schema.\n */\nexport interface FieldKindData {\n\treadonly identifier: FieldKindIdentifier;\n\treadonly multiplicity: Multiplicity;\n}\n\n/**\n * Everything needed to define what it means for a tree to be in schema.\n */\nexport interface SchemaAndPolicy {\n\treadonly schema: StoredSchemaCollection;\n\treadonly policy: SchemaPolicy;\n}\n\n/**\n * Extra data needed to interpret schema.\n */\nexport interface SchemaPolicy {\n\t/**\n\t * Policy information about FieldKinds:\n\t * This is typically stored as code, not in documents, and defines how to handle fields based on their kind.\n\t * It is assumed that all users of a document will have exactly the same FieldKind policies,\n\t * though older applications might be missing some,\n\t * and will be unable to process any changes that use those FieldKinds.\n\t */\n\treadonly fieldKinds: ReadonlyMap<FieldKindIdentifier, FieldKindData>;\n\n\t/**\n\t * If true, new content inserted into the tree should be validated against the stored schema.\n\t */\n\treadonly validateSchema: boolean;\n\n\t/**\n\t * Whether to allow a document to be opened when a particular stored schema (identified by `identifier`)\n\t * contains optional fields that are not known to the view schema.\n\t *\n\t * @privateRemarks\n\t * Plumbing this in via `SchemaPolicy` avoids needing to walk the view schema representation repeatedly in places\n\t * that need it (schema validation, view vs stored compatibility checks).\n\t */\n\tallowUnknownOptionalFields(identifier: TreeNodeSchemaIdentifier): boolean;\n}\n\n/**\n * Schema for a field.\n * Object implementing this interface should never be modified.\n */\nexport interface TreeFieldStoredSchema {\n\treadonly kind: FieldKindIdentifier;\n\n\t/**\n\t * The set of allowed child types.\n\t * If not specified, types are unconstrained.\n\t */\n\treadonly types: TreeTypeSet;\n\n\t/**\n\t * Portion of the metadata which can be persisted.\n\t * @remarks\n\t * Discarded when encoding to {@link SchemaFormatVersion.V1}.\n\t * @privateRemarks\n\t * This field corresponds to the `metadata` field in the persisted schema format.\n\t */\n\treadonly persistedMetadata: JsonCompatibleReadOnlyObject | undefined;\n}\n\n/**\n * Identifier used for the FieldKind for fields which must be empty.\n *\n * @remarks\n * This mainly show up in:\n *\n * 1. The root default field for documents.\n *\n * 2. The schema used for out of schema fields (which thus must be empty/not exist) on object and leaf nodes.\n */\nexport const forbiddenFieldKindIdentifier = \"Forbidden\";\n\n/**\n * A schema for empty fields (fields which must always be empty).\n * There are multiple ways this could be encoded, but this is the most explicit.\n */\nexport const storedEmptyFieldSchema: TreeFieldStoredSchema = {\n\t// This kind requires the field to be empty.\n\tkind: brand(forbiddenFieldKindIdentifier),\n\t// This type set also forces the field to be empty not not allowing any types as all.\n\ttypes: new Set(),\n\tpersistedMetadata: undefined,\n};\n\n/**\n * Identifier used for the FieldKind for fields of type identifier.\n */\nexport const identifierFieldKindIdentifier = \"Identifier\";\n\nexport abstract class TreeNodeStoredSchema {\n\tprotected _typeCheck!: MakeNominal;\n\n\t/**\n\t * Constructor for a TreeNodeStoredSchema.\n\t * @param metadata - Persisted metadata for this node schema.\n\t */\n\tpublic constructor(public readonly metadata: PersistedMetadataFormat | undefined) {}\n\n\t/**\n\t * Encode in the v1 schema format.\n\t */\n\tpublic abstract encodeV1(): TreeNodeSchemaDataFormatV1;\n\n\t/**\n\t * Encode in the v2 schema format.\n\t * @remarks Post-condition: if metadata was specified on the input schema, it will be present in the output.\n\t */\n\tpublic abstract encodeV2(): TreeNodeSchemaDataFormatV2;\n\n\t/**\n\t * Returns the schema for the provided field.\n\t */\n\tpublic abstract getFieldSchema(field: FieldKey): TreeFieldStoredSchema;\n}\n\nexport class ObjectNodeStoredSchema extends TreeNodeStoredSchema {\n\t/**\n\t * @param objectNodeFields -\n\t * Schema for fields with keys scoped to this TreeNodeStoredSchema.\n\t * This refers to the TreeFieldStoredSchema directly\n\t * (as opposed to just supporting FieldSchemaIdentifier and having a central FieldKey -\\> TreeFieldStoredSchema map).\n\t * This allows us short friendly field keys which can be ergonomically used as field names in code.\n\t * It also interoperates well with mapFields being used as a map with arbitrary data as keys.\n\t */\n\tpublic constructor(\n\t\tpublic readonly objectNodeFields: ReadonlyMap<FieldKey, TreeFieldStoredSchema>,\n\t\tmetadata?: PersistedMetadataFormat | undefined,\n\t) {\n\t\tsuper(metadata);\n\t}\n\n\tpublic override encodeV1(): TreeNodeSchemaDataFormatV1 {\n\t\tconst fieldsObject: Record<string, FieldSchemaFormat> =\n\t\t\tthis.encodeFieldsObject(encodeFieldSchemaV1);\n\n\t\treturn {\n\t\t\tobject: fieldsObject,\n\t\t};\n\t}\n\n\tpublic override encodeV2(): TreeNodeSchemaDataFormatV2 {\n\t\tconst fieldsObject: Record<string, FieldSchemaFormat> =\n\t\t\tthis.encodeFieldsObject(encodeFieldSchemaV2);\n\t\tconst kind = { object: fieldsObject };\n\n\t\treturn { kind, metadata: this.metadata };\n\t}\n\n\tpublic override getFieldSchema(field: FieldKey): TreeFieldStoredSchema {\n\t\treturn this.objectNodeFields.get(field) ?? storedEmptyFieldSchema;\n\t}\n\n\tprivate encodeFieldsObject(\n\t\tencodeFieldSchema: (storedFieldSchema: TreeFieldStoredSchema) => FieldSchemaFormat,\n\t): Record<string, FieldSchemaFormat> {\n\t\tconst fieldsObject: Record<string, FieldSchemaFormat> = Object.create(null);\n\t\t// Sort fields to ensure output is identical for for equivalent schema (since field order is not considered significant).\n\t\t// This makes comparing schema easier, and ensures chunk reuse for schema summaries isn't needlessly broken.\n\t\tfor (const key of [...this.objectNodeFields.keys()].sort()) {\n\t\t\tObject.defineProperty(fieldsObject, key, {\n\t\t\t\tenumerable: true,\n\t\t\t\tconfigurable: true,\n\t\t\t\twritable: true,\n\t\t\t\tvalue: encodeFieldSchema(\n\t\t\t\t\tthis.objectNodeFields.get(key) ?? fail(0xae7 /* missing field */),\n\t\t\t\t),\n\t\t\t});\n\t\t}\n\t\treturn fieldsObject;\n\t}\n}\n\nexport class MapNodeStoredSchema extends TreeNodeStoredSchema {\n\t/**\n\t * @param mapFields -\n\t * Allows using the fields as a map, with the keys being\n\t * FieldKeys and the values being constrained by this TreeFieldStoredSchema.\n\t * Usually `FieldKind.Value` should NOT be used here\n\t * since no nodes can ever be in schema if you use `FieldKind.Value` here\n\t * (that would require infinite children).\n\t */\n\tpublic constructor(\n\t\tpublic readonly mapFields: TreeFieldStoredSchema,\n\t\tmetadata?: PersistedMetadataFormat | undefined,\n\t) {\n\t\tsuper(metadata);\n\t}\n\n\tpublic override encodeV1(): TreeNodeSchemaDataFormatV1 {\n\t\treturn {\n\t\t\tmap: encodeFieldSchemaV1(this.mapFields),\n\t\t};\n\t}\n\n\tpublic override encodeV2(): TreeNodeSchemaDataFormatV2 {\n\t\tconst kind = { map: encodeFieldSchemaV2(this.mapFields) };\n\t\treturn { kind, metadata: this.metadata };\n\t}\n\n\tpublic override getFieldSchema(field: FieldKey): TreeFieldStoredSchema {\n\t\treturn this.mapFields;\n\t}\n}\n\nexport class LeafNodeStoredSchema extends TreeNodeStoredSchema {\n\t/**\n\t * @param leafValue -\n\t * There are several approaches for how to store actual data in the tree\n\t * (special node types, special field contents, data on nodes etc.)\n\t * as well as several options about how the data should be modeled at this level\n\t * (byte sequence? javascript type? json?),\n\t * as well as options for how much of this would be exposed in the schema language\n\t * (ex: would all nodes with values be special built-ins, or could any schema add them?)\n\t * A simple easy to do in javascript approach is taken here:\n\t * this is not intended to be a suggestion of what approach to take, or what to expose in the schema language.\n\t * This is simply one approach that can work for modeling them in the internal schema representation.\n\t */\n\tpublic constructor(public readonly leafValue: ValueSchema) {\n\t\t// No metadata for leaf nodes.\n\t\tsuper(undefined);\n\t}\n\n\tpublic override encodeV1(): TreeNodeSchemaDataFormatV1 {\n\t\treturn {\n\t\t\tleaf: encodeValueSchema(this.leafValue),\n\t\t};\n\t}\n\n\tpublic override encodeV2(): TreeNodeSchemaDataFormatV2 {\n\t\treturn {\n\t\t\t// No metadata for leaf nodes, so don't emit a metadata field.\n\t\t\tkind: {\n\t\t\t\tleaf: encodeValueSchema(this.leafValue),\n\t\t\t},\n\t\t};\n\t}\n\n\tpublic override getFieldSchema(field: FieldKey): TreeFieldStoredSchema {\n\t\treturn storedEmptyFieldSchema;\n\t}\n}\n\n/**\n * Decoder wrapper function for {@link TreeNodeStoredSchema} implementations.\n * Curries the constructor so that the caller can inject metadata.\n */\ntype StoredSchemaDecoder = (\n\tmetadata: PersistedMetadataFormat | undefined,\n) => TreeNodeStoredSchema;\n\nexport const storedSchemaDecodeDispatcher: DiscriminatedUnionDispatcher<\n\tTreeNodeSchemaUnionFormat,\n\t[],\n\tStoredSchemaDecoder\n> = new DiscriminatedUnionDispatcher({\n\tleaf: (data: PersistedValueSchema) => (metadata) =>\n\t\tnew LeafNodeStoredSchema(decodeValueSchema(data)),\n\tobject: (data: Record<TreeNodeSchemaIdentifier, FieldSchemaFormat>) => (metadata) => {\n\t\tconst map = new Map();\n\t\tfor (const [key, value] of Object.entries(data)) {\n\t\t\tmap.set(key, decodeFieldSchema(value));\n\t\t}\n\t\treturn new ObjectNodeStoredSchema(map, metadata);\n\t},\n\tmap: (data: FieldSchemaFormat) => (metadata) =>\n\t\tnew MapNodeStoredSchema(decodeFieldSchema(data), metadata),\n});\n\nconst valueSchemaEncode = new Map([\n\t[ValueSchema.Number, PersistedValueSchema.Number],\n\t[ValueSchema.String, PersistedValueSchema.String],\n\t[ValueSchema.Boolean, PersistedValueSchema.Boolean],\n\t[ValueSchema.FluidHandle, PersistedValueSchema.FluidHandle],\n\t[ValueSchema.Null, PersistedValueSchema.Null],\n]);\n\nconst valueSchemaDecode = invertMap(valueSchemaEncode);\n\nfunction encodeValueSchema(inMemory: ValueSchema): PersistedValueSchema {\n\treturn valueSchemaEncode.get(inMemory) ?? fail(0xae8 /* missing PersistedValueSchema */);\n}\n\nfunction decodeValueSchema(inMemory: PersistedValueSchema): ValueSchema {\n\treturn valueSchemaDecode.get(inMemory) ?? fail(0xae9 /* missing ValueSchema */);\n}\n\nexport function encodeFieldSchemaV1(schema: TreeFieldStoredSchema): FieldSchemaFormatV1 {\n\treturn {\n\t\tkind: schema.kind,\n\t\t// Types are sorted by identifier to improve stability of persisted data to increase chance of schema blob reuse.\n\t\ttypes: [...schema.types].sort(),\n\t};\n}\n\nexport function encodeFieldSchemaV2(schema: TreeFieldStoredSchema): FieldSchemaFormatV2 {\n\tconst fieldSchema: FieldSchemaFormatV1 = encodeFieldSchemaV1(schema);\n\n\t// Omit metadata from the output if it is undefined\n\treturn schema.persistedMetadata !== undefined\n\t\t? { ...fieldSchema, metadata: schema.persistedMetadata }\n\t\t: { ...fieldSchema };\n}\n\nexport function decodeFieldSchema(schema: FieldSchemaFormatV2): TreeFieldStoredSchema {\n\tconst out: TreeFieldStoredSchema = {\n\t\t// TODO: maybe provide actual FieldKind objects here, error on unrecognized kinds.\n\t\tkind: schema.kind,\n\t\ttypes: new Set(schema.types),\n\t\tpersistedMetadata: schema.metadata,\n\t};\n\treturn out;\n}\n\n/**\n * Document schema data that can be stored in a document.\n *\n * @remarks\n * Note: the owner of this may modify it over time:\n * thus if needing to hand onto a specific version, make a copy.\n */\nexport interface TreeStoredSchema extends StoredSchemaCollection {\n\t/**\n\t * Schema for the root field which contains the whole tree.\n\t */\n\treadonly rootFieldSchema: TreeFieldStoredSchema;\n}\n\n/**\n * Collection of TreeNodeSchema data that can be stored in a document.\n *\n * @remarks\n * Note: the owner of this may modify it over time:\n * thus if needing to hang onto a specific version, make a copy.\n */\nexport interface StoredSchemaCollection {\n\t/**\n\t * {@inheritdoc StoredSchemaCollection}\n\t */\n\treadonly nodeSchema: ReadonlyMap<TreeNodeSchemaIdentifier, TreeNodeStoredSchema>;\n}\n"]}
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/core/schema-stored/schema.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA2D;AAE3D,mDAAoE;AACpE,kDAK6B;AAE7B,+CAOuB;AASvB;;GAEG;AACH,IAAY,aAMX;AAND,WAAY,aAAa;IACxB,6CAAM,CAAA;IACN;;OAEG;IACH,6CAAM,CAAA;AACP,CAAC,EANW,aAAa,6BAAb,aAAa,QAMxB;AAID;;;;;;;;GAQG;AACH,IAAY,WAMX;AAND,WAAY,WAAW;IACtB,iDAAM,CAAA;IACN,iDAAM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D,MAAM,GAAG,GAA0B;QAClC,kFAAkF;QAClF,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,KAAK,EAAE,IAAI,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC;QAC5B,iBAAiB,EAAE,MAAM,CAAC,QAAQ;KAClC,CAAC;IACF,OAAO,GAAG,CAAC;AACZ,CAAC;AARD,8CAQC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { fail } from \"@fluidframework/core-utils/internal\";\n\nimport { DiscriminatedUnionDispatcher } from \"../../codec/index.js\";\nimport {\n\ttype JsonCompatibleReadOnlyObject,\n\ttype MakeNominal,\n\tbrand,\n\tinvertMap,\n} from \"../../util/index.js\";\n\nimport {\n\ttype FieldKey,\n\ttype FieldKindIdentifier,\n\ttype FieldSchemaFormat as FieldSchemaFormatV1,\n\tPersistedValueSchema,\n\ttype TreeNodeSchemaDataFormat as TreeNodeSchemaDataFormatV1,\n\ttype TreeNodeSchemaIdentifier,\n} from \"./formatV1.js\";\nimport type {\n\tFieldSchemaFormat as FieldSchemaFormatV2,\n\tPersistedMetadataFormat,\n\tTreeNodeSchemaUnionFormat,\n\tTreeNodeSchemaDataFormat as TreeNodeSchemaDataFormatV2,\n} from \"./formatV2.js\";\nimport type { Multiplicity } from \"./multiplicity.js\";\n\n/**\n * The format version for the schema.\n */\nexport enum SchemaVersion {\n\tv1 = 1,\n\t/**\n\t * Adds persisted metadata to the node schema and field schema.\n\t */\n\tv2 = 2,\n}\n\ntype FieldSchemaFormat = FieldSchemaFormatV1 | FieldSchemaFormatV2;\n\n/**\n * Schema for what {@link TreeLeafValue} is allowed on a Leaf node.\n * @privateRemarks\n * See also {@link TreeValue}.\n * If further stabilizing this,\n * consider the implications of how this might prevent adding of new leaf types in the future.\n * Maybe add a disclaimer that it might be extended like on {@link NodeKind}?\n * @alpha\n */\nexport enum ValueSchema {\n\tNumber,\n\tString,\n\tBoolean,\n\tFluidHandle,\n\tNull,\n}\n\n/**\n * Set of allowed tree types.\n * Providing multiple values here allows polymorphism, tagged union style.\n *\n * In the future, this could be extended to allow inlining a TreeNodeStoredSchema here\n * (or some similar structural schema system).\n * For structural types which could go here, there are a few interesting options:\n *\n * - Allow replacing the whole set with a structural type for terminal / non-tree data,\n * and use this as a replacement for values on the tree nodes.\n *\n * - Allow expression structural constraints for child trees, for example requiring specific traits\n * (ex: via TreeNodeStoredSchema), instead of by type.\n *\n * There are two ways this could work:\n *\n * - Constrain the child nodes based on their shape:\n * this makes schema safe editing difficult because nodes would incur extra editing constraints to prevent them\n * from going out of schema based on their location in such a field.\n *\n * - Constrain the types allowed based on which types guarantee their data will always meet the constraints.\n *\n * Care would need to be taken to make sure this is sound for the schema updating mechanisms.\n */\nexport type TreeTypeSet = ReadonlySet<TreeNodeSchemaIdentifier>;\n\n/**\n * Declarative portion of a Field Kind.\n *\n * @remarks\n * Enough info about a field kind to know if a given tree is is schema.\n */\nexport interface FieldKindData {\n\treadonly identifier: FieldKindIdentifier;\n\treadonly multiplicity: Multiplicity;\n}\n\n/**\n * Everything needed to define what it means for a tree to be in schema.\n */\nexport interface SchemaAndPolicy {\n\treadonly schema: StoredSchemaCollection;\n\treadonly policy: SchemaPolicy;\n}\n\n/**\n * Extra data needed to interpret stored schema.\n * @remarks\n * This contains information that describes the semantics of things which can be referenced in stored schema.\n * For example, field kind identifiers refer to specific field kinds, which imply specific rules around what is valid in a given field (the multiplicity).\n * This structure provides such information, allowing it to be possible to determine if a given tree complies with a particular stored schema.\n *\n * TODO: AB#43546\n * Some additional data which is not needed to define compatibility with a given stored schema is currently included here, and should be removed.\n */\nexport interface SchemaPolicy {\n\t/**\n\t * Policy information about FieldKinds:\n\t * This is typically stored as code, not in documents, and defines how to handle fields based on their kind.\n\t * It is assumed that all users of a document will have exactly the same FieldKind policies,\n\t * though older applications might be missing some,\n\t * and will be unable to process any changes that use those FieldKinds.\n\t */\n\treadonly fieldKinds: ReadonlyMap<FieldKindIdentifier, FieldKindData>;\n\n\t/**\n\t * If true, new content inserted into the tree should be validated against the stored schema.\n\t * @remarks\n\t * TODO: AB#43546: This is not information used to interpret the stored schema: this configuration should be moved elsewhere.\n\t */\n\treadonly validateSchema: boolean;\n\n\t/**\n\t * Whether to allow a document to be opened when a particular stored schema (identified by `identifier`)\n\t * contains optional fields that are not known to the view schema.\n\t *\n\t * @privateRemarks\n\t * Plumbing this in via `SchemaPolicy` avoids needing to walk the view schema representation repeatedly in places\n\t * that need it (schema validation, view vs stored compatibility checks).\n\t *\n\t * TODO: AB#43546\n\t * This is not information used to interpret the stored schema: it is instead about view schema, and how compatible they are with a stored schema.\n\t * SchemaCompatibilityTester should be updated to not store this table in here, and then this field should be removed.\n\t */\n\tallowUnknownOptionalFields(identifier: TreeNodeSchemaIdentifier): boolean;\n}\n\n/**\n * Schema for a field.\n * Object implementing this interface should never be modified.\n */\nexport interface TreeFieldStoredSchema {\n\treadonly kind: FieldKindIdentifier;\n\n\t/**\n\t * The set of allowed child types.\n\t * If not specified, types are unconstrained.\n\t */\n\treadonly types: TreeTypeSet;\n\n\t/**\n\t * Portion of the metadata which can be persisted.\n\t * @remarks\n\t * Discarded when encoding to {@link SchemaFormatVersion.V1}.\n\t * @privateRemarks\n\t * This field corresponds to the `metadata` field in the persisted schema format.\n\t */\n\treadonly persistedMetadata: JsonCompatibleReadOnlyObject | undefined;\n}\n\n/**\n * Identifier used for the FieldKind for fields which must be empty.\n *\n * @remarks\n * This mainly show up in:\n *\n * 1. The root default field for documents.\n *\n * 2. The schema used for out of schema fields (which thus must be empty/not exist) on object and leaf nodes.\n */\nexport const forbiddenFieldKindIdentifier = \"Forbidden\";\n\n/**\n * A schema for empty fields (fields which must always be empty).\n * There are multiple ways this could be encoded, but this is the most explicit.\n */\nexport const storedEmptyFieldSchema: TreeFieldStoredSchema = {\n\t// This kind requires the field to be empty.\n\tkind: brand(forbiddenFieldKindIdentifier),\n\t// This type set also forces the field to be empty not not allowing any types as all.\n\ttypes: new Set(),\n\tpersistedMetadata: undefined,\n};\n\n/**\n * Identifier used for the FieldKind for fields of type identifier.\n */\nexport const identifierFieldKindIdentifier = \"Identifier\";\n\nexport abstract class TreeNodeStoredSchema {\n\tprotected _typeCheck!: MakeNominal;\n\n\t/**\n\t * Constructor for a TreeNodeStoredSchema.\n\t * @param metadata - Persisted metadata for this node schema.\n\t */\n\tpublic constructor(public readonly metadata: PersistedMetadataFormat | undefined) {}\n\n\t/**\n\t * Encode in the v1 schema format.\n\t */\n\tpublic abstract encodeV1(): TreeNodeSchemaDataFormatV1;\n\n\t/**\n\t * Encode in the v2 schema format.\n\t * @remarks Post-condition: if metadata was specified on the input schema, it will be present in the output.\n\t */\n\tpublic abstract encodeV2(): TreeNodeSchemaDataFormatV2;\n\n\t/**\n\t * Returns the schema for the provided field.\n\t */\n\tpublic abstract getFieldSchema(field: FieldKey): TreeFieldStoredSchema;\n}\n\nexport class ObjectNodeStoredSchema extends TreeNodeStoredSchema {\n\t/**\n\t * @param objectNodeFields -\n\t * Schema for fields with keys scoped to this TreeNodeStoredSchema.\n\t * This refers to the TreeFieldStoredSchema directly\n\t * (as opposed to just supporting FieldSchemaIdentifier and having a central FieldKey -\\> TreeFieldStoredSchema map).\n\t * This allows us short friendly field keys which can be ergonomically used as field names in code.\n\t * It also interoperates well with mapFields being used as a map with arbitrary data as keys.\n\t */\n\tpublic constructor(\n\t\tpublic readonly objectNodeFields: ReadonlyMap<FieldKey, TreeFieldStoredSchema>,\n\t\tmetadata?: PersistedMetadataFormat | undefined,\n\t) {\n\t\tsuper(metadata);\n\t}\n\n\tpublic override encodeV1(): TreeNodeSchemaDataFormatV1 {\n\t\tconst fieldsObject: Record<string, FieldSchemaFormat> =\n\t\t\tthis.encodeFieldsObject(encodeFieldSchemaV1);\n\n\t\treturn {\n\t\t\tobject: fieldsObject,\n\t\t};\n\t}\n\n\tpublic override encodeV2(): TreeNodeSchemaDataFormatV2 {\n\t\tconst fieldsObject: Record<string, FieldSchemaFormat> =\n\t\t\tthis.encodeFieldsObject(encodeFieldSchemaV2);\n\t\tconst kind = { object: fieldsObject };\n\n\t\treturn { kind, metadata: this.metadata };\n\t}\n\n\tpublic override getFieldSchema(field: FieldKey): TreeFieldStoredSchema {\n\t\treturn this.objectNodeFields.get(field) ?? storedEmptyFieldSchema;\n\t}\n\n\tprivate encodeFieldsObject(\n\t\tencodeFieldSchema: (storedFieldSchema: TreeFieldStoredSchema) => FieldSchemaFormat,\n\t): Record<string, FieldSchemaFormat> {\n\t\tconst fieldsObject: Record<string, FieldSchemaFormat> = Object.create(null);\n\t\t// Sort fields to ensure output is identical for for equivalent schema (since field order is not considered significant).\n\t\t// This makes comparing schema easier, and ensures chunk reuse for schema summaries isn't needlessly broken.\n\t\tfor (const key of [...this.objectNodeFields.keys()].sort()) {\n\t\t\tObject.defineProperty(fieldsObject, key, {\n\t\t\t\tenumerable: true,\n\t\t\t\tconfigurable: true,\n\t\t\t\twritable: true,\n\t\t\t\tvalue: encodeFieldSchema(\n\t\t\t\t\tthis.objectNodeFields.get(key) ?? fail(0xae7 /* missing field */),\n\t\t\t\t),\n\t\t\t});\n\t\t}\n\t\treturn fieldsObject;\n\t}\n}\n\nexport class MapNodeStoredSchema extends TreeNodeStoredSchema {\n\t/**\n\t * @param mapFields -\n\t * Allows using the fields as a map, with the keys being\n\t * FieldKeys and the values being constrained by this TreeFieldStoredSchema.\n\t * Usually `FieldKind.Value` should NOT be used here\n\t * since no nodes can ever be in schema if you use `FieldKind.Value` here\n\t * (that would require infinite children).\n\t */\n\tpublic constructor(\n\t\tpublic readonly mapFields: TreeFieldStoredSchema,\n\t\tmetadata?: PersistedMetadataFormat | undefined,\n\t) {\n\t\tsuper(metadata);\n\t}\n\n\tpublic override encodeV1(): TreeNodeSchemaDataFormatV1 {\n\t\treturn {\n\t\t\tmap: encodeFieldSchemaV1(this.mapFields),\n\t\t};\n\t}\n\n\tpublic override encodeV2(): TreeNodeSchemaDataFormatV2 {\n\t\tconst kind = { map: encodeFieldSchemaV2(this.mapFields) };\n\t\treturn { kind, metadata: this.metadata };\n\t}\n\n\tpublic override getFieldSchema(field: FieldKey): TreeFieldStoredSchema {\n\t\treturn this.mapFields;\n\t}\n}\n\nexport class LeafNodeStoredSchema extends TreeNodeStoredSchema {\n\t/**\n\t * @param leafValue -\n\t * There are several approaches for how to store actual data in the tree\n\t * (special node types, special field contents, data on nodes etc.)\n\t * as well as several options about how the data should be modeled at this level\n\t * (byte sequence? javascript type? json?),\n\t * as well as options for how much of this would be exposed in the schema language\n\t * (ex: would all nodes with values be special built-ins, or could any schema add them?)\n\t * A simple easy to do in javascript approach is taken here:\n\t * this is not intended to be a suggestion of what approach to take, or what to expose in the schema language.\n\t * This is simply one approach that can work for modeling them in the internal schema representation.\n\t */\n\tpublic constructor(public readonly leafValue: ValueSchema) {\n\t\t// No metadata for leaf nodes.\n\t\tsuper(undefined);\n\t}\n\n\tpublic override encodeV1(): TreeNodeSchemaDataFormatV1 {\n\t\treturn {\n\t\t\tleaf: encodeValueSchema(this.leafValue),\n\t\t};\n\t}\n\n\tpublic override encodeV2(): TreeNodeSchemaDataFormatV2 {\n\t\treturn {\n\t\t\t// No metadata for leaf nodes, so don't emit a metadata field.\n\t\t\tkind: {\n\t\t\t\tleaf: encodeValueSchema(this.leafValue),\n\t\t\t},\n\t\t};\n\t}\n\n\tpublic override getFieldSchema(field: FieldKey): TreeFieldStoredSchema {\n\t\treturn storedEmptyFieldSchema;\n\t}\n}\n\n/**\n * Decoder wrapper function for {@link TreeNodeStoredSchema} implementations.\n * Curries the constructor so that the caller can inject metadata.\n */\ntype StoredSchemaDecoder = (\n\tmetadata: PersistedMetadataFormat | undefined,\n) => TreeNodeStoredSchema;\n\nexport const storedSchemaDecodeDispatcher: DiscriminatedUnionDispatcher<\n\tTreeNodeSchemaUnionFormat,\n\t[],\n\tStoredSchemaDecoder\n> = new DiscriminatedUnionDispatcher({\n\tleaf: (data: PersistedValueSchema) => (metadata) =>\n\t\tnew LeafNodeStoredSchema(decodeValueSchema(data)),\n\tobject: (data: Record<TreeNodeSchemaIdentifier, FieldSchemaFormat>) => (metadata) => {\n\t\tconst map = new Map();\n\t\tfor (const [key, value] of Object.entries(data)) {\n\t\t\tmap.set(key, decodeFieldSchema(value));\n\t\t}\n\t\treturn new ObjectNodeStoredSchema(map, metadata);\n\t},\n\tmap: (data: FieldSchemaFormat) => (metadata) =>\n\t\tnew MapNodeStoredSchema(decodeFieldSchema(data), metadata),\n});\n\nconst valueSchemaEncode = new Map([\n\t[ValueSchema.Number, PersistedValueSchema.Number],\n\t[ValueSchema.String, PersistedValueSchema.String],\n\t[ValueSchema.Boolean, PersistedValueSchema.Boolean],\n\t[ValueSchema.FluidHandle, PersistedValueSchema.FluidHandle],\n\t[ValueSchema.Null, PersistedValueSchema.Null],\n]);\n\nconst valueSchemaDecode = invertMap(valueSchemaEncode);\n\nfunction encodeValueSchema(inMemory: ValueSchema): PersistedValueSchema {\n\treturn valueSchemaEncode.get(inMemory) ?? fail(0xae8 /* missing PersistedValueSchema */);\n}\n\nfunction decodeValueSchema(inMemory: PersistedValueSchema): ValueSchema {\n\treturn valueSchemaDecode.get(inMemory) ?? fail(0xae9 /* missing ValueSchema */);\n}\n\nexport function encodeFieldSchemaV1(schema: TreeFieldStoredSchema): FieldSchemaFormatV1 {\n\treturn {\n\t\tkind: schema.kind,\n\t\t// Types are sorted by identifier to improve stability of persisted data to increase chance of schema blob reuse.\n\t\ttypes: [...schema.types].sort(),\n\t};\n}\n\nexport function encodeFieldSchemaV2(schema: TreeFieldStoredSchema): FieldSchemaFormatV2 {\n\tconst fieldSchema: FieldSchemaFormatV1 = encodeFieldSchemaV1(schema);\n\n\t// Omit metadata from the output if it is undefined\n\treturn schema.persistedMetadata !== undefined\n\t\t? { ...fieldSchema, metadata: schema.persistedMetadata }\n\t\t: { ...fieldSchema };\n}\n\nexport function decodeFieldSchema(schema: FieldSchemaFormatV2): TreeFieldStoredSchema {\n\tconst out: TreeFieldStoredSchema = {\n\t\t// TODO: maybe provide actual FieldKind objects here, error on unrecognized kinds.\n\t\tkind: schema.kind,\n\t\ttypes: new Set(schema.types),\n\t\tpersistedMetadata: schema.metadata,\n\t};\n\treturn out;\n}\n\n/**\n * Document schema data that can be stored in a document.\n *\n * @remarks\n * Note: the owner of this may modify it over time:\n * thus if needing to hand onto a specific version, make a copy.\n */\nexport interface TreeStoredSchema extends StoredSchemaCollection {\n\t/**\n\t * Schema for the root field which contains the whole tree.\n\t */\n\treadonly rootFieldSchema: TreeFieldStoredSchema;\n}\n\n/**\n * Collection of TreeNodeSchema data that can be stored in a document.\n *\n * @remarks\n * Note: the owner of this may modify it over time:\n * thus if needing to hang onto a specific version, make a copy.\n */\nexport interface StoredSchemaCollection {\n\t/**\n\t * {@inheritdoc StoredSchemaCollection}\n\t */\n\treadonly nodeSchema: ReadonlyMap<TreeNodeSchemaIdentifier, TreeNodeStoredSchema>;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"schemaChecker.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/default-schema/schemaChecker.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EACN,KAAK,qBAAqB,EAI1B,YAAY,EACZ,KAAK,eAAe,EACpB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAG3F,oBAAY,qBAAqB;IAChC,2BAA2B,IAAA;IAC3B,0BAA0B,IAAA;IAC1B,gCAAgC,IAAA;IAChC,2BAA2B,IAAA;IAC3B,wBAAwB,IAAA;IACxB,qBAAqB,IAAA;IACrB,yBAAyB,IAAA;IACzB,2BAA2B,IAAA;IAC3B,2BAA2B,IAAA;IAC3B,kBAAkB,IAAA;CAClB;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,qBAAqB,GAAG,SAAS,GAAG,IAAI,CAMnF;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC7B,IAAI,EAAE,sBAAsB,EAC5B,eAAe,EAAE,eAAe,GAC9B,qBAAqB,GAAG,SAAS,CAmDnC;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC9B,UAAU,EAAE,uBAAuB,CAAC,sBAAsB,CAAC,EAC3D,MAAM,EAAE,qBAAqB,EAC7B,eAAe,EAAE,eAAe,GAC9B,qBAAqB,GAAG,SAAS,CA6BnC;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACvC,aAAa,EAAE,MAAM,EACrB,YAAY,EAAE,YAAY,GACxB,qBAAqB,GAAG,SAAS,CAuBnC"}
1
+ {"version":3,"file":"schemaChecker.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/default-schema/schemaChecker.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EACN,KAAK,qBAAqB,EAI1B,YAAY,EACZ,KAAK,eAAe,EACpB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAG3F,oBAAY,qBAAqB;IAChC,2BAA2B,IAAA;IAC3B,0BAA0B,IAAA;IAC1B,gCAAgC,IAAA;IAChC,2BAA2B,IAAA;IAC3B,wBAAwB,IAAA;IACxB,qBAAqB,IAAA;IACrB,yBAAyB,IAAA;IACzB,2BAA2B,IAAA;IAC3B,2BAA2B,IAAA;IAC3B,kBAAkB,IAAA;CAClB;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,qBAAqB,GAAG,SAAS,GAAG,IAAI,CAMnF;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC7B,IAAI,EAAE,sBAAsB,EAC5B,eAAe,EAAE,eAAe,GAC9B,qBAAqB,GAAG,SAAS,CAsDnC;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC9B,UAAU,EAAE,uBAAuB,CAAC,sBAAsB,CAAC,EAC3D,MAAM,EAAE,qBAAqB,EAC7B,eAAe,EAAE,eAAe,GAC9B,qBAAqB,GAAG,SAAS,CA6BnC;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACvC,aAAa,EAAE,MAAM,EACrB,YAAY,EAAE,YAAY,GACxB,qBAAqB,GAAG,SAAS,CAuBnC"}
@@ -66,6 +66,9 @@ function isNodeInSchema(node, schemaAndPolicy) {
66
66
  }
67
67
  // The node has fields that we did not check as part of looking at every field defined in the node's schema
68
68
  if (uncheckedFieldsFromNode.size !== 0 &&
69
+ // TODO: AB#43547: This check is wrong. If a given view schema allows an unknown optional field, that does NOT mean the stored schema should allow unknown:
70
+ // In-fact, any data the view schema does not know about must still comply with the stored schema:
71
+ // if this were not the case schema evolution could not add any fields since they might already have out of schema data.
69
72
  !schemaAndPolicy.policy.allowUnknownOptionalFields(node.type)) {
70
73
  return SchemaValidationError.ObjectNode_FieldNotInSchema;
71
74
  }
@@ -1 +1 @@
1
- {"version":3,"file":"schemaChecker.js","sourceRoot":"","sources":["../../../src/feature-libraries/default-schema/schemaChecker.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA4E;AAC5E,uEAAsE;AAEtE,kDAO6B;AAC7B,4DAAmD;AAEnD,kDAAmE;AAEnE,IAAY,qBAWX;AAXD,WAAY,qBAAqB;IAChC,+GAA2B,CAAA;IAC3B,6GAA0B,CAAA;IAC1B,yHAAgC,CAAA;IAChC,+GAA2B,CAAA;IAC3B,yGAAwB,CAAA;IACxB,mGAAqB,CAAA;IACrB,2GAAyB,CAAA;IACzB,+GAA2B,CAAA;IAC3B,+GAA2B,CAAA;IAC3B,6FAAkB,CAAA;AACnB,CAAC,EAXW,qBAAqB,qCAArB,qBAAqB,QAWhC;AAED;;GAEG;AACH,SAAgB,eAAe,CAAC,UAA6C;IAC5E,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;QAC9B,MAAM,IAAI,qBAAU,CACnB,oCAAoC,qBAAqB,CAAC,UAAU,CAAC,EAAE,CACvE,CAAC;IACH,CAAC;AACF,CAAC;AAND,0CAMC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,CAAC,2BAA2B,CAAC;QACtD;YACC,IAAA,0BAAe,EAAC,YAAY,CAAC,CAAC;IAChC,CAAC;AACF,CAAC;AA1BD,4DA0BC","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\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\ttype TreeFieldStoredSchema,\n\tLeafNodeStoredSchema,\n\tObjectNodeStoredSchema,\n\tMapNodeStoredSchema,\n\tMultiplicity,\n\ttype SchemaAndPolicy,\n} from \"../../core/index.js\";\nimport { allowsValue } from \"../valueUtilities.js\";\nimport type { MapTreeFieldViewGeneric, MinimalMapTreeNodeView } from \"../mapTreeCursor.js\";\nimport { iterableHasSome, mapIterable } from \"../../util/index.js\";\n\nexport enum SchemaValidationError {\n\tField_KindNotInSchemaPolicy,\n\tField_MissingRequiredChild,\n\tField_MultipleChildrenNotAllowed,\n\tField_ChildInForbiddenField,\n\tField_NodeTypeNotAllowed,\n\tLeafNode_InvalidValue,\n\tLeafNode_FieldsNotAllowed,\n\tObjectNode_FieldNotInSchema,\n\tNonLeafNode_ValueNotAllowed,\n\tNode_MissingSchema,\n}\n\n/**\n * Throws a UsageError if maybeError indicates a tree is out of schema.\n */\nexport function inSchemaOrThrow(maybeError: SchemaValidationError | undefined): void {\n\tif (maybeError !== undefined) {\n\t\tthrow new UsageError(\n\t\t\t`Tree does not conform to schema: ${SchemaValidationError[maybeError]}`,\n\t\t);\n\t}\n}\n\n/**\n * Deeply checks that the provided node complies with the schema based on its identifier.\n */\nexport function isNodeInSchema(\n\tnode: MinimalMapTreeNodeView,\n\tschemaAndPolicy: SchemaAndPolicy,\n): SchemaValidationError | undefined {\n\t// Validate the schema declared by the node exists\n\tconst schema = schemaAndPolicy.schema.nodeSchema.get(node.type);\n\tif (schema === undefined) {\n\t\treturn SchemaValidationError.Node_MissingSchema;\n\t}\n\n\t// Validate the node is well formed according to its schema\n\n\tif (schema instanceof LeafNodeStoredSchema) {\n\t\tif (iterableHasSome(node.fields)) {\n\t\t\treturn SchemaValidationError.LeafNode_FieldsNotAllowed;\n\t\t}\n\t\tif (!allowsValue(schema.leafValue, node.value)) {\n\t\t\treturn SchemaValidationError.LeafNode_InvalidValue;\n\t\t}\n\t} else {\n\t\tif (node.value !== undefined) {\n\t\t\treturn SchemaValidationError.NonLeafNode_ValueNotAllowed;\n\t\t}\n\n\t\tif (schema instanceof ObjectNodeStoredSchema) {\n\t\t\tconst uncheckedFieldsFromNode = new Set(mapIterable(node.fields, ([key, field]) => key));\n\t\t\tfor (const [fieldKey, fieldSchema] of schema.objectNodeFields) {\n\t\t\t\tconst nodeField = node.fields.get(fieldKey) ?? [];\n\t\t\t\tconst fieldInSchemaResult = isFieldInSchema(nodeField, fieldSchema, schemaAndPolicy);\n\t\t\t\tif (fieldInSchemaResult !== undefined) {\n\t\t\t\t\treturn fieldInSchemaResult;\n\t\t\t\t}\n\t\t\t\tuncheckedFieldsFromNode.delete(fieldKey);\n\t\t\t}\n\t\t\t// The node has fields that we did not check as part of looking at every field defined in the node's schema\n\t\t\tif (\n\t\t\t\tuncheckedFieldsFromNode.size !== 0 &&\n\t\t\t\t!schemaAndPolicy.policy.allowUnknownOptionalFields(node.type)\n\t\t\t) {\n\t\t\t\treturn SchemaValidationError.ObjectNode_FieldNotInSchema;\n\t\t\t}\n\t\t} else if (schema instanceof MapNodeStoredSchema) {\n\t\t\tfor (const [_key, field] of node.fields) {\n\t\t\t\tconst fieldInSchemaResult = isFieldInSchema(field, schema.mapFields, schemaAndPolicy);\n\t\t\t\tif (fieldInSchemaResult !== undefined) {\n\t\t\t\t\treturn fieldInSchemaResult;\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tfail(0xb0e /* Unknown TreeNodeStoredSchema type */);\n\t\t}\n\t}\n\n\treturn undefined;\n}\n\n/**\n * Deeply checks that the nodes comply with the field schema and included schema.\n */\nexport function isFieldInSchema(\n\tchildNodes: MapTreeFieldViewGeneric<MinimalMapTreeNodeView>,\n\tschema: TreeFieldStoredSchema,\n\tschemaAndPolicy: SchemaAndPolicy,\n): SchemaValidationError | undefined {\n\t// Validate that the field kind is handled by the schema policy\n\tconst kind = schemaAndPolicy.policy.fieldKinds.get(schema.kind);\n\tif (kind === undefined) {\n\t\treturn SchemaValidationError.Field_KindNotInSchemaPolicy;\n\t}\n\n\t// Validate that the field doesn't contain more nodes than its type supports\n\t{\n\t\tconst multiplicityCheck = compliesWithMultiplicity(childNodes.length, kind.multiplicity);\n\t\tif (multiplicityCheck !== undefined) {\n\t\t\treturn multiplicityCheck;\n\t\t}\n\t}\n\n\tfor (const node of childNodes) {\n\t\t// Validate the type declared by the node is allowed in this field\n\t\tif (schema.types !== undefined && !schema.types.has(node.type)) {\n\t\t\treturn SchemaValidationError.Field_NodeTypeNotAllowed;\n\t\t}\n\n\t\t// Validate the node complies with the type it declares to be.\n\t\tconst nodeInSchemaResult = isNodeInSchema(node, schemaAndPolicy);\n\t\tif (nodeInSchemaResult !== undefined) {\n\t\t\treturn nodeInSchemaResult;\n\t\t}\n\t}\n\n\treturn undefined;\n}\n\n/**\n * Validates that a given number of items complies with the specified {@link Multiplicity | multiplicity}.\n * @param numberOfItems - Number of items.\n * @param multiplicity - Kind of multiplicity to validate against.\n * @returns `true` if the specified number of items complies with the specified multiplicity; otherwise, `false`.\n */\nexport function compliesWithMultiplicity(\n\tnumberOfItems: number,\n\tmultiplicity: Multiplicity,\n): SchemaValidationError | undefined {\n\tswitch (multiplicity) {\n\t\tcase Multiplicity.Single:\n\t\t\tif (numberOfItems < 1) {\n\t\t\t\treturn SchemaValidationError.Field_MissingRequiredChild;\n\t\t\t} else if (numberOfItems > 1) {\n\t\t\t\treturn SchemaValidationError.Field_MultipleChildrenNotAllowed;\n\t\t\t} else {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\tcase Multiplicity.Optional:\n\t\t\treturn numberOfItems > 1\n\t\t\t\t? SchemaValidationError.Field_MultipleChildrenNotAllowed\n\t\t\t\t: undefined;\n\t\tcase Multiplicity.Sequence:\n\t\t\treturn undefined;\n\t\tcase Multiplicity.Forbidden:\n\t\t\treturn numberOfItems === 0\n\t\t\t\t? undefined\n\t\t\t\t: SchemaValidationError.Field_ChildInForbiddenField;\n\t\tdefault:\n\t\t\tunreachableCase(multiplicity);\n\t}\n}\n"]}
1
+ {"version":3,"file":"schemaChecker.js","sourceRoot":"","sources":["../../../src/feature-libraries/default-schema/schemaChecker.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA4E;AAC5E,uEAAsE;AAEtE,kDAO6B;AAC7B,4DAAmD;AAEnD,kDAAmE;AAEnE,IAAY,qBAWX;AAXD,WAAY,qBAAqB;IAChC,+GAA2B,CAAA;IAC3B,6GAA0B,CAAA;IAC1B,yHAAgC,CAAA;IAChC,+GAA2B,CAAA;IAC3B,yGAAwB,CAAA;IACxB,mGAAqB,CAAA;IACrB,2GAAyB,CAAA;IACzB,+GAA2B,CAAA;IAC3B,+GAA2B,CAAA;IAC3B,6FAAkB,CAAA;AACnB,CAAC,EAXW,qBAAqB,qCAArB,qBAAqB,QAWhC;AAED;;GAEG;AACH,SAAgB,eAAe,CAAC,UAA6C;IAC5E,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;QAC9B,MAAM,IAAI,qBAAU,CACnB,oCAAoC,qBAAqB,CAAC,UAAU,CAAC,EAAE,CACvE,CAAC;IACH,CAAC;AACF,CAAC;AAND,0CAMC;AAED;;GAEG;AACH,SAAgB,cAAc,CAC7B,IAA4B,EAC5B,eAAgC;IAEhC,kDAAkD;IAClD,MAAM,MAAM,GAAG,eAAe,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAChE,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QAC1B,OAAO,qBAAqB,CAAC,kBAAkB,CAAC;IACjD,CAAC;I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GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YAChE,OAAO,qBAAqB,CAAC,wBAAwB,CAAC;QACvD,CAAC;QAED,8DAA8D;QAC9D,MAAM,kBAAkB,GAAG,cAAc,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC;QACjE,IAAI,kBAAkB,KAAK,SAAS,EAAE,CAAC;YACtC,OAAO,kBAAkB,CAAC;QAC3B,CAAC;IACF,CAAC;IAED,OAAO,SAAS,CAAC;AAClB,CAAC;AAjCD,0CAiCC;AAED;;;;;GAKG;AACH,SAAgB,wBAAwB,CACvC,aAAqB,EACrB,YAA0B;IAE1B,QAAQ,YAAY,EAAE,CAAC;QACtB,KAAK,uBAAY,CAAC,MAAM;YACvB,IAAI,aAAa,GAAG,CAAC,EAAE,CAAC;gBACvB,OAAO,qBAAqB,CAAC,0BAA0B,CAAC;YACzD,CAAC;iBAAM,IAAI,aAAa,GAAG,CAAC,EAAE,CAAC;gBAC9B,OAAO,qBAAqB,CAAC,gCAAgC,CAAC;YAC/D,CAAC;iBAAM,CAAC;gBACP,OAAO,SAAS,CAAC;YAClB,CAAC;QACF,KAAK,uBAAY,CAAC,QAAQ;YACzB,OAAO,aAAa,GAAG,CAAC;gBACvB,CAAC,CAAC,qBAAqB,CAAC,gCAAgC;gBACxD,CAAC,CAAC,SAAS,CAAC;QACd,KAAK,uBAAY,CAAC,QAAQ;YACzB,OAAO,SAAS,CAAC;QAClB,KAAK,uBAAY,CAAC,SAAS;YAC1B,OAAO,aAAa,KAAK,CAAC;gBACzB,CAAC,CAAC,SAAS;gBACX,CAAC,CAAC,qBAAqB,CAAC,2BAA2B,CAAC;QACtD;YACC,IAAA,0BAAe,EAAC,YAAY,CAAC,CAAC;IAChC,CAAC;AACF,CAAC;AA1BD,4DA0BC","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\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\ttype TreeFieldStoredSchema,\n\tLeafNodeStoredSchema,\n\tObjectNodeStoredSchema,\n\tMapNodeStoredSchema,\n\tMultiplicity,\n\ttype SchemaAndPolicy,\n} from \"../../core/index.js\";\nimport { allowsValue } from \"../valueUtilities.js\";\nimport type { MapTreeFieldViewGeneric, MinimalMapTreeNodeView } from \"../mapTreeCursor.js\";\nimport { iterableHasSome, mapIterable } from \"../../util/index.js\";\n\nexport enum SchemaValidationError {\n\tField_KindNotInSchemaPolicy,\n\tField_MissingRequiredChild,\n\tField_MultipleChildrenNotAllowed,\n\tField_ChildInForbiddenField,\n\tField_NodeTypeNotAllowed,\n\tLeafNode_InvalidValue,\n\tLeafNode_FieldsNotAllowed,\n\tObjectNode_FieldNotInSchema,\n\tNonLeafNode_ValueNotAllowed,\n\tNode_MissingSchema,\n}\n\n/**\n * Throws a UsageError if maybeError indicates a tree is out of schema.\n */\nexport function inSchemaOrThrow(maybeError: SchemaValidationError | undefined): void {\n\tif (maybeError !== undefined) {\n\t\tthrow new UsageError(\n\t\t\t`Tree does not conform to schema: ${SchemaValidationError[maybeError]}`,\n\t\t);\n\t}\n}\n\n/**\n * Deeply checks that the provided node complies with the schema based on its identifier.\n */\nexport function isNodeInSchema(\n\tnode: MinimalMapTreeNodeView,\n\tschemaAndPolicy: SchemaAndPolicy,\n): SchemaValidationError | undefined {\n\t// Validate the schema declared by the node exists\n\tconst schema = schemaAndPolicy.schema.nodeSchema.get(node.type);\n\tif (schema === undefined) {\n\t\treturn SchemaValidationError.Node_MissingSchema;\n\t}\n\n\t// Validate the node is well formed according to its schema\n\n\tif (schema instanceof LeafNodeStoredSchema) {\n\t\tif (iterableHasSome(node.fields)) {\n\t\t\treturn SchemaValidationError.LeafNode_FieldsNotAllowed;\n\t\t}\n\t\tif (!allowsValue(schema.leafValue, node.value)) {\n\t\t\treturn SchemaValidationError.LeafNode_InvalidValue;\n\t\t}\n\t} else {\n\t\tif (node.value !== undefined) {\n\t\t\treturn SchemaValidationError.NonLeafNode_ValueNotAllowed;\n\t\t}\n\n\t\tif (schema instanceof ObjectNodeStoredSchema) {\n\t\t\tconst uncheckedFieldsFromNode = new Set(mapIterable(node.fields, ([key, field]) => key));\n\t\t\tfor (const [fieldKey, fieldSchema] of schema.objectNodeFields) {\n\t\t\t\tconst nodeField = node.fields.get(fieldKey) ?? [];\n\t\t\t\tconst fieldInSchemaResult = isFieldInSchema(nodeField, fieldSchema, schemaAndPolicy);\n\t\t\t\tif (fieldInSchemaResult !== undefined) {\n\t\t\t\t\treturn fieldInSchemaResult;\n\t\t\t\t}\n\t\t\t\tuncheckedFieldsFromNode.delete(fieldKey);\n\t\t\t}\n\t\t\t// The node has fields that we did not check as part of looking at every field defined in the node's schema\n\t\t\tif (\n\t\t\t\tuncheckedFieldsFromNode.size !== 0 &&\n\t\t\t\t// TODO: AB#43547: This check is wrong. If a given view schema allows an unknown optional field, that does NOT mean the stored schema should allow unknown:\n\t\t\t\t// In-fact, any data the view schema does not know about must still comply with the stored schema:\n\t\t\t\t// if this were not the case schema evolution could not add any fields since they might already have out of schema data.\n\t\t\t\t!schemaAndPolicy.policy.allowUnknownOptionalFields(node.type)\n\t\t\t) {\n\t\t\t\treturn SchemaValidationError.ObjectNode_FieldNotInSchema;\n\t\t\t}\n\t\t} else if (schema instanceof MapNodeStoredSchema) {\n\t\t\tfor (const [_key, field] of node.fields) {\n\t\t\t\tconst fieldInSchemaResult = isFieldInSchema(field, schema.mapFields, schemaAndPolicy);\n\t\t\t\tif (fieldInSchemaResult !== undefined) {\n\t\t\t\t\treturn fieldInSchemaResult;\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tfail(0xb0e /* Unknown TreeNodeStoredSchema type */);\n\t\t}\n\t}\n\n\treturn undefined;\n}\n\n/**\n * Deeply checks that the nodes comply with the field schema and included schema.\n */\nexport function isFieldInSchema(\n\tchildNodes: MapTreeFieldViewGeneric<MinimalMapTreeNodeView>,\n\tschema: TreeFieldStoredSchema,\n\tschemaAndPolicy: SchemaAndPolicy,\n): SchemaValidationError | undefined {\n\t// Validate that the field kind is handled by the schema policy\n\tconst kind = schemaAndPolicy.policy.fieldKinds.get(schema.kind);\n\tif (kind === undefined) {\n\t\treturn SchemaValidationError.Field_KindNotInSchemaPolicy;\n\t}\n\n\t// Validate that the field doesn't contain more nodes than its type supports\n\t{\n\t\tconst multiplicityCheck = compliesWithMultiplicity(childNodes.length, kind.multiplicity);\n\t\tif (multiplicityCheck !== undefined) {\n\t\t\treturn multiplicityCheck;\n\t\t}\n\t}\n\n\tfor (const node of childNodes) {\n\t\t// Validate the type declared by the node is allowed in this field\n\t\tif (schema.types !== undefined && !schema.types.has(node.type)) {\n\t\t\treturn SchemaValidationError.Field_NodeTypeNotAllowed;\n\t\t}\n\n\t\t// Validate the node complies with the type it declares to be.\n\t\tconst nodeInSchemaResult = isNodeInSchema(node, schemaAndPolicy);\n\t\tif (nodeInSchemaResult !== undefined) {\n\t\t\treturn nodeInSchemaResult;\n\t\t}\n\t}\n\n\treturn undefined;\n}\n\n/**\n * Validates that a given number of items complies with the specified {@link Multiplicity | multiplicity}.\n * @param numberOfItems - Number of items.\n * @param multiplicity - Kind of multiplicity to validate against.\n * @returns `true` if the specified number of items complies with the specified multiplicity; otherwise, `false`.\n */\nexport function compliesWithMultiplicity(\n\tnumberOfItems: number,\n\tmultiplicity: Multiplicity,\n): SchemaValidationError | undefined {\n\tswitch (multiplicity) {\n\t\tcase Multiplicity.Single:\n\t\t\tif (numberOfItems < 1) {\n\t\t\t\treturn SchemaValidationError.Field_MissingRequiredChild;\n\t\t\t} else if (numberOfItems > 1) {\n\t\t\t\treturn SchemaValidationError.Field_MultipleChildrenNotAllowed;\n\t\t\t} else {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\tcase Multiplicity.Optional:\n\t\t\treturn numberOfItems > 1\n\t\t\t\t? SchemaValidationError.Field_MultipleChildrenNotAllowed\n\t\t\t\t: undefined;\n\t\tcase Multiplicity.Sequence:\n\t\t\treturn undefined;\n\t\tcase Multiplicity.Forbidden:\n\t\t\treturn numberOfItems === 0\n\t\t\t\t? undefined\n\t\t\t\t: SchemaValidationError.Field_ChildInForbiddenField;\n\t\tdefault:\n\t\t\tunreachableCase(multiplicity);\n\t}\n}\n"]}
@@ -64,7 +64,7 @@ export interface FlexTreeHydratedContext extends FlexTreeContext, FlexTreeHydrat
64
64
  */
65
65
  export declare const ContextSlot: import("../../core/index.js").AnchorSlot<Context>;
66
66
  /**
67
- * Implementation of `FlexTreeContext`.
67
+ * Implementation of `FlexTreeHydratedContext`.
68
68
  *
69
69
  * @remarks An editor is required to edit the FlexTree.
70
70
  *
@@ -82,7 +82,12 @@ export declare class Context implements FlexTreeHydratedContext, IDisposable {
82
82
  readonly nodeKeyManager: NodeIdentifierManager;
83
83
  readonly withCursors: Set<LazyEntity>;
84
84
  readonly withAnchors: Set<LazyEntity>;
85
- private readonly eventUnregister;
85
+ /**
86
+ * Callbacks to run when disposing.
87
+ *
88
+ * Mainly event un-registration.
89
+ */
90
+ private readonly onDispose;
86
91
  private disposed;
87
92
  /**
88
93
  * Stores the last accessed version of the root.
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/context.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAGlE,OAAO,EACN,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,gBAAgB,EAIrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,KAAK,WAAW,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAEzE,OA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/B;IAED;;;;;OAKG;IACI,aAAa,CAAC,GAAG,EAAE,aAAa,EAAE,MAAM,EAAE,mBAAmB,GAAG,aAAa;IAUpF,IAAW,MAAM,IAAI,UAAU,CAAC,YAAY,CAAC,CAE5C;CACD"}
@@ -15,7 +15,7 @@ const lazyField_js_1 = require("./lazyField.js");
15
15
  */
16
16
  exports.ContextSlot = (0, index_js_1.anchorSlot)();
17
17
  /**
18
- * Implementation of `FlexTreeContext`.
18
+ * Implementation of `FlexTreeHydratedContext`.
19
19
  *
20
20
  * @remarks An editor is required to edit the FlexTree.
21
21
  *
@@ -36,7 +36,7 @@ class Context {
36
36
  this.withCursors = new Set();
37
37
  this.withAnchors = new Set();
38
38
  this.disposed = false;
39
- this.eventUnregister = [
39
+ this.onDispose = [
40
40
  this.checkout.forest.events.on("beforeChange", () => {
41
41
  this.prepareForEdit();
42
42
  }),
@@ -69,10 +69,10 @@ class Context {
69
69
  (0, internal_1.assert)(this.disposed === false, 0x803 /* double dispose */);
70
70
  this.disposed = true;
71
71
  this.clear();
72
- for (const unregister of this.eventUnregister) {
72
+ for (const unregister of this.onDispose) {
73
73
  unregister();
74
74
  }
75
- this.eventUnregister.length = 0;
75
+ this.onDispose.length = 0;
76
76
  const deleted = this.checkout.forest.anchors.slots.delete(exports.ContextSlot);
77
77
  (0, internal_1.assert)(deleted, 0x8c4 /* unexpected dispose */);
78
78
  }
@@ -1 +1 @@
1
- {"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/context.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,kEAA0E;AAE1E,kDAS6B;AAE7B,kDAAsE;AAKtE,iDAA2C;AA4D3C;;;GAGG;AACU,QAAA,WAAW,GAAG,IAAA,qBAAU,GAAW,CAAC;AAEjD;;;;;;;;;GASG;AACH,MAAa,OAAO;IAenB,YACiB,YAA0B,EAC1B,QAAuB;IACvC;;OAEG;IACa,cAAqC;QALrC,iBAAY,GAAZ,YAAY,CAAc;QAC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AC,IAAI,CAAC,CAAC;QACvF,OAAO,IAAI,CAAC,aAAa,CAAC;IAC3B,CAAC;IAED;;;;;OAKG;IACI,aAAa,CAAC,GAAkB,EAAE,MAA2B;QACnE,IAAA,iBAAM,EAAC,IAAI,CAAC,QAAQ,KAAK,KAAK,EAAE,KAAK,CAAC,uBAAuB,CAAC,CAAC;QAE/D,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;QAC3D,IAAA,8BAAmB,EAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC;QACvD,MAAM,KAAK,GAAG,IAAA,wBAAS,EAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QAC9C,MAAM,CAAC,IAAI,EAAE,CAAC;QACd,OAAO,KAAK,CAAC;IACd,CAAC;IAED,IAAW,MAAM;QAChB,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;IACpC,CAAC;CACD;AA1HD,0BA0HC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { Listenable } from \"@fluidframework/core-interfaces\";\nimport { assert, debugAssert } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\ttype DetachedField,\n\ttype FieldKindIdentifier,\n\ttype ForestEvents,\n\ttype SchemaPolicy,\n\ttype TreeStoredSchema,\n\tanchorSlot,\n\tmoveToDetachedField,\n\trootField,\n} from \"../../core/index.js\";\nimport type { ITreeCheckout } from \"../../shared-tree/index.js\";\nimport { type IDisposable, disposeSymbol } from \"../../util/index.js\";\nimport type { NodeIdentifierManager } from \"../node-identifier/index.js\";\n\nimport type { FlexTreeField } from \"./flexTreeTypes.js\";\nimport type { LazyEntity } from \"./lazyEntity.js\";\nimport { makeField } from \"./lazyField.js\";\n\n/**\n * Context for FlexTrees.\n */\nexport interface FlexTreeContext {\n\t/**\n\t * Schema used within this context.\n\t * All data must conform to these schema.\n\t */\n\treadonly schema: TreeStoredSchema;\n\n\t/**\n\t * SchemaPolicy used within this context.\n\t */\n\treadonly schemaPolicy: SchemaPolicy;\n\n\t/**\n\t * If true, this context is the canonical context instance for a given view,\n\t * and its schema include all schema from the document.\n\t *\n\t * If false, this context was created for use in a unhydrated tree, and the full document schema is unknown.\n\t */\n\tisHydrated(): this is FlexTreeHydratedContext;\n\n\t/**\n\t * If true, none of the nodes in this context can be used.\n\t */\n\tisDisposed(): boolean;\n}\n\n/**\n * Subset of a hydrated context which can be used in more cases (like before the root and events are set up).\n */\nexport interface FlexTreeHydratedContextMinimal {\n\t/**\n\t * The {@link NodeIdentifierManager} responsible for allocating and compressing identifiers for nodes in this context.\n\t */\n\treadonly nodeKeyManager: NodeIdentifierManager;\n\n\t/**\n\t * The checkout object associated with this context.\n\t */\n\treadonly checkout: ITreeCheckout;\n}\n\n/**\n * A common context of a \"forest\" of FlexTrees.\n * It handles group operations like transforming cursors into anchors for edits.\n */\nexport interface FlexTreeHydratedContext\n\textends FlexTreeContext,\n\t\tFlexTreeHydratedContextMinimal {\n\treadonly events: Listenable<ForestEvents>;\n\t/**\n\t * Gets the root field of the tree.\n\t */\n\tget root(): FlexTreeField;\n}\n\n/**\n * Creating multiple flex tree contexts for the same branch, and thus with the same underlying AnchorSet does not work due to how TreeNode caching works.\n * This slot is used to detect if one already exists and error if creating a second.\n */\nexport const ContextSlot = anchorSlot<Context>();\n\n/**\n * Implementation of `FlexTreeContext`.\n *\n * @remarks An editor is required to edit the FlexTree.\n *\n * A {@link FlexTreeContext} which is used to manage the cursors and anchors within the FlexTrees:\n * This is necessary for supporting using this tree across edits to the forest, and not leaking memory.\n *\n * This context and the trees it produces observe the kinds of fields from the schema\n */\nexport class Context implements FlexTreeHydratedContext, IDisposable {\n\tpublic readonly withCursors: Set<LazyEntity> = new Set();\n\tpublic readonly withAnchors: Set<LazyEntity> = new Set();\n\n\tprivate readonly eventUnregister: (() => void)[];\n\tprivate disposed = false;\n\n\t/**\n\t * Stores the last accessed version of the root.\n\t * @remarks\n\t * Anything which can delete this field must clear it.\n\t * Currently \"clear\" is the only case.\n\t */\n\tprivate lazyRootCache: FlexTreeField | undefined;\n\n\tpublic constructor(\n\t\tpublic readonly schemaPolicy: SchemaPolicy,\n\t\tpublic readonly checkout: ITreeCheckout,\n\t\t/**\n\t\t * An object which handles node key generation and conversion\n\t\t */\n\t\tpublic readonly nodeKeyManager: NodeIdentifierManager,\n\t) {\n\t\tthis.eventUnregister = [\n\t\t\tthis.checkout.forest.events.on(\"beforeChange\", () => {\n\t\t\t\tthis.prepareForEdit();\n\t\t\t}),\n\t\t];\n\n\t\tassert(\n\t\t\t!this.checkout.forest.anchors.slots.has(ContextSlot),\n\t\t\t0x92b /* Cannot create second flex-tree from checkout */,\n\t\t);\n\t\tthis.checkout.forest.anchors.slots.set(ContextSlot, this);\n\t}\n\n\tpublic isHydrated(): this is FlexTreeHydratedContext {\n\t\tdebugAssert(() => !this.disposed || \"Disposed\");\n\t\treturn true;\n\t}\n\n\tpublic isDisposed(): boolean {\n\t\treturn this.disposed;\n\t}\n\n\tpublic get schema(): TreeStoredSchema {\n\t\treturn this.checkout.storedSchema;\n\t}\n\n\t/**\n\t * Called before editing.\n\t * Clears all cursors so editing can proceed.\n\t */\n\tprivate prepareForEdit(): void {\n\t\tassert(this.disposed === false, 0x802 /* use after dispose */);\n\t\tfor (const target of this.withCursors) {\n\t\t\ttarget.prepareForEdit();\n\t\t}\n\t\tassert(this.withCursors.size === 0, 0x773 /* prepareForEdit should remove all cursors */);\n\t}\n\n\tpublic [disposeSymbol](): void {\n\t\tassert(this.disposed === false, 0x803 /* double dispose */);\n\t\tthis.disposed = true;\n\t\tthis.clear();\n\t\tfor (const unregister of this.eventUnregister) {\n\t\t\tunregister();\n\t\t}\n\t\tthis.eventUnregister.length = 0;\n\n\t\tconst deleted = this.checkout.forest.anchors.slots.delete(ContextSlot);\n\t\tassert(deleted, 0x8c4 /* unexpected dispose */);\n\t}\n\n\t/**\n\t * Release any cursors and anchors held by tree entities created in this context.\n\t * @remarks\n\t * Ensures the cashed references to those entities on the Anchors are also cleared.\n\t * The tree entities are invalid to use after this, but the context may still be used\n\t * to create new trees starting from the root.\n\t */\n\tpublic clear(): void {\n\t\tfor (const target of this.withAnchors) {\n\t\t\ttarget[disposeSymbol]();\n\t\t}\n\t\tthis.lazyRootCache = undefined;\n\t\tassert(this.withCursors.size === 0, 0x774 /* free should remove all cursors */);\n\t\tassert(this.withAnchors.size === 0, 0x775 /* free should remove all anchors */);\n\t}\n\n\t/**\n\t * Gets the root field of the tree.\n\t * @remarks\n\t * This is a cached value: it should not be disposed by the accessor.\n\t * Like all other fields from this context, it will become invalid to use after {@link clear} is called or the {@link disposeSymbol} method is called.\n\t */\n\tpublic get root(): FlexTreeField {\n\t\tassert(this.disposed === false, 0x804 /* use after dispose */);\n\n\t\tthis.lazyRootCache ??= this.detachedField(rootField, this.schema.rootFieldSchema.kind);\n\t\treturn this.lazyRootCache;\n\t}\n\n\t/**\n\t * Returns a new {@link FlexTreeField} that will live as long as the caller allows up to the next call to {@link clear} or disposal of the context.\n\t * @remarks\n\t * Due to limited support for detached fields, not all operations are supported.\n\t * Additionally if the detached field's content is deleted, the field will become out of schema if it is required: it must not be used after that point.\n\t */\n\tpublic detachedField(key: DetachedField, schema: FieldKindIdentifier): FlexTreeField {\n\t\tassert(this.disposed === false, 0xb9c /* use after dispose */);\n\n\t\tconst cursor = this.checkout.forest.allocateCursor(\"root\");\n\t\tmoveToDetachedField(this.checkout.forest, cursor, key);\n\t\tconst field = makeField(this, schema, cursor);\n\t\tcursor.free();\n\t\treturn field;\n\t}\n\n\tpublic get events(): Listenable<ForestEvents> {\n\t\treturn this.checkout.forest.events;\n\t}\n}\n"]}
1
+ {"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/context.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,k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oC,CAAC,CAAC;IACjF,CAAC;IAED;;;;;OAKG;IACH,IAAW,IAAI;QACd,IAAA,iBAAM,EAAC,IAAI,CAAC,QAAQ,KAAK,KAAK,EAAE,KAAK,CAAC,uBAAuB,CAAC,CAAC;QAE/D,IAAI,CAAC,aAAa,KAAK,IAAI,CAAC,aAAa,CAAC,oBAAS,EAAE,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;QACvF,OAAO,IAAI,CAAC,aAAa,CAAC;IAC3B,CAAC;IAED;;;;;OAKG;IACI,aAAa,CAAC,GAAkB,EAAE,MAA2B;QACnE,IAAA,iBAAM,EAAC,IAAI,CAAC,QAAQ,KAAK,KAAK,EAAE,KAAK,CAAC,uBAAuB,CAAC,CAAC;QAE/D,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;QAC3D,IAAA,8BAAmB,EAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC;QACvD,MAAM,KAAK,GAAG,IAAA,wBAAS,EAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QAC9C,MAAM,CAAC,IAAI,EAAE,CAAC;QACd,OAAO,KAAK,CAAC;IACd,CAAC;IAED,IAAW,MAAM;QAChB,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;IACpC,CAAC;CACD;AA/HD,0BA+HC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { Listenable } from \"@fluidframework/core-interfaces\";\nimport { assert, debugAssert } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\ttype DetachedField,\n\ttype FieldKindIdentifier,\n\ttype ForestEvents,\n\ttype SchemaPolicy,\n\ttype TreeStoredSchema,\n\tanchorSlot,\n\tmoveToDetachedField,\n\trootField,\n} from \"../../core/index.js\";\nimport type { ITreeCheckout } from \"../../shared-tree/index.js\";\nimport { type IDisposable, disposeSymbol } from \"../../util/index.js\";\nimport type { NodeIdentifierManager } from \"../node-identifier/index.js\";\n\nimport type { FlexTreeField } from \"./flexTreeTypes.js\";\nimport type { LazyEntity } from \"./lazyEntity.js\";\nimport { makeField } from \"./lazyField.js\";\n\n/**\n * Context for FlexTrees.\n */\nexport interface FlexTreeContext {\n\t/**\n\t * Schema used within this context.\n\t * All data must conform to these schema.\n\t */\n\treadonly schema: TreeStoredSchema;\n\n\t/**\n\t * SchemaPolicy used within this context.\n\t */\n\treadonly schemaPolicy: SchemaPolicy;\n\n\t/**\n\t * If true, this context is the canonical context instance for a given view,\n\t * and its schema include all schema from the document.\n\t *\n\t * If false, this context was created for use in a unhydrated tree, and the full document schema is unknown.\n\t */\n\tisHydrated(): this is FlexTreeHydratedContext;\n\n\t/**\n\t * If true, none of the nodes in this context can be used.\n\t */\n\tisDisposed(): boolean;\n}\n\n/**\n * Subset of a hydrated context which can be used in more cases (like before the root and events are set up).\n */\nexport interface FlexTreeHydratedContextMinimal {\n\t/**\n\t * The {@link NodeIdentifierManager} responsible for allocating and compressing identifiers for nodes in this context.\n\t */\n\treadonly nodeKeyManager: NodeIdentifierManager;\n\n\t/**\n\t * The checkout object associated with this context.\n\t */\n\treadonly checkout: ITreeCheckout;\n}\n\n/**\n * A common context of a \"forest\" of FlexTrees.\n * It handles group operations like transforming cursors into anchors for edits.\n */\nexport interface FlexTreeHydratedContext\n\textends FlexTreeContext,\n\t\tFlexTreeHydratedContextMinimal {\n\treadonly events: Listenable<ForestEvents>;\n\t/**\n\t * Gets the root field of the tree.\n\t */\n\tget root(): FlexTreeField;\n}\n\n/**\n * Creating multiple flex tree contexts for the same branch, and thus with the same underlying AnchorSet does not work due to how TreeNode caching works.\n * This slot is used to detect if one already exists and error if creating a second.\n */\nexport const ContextSlot = anchorSlot<Context>();\n\n/**\n * Implementation of `FlexTreeHydratedContext`.\n *\n * @remarks An editor is required to edit the FlexTree.\n *\n * A {@link FlexTreeContext} which is used to manage the cursors and anchors within the FlexTrees:\n * This is necessary for supporting using this tree across edits to the forest, and not leaking memory.\n *\n * This context and the trees it produces observe the kinds of fields from the schema\n */\nexport class Context implements FlexTreeHydratedContext, IDisposable {\n\tpublic readonly withCursors: Set<LazyEntity> = new Set();\n\tpublic readonly withAnchors: Set<LazyEntity> = new Set();\n\n\t/**\n\t * Callbacks to run when disposing.\n\t *\n\t * Mainly event un-registration.\n\t */\n\tprivate readonly onDispose: (() => void)[];\n\tprivate disposed = false;\n\n\t/**\n\t * Stores the last accessed version of the root.\n\t * @remarks\n\t * Anything which can delete this field must clear it.\n\t * Currently \"clear\" is the only case.\n\t */\n\tprivate lazyRootCache: FlexTreeField | undefined;\n\n\tpublic constructor(\n\t\tpublic readonly schemaPolicy: SchemaPolicy,\n\t\tpublic readonly checkout: ITreeCheckout,\n\t\t/**\n\t\t * An object which handles node key generation and conversion\n\t\t */\n\t\tpublic readonly nodeKeyManager: NodeIdentifierManager,\n\t) {\n\t\tthis.onDispose = [\n\t\t\tthis.checkout.forest.events.on(\"beforeChange\", () => {\n\t\t\t\tthis.prepareForEdit();\n\t\t\t}),\n\t\t];\n\n\t\tassert(\n\t\t\t!this.checkout.forest.anchors.slots.has(ContextSlot),\n\t\t\t0x92b /* Cannot create second flex-tree from checkout */,\n\t\t);\n\t\tthis.checkout.forest.anchors.slots.set(ContextSlot, this);\n\t}\n\n\tpublic isHydrated(): this is FlexTreeHydratedContext {\n\t\tdebugAssert(() => !this.disposed || \"Disposed\");\n\t\treturn true;\n\t}\n\n\tpublic isDisposed(): boolean {\n\t\treturn this.disposed;\n\t}\n\n\tpublic get schema(): TreeStoredSchema {\n\t\treturn this.checkout.storedSchema;\n\t}\n\n\t/**\n\t * Called before editing.\n\t * Clears all cursors so editing can proceed.\n\t */\n\tprivate prepareForEdit(): void {\n\t\tassert(this.disposed === false, 0x802 /* use after dispose */);\n\t\tfor (const target of this.withCursors) {\n\t\t\ttarget.prepareForEdit();\n\t\t}\n\t\tassert(this.withCursors.size === 0, 0x773 /* prepareForEdit should remove all cursors */);\n\t}\n\n\tpublic [disposeSymbol](): void {\n\t\tassert(this.disposed === false, 0x803 /* double dispose */);\n\t\tthis.disposed = true;\n\t\tthis.clear();\n\t\tfor (const unregister of this.onDispose) {\n\t\t\tunregister();\n\t\t}\n\t\tthis.onDispose.length = 0;\n\n\t\tconst deleted = this.checkout.forest.anchors.slots.delete(ContextSlot);\n\t\tassert(deleted, 0x8c4 /* unexpected dispose */);\n\t}\n\n\t/**\n\t * Release any cursors and anchors held by tree entities created in this context.\n\t * @remarks\n\t * Ensures the cashed references to those entities on the Anchors are also cleared.\n\t * The tree entities are invalid to use after this, but the context may still be used\n\t * to create new trees starting from the root.\n\t */\n\tpublic clear(): void {\n\t\tfor (const target of this.withAnchors) {\n\t\t\ttarget[disposeSymbol]();\n\t\t}\n\t\tthis.lazyRootCache = undefined;\n\t\tassert(this.withCursors.size === 0, 0x774 /* free should remove all cursors */);\n\t\tassert(this.withAnchors.size === 0, 0x775 /* free should remove all anchors */);\n\t}\n\n\t/**\n\t * Gets the root field of the tree.\n\t * @remarks\n\t * This is a cached value: it should not be disposed by the accessor.\n\t * Like all other fields from this context, it will become invalid to use after {@link clear} is called or the {@link disposeSymbol} method is called.\n\t */\n\tpublic get root(): FlexTreeField {\n\t\tassert(this.disposed === false, 0x804 /* use after dispose */);\n\n\t\tthis.lazyRootCache ??= this.detachedField(rootField, this.schema.rootFieldSchema.kind);\n\t\treturn this.lazyRootCache;\n\t}\n\n\t/**\n\t * Returns a new {@link FlexTreeField} that will live as long as the caller allows up to the next call to {@link clear} or disposal of the context.\n\t * @remarks\n\t * Due to limited support for detached fields, not all operations are supported.\n\t * Additionally if the detached field's content is deleted, the field will become out of schema if it is required: it must not be used after that point.\n\t */\n\tpublic detachedField(key: DetachedField, schema: FieldKindIdentifier): FlexTreeField {\n\t\tassert(this.disposed === false, 0xb9c /* use after dispose */);\n\n\t\tconst cursor = this.checkout.forest.allocateCursor(\"root\");\n\t\tmoveToDetachedField(this.checkout.forest, cursor, key);\n\t\tconst field = makeField(this, schema, cursor);\n\t\tcursor.free();\n\t\treturn field;\n\t}\n\n\tpublic get events(): Listenable<ForestEvents> {\n\t\treturn this.checkout.forest.events;\n\t}\n}\n"]}
@@ -6,6 +6,7 @@ export { type FlexTreeField, type FlexTreeNode, type FlexTreeEntity, type FlexTr
6
6
  export { type FlexTreeContext, type FlexTreeHydratedContext, Context, ContextSlot, type FlexTreeHydratedContextMinimal, } from "./context.js";
7
7
  export { type FlexTreeNodeEvents } from "./treeEvents.js";
8
8
  export { assertFlexTreeEntityNotFreed, LazyEntity, } from "./lazyEntity.js";
9
+ export { getOrCreateHydratedFlexTreeNode } from "./lazyNode.js";
9
10
  export { getSchemaAndPolicy, indexForAt } from "./utilities.js";
10
11
  export { treeStatusFromAnchorCache } from "./utilities.js";
11
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,UAAU,EACV,KAAK,sBAAsB,EAC3B,cAAc,EACd,kBAAkB,EAClB,cAAc,EACd,YAAY,EACZ,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,GACzB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACN,KAAK,eAAe,EACpB,KAAK,uBAAuB,EAC5B,OAAO,EACP,WAAW,EACX,KAAK,8BAA8B,GACnC,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAE1D,OAAO,EACN,4BAA4B,EAC5B,UAAU,GACV,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEhE,OAAO,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,UAAU,EACV,KAAK,sBAAsB,EAC3B,cAAc,EACd,kBAAkB,EAClB,cAAc,EACd,YAAY,EACZ,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,GACzB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACN,KAAK,eAAe,EACpB,KAAK,uBAAuB,EAC5B,OAAO,EACP,WAAW,EACX,KAAK,8BAA8B,GACnC,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAE1D,OAAO,EACN,4BAA4B,EAC5B,UAAU,GACV,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,+BAA+B,EAAE,MAAM,eAAe,CAAC;AAEhE,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEhE,OAAO,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC"}
@@ -4,7 +4,7 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.treeStatusFromAnchorCache = exports.indexForAt = exports.getSchemaAndPolicy = exports.LazyEntity = exports.assertFlexTreeEntityNotFreed = exports.ContextSlot = exports.Context = exports.flexTreeSlot = exports.isFlexTreeNode = exports.FlexTreeEntityKind = exports.flexTreeMarker = exports.TreeStatus = void 0;
7
+ exports.treeStatusFromAnchorCache = exports.indexForAt = exports.getSchemaAndPolicy = exports.getOrCreateHydratedFlexTreeNode = exports.LazyEntity = exports.assertFlexTreeEntityNotFreed = exports.ContextSlot = exports.Context = exports.flexTreeSlot = exports.isFlexTreeNode = exports.FlexTreeEntityKind = exports.flexTreeMarker = exports.TreeStatus = void 0;
8
8
  var flexTreeTypes_js_1 = require("./flexTreeTypes.js");
9
9
  Object.defineProperty(exports, "TreeStatus", { enumerable: true, get: function () { return flexTreeTypes_js_1.TreeStatus; } });
10
10
  Object.defineProperty(exports, "flexTreeMarker", { enumerable: true, get: function () { return flexTreeTypes_js_1.flexTreeMarker; } });
@@ -17,6 +17,8 @@ Object.defineProperty(exports, "ContextSlot", { enumerable: true, get: function
17
17
  var lazyEntity_js_1 = require("./lazyEntity.js");
18
18
  Object.defineProperty(exports, "assertFlexTreeEntityNotFreed", { enumerable: true, get: function () { return lazyEntity_js_1.assertFlexTreeEntityNotFreed; } });
19
19
  Object.defineProperty(exports, "LazyEntity", { enumerable: true, get: function () { return lazyEntity_js_1.LazyEntity; } });
20
+ var lazyNode_js_1 = require("./lazyNode.js");
21
+ Object.defineProperty(exports, "getOrCreateHydratedFlexTreeNode", { enumerable: true, get: function () { return lazyNode_js_1.getOrCreateHydratedFlexTreeNode; } });
20
22
  var utilities_js_1 = require("./utilities.js");
21
23
  Object.defineProperty(exports, "getSchemaAndPolicy", { enumerable: true, get: function () { return utilities_js_1.getSchemaAndPolicy; } });
22
24
  Object.defineProperty(exports, "indexForAt", { enumerable: true, get: function () { return utilities_js_1.indexForAt; } });
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,uDAiB4B;AAT3B,8GAAA,UAAU,OAAA;AAEV,kHAAA,cAAc,OAAA;AACd,sHAAA,kBAAkB,OAAA;AAClB,kHAAA,cAAc,OAAA;AACd,gHAAA,YAAY,OAAA;AAMb,2CAMsB;AAHrB,qGAAA,OAAO,OAAA;AACP,yGAAA,WAAW,OAAA;AAMZ,iDAGyB;AAFxB,6HAAA,4BAA4B,OAAA;AAC5B,2GAAA,UAAU,OAAA;AAGX,+CAAgE;AAAvD,kHAAA,kBAAkB,OAAA;AAAE,0GAAA,UAAU,OAAA;AAEvC,+CAA2D;AAAlD,yHAAA,yBAAyB,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\ttype FlexTreeField,\n\ttype FlexTreeNode,\n\ttype FlexTreeEntity,\n\ttype FlexTreeTypedField,\n\ttype FlexTreeOptionalField,\n\ttype FlexTreeRequiredField,\n\ttype FlexTreeSequenceField,\n\tTreeStatus,\n\ttype FlexTreeUnknownUnboxed,\n\tflexTreeMarker,\n\tFlexTreeEntityKind,\n\tisFlexTreeNode,\n\tflexTreeSlot,\n\ttype FlexibleNodeContent,\n\ttype FlexibleFieldContent,\n\ttype HydratedFlexTreeNode,\n} from \"./flexTreeTypes.js\";\n\nexport {\n\ttype FlexTreeContext,\n\ttype FlexTreeHydratedContext,\n\tContext,\n\tContextSlot,\n\ttype FlexTreeHydratedContextMinimal,\n} from \"./context.js\";\n\nexport { type FlexTreeNodeEvents } from \"./treeEvents.js\";\n\nexport {\n\tassertFlexTreeEntityNotFreed,\n\tLazyEntity,\n} from \"./lazyEntity.js\";\n\nexport { getSchemaAndPolicy, indexForAt } from \"./utilities.js\";\n\nexport { treeStatusFromAnchorCache } from \"./utilities.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,uDAiB4B;AAT3B,8GAAA,UAAU,OAAA;AAEV,kHAAA,cAAc,OAAA;AACd,sHAAA,kBAAkB,OAAA;AAClB,kHAAA,cAAc,OAAA;AACd,gHAAA,YAAY,OAAA;AAMb,2CAMsB;AAHrB,qGAAA,OAAO,OAAA;AACP,yGAAA,WAAW,OAAA;AAMZ,iDAGyB;AAFxB,6HAAA,4BAA4B,OAAA;AAC5B,2GAAA,UAAU,OAAA;AAGX,6CAAgE;AAAvD,8HAAA,+BAA+B,OAAA;AAExC,+CAAgE;AAAvD,kHAAA,kBAAkB,OAAA;AAAE,0GAAA,UAAU,OAAA;AAEvC,+CAA2D;AAAlD,yHAAA,yBAAyB,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\ttype FlexTreeField,\n\ttype FlexTreeNode,\n\ttype FlexTreeEntity,\n\ttype FlexTreeTypedField,\n\ttype FlexTreeOptionalField,\n\ttype FlexTreeRequiredField,\n\ttype FlexTreeSequenceField,\n\tTreeStatus,\n\ttype FlexTreeUnknownUnboxed,\n\tflexTreeMarker,\n\tFlexTreeEntityKind,\n\tisFlexTreeNode,\n\tflexTreeSlot,\n\ttype FlexibleNodeContent,\n\ttype FlexibleFieldContent,\n\ttype HydratedFlexTreeNode,\n} from \"./flexTreeTypes.js\";\n\nexport {\n\ttype FlexTreeContext,\n\ttype FlexTreeHydratedContext,\n\tContext,\n\tContextSlot,\n\ttype FlexTreeHydratedContextMinimal,\n} from \"./context.js\";\n\nexport { type FlexTreeNodeEvents } from \"./treeEvents.js\";\n\nexport {\n\tassertFlexTreeEntityNotFreed,\n\tLazyEntity,\n} from \"./lazyEntity.js\";\n\nexport { getOrCreateHydratedFlexTreeNode } from \"./lazyNode.js\";\n\nexport { getSchemaAndPolicy, indexForAt } from \"./utilities.js\";\n\nexport { treeStatusFromAnchorCache } from \"./utilities.js\";\n"]}