@fluidframework/tree 2.3.1 → 2.4.0-297027

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 (674) hide show
  1. package/api-report/tree.alpha.api.md +77 -38
  2. package/api-report/tree.beta.api.md +50 -30
  3. package/api-report/tree.legacy.alpha.api.md +50 -30
  4. package/api-report/tree.legacy.public.api.md +50 -30
  5. package/api-report/tree.public.api.md +50 -30
  6. package/dist/alpha.d.ts +7 -0
  7. package/dist/beta.d.ts +4 -0
  8. package/dist/core/index.d.ts +1 -1
  9. package/dist/core/index.d.ts.map +1 -1
  10. package/dist/core/index.js +2 -1
  11. package/dist/core/index.js.map +1 -1
  12. package/dist/core/rebase/index.d.ts +1 -1
  13. package/dist/core/rebase/index.d.ts.map +1 -1
  14. package/dist/core/rebase/index.js +2 -1
  15. package/dist/core/rebase/index.js.map +1 -1
  16. package/dist/core/rebase/types.d.ts +1 -0
  17. package/dist/core/rebase/types.d.ts.map +1 -1
  18. package/dist/core/rebase/types.js +8 -1
  19. package/dist/core/rebase/types.js.map +1 -1
  20. package/dist/core/schema-stored/schema.d.ts +7 -0
  21. package/dist/core/schema-stored/schema.d.ts.map +1 -1
  22. package/dist/core/schema-stored/schema.js +9 -0
  23. package/dist/core/schema-stored/schema.js.map +1 -1
  24. package/dist/core/tree/anchorSet.d.ts +1 -2
  25. package/dist/core/tree/anchorSet.d.ts.map +1 -1
  26. package/dist/core/tree/anchorSet.js +2 -2
  27. package/dist/core/tree/anchorSet.js.map +1 -1
  28. package/dist/core/tree/detachedFieldIndex.d.ts.map +1 -1
  29. package/dist/core/tree/detachedFieldIndex.js +13 -2
  30. package/dist/core/tree/detachedFieldIndex.js.map +1 -1
  31. package/dist/core/tree/detachedFieldIndexTypes.d.ts +1 -1
  32. package/dist/core/tree/detachedFieldIndexTypes.js.map +1 -1
  33. package/dist/feature-libraries/editableTreeBinder.d.ts +3 -230
  34. package/dist/feature-libraries/editableTreeBinder.d.ts.map +1 -1
  35. package/dist/feature-libraries/editableTreeBinder.js +1 -539
  36. package/dist/feature-libraries/editableTreeBinder.js.map +1 -1
  37. package/dist/feature-libraries/flex-tree/context.d.ts +7 -14
  38. package/dist/feature-libraries/flex-tree/context.d.ts.map +1 -1
  39. package/dist/feature-libraries/flex-tree/context.js +3 -3
  40. package/dist/feature-libraries/flex-tree/context.js.map +1 -1
  41. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts +2 -16
  42. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  43. package/dist/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  44. package/dist/feature-libraries/flex-tree/lazyEntity.d.ts +2 -3
  45. package/dist/feature-libraries/flex-tree/lazyEntity.d.ts.map +1 -1
  46. package/dist/feature-libraries/flex-tree/lazyEntity.js +1 -2
  47. package/dist/feature-libraries/flex-tree/lazyEntity.js.map +1 -1
  48. package/dist/feature-libraries/flex-tree/lazyField.d.ts +10 -15
  49. package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  50. package/dist/feature-libraries/flex-tree/lazyField.js +18 -20
  51. package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
  52. package/dist/feature-libraries/flex-tree/lazyNode.d.ts +4 -5
  53. package/dist/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  54. package/dist/feature-libraries/flex-tree/lazyNode.js +13 -23
  55. package/dist/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  56. package/dist/feature-libraries/flex-tree/utilities.js +1 -1
  57. package/dist/feature-libraries/flex-tree/utilities.js.map +1 -1
  58. package/dist/feature-libraries/index.d.ts +4 -7
  59. package/dist/feature-libraries/index.d.ts.map +1 -1
  60. package/dist/feature-libraries/index.js +5 -31
  61. package/dist/feature-libraries/index.js.map +1 -1
  62. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +7 -0
  63. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  64. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +61 -17
  65. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  66. package/dist/feature-libraries/sequence-field/compose.d.ts.map +1 -1
  67. package/dist/feature-libraries/sequence-field/compose.js +3 -0
  68. package/dist/feature-libraries/sequence-field/compose.js.map +1 -1
  69. package/dist/feature-libraries/sequence-field/formatV1.d.ts +18 -18
  70. package/dist/feature-libraries/sequence-field/formatV2.d.ts +18 -18
  71. package/dist/feature-libraries/sequence-field/formatV3.d.ts +27 -27
  72. package/dist/feature-libraries/sequence-field/utils.d.ts.map +1 -1
  73. package/dist/feature-libraries/sequence-field/utils.js +1 -4
  74. package/dist/feature-libraries/sequence-field/utils.js.map +1 -1
  75. package/dist/feature-libraries/typed-schema/flexList.d.ts +1 -46
  76. package/dist/feature-libraries/typed-schema/flexList.d.ts.map +1 -1
  77. package/dist/feature-libraries/typed-schema/flexList.js +1 -13
  78. package/dist/feature-libraries/typed-schema/flexList.js.map +1 -1
  79. package/dist/feature-libraries/typed-schema/index.d.ts +2 -4
  80. package/dist/feature-libraries/typed-schema/index.d.ts.map +1 -1
  81. package/dist/feature-libraries/typed-schema/index.js +1 -19
  82. package/dist/feature-libraries/typed-schema/index.js.map +1 -1
  83. package/dist/feature-libraries/typed-schema/typedTreeSchema.d.ts +0 -212
  84. package/dist/feature-libraries/typed-schema/typedTreeSchema.d.ts.map +1 -1
  85. package/dist/feature-libraries/typed-schema/typedTreeSchema.js +0 -266
  86. package/dist/feature-libraries/typed-schema/typedTreeSchema.js.map +1 -1
  87. package/dist/index.d.ts +3 -3
  88. package/dist/index.d.ts.map +1 -1
  89. package/dist/index.js +2 -1
  90. package/dist/index.js.map +1 -1
  91. package/dist/internalTypes.d.ts +1 -1
  92. package/dist/internalTypes.d.ts.map +1 -1
  93. package/dist/internalTypes.js.map +1 -1
  94. package/dist/legacy.d.ts +4 -0
  95. package/dist/packageVersion.d.ts +1 -1
  96. package/dist/packageVersion.d.ts.map +1 -1
  97. package/dist/packageVersion.js +1 -1
  98. package/dist/packageVersion.js.map +1 -1
  99. package/dist/public.d.ts +4 -0
  100. package/dist/shared-tree/checkoutFlexTreeView.d.ts +3 -3
  101. package/dist/shared-tree/checkoutFlexTreeView.d.ts.map +1 -1
  102. package/dist/shared-tree/checkoutFlexTreeView.js +1 -1
  103. package/dist/shared-tree/checkoutFlexTreeView.js.map +1 -1
  104. package/dist/shared-tree/index.d.ts +3 -3
  105. package/dist/shared-tree/index.d.ts.map +1 -1
  106. package/dist/shared-tree/index.js +2 -3
  107. package/dist/shared-tree/index.js.map +1 -1
  108. package/dist/shared-tree/schematizeTree.d.ts +1 -40
  109. package/dist/shared-tree/schematizeTree.d.ts.map +1 -1
  110. package/dist/shared-tree/schematizeTree.js +2 -11
  111. package/dist/shared-tree/schematizeTree.js.map +1 -1
  112. package/dist/shared-tree/schematizingTreeView.d.ts +9 -7
  113. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  114. package/dist/shared-tree/schematizingTreeView.js +19 -8
  115. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  116. package/dist/shared-tree/sharedTree.d.ts +19 -2
  117. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  118. package/dist/shared-tree/sharedTree.js +10 -2
  119. package/dist/shared-tree/sharedTree.js.map +1 -1
  120. package/dist/shared-tree/treeCheckout.d.ts +71 -41
  121. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  122. package/dist/shared-tree/treeCheckout.js +116 -84
  123. package/dist/shared-tree/treeCheckout.js.map +1 -1
  124. package/dist/shared-tree-core/branch.d.ts +8 -11
  125. package/dist/shared-tree-core/branch.d.ts.map +1 -1
  126. package/dist/shared-tree-core/branch.js +12 -15
  127. package/dist/shared-tree-core/branch.js.map +1 -1
  128. package/dist/simple-tree/api/create.d.ts +1 -1
  129. package/dist/simple-tree/api/create.d.ts.map +1 -1
  130. package/dist/simple-tree/api/create.js +11 -13
  131. package/dist/simple-tree/api/create.js.map +1 -1
  132. package/dist/simple-tree/api/getJsonSchema.d.ts +3 -3
  133. package/dist/simple-tree/api/getJsonSchema.d.ts.map +1 -1
  134. package/dist/simple-tree/api/getJsonSchema.js +1 -1
  135. package/dist/simple-tree/api/getJsonSchema.js.map +1 -1
  136. package/dist/simple-tree/api/getSimpleSchema.d.ts +2 -2
  137. package/dist/simple-tree/api/getSimpleSchema.d.ts.map +1 -1
  138. package/dist/simple-tree/api/getSimpleSchema.js.map +1 -1
  139. package/dist/simple-tree/api/index.d.ts +2 -1
  140. package/dist/simple-tree/api/index.d.ts.map +1 -1
  141. package/dist/simple-tree/api/index.js +3 -1
  142. package/dist/simple-tree/api/index.js.map +1 -1
  143. package/dist/simple-tree/api/jsonSchema.d.ts +13 -14
  144. package/dist/simple-tree/api/jsonSchema.d.ts.map +1 -1
  145. package/dist/simple-tree/api/jsonSchema.js.map +1 -1
  146. package/dist/simple-tree/api/schemaFactory.d.ts +14 -8
  147. package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
  148. package/dist/simple-tree/api/schemaFactory.js +21 -2
  149. package/dist/simple-tree/api/schemaFactory.js.map +1 -1
  150. package/dist/simple-tree/api/schemaFactoryRecursive.d.ts +3 -3
  151. package/dist/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
  152. package/dist/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
  153. package/dist/simple-tree/api/simpleSchema.d.ts +18 -10
  154. package/dist/simple-tree/api/simpleSchema.d.ts.map +1 -1
  155. package/dist/simple-tree/api/simpleSchema.js.map +1 -1
  156. package/dist/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -1
  157. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js +30 -17
  158. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  159. package/dist/simple-tree/api/tree.d.ts +16 -6
  160. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  161. package/dist/simple-tree/api/tree.js +4 -4
  162. package/dist/simple-tree/api/tree.js.map +1 -1
  163. package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  164. package/dist/simple-tree/api/treeNodeApi.js +8 -6
  165. package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
  166. package/dist/simple-tree/api/verboseTree.d.ts.map +1 -1
  167. package/dist/simple-tree/api/verboseTree.js +6 -10
  168. package/dist/simple-tree/api/verboseTree.js.map +1 -1
  169. package/{lib/feature-libraries/typed-schema → dist/simple-tree/api}/view.d.ts +4 -11
  170. package/dist/simple-tree/api/view.d.ts.map +1 -0
  171. package/dist/{feature-libraries/typed-schema → simple-tree/api}/view.js +9 -9
  172. package/dist/simple-tree/api/view.js.map +1 -0
  173. package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts +2 -2
  174. package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
  175. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js +11 -1
  176. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
  177. package/dist/simple-tree/arrayNode.d.ts +147 -14
  178. package/dist/simple-tree/arrayNode.d.ts.map +1 -1
  179. package/dist/simple-tree/arrayNode.js +32 -20
  180. package/dist/simple-tree/arrayNode.js.map +1 -1
  181. package/dist/simple-tree/core/context.d.ts +55 -0
  182. package/dist/simple-tree/core/context.d.ts.map +1 -0
  183. package/dist/simple-tree/core/context.js +60 -0
  184. package/dist/simple-tree/core/context.js.map +1 -0
  185. package/dist/simple-tree/core/getOrCreateNode.d.ts +15 -0
  186. package/dist/simple-tree/core/getOrCreateNode.d.ts.map +1 -0
  187. package/dist/simple-tree/core/getOrCreateNode.js +36 -0
  188. package/dist/simple-tree/core/getOrCreateNode.js.map +1 -0
  189. package/dist/simple-tree/core/index.d.ts +7 -3
  190. package/dist/simple-tree/core/index.d.ts.map +1 -1
  191. package/dist/simple-tree/core/index.js +16 -7
  192. package/dist/simple-tree/core/index.js.map +1 -1
  193. package/dist/simple-tree/core/schemaCaching.d.ts +5 -13
  194. package/dist/simple-tree/core/schemaCaching.d.ts.map +1 -1
  195. package/dist/simple-tree/core/schemaCaching.js +16 -45
  196. package/dist/simple-tree/core/schemaCaching.js.map +1 -1
  197. package/dist/simple-tree/core/treeNodeKernel.d.ts +29 -7
  198. package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  199. package/dist/simple-tree/core/treeNodeKernel.js +94 -58
  200. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
  201. package/dist/simple-tree/core/treeNodeSchema.d.ts +24 -0
  202. package/dist/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  203. package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
  204. package/dist/simple-tree/core/types.d.ts +0 -5
  205. package/dist/simple-tree/core/types.d.ts.map +1 -1
  206. package/dist/simple-tree/core/types.js.map +1 -1
  207. package/dist/simple-tree/core/unhydratedFlexTree.d.ts +139 -0
  208. package/dist/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -0
  209. package/dist/{feature-libraries/flex-map-tree/mapTreeNode.js → simple-tree/core/unhydratedFlexTree.js} +112 -132
  210. package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -0
  211. package/dist/simple-tree/{walkSchema.d.ts → core/walkSchema.d.ts} +8 -4
  212. package/dist/simple-tree/core/walkSchema.d.ts.map +1 -0
  213. package/dist/simple-tree/core/walkSchema.js +34 -0
  214. package/dist/simple-tree/core/walkSchema.js.map +1 -0
  215. package/dist/simple-tree/createContext.d.ts +11 -0
  216. package/dist/simple-tree/createContext.d.ts.map +1 -0
  217. package/dist/simple-tree/createContext.js +25 -0
  218. package/dist/simple-tree/createContext.js.map +1 -0
  219. package/dist/simple-tree/index.d.ts +4 -5
  220. package/dist/simple-tree/index.d.ts.map +1 -1
  221. package/dist/simple-tree/index.js +7 -7
  222. package/dist/simple-tree/index.js.map +1 -1
  223. package/dist/simple-tree/leafNodeSchema.d.ts +1 -0
  224. package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
  225. package/dist/simple-tree/leafNodeSchema.js +1 -2
  226. package/dist/simple-tree/leafNodeSchema.js.map +1 -1
  227. package/dist/simple-tree/mapNode.d.ts +4 -4
  228. package/dist/simple-tree/mapNode.d.ts.map +1 -1
  229. package/dist/simple-tree/mapNode.js +9 -5
  230. package/dist/simple-tree/mapNode.js.map +1 -1
  231. package/dist/simple-tree/objectNode.d.ts +8 -8
  232. package/dist/simple-tree/objectNode.d.ts.map +1 -1
  233. package/dist/simple-tree/objectNode.js +33 -14
  234. package/dist/simple-tree/objectNode.js.map +1 -1
  235. package/dist/simple-tree/objectNodeTypes.d.ts +7 -3
  236. package/dist/simple-tree/objectNodeTypes.d.ts.map +1 -1
  237. package/dist/simple-tree/objectNodeTypes.js.map +1 -1
  238. package/dist/simple-tree/proxies.d.ts +1 -2
  239. package/dist/simple-tree/proxies.d.ts.map +1 -1
  240. package/dist/simple-tree/proxies.js +6 -22
  241. package/dist/simple-tree/proxies.js.map +1 -1
  242. package/dist/simple-tree/schemaTypes.d.ts +44 -4
  243. package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
  244. package/dist/simple-tree/schemaTypes.js +10 -0
  245. package/dist/simple-tree/schemaTypes.js.map +1 -1
  246. package/dist/simple-tree/toFlexSchema.d.ts +6 -36
  247. package/dist/simple-tree/toFlexSchema.d.ts.map +1 -1
  248. package/dist/simple-tree/toFlexSchema.js +58 -142
  249. package/dist/simple-tree/toFlexSchema.js.map +1 -1
  250. package/dist/simple-tree/toMapTree.d.ts.map +1 -1
  251. package/dist/simple-tree/toMapTree.js +2 -2
  252. package/dist/simple-tree/toMapTree.js.map +1 -1
  253. package/dist/simple-tree/treeNodeValid.d.ts +13 -5
  254. package/dist/simple-tree/treeNodeValid.d.ts.map +1 -1
  255. package/dist/simple-tree/treeNodeValid.js +19 -10
  256. package/dist/simple-tree/treeNodeValid.js.map +1 -1
  257. package/dist/simple-tree/typesUnsafe.d.ts +4 -4
  258. package/dist/simple-tree/typesUnsafe.d.ts.map +1 -1
  259. package/dist/simple-tree/typesUnsafe.js.map +1 -1
  260. package/dist/simple-tree/walkFieldSchema.d.ts +11 -0
  261. package/dist/simple-tree/walkFieldSchema.d.ts.map +1 -0
  262. package/dist/simple-tree/walkFieldSchema.js +17 -0
  263. package/dist/simple-tree/walkFieldSchema.js.map +1 -0
  264. package/dist/util/index.d.ts +1 -1
  265. package/dist/util/index.d.ts.map +1 -1
  266. package/dist/util/index.js.map +1 -1
  267. package/dist/util/typeUtils.d.ts +14 -45
  268. package/dist/util/typeUtils.d.ts.map +1 -1
  269. package/dist/util/typeUtils.js.map +1 -1
  270. package/lib/alpha.d.ts +7 -0
  271. package/lib/beta.d.ts +4 -0
  272. package/lib/core/index.d.ts +1 -1
  273. package/lib/core/index.d.ts.map +1 -1
  274. package/lib/core/index.js +1 -1
  275. package/lib/core/index.js.map +1 -1
  276. package/lib/core/rebase/index.d.ts +1 -1
  277. package/lib/core/rebase/index.d.ts.map +1 -1
  278. package/lib/core/rebase/index.js +1 -1
  279. package/lib/core/rebase/index.js.map +1 -1
  280. package/lib/core/rebase/types.d.ts +1 -0
  281. package/lib/core/rebase/types.d.ts.map +1 -1
  282. package/lib/core/rebase/types.js +6 -0
  283. package/lib/core/rebase/types.js.map +1 -1
  284. package/lib/core/schema-stored/schema.d.ts +7 -0
  285. package/lib/core/schema-stored/schema.d.ts.map +1 -1
  286. package/lib/core/schema-stored/schema.js +9 -0
  287. package/lib/core/schema-stored/schema.js.map +1 -1
  288. package/lib/core/tree/anchorSet.d.ts +1 -2
  289. package/lib/core/tree/anchorSet.d.ts.map +1 -1
  290. package/lib/core/tree/anchorSet.js +2 -2
  291. package/lib/core/tree/anchorSet.js.map +1 -1
  292. package/lib/core/tree/detachedFieldIndex.d.ts.map +1 -1
  293. package/lib/core/tree/detachedFieldIndex.js +13 -2
  294. package/lib/core/tree/detachedFieldIndex.js.map +1 -1
  295. package/lib/core/tree/detachedFieldIndexTypes.d.ts +1 -1
  296. package/lib/core/tree/detachedFieldIndexTypes.js.map +1 -1
  297. package/lib/feature-libraries/editableTreeBinder.d.ts +3 -230
  298. package/lib/feature-libraries/editableTreeBinder.d.ts.map +1 -1
  299. package/lib/feature-libraries/editableTreeBinder.js +1 -532
  300. package/lib/feature-libraries/editableTreeBinder.js.map +1 -1
  301. package/lib/feature-libraries/flex-tree/context.d.ts +7 -14
  302. package/lib/feature-libraries/flex-tree/context.d.ts.map +1 -1
  303. package/lib/feature-libraries/flex-tree/context.js +3 -3
  304. package/lib/feature-libraries/flex-tree/context.js.map +1 -1
  305. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts +2 -16
  306. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  307. package/lib/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  308. package/lib/feature-libraries/flex-tree/lazyEntity.d.ts +2 -3
  309. package/lib/feature-libraries/flex-tree/lazyEntity.d.ts.map +1 -1
  310. package/lib/feature-libraries/flex-tree/lazyEntity.js +1 -2
  311. package/lib/feature-libraries/flex-tree/lazyEntity.js.map +1 -1
  312. package/lib/feature-libraries/flex-tree/lazyField.d.ts +10 -15
  313. package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  314. package/lib/feature-libraries/flex-tree/lazyField.js +18 -20
  315. package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
  316. package/lib/feature-libraries/flex-tree/lazyNode.d.ts +4 -5
  317. package/lib/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  318. package/lib/feature-libraries/flex-tree/lazyNode.js +13 -23
  319. package/lib/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  320. package/lib/feature-libraries/flex-tree/utilities.js +1 -1
  321. package/lib/feature-libraries/flex-tree/utilities.js.map +1 -1
  322. package/lib/feature-libraries/index.d.ts +4 -7
  323. package/lib/feature-libraries/index.d.ts.map +1 -1
  324. package/lib/feature-libraries/index.js +4 -6
  325. package/lib/feature-libraries/index.js.map +1 -1
  326. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +7 -0
  327. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  328. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +62 -18
  329. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  330. package/lib/feature-libraries/sequence-field/compose.d.ts.map +1 -1
  331. package/lib/feature-libraries/sequence-field/compose.js +3 -0
  332. package/lib/feature-libraries/sequence-field/compose.js.map +1 -1
  333. package/lib/feature-libraries/sequence-field/formatV1.d.ts +18 -18
  334. package/lib/feature-libraries/sequence-field/formatV2.d.ts +18 -18
  335. package/lib/feature-libraries/sequence-field/formatV3.d.ts +27 -27
  336. package/lib/feature-libraries/sequence-field/utils.d.ts.map +1 -1
  337. package/lib/feature-libraries/sequence-field/utils.js +2 -5
  338. package/lib/feature-libraries/sequence-field/utils.js.map +1 -1
  339. package/lib/feature-libraries/typed-schema/flexList.d.ts +1 -46
  340. package/lib/feature-libraries/typed-schema/flexList.d.ts.map +1 -1
  341. package/lib/feature-libraries/typed-schema/flexList.js +0 -11
  342. package/lib/feature-libraries/typed-schema/flexList.js.map +1 -1
  343. package/lib/feature-libraries/typed-schema/index.d.ts +2 -4
  344. package/lib/feature-libraries/typed-schema/index.d.ts.map +1 -1
  345. package/lib/feature-libraries/typed-schema/index.js +0 -3
  346. package/lib/feature-libraries/typed-schema/index.js.map +1 -1
  347. package/lib/feature-libraries/typed-schema/typedTreeSchema.d.ts +0 -212
  348. package/lib/feature-libraries/typed-schema/typedTreeSchema.d.ts.map +1 -1
  349. package/lib/feature-libraries/typed-schema/typedTreeSchema.js +1 -253
  350. package/lib/feature-libraries/typed-schema/typedTreeSchema.js.map +1 -1
  351. package/lib/index.d.ts +3 -3
  352. package/lib/index.d.ts.map +1 -1
  353. package/lib/index.js +1 -1
  354. package/lib/index.js.map +1 -1
  355. package/lib/internalTypes.d.ts +1 -1
  356. package/lib/internalTypes.d.ts.map +1 -1
  357. package/lib/internalTypes.js.map +1 -1
  358. package/lib/legacy.d.ts +4 -0
  359. package/lib/packageVersion.d.ts +1 -1
  360. package/lib/packageVersion.d.ts.map +1 -1
  361. package/lib/packageVersion.js +1 -1
  362. package/lib/packageVersion.js.map +1 -1
  363. package/lib/public.d.ts +4 -0
  364. package/lib/shared-tree/checkoutFlexTreeView.d.ts +3 -3
  365. package/lib/shared-tree/checkoutFlexTreeView.d.ts.map +1 -1
  366. package/lib/shared-tree/checkoutFlexTreeView.js +1 -1
  367. package/lib/shared-tree/checkoutFlexTreeView.js.map +1 -1
  368. package/lib/shared-tree/index.d.ts +3 -3
  369. package/lib/shared-tree/index.d.ts.map +1 -1
  370. package/lib/shared-tree/index.js +1 -2
  371. package/lib/shared-tree/index.js.map +1 -1
  372. package/lib/shared-tree/schematizeTree.d.ts +1 -40
  373. package/lib/shared-tree/schematizeTree.d.ts.map +1 -1
  374. package/lib/shared-tree/schematizeTree.js +1 -9
  375. package/lib/shared-tree/schematizeTree.js.map +1 -1
  376. package/lib/shared-tree/schematizingTreeView.d.ts +9 -7
  377. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  378. package/lib/shared-tree/schematizingTreeView.js +22 -11
  379. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  380. package/lib/shared-tree/sharedTree.d.ts +19 -2
  381. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  382. package/lib/shared-tree/sharedTree.js +10 -3
  383. package/lib/shared-tree/sharedTree.js.map +1 -1
  384. package/lib/shared-tree/treeCheckout.d.ts +71 -41
  385. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  386. package/lib/shared-tree/treeCheckout.js +118 -86
  387. package/lib/shared-tree/treeCheckout.js.map +1 -1
  388. package/lib/shared-tree-core/branch.d.ts +8 -11
  389. package/lib/shared-tree-core/branch.d.ts.map +1 -1
  390. package/lib/shared-tree-core/branch.js +12 -15
  391. package/lib/shared-tree-core/branch.js.map +1 -1
  392. package/lib/simple-tree/api/create.d.ts +1 -1
  393. package/lib/simple-tree/api/create.d.ts.map +1 -1
  394. package/lib/simple-tree/api/create.js +14 -16
  395. package/lib/simple-tree/api/create.js.map +1 -1
  396. package/lib/simple-tree/api/getJsonSchema.d.ts +3 -3
  397. package/lib/simple-tree/api/getJsonSchema.d.ts.map +1 -1
  398. package/lib/simple-tree/api/getJsonSchema.js +1 -1
  399. package/lib/simple-tree/api/getJsonSchema.js.map +1 -1
  400. package/lib/simple-tree/api/getSimpleSchema.d.ts +2 -2
  401. package/lib/simple-tree/api/getSimpleSchema.d.ts.map +1 -1
  402. package/lib/simple-tree/api/getSimpleSchema.js.map +1 -1
  403. package/lib/simple-tree/api/index.d.ts +2 -1
  404. package/lib/simple-tree/api/index.d.ts.map +1 -1
  405. package/lib/simple-tree/api/index.js +1 -0
  406. package/lib/simple-tree/api/index.js.map +1 -1
  407. package/lib/simple-tree/api/jsonSchema.d.ts +13 -14
  408. package/lib/simple-tree/api/jsonSchema.d.ts.map +1 -1
  409. package/lib/simple-tree/api/jsonSchema.js.map +1 -1
  410. package/lib/simple-tree/api/schemaFactory.d.ts +14 -8
  411. package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
  412. package/lib/simple-tree/api/schemaFactory.js +21 -2
  413. package/lib/simple-tree/api/schemaFactory.js.map +1 -1
  414. package/lib/simple-tree/api/schemaFactoryRecursive.d.ts +3 -3
  415. package/lib/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
  416. package/lib/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
  417. package/lib/simple-tree/api/simpleSchema.d.ts +18 -10
  418. package/lib/simple-tree/api/simpleSchema.d.ts.map +1 -1
  419. package/lib/simple-tree/api/simpleSchema.js.map +1 -1
  420. package/lib/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -1
  421. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js +31 -18
  422. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  423. package/lib/simple-tree/api/tree.d.ts +16 -6
  424. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  425. package/lib/simple-tree/api/tree.js +4 -4
  426. package/lib/simple-tree/api/tree.js.map +1 -1
  427. package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  428. package/lib/simple-tree/api/treeNodeApi.js +10 -8
  429. package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
  430. package/lib/simple-tree/api/verboseTree.d.ts.map +1 -1
  431. package/lib/simple-tree/api/verboseTree.js +6 -10
  432. package/lib/simple-tree/api/verboseTree.js.map +1 -1
  433. package/{dist/feature-libraries/typed-schema → lib/simple-tree/api}/view.d.ts +4 -11
  434. package/lib/simple-tree/api/view.d.ts.map +1 -0
  435. package/lib/{feature-libraries/typed-schema → simple-tree/api}/view.js +9 -9
  436. package/lib/simple-tree/api/view.js.map +1 -0
  437. package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts +2 -2
  438. package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
  439. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js +11 -1
  440. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
  441. package/lib/simple-tree/arrayNode.d.ts +147 -14
  442. package/lib/simple-tree/arrayNode.d.ts.map +1 -1
  443. package/lib/simple-tree/arrayNode.js +37 -25
  444. package/lib/simple-tree/arrayNode.js.map +1 -1
  445. package/lib/simple-tree/core/context.d.ts +55 -0
  446. package/lib/simple-tree/core/context.d.ts.map +1 -0
  447. package/lib/simple-tree/core/context.js +55 -0
  448. package/lib/simple-tree/core/context.js.map +1 -0
  449. package/lib/simple-tree/core/getOrCreateNode.d.ts +15 -0
  450. package/lib/simple-tree/core/getOrCreateNode.d.ts.map +1 -0
  451. package/lib/simple-tree/core/getOrCreateNode.js +32 -0
  452. package/lib/simple-tree/core/getOrCreateNode.js.map +1 -0
  453. package/lib/simple-tree/core/index.d.ts +7 -3
  454. package/lib/simple-tree/core/index.d.ts.map +1 -1
  455. package/lib/simple-tree/core/index.js +6 -2
  456. package/lib/simple-tree/core/index.js.map +1 -1
  457. package/lib/simple-tree/core/schemaCaching.d.ts +5 -13
  458. package/lib/simple-tree/core/schemaCaching.d.ts.map +1 -1
  459. package/lib/simple-tree/core/schemaCaching.js +13 -39
  460. package/lib/simple-tree/core/schemaCaching.js.map +1 -1
  461. package/lib/simple-tree/core/treeNodeKernel.d.ts +29 -7
  462. package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  463. package/lib/simple-tree/core/treeNodeKernel.js +89 -54
  464. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
  465. package/lib/simple-tree/core/treeNodeSchema.d.ts +24 -0
  466. package/lib/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  467. package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
  468. package/lib/simple-tree/core/types.d.ts +0 -5
  469. package/lib/simple-tree/core/types.d.ts.map +1 -1
  470. package/lib/simple-tree/core/types.js.map +1 -1
  471. package/lib/simple-tree/core/unhydratedFlexTree.d.ts +139 -0
  472. package/lib/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -0
  473. package/lib/{feature-libraries/flex-map-tree/mapTreeNode.js → simple-tree/core/unhydratedFlexTree.js} +110 -128
  474. package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -0
  475. package/lib/simple-tree/{walkSchema.d.ts → core/walkSchema.d.ts} +8 -4
  476. package/lib/simple-tree/core/walkSchema.d.ts.map +1 -0
  477. package/lib/simple-tree/core/walkSchema.js +29 -0
  478. package/lib/simple-tree/core/walkSchema.js.map +1 -0
  479. package/lib/simple-tree/createContext.d.ts +11 -0
  480. package/lib/simple-tree/createContext.d.ts.map +1 -0
  481. package/lib/simple-tree/createContext.js +21 -0
  482. package/lib/simple-tree/createContext.js.map +1 -0
  483. package/lib/simple-tree/index.d.ts +4 -5
  484. package/lib/simple-tree/index.d.ts.map +1 -1
  485. package/lib/simple-tree/index.js +3 -4
  486. package/lib/simple-tree/index.js.map +1 -1
  487. package/lib/simple-tree/leafNodeSchema.d.ts +1 -0
  488. package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
  489. package/lib/simple-tree/leafNodeSchema.js +3 -4
  490. package/lib/simple-tree/leafNodeSchema.js.map +1 -1
  491. package/lib/simple-tree/mapNode.d.ts +4 -4
  492. package/lib/simple-tree/mapNode.d.ts.map +1 -1
  493. package/lib/simple-tree/mapNode.js +12 -8
  494. package/lib/simple-tree/mapNode.js.map +1 -1
  495. package/lib/simple-tree/objectNode.d.ts +8 -8
  496. package/lib/simple-tree/objectNode.d.ts.map +1 -1
  497. package/lib/simple-tree/objectNode.js +36 -17
  498. package/lib/simple-tree/objectNode.js.map +1 -1
  499. package/lib/simple-tree/objectNodeTypes.d.ts +7 -3
  500. package/lib/simple-tree/objectNodeTypes.d.ts.map +1 -1
  501. package/lib/simple-tree/objectNodeTypes.js.map +1 -1
  502. package/lib/simple-tree/proxies.d.ts +1 -2
  503. package/lib/simple-tree/proxies.d.ts.map +1 -1
  504. package/lib/simple-tree/proxies.js +7 -22
  505. package/lib/simple-tree/proxies.js.map +1 -1
  506. package/lib/simple-tree/schemaTypes.d.ts +44 -4
  507. package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
  508. package/lib/simple-tree/schemaTypes.js +10 -0
  509. package/lib/simple-tree/schemaTypes.js.map +1 -1
  510. package/lib/simple-tree/toFlexSchema.d.ts +6 -36
  511. package/lib/simple-tree/toFlexSchema.d.ts.map +1 -1
  512. package/lib/simple-tree/toFlexSchema.js +61 -142
  513. package/lib/simple-tree/toFlexSchema.js.map +1 -1
  514. package/lib/simple-tree/toMapTree.d.ts.map +1 -1
  515. package/lib/simple-tree/toMapTree.js +4 -4
  516. package/lib/simple-tree/toMapTree.js.map +1 -1
  517. package/lib/simple-tree/treeNodeValid.d.ts +13 -5
  518. package/lib/simple-tree/treeNodeValid.d.ts.map +1 -1
  519. package/lib/simple-tree/treeNodeValid.js +21 -12
  520. package/lib/simple-tree/treeNodeValid.js.map +1 -1
  521. package/lib/simple-tree/typesUnsafe.d.ts +4 -4
  522. package/lib/simple-tree/typesUnsafe.d.ts.map +1 -1
  523. package/lib/simple-tree/typesUnsafe.js.map +1 -1
  524. package/lib/simple-tree/walkFieldSchema.d.ts +11 -0
  525. package/lib/simple-tree/walkFieldSchema.d.ts.map +1 -0
  526. package/lib/simple-tree/walkFieldSchema.js +13 -0
  527. package/lib/simple-tree/walkFieldSchema.js.map +1 -0
  528. package/lib/util/index.d.ts +1 -1
  529. package/lib/util/index.d.ts.map +1 -1
  530. package/lib/util/index.js.map +1 -1
  531. package/lib/util/typeUtils.d.ts +14 -45
  532. package/lib/util/typeUtils.d.ts.map +1 -1
  533. package/lib/util/typeUtils.js.map +1 -1
  534. package/package.json +41 -22
  535. package/src/core/index.ts +1 -0
  536. package/src/core/rebase/index.ts +1 -0
  537. package/src/core/rebase/types.ts +11 -0
  538. package/src/core/schema-stored/schema.ts +18 -0
  539. package/src/core/tree/anchorSet.ts +3 -4
  540. package/src/core/tree/detachedFieldIndex.ts +14 -3
  541. package/src/core/tree/detachedFieldIndexTypes.ts +1 -1
  542. package/src/feature-libraries/editableTreeBinder.ts +2 -915
  543. package/src/feature-libraries/flex-tree/context.ts +7 -20
  544. package/src/feature-libraries/flex-tree/flexTreeTypes.ts +2 -18
  545. package/src/feature-libraries/flex-tree/lazyEntity.ts +1 -4
  546. package/src/feature-libraries/flex-tree/lazyField.ts +22 -78
  547. package/src/feature-libraries/flex-tree/lazyNode.ts +24 -39
  548. package/src/feature-libraries/flex-tree/utilities.ts +1 -1
  549. package/src/feature-libraries/index.ts +3 -71
  550. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +97 -10
  551. package/src/feature-libraries/sequence-field/compose.ts +3 -0
  552. package/src/feature-libraries/sequence-field/utils.ts +2 -4
  553. package/src/feature-libraries/typed-schema/flexList.ts +3 -84
  554. package/src/feature-libraries/typed-schema/index.ts +1 -33
  555. package/src/feature-libraries/typed-schema/typedTreeSchema.ts +0 -458
  556. package/src/index.ts +7 -0
  557. package/src/internalTypes.ts +0 -1
  558. package/src/packageVersion.ts +1 -1
  559. package/src/shared-tree/checkoutFlexTreeView.ts +3 -3
  560. package/src/shared-tree/index.ts +4 -8
  561. package/src/shared-tree/schematizeTree.ts +2 -56
  562. package/src/shared-tree/schematizingTreeView.ts +38 -15
  563. package/src/shared-tree/sharedTree.ts +36 -8
  564. package/src/shared-tree/treeCheckout.ts +225 -128
  565. package/src/shared-tree-core/branch.ts +15 -26
  566. package/src/simple-tree/api/create.ts +18 -20
  567. package/src/simple-tree/api/getJsonSchema.ts +3 -3
  568. package/src/simple-tree/api/getSimpleSchema.ts +2 -2
  569. package/src/simple-tree/api/index.ts +2 -0
  570. package/src/simple-tree/api/jsonSchema.ts +19 -17
  571. package/src/simple-tree/api/schemaFactory.ts +53 -18
  572. package/src/simple-tree/api/schemaFactoryRecursive.ts +3 -6
  573. package/src/simple-tree/api/simpleSchema.ts +20 -10
  574. package/src/simple-tree/api/simpleSchemaToJsonSchema.ts +40 -19
  575. package/src/simple-tree/api/tree.ts +20 -9
  576. package/src/simple-tree/api/treeNodeApi.ts +12 -10
  577. package/src/simple-tree/api/verboseTree.ts +6 -12
  578. package/src/{feature-libraries/typed-schema → simple-tree/api}/view.ts +9 -22
  579. package/src/simple-tree/api/viewSchemaToSimpleSchema.ts +18 -4
  580. package/src/simple-tree/arrayNode.ts +202 -53
  581. package/src/simple-tree/core/context.ts +78 -0
  582. package/src/simple-tree/core/getOrCreateNode.ts +38 -0
  583. package/src/simple-tree/core/index.ts +11 -7
  584. package/src/simple-tree/core/schemaCaching.ts +13 -50
  585. package/src/simple-tree/core/treeNodeKernel.ts +117 -78
  586. package/src/simple-tree/core/treeNodeSchema.ts +35 -1
  587. package/src/simple-tree/core/types.ts +0 -5
  588. package/src/{feature-libraries/flex-map-tree/mapTreeNode.ts → simple-tree/core/unhydratedFlexTree.ts} +167 -210
  589. package/src/simple-tree/{walkSchema.ts → core/walkSchema.ts} +12 -34
  590. package/src/simple-tree/createContext.ts +24 -0
  591. package/src/simple-tree/index.ts +6 -2
  592. package/src/simple-tree/leafNodeSchema.ts +3 -9
  593. package/src/simple-tree/mapNode.ts +20 -17
  594. package/src/simple-tree/objectNode.ts +63 -38
  595. package/src/simple-tree/objectNodeTypes.ts +8 -5
  596. package/src/simple-tree/proxies.ts +8 -26
  597. package/src/simple-tree/schemaTypes.ts +55 -5
  598. package/src/simple-tree/toFlexSchema.ts +71 -204
  599. package/src/simple-tree/toMapTree.ts +5 -5
  600. package/src/simple-tree/treeNodeValid.ts +28 -22
  601. package/src/simple-tree/typesUnsafe.ts +4 -4
  602. package/src/simple-tree/walkFieldSchema.ts +19 -0
  603. package/src/util/index.ts +1 -5
  604. package/src/util/typeUtils.ts +14 -56
  605. package/dist/feature-libraries/fieldGenerator.d.ts +0 -43
  606. package/dist/feature-libraries/fieldGenerator.d.ts.map +0 -1
  607. package/dist/feature-libraries/fieldGenerator.js +0 -13
  608. package/dist/feature-libraries/fieldGenerator.js.map +0 -1
  609. package/dist/feature-libraries/flex-map-tree/index.d.ts +0 -6
  610. package/dist/feature-libraries/flex-map-tree/index.d.ts.map +0 -1
  611. package/dist/feature-libraries/flex-map-tree/index.js +0 -14
  612. package/dist/feature-libraries/flex-map-tree/index.js.map +0 -1
  613. package/dist/feature-libraries/flex-map-tree/mapTreeNode.d.ts +0 -157
  614. package/dist/feature-libraries/flex-map-tree/mapTreeNode.d.ts.map +0 -1
  615. package/dist/feature-libraries/flex-map-tree/mapTreeNode.js.map +0 -1
  616. package/dist/feature-libraries/storedToViewSchema.d.ts +0 -17
  617. package/dist/feature-libraries/storedToViewSchema.d.ts.map +0 -1
  618. package/dist/feature-libraries/storedToViewSchema.js +0 -67
  619. package/dist/feature-libraries/storedToViewSchema.js.map +0 -1
  620. package/dist/feature-libraries/typed-schema/schemaCollection.d.ts +0 -58
  621. package/dist/feature-libraries/typed-schema/schemaCollection.d.ts.map +0 -1
  622. package/dist/feature-libraries/typed-schema/schemaCollection.js +0 -160
  623. package/dist/feature-libraries/typed-schema/schemaCollection.js.map +0 -1
  624. package/dist/feature-libraries/typed-schema/typeUtils.d.ts +0 -15
  625. package/dist/feature-libraries/typed-schema/typeUtils.d.ts.map +0 -1
  626. package/dist/feature-libraries/typed-schema/typeUtils.js +0 -14
  627. package/dist/feature-libraries/typed-schema/typeUtils.js.map +0 -1
  628. package/dist/feature-libraries/typed-schema/view.d.ts.map +0 -1
  629. package/dist/feature-libraries/typed-schema/view.js.map +0 -1
  630. package/dist/simple-tree/getSimpleFieldSchema.d.ts +0 -14
  631. package/dist/simple-tree/getSimpleFieldSchema.d.ts.map +0 -1
  632. package/dist/simple-tree/getSimpleFieldSchema.js +0 -29
  633. package/dist/simple-tree/getSimpleFieldSchema.js.map +0 -1
  634. package/dist/simple-tree/walkSchema.d.ts.map +0 -1
  635. package/dist/simple-tree/walkSchema.js +0 -49
  636. package/dist/simple-tree/walkSchema.js.map +0 -1
  637. package/lib/feature-libraries/fieldGenerator.d.ts +0 -43
  638. package/lib/feature-libraries/fieldGenerator.d.ts.map +0 -1
  639. package/lib/feature-libraries/fieldGenerator.js +0 -12
  640. package/lib/feature-libraries/fieldGenerator.js.map +0 -1
  641. package/lib/feature-libraries/flex-map-tree/index.d.ts +0 -6
  642. package/lib/feature-libraries/flex-map-tree/index.d.ts.map +0 -1
  643. package/lib/feature-libraries/flex-map-tree/index.js +0 -6
  644. package/lib/feature-libraries/flex-map-tree/index.js.map +0 -1
  645. package/lib/feature-libraries/flex-map-tree/mapTreeNode.d.ts +0 -157
  646. package/lib/feature-libraries/flex-map-tree/mapTreeNode.d.ts.map +0 -1
  647. package/lib/feature-libraries/flex-map-tree/mapTreeNode.js.map +0 -1
  648. package/lib/feature-libraries/storedToViewSchema.d.ts +0 -17
  649. package/lib/feature-libraries/storedToViewSchema.d.ts.map +0 -1
  650. package/lib/feature-libraries/storedToViewSchema.js +0 -62
  651. package/lib/feature-libraries/storedToViewSchema.js.map +0 -1
  652. package/lib/feature-libraries/typed-schema/schemaCollection.d.ts +0 -58
  653. package/lib/feature-libraries/typed-schema/schemaCollection.d.ts.map +0 -1
  654. package/lib/feature-libraries/typed-schema/schemaCollection.js +0 -153
  655. package/lib/feature-libraries/typed-schema/schemaCollection.js.map +0 -1
  656. package/lib/feature-libraries/typed-schema/typeUtils.d.ts +0 -15
  657. package/lib/feature-libraries/typed-schema/typeUtils.d.ts.map +0 -1
  658. package/lib/feature-libraries/typed-schema/typeUtils.js +0 -10
  659. package/lib/feature-libraries/typed-schema/typeUtils.js.map +0 -1
  660. package/lib/feature-libraries/typed-schema/view.d.ts.map +0 -1
  661. package/lib/feature-libraries/typed-schema/view.js.map +0 -1
  662. package/lib/simple-tree/getSimpleFieldSchema.d.ts +0 -14
  663. package/lib/simple-tree/getSimpleFieldSchema.d.ts.map +0 -1
  664. package/lib/simple-tree/getSimpleFieldSchema.js +0 -25
  665. package/lib/simple-tree/getSimpleFieldSchema.js.map +0 -1
  666. package/lib/simple-tree/walkSchema.d.ts.map +0 -1
  667. package/lib/simple-tree/walkSchema.js +0 -43
  668. package/lib/simple-tree/walkSchema.js.map +0 -1
  669. package/src/feature-libraries/fieldGenerator.ts +0 -47
  670. package/src/feature-libraries/flex-map-tree/index.ts +0 -14
  671. package/src/feature-libraries/storedToViewSchema.ts +0 -100
  672. package/src/feature-libraries/typed-schema/schemaCollection.ts +0 -254
  673. package/src/feature-libraries/typed-schema/typeUtils.ts +0 -29
  674. package/src/simple-tree/getSimpleFieldSchema.ts +0 -36
@@ -1,157 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- import { type AnchorNode, type ExclusiveMapTree, type FieldKey, type FieldUpPath, type MapTree, type TreeFieldStoredSchema, type TreeNodeSchemaIdentifier, type TreeStoredSchema, type Value } from "../../core/index.js";
6
- import { type FlexTreeContext, FlexTreeEntityKind, type FlexTreeField, type FlexTreeNode, type FlexTreeSequenceField, type FlexTreeTypedField, flexTreeMarker, type FlexTreeHydratedContext } from "../flex-tree/index.js";
7
- import { FlexFieldSchema, type FlexTreeNodeSchema, type FlexTreeSchema } from "../typed-schema/index.js";
8
- import type { FlexFieldKind } from "../modular-schema/index.js";
9
- import { type SequenceFieldEditBuilder } from "../default-schema/index.js";
10
- /**
11
- * A readonly {@link FlexTreeNode} which wraps a {@link MapTree}.
12
- * @remarks Reading data from the MapTreeNode will read the corresponding data from the {@link MapTree}.
13
- * Create a `MapTreeNode` by calling {@link getOrCreateMapTreeNode}.
14
- */
15
- export interface MapTreeNode extends FlexTreeNode {
16
- readonly mapTree: MapTree;
17
- }
18
- /**
19
- * Checks if the given {@link FlexTreeNode} is a {@link MapTreeNode}.
20
- */
21
- export declare function isMapTreeNode(flexNode: FlexTreeNode): flexNode is MapTreeNode;
22
- /**
23
- * Checks if the given {@link FlexTreeField} is a {@link MapTreeSequenceField}.
24
- */
25
- export declare function isMapTreeSequenceField(field: FlexTreeSequenceField | FlexTreeField): field is MapTreeSequenceField;
26
- /**
27
- * An unhydrated {@link FlexTreeSequenceField}, which has additional editing capabilities.
28
- * @remarks When doing a removal edit, a {@link MapTreeSequenceField}'s `editor` returns ownership of the removed {@link ExclusiveMapTree}s to the caller.
29
- */
30
- export interface MapTreeSequenceField extends FlexTreeSequenceField {
31
- readonly editor: MapTreeSequenceFieldEditBuilder;
32
- }
33
- interface MapTreeSequenceFieldEditBuilder extends SequenceFieldEditBuilder<ExclusiveMapTree[]> {
34
- /**
35
- * Issues a change which removes `count` elements starting at the given `index`.
36
- * @param index - The index of the first removed element.
37
- * @param count - The number of elements to remove.
38
- * @returns the MapTrees that were removed
39
- */
40
- remove(index: number, count: number): ExclusiveMapTree[];
41
- }
42
- /** A node's parent field and its index in that field */
43
- interface LocationInField {
44
- readonly parent: MapTreeField;
45
- readonly index: number;
46
- }
47
- /**
48
- * A readonly implementation of {@link FlexTreeNode} which wraps a {@link MapTree}.
49
- * @remarks Any methods that would mutate the node will fail,
50
- * as will the querying of data specific to the {@link LazyTreeNode} implementation (e.g. {@link FlexTreeNode.context}).
51
- * MapTreeNodes are unconditionally cached -
52
- * when retrieved via {@link getOrCreateNode}, the same {@link MapTree} object will always produce the same `MapTreeNode` object.
53
- */
54
- export declare class EagerMapTreeNode implements MapTreeNode {
55
- readonly context: UnhydratedContext;
56
- readonly flexSchema: FlexTreeNodeSchema;
57
- /** The underlying {@link MapTree} that this `MapTreeNode` reads its data from */
58
- readonly mapTree: ExclusiveMapTree;
59
- private location;
60
- get schema(): TreeNodeSchemaIdentifier;
61
- readonly [flexTreeMarker]: FlexTreeEntityKind.Node;
62
- /**
63
- * Create a new MapTreeNode.
64
- * @param location - the parentage of this node, if it is being created underneath an existing node and field, or undefined if not
65
- * @remarks This class (and its subclasses) should not be directly constructed outside of this module.
66
- * Instead, use {@link getOrCreateNode} to create a MapTreeNode from a {@link MapTree}.
67
- * A `MapTreeNode` may never be constructed more than once for the same {@link MapTree} object.
68
- * Instead, it should always be acquired via {@link getOrCreateNode}.
69
- */
70
- constructor(context: UnhydratedContext, flexSchema: FlexTreeNodeSchema,
71
- /** The underlying {@link MapTree} that this `MapTreeNode` reads its data from */
72
- mapTree: ExclusiveMapTree, location?: LocationInField);
73
- get type(): TreeNodeSchemaIdentifier;
74
- /**
75
- * Set this node's parentage (see {@link FlexTreeNode.parentField}).
76
- * @remarks The node may be given a parent if it has none, or may have its parent removed (by passing `undefined`).
77
- * However, a node with a parent may not be directly re-assigned a different parent.
78
- * That likely indicates either an attempted multi-parenting or an attempt to "move" the node, neither of which are supported.
79
- * Removing a node's parent twice in a row is also not supported, as it likely indicates a bug.
80
- */
81
- adoptBy(parent: undefined): void;
82
- adoptBy(parent: MapTreeField, index: number): void;
83
- /**
84
- * The field this tree is in, and the index within that field.
85
- * @remarks If this node is unparented, this method will return the special {@link unparentedLocation} as the parent.
86
- */
87
- get parentField(): LocationInField;
88
- is(schema: FlexTreeNodeSchema): boolean;
89
- tryGetField(key: FieldKey): EagerMapTreeField | undefined;
90
- getBoxed(key: string): FlexTreeField;
91
- boxedIterator(): IterableIterator<FlexTreeField>;
92
- keys(): IterableIterator<FieldKey>;
93
- get value(): Value;
94
- get anchorNode(): AnchorNode;
95
- private walkTree;
96
- }
97
- /**
98
- * Implementation of `FlexTreeContext`.
99
- *
100
- * @remarks An editor is required to edit the FlexTree.
101
- */
102
- export declare class UnhydratedContext implements FlexTreeContext {
103
- readonly flexSchema: FlexTreeSchema;
104
- readonly schema: TreeStoredSchema;
105
- /**
106
- * @param flexSchema - Schema to use when working with the tree.
107
- */
108
- constructor(flexSchema: FlexTreeSchema);
109
- isHydrated(): this is FlexTreeHydratedContext;
110
- }
111
- /**
112
- * A readonly {@link FlexTreeField} which wraps an array of {@link MapTrees}.
113
- * @remarks Reading data from the MapTreeField will read the corresponding data from the {@link MapTree}s.
114
- * Create a `MapTreeField` by calling {@link getOrCreateField}.
115
- */
116
- interface MapTreeField extends FlexTreeField {
117
- readonly mapTrees: readonly MapTree[];
118
- }
119
- declare class EagerMapTreeField implements MapTreeField {
120
- readonly context: UnhydratedContext;
121
- readonly flexSchema: FlexFieldSchema;
122
- readonly key: FieldKey;
123
- readonly parent: EagerMapTreeNode;
124
- [flexTreeMarker]: FlexTreeEntityKind.Field;
125
- get schema(): TreeFieldStoredSchema;
126
- constructor(context: UnhydratedContext, flexSchema: FlexFieldSchema, key: FieldKey, parent: EagerMapTreeNode);
127
- get mapTrees(): readonly ExclusiveMapTree[];
128
- get length(): number;
129
- is<TKind2 extends FlexFieldKind>(kind: TKind2): this is FlexTreeTypedField<TKind2>;
130
- boxedIterator(): IterableIterator<FlexTreeNode>;
131
- boxedAt(index: number): FlexTreeNode | undefined;
132
- /**
133
- * Mutate this field.
134
- * @param edit - A function which receives the current `MapTree`s that comprise the contents of the field so that it may be mutated.
135
- * The function may mutate the array in place or return a new array.
136
- * If a new array is returned then it will be used as the new contents of the field, otherwise the original array will be continue to be used.
137
- * @remarks All edits to the field (i.e. mutations of the field's MapTrees) should be directed through this function.
138
- * This function ensures that the parent MapTree has no empty fields (which is an invariant of `MapTree`) after the mutation.
139
- */
140
- protected edit(edit: (mapTrees: ExclusiveMapTree[]) => void | ExclusiveMapTree[]): void;
141
- getFieldPath(): FieldUpPath;
142
- }
143
- /**
144
- * If there exists a {@link EagerMapTreeNode} for the given {@link MapTree}, returns it, otherwise returns `undefined`.
145
- * @remarks {@link EagerMapTreeNode | MapTreeNodes} are created via {@link getOrCreateNode}.
146
- */
147
- export declare function tryGetMapTreeNode(mapTree: MapTree): MapTreeNode | undefined;
148
- /**
149
- * Create a {@link EagerMapTreeNode} that wraps the given {@link MapTree}, or get the node that already exists for that {@link MapTree} if there is one.
150
- * @param nodeSchema - the {@link FlexTreeNodeSchema | schema} that the node conforms to
151
- * @param mapTree - the {@link MapTree} containing the data for this node.
152
- * @remarks It must conform to the `nodeSchema`.
153
- */
154
- export declare function getOrCreateMapTreeNode(context: UnhydratedContext, nodeSchema: FlexTreeNodeSchema, mapTree: ExclusiveMapTree): EagerMapTreeNode;
155
- export declare function unsupportedUsageError(message?: string): Error;
156
- export {};
157
- //# sourceMappingURL=mapTreeNode.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mapTreeNode.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/flex-map-tree/mapTreeNode.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EACN,KAAK,UAAU,EAEf,KAAK,gBAAgB,EACrB,KAAK,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,OAAO,EACZ,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,EAC7B,KAAK,gBAAgB,EACrB,KAAK,KAAK,EACV,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACN,KAAK,eAAe,EACpB,kBAAkB,EAClB,KAAK,aAAa,EAClB,KAAK,YAAY,EAGjB,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EAEvB,cAAc,EAEd,KAAK,uBAAuB,EAC5B,MAAM,uBAAuB,CAAC;A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AC,UAAU,EAAE,CAAC;QAC/D,OAAO,IAAI,yBAAyB,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;IAC3E,CAAC;IAED,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,KAAK,UAAU,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC;QAC/D,OAAO,IAAI,yBAAyB,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;IAC3E,CAAC;IAED,OAAO,IAAI,iBAAiB,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;AACnE,CAAC;AAED,yCAAyC;AACzC,SAAS,OAAO,CACf,MAAuB,EACvB,OAAyB,EACzB,MAAuB;IAEvB,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;IAC5B,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC;IACd,CAAC;IAED,OAAO,gBAAgB,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;AACtF,CAAC;AAED,4CAA4C;AAE5C,MAAM,UAAU,qBAAqB,CAAC,OAAgB;IACrD,OAAO,IAAI,UAAU,CACpB,GACC,OAAO,IAAI,WACZ,4EAA4E,CAC5E,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, oob } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\ttype AnchorNode,\n\tEmptyKey,\n\ttype ExclusiveMapTree,\n\ttype FieldKey,\n\ttype FieldUpPath,\n\ttype MapTree,\n\ttype TreeFieldStoredSchema,\n\ttype TreeNodeSchemaIdentifier,\n\ttype TreeStoredSchema,\n\ttype Value,\n} from \"../../core/index.js\";\nimport { brand, fail, getOrCreate, isReadonlyArray, mapIterable } from \"../../util/index.js\";\nimport {\n\ttype FlexTreeContext,\n\tFlexTreeEntityKind,\n\ttype FlexTreeField,\n\ttype FlexTreeNode,\n\ttype FlexTreeOptionalField,\n\ttype FlexTreeRequiredField,\n\ttype FlexTreeSequenceField,\n\ttype FlexTreeTypedField,\n\ttype FlexTreeUnknownUnboxed,\n\tflexTreeMarker,\n\tindexForAt,\n\ttype FlexTreeHydratedContext,\n} from \"../flex-tree/index.js\";\nimport {\n\ttype FlexAllowedTypes,\n\tFlexFieldSchema,\n\ttype FlexTreeNodeSchema,\n\ttype FlexTreeSchema,\n\tintoStoredSchemaCollection,\n\tisLazy,\n} from \"../typed-schema/index.js\";\nimport type { FlexFieldKind } from \"../modular-schema/index.js\";\nimport {\n\tdefaultSchemaPolicy,\n\tFieldKinds,\n\ttype SequenceFieldEditBuilder,\n} from \"../default-schema/index.js\";\n\n// #region Nodes\n\n/**\n * A readonly {@link FlexTreeNode} which wraps a {@link MapTree}.\n * @remarks Reading data from the MapTreeNode will read the corresponding data from the {@link MapTree}.\n * Create a `MapTreeNode` by calling {@link getOrCreateMapTreeNode}.\n */\nexport interface MapTreeNode extends FlexTreeNode {\n\treadonly mapTree: MapTree;\n}\n\n/**\n * Checks if the given {@link FlexTreeNode} is a {@link MapTreeNode}.\n */\nexport function isMapTreeNode(flexNode: FlexTreeNode): flexNode is MapTreeNode {\n\treturn flexNode instanceof EagerMapTreeNode;\n}\n\n/**\n * Checks if the given {@link FlexTreeField} is a {@link MapTreeSequenceField}.\n */\nexport function isMapTreeSequenceField(\n\tfield: FlexTreeSequenceField | FlexTreeField,\n): field is MapTreeSequenceField {\n\treturn field instanceof EagerMapTreeSequenceField;\n}\n\n/**\n * An unhydrated {@link FlexTreeSequenceField}, which has additional editing capabilities.\n * @remarks When doing a removal edit, a {@link MapTreeSequenceField}'s `editor` returns ownership of the removed {@link ExclusiveMapTree}s to the caller.\n */\nexport interface MapTreeSequenceField extends FlexTreeSequenceField {\n\treadonly editor: MapTreeSequenceFieldEditBuilder;\n}\n\ninterface MapTreeSequenceFieldEditBuilder\n\textends SequenceFieldEditBuilder<ExclusiveMapTree[]> {\n\t/**\n\t * Issues a change which removes `count` elements starting at the given `index`.\n\t * @param index - The index of the first removed element.\n\t * @param count - The number of elements to remove.\n\t * @returns the MapTrees that were removed\n\t */\n\tremove(index: number, count: number): ExclusiveMapTree[];\n}\n\n/** A node's parent field and its index in that field */\ninterface LocationInField {\n\treadonly parent: MapTreeField;\n\treadonly index: number;\n}\n\n/**\n * A readonly implementation of {@link FlexTreeNode} which wraps a {@link MapTree}.\n * @remarks Any methods that would mutate the node will fail,\n * as will the querying of data specific to the {@link LazyTreeNode} implementation (e.g. {@link FlexTreeNode.context}).\n * MapTreeNodes are unconditionally cached -\n * when retrieved via {@link getOrCreateNode}, the same {@link MapTree} object will always produce the same `MapTreeNode` object.\n */\nexport class EagerMapTreeNode implements MapTreeNode {\n\tpublic get schema(): TreeNodeSchemaIdentifier {\n\t\treturn this.flexSchema.name;\n\t}\n\n\tpublic readonly [flexTreeMarker] = FlexTreeEntityKind.Node as const;\n\n\t/**\n\t * Create a new MapTreeNode.\n\t * @param location - the parentage of this node, if it is being created underneath an existing node and field, or undefined if not\n\t * @remarks This class (and its subclasses) should not be directly constructed outside of this module.\n\t * Instead, use {@link getOrCreateNode} to create a MapTreeNode from a {@link MapTree}.\n\t * A `MapTreeNode` may never be constructed more than once for the same {@link MapTree} object.\n\t * Instead, it should always be acquired via {@link getOrCreateNode}.\n\t */\n\tpublic constructor(\n\t\tpublic readonly context: UnhydratedContext,\n\t\tpublic readonly flexSchema: FlexTreeNodeSchema,\n\t\t/** The underlying {@link MapTree} that this `MapTreeNode` reads its data from */\n\t\tpublic readonly mapTree: ExclusiveMapTree,\n\t\tprivate location = unparentedLocation,\n\t) {\n\t\tassert(!nodeCache.has(mapTree), 0x98b /* A node already exists for the given MapTree */);\n\t\tnodeCache.set(mapTree, this);\n\n\t\t// Fully demand the tree to ensure that parent pointers are present and accurate on all nodes.\n\t\t// When a MapTreeNode is constructed, its MapTree may contain nodes (anywhere below) that map (via the `nodeCache`) to pre-existing MapTreeNodes.\n\t\t// Put another way, for a given MapTree, some ancestor MapTreeNode can be created after any number of its descendant MapTreeNodes already exist.\n\t\t// In such a case, the spine of nodes between the descendant and ancestor need to exist in order for the ancestor to be able to walk upwards via the `parentField` property.\n\t\t// This needs to happen for all MapTreeNodes that are descendants of the ancestor MapTreeNode.\n\t\t// Demanding the entire tree is overkill to solve this problem since not all descendant MapTree nodes will have corresponding MapTreeNodes.\n\t\t// However, demanding the full tree also lets us eagerly validate that there are no duplicate MapTrees (i.e. same MapTree object) anywhere in the tree.\n\t\tthis.walkTree();\n\t}\n\n\tpublic get type(): TreeNodeSchemaIdentifier {\n\t\treturn this.flexSchema.name;\n\t}\n\n\t/**\n\t * Set this node's parentage (see {@link FlexTreeNode.parentField}).\n\t * @remarks The node may be given a parent if it has none, or may have its parent removed (by passing `undefined`).\n\t * However, a node with a parent may not be directly re-assigned a different parent.\n\t * That likely indicates either an attempted multi-parenting or an attempt to \"move\" the node, neither of which are supported.\n\t * Removing a node's parent twice in a row is also not supported, as it likely indicates a bug.\n\t */\n\tpublic adoptBy(parent: undefined): void;\n\tpublic adoptBy(parent: MapTreeField, index: number): void;\n\tpublic adoptBy(parent: MapTreeField | undefined, index?: number): void {\n\t\tif (parent !== undefined) {\n\t\t\tassert(\n\t\t\t\tthis.location === unparentedLocation,\n\t\t\t\t0x98c /* Node may not be adopted if it already has a parent */,\n\t\t\t);\n\t\t\tassert(index !== undefined, 0xa08 /* Expected index */);\n\t\t\tthis.location = { parent, index };\n\t\t} else {\n\t\t\tassert(\n\t\t\t\tthis.location !== unparentedLocation,\n\t\t\t\t0xa09 /* Node may not be un-adopted if it does not have a parent */,\n\t\t\t);\n\t\t\tthis.location = unparentedLocation;\n\t\t}\n\t}\n\n\t/**\n\t * The field this tree is in, and the index within that field.\n\t * @remarks If this node is unparented, this method will return the special {@link unparentedLocation} as the parent.\n\t */\n\tpublic get parentField(): LocationInField {\n\t\treturn this.location;\n\t}\n\n\tpublic is(schema: FlexTreeNodeSchema): boolean {\n\t\treturn (schema as unknown) === this.flexSchema;\n\t}\n\n\tpublic tryGetField(key: FieldKey): EagerMapTreeField | undefined {\n\t\tconst field = this.mapTree.fields.get(key);\n\t\t// Only return the field if it is not empty, in order to fulfill the contract of `tryGetField`.\n\t\tif (field !== undefined && field.length > 0) {\n\t\t\treturn getOrCreateField(this, key, this.flexSchema.getFieldSchema(key));\n\t\t}\n\t}\n\n\tpublic getBoxed(key: string): FlexTreeField {\n\t\tconst fieldKey: FieldKey = brand(key);\n\t\treturn getOrCreateField(this, fieldKey, this.flexSchema.getFieldSchema(fieldKey));\n\t}\n\n\tpublic boxedIterator(): IterableIterator<FlexTreeField> {\n\t\treturn mapIterable(this.mapTree.fields.entries(), ([key]) =>\n\t\t\tgetOrCreateField(this, key, this.flexSchema.getFieldSchema(key)),\n\t\t);\n\t}\n\n\tpublic keys(): IterableIterator<FieldKey> {\n\t\t// TODO: how this should handle missing defaults (and empty keys if they end up being allowed) needs to be determined.\n\t\treturn this.mapTree.fields.keys();\n\t}\n\n\tpublic get value(): Value {\n\t\treturn this.mapTree.value;\n\t}\n\n\tpublic get anchorNode(): AnchorNode {\n\t\t// This API is relevant to `LazyTreeNode`s, but not `MapTreeNode`s.\n\t\t// TODO: Refactor the FlexTreeNode interface so that stubbing this out isn't necessary.\n\t\treturn fail(\"MapTreeNode does not implement anchorNode\");\n\t}\n\n\tprivate walkTree(): void {\n\t\tfor (const [key, mapTrees] of this.mapTree.fields) {\n\t\t\tconst field = getOrCreateField(this, key, this.flexSchema.getFieldSchema(key));\n\t\t\tfor (let index = 0; index < field.length; index++) {\n\t\t\t\tconst child = getOrCreateChild(\n\t\t\t\t\tthis.context,\n\t\t\t\t\tmapTrees[index] ?? oob(),\n\t\t\t\t\tthis.flexSchema.getFieldSchema(key).allowedTypes,\n\t\t\t\t\t{ parent: field, index },\n\t\t\t\t);\n\t\t\t\t// These next asserts detect the case where `getOrCreateChild` gets a cache hit of a different node than the one we're trying to create\n\t\t\t\tassert(child.location !== undefined, 0x98d /* Expected node to have parent */);\n\t\t\t\tassert(\n\t\t\t\t\tchild.location.parent.parent === this,\n\t\t\t\t\t0x98e /* Node may not be multi-parented */,\n\t\t\t\t);\n\t\t\t\tassert(child.location.index === index, 0x98f /* Node may not be multi-parented */);\n\t\t\t\tchild.walkTree();\n\t\t\t}\n\t\t}\n\t}\n}\n\n// #endregion Nodes\n\n/**\n * Implementation of `FlexTreeContext`.\n *\n * @remarks An editor is required to edit the FlexTree.\n */\nexport class UnhydratedContext implements FlexTreeContext {\n\tpublic readonly schema: TreeStoredSchema;\n\n\t/**\n\t * @param flexSchema - Schema to use when working with the tree.\n\t */\n\tpublic constructor(public readonly flexSchema: FlexTreeSchema) {\n\t\tthis.schema = {\n\t\t\trootFieldSchema: flexSchema.rootFieldSchema.stored,\n\t\t\t...intoStoredSchemaCollection(flexSchema),\n\t\t};\n\t}\n\n\tpublic isHydrated(): this is FlexTreeHydratedContext {\n\t\treturn false;\n\t}\n}\n\n// #region Fields\n\n/**\n * A readonly {@link FlexTreeField} which wraps an array of {@link MapTrees}.\n * @remarks Reading data from the MapTreeField will read the corresponding data from the {@link MapTree}s.\n * Create a `MapTreeField` by calling {@link getOrCreateField}.\n */\ninterface MapTreeField extends FlexTreeField {\n\treadonly mapTrees: readonly MapTree[];\n}\n\nconst emptyContext = new UnhydratedContext({\n\tadapters: {},\n\tnodeSchema: new Map(),\n\tpolicy: defaultSchemaPolicy,\n\trootFieldSchema: FlexFieldSchema.empty,\n});\n\n/**\n * A special singleton that is the implicit {@link LocationInField} of all un-parented {@link EagerMapTreeNode}s.\n * @remarks This exists because {@link EagerMapTreeNode.parentField} must return a field.\n * If a {@link EagerMapTreeNode} is created without a parent, its {@link EagerMapTreeNode.parentField} property will point to this object.\n * However, this field cannot be used in any practical way because it is empty, i.e. it does not actually contain the children that claim to be parented under it.\n * It has the \"empty\" schema and it will always contain zero children if queried.\n * Any nodes with this location will have a dummy parent index of `-1`.\n */\nconst unparentedLocation: LocationInField = {\n\tparent: {\n\t\t[flexTreeMarker]: FlexTreeEntityKind.Field as const,\n\t\tlength: 0,\n\t\tkey: EmptyKey,\n\t\tparent: undefined,\n\t\tis<TKind2 extends FlexFieldKind>(kind: TKind2) {\n\t\t\treturn this.schema.kind === kind.identifier;\n\t\t},\n\t\tboxedIterator(): IterableIterator<FlexTreeNode> {\n\t\t\treturn [].values();\n\t\t},\n\t\tboxedAt(index: number): FlexTreeNode | undefined {\n\t\t\treturn undefined;\n\t\t},\n\t\tschema: FlexFieldSchema.empty.stored,\n\t\tcontext: emptyContext,\n\t\tmapTrees: [],\n\t\tgetFieldPath() {\n\t\t\tfail(\"unsupported\");\n\t\t},\n\t},\n\tindex: -1,\n};\n\nclass EagerMapTreeField implements MapTreeField {\n\tpublic [flexTreeMarker] = FlexTreeEntityKind.Field as const;\n\n\tpublic get schema(): TreeFieldStoredSchema {\n\t\treturn this.flexSchema.stored;\n\t}\n\n\tpublic constructor(\n\t\tpublic readonly context: UnhydratedContext,\n\t\tpublic readonly flexSchema: FlexFieldSchema,\n\t\tpublic readonly key: FieldKey,\n\t\tpublic readonly parent: EagerMapTreeNode,\n\t) {\n\t\tconst fieldKeyCache = getFieldKeyCache(parent);\n\t\tassert(!fieldKeyCache.has(key), 0x990 /* A field already exists for the given MapTrees */);\n\t\tfieldKeyCache.set(key, this);\n\n\t\t// When this field is created (which only happens one time, because it is cached), all the children become parented for the first time.\n\t\t// \"Adopt\" each child by updating its parent information to point to this field.\n\t\tfor (const [i, mapTree] of this.mapTrees.entries()) {\n\t\t\tconst mapTreeNodeChild = nodeCache.get(mapTree);\n\t\t\tif (mapTreeNodeChild !== undefined) {\n\t\t\t\tif (mapTreeNodeChild.parentField !== unparentedLocation) {\n\t\t\t\t\tthrow new UsageError(\"A node may not be in more than one place in the tree\");\n\t\t\t\t}\n\t\t\t\tmapTreeNodeChild.adoptBy(this, i);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic get mapTrees(): readonly ExclusiveMapTree[] {\n\t\treturn this.parent.mapTree.fields.get(this.key) ?? [];\n\t}\n\n\tpublic get length(): number {\n\t\treturn this.mapTrees.length;\n\t}\n\n\tpublic is<TKind2 extends FlexFieldKind>(kind: TKind2): this is FlexTreeTypedField<TKind2> {\n\t\treturn this.schema.kind === kind.identifier;\n\t}\n\n\tpublic boxedIterator(): IterableIterator<FlexTreeNode> {\n\t\treturn this.mapTrees\n\t\t\t.map(\n\t\t\t\t(m, index) =>\n\t\t\t\t\tgetOrCreateChild(this.context, m, this.flexSchema.allowedTypes, {\n\t\t\t\t\t\tparent: this,\n\t\t\t\t\t\tindex,\n\t\t\t\t\t}) as FlexTreeNode,\n\t\t\t)\n\t\t\t.values();\n\t}\n\n\tpublic boxedAt(index: number): FlexTreeNode | undefined {\n\t\tconst i = indexForAt(index, this.length);\n\t\tif (i === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst m = this.mapTrees[i];\n\t\tif (m !== undefined) {\n\t\t\treturn getOrCreateChild(this.context, m, this.flexSchema.allowedTypes, {\n\t\t\t\tparent: this,\n\t\t\t\tindex: i,\n\t\t\t}) as FlexTreeNode;\n\t\t}\n\t}\n\n\t/**\n\t * Mutate this field.\n\t * @param edit - A function which receives the current `MapTree`s that comprise the contents of the field so that it may be mutated.\n\t * The function may mutate the array in place or return a new array.\n\t * If a new array is returned then it will be used as the new contents of the field, otherwise the original array will be continue to be used.\n\t * @remarks All edits to the field (i.e. mutations of the field's MapTrees) should be directed through this function.\n\t * This function ensures that the parent MapTree has no empty fields (which is an invariant of `MapTree`) after the mutation.\n\t */\n\tprotected edit(edit: (mapTrees: ExclusiveMapTree[]) => void | ExclusiveMapTree[]): void {\n\t\tconst oldMapTrees = this.parent.mapTree.fields.get(this.key) ?? [];\n\t\tconst newMapTrees = edit(oldMapTrees) ?? oldMapTrees;\n\t\tif (newMapTrees.length > 0) {\n\t\t\tthis.parent.mapTree.fields.set(this.key, newMapTrees);\n\t\t} else {\n\t\t\tthis.parent.mapTree.fields.delete(this.key);\n\t\t}\n\t}\n\n\tpublic getFieldPath(): FieldUpPath {\n\t\tthrow unsupportedUsageError(\"Editing an array\");\n\t}\n}\n\nclass EagerMapTreeOptionalField extends EagerMapTreeField implements FlexTreeOptionalField {\n\tpublic readonly editor = {\n\t\tset: (newContent: ExclusiveMapTree | undefined): void => {\n\t\t\t// If the new content is a MapTreeNode, it needs to have its parent pointer updated\n\t\t\tif (newContent !== undefined) {\n\t\t\t\tnodeCache.get(newContent)?.adoptBy(this, 0);\n\t\t\t}\n\t\t\t// If the old content is a MapTreeNode, it needs to have its parent pointer unset\n\t\t\tconst oldContent = this.mapTrees[0];\n\t\t\tif (oldContent !== undefined) {\n\t\t\t\tnodeCache.get(oldContent)?.adoptBy(undefined);\n\t\t\t}\n\n\t\t\tthis.edit((mapTrees) => {\n\t\t\t\tif (newContent !== undefined) {\n\t\t\t\t\tmapTrees[0] = newContent;\n\t\t\t\t} else {\n\t\t\t\t\tmapTrees.length = 0;\n\t\t\t\t}\n\t\t\t});\n\t\t},\n\t};\n\n\tpublic get content(): FlexTreeUnknownUnboxed | undefined {\n\t\tconst value = this.mapTrees[0];\n\t\tif (value !== undefined) {\n\t\t\treturn unboxed(this.flexSchema, value, {\n\t\t\t\tparent: this,\n\t\t\t\tindex: 0,\n\t\t\t});\n\t\t}\n\n\t\treturn undefined;\n\t}\n}\n\nclass EagerMapTreeRequiredField\n\textends EagerMapTreeOptionalField\n\timplements FlexTreeRequiredField\n{\n\tpublic override get content(): FlexTreeUnknownUnboxed {\n\t\treturn super.content ?? fail(\"Expected EagerMapTree required field to have a value\");\n\t}\n}\n\nclass EagerMapTreeSequenceField extends EagerMapTreeField implements FlexTreeSequenceField {\n\tpublic readonly editor: MapTreeSequenceFieldEditBuilder = {\n\t\tinsert: (index, newContent): void => {\n\t\t\tfor (let i = 0; i < newContent.length; i++) {\n\t\t\t\tconst c = newContent[i];\n\t\t\t\tassert(c !== undefined, 0xa0a /* Unexpected sparse array content */);\n\t\t\t\tnodeCache.get(c)?.adoptBy(this, index + i);\n\t\t\t}\n\t\t\tthis.edit((mapTrees) => {\n\t\t\t\tif (newContent.length < 1000) {\n\t\t\t\t\t// For \"smallish arrays\" (`1000` is not empirically derived), the `splice` function is appropriate...\n\t\t\t\t\tmapTrees.splice(index, 0, ...newContent);\n\t\t\t\t} else {\n\t\t\t\t\t// ...but we avoid using `splice` + spread for very large input arrays since there is a limit on how many elements can be spread (too many will overflow the stack).\n\t\t\t\t\treturn mapTrees.slice(0, index).concat(newContent, mapTrees.slice(index));\n\t\t\t\t}\n\t\t\t});\n\t\t},\n\t\tremove: (index, count): ExclusiveMapTree[] => {\n\t\t\tfor (let i = index; i < index + count; i++) {\n\t\t\t\tconst c = this.mapTrees[i];\n\t\t\t\tassert(c !== undefined, 0xa0b /* Unexpected sparse array */);\n\t\t\t\tnodeCache.get(c)?.adoptBy(undefined);\n\t\t\t}\n\t\t\tlet removed: ExclusiveMapTree[] | undefined;\n\t\t\tthis.edit((mapTrees) => {\n\t\t\t\tremoved = mapTrees.splice(index, count);\n\t\t\t});\n\t\t\treturn removed ?? fail(\"Expected removed to be set by edit\");\n\t\t},\n\t};\n\n\tpublic at(index: number): FlexTreeUnknownUnboxed | undefined {\n\t\tconst i = indexForAt(index, this.length);\n\t\tif (i === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn unboxed(this.flexSchema, this.mapTrees[i] ?? oob(), { parent: this, index: i });\n\t}\n\tpublic map<U>(callbackfn: (value: FlexTreeUnknownUnboxed, index: number) => U): U[] {\n\t\treturn Array.from(this, callbackfn);\n\t}\n\n\tpublic *[Symbol.iterator](): IterableIterator<FlexTreeUnknownUnboxed> {\n\t\tfor (const [i, mapTree] of this.mapTrees.entries()) {\n\t\t\tyield unboxed(this.flexSchema, mapTree, { parent: this, index: i });\n\t\t}\n\t}\n}\n\n// #endregion Fields\n\n// #region Caching and unboxing utilities\n\nconst nodeCache = new WeakMap<MapTree, EagerMapTreeNode>();\n/** Node Parent -\\> Field Key -\\> Field */\nconst fieldCache = new WeakMap<MapTreeNode, Map<FieldKey, EagerMapTreeField>>();\nfunction getFieldKeyCache(parent: MapTreeNode): WeakMap<FieldKey, EagerMapTreeField> {\n\treturn getOrCreate(fieldCache, parent, () => new Map());\n}\n\n/**\n * If there exists a {@link EagerMapTreeNode} for the given {@link MapTree}, returns it, otherwise returns `undefined`.\n * @remarks {@link EagerMapTreeNode | MapTreeNodes} are created via {@link getOrCreateNode}.\n */\nexport function tryGetMapTreeNode(mapTree: MapTree): MapTreeNode | undefined {\n\treturn nodeCache.get(mapTree);\n}\n\n/**\n * Create a {@link EagerMapTreeNode} that wraps the given {@link MapTree}, or get the node that already exists for that {@link MapTree} if there is one.\n * @param nodeSchema - the {@link FlexTreeNodeSchema | schema} that the node conforms to\n * @param mapTree - the {@link MapTree} containing the data for this node.\n * @remarks It must conform to the `nodeSchema`.\n */\nexport function getOrCreateMapTreeNode(\n\tcontext: UnhydratedContext,\n\tnodeSchema: FlexTreeNodeSchema,\n\tmapTree: ExclusiveMapTree,\n): EagerMapTreeNode {\n\treturn nodeCache.get(mapTree) ?? createNode(context, nodeSchema, mapTree, undefined);\n}\n\n/** Helper for creating a `MapTreeNode` given the parent field (e.g. when \"walking down\") */\nfunction getOrCreateChild(\n\tcontext: UnhydratedContext,\n\tmapTree: ExclusiveMapTree,\n\tallowedTypes: FlexAllowedTypes,\n\tparent: LocationInField | undefined,\n): EagerMapTreeNode {\n\tconst cached = nodeCache.get(mapTree);\n\tif (cached !== undefined) {\n\t\treturn cached;\n\t}\n\n\tassert(isReadonlyArray(allowedTypes), 0xa25 /* invalid types */);\n\tconst nodeSchema =\n\t\tallowedTypes\n\t\t\t.map((t) => (isLazy(t) ? t() : t))\n\t\t\t.find((t): t is FlexTreeNodeSchema => {\n\t\t\t\treturn t.name === mapTree.type;\n\t\t\t}) ?? fail(\"Unsupported node schema\");\n\n\treturn createNode(context, nodeSchema, mapTree, parent);\n}\n\n/** Always constructs a new node, therefore may not be called twice for the same `MapTree`. */\nfunction createNode(\n\tcontext: UnhydratedContext,\n\tnodeSchema: FlexTreeNodeSchema,\n\tmapTree: ExclusiveMapTree,\n\tparentField: LocationInField | undefined,\n): EagerMapTreeNode {\n\treturn new EagerMapTreeNode(context, nodeSchema, mapTree, parentField);\n}\n\n/** Creates a field with the given attributes, or returns a cached field if there is one */\nfunction getOrCreateField(\n\tparent: EagerMapTreeNode,\n\tkey: FieldKey,\n\tschema: FlexFieldSchema,\n): EagerMapTreeField {\n\tconst cached = getFieldKeyCache(parent).get(key);\n\tif (cached !== undefined) {\n\t\treturn cached;\n\t}\n\n\tif (\n\t\tschema.kind.identifier === FieldKinds.required.identifier ||\n\t\tschema.kind.identifier === FieldKinds.identifier.identifier\n\t) {\n\t\treturn new EagerMapTreeRequiredField(parent.context, schema, key, parent);\n\t}\n\n\tif (schema.kind.identifier === FieldKinds.optional.identifier) {\n\t\treturn new EagerMapTreeOptionalField(parent.context, schema, key, parent);\n\t}\n\n\tif (schema.kind.identifier === FieldKinds.sequence.identifier) {\n\t\treturn new EagerMapTreeSequenceField(parent.context, schema, key, parent);\n\t}\n\n\treturn new EagerMapTreeField(parent.context, schema, key, parent);\n}\n\n/** Unboxes leaf nodes to their values */\nfunction unboxed(\n\tschema: FlexFieldSchema,\n\tmapTree: ExclusiveMapTree,\n\tparent: LocationInField,\n): FlexTreeUnknownUnboxed {\n\tconst value = mapTree.value;\n\tif (value !== undefined) {\n\t\treturn value;\n\t}\n\n\treturn getOrCreateChild(parent.parent.context, mapTree, schema.allowedTypes, parent);\n}\n\n// #endregion Caching and unboxing utilities\n\nexport function unsupportedUsageError(message?: string): Error {\n\treturn new UsageError(\n\t\t`${\n\t\t\tmessage ?? \"Operation\"\n\t\t} is not supported for content that has not yet been inserted into the tree`,\n\t);\n}\n"]}
@@ -1,17 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- import { type TreeFieldStoredSchema, type TreeNodeSchemaIdentifier, type TreeStoredSchema } from "../core/index.js";
6
- import { FlexFieldSchema, type FlexTreeNodeSchema, type FlexTreeSchema } from "./typed-schema/index.js";
7
- /**
8
- * Creates a new view schema using the stored schema.
9
- * @remarks
10
- * This is really only suitable for use with code that happens to need access to things which require a view schema, but isn't actually schema aware.
11
- * If the input schema came from a view schema, it will not return the same view schema, and will not be compatible:
12
- * the returned TreeSchema is simply one which schematize will not object to.
13
- * Assumes the schema uses the default field kinds.
14
- */
15
- export declare function treeSchemaFromStoredSchema(schema: TreeStoredSchema): FlexTreeSchema;
16
- export declare function fieldSchemaFromStoredSchema(schema: TreeFieldStoredSchema, map: ReadonlyMap<TreeNodeSchemaIdentifier, FlexTreeNodeSchema>): FlexFieldSchema;
17
- //# sourceMappingURL=storedToViewSchema.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"storedToViewSchema.d.ts","sourceRoot":"","sources":["../../src/feature-libraries/storedToViewSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAIN,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,EAC7B,KAAK,gBAAgB,EACrB,MAAM,kBAAkB,CAAC;AAI1B,OAAO,EAEN,eAAe,EAIf,KAAK,kBAAkB,EACvB,KAAK,cAAc,EAEnB,MAAM,yBAAyB,CAAC;AAEjC;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,gBAAgB,GAAG,cAAc,CAoCnF;AAgBD,wBAAgB,2BAA2B,CAC1C,MAAM,EAAE,qBAAqB,EAC7B,GAAG,EAAE,WAAW,CAAC,wBAAwB,EAAE,kBAAkB,CAAC,GAC5D,eAAe,CAOjB"}
@@ -1,62 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- import { assert } from "@fluidframework/core-utils/internal";
6
- import { LeafNodeStoredSchema, MapNodeStoredSchema, ObjectNodeStoredSchema, } from "../core/index.js";
7
- import { fail } from "../util/index.js";
8
- import { defaultSchemaPolicy } from "./default-schema/index.js";
9
- import { FlexFieldSchema, FlexMapNodeSchema, FlexObjectNodeSchema, LeafNodeSchema, } from "./typed-schema/index.js";
10
- /**
11
- * Creates a new view schema using the stored schema.
12
- * @remarks
13
- * This is really only suitable for use with code that happens to need access to things which require a view schema, but isn't actually schema aware.
14
- * If the input schema came from a view schema, it will not return the same view schema, and will not be compatible:
15
- * the returned TreeSchema is simply one which schematize will not object to.
16
- * Assumes the schema uses the default field kinds.
17
- */
18
- export function treeSchemaFromStoredSchema(schema) {
19
- const map = new Map();
20
- for (const [identifier, innerSchema] of schema.nodeSchema) {
21
- if (innerSchema instanceof LeafNodeStoredSchema) {
22
- map.set(identifier, new LeafNodeSchema({ name: "intoTypedSchema" }, identifier, innerSchema.leafValue));
23
- }
24
- else if (innerSchema instanceof MapNodeStoredSchema) {
25
- map.set(identifier, FlexMapNodeSchema.create({ name: "intoTypedSchema" }, identifier, fieldSchemaFromStoredSchema(innerSchema.mapFields, map)));
26
- }
27
- else {
28
- assert(innerSchema instanceof ObjectNodeStoredSchema, 0x882 /* unsupported node kind */);
29
- const fields = new Map();
30
- for (const [key, field] of innerSchema.objectNodeFields) {
31
- fields.set(key, fieldSchemaFromStoredSchema(field, map));
32
- }
33
- const fieldsObject = mapToObject(fields);
34
- map.set(identifier, FlexObjectNodeSchema.create({ name: "intoTypedSchema" }, identifier, fieldsObject));
35
- }
36
- }
37
- return {
38
- adapters: {},
39
- policy: defaultSchemaPolicy,
40
- rootFieldSchema: fieldSchemaFromStoredSchema(schema.rootFieldSchema, map),
41
- nodeSchema: map,
42
- };
43
- }
44
- function mapToObject(map) {
45
- const objectMap = Object.create(null);
46
- for (const [key, value] of map.entries()) {
47
- // This code has to be careful to avoid assigned to __proto__ or similar built in fields.
48
- Object.defineProperty(objectMap, key, {
49
- enumerable: true,
50
- configurable: false,
51
- writable: false,
52
- value,
53
- });
54
- }
55
- return objectMap;
56
- }
57
- export function fieldSchemaFromStoredSchema(schema, map) {
58
- const kind = defaultSchemaPolicy.fieldKinds.get(schema.kind) ?? fail("missing field kind");
59
- const types = Array.from(schema.types, (v) => () => map.get(v) ?? fail("missing schema"));
60
- return FlexFieldSchema.create(kind, types);
61
- }
62
- //# sourceMappingURL=storedToViewSchema.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"storedToViewSchema.js","sourceRoot":"","sources":["../../src/feature-libraries/storedToViewSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAE7D,OAAO,EACN,oBAAoB,EACpB,mBAAmB,EACnB,sBAAsB,GAItB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAEN,eAAe,EAEf,iBAAiB,EACjB,oBAAoB,EAGpB,cAAc,GACd,MAAM,yBAAyB,CAAC;AAEjC;;;;;;;GAOG;AACH,MAAM,UAAU,0BAA0B,CAAC,MAAwB;IAClE,MAAM,GAAG,GAAsD,IAAI,GAAG,EAAE,CAAC;IACzE,KAAK,MAAM,CAAC,UAAU,EAAE,WAAW,CAAC,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;QAC3D,IAAI,WAAW,YAAY,oBAAoB,EAAE,CAAC;YACjD,GAAG,CAAC,GAAG,CACN,UAAU,EACV,IAAI,cAAc,CAAC,EAAE,IAAI,EAAE,iBAAiB,EAAE,EAAE,UAAU,EAAE,WAAW,CAAC,SAAS,CAAC,CAClF,CAAC;QACH,CAAC;aAAM,IAAI,WAAW,YAAY,mBAAmB,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KAAK;YACnB,QAAQ,EAAE,KAAK;YACf,KAAK;SACL,CAAC,CAAC;IACJ,CAAC;IACD,OAAO,SAAS,CAAC;AAClB,CAAC;AAED,MAAM,UAAU,2BAA2B,CAC1C,MAA6B,EAC7B,GAA8D;IAE9D,MAAM,IAAI,GAAG,mBAAmB,CAAC,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,oBAAoB,CAAC,CAAC;IAC3F,MAAM,KAAK,GAAqB,KAAK,CAAC,IAAI,CACzC,MAAM,CAAC,KAAK,EACZ,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,gBAAgB,CAAC,CACjD,CAAC;IACF,OAAO,eAAe,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AAC5C,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\tLeafNodeStoredSchema,\n\tMapNodeStoredSchema,\n\tObjectNodeStoredSchema,\n\ttype TreeFieldStoredSchema,\n\ttype TreeNodeSchemaIdentifier,\n\ttype TreeStoredSchema,\n} from \"../core/index.js\";\nimport { fail } from \"../util/index.js\";\n\nimport { defaultSchemaPolicy } from \"./default-schema/index.js\";\nimport {\n\ttype FlexAllowedTypes,\n\tFlexFieldSchema,\n\ttype FlexMapFieldSchema,\n\tFlexMapNodeSchema,\n\tFlexObjectNodeSchema,\n\ttype FlexTreeNodeSchema,\n\ttype FlexTreeSchema,\n\tLeafNodeSchema,\n} from \"./typed-schema/index.js\";\n\n/**\n * Creates a new view schema using the stored schema.\n * @remarks\n * This is really only suitable for use with code that happens to need access to things which require a view schema, but isn't actually schema aware.\n * If the input schema came from a view schema, it will not return the same view schema, and will not be compatible:\n * the returned TreeSchema is simply one which schematize will not object to.\n * Assumes the schema uses the default field kinds.\n */\nexport function treeSchemaFromStoredSchema(schema: TreeStoredSchema): FlexTreeSchema {\n\tconst map: Map<TreeNodeSchemaIdentifier, FlexTreeNodeSchema> = new Map();\n\tfor (const [identifier, innerSchema] of schema.nodeSchema) {\n\t\tif (innerSchema instanceof LeafNodeStoredSchema) {\n\t\t\tmap.set(\n\t\t\t\tidentifier,\n\t\t\t\tnew LeafNodeSchema({ name: \"intoTypedSchema\" }, identifier, innerSchema.leafValue),\n\t\t\t);\n\t\t} else if (innerSchema instanceof MapNodeStoredSchema) {\n\t\t\tmap.set(\n\t\t\t\tidentifier,\n\t\t\t\tFlexMapNodeSchema.create(\n\t\t\t\t\t{ name: \"intoTypedSchema\" },\n\t\t\t\t\tidentifier,\n\t\t\t\t\tfieldSchemaFromStoredSchema(innerSchema.mapFields, map) as FlexMapFieldSchema,\n\t\t\t\t),\n\t\t\t);\n\t\t} else {\n\t\t\tassert(innerSchema instanceof ObjectNodeStoredSchema, 0x882 /* unsupported node kind */);\n\t\t\tconst fields = new Map<string, FlexFieldSchema>();\n\t\t\tfor (const [key, field] of innerSchema.objectNodeFields) {\n\t\t\t\tfields.set(key, fieldSchemaFromStoredSchema(field, map));\n\t\t\t}\n\t\t\tconst fieldsObject = mapToObject(fields);\n\t\t\tmap.set(\n\t\t\t\tidentifier,\n\t\t\t\tFlexObjectNodeSchema.create({ name: \"intoTypedSchema\" }, identifier, fieldsObject),\n\t\t\t);\n\t\t}\n\t}\n\treturn {\n\t\tadapters: {},\n\t\tpolicy: defaultSchemaPolicy,\n\t\trootFieldSchema: fieldSchemaFromStoredSchema(schema.rootFieldSchema, map),\n\t\tnodeSchema: map,\n\t};\n}\n\nfunction mapToObject<MapValue>(map: Map<string, MapValue>): Record<string, MapValue> {\n\tconst objectMap: Record<string, MapValue> = Object.create(null);\n\tfor (const [key, value] of map.entries()) {\n\t\t// This code has to be careful to avoid assigned to __proto__ or similar built in fields.\n\t\tObject.defineProperty(objectMap, key, {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: false,\n\t\t\twritable: false,\n\t\t\tvalue,\n\t\t});\n\t}\n\treturn objectMap;\n}\n\nexport function fieldSchemaFromStoredSchema(\n\tschema: TreeFieldStoredSchema,\n\tmap: ReadonlyMap<TreeNodeSchemaIdentifier, FlexTreeNodeSchema>,\n): FlexFieldSchema {\n\tconst kind = defaultSchemaPolicy.fieldKinds.get(schema.kind) ?? fail(\"missing field kind\");\n\tconst types: FlexAllowedTypes = Array.from(\n\t\tschema.types,\n\t\t(v) => () => map.get(v) ?? fail(\"missing schema\"),\n\t);\n\treturn FlexFieldSchema.create(kind, types);\n}\n"]}
@@ -1,58 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- import { type Adapters, type TreeAdapter } from "../../core/index.js";
6
- import { type FlexFieldSchema, type SchemaCollection } from "./typedTreeSchema.js";
7
- import type { Sourced } from "./view.js";
8
- /**
9
- * Schema data collected by a single SchemaBuilder (does not include referenced libraries).
10
- * @internal
11
- */
12
- export interface SchemaLibraryData extends SchemaCollection {
13
- readonly name: string;
14
- readonly adapters: Adapters;
15
- }
16
- /**
17
- * Mutable adapter collection which records the associated factory.
18
- * See {@link Adapters}.
19
- */
20
- export interface SourcedAdapters {
21
- readonly tree: (Sourced & TreeAdapter)[];
22
- }
23
- /**
24
- * Allows opting into and out of errors for some unusual schema patterns which are usually bugs.
25
- * @internal
26
- */
27
- export interface SchemaLintConfiguration {
28
- readonly rejectForbidden: boolean;
29
- readonly rejectEmpty: boolean;
30
- }
31
- export declare const schemaLintDefault: SchemaLintConfiguration;
32
- /**
33
- * Build and validate a SchemaCollection.
34
- *
35
- * As much as possible tries to detect anything that might be a mistake made by the schema author.
36
- * This will error on some valid but probably never intended to be used patterns
37
- * (like libraries with the same name, nodes which are impossible to create etc).
38
- *
39
- * @param name - Name of the resulting library.
40
- * @param lintConfiguration - configuration for what errors to generate.
41
- * @param libraries - Data to aggregate into the SchemaCollection.
42
- * @param rootFieldSchema - Only validated: not included in the result.
43
- *
44
- * @privateRemarks
45
- * This checks that input works with defaultSchemaPolicy.
46
- * If support fo other policies is added, this will need to take in the policy.
47
- */
48
- export declare function aggregateSchemaLibraries(name: string, lintConfiguration: SchemaLintConfiguration, libraries: Iterable<SchemaLibraryData>, rootFieldSchema?: FlexFieldSchema): SchemaLibraryData;
49
- /**
50
- * Returns an array of descriptions of errors in the collection.
51
- *
52
- * As much as possible tries to detect anything that might be a mistake made by the schema author.
53
- * This will error on some valid but probably never intended to be used patterns (like never nodes).
54
- */
55
- export declare function validateSchemaCollection(lintConfiguration: SchemaLintConfiguration, collection: SchemaCollection, rootFieldSchema?: FlexFieldSchema): string[];
56
- export declare function validateRootField(lintConfiguration: SchemaLintConfiguration, collection: SchemaCollection, field: FlexFieldSchema, errors: string[]): void;
57
- export declare function validateField(lintConfiguration: SchemaLintConfiguration, collection: SchemaCollection, field: FlexFieldSchema, describeField: () => string, errors: string[]): void;
58
- //# sourceMappingURL=schemaCollection.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schemaCollection.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/typed-schema/schemaCollection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EACN,KAAK,QAAQ,EACb,KAAK,WAAW,EAGhB,MAAM,qBAAqB,CAAC;AAK7B,OAAO,EACN,KAAK,eAAe,EAKpB,KAAK,gBAAgB,EACrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIzC;;;GAGG;AACH,MAAM,WAAW,iBAAkB,SAAQ,gBAAgB;IAC1D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;CAC5B;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC/B,QAAQ,CAAC,IAAI,EAAE,CAAC,OAAO,GAAG,WAAW,CAAC,EAAE,CAAC;CACzC;AAMD;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACvC,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC;IAClC,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;CAC9B;AAED,eAAO,MAAM,iBAAiB,EAAE,uBAG/B,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,wBAAwB,CACvC,IAAI,EAAE,MAAM,EACZ,iBAAiB,EAAE,uBAAuB,EAC1C,SAAS,EAAE,QAAQ,CAAC,iBAAiB,CAAC,EACtC,eAAe,CAAC,EAAE,eAAe,GAC/B,iBAAiB,CAuDnB;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACvC,iBAAiB,EAAE,uBAAuB,EAC1C,UAAU,EAAE,gBAAgB,EAC5B,eAAe,CAAC,EAAE,eAAe,GAC/B,MAAM,EAAE,CA0CV;AAED,wBAAgB,iBAAiB,CAChC,iBAAiB,EAAE,uBAAuB,EAC1C,UAAU,EAAE,gBAAgB,EAC5B,KAAK,EAAE,eAAe,EACtB,MAAM,EAAE,MAAM,EAAE,GACd,IAAI,CAGN;AAED,wBAAgB,aAAa,CAC5B,iBAAiB,EAAE,uBAAuB,EAC1C,UAAU,EAAE,gBAAgB,EAC5B,KAAK,EAAE,eAAe,EACtB,aAAa,EAAE,MAAM,MAAM,EAC3B,MAAM,EAAE,MAAM,EAAE,GACd,IAAI,CAyCN"}
@@ -1,153 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- import { assert } from "@fluidframework/core-utils/internal";
6
- import { Multiplicity, } from "../../core/index.js";
7
- import { fail } from "../../util/index.js";
8
- import { FieldKinds, defaultSchemaPolicy } from "../default-schema/index.js";
9
- import { normalizeFlexListEager } from "./flexList.js";
10
- import { FlexMapNodeSchema, FlexObjectNodeSchema, LeafNodeSchema, } from "./typedTreeSchema.js";
11
- {
12
- }
13
- export const schemaLintDefault = {
14
- rejectForbidden: true,
15
- rejectEmpty: true,
16
- };
17
- /**
18
- * Build and validate a SchemaCollection.
19
- *
20
- * As much as possible tries to detect anything that might be a mistake made by the schema author.
21
- * This will error on some valid but probably never intended to be used patterns
22
- * (like libraries with the same name, nodes which are impossible to create etc).
23
- *
24
- * @param name - Name of the resulting library.
25
- * @param lintConfiguration - configuration for what errors to generate.
26
- * @param libraries - Data to aggregate into the SchemaCollection.
27
- * @param rootFieldSchema - Only validated: not included in the result.
28
- *
29
- * @privateRemarks
30
- * This checks that input works with defaultSchemaPolicy.
31
- * If support fo other policies is added, this will need to take in the policy.
32
- */
33
- export function aggregateSchemaLibraries(name, lintConfiguration, libraries, rootFieldSchema) {
34
- const nodeSchema = new Map();
35
- const adapters = { tree: [] };
36
- const errors = [];
37
- const librarySet = new Set();
38
- const libraryNames = new Set();
39
- for (const library of libraries) {
40
- if (librarySet.has(library)) {
41
- // SchemaBuilder should ensure this doesn't happen, but include it here for completeness.
42
- errors.push(`Duplicate library named "${library.name}"`);
43
- continue;
44
- }
45
- librarySet.add(library);
46
- if (libraryNames.has(library.name)) {
47
- // This wouldn't break anything, but could make error messages confusing, so its better to avoid duplicates.
48
- errors.push(`Found another library with name "${library.name}"`);
49
- }
50
- for (const [key, tree] of library.nodeSchema) {
51
- // This check is an assert since if it fails, the other error messages would be incorrect.
52
- assert(tree.builder.name === library.name, 0x6a9 /* tree must be part by the library its in */);
53
- const existing = nodeSchema.get(key);
54
- if (existing !== undefined) {
55
- errors.push(`Multiple tree schema for identifier "${key}". One from library "${existing.builder.name}" and one from "${tree.builder.name}"`);
56
- }
57
- else {
58
- nodeSchema.set(key, tree);
59
- }
60
- }
61
- for (const _adapter of library.adapters.tree ?? []) {
62
- fail("Adapters not yet supported");
63
- }
64
- }
65
- if (errors.length !== 0) {
66
- fail(errors.join("\n"));
67
- }
68
- const result = { rootFieldSchema, nodeSchema, adapters, policy: defaultSchemaPolicy };
69
- const errors2 = validateSchemaCollection(lintConfiguration, result, rootFieldSchema);
70
- if (errors2.length !== 0) {
71
- fail(errors2.join("\n"));
72
- }
73
- return {
74
- name,
75
- nodeSchema,
76
- adapters,
77
- };
78
- }
79
- /**
80
- * Returns an array of descriptions of errors in the collection.
81
- *
82
- * As much as possible tries to detect anything that might be a mistake made by the schema author.
83
- * This will error on some valid but probably never intended to be used patterns (like never nodes).
84
- */
85
- export function validateSchemaCollection(lintConfiguration, collection, rootFieldSchema) {
86
- const errors = [];
87
- // TODO: make this check specific to document schema. Replace check here for no tre or field schema (empty library).
88
- if (collection.nodeSchema.size === 0 && lintConfiguration.rejectEmpty) {
89
- errors.push("No tree schema are included, meaning no data can possibly be stored.");
90
- }
91
- // Validate that all schema referenced are included, and none are "never".
92
- if (rootFieldSchema !== undefined) {
93
- validateRootField(lintConfiguration, collection, rootFieldSchema, errors);
94
- }
95
- for (const [identifier, tree] of collection.nodeSchema) {
96
- if (tree instanceof FlexMapNodeSchema) {
97
- validateField(lintConfiguration, collection, tree.info, () => `Map fields of "${identifier}" schema from library "${tree.builder.name}"`, errors);
98
- if (tree.info.kind.multiplicity === Multiplicity.Single) {
99
- errors.push(`Map fields of "${identifier}" schema from library "${tree.builder.name}" has kind with multiplicity "Single". This is invalid since it requires all possible field keys to have a value under them.`);
100
- }
101
- }
102
- else if (tree instanceof LeafNodeSchema) {
103
- // No validation for now.
104
- }
105
- else if (tree instanceof FlexObjectNodeSchema) {
106
- for (const [key, field] of tree.objectNodeFields) {
107
- const description = () => `Object node field "${key}" of "${identifier}" schema from library "${tree.builder.name}"`;
108
- validateField(lintConfiguration, collection, field, description, errors);
109
- }
110
- }
111
- else {
112
- // TODO: there should be a common fallback that works for cases without a specialized implementation.
113
- fail("unrecognized node kind");
114
- }
115
- }
116
- // TODO: validate adapters
117
- return errors;
118
- }
119
- export function validateRootField(lintConfiguration, collection, field, errors) {
120
- const describeField = () => `Root field schema`;
121
- validateField(lintConfiguration, collection, field, describeField, errors);
122
- }
123
- export function validateField(lintConfiguration, collection, field, describeField, errors) {
124
- const types = field.allowedTypes;
125
- const normalizedTypes = normalizeFlexListEager(types);
126
- for (const type of normalizedTypes) {
127
- const referenced = collection.nodeSchema.get(type.name);
128
- if (referenced === undefined) {
129
- errors.push(`${describeField()} references type "${type.name}" from library "${type.builder.name}" which is not defined. Perhaps another type was intended, or that library needs to be added.`);
130
- }
131
- }
132
- if (types.length === 0 && lintConfiguration.rejectEmpty) {
133
- errors.push(`${describeField()} requires children to have a type from a set of zero types. This means the field must always be empty.`);
134
- }
135
- const kind = field.kind;
136
- const kindFromPolicy = defaultSchemaPolicy.fieldKinds.get(kind.identifier);
137
- if (kindFromPolicy === undefined) {
138
- errors.push(`"${describeField()}" has unknown field kind "${kind.identifier}".`);
139
- }
140
- else if (kindFromPolicy !== kind) {
141
- errors.push(`${describeField()} has field kind "${kind.identifier}" which isn't a reference to the default kind with that identifier.`);
142
- }
143
- else if (kind === FieldKinds.forbidden) {
144
- if (lintConfiguration.rejectForbidden) {
145
- errors.push(`${describeField()} explicitly uses "forbidden" kind, which is not recommended.`);
146
- }
147
- } // else if (kind !== counter) {
148
- // errors.push(
149
- // `${describeField()} explicitly uses "counter" kind, which is finished.`,
150
- // );
151
- // }
152
- }
153
- //# sourceMappingURL=schemaCollection.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schemaCollection.js","sourceRoot":"","sources":["../../../src/feature-libraries/typed-schema/schemaCollection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAE7D,OAAO,EAIN,YAAY,GACZ,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,IAAI,EAA4B,MAAM,qBAAqB,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAE7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAEN,iBAAiB,EACjB,oBA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CAAC,CAAC;IAClF,CAAC;SAAM,IAAI,cAAc,KAAK,IAAI,EAAE,CAAC;QACpC,MAAM,CAAC,IAAI,CACV,GAAG,aAAa,EAAE,oBACjB,IAAI,CAAC,UACN,qEAAqE,CACrE,CAAC;IACH,CAAC;SAAM,IAAI,IAAI,KAAK,UAAU,CAAC,SAAS,EAAE,CAAC;QAC1C,IAAI,iBAAiB,CAAC,eAAe,EAAE,CAAC;YACvC,MAAM,CAAC,IAAI,CACV,GAAG,aAAa,EAAE,8DAA8D,CAChF,CAAC;QACH,CAAC;IACF,CAAC,CAAC,+BAA+B;IACjC,gBAAgB;IAChB,6EAA6E;IAC7E,MAAM;IACN,IAAI;AACL,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\ttype Adapters,\n\ttype TreeAdapter,\n\ttype TreeNodeSchemaIdentifier,\n\tMultiplicity,\n} from \"../../core/index.js\";\nimport { fail, type requireAssignableTo } from \"../../util/index.js\";\nimport { FieldKinds, defaultSchemaPolicy } from \"../default-schema/index.js\";\n\nimport { normalizeFlexListEager } from \"./flexList.js\";\nimport {\n\ttype FlexFieldSchema,\n\tFlexMapNodeSchema,\n\tFlexObjectNodeSchema,\n\ttype FlexTreeNodeSchema,\n\tLeafNodeSchema,\n\ttype SchemaCollection,\n} from \"./typedTreeSchema.js\";\nimport type { Sourced } from \"./view.js\";\n\n// TODO: tests for this file\n\n/**\n * Schema data collected by a single SchemaBuilder (does not include referenced libraries).\n * @internal\n */\nexport interface SchemaLibraryData extends SchemaCollection {\n\treadonly name: string;\n\treadonly adapters: Adapters;\n}\n\n/**\n * Mutable adapter collection which records the associated factory.\n * See {@link Adapters}.\n */\nexport interface SourcedAdapters {\n\treadonly tree: (Sourced & TreeAdapter)[];\n}\n\n{\n\ttype _check = requireAssignableTo<SourcedAdapters, Adapters>;\n}\n\n/**\n * Allows opting into and out of errors for some unusual schema patterns which are usually bugs.\n * @internal\n */\nexport interface SchemaLintConfiguration {\n\treadonly rejectForbidden: boolean;\n\treadonly rejectEmpty: boolean;\n}\n\nexport const schemaLintDefault: SchemaLintConfiguration = {\n\trejectForbidden: true,\n\trejectEmpty: true,\n};\n\n/**\n * Build and validate a SchemaCollection.\n *\n * As much as possible tries to detect anything that might be a mistake made by the schema author.\n * This will error on some valid but probably never intended to be used patterns\n * (like libraries with the same name, nodes which are impossible to create etc).\n *\n * @param name - Name of the resulting library.\n * @param lintConfiguration - configuration for what errors to generate.\n * @param libraries - Data to aggregate into the SchemaCollection.\n * @param rootFieldSchema - Only validated: not included in the result.\n *\n * @privateRemarks\n * This checks that input works with defaultSchemaPolicy.\n * If support fo other policies is added, this will need to take in the policy.\n */\nexport function aggregateSchemaLibraries(\n\tname: string,\n\tlintConfiguration: SchemaLintConfiguration,\n\tlibraries: Iterable<SchemaLibraryData>,\n\trootFieldSchema?: FlexFieldSchema,\n): SchemaLibraryData {\n\tconst nodeSchema: Map<TreeNodeSchemaIdentifier, FlexTreeNodeSchema> = new Map();\n\tconst adapters: SourcedAdapters = { tree: [] };\n\n\tconst errors: string[] = [];\n\tconst librarySet: Set<SchemaLibraryData> = new Set();\n\tconst libraryNames: Set<string> = new Set();\n\n\tfor (const library of libraries) {\n\t\tif (librarySet.has(library)) {\n\t\t\t// SchemaBuilder should ensure this doesn't happen, but include it here for completeness.\n\t\t\terrors.push(`Duplicate library named \"${library.name}\"`);\n\t\t\tcontinue;\n\t\t}\n\t\tlibrarySet.add(library);\n\t\tif (libraryNames.has(library.name)) {\n\t\t\t// This wouldn't break anything, but could make error messages confusing, so its better to avoid duplicates.\n\t\t\terrors.push(`Found another library with name \"${library.name}\"`);\n\t\t}\n\n\t\tfor (const [key, tree] of library.nodeSchema) {\n\t\t\t// This check is an assert since if it fails, the other error messages would be incorrect.\n\t\t\tassert(\n\t\t\t\ttree.builder.name === library.name,\n\t\t\t\t0x6a9 /* tree must be part by the library its in */,\n\t\t\t);\n\t\t\tconst existing = nodeSchema.get(key);\n\t\t\tif (existing !== undefined) {\n\t\t\t\terrors.push(\n\t\t\t\t\t`Multiple tree schema for identifier \"${key}\". One from library \"${existing.builder.name}\" and one from \"${tree.builder.name}\"`,\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tnodeSchema.set(key, tree);\n\t\t\t}\n\t\t}\n\t\tfor (const _adapter of library.adapters.tree ?? []) {\n\t\t\tfail(\"Adapters not yet supported\");\n\t\t}\n\t}\n\n\tif (errors.length !== 0) {\n\t\tfail(errors.join(\"\\n\"));\n\t}\n\n\tconst result = { rootFieldSchema, nodeSchema, adapters, policy: defaultSchemaPolicy };\n\tconst errors2 = validateSchemaCollection(lintConfiguration, result, rootFieldSchema);\n\tif (errors2.length !== 0) {\n\t\tfail(errors2.join(\"\\n\"));\n\t}\n\n\treturn {\n\t\tname,\n\t\tnodeSchema,\n\t\tadapters,\n\t};\n}\n\n/**\n * Returns an array of descriptions of errors in the collection.\n *\n * As much as possible tries to detect anything that might be a mistake made by the schema author.\n * This will error on some valid but probably never intended to be used patterns (like never nodes).\n */\nexport function validateSchemaCollection(\n\tlintConfiguration: SchemaLintConfiguration,\n\tcollection: SchemaCollection,\n\trootFieldSchema?: FlexFieldSchema,\n): string[] {\n\tconst errors: string[] = [];\n\n\t// TODO: make this check specific to document schema. Replace check here for no tre or field schema (empty library).\n\tif (collection.nodeSchema.size === 0 && lintConfiguration.rejectEmpty) {\n\t\terrors.push(\"No tree schema are included, meaning no data can possibly be stored.\");\n\t}\n\n\t// Validate that all schema referenced are included, and none are \"never\".\n\tif (rootFieldSchema !== undefined) {\n\t\tvalidateRootField(lintConfiguration, collection, rootFieldSchema, errors);\n\t}\n\tfor (const [identifier, tree] of collection.nodeSchema) {\n\t\tif (tree instanceof FlexMapNodeSchema) {\n\t\t\tvalidateField(\n\t\t\t\tlintConfiguration,\n\t\t\t\tcollection,\n\t\t\t\ttree.info as FlexFieldSchema,\n\t\t\t\t() => `Map fields of \"${identifier}\" schema from library \"${tree.builder.name}\"`,\n\t\t\t\terrors,\n\t\t\t);\n\t\t\tif ((tree.info as FlexFieldSchema).kind.multiplicity === Multiplicity.Single) {\n\t\t\t\terrors.push(\n\t\t\t\t\t`Map fields of \"${identifier}\" schema from library \"${tree.builder.name}\" has kind with multiplicity \"Single\". This is invalid since it requires all possible field keys to have a value under them.`,\n\t\t\t\t);\n\t\t\t}\n\t\t} else if (tree instanceof LeafNodeSchema) {\n\t\t\t// No validation for now.\n\t\t} else if (tree instanceof FlexObjectNodeSchema) {\n\t\t\tfor (const [key, field] of tree.objectNodeFields) {\n\t\t\t\tconst description = (): string =>\n\t\t\t\t\t`Object node field \"${key}\" of \"${identifier}\" schema from library \"${tree.builder.name}\"`;\n\t\t\t\tvalidateField(lintConfiguration, collection, field, description, errors);\n\t\t\t}\n\t\t} else {\n\t\t\t// TODO: there should be a common fallback that works for cases without a specialized implementation.\n\t\t\tfail(\"unrecognized node kind\");\n\t\t}\n\t}\n\n\t// TODO: validate adapters\n\treturn errors;\n}\n\nexport function validateRootField(\n\tlintConfiguration: SchemaLintConfiguration,\n\tcollection: SchemaCollection,\n\tfield: FlexFieldSchema,\n\terrors: string[],\n): void {\n\tconst describeField = (): string => `Root field schema`;\n\tvalidateField(lintConfiguration, collection, field, describeField, errors);\n}\n\nexport function validateField(\n\tlintConfiguration: SchemaLintConfiguration,\n\tcollection: SchemaCollection,\n\tfield: FlexFieldSchema,\n\tdescribeField: () => string,\n\terrors: string[],\n): void {\n\tconst types = field.allowedTypes;\n\n\tconst normalizedTypes = normalizeFlexListEager(types);\n\tfor (const type of normalizedTypes) {\n\t\tconst referenced = collection.nodeSchema.get(type.name);\n\t\tif (referenced === undefined) {\n\t\t\terrors.push(\n\t\t\t\t`${describeField()} references type \"${type.name}\" from library \"${\n\t\t\t\t\ttype.builder.name\n\t\t\t\t}\" which is not defined. Perhaps another type was intended, or that library needs to be added.`,\n\t\t\t);\n\t\t}\n\t}\n\tif (types.length === 0 && lintConfiguration.rejectEmpty) {\n\t\terrors.push(\n\t\t\t`${describeField()} requires children to have a type from a set of zero types. This means the field must always be empty.`,\n\t\t);\n\t}\n\n\tconst kind = field.kind;\n\tconst kindFromPolicy = defaultSchemaPolicy.fieldKinds.get(kind.identifier);\n\tif (kindFromPolicy === undefined) {\n\t\terrors.push(`\"${describeField()}\" has unknown field kind \"${kind.identifier}\".`);\n\t} else if (kindFromPolicy !== kind) {\n\t\terrors.push(\n\t\t\t`${describeField()} has field kind \"${\n\t\t\t\tkind.identifier\n\t\t\t}\" which isn't a reference to the default kind with that identifier.`,\n\t\t);\n\t} else if (kind === FieldKinds.forbidden) {\n\t\tif (lintConfiguration.rejectForbidden) {\n\t\t\terrors.push(\n\t\t\t\t`${describeField()} explicitly uses \"forbidden\" kind, which is not recommended.`,\n\t\t\t);\n\t\t}\n\t} // else if (kind !== counter) {\n\t// \terrors.push(\n\t// \t\t`${describeField()} explicitly uses \"counter\" kind, which is finished.`,\n\t// \t);\n\t// }\n}\n"]}
@@ -1,15 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- /**
6
- * Utilities for manipulating types.
7
- */
8
- /**
9
- * Convert a object type into the type of a ReadonlyMap from field name to value.
10
- */
11
- export type ObjectToMap<ObjectMap, MapKey extends number | string, MapValue> = ReadonlyMap<MapKey, MapValue> & {
12
- get<TKey extends keyof ObjectMap>(key: TKey): ObjectMap[TKey];
13
- };
14
- export declare function objectToMapTyped<ObjectMap extends Record<MapKey, MapValue>, MapKey extends string, MapValue>(objectMap: ObjectMap): ObjectToMap<ObjectMap, MapKey, MapValue>;
15
- //# sourceMappingURL=typeUtils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"typeUtils.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/typed-schema/typeUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;GAEG;AAEH;;GAEG;AACH,MAAM,MAAM,WAAW,CAAC,SAAS,EAAE,MAAM,SAAS,MAAM,GAAG,MAAM,EAAE,QAAQ,IAAI,WAAW,CACzF,MAAM,EACN,QAAQ,CACR,GAAG;IACH,GAAG,CAAC,IAAI,SAAS,MAAM,SAAS,EAAE,GAAG,EAAE,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;CAC9D,CAAC;AAGF,wBAAgB,gBAAgB,CAC/B,SAAS,SAAS,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,EAC1C,MAAM,SAAS,MAAM,EACrB,QAAQ,EACP,SAAS,EAAE,SAAS,GAAG,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,CAEhE"}