@fluidframework/tree 2.3.0-288113 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (869) hide show
  1. package/.dependency-cruiser-known-violations.json +28 -40
  2. package/.vscode/Tree.code-workspace +0 -2
  3. package/CHANGELOG.md +92 -0
  4. package/README.md +6 -0
  5. package/alpha.d.ts +11 -0
  6. package/api-extractor/api-extractor-lint-alpha.cjs.json +5 -0
  7. package/api-extractor/api-extractor-lint-alpha.esm.json +5 -0
  8. package/api-extractor/api-extractor-lint-legacy.cjs.json +5 -0
  9. package/api-extractor/api-extractor-lint-legacy.esm.json +5 -0
  10. package/api-extractor/api-extractor.current.json +8 -0
  11. package/api-extractor/api-extractor.legacy.json +4 -0
  12. package/api-extractor.json +1 -1
  13. package/api-report/tree.alpha.api.md +21 -42
  14. package/api-report/tree.beta.api.md +21 -11
  15. package/api-report/tree.legacy.alpha.api.md +562 -0
  16. package/api-report/tree.legacy.public.api.md +559 -0
  17. package/api-report/tree.public.api.md +8 -13
  18. package/dist/alpha.d.ts +102 -0
  19. package/dist/beta.d.ts +6 -2
  20. package/dist/core/index.d.ts +1 -1
  21. package/dist/core/index.d.ts.map +1 -1
  22. package/dist/core/index.js +2 -2
  23. package/dist/core/index.js.map +1 -1
  24. package/dist/core/{revertible/revertible.d.ts → revertible.d.ts} +12 -0
  25. package/dist/core/revertible.d.ts.map +1 -0
  26. package/dist/core/revertible.js.map +1 -0
  27. package/dist/core/schema-stored/format.d.ts +3 -3
  28. package/dist/core/schema-stored/format.js +1 -1
  29. package/dist/core/schema-stored/format.js.map +1 -1
  30. package/dist/core/schema-stored/schema.d.ts +2 -7
  31. package/dist/core/schema-stored/schema.d.ts.map +1 -1
  32. package/dist/core/schema-stored/schema.js +4 -6
  33. package/dist/core/schema-stored/schema.js.map +1 -1
  34. package/dist/core/schema-stored/storedSchemaRepository.d.ts +1 -1
  35. package/dist/core/schema-stored/storedSchemaRepository.d.ts.map +1 -1
  36. package/dist/core/tree/anchorSet.d.ts.map +1 -1
  37. package/dist/core/tree/anchorSet.js +6 -2
  38. package/dist/core/tree/anchorSet.js.map +1 -1
  39. package/dist/core/tree/detachedFieldIndex.d.ts +0 -1
  40. package/dist/core/tree/detachedFieldIndex.d.ts.map +1 -1
  41. package/dist/core/tree/detachedFieldIndex.js +1 -0
  42. package/dist/core/tree/detachedFieldIndex.js.map +1 -1
  43. package/dist/core/tree/visitDelta.d.ts +7 -2
  44. package/dist/core/tree/visitDelta.d.ts.map +1 -1
  45. package/dist/core/tree/visitDelta.js.map +1 -1
  46. package/dist/events/emitter.d.ts +127 -0
  47. package/dist/events/emitter.d.ts.map +1 -0
  48. package/dist/events/{events.js → emitter.js} +48 -30
  49. package/dist/events/emitter.js.map +1 -0
  50. package/dist/events/index.d.ts +2 -1
  51. package/dist/events/index.d.ts.map +1 -1
  52. package/dist/events/index.js +4 -5
  53. package/dist/events/index.js.map +1 -1
  54. package/dist/events/interop.d.ts +36 -0
  55. package/dist/events/interop.d.ts.map +1 -0
  56. package/dist/{core/revertible/index.d.ts → events/interop.js} +3 -2
  57. package/dist/events/interop.js.map +1 -0
  58. package/dist/events/listeners.d.ts +65 -0
  59. package/dist/events/listeners.d.ts.map +1 -0
  60. package/{lib/core/revertible/index.d.ts → dist/events/listeners.js} +3 -2
  61. package/dist/events/listeners.js.map +1 -0
  62. package/dist/feature-libraries/chunked-forest/chunkTree.d.ts +25 -7
  63. package/dist/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  64. package/dist/feature-libraries/chunked-forest/chunkTree.js +36 -15
  65. package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  66. package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts +4 -2
  67. package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  68. package/dist/feature-libraries/chunked-forest/chunkedForest.js +12 -5
  69. package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  70. package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts +15 -2
  71. package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
  72. package/dist/feature-libraries/chunked-forest/uniformChunk.js +28 -2
  73. package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  74. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts +3 -1
  75. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  76. package/dist/feature-libraries/default-schema/defaultEditBuilder.js +5 -4
  77. package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  78. package/dist/feature-libraries/flex-map-tree/index.d.ts +1 -1
  79. package/dist/feature-libraries/flex-map-tree/index.d.ts.map +1 -1
  80. package/dist/feature-libraries/flex-map-tree/index.js +2 -1
  81. package/dist/feature-libraries/flex-map-tree/index.js.map +1 -1
  82. package/dist/feature-libraries/flex-map-tree/mapTreeNode.d.ts +35 -33
  83. package/dist/feature-libraries/flex-map-tree/mapTreeNode.d.ts.map +1 -1
  84. package/dist/feature-libraries/flex-map-tree/mapTreeNode.js +82 -103
  85. package/dist/feature-libraries/flex-map-tree/mapTreeNode.js.map +1 -1
  86. package/dist/feature-libraries/flex-tree/context.d.ts +30 -14
  87. package/dist/feature-libraries/flex-tree/context.d.ts.map +1 -1
  88. package/dist/feature-libraries/flex-tree/context.js +10 -7
  89. package/dist/feature-libraries/flex-tree/context.js.map +1 -1
  90. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts +57 -190
  91. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  92. package/dist/feature-libraries/flex-tree/flexTreeTypes.js +15 -3
  93. package/dist/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  94. package/dist/feature-libraries/flex-tree/index.d.ts +2 -3
  95. package/dist/feature-libraries/flex-tree/index.d.ts.map +1 -1
  96. package/dist/feature-libraries/flex-tree/index.js.map +1 -1
  97. package/dist/feature-libraries/flex-tree/lazyEntity.d.ts +3 -3
  98. package/dist/feature-libraries/flex-tree/lazyEntity.d.ts.map +1 -1
  99. package/dist/feature-libraries/flex-tree/lazyEntity.js +2 -10
  100. package/dist/feature-libraries/flex-tree/lazyEntity.js.map +1 -1
  101. package/dist/feature-libraries/flex-tree/lazyField.d.ts +26 -28
  102. package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  103. package/dist/feature-libraries/flex-tree/lazyField.js +11 -14
  104. package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
  105. package/dist/feature-libraries/flex-tree/lazyNode.d.ts +5 -26
  106. package/dist/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  107. package/dist/feature-libraries/flex-tree/lazyNode.js +23 -74
  108. package/dist/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  109. package/dist/feature-libraries/flex-tree/unboxed.d.ts +4 -16
  110. package/dist/feature-libraries/flex-tree/unboxed.d.ts.map +1 -1
  111. package/dist/feature-libraries/flex-tree/unboxed.js +7 -41
  112. package/dist/feature-libraries/flex-tree/unboxed.js.map +1 -1
  113. package/dist/feature-libraries/flex-tree/utilities.d.ts +2 -2
  114. package/dist/feature-libraries/flex-tree/utilities.d.ts.map +1 -1
  115. package/dist/feature-libraries/flex-tree/utilities.js +3 -6
  116. package/dist/feature-libraries/flex-tree/utilities.js.map +1 -1
  117. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  118. package/dist/feature-libraries/forest-summary/forestSummarizer.js +4 -1
  119. package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  120. package/dist/feature-libraries/index.d.ts +3 -5
  121. package/dist/feature-libraries/index.d.ts.map +1 -1
  122. package/dist/feature-libraries/index.js +5 -11
  123. package/dist/feature-libraries/index.js.map +1 -1
  124. package/dist/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
  125. package/dist/feature-libraries/modular-schema/comparison.js +3 -6
  126. package/dist/feature-libraries/modular-schema/comparison.js.map +1 -1
  127. package/dist/feature-libraries/modular-schema/discrepancies.d.ts.map +1 -1
  128. package/dist/feature-libraries/modular-schema/discrepancies.js +3 -13
  129. package/dist/feature-libraries/modular-schema/discrepancies.js.map +1 -1
  130. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js +4 -1
  131. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  132. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +2 -1
  133. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  134. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +12 -5
  135. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  136. package/dist/feature-libraries/schema-edits/schemaChangeFormat.d.ts +6 -6
  137. package/dist/feature-libraries/schema-index/format.d.ts +3 -3
  138. package/dist/feature-libraries/storedToViewSchema.d.ts.map +1 -1
  139. package/dist/feature-libraries/storedToViewSchema.js +2 -4
  140. package/dist/feature-libraries/storedToViewSchema.js.map +1 -1
  141. package/dist/feature-libraries/typed-schema/flexList.d.ts +3 -3
  142. package/dist/feature-libraries/typed-schema/flexList.js.map +1 -1
  143. package/dist/feature-libraries/typed-schema/index.d.ts +2 -2
  144. package/dist/feature-libraries/typed-schema/index.d.ts.map +1 -1
  145. package/dist/feature-libraries/typed-schema/index.js +2 -2
  146. package/dist/feature-libraries/typed-schema/index.js.map +1 -1
  147. package/dist/feature-libraries/typed-schema/schemaCollection.d.ts.map +1 -1
  148. package/dist/feature-libraries/typed-schema/schemaCollection.js +8 -10
  149. package/dist/feature-libraries/typed-schema/schemaCollection.js.map +1 -1
  150. package/dist/feature-libraries/typed-schema/typedTreeSchema.d.ts +17 -48
  151. package/dist/feature-libraries/typed-schema/typedTreeSchema.d.ts.map +1 -1
  152. package/dist/feature-libraries/typed-schema/typedTreeSchema.js +5 -37
  153. package/dist/feature-libraries/typed-schema/typedTreeSchema.js.map +1 -1
  154. package/dist/feature-libraries/typed-schema/view.d.ts +4 -6
  155. package/dist/feature-libraries/typed-schema/view.d.ts.map +1 -1
  156. package/dist/feature-libraries/typed-schema/view.js +5 -4
  157. package/dist/feature-libraries/typed-schema/view.js.map +1 -1
  158. package/dist/index.d.ts +4 -4
  159. package/dist/index.d.ts.map +1 -1
  160. package/dist/index.js +33 -36
  161. package/dist/index.js.map +1 -1
  162. package/dist/legacy.d.ts +83 -0
  163. package/dist/packageVersion.d.ts +1 -1
  164. package/dist/packageVersion.d.ts.map +1 -1
  165. package/dist/packageVersion.js +1 -1
  166. package/dist/packageVersion.js.map +1 -1
  167. package/dist/public.d.ts +0 -1
  168. package/dist/shared-tree/checkoutFlexTreeView.d.ts +53 -0
  169. package/dist/shared-tree/checkoutFlexTreeView.d.ts.map +1 -0
  170. package/dist/shared-tree/{treeView.js → checkoutFlexTreeView.js} +28 -6
  171. package/dist/shared-tree/checkoutFlexTreeView.js.map +1 -0
  172. package/dist/shared-tree/index.d.ts +3 -3
  173. package/dist/shared-tree/index.d.ts.map +1 -1
  174. package/dist/shared-tree/index.js +2 -2
  175. package/dist/shared-tree/index.js.map +1 -1
  176. package/dist/shared-tree/schematizeTree.d.ts +15 -4
  177. package/dist/shared-tree/schematizeTree.d.ts.map +1 -1
  178. package/dist/shared-tree/schematizeTree.js +7 -8
  179. package/dist/shared-tree/schematizeTree.js.map +1 -1
  180. package/dist/shared-tree/schematizingTreeView.d.ts +9 -4
  181. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  182. package/dist/shared-tree/schematizingTreeView.js +25 -12
  183. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  184. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  185. package/dist/shared-tree/sharedTree.js +2 -2
  186. package/dist/shared-tree/sharedTree.js.map +1 -1
  187. package/dist/shared-tree/sharedTreeChangeEnricher.d.ts +3 -1
  188. package/dist/shared-tree/sharedTreeChangeEnricher.d.ts.map +1 -1
  189. package/dist/shared-tree/sharedTreeChangeEnricher.js +6 -2
  190. package/dist/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
  191. package/dist/shared-tree/sharedTreeChangeFamily.d.ts +3 -1
  192. package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  193. package/dist/shared-tree/sharedTreeChangeFamily.js +3 -2
  194. package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  195. package/dist/shared-tree/sharedTreeEditBuilder.d.ts +2 -1
  196. package/dist/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
  197. package/dist/shared-tree/sharedTreeEditBuilder.js +2 -2
  198. package/dist/shared-tree/sharedTreeEditBuilder.js.map +1 -1
  199. package/dist/shared-tree/treeApi.d.ts +1 -3
  200. package/dist/shared-tree/treeApi.d.ts.map +1 -1
  201. package/dist/shared-tree/treeApi.js +6 -4
  202. package/dist/shared-tree/treeApi.js.map +1 -1
  203. package/dist/shared-tree/treeCheckout.d.ts +2 -13
  204. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  205. package/dist/shared-tree/treeCheckout.js +17 -1
  206. package/dist/shared-tree/treeCheckout.js.map +1 -1
  207. package/dist/shared-tree-core/branch.js +1 -1
  208. package/dist/shared-tree-core/branch.js.map +1 -1
  209. package/dist/simple-tree/api/create.d.ts.map +1 -1
  210. package/dist/simple-tree/api/create.js +1 -1
  211. package/dist/simple-tree/api/create.js.map +1 -1
  212. package/{lib/simple-tree → dist/simple-tree/api}/getJsonSchema.d.ts +1 -1
  213. package/dist/simple-tree/api/getJsonSchema.d.ts.map +1 -0
  214. package/dist/simple-tree/{getJsonSchema.js → api/getJsonSchema.js} +1 -1
  215. package/dist/simple-tree/api/getJsonSchema.js.map +1 -0
  216. package/{lib/simple-tree → dist/simple-tree/api}/getSimpleSchema.d.ts +1 -1
  217. package/dist/simple-tree/api/getSimpleSchema.d.ts.map +1 -0
  218. package/dist/simple-tree/{getSimpleSchema.js → api/getSimpleSchema.js} +1 -1
  219. package/dist/simple-tree/api/getSimpleSchema.js.map +1 -0
  220. package/dist/simple-tree/api/index.d.ts +5 -0
  221. package/dist/simple-tree/api/index.d.ts.map +1 -1
  222. package/dist/simple-tree/api/index.js +7 -1
  223. package/dist/simple-tree/api/index.js.map +1 -1
  224. package/{lib/simple-tree → dist/simple-tree/api}/jsonSchema.d.ts +1 -1
  225. package/dist/simple-tree/api/jsonSchema.d.ts.map +1 -0
  226. package/dist/simple-tree/api/jsonSchema.js.map +1 -0
  227. package/dist/simple-tree/api/schemaFactory.d.ts +45 -14
  228. package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
  229. package/dist/simple-tree/api/schemaFactory.js +43 -12
  230. package/dist/simple-tree/api/schemaFactory.js.map +1 -1
  231. package/dist/simple-tree/{simpleSchema.d.ts → api/simpleSchema.d.ts} +4 -4
  232. package/dist/simple-tree/api/simpleSchema.d.ts.map +1 -0
  233. package/dist/simple-tree/api/simpleSchema.js.map +1 -0
  234. package/dist/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -0
  235. package/dist/simple-tree/{simpleSchemaToJsonSchema.js → api/simpleSchemaToJsonSchema.js} +4 -4
  236. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -0
  237. package/dist/simple-tree/api/tree.d.ts +1 -21
  238. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  239. package/dist/simple-tree/api/tree.js +3 -38
  240. package/dist/simple-tree/api/tree.js.map +1 -1
  241. package/dist/simple-tree/api/treeApiBeta.d.ts +79 -0
  242. package/dist/simple-tree/api/treeApiBeta.d.ts.map +1 -0
  243. package/dist/simple-tree/api/treeApiBeta.js +26 -0
  244. package/dist/simple-tree/api/treeApiBeta.js.map +1 -0
  245. package/dist/simple-tree/api/treeNodeApi.d.ts +1 -1
  246. package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  247. package/dist/simple-tree/api/treeNodeApi.js +21 -19
  248. package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
  249. package/dist/simple-tree/api/verboseTree.js +2 -2
  250. package/dist/simple-tree/api/verboseTree.js.map +1 -1
  251. package/dist/simple-tree/{viewSchemaToSimpleSchema.d.ts → api/viewSchemaToSimpleSchema.d.ts} +1 -1
  252. package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -0
  253. package/dist/simple-tree/{viewSchemaToSimpleSchema.js → api/viewSchemaToSimpleSchema.js} +4 -4
  254. package/{lib/simple-tree → dist/simple-tree/api}/viewSchemaToSimpleSchema.js.map +1 -1
  255. package/dist/simple-tree/arrayNode.d.ts +2 -2
  256. package/dist/simple-tree/arrayNode.d.ts.map +1 -1
  257. package/dist/simple-tree/arrayNode.js +30 -21
  258. package/dist/simple-tree/arrayNode.js.map +1 -1
  259. package/dist/simple-tree/core/index.d.ts +3 -3
  260. package/dist/simple-tree/core/index.d.ts.map +1 -1
  261. package/dist/simple-tree/core/index.js +4 -1
  262. package/dist/simple-tree/core/index.js.map +1 -1
  263. package/dist/simple-tree/core/schemaCaching.d.ts +5 -0
  264. package/dist/simple-tree/core/schemaCaching.d.ts.map +1 -1
  265. package/dist/simple-tree/core/schemaCaching.js +10 -1
  266. package/dist/simple-tree/core/schemaCaching.js.map +1 -1
  267. package/dist/simple-tree/core/treeNodeKernel.d.ts +61 -3
  268. package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  269. package/dist/simple-tree/core/treeNodeKernel.js +166 -13
  270. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
  271. package/dist/simple-tree/core/treeNodeSchema.d.ts +1 -1
  272. package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
  273. package/dist/simple-tree/core/types.d.ts +17 -20
  274. package/dist/simple-tree/core/types.d.ts.map +1 -1
  275. package/dist/simple-tree/core/types.js.map +1 -1
  276. package/dist/simple-tree/core/withType.d.ts +3 -2
  277. package/dist/simple-tree/core/withType.d.ts.map +1 -1
  278. package/dist/simple-tree/core/withType.js.map +1 -1
  279. package/dist/simple-tree/index.d.ts +7 -9
  280. package/dist/simple-tree/index.d.ts.map +1 -1
  281. package/dist/simple-tree/index.js +15 -6
  282. package/dist/simple-tree/index.js.map +1 -1
  283. package/dist/simple-tree/leafNodeSchema.d.ts +7 -9
  284. package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
  285. package/dist/simple-tree/leafNodeSchema.js +13 -11
  286. package/dist/simple-tree/leafNodeSchema.js.map +1 -1
  287. package/dist/simple-tree/mapNode.d.ts +1 -1
  288. package/dist/simple-tree/mapNode.d.ts.map +1 -1
  289. package/dist/simple-tree/mapNode.js +38 -29
  290. package/dist/simple-tree/mapNode.js.map +1 -1
  291. package/dist/simple-tree/objectNode.d.ts +9 -7
  292. package/dist/simple-tree/objectNode.d.ts.map +1 -1
  293. package/dist/simple-tree/objectNode.js +37 -31
  294. package/dist/simple-tree/objectNode.js.map +1 -1
  295. package/dist/simple-tree/proxies.d.ts +1 -14
  296. package/dist/simple-tree/proxies.d.ts.map +1 -1
  297. package/dist/simple-tree/proxies.js +12 -15
  298. package/dist/simple-tree/proxies.js.map +1 -1
  299. package/dist/simple-tree/proxyBinding.d.ts +2 -62
  300. package/dist/simple-tree/proxyBinding.d.ts.map +1 -1
  301. package/dist/simple-tree/proxyBinding.js +8 -181
  302. package/dist/simple-tree/proxyBinding.js.map +1 -1
  303. package/dist/simple-tree/schemaTypes.d.ts +7 -7
  304. package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
  305. package/dist/simple-tree/schemaTypes.js +4 -4
  306. package/dist/simple-tree/schemaTypes.js.map +1 -1
  307. package/dist/simple-tree/toFlexSchema.d.ts +11 -1
  308. package/dist/simple-tree/toFlexSchema.d.ts.map +1 -1
  309. package/dist/simple-tree/toFlexSchema.js +54 -31
  310. package/dist/simple-tree/toFlexSchema.js.map +1 -1
  311. package/dist/simple-tree/toMapTree.d.ts +25 -37
  312. package/dist/simple-tree/toMapTree.d.ts.map +1 -1
  313. package/dist/simple-tree/toMapTree.js +53 -16
  314. package/dist/simple-tree/toMapTree.js.map +1 -1
  315. package/dist/simple-tree/treeNodeValid.d.ts.map +1 -1
  316. package/dist/simple-tree/treeNodeValid.js +7 -10
  317. package/dist/simple-tree/treeNodeValid.js.map +1 -1
  318. package/dist/simple-tree/typesUnsafe.d.ts +13 -13
  319. package/dist/simple-tree/typesUnsafe.js.map +1 -1
  320. package/dist/simple-tree/walkSchema.d.ts +26 -0
  321. package/dist/simple-tree/walkSchema.d.ts.map +1 -0
  322. package/dist/simple-tree/walkSchema.js +49 -0
  323. package/dist/simple-tree/walkSchema.js.map +1 -0
  324. package/dist/treeFactory.d.ts +2 -1
  325. package/dist/treeFactory.d.ts.map +1 -1
  326. package/dist/treeFactory.js +2 -1
  327. package/dist/treeFactory.js.map +1 -1
  328. package/dist/util/typeUtils.d.ts +2 -2
  329. package/dist/util/typeUtils.js.map +1 -1
  330. package/legacy.d.ts +11 -0
  331. package/lib/alpha.d.ts +102 -0
  332. package/lib/beta.d.ts +6 -2
  333. package/lib/core/index.d.ts +1 -1
  334. package/lib/core/index.d.ts.map +1 -1
  335. package/lib/core/index.js +1 -1
  336. package/lib/core/index.js.map +1 -1
  337. package/lib/core/{revertible/revertible.d.ts → revertible.d.ts} +12 -0
  338. package/lib/core/revertible.d.ts.map +1 -0
  339. package/lib/core/revertible.js.map +1 -0
  340. package/lib/core/schema-stored/format.d.ts +3 -3
  341. package/lib/core/schema-stored/format.js +1 -1
  342. package/lib/core/schema-stored/format.js.map +1 -1
  343. package/lib/core/schema-stored/schema.d.ts +2 -7
  344. package/lib/core/schema-stored/schema.d.ts.map +1 -1
  345. package/lib/core/schema-stored/schema.js +4 -6
  346. package/lib/core/schema-stored/schema.js.map +1 -1
  347. package/lib/core/schema-stored/storedSchemaRepository.d.ts +1 -1
  348. package/lib/core/schema-stored/storedSchemaRepository.d.ts.map +1 -1
  349. package/lib/core/tree/anchorSet.d.ts.map +1 -1
  350. package/lib/core/tree/anchorSet.js +6 -2
  351. package/lib/core/tree/anchorSet.js.map +1 -1
  352. package/lib/core/tree/detachedFieldIndex.d.ts +0 -1
  353. package/lib/core/tree/detachedFieldIndex.d.ts.map +1 -1
  354. package/lib/core/tree/detachedFieldIndex.js +1 -0
  355. package/lib/core/tree/detachedFieldIndex.js.map +1 -1
  356. package/lib/core/tree/visitDelta.d.ts +7 -2
  357. package/lib/core/tree/visitDelta.d.ts.map +1 -1
  358. package/lib/core/tree/visitDelta.js.map +1 -1
  359. package/lib/events/emitter.d.ts +127 -0
  360. package/lib/events/emitter.d.ts.map +1 -0
  361. package/lib/events/{events.js → emitter.js} +48 -29
  362. package/lib/events/emitter.js.map +1 -0
  363. package/lib/events/index.d.ts +2 -1
  364. package/lib/events/index.d.ts.map +1 -1
  365. package/lib/events/index.js +1 -1
  366. package/lib/events/index.js.map +1 -1
  367. package/lib/events/interop.d.ts +36 -0
  368. package/lib/events/interop.d.ts.map +1 -0
  369. package/{src/core/revertible/index.ts → lib/events/interop.js} +2 -2
  370. package/lib/events/interop.js.map +1 -0
  371. package/lib/events/listeners.d.ts +65 -0
  372. package/lib/events/listeners.d.ts.map +1 -0
  373. package/lib/{core/revertible/index.js → events/listeners.js} +2 -2
  374. package/lib/events/listeners.js.map +1 -0
  375. package/lib/feature-libraries/chunked-forest/chunkTree.d.ts +25 -7
  376. package/lib/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  377. package/lib/feature-libraries/chunked-forest/chunkTree.js +37 -16
  378. package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  379. package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts +4 -2
  380. package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  381. package/lib/feature-libraries/chunked-forest/chunkedForest.js +12 -5
  382. package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  383. package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts +15 -2
  384. package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
  385. package/lib/feature-libraries/chunked-forest/uniformChunk.js +28 -2
  386. package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  387. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts +3 -1
  388. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  389. package/lib/feature-libraries/default-schema/defaultEditBuilder.js +5 -4
  390. package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  391. package/lib/feature-libraries/flex-map-tree/index.d.ts +1 -1
  392. package/lib/feature-libraries/flex-map-tree/index.d.ts.map +1 -1
  393. package/lib/feature-libraries/flex-map-tree/index.js +1 -1
  394. package/lib/feature-libraries/flex-map-tree/index.js.map +1 -1
  395. package/lib/feature-libraries/flex-map-tree/mapTreeNode.d.ts +35 -33
  396. package/lib/feature-libraries/flex-map-tree/mapTreeNode.d.ts.map +1 -1
  397. package/lib/feature-libraries/flex-map-tree/mapTreeNode.js +83 -104
  398. package/lib/feature-libraries/flex-map-tree/mapTreeNode.js.map +1 -1
  399. package/lib/feature-libraries/flex-tree/context.d.ts +30 -14
  400. package/lib/feature-libraries/flex-tree/context.d.ts.map +1 -1
  401. package/lib/feature-libraries/flex-tree/context.js +10 -7
  402. package/lib/feature-libraries/flex-tree/context.js.map +1 -1
  403. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts +57 -190
  404. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  405. package/lib/feature-libraries/flex-tree/flexTreeTypes.js +15 -2
  406. package/lib/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  407. package/lib/feature-libraries/flex-tree/index.d.ts +2 -3
  408. package/lib/feature-libraries/flex-tree/index.d.ts.map +1 -1
  409. package/lib/feature-libraries/flex-tree/index.js +1 -1
  410. package/lib/feature-libraries/flex-tree/index.js.map +1 -1
  411. package/lib/feature-libraries/flex-tree/lazyEntity.d.ts +3 -3
  412. package/lib/feature-libraries/flex-tree/lazyEntity.d.ts.map +1 -1
  413. package/lib/feature-libraries/flex-tree/lazyEntity.js +2 -10
  414. package/lib/feature-libraries/flex-tree/lazyEntity.js.map +1 -1
  415. package/lib/feature-libraries/flex-tree/lazyField.d.ts +26 -28
  416. package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  417. package/lib/feature-libraries/flex-tree/lazyField.js +11 -13
  418. package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
  419. package/lib/feature-libraries/flex-tree/lazyNode.d.ts +5 -26
  420. package/lib/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  421. package/lib/feature-libraries/flex-tree/lazyNode.js +23 -72
  422. package/lib/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  423. package/lib/feature-libraries/flex-tree/unboxed.d.ts +4 -16
  424. package/lib/feature-libraries/flex-tree/unboxed.d.ts.map +1 -1
  425. package/lib/feature-libraries/flex-tree/unboxed.js +5 -37
  426. package/lib/feature-libraries/flex-tree/unboxed.js.map +1 -1
  427. package/lib/feature-libraries/flex-tree/utilities.d.ts +2 -2
  428. package/lib/feature-libraries/flex-tree/utilities.d.ts.map +1 -1
  429. package/lib/feature-libraries/flex-tree/utilities.js +3 -6
  430. package/lib/feature-libraries/flex-tree/utilities.js.map +1 -1
  431. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  432. package/lib/feature-libraries/forest-summary/forestSummarizer.js +4 -1
  433. package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  434. package/lib/feature-libraries/index.d.ts +3 -5
  435. package/lib/feature-libraries/index.d.ts.map +1 -1
  436. package/lib/feature-libraries/index.js +5 -5
  437. package/lib/feature-libraries/index.js.map +1 -1
  438. package/lib/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
  439. package/lib/feature-libraries/modular-schema/comparison.js +3 -6
  440. package/lib/feature-libraries/modular-schema/comparison.js.map +1 -1
  441. package/lib/feature-libraries/modular-schema/discrepancies.d.ts.map +1 -1
  442. package/lib/feature-libraries/modular-schema/discrepancies.js +3 -13
  443. package/lib/feature-libraries/modular-schema/discrepancies.js.map +1 -1
  444. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js +4 -1
  445. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  446. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +2 -1
  447. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  448. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +12 -5
  449. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  450. package/lib/feature-libraries/schema-edits/schemaChangeFormat.d.ts +6 -6
  451. package/lib/feature-libraries/schema-index/format.d.ts +3 -3
  452. package/lib/feature-libraries/storedToViewSchema.d.ts.map +1 -1
  453. package/lib/feature-libraries/storedToViewSchema.js +3 -5
  454. package/lib/feature-libraries/storedToViewSchema.js.map +1 -1
  455. package/lib/feature-libraries/typed-schema/flexList.d.ts +3 -3
  456. package/lib/feature-libraries/typed-schema/flexList.js.map +1 -1
  457. package/lib/feature-libraries/typed-schema/index.d.ts +2 -2
  458. package/lib/feature-libraries/typed-schema/index.d.ts.map +1 -1
  459. package/lib/feature-libraries/typed-schema/index.js +2 -2
  460. package/lib/feature-libraries/typed-schema/index.js.map +1 -1
  461. package/lib/feature-libraries/typed-schema/schemaCollection.d.ts.map +1 -1
  462. package/lib/feature-libraries/typed-schema/schemaCollection.js +9 -11
  463. package/lib/feature-libraries/typed-schema/schemaCollection.js.map +1 -1
  464. package/lib/feature-libraries/typed-schema/typedTreeSchema.d.ts +17 -48
  465. package/lib/feature-libraries/typed-schema/typedTreeSchema.d.ts.map +1 -1
  466. package/lib/feature-libraries/typed-schema/typedTreeSchema.js +5 -36
  467. package/lib/feature-libraries/typed-schema/typedTreeSchema.js.map +1 -1
  468. package/lib/feature-libraries/typed-schema/view.d.ts +4 -6
  469. package/lib/feature-libraries/typed-schema/view.d.ts.map +1 -1
  470. package/lib/feature-libraries/typed-schema/view.js +5 -4
  471. package/lib/feature-libraries/typed-schema/view.js.map +1 -1
  472. package/lib/index.d.ts +4 -4
  473. package/lib/index.d.ts.map +1 -1
  474. package/lib/index.js +3 -5
  475. package/lib/index.js.map +1 -1
  476. package/lib/legacy.d.ts +83 -0
  477. package/lib/packageVersion.d.ts +1 -1
  478. package/lib/packageVersion.d.ts.map +1 -1
  479. package/lib/packageVersion.js +1 -1
  480. package/lib/packageVersion.js.map +1 -1
  481. package/lib/public.d.ts +0 -1
  482. package/lib/shared-tree/checkoutFlexTreeView.d.ts +53 -0
  483. package/lib/shared-tree/checkoutFlexTreeView.d.ts.map +1 -0
  484. package/lib/shared-tree/{treeView.js → checkoutFlexTreeView.js} +26 -5
  485. package/lib/shared-tree/checkoutFlexTreeView.js.map +1 -0
  486. package/lib/shared-tree/index.d.ts +3 -3
  487. package/lib/shared-tree/index.d.ts.map +1 -1
  488. package/lib/shared-tree/index.js +1 -1
  489. package/lib/shared-tree/index.js.map +1 -1
  490. package/lib/shared-tree/schematizeTree.d.ts +15 -4
  491. package/lib/shared-tree/schematizeTree.d.ts.map +1 -1
  492. package/lib/shared-tree/schematizeTree.js +8 -9
  493. package/lib/shared-tree/schematizeTree.js.map +1 -1
  494. package/lib/shared-tree/schematizingTreeView.d.ts +9 -4
  495. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  496. package/lib/shared-tree/schematizingTreeView.js +26 -13
  497. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  498. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  499. package/lib/shared-tree/sharedTree.js +2 -2
  500. package/lib/shared-tree/sharedTree.js.map +1 -1
  501. package/lib/shared-tree/sharedTreeChangeEnricher.d.ts +3 -1
  502. package/lib/shared-tree/sharedTreeChangeEnricher.d.ts.map +1 -1
  503. package/lib/shared-tree/sharedTreeChangeEnricher.js +6 -2
  504. package/lib/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
  505. package/lib/shared-tree/sharedTreeChangeFamily.d.ts +3 -1
  506. package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  507. package/lib/shared-tree/sharedTreeChangeFamily.js +3 -2
  508. package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  509. package/lib/shared-tree/sharedTreeEditBuilder.d.ts +2 -1
  510. package/lib/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
  511. package/lib/shared-tree/sharedTreeEditBuilder.js +2 -2
  512. package/lib/shared-tree/sharedTreeEditBuilder.js.map +1 -1
  513. package/lib/shared-tree/treeApi.d.ts +1 -3
  514. package/lib/shared-tree/treeApi.d.ts.map +1 -1
  515. package/lib/shared-tree/treeApi.js +7 -5
  516. package/lib/shared-tree/treeApi.js.map +1 -1
  517. package/lib/shared-tree/treeCheckout.d.ts +2 -13
  518. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  519. package/lib/shared-tree/treeCheckout.js +18 -2
  520. package/lib/shared-tree/treeCheckout.js.map +1 -1
  521. package/lib/shared-tree-core/branch.js +1 -1
  522. package/lib/shared-tree-core/branch.js.map +1 -1
  523. package/lib/simple-tree/api/create.d.ts.map +1 -1
  524. package/lib/simple-tree/api/create.js +2 -2
  525. package/lib/simple-tree/api/create.js.map +1 -1
  526. package/{dist/simple-tree → lib/simple-tree/api}/getJsonSchema.d.ts +1 -1
  527. package/lib/simple-tree/api/getJsonSchema.d.ts.map +1 -0
  528. package/lib/simple-tree/{getJsonSchema.js → api/getJsonSchema.js} +1 -1
  529. package/lib/simple-tree/api/getJsonSchema.js.map +1 -0
  530. package/{dist/simple-tree → lib/simple-tree/api}/getSimpleSchema.d.ts +1 -1
  531. package/lib/simple-tree/api/getSimpleSchema.d.ts.map +1 -0
  532. package/lib/simple-tree/{getSimpleSchema.js → api/getSimpleSchema.js} +1 -1
  533. package/lib/simple-tree/api/getSimpleSchema.js.map +1 -0
  534. package/lib/simple-tree/api/index.d.ts +5 -0
  535. package/lib/simple-tree/api/index.d.ts.map +1 -1
  536. package/lib/simple-tree/api/index.js +3 -0
  537. package/lib/simple-tree/api/index.js.map +1 -1
  538. package/{dist/simple-tree → lib/simple-tree/api}/jsonSchema.d.ts +1 -1
  539. package/lib/simple-tree/api/jsonSchema.d.ts.map +1 -0
  540. package/lib/simple-tree/api/jsonSchema.js.map +1 -0
  541. package/lib/simple-tree/api/schemaFactory.d.ts +45 -14
  542. package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
  543. package/lib/simple-tree/api/schemaFactory.js +43 -12
  544. package/lib/simple-tree/api/schemaFactory.js.map +1 -1
  545. package/lib/simple-tree/{simpleSchema.d.ts → api/simpleSchema.d.ts} +4 -4
  546. package/lib/simple-tree/api/simpleSchema.d.ts.map +1 -0
  547. package/lib/simple-tree/api/simpleSchema.js.map +1 -0
  548. package/lib/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -0
  549. package/lib/simple-tree/{simpleSchemaToJsonSchema.js → api/simpleSchemaToJsonSchema.js} +4 -4
  550. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -0
  551. package/lib/simple-tree/api/tree.d.ts +1 -21
  552. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  553. package/lib/simple-tree/api/tree.js +2 -34
  554. package/lib/simple-tree/api/tree.js.map +1 -1
  555. package/lib/simple-tree/api/treeApiBeta.d.ts +79 -0
  556. package/lib/simple-tree/api/treeApiBeta.d.ts.map +1 -0
  557. package/lib/simple-tree/api/treeApiBeta.js +23 -0
  558. package/lib/simple-tree/api/treeApiBeta.js.map +1 -0
  559. package/lib/simple-tree/api/treeNodeApi.d.ts +1 -1
  560. package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  561. package/lib/simple-tree/api/treeNodeApi.js +23 -21
  562. package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
  563. package/lib/simple-tree/api/verboseTree.js +1 -1
  564. package/lib/simple-tree/api/verboseTree.js.map +1 -1
  565. package/lib/simple-tree/{viewSchemaToSimpleSchema.d.ts → api/viewSchemaToSimpleSchema.d.ts} +1 -1
  566. package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -0
  567. package/lib/simple-tree/{viewSchemaToSimpleSchema.js → api/viewSchemaToSimpleSchema.js} +4 -4
  568. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -0
  569. package/lib/simple-tree/arrayNode.d.ts +2 -2
  570. package/lib/simple-tree/arrayNode.d.ts.map +1 -1
  571. package/lib/simple-tree/arrayNode.js +33 -24
  572. package/lib/simple-tree/arrayNode.js.map +1 -1
  573. package/lib/simple-tree/core/index.d.ts +3 -3
  574. package/lib/simple-tree/core/index.d.ts.map +1 -1
  575. package/lib/simple-tree/core/index.js +2 -2
  576. package/lib/simple-tree/core/index.js.map +1 -1
  577. package/lib/simple-tree/core/schemaCaching.d.ts +5 -0
  578. package/lib/simple-tree/core/schemaCaching.d.ts.map +1 -1
  579. package/lib/simple-tree/core/schemaCaching.js +8 -0
  580. package/lib/simple-tree/core/schemaCaching.js.map +1 -1
  581. package/lib/simple-tree/core/treeNodeKernel.d.ts +61 -3
  582. package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  583. package/lib/simple-tree/core/treeNodeKernel.js +156 -5
  584. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
  585. package/lib/simple-tree/core/treeNodeSchema.d.ts +1 -1
  586. package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
  587. package/lib/simple-tree/core/types.d.ts +17 -20
  588. package/lib/simple-tree/core/types.d.ts.map +1 -1
  589. package/lib/simple-tree/core/types.js.map +1 -1
  590. package/lib/simple-tree/core/withType.d.ts +3 -2
  591. package/lib/simple-tree/core/withType.d.ts.map +1 -1
  592. package/lib/simple-tree/core/withType.js.map +1 -1
  593. package/lib/simple-tree/index.d.ts +7 -9
  594. package/lib/simple-tree/index.d.ts.map +1 -1
  595. package/lib/simple-tree/index.js +5 -5
  596. package/lib/simple-tree/index.js.map +1 -1
  597. package/lib/simple-tree/leafNodeSchema.d.ts +7 -9
  598. package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
  599. package/lib/simple-tree/leafNodeSchema.js +14 -12
  600. package/lib/simple-tree/leafNodeSchema.js.map +1 -1
  601. package/lib/simple-tree/mapNode.d.ts +1 -1
  602. package/lib/simple-tree/mapNode.d.ts.map +1 -1
  603. package/lib/simple-tree/mapNode.js +38 -29
  604. package/lib/simple-tree/mapNode.js.map +1 -1
  605. package/lib/simple-tree/objectNode.d.ts +9 -7
  606. package/lib/simple-tree/objectNode.d.ts.map +1 -1
  607. package/lib/simple-tree/objectNode.js +40 -34
  608. package/lib/simple-tree/objectNode.js.map +1 -1
  609. package/lib/simple-tree/proxies.d.ts +1 -14
  610. package/lib/simple-tree/proxies.d.ts.map +1 -1
  611. package/lib/simple-tree/proxies.js +11 -14
  612. package/lib/simple-tree/proxies.js.map +1 -1
  613. package/lib/simple-tree/proxyBinding.d.ts +2 -62
  614. package/lib/simple-tree/proxyBinding.d.ts.map +1 -1
  615. package/lib/simple-tree/proxyBinding.js +6 -174
  616. package/lib/simple-tree/proxyBinding.js.map +1 -1
  617. package/lib/simple-tree/schemaTypes.d.ts +7 -7
  618. package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
  619. package/lib/simple-tree/schemaTypes.js +4 -4
  620. package/lib/simple-tree/schemaTypes.js.map +1 -1
  621. package/lib/simple-tree/toFlexSchema.d.ts +11 -1
  622. package/lib/simple-tree/toFlexSchema.d.ts.map +1 -1
  623. package/lib/simple-tree/toFlexSchema.js +29 -8
  624. package/lib/simple-tree/toFlexSchema.js.map +1 -1
  625. package/lib/simple-tree/toMapTree.d.ts +25 -37
  626. package/lib/simple-tree/toMapTree.d.ts.map +1 -1
  627. package/lib/simple-tree/toMapTree.js +54 -17
  628. package/lib/simple-tree/toMapTree.js.map +1 -1
  629. package/lib/simple-tree/treeNodeValid.d.ts.map +1 -1
  630. package/lib/simple-tree/treeNodeValid.js +8 -11
  631. package/lib/simple-tree/treeNodeValid.js.map +1 -1
  632. package/lib/simple-tree/typesUnsafe.d.ts +13 -13
  633. package/lib/simple-tree/typesUnsafe.js.map +1 -1
  634. package/lib/simple-tree/walkSchema.d.ts +26 -0
  635. package/lib/simple-tree/walkSchema.d.ts.map +1 -0
  636. package/lib/simple-tree/walkSchema.js +43 -0
  637. package/lib/simple-tree/walkSchema.js.map +1 -0
  638. package/lib/treeFactory.d.ts +2 -1
  639. package/lib/treeFactory.d.ts.map +1 -1
  640. package/lib/treeFactory.js +2 -1
  641. package/lib/treeFactory.js.map +1 -1
  642. package/lib/tsdoc-metadata.json +1 -1
  643. package/lib/util/typeUtils.d.ts +2 -2
  644. package/lib/util/typeUtils.js.map +1 -1
  645. package/package.json +57 -25
  646. package/src/core/index.ts +1 -1
  647. package/src/core/{revertible/revertible.ts → revertible.ts} +15 -0
  648. package/src/core/schema-stored/format.ts +1 -1
  649. package/src/core/schema-stored/schema.ts +6 -13
  650. package/src/core/tree/anchorSet.ts +18 -3
  651. package/src/core/tree/detachedFieldIndex.ts +6 -5
  652. package/src/core/tree/visitDelta.ts +7 -2
  653. package/src/events/{events.ts → emitter.ts} +52 -139
  654. package/src/events/index.ts +7 -7
  655. package/src/events/interop.ts +49 -0
  656. package/src/events/listeners.ts +68 -0
  657. package/src/feature-libraries/chunked-forest/chunkTree.ts +63 -18
  658. package/src/feature-libraries/chunked-forest/chunkedForest.ts +18 -4
  659. package/src/feature-libraries/chunked-forest/uniformChunk.ts +33 -0
  660. package/src/feature-libraries/default-schema/defaultEditBuilder.ts +5 -3
  661. package/src/feature-libraries/flex-map-tree/index.ts +1 -0
  662. package/src/feature-libraries/flex-map-tree/mapTreeNode.ts +135 -210
  663. package/src/feature-libraries/flex-tree/README.md +4 -75
  664. package/src/feature-libraries/flex-tree/context.ts +37 -16
  665. package/src/feature-libraries/flex-tree/flexTreeTypes.ts +69 -291
  666. package/src/feature-libraries/flex-tree/index.ts +7 -13
  667. package/src/feature-libraries/flex-tree/lazyEntity.ts +2 -11
  668. package/src/feature-libraries/flex-tree/lazyField.ts +49 -73
  669. package/src/feature-libraries/flex-tree/lazyNode.ts +25 -154
  670. package/src/feature-libraries/flex-tree/unboxed.ts +9 -68
  671. package/src/feature-libraries/flex-tree/utilities.ts +4 -8
  672. package/src/feature-libraries/forest-summary/forestSummarizer.ts +4 -1
  673. package/src/feature-libraries/index.ts +2 -27
  674. package/src/feature-libraries/modular-schema/comparison.ts +4 -6
  675. package/src/feature-libraries/modular-schema/discrepancies.ts +7 -16
  676. package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +4 -1
  677. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +14 -4
  678. package/src/feature-libraries/storedToViewSchema.ts +5 -6
  679. package/src/feature-libraries/typed-schema/flexList.ts +3 -3
  680. package/src/feature-libraries/typed-schema/index.ts +1 -3
  681. package/src/feature-libraries/typed-schema/schemaCollection.ts +15 -17
  682. package/src/feature-libraries/typed-schema/typedTreeSchema.ts +35 -127
  683. package/src/feature-libraries/typed-schema/view.ts +4 -13
  684. package/src/index.ts +4 -8
  685. package/src/packageVersion.ts +1 -1
  686. package/src/shared-tree/checkoutFlexTreeView.ts +89 -0
  687. package/src/shared-tree/index.ts +2 -7
  688. package/src/shared-tree/schematizeTree.ts +23 -12
  689. package/src/shared-tree/schematizingTreeView.ts +34 -24
  690. package/src/shared-tree/sharedTree.ts +6 -1
  691. package/src/shared-tree/sharedTreeChangeEnricher.ts +6 -1
  692. package/src/shared-tree/sharedTreeChangeFamily.ts +7 -1
  693. package/src/shared-tree/sharedTreeEditBuilder.ts +9 -4
  694. package/src/shared-tree/treeApi.ts +10 -10
  695. package/src/shared-tree/treeCheckout.ts +26 -15
  696. package/src/shared-tree-core/branch.ts +1 -1
  697. package/src/simple-tree/ProxyBinding.md +23 -23
  698. package/src/simple-tree/api/create.ts +8 -3
  699. package/src/simple-tree/{getJsonSchema.ts → api/getJsonSchema.ts} +3 -3
  700. package/src/simple-tree/{getSimpleSchema.ts → api/getSimpleSchema.ts} +3 -3
  701. package/src/simple-tree/api/index.ts +20 -0
  702. package/src/simple-tree/{jsonSchema.ts → api/jsonSchema.ts} +1 -1
  703. package/src/simple-tree/api/schemaFactory.ts +44 -13
  704. package/src/simple-tree/{simpleSchema.ts → api/simpleSchema.ts} +4 -4
  705. package/src/simple-tree/{simpleSchemaToJsonSchema.ts → api/simpleSchemaToJsonSchema.ts} +4 -4
  706. package/src/simple-tree/api/tree.ts +2 -71
  707. package/src/simple-tree/api/treeApiBeta.ts +101 -0
  708. package/src/simple-tree/api/treeNodeApi.ts +32 -23
  709. package/src/simple-tree/api/verboseTree.ts +1 -1
  710. package/src/simple-tree/{viewSchemaToSimpleSchema.ts → api/viewSchemaToSimpleSchema.ts} +5 -5
  711. package/src/simple-tree/arrayNode.ts +37 -31
  712. package/src/simple-tree/core/index.ts +4 -1
  713. package/src/simple-tree/core/schemaCaching.ts +10 -0
  714. package/src/simple-tree/core/treeNodeKernel.ts +198 -5
  715. package/src/simple-tree/core/treeNodeSchema.ts +1 -1
  716. package/src/simple-tree/core/types.ts +16 -27
  717. package/src/simple-tree/core/withType.ts +3 -1
  718. package/src/simple-tree/index.ts +29 -21
  719. package/src/simple-tree/leafNodeSchema.ts +24 -28
  720. package/src/simple-tree/mapNode.ts +47 -29
  721. package/src/simple-tree/objectNode.ts +51 -46
  722. package/src/simple-tree/proxies.ts +22 -51
  723. package/src/simple-tree/proxyBinding.ts +3 -254
  724. package/src/simple-tree/schemaTypes.ts +8 -8
  725. package/src/simple-tree/toFlexSchema.ts +40 -7
  726. package/src/simple-tree/toMapTree.ts +113 -79
  727. package/src/simple-tree/treeNodeValid.ts +10 -13
  728. package/src/simple-tree/typesUnsafe.ts +13 -13
  729. package/src/simple-tree/walkSchema.ts +81 -0
  730. package/src/treeFactory.ts +2 -1
  731. package/src/util/typeUtils.ts +2 -2
  732. package/dist/core/revertible/index.d.ts.map +0 -1
  733. package/dist/core/revertible/index.js +0 -10
  734. package/dist/core/revertible/index.js.map +0 -1
  735. package/dist/core/revertible/revertible.d.ts.map +0 -1
  736. package/dist/core/revertible/revertible.js.map +0 -1
  737. package/dist/domains/index.d.ts +0 -8
  738. package/dist/domains/index.d.ts.map +0 -1
  739. package/dist/domains/index.js +0 -20
  740. package/dist/domains/index.js.map +0 -1
  741. package/dist/domains/json/index.d.ts +0 -7
  742. package/dist/domains/json/index.d.ts.map +0 -1
  743. package/dist/domains/json/index.js +0 -17
  744. package/dist/domains/json/index.js.map +0 -1
  745. package/dist/domains/json/jsonCursor.d.ts +0 -52
  746. package/dist/domains/json/jsonCursor.d.ts.map +0 -1
  747. package/dist/domains/json/jsonCursor.js +0 -197
  748. package/dist/domains/json/jsonCursor.js.map +0 -1
  749. package/dist/domains/json/jsonDomainSchema.d.ts +0 -24
  750. package/dist/domains/json/jsonDomainSchema.d.ts.map +0 -1
  751. package/dist/domains/json/jsonDomainSchema.js +0 -32
  752. package/dist/domains/json/jsonDomainSchema.js.map +0 -1
  753. package/dist/domains/leafDomain.d.ts +0 -72
  754. package/dist/domains/leafDomain.d.ts.map +0 -1
  755. package/dist/domains/leafDomain.js +0 -88
  756. package/dist/domains/leafDomain.js.map +0 -1
  757. package/dist/domains/schemaBuilder.d.ts +0 -103
  758. package/dist/domains/schemaBuilder.d.ts.map +0 -1
  759. package/dist/domains/schemaBuilder.js +0 -121
  760. package/dist/domains/schemaBuilder.js.map +0 -1
  761. package/dist/domains/testRecursiveDomain.d.ts +0 -17
  762. package/dist/domains/testRecursiveDomain.d.ts.map +0 -1
  763. package/dist/domains/testRecursiveDomain.js +0 -35
  764. package/dist/domains/testRecursiveDomain.js.map +0 -1
  765. package/dist/events/events.d.ts +0 -207
  766. package/dist/events/events.d.ts.map +0 -1
  767. package/dist/events/events.js.map +0 -1
  768. package/dist/feature-libraries/schemaBuilder.d.ts +0 -31
  769. package/dist/feature-libraries/schemaBuilder.d.ts.map +0 -1
  770. package/dist/feature-libraries/schemaBuilder.js +0 -40
  771. package/dist/feature-libraries/schemaBuilder.js.map +0 -1
  772. package/dist/feature-libraries/schemaBuilderBase.d.ts +0 -191
  773. package/dist/feature-libraries/schemaBuilderBase.d.ts.map +0 -1
  774. package/dist/feature-libraries/schemaBuilderBase.js +0 -201
  775. package/dist/feature-libraries/schemaBuilderBase.js.map +0 -1
  776. package/dist/shared-tree/treeView.d.ts +0 -73
  777. package/dist/shared-tree/treeView.d.ts.map +0 -1
  778. package/dist/shared-tree/treeView.js.map +0 -1
  779. package/dist/simple-tree/getJsonSchema.d.ts.map +0 -1
  780. package/dist/simple-tree/getJsonSchema.js.map +0 -1
  781. package/dist/simple-tree/getSimpleSchema.d.ts.map +0 -1
  782. package/dist/simple-tree/getSimpleSchema.js.map +0 -1
  783. package/dist/simple-tree/jsonSchema.d.ts.map +0 -1
  784. package/dist/simple-tree/jsonSchema.js.map +0 -1
  785. package/dist/simple-tree/simpleSchema.d.ts.map +0 -1
  786. package/dist/simple-tree/simpleSchema.js.map +0 -1
  787. package/dist/simple-tree/simpleSchemaToJsonSchema.d.ts.map +0 -1
  788. package/dist/simple-tree/simpleSchemaToJsonSchema.js.map +0 -1
  789. package/dist/simple-tree/viewSchemaToSimpleSchema.d.ts.map +0 -1
  790. package/dist/simple-tree/viewSchemaToSimpleSchema.js.map +0 -1
  791. package/lib/core/revertible/index.d.ts.map +0 -1
  792. package/lib/core/revertible/index.js.map +0 -1
  793. package/lib/core/revertible/revertible.d.ts.map +0 -1
  794. package/lib/core/revertible/revertible.js.map +0 -1
  795. package/lib/domains/index.d.ts +0 -8
  796. package/lib/domains/index.d.ts.map +0 -1
  797. package/lib/domains/index.js +0 -8
  798. package/lib/domains/index.js.map +0 -1
  799. package/lib/domains/json/index.d.ts +0 -7
  800. package/lib/domains/json/index.d.ts.map +0 -1
  801. package/lib/domains/json/index.js +0 -7
  802. package/lib/domains/json/index.js.map +0 -1
  803. package/lib/domains/json/jsonCursor.d.ts +0 -52
  804. package/lib/domains/json/jsonCursor.d.ts.map +0 -1
  805. package/lib/domains/json/jsonCursor.js +0 -192
  806. package/lib/domains/json/jsonCursor.js.map +0 -1
  807. package/lib/domains/json/jsonDomainSchema.d.ts +0 -24
  808. package/lib/domains/json/jsonDomainSchema.d.ts.map +0 -1
  809. package/lib/domains/json/jsonDomainSchema.js +0 -29
  810. package/lib/domains/json/jsonDomainSchema.js.map +0 -1
  811. package/lib/domains/leafDomain.d.ts +0 -72
  812. package/lib/domains/leafDomain.d.ts.map +0 -1
  813. package/lib/domains/leafDomain.js +0 -85
  814. package/lib/domains/leafDomain.js.map +0 -1
  815. package/lib/domains/schemaBuilder.d.ts +0 -103
  816. package/lib/domains/schemaBuilder.d.ts.map +0 -1
  817. package/lib/domains/schemaBuilder.js +0 -117
  818. package/lib/domains/schemaBuilder.js.map +0 -1
  819. package/lib/domains/testRecursiveDomain.d.ts +0 -17
  820. package/lib/domains/testRecursiveDomain.d.ts.map +0 -1
  821. package/lib/domains/testRecursiveDomain.js +0 -32
  822. package/lib/domains/testRecursiveDomain.js.map +0 -1
  823. package/lib/events/events.d.ts +0 -207
  824. package/lib/events/events.d.ts.map +0 -1
  825. package/lib/events/events.js.map +0 -1
  826. package/lib/feature-libraries/schemaBuilder.d.ts +0 -31
  827. package/lib/feature-libraries/schemaBuilder.d.ts.map +0 -1
  828. package/lib/feature-libraries/schemaBuilder.js +0 -36
  829. package/lib/feature-libraries/schemaBuilder.js.map +0 -1
  830. package/lib/feature-libraries/schemaBuilderBase.d.ts +0 -191
  831. package/lib/feature-libraries/schemaBuilderBase.d.ts.map +0 -1
  832. package/lib/feature-libraries/schemaBuilderBase.js +0 -195
  833. package/lib/feature-libraries/schemaBuilderBase.js.map +0 -1
  834. package/lib/shared-tree/treeView.d.ts +0 -73
  835. package/lib/shared-tree/treeView.d.ts.map +0 -1
  836. package/lib/shared-tree/treeView.js.map +0 -1
  837. package/lib/simple-tree/getJsonSchema.d.ts.map +0 -1
  838. package/lib/simple-tree/getJsonSchema.js.map +0 -1
  839. package/lib/simple-tree/getSimpleSchema.d.ts.map +0 -1
  840. package/lib/simple-tree/getSimpleSchema.js.map +0 -1
  841. package/lib/simple-tree/jsonSchema.d.ts.map +0 -1
  842. package/lib/simple-tree/jsonSchema.js.map +0 -1
  843. package/lib/simple-tree/simpleSchema.d.ts.map +0 -1
  844. package/lib/simple-tree/simpleSchema.js.map +0 -1
  845. package/lib/simple-tree/simpleSchemaToJsonSchema.d.ts.map +0 -1
  846. package/lib/simple-tree/simpleSchemaToJsonSchema.js.map +0 -1
  847. package/lib/simple-tree/viewSchemaToSimpleSchema.d.ts.map +0 -1
  848. package/src/domains/README.md +0 -6
  849. package/src/domains/fence.json +0 -5
  850. package/src/domains/index.ts +0 -19
  851. package/src/domains/json/fence.json +0 -5
  852. package/src/domains/json/index.ts +0 -13
  853. package/src/domains/json/jsonCursor.ts +0 -247
  854. package/src/domains/json/jsonDomainSchema.ts +0 -47
  855. package/src/domains/leafDomain.ts +0 -97
  856. package/src/domains/schemaBuilder.ts +0 -153
  857. package/src/domains/testRecursiveDomain.ts +0 -38
  858. package/src/events/fence.json +0 -5
  859. package/src/feature-libraries/schemaBuilder.ts +0 -45
  860. package/src/feature-libraries/schemaBuilderBase.ts +0 -393
  861. package/src/shared-tree/treeView.ts +0 -113
  862. /package/dist/core/{revertible/revertible.js → revertible.js} +0 -0
  863. /package/dist/simple-tree/{jsonSchema.js → api/jsonSchema.js} +0 -0
  864. /package/dist/simple-tree/{simpleSchema.js → api/simpleSchema.js} +0 -0
  865. /package/dist/simple-tree/{simpleSchemaToJsonSchema.d.ts → api/simpleSchemaToJsonSchema.d.ts} +0 -0
  866. /package/lib/core/{revertible/revertible.js → revertible.js} +0 -0
  867. /package/lib/simple-tree/{jsonSchema.js → api/jsonSchema.js} +0 -0
  868. /package/lib/simple-tree/{simpleSchema.js → api/simpleSchema.js} +0 -0
  869. /package/lib/simple-tree/{simpleSchemaToJsonSchema.d.ts → api/simpleSchemaToJsonSchema.d.ts} +0 -0
@@ -4,7 +4,7 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.schemaIsObjectNode = exports.schemaIsLeaf = exports.schemaIsMap = exports.intoStoredSchemaCollection = exports.intoStoredSchema = exports.allowedTypesToTypeSet = exports.allowedTypesSchemaSet = exports.FlexFieldSchema = exports.allowedTypesIsAny = exports.Any = exports.FlexObjectNodeSchema = exports.LeafNodeSchema = exports.FlexMapNodeSchema = exports.TreeNodeSchemaBase = void 0;
7
+ exports.schemaIsObjectNode = exports.schemaIsLeaf = exports.schemaIsMap = exports.intoStoredSchemaCollection = exports.intoStoredSchema = exports.allowedTypesToTypeSet = exports.allowedTypesSchemaSet = exports.FlexFieldSchema = exports.FlexObjectNodeSchema = exports.LeafNodeSchema = exports.FlexMapNodeSchema = exports.TreeNodeSchemaBase = void 0;
8
8
  const internal_1 = require("@fluidframework/core-utils/internal");
9
9
  const index_js_1 = require("../../core/index.js");
10
10
  const index_js_2 = require("../../util/index.js");
@@ -43,11 +43,8 @@ exports.FlexMapNodeSchema = FlexMapNodeSchema;
43
43
  /**
44
44
  */
45
45
  class LeafNodeSchema extends TreeNodeSchemaBase {
46
- get leafValue() {
47
- return this.info;
48
- }
49
- static create(builder, name, specification) {
50
- return new LeafNodeSchema(builder, name, specification, new index_js_1.LeafNodeStoredSchema(specification));
46
+ constructor(builder, name, specification) {
47
+ super(builder, (0, index_js_2.brand)(name), specification, new index_js_1.LeafNodeStoredSchema(specification));
51
48
  }
52
49
  getFieldSchema(field) {
53
50
  return FlexFieldSchema.empty;
@@ -96,17 +93,6 @@ function normalizeField(t) {
96
93
  (0, internal_1.assert)(t instanceof FlexFieldSchema, 0x6ae /* invalid TreeFieldSchema */);
97
94
  return t;
98
95
  }
99
- /**
100
- * Allow any node (as long as it meets the schema for its own type).
101
- */
102
- exports.Any = "Any";
103
- /**
104
- * Checks if an {@link FlexAllowedTypes} is {@link (Any:type)}.
105
- */
106
- function allowedTypesIsAny(t) {
107
- return t.length === 1 && t[0] === exports.Any;
108
- }
109
- exports.allowedTypesIsAny = allowedTypesIsAny;
110
96
  /**
111
97
  * All policy for a specific field,
112
98
  * including functionality that does not have to be kept consistent across versions or deterministic.
@@ -130,15 +116,6 @@ class FlexFieldSchema {
130
116
  static create(kind, allowedTypes) {
131
117
  return new FlexFieldSchema(kind, allowedTypes);
132
118
  }
133
- /**
134
- * Constructs a TreeFieldSchema, but missing the extends clause which breaks most recursive types.
135
- * @remarks
136
- * `Types` here must extend `AllowedTypes`, but this cannot be enforced with an "extends" clause: see {@link Unenforced} for details.
137
- * Prefer {@link FlexFieldSchema.create} when possible.
138
- */
139
- static createUnsafe(kind, allowedTypes) {
140
- return new FlexFieldSchema(kind, allowedTypes);
141
- }
142
119
  /**
143
120
  * @param kind - The {@link https://en.wikipedia.org/wiki/Kind_(type_theory) | kind} of this field.
144
121
  * Determine the multiplicity, viewing and editing APIs as well as the merge resolution policy.
@@ -150,10 +127,7 @@ class FlexFieldSchema {
150
127
  // Since this class can't have the desired extends clause, do some extra runtime validation:
151
128
  (0, internal_1.assert)(Array.isArray(allowedTypes), 0x7bc /* Invalid allowedTypes */);
152
129
  for (const allowedType of allowedTypes) {
153
- if (allowedType === exports.Any) {
154
- (0, internal_1.assert)(allowedTypes.length === 1, 0x7bd /* Invalid Any in allowedTypes */);
155
- }
156
- else if (typeof allowedType !== "function") {
130
+ if (typeof allowedType !== "function") {
157
131
  (0, internal_1.assert)(allowedType instanceof TreeNodeSchemaBase, 0x7be /* Invalid entry in allowedTypes */);
158
132
  }
159
133
  }
@@ -163,7 +137,7 @@ class FlexFieldSchema {
163
137
  return {
164
138
  names: allowedTypesToTypeSet(input),
165
139
  schema,
166
- monomorphicChildType: schema !== exports.Any ? (0, index_js_2.oneFromSet)(schema) : undefined,
140
+ monomorphicChildType: (0, index_js_2.oneFromSet)(schema),
167
141
  };
168
142
  });
169
143
  this.lazyTypes = lazy;
@@ -234,9 +208,6 @@ FlexFieldSchema.empty = FlexFieldSchema.create(index_js_3.FieldKinds.forbidden,
234
208
  * Convert {@link FlexAllowedTypes} to {@link TreeTypeSet}.
235
209
  */
236
210
  function allowedTypesSchemaSet(t) {
237
- if (allowedTypesIsAny(t)) {
238
- return exports.Any;
239
- }
240
211
  const list = t.map((value) => {
241
212
  if (typeof value === "function") {
242
213
  return value();
@@ -251,9 +222,6 @@ exports.allowedTypesSchemaSet = allowedTypesSchemaSet;
251
222
  */
252
223
  function allowedTypesToTypeSet(t) {
253
224
  const list = allowedTypesSchemaSet(t);
254
- if (list === exports.Any) {
255
- return undefined;
256
- }
257
225
  const names = Array.from(list, (type) => {
258
226
  (0, internal_1.assert)(type instanceof TreeNodeSchemaBase, 0x7bf /* invalid allowed type */);
259
227
  return type.name;
@@ -1 +1 @@
1
- {"version":3,"file":"typedTreeSchema.js","sourceRoot":"","sources":["../../../src/feature-libraries/typed-schema/typedTreeSchema.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAAmE;AAEnE,kDAc6B;AAC7B,kDAS6B;AAC7B,yDAAwD;AAIxD,iDAAoE;AAwBpE,CAAC;AAED,CAAC;AAED;;;;GAIG;AACH,MAAsB,kBAAkB;IAKvC,YACiB,OAAsB,EACtB,IAAoC,EACpC,IAAmB,EACnB,MAA4B;QAH5B,YAAO,GAAP,OAAO,CAAe;QACtB,SAAI,GAAJ,IAAI,CAAgC;QACpC,SAAI,GAAJ,IAAI,CAAe;QACnB,WAAM,GAAN,MAAM,CAAsB;IAC1C,CAAC;CAEJ;AAZD,gDAYC;AAED;GACG;AACH,MAAa,iBAGX,SAAQ,kBAAuC;IAChD,IAAW,SAAS;QACnB,OAAO,IAAI,CAAC,IAA0B,CAAC;IACxC,CAAC;IAGM,MAAM,CAAC,MAAM,CAInB,OAAsB,EACtB,IAAoC,EACpC,aAA4B;QAE5B,OAAO,IAAI,iBAAiB,CAC3B,OAAO,EACP,IAAI,EACJ,aAAa,EACb,IAAI,8BAAmB,CAAC,aAAa,CAAC,MAAM,CAAC,CAC7C,CAAC;IACH,CAAC;IAEe,cAAc,CAAC,KAAe;QAC7C,OAAO,IAAI,CAAC,IAA0B,CAAC;IACxC,CAAC;CACD;AA5BD,8CA4BC;AAED;GACG;A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E5B,OAAO;QACN,UAAU,EAAE,IAAI,GAAG,CAClB,IAAA,sBAAW,EAAC,UAAU,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CACvE;KACD,CAAC;AACH,CAAC;AARD,gEAQC;AAgBD,8HAA8H;AAE9H;;GAEG;AACH,SAAgB,WAAW,CAAC,MAA0B;IACrD,OAAO,MAAM,YAAY,iBAAiB,CAAC;AAC5C,CAAC;AAFD,kCAEC;AAED;;GAEG;AACH,SAAgB,YAAY,CAAC,MAA0B;IACtD,OAAO,MAAM,YAAY,cAAc,CAAC;AACzC,CAAC;AAFD,oCAEC;AAED;;GAEG;AACH,SAAgB,kBAAkB,CACjC,MAA0B;IAE1B,OAAO,MAAM,YAAY,oBAAoB,CAAC;AAC/C,CAAC;AAJD,gDAIC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, Lazy } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\ttype Adapters,\n\ttype FieldKey,\n\tLeafNodeStoredSchema,\n\tMapNodeStoredSchema,\n\tObjectNodeStoredSchema,\n\ttype StoredSchemaCollection,\n\ttype TreeFieldStoredSchema,\n\ttype TreeNodeSchemaIdentifier,\n\ttype TreeNodeStoredSchema,\n\ttype TreeStoredSchema,\n\ttype TreeTypeSet,\n\ttype ValueSchema,\n\tidentifierFieldKindIdentifier,\n} from \"../../core/index.js\";\nimport {\n\ttype Assume,\n\ttype MakeNominal,\n\ttype Named,\n\tcompareSets,\n\tmapIterable,\n\toneFromSet,\n\ttype requireAssignableTo,\n\tfilterIterable,\n} from \"../../util/index.js\";\nimport { FieldKinds } from \"../default-schema/index.js\";\nimport type { FlexFieldKind, FullSchemaPolicy } from \"../modular-schema/index.js\";\n\nimport type { LazyItem } from \"./flexList.js\";\nimport { type ObjectToMap, objectToMapTyped } from \"./typeUtils.js\";\n\n/**\n */\nexport interface FlexObjectNodeFields {\n\treadonly [key: string]: FlexFieldSchema;\n}\n\n/**\n */\nexport type NormalizeObjectNodeFields<T extends FlexObjectNodeFields> = {\n\treadonly [Property in keyof T]: NormalizeField<T[Property]>;\n};\n\n/**\n * A placeholder to use in {@link https://www.typescriptlang.org/docs/handbook/2/generics.html#generic-constraints | extends constraints} when using the real type breaks compilation of some recursive types due to {@link https://github.com/microsoft/TypeScript/issues/55758 | a design limitation of TypeScript}.\n *\n * These extends constraints only serve as documentation:\n * to avoid breaking compilation, this type has to not actually enforce anything, and thus is just `unknown`.\n * Therefore the type safety is the responsibility of the user of the API.\n * @public\n */\nexport type Unenforced<_DesiredExtendsConstraint> = unknown;\n\n{\n\ttype _check = requireAssignableTo<FlexTreeNodeSchema, Unenforced<FlexTreeNodeSchema>>;\n}\n\n/**\n * T must extend TreeSchemaSpecification.\n * This can not be enforced using TypeScript since doing so breaks recursive type support.\n * See note on SchemaBuilder.fieldRecursive.\n */\nexport abstract class TreeNodeSchemaBase<\n\tconst out Name extends string = string,\n\tconst out Specification = unknown,\n> {\n\tprotected _typeCheck!: MakeNominal;\n\tprotected constructor(\n\t\tpublic readonly builder: Named<string>,\n\t\tpublic readonly name: TreeNodeSchemaIdentifier<Name>,\n\t\tpublic readonly info: Specification,\n\t\tpublic readonly stored: TreeNodeStoredSchema,\n\t) {}\n\tpublic abstract getFieldSchema(field: FieldKey): FlexFieldSchema;\n}\n\n/**\n */\nexport class FlexMapNodeSchema<\n\tconst out Name extends string = string,\n\tconst out Specification extends Unenforced<FlexMapFieldSchema> = FlexMapFieldSchema,\n> extends TreeNodeSchemaBase<Name, Specification> {\n\tpublic get mapFields(): FlexMapFieldSchema {\n\t\treturn this.info as FlexMapFieldSchema;\n\t}\n\n\tprotected _typeCheck2?: MakeNominal;\n\tpublic static create<\n\t\tconst Name extends string,\n\t\tconst Specification extends FlexMapFieldSchema,\n\t>(\n\t\tbuilder: Named<string>,\n\t\tname: TreeNodeSchemaIdentifier<Name>,\n\t\tspecification: Specification,\n\t): FlexMapNodeSchema<Name, Specification> {\n\t\treturn new FlexMapNodeSchema(\n\t\t\tbuilder,\n\t\t\tname,\n\t\t\tspecification,\n\t\t\tnew MapNodeStoredSchema(specification.stored),\n\t\t);\n\t}\n\n\tpublic override getFieldSchema(field: FieldKey): FlexMapFieldSchema {\n\t\treturn this.info as FlexMapFieldSchema;\n\t}\n}\n\n/**\n */\nexport class LeafNodeSchema<\n\tconst out Name extends string = string,\n\tconst out Specification extends Unenforced<ValueSchema> = ValueSchema,\n> extends TreeNodeSchemaBase<Name, Specification> {\n\tpublic get leafValue(): ValueSchema {\n\t\treturn this.info as ValueSchema;\n\t}\n\n\tprotected _typeCheck2?: MakeNominal;\n\tpublic static create<const Name extends string, const Specification extends ValueSchema>(\n\t\tbuilder: Named<string>,\n\t\tname: TreeNodeSchemaIdentifier<Name>,\n\t\tspecification: Specification,\n\t): LeafNodeSchema<Name, Specification> {\n\t\treturn new LeafNodeSchema(\n\t\t\tbuilder,\n\t\t\tname,\n\t\t\tspecification,\n\t\t\tnew LeafNodeStoredSchema(specification),\n\t\t);\n\t}\n\n\tpublic override getFieldSchema(field: FieldKey): FlexFieldSchema {\n\t\treturn FlexFieldSchema.empty;\n\t}\n}\n\n/**\n */\nexport class FlexObjectNodeSchema<\n\tconst out Name extends string = string,\n\tconst out Specification extends Unenforced<FlexObjectNodeFields> = FlexObjectNodeFields,\n> extends TreeNodeSchemaBase<Name, Specification> {\n\tprotected _typeCheck2?: MakeNominal;\n\tpublic readonly identifierFieldKeys: readonly FieldKey[] = [];\n\n\tpublic static create<\n\t\tconst Name extends string,\n\t\tconst Specification extends FlexObjectNodeFields,\n\t>(\n\t\tbuilder: Named<string>,\n\t\tname: TreeNodeSchemaIdentifier<Name>,\n\t\tspecification: Specification,\n\t): FlexObjectNodeSchema<Name, Specification> {\n\t\tconst objectNodeFieldsObject: NormalizeObjectNodeFields<Specification> =\n\t\t\tnormalizeStructFields<Specification>(specification);\n\t\tconst objectNodeFields: ObjectToMap<\n\t\t\tNormalizeObjectNodeFields<Specification>,\n\t\t\tFieldKey,\n\t\t\tFlexFieldSchema\n\t\t> = objectToMapTyped(objectNodeFieldsObject);\n\t\treturn new FlexObjectNodeSchema(\n\t\t\tbuilder,\n\t\t\tname,\n\t\t\tspecification,\n\t\t\tobjectNodeFieldsObject,\n\t\t\tobjectNodeFields,\n\t\t);\n\t}\n\n\tprivate constructor(\n\t\tbuilder: Named<string>,\n\t\tname: TreeNodeSchemaIdentifier<Name>,\n\t\tinfo: Specification,\n\t\tpublic readonly objectNodeFieldsObject: NormalizeObjectNodeFields<\n\t\t\tAssume<Specification, FlexObjectNodeFields>\n\t\t>,\n\t\t// Allows reading fields through the normal map.\n\t\t// Stricter typing caused Specification to no longer be covariant, so has been removed.\n\t\tpublic readonly objectNodeFields: ReadonlyMap<FieldKey, FlexFieldSchema>,\n\t) {\n\t\tconst fields = mapIterable(objectNodeFields, ([k, v]) => [k, v.stored] as const);\n\t\tsuper(builder, name, info, new ObjectNodeStoredSchema(new Map(fields)));\n\t\tthis.identifierFieldKeys = Array.from(\n\t\t\tfilterIterable(\n\t\t\t\tobjectNodeFields.entries(),\n\t\t\t\t([k, f]) => f.kind.identifier === identifierFieldKindIdentifier,\n\t\t\t),\n\t\t\t([k]) => k,\n\t\t);\n\t}\n\n\tpublic override getFieldSchema(field: FieldKey): FlexFieldSchema {\n\t\treturn this.objectNodeFields.get(field) ?? FlexFieldSchema.empty;\n\t}\n}\n\n/**\n * @privateRemarks\n * This could be an exhaustive union, or just the common base type.\n * Using just the base type prevents exhaustive matching, which has both pros and cons.\n *\n * For now this is using just the base type since the union is causing issues with schema aware typing, likely due to it being a union and thus distributing over extends clauses.\n */\nexport type FlexTreeNodeSchema = TreeNodeSchemaBase;\n\n/**\n * Convert FieldSchemaSpecification | undefined into TreeFieldSchema.\n */\nexport type NormalizeField<T extends FlexFieldSchema | undefined> = T extends FlexFieldSchema\n\t? T\n\t: FlexFieldSchema<typeof FieldKinds.forbidden, []>;\n\nfunction normalizeStructFields<T extends FlexObjectNodeFields>(\n\tfields: T,\n): NormalizeObjectNodeFields<T> {\n\tconst out: Record<string, FlexFieldSchema> = {};\n\t// eslint-disable-next-line no-restricted-syntax\n\tfor (const key in fields) {\n\t\tif (Object.prototype.hasOwnProperty.call(fields, key)) {\n\t\t\tconst element = fields[key];\n\t\t\tout[key] = normalizeField(element);\n\t\t}\n\t}\n\treturn out as NormalizeObjectNodeFields<T>;\n}\n\nfunction normalizeField<T extends FlexFieldSchema | undefined>(t: T): NormalizeField<T> {\n\tif (t === undefined) {\n\t\treturn FlexFieldSchema.empty as unknown as NormalizeField<T>;\n\t}\n\n\tassert(t instanceof FlexFieldSchema, 0x6ae /* invalid TreeFieldSchema */);\n\treturn t as NormalizeField<T>;\n}\n\n/**\n * Allow any node (as long as it meets the schema for its own type).\n */\nexport const Any = \"Any\" as const;\n/**\n * Allow any node (as long as it meets the schema for its own type).\n */\nexport type Any = typeof Any;\n\n/**\n * Tree type, but can be wrapped in a function to allow referring to types before they are declared.\n * This makes recursive and co-recursive types possible.\n */\nexport type LazyTreeNodeSchema = FlexTreeNodeSchema | (() => FlexTreeNodeSchema);\n\n/**\n * Types for use in fields.\n *\n * \"Any\" is boxed in an array to allow use as variadic parameter.\n */\nexport type FlexAllowedTypes = readonly [Any] | readonly LazyItem<FlexTreeNodeSchema>[];\n\n/**\n * Checks if an {@link FlexAllowedTypes} is {@link (Any:type)}.\n */\nexport function allowedTypesIsAny(t: FlexAllowedTypes): t is readonly [Any] {\n\treturn t.length === 1 && t[0] === Any;\n}\n\n/**\n * Subset of TreeFieldSchema thats legal in maps.\n * This requires empty to be a valid value for the map.\n */\nexport type FlexMapFieldSchema = FlexFieldSchema<\n\ttypeof FieldKinds.optional | typeof FieldKinds.sequence\n>;\n\n/**\n * All policy for a specific field,\n * including functionality that does not have to be kept consistent across versions or deterministic.\n *\n * This can include policy for how to use this schema for \"view\" purposes, and well as how to expose editing APIs.\n *\n * @remarks\n * `Types` here must extend `AllowedTypes`, but this cannot be enforced with an \"extends\" clause: see {@link Unenforced} for details.\n *\n * @typeParam TKind - The kind of field.\n * @typeParam TTypes - The types allowed by the field.\n *\n * @sealed\n */\nexport class FlexFieldSchema<\n\tout TKind extends FlexFieldKind = FlexFieldKind,\n\tconst out TTypes extends Unenforced<FlexAllowedTypes> = FlexAllowedTypes,\n> {\n\t/**\n\t * Schema for a field which must always be empty.\n\t */\n\tpublic static readonly empty = FlexFieldSchema.create(FieldKinds.forbidden, []);\n\n\t/**\n\t * Constructs a TreeFieldSchema.\n\t * @privateRemarks\n\t * Alias for the constructor, but with extends clause for the `Types` parameter that {@link FlexFieldSchema} can not have (due to recursive type issues).\n\t */\n\tpublic static create<TKind extends FlexFieldKind, const Types extends FlexAllowedTypes>(\n\t\tkind: TKind,\n\t\tallowedTypes: Types,\n\t): FlexFieldSchema<TKind, Types> {\n\t\treturn new FlexFieldSchema(kind, allowedTypes);\n\t}\n\n\t/**\n\t * Constructs a TreeFieldSchema, but missing the extends clause which breaks most recursive types.\n\t * @remarks\n\t * `Types` here must extend `AllowedTypes`, but this cannot be enforced with an \"extends\" clause: see {@link Unenforced} for details.\n\t * Prefer {@link FlexFieldSchema.create} when possible.\n\t */\n\tpublic static createUnsafe<\n\t\tTKind extends FlexFieldKind,\n\t\tconst Types extends Unenforced<FlexAllowedTypes>,\n\t>(kind: TKind, allowedTypes: Types): FlexFieldSchema<TKind, Types> {\n\t\treturn new FlexFieldSchema(kind, allowedTypes);\n\t}\n\n\tprotected _typeCheck!: MakeNominal;\n\n\t/**\n\t * This is computed lazily since types can be recursive, which makes evaluating this have to happen after all the schema are defined.\n\t */\n\tprivate readonly lazyTypes: Lazy<{\n\t\tnames: TreeTypeSet;\n\t\tschema: AllowedTypeSet;\n\t\tmonomorphicChildType?: FlexTreeNodeSchema;\n\t}>;\n\n\t/**\n\t * @param kind - The {@link https://en.wikipedia.org/wiki/Kind_(type_theory) | kind} of this field.\n\t * Determine the multiplicity, viewing and editing APIs as well as the merge resolution policy.\n\t * @param allowedTypes - What types of tree nodes are allowed in this field.\n\t */\n\tprivate constructor(\n\t\tpublic readonly kind: TKind,\n\t\tpublic readonly allowedTypes: TTypes,\n\t) {\n\t\t// Since this class can't have the desired extends clause, do some extra runtime validation:\n\t\tassert(Array.isArray(allowedTypes), 0x7bc /* Invalid allowedTypes */);\n\t\tfor (const allowedType of allowedTypes) {\n\t\t\tif (allowedType === Any) {\n\t\t\t\tassert(allowedTypes.length === 1, 0x7bd /* Invalid Any in allowedTypes */);\n\t\t\t} else if (typeof allowedType !== \"function\") {\n\t\t\t\tassert(\n\t\t\t\t\tallowedType instanceof TreeNodeSchemaBase,\n\t\t\t\t\t0x7be /* Invalid entry in allowedTypes */,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tconst lazy = new Lazy(() => {\n\t\t\tconst input = this.allowedTypes as unknown as FlexAllowedTypes;\n\t\t\tconst schema = allowedTypesSchemaSet(input);\n\t\t\treturn {\n\t\t\t\tnames: allowedTypesToTypeSet(input),\n\t\t\t\tschema,\n\t\t\t\tmonomorphicChildType: schema !== Any ? oneFromSet(schema) : undefined,\n\t\t\t};\n\t\t});\n\n\t\tthis.lazyTypes = lazy;\n\n\t\tthis.stored = {\n\t\t\tkind: this.kind.identifier,\n\t\t\tget types() {\n\t\t\t\treturn lazy.value.names;\n\t\t\t},\n\t\t};\n\t}\n\n\tpublic readonly stored: TreeFieldStoredSchema;\n\n\t/**\n\t * Types which are allowed in this field (by {@link TreeNodeSchemaIdentifier}), in a format optimized for stored schema.\n\t * This is the same set of types in {@link FlexFieldSchema.allowedTypes}, just in a different format.\n\t */\n\tpublic get types(): TreeTypeSet {\n\t\treturn this.lazyTypes.value.names;\n\t}\n\n\t/**\n\t * Types which are allowed in this field.\n\t * This is the same set of types in {@link FlexFieldSchema.allowedTypes}, just as a set with laziness removed.\n\t * @privateRemarks\n\t * TODO:\n\t * 3 ways to access the allowed types are now exposed.\n\t * Reducing this and/or renaming the more friendly options to take the shorter name (`types`)\n\t * would be a good idea.\n\t */\n\tpublic get allowedTypeSet(): AllowedTypeSet {\n\t\treturn this.lazyTypes.value.schema;\n\t}\n\n\t/**\n\t * If exactly one type of child is allowed in this field, it is provided here.\n\t * @remarks\n\t * Some code paths (like unboxing and compressed tree encoding) special case schema with exactly one allowed type.\n\t * This field allows for simple and optimized handling of this case.\n\t */\n\tpublic get monomorphicChildType(): FlexTreeNodeSchema | undefined {\n\t\treturn this.lazyTypes.value.monomorphicChildType;\n\t}\n\n\t/**\n\t * Compare this schema to another.\n\t *\n\t * @returns true iff the schema are identical.\n\t */\n\tpublic equals(other: FlexFieldSchema): boolean {\n\t\tif (other.kind !== this.kind) {\n\t\t\treturn false;\n\t\t}\n\t\tif (other.types === undefined) {\n\t\t\treturn this.types === undefined;\n\t\t}\n\t\tif (this.types === undefined) {\n\t\t\treturn false;\n\t\t}\n\t\treturn compareSets({\n\t\t\ta: this.types,\n\t\t\tb: other.types,\n\t\t\taExtra: () => false,\n\t\t\tbExtra: () => false,\n\t\t});\n\t}\n}\n\n/**\n * Types for use in fields.\n * This representation is optimized for runtime use in view-schema.\n *\n * @remarks\n * See {@link TreeTypeSet} for a stored-schema compatible version using the {@link TreeNodeSchemaIdentifier}.\n * See {@link FlexAllowedTypes} for a compile time optimized version.\n */\nexport type AllowedTypeSet = Any | ReadonlySet<FlexTreeNodeSchema>;\n\n/**\n * Convert {@link FlexAllowedTypes} to {@link TreeTypeSet}.\n */\nexport function allowedTypesSchemaSet(t: FlexAllowedTypes): AllowedTypeSet {\n\tif (allowedTypesIsAny(t)) {\n\t\treturn Any;\n\t}\n\tconst list: FlexTreeNodeSchema[] = t.map((value: LazyItem<FlexTreeNodeSchema>) => {\n\t\tif (typeof value === \"function\") {\n\t\t\treturn value();\n\t\t}\n\t\treturn value;\n\t});\n\treturn new Set(list);\n}\n\n/**\n * Convert {@link FlexAllowedTypes} to {@link TreeTypeSet}.\n */\nexport function allowedTypesToTypeSet(t: FlexAllowedTypes): TreeTypeSet {\n\tconst list = allowedTypesSchemaSet(t);\n\tif (list === Any) {\n\t\treturn undefined;\n\t}\n\tconst names = Array.from(list, (type) => {\n\t\tassert(type instanceof TreeNodeSchemaBase, 0x7bf /* invalid allowed type */);\n\t\treturn type.name;\n\t});\n\treturn new Set(names);\n}\n\n/**\n * Schema data that can be be used to view a document.\n * Strongly typed over its rootFieldSchema.\n *\n * @remarks\n * The type of the rootFieldSchema is used to implement SchemaAware APIs.\n * Cases that do not require being compile time schema aware can omit the explicit type for it.\n */\nexport interface FlexTreeSchema<out T extends FlexFieldSchema = FlexFieldSchema>\n\textends SchemaCollection {\n\t/**\n\t * Schema for the root field which contains the whole tree.\n\t */\n\treadonly rootFieldSchema: T;\n\t/**\n\t * Extra configuration for how this schema is handled at runtime.\n\t */\n\treadonly policy: FullSchemaPolicy;\n\t/**\n\t * Compatibility information how how to interact with content who's stored schema is not directly compatible with this schema.\n\t */\n\treadonly adapters: Adapters;\n}\n\n/**\n * Converts a {@link FlexTreeSchema} into a {@link TreeStoredSchema}.\n */\nexport function intoStoredSchema(treeSchema: FlexTreeSchema): TreeStoredSchema {\n\treturn {\n\t\trootFieldSchema: treeSchema.rootFieldSchema.stored,\n\t\t...intoStoredSchemaCollection(treeSchema),\n\t};\n}\n\n/**\n * Converts a {@link SchemaCollection} into a {@link StoredSchemaCollection}.\n */\nexport function intoStoredSchemaCollection(\n\ttreeSchema: SchemaCollection,\n): StoredSchemaCollection {\n\treturn {\n\t\tnodeSchema: new Map(\n\t\t\tmapIterable(treeSchema.nodeSchema.entries(), ([k, v]) => [k, v.stored]),\n\t\t),\n\t};\n}\n\n/**\n * Schema data that can be be used to view a document.\n *\n * @privateRemarks\n * It is convenient that this can be used as a StoredSchemaCollection with no conversion.\n * There there isn't a design requirement for this however, so this extends clause can be removed later if needed.\n */\nexport interface SchemaCollection {\n\t/**\n\t * {@inheritdoc SchemaCollection}\n\t */\n\treadonly nodeSchema: ReadonlyMap<TreeNodeSchemaIdentifier, FlexTreeNodeSchema>;\n}\n\n// These schema type narrowing functions are preferred over `instanceof` due to being easier to migrate to class based schema.\n\n/**\n * Checks if a {@link FlexTreeNodeSchema} is a {@link FlexMapNodeSchema}.\n */\nexport function schemaIsMap(schema: FlexTreeNodeSchema): schema is FlexMapNodeSchema {\n\treturn schema instanceof FlexMapNodeSchema;\n}\n\n/**\n * Checks if a {@link FlexTreeNodeSchema} is a {@link LeafNodeSchema}.\n */\nexport function schemaIsLeaf(schema: FlexTreeNodeSchema): schema is LeafNodeSchema {\n\treturn schema instanceof LeafNodeSchema;\n}\n\n/**\n * Checks if a {@link FlexTreeNodeSchema} is a {@link FlexObjectNodeSchema}.\n */\nexport function schemaIsObjectNode(\n\tschema: FlexTreeNodeSchema,\n): schema is FlexObjectNodeSchema {\n\treturn schema instanceof FlexObjectNodeSchema;\n}\n"]}
1
+ {"version":3,"file":"typedTreeSchema.js","sourceRoot":"","sources":["../../../src/feature-libraries/typed-schema/typedTreeSchema.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAAmE;AAEnE,kDAc6B;AAC7B,kDAS6B;AAC7B,yDAAwD;AAIxD,iDAAoE;AAkBpE,CAAC;AAED,CAAC;AAED;;;;GAIG;AACH,MAAsB,kBAAkB;IAEvC,YACiB,OAAsB,EACtB,IAA8B,EAC9B,IAAmB,EACnB,MAA4B;QAH5B,YAAO,GAAP,OAAO,CAAe;QACtB,SAAI,GAAJ,IAAI,CAA0B;QAC9B,SAAI,GAAJ,IAAI,CAAe;QACnB,WAAM,GAAN,MAAM,CAAsB;IAC1C,CAAC;CAEJ;AATD,gDASC;AAED;GACG;AACH,MAAa,iBAAkB,SAAQ,kBAAkB;IACxD,IAAW,SAAS;QACnB,OAAO,IAAI,CAAC,IAA0B,CAAC;IACxC,CAAC;IAGM,MAAM,CAAC,MAAM,CACnB,OAAsB,EACtB,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,MAAM,YAAY,oBAAoB,CAAC;AAC/C,CAAC;AAJD,gDAIC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, Lazy } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\ttype Adapters,\n\ttype FieldKey,\n\tLeafNodeStoredSchema,\n\tMapNodeStoredSchema,\n\tObjectNodeStoredSchema,\n\ttype StoredSchemaCollection,\n\ttype TreeFieldStoredSchema,\n\ttype TreeNodeSchemaIdentifier,\n\ttype TreeNodeStoredSchema,\n\ttype TreeStoredSchema,\n\ttype TreeTypeSet,\n\ttype ValueSchema,\n\tidentifierFieldKindIdentifier,\n} from \"../../core/index.js\";\nimport {\n\ttype MakeNominal,\n\ttype Named,\n\tcompareSets,\n\tmapIterable,\n\toneFromSet,\n\ttype requireAssignableTo,\n\tfilterIterable,\n\tbrand,\n} from \"../../util/index.js\";\nimport { FieldKinds } from \"../default-schema/index.js\";\nimport type { FlexFieldKind, FullSchemaPolicy } from \"../modular-schema/index.js\";\n\nimport type { LazyItem } from \"./flexList.js\";\nimport { type ObjectToMap, objectToMapTyped } from \"./typeUtils.js\";\n\n/**\n */\nexport interface FlexObjectNodeFields {\n\treadonly [key: string]: FlexFieldSchema;\n}\n\n/**\n * A placeholder to use in {@link https://www.typescriptlang.org/docs/handbook/2/generics.html#generic-constraints | extends constraints} when using the real type breaks compilation of some recursive types due to {@link https://github.com/microsoft/TypeScript/issues/55758 | a design limitation of TypeScript}.\n *\n * These extends constraints only serve as documentation:\n * to avoid breaking compilation, this type has to not actually enforce anything, and thus is just `unknown`.\n * Therefore the type safety is the responsibility of the user of the API.\n * @public\n */\nexport type Unenforced<_DesiredExtendsConstraint> = unknown;\n\n{\n\ttype _check = requireAssignableTo<FlexTreeNodeSchema, Unenforced<FlexTreeNodeSchema>>;\n}\n\n/**\n * T must extend TreeSchemaSpecification.\n * This can not be enforced using TypeScript since doing so breaks recursive type support.\n * See note on SchemaBuilder.fieldRecursive.\n */\nexport abstract class TreeNodeSchemaBase<const out Specification = unknown> {\n\tprotected _typeCheck!: MakeNominal;\n\tprotected constructor(\n\t\tpublic readonly builder: Named<string>,\n\t\tpublic readonly name: TreeNodeSchemaIdentifier,\n\t\tpublic readonly info: Specification,\n\t\tpublic readonly stored: TreeNodeStoredSchema,\n\t) {}\n\tpublic abstract getFieldSchema(field: FieldKey): FlexFieldSchema;\n}\n\n/**\n */\nexport class FlexMapNodeSchema extends TreeNodeSchemaBase {\n\tpublic get mapFields(): FlexMapFieldSchema {\n\t\treturn this.info as FlexMapFieldSchema;\n\t}\n\n\tprotected _typeCheck2?: MakeNominal;\n\tpublic static create<const Name extends string>(\n\t\tbuilder: Named<string>,\n\t\tname: TreeNodeSchemaIdentifier<Name>,\n\t\tspecification: FlexMapFieldSchema,\n\t): FlexMapNodeSchema {\n\t\treturn new FlexMapNodeSchema(\n\t\t\tbuilder,\n\t\t\tname,\n\t\t\tspecification,\n\t\t\tnew MapNodeStoredSchema(specification.stored),\n\t\t);\n\t}\n\n\tpublic override getFieldSchema(field: FieldKey): FlexMapFieldSchema {\n\t\treturn this.info as FlexMapFieldSchema;\n\t}\n}\n\n/**\n */\nexport class LeafNodeSchema extends TreeNodeSchemaBase<ValueSchema> {\n\tprotected _typeCheck2?: MakeNominal;\n\tpublic constructor(builder: Named<string>, name: string, specification: ValueSchema) {\n\t\tsuper(builder, brand(name), specification, new LeafNodeStoredSchema(specification));\n\t}\n\n\tpublic override getFieldSchema(field: FieldKey): FlexFieldSchema {\n\t\treturn FlexFieldSchema.empty;\n\t}\n}\n\n/**\n */\nexport class FlexObjectNodeSchema extends TreeNodeSchemaBase {\n\tprotected _typeCheck2?: MakeNominal;\n\tpublic readonly identifierFieldKeys: readonly FieldKey[] = [];\n\n\tpublic static create(\n\t\tbuilder: Named<string>,\n\t\tname: TreeNodeSchemaIdentifier,\n\t\tspecification: FlexObjectNodeFields,\n\t): FlexObjectNodeSchema {\n\t\tconst objectNodeFieldsObject = normalizeStructFields(specification);\n\t\tconst objectNodeFields: ObjectToMap<FlexObjectNodeFields, FieldKey, FlexFieldSchema> =\n\t\t\tobjectToMapTyped(objectNodeFieldsObject);\n\t\treturn new FlexObjectNodeSchema(\n\t\t\tbuilder,\n\t\t\tname,\n\t\t\tspecification,\n\t\t\tobjectNodeFieldsObject,\n\t\t\tobjectNodeFields,\n\t\t);\n\t}\n\n\tprivate constructor(\n\t\tbuilder: Named<string>,\n\t\tname: TreeNodeSchemaIdentifier,\n\t\tinfo: FlexObjectNodeFields,\n\t\tpublic readonly objectNodeFieldsObject: FlexObjectNodeFields,\n\t\t// Allows reading fields through the normal map.\n\t\t// Stricter typing caused Specification to no longer be covariant, so has been removed.\n\t\tpublic readonly objectNodeFields: ReadonlyMap<FieldKey, FlexFieldSchema>,\n\t) {\n\t\tconst fields = mapIterable(objectNodeFields, ([k, v]) => [k, v.stored] as const);\n\t\tsuper(builder, name, info, new ObjectNodeStoredSchema(new Map(fields)));\n\t\tthis.identifierFieldKeys = Array.from(\n\t\t\tfilterIterable(\n\t\t\t\tobjectNodeFields.entries(),\n\t\t\t\t([k, f]) => f.kind.identifier === identifierFieldKindIdentifier,\n\t\t\t),\n\t\t\t([k]) => k,\n\t\t);\n\t}\n\n\tpublic override getFieldSchema(field: FieldKey): FlexFieldSchema {\n\t\treturn this.objectNodeFields.get(field) ?? FlexFieldSchema.empty;\n\t}\n}\n\n/**\n * @privateRemarks\n * This could be an exhaustive union, or just the common base type.\n * Using just the base type prevents exhaustive matching, which has both pros and cons.\n *\n * For now this is using just the base type since the union is causing issues with schema aware typing, likely due to it being a union and thus distributing over extends clauses.\n */\nexport type FlexTreeNodeSchema = TreeNodeSchemaBase;\n\nfunction normalizeStructFields<T extends FlexObjectNodeFields>(\n\tfields: T,\n): FlexObjectNodeFields {\n\tconst out: Record<string, FlexFieldSchema> = {};\n\t// eslint-disable-next-line no-restricted-syntax\n\tfor (const key in fields) {\n\t\tif (Object.prototype.hasOwnProperty.call(fields, key)) {\n\t\t\tconst element = fields[key];\n\t\t\tout[key] = normalizeField(element);\n\t\t}\n\t}\n\treturn out;\n}\n\nfunction normalizeField(t: FlexFieldSchema | undefined): FlexFieldSchema {\n\tif (t === undefined) {\n\t\treturn FlexFieldSchema.empty;\n\t}\n\n\tassert(t instanceof FlexFieldSchema, 0x6ae /* invalid TreeFieldSchema */);\n\treturn t;\n}\n\n/**\n * Tree type, but can be wrapped in a function to allow referring to types before they are declared.\n * This makes recursive and co-recursive types possible.\n */\nexport type LazyTreeNodeSchema = FlexTreeNodeSchema | (() => FlexTreeNodeSchema);\n\n/**\n * Types for use in fields.\n */\nexport type FlexAllowedTypes = readonly LazyItem<FlexTreeNodeSchema>[];\n\n/**\n * Subset of TreeFieldSchema thats legal in maps.\n * This requires empty to be a valid value for the map.\n */\nexport type FlexMapFieldSchema = FlexFieldSchema<\n\ttypeof FieldKinds.optional | typeof FieldKinds.sequence\n>;\n\n/**\n * All policy for a specific field,\n * including functionality that does not have to be kept consistent across versions or deterministic.\n *\n * This can include policy for how to use this schema for \"view\" purposes, and well as how to expose editing APIs.\n *\n * @remarks\n * `Types` here must extend `AllowedTypes`, but this cannot be enforced with an \"extends\" clause: see {@link Unenforced} for details.\n *\n * @typeParam TKind - The kind of field.\n * @typeParam TTypes - The types allowed by the field.\n *\n * @sealed\n */\nexport class FlexFieldSchema<out TKind extends FlexFieldKind = FlexFieldKind> {\n\t/**\n\t * Schema for a field which must always be empty.\n\t */\n\tpublic static readonly empty = FlexFieldSchema.create(FieldKinds.forbidden, []);\n\n\t/**\n\t * Constructs a TreeFieldSchema.\n\t * @privateRemarks\n\t * Alias for the constructor, but with extends clause for the `Types` parameter that {@link FlexFieldSchema} can not have (due to recursive type issues).\n\t */\n\tpublic static create<TKind extends FlexFieldKind>(\n\t\tkind: TKind,\n\t\tallowedTypes: FlexAllowedTypes,\n\t): FlexFieldSchema<TKind> {\n\t\treturn new FlexFieldSchema(kind, allowedTypes);\n\t}\n\n\tprotected _typeCheck!: MakeNominal;\n\n\t/**\n\t * This is computed lazily since types can be recursive, which makes evaluating this have to happen after all the schema are defined.\n\t */\n\tprivate readonly lazyTypes: Lazy<{\n\t\tnames: TreeTypeSet;\n\t\tschema: AllowedTypeSet;\n\t\tmonomorphicChildType?: FlexTreeNodeSchema;\n\t}>;\n\n\t/**\n\t * @param kind - The {@link https://en.wikipedia.org/wiki/Kind_(type_theory) | kind} of this field.\n\t * Determine the multiplicity, viewing and editing APIs as well as the merge resolution policy.\n\t * @param allowedTypes - What types of tree nodes are allowed in this field.\n\t */\n\tprivate constructor(\n\t\tpublic readonly kind: TKind,\n\t\tpublic readonly allowedTypes: FlexAllowedTypes,\n\t) {\n\t\t// Since this class can't have the desired extends clause, do some extra runtime validation:\n\t\tassert(Array.isArray(allowedTypes), 0x7bc /* Invalid allowedTypes */);\n\t\tfor (const allowedType of allowedTypes) {\n\t\t\tif (typeof allowedType !== \"function\") {\n\t\t\t\tassert(\n\t\t\t\t\tallowedType instanceof TreeNodeSchemaBase,\n\t\t\t\t\t0x7be /* Invalid entry in allowedTypes */,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tconst lazy = new Lazy(() => {\n\t\t\tconst input = this.allowedTypes as unknown as FlexAllowedTypes;\n\t\t\tconst schema = allowedTypesSchemaSet(input);\n\t\t\treturn {\n\t\t\t\tnames: allowedTypesToTypeSet(input),\n\t\t\t\tschema,\n\t\t\t\tmonomorphicChildType: oneFromSet(schema),\n\t\t\t};\n\t\t});\n\n\t\tthis.lazyTypes = lazy;\n\n\t\tthis.stored = {\n\t\t\tkind: this.kind.identifier,\n\t\t\tget types() {\n\t\t\t\treturn lazy.value.names;\n\t\t\t},\n\t\t};\n\t}\n\n\tpublic readonly stored: TreeFieldStoredSchema;\n\n\t/**\n\t * Types which are allowed in this field (by {@link TreeNodeSchemaIdentifier}), in a format optimized for stored schema.\n\t * This is the same set of types in {@link FlexFieldSchema.allowedTypes}, just in a different format.\n\t */\n\tpublic get types(): TreeTypeSet {\n\t\treturn this.lazyTypes.value.names;\n\t}\n\n\t/**\n\t * Types which are allowed in this field.\n\t * This is the same set of types in {@link FlexFieldSchema.allowedTypes}, just as a set with laziness removed.\n\t * @privateRemarks\n\t * TODO:\n\t * 3 ways to access the allowed types are now exposed.\n\t * Reducing this and/or renaming the more friendly options to take the shorter name (`types`)\n\t * would be a good idea.\n\t */\n\tpublic get allowedTypeSet(): AllowedTypeSet {\n\t\treturn this.lazyTypes.value.schema;\n\t}\n\n\t/**\n\t * If exactly one type of child is allowed in this field, it is provided here.\n\t * @remarks\n\t * Some code paths (like unboxing and compressed tree encoding) special case schema with exactly one allowed type.\n\t * This field allows for simple and optimized handling of this case.\n\t */\n\tpublic get monomorphicChildType(): FlexTreeNodeSchema | undefined {\n\t\treturn this.lazyTypes.value.monomorphicChildType;\n\t}\n\n\t/**\n\t * Compare this schema to another.\n\t *\n\t * @returns true iff the schema are identical.\n\t */\n\tpublic equals(other: FlexFieldSchema): boolean {\n\t\tif (other.kind !== this.kind) {\n\t\t\treturn false;\n\t\t}\n\t\tif (other.types === undefined) {\n\t\t\treturn this.types === undefined;\n\t\t}\n\t\tif (this.types === undefined) {\n\t\t\treturn false;\n\t\t}\n\t\treturn compareSets({\n\t\t\ta: this.types,\n\t\t\tb: other.types,\n\t\t\taExtra: () => false,\n\t\t\tbExtra: () => false,\n\t\t});\n\t}\n}\n\n/**\n * Types for use in fields.\n * This representation is optimized for runtime use in view-schema.\n *\n * @remarks\n * See {@link TreeTypeSet} for a stored-schema compatible version using the {@link TreeNodeSchemaIdentifier}.\n * See {@link FlexAllowedTypes} for a compile time optimized version.\n */\nexport type AllowedTypeSet = ReadonlySet<FlexTreeNodeSchema>;\n\n/**\n * Convert {@link FlexAllowedTypes} to {@link TreeTypeSet}.\n */\nexport function allowedTypesSchemaSet(t: FlexAllowedTypes): AllowedTypeSet {\n\tconst list: FlexTreeNodeSchema[] = t.map((value: LazyItem<FlexTreeNodeSchema>) => {\n\t\tif (typeof value === \"function\") {\n\t\t\treturn value();\n\t\t}\n\t\treturn value;\n\t});\n\treturn new Set(list);\n}\n\n/**\n * Convert {@link FlexAllowedTypes} to {@link TreeTypeSet}.\n */\nexport function allowedTypesToTypeSet(t: FlexAllowedTypes): TreeTypeSet {\n\tconst list = allowedTypesSchemaSet(t);\n\tconst names = Array.from(list, (type) => {\n\t\tassert(type instanceof TreeNodeSchemaBase, 0x7bf /* invalid allowed type */);\n\t\treturn type.name;\n\t});\n\treturn new Set(names);\n}\n\n/**\n * Schema data that can be be used to view a document.\n * Strongly typed over its rootFieldSchema.\n *\n * @remarks\n * The type of the rootFieldSchema is used to implement SchemaAware APIs.\n * Cases that do not require being compile time schema aware can omit the explicit type for it.\n */\nexport interface FlexTreeSchema<out T extends FlexFieldSchema = FlexFieldSchema>\n\textends SchemaCollection {\n\t/**\n\t * Schema for the root field which contains the whole tree.\n\t */\n\treadonly rootFieldSchema: T;\n\t/**\n\t * Extra configuration for how this schema is handled at runtime.\n\t */\n\treadonly policy: FullSchemaPolicy;\n\t/**\n\t * Compatibility information how how to interact with content who's stored schema is not directly compatible with this schema.\n\t */\n\treadonly adapters: Adapters;\n}\n\n/**\n * Converts a {@link FlexTreeSchema} into a {@link TreeStoredSchema}.\n */\nexport function intoStoredSchema(treeSchema: FlexTreeSchema): TreeStoredSchema {\n\treturn {\n\t\trootFieldSchema: treeSchema.rootFieldSchema.stored,\n\t\t...intoStoredSchemaCollection(treeSchema),\n\t};\n}\n\n/**\n * Converts a {@link SchemaCollection} into a {@link StoredSchemaCollection}.\n */\nexport function intoStoredSchemaCollection(\n\ttreeSchema: SchemaCollection,\n): StoredSchemaCollection {\n\treturn {\n\t\tnodeSchema: new Map(\n\t\t\tmapIterable(treeSchema.nodeSchema.entries(), ([k, v]) => [k, v.stored]),\n\t\t),\n\t};\n}\n\n/**\n * Schema data that can be be used to view a document.\n *\n * @privateRemarks\n * It is convenient that this can be used as a StoredSchemaCollection with no conversion.\n * There there isn't a design requirement for this however, so this extends clause can be removed later if needed.\n */\nexport interface SchemaCollection {\n\t/**\n\t * {@inheritdoc SchemaCollection}\n\t */\n\treadonly nodeSchema: ReadonlyMap<TreeNodeSchemaIdentifier, FlexTreeNodeSchema>;\n}\n\n// These schema type narrowing functions are preferred over `instanceof` due to being easier to migrate to class based schema.\n\n/**\n * Checks if a {@link FlexTreeNodeSchema} is a {@link FlexMapNodeSchema}.\n */\nexport function schemaIsMap(schema: FlexTreeNodeSchema): schema is FlexMapNodeSchema {\n\treturn schema instanceof FlexMapNodeSchema;\n}\n\n/**\n * Checks if a {@link FlexTreeNodeSchema} is a {@link LeafNodeSchema}.\n */\nexport function schemaIsLeaf(schema: FlexTreeNodeSchema): schema is LeafNodeSchema {\n\treturn schema instanceof LeafNodeSchema;\n}\n\n/**\n * Checks if a {@link FlexTreeNodeSchema} is a {@link FlexObjectNodeSchema}.\n */\nexport function schemaIsObjectNode(\n\tschema: FlexTreeNodeSchema,\n): schema is FlexObjectNodeSchema {\n\treturn schema instanceof FlexObjectNodeSchema;\n}\n"]}
@@ -5,19 +5,17 @@
5
5
  import { AdaptedViewSchema, type Adapters, Compatibility, type TreeStoredSchema } from "../../core/index.js";
6
6
  import { type Named } from "../../util/index.js";
7
7
  import { type FullSchemaPolicy } from "../modular-schema/index.js";
8
- import { type FlexFieldSchema, type FlexTreeSchema } from "./typedTreeSchema.js";
9
8
  /**
10
9
  * A collection of View information for schema, including policy.
11
10
  */
12
- export declare class ViewSchema<out TSchema extends FlexFieldSchema = FlexFieldSchema> {
11
+ export declare class ViewSchema {
13
12
  readonly policy: FullSchemaPolicy;
14
13
  readonly adapters: Adapters;
15
- readonly schema: FlexTreeSchema<TSchema>;
14
+ readonly storedSchema: TreeStoredSchema;
16
15
  /**
17
- * Cached conversion of `schema` into a stored schema.
16
+ * @param storedSchema - Cached conversion of view schema into a stored schema.
18
17
  */
19
- readonly storedSchema: TreeStoredSchema;
20
- constructor(policy: FullSchemaPolicy, adapters: Adapters, schema: FlexTreeSchema<TSchema>);
18
+ constructor(policy: FullSchemaPolicy, adapters: Adapters, storedSchema: TreeStoredSchema);
21
19
  /**
22
20
  * Determines the compatibility of a stored document
23
21
  * (based on its stored schema) with a viewer (based on its view schema).
@@ -1 +1 @@
1
- {"version":3,"file":"view.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/typed-schema/view.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,iBAAiB,EACjB,KAAK,QAAQ,EACb,aAAa,EAIb,KAAK,gBAAgB,EACrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,KAAK,KAAK,EAAQ,MAAM,qBAAqB,CAAC;AACvD,OAAO,EACN,KAAK,gBAAgB,EAGrB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACN,KAAK,eAAe,EACpB,KAAK,cAAc,EAEnB,MAAM,sBAAsB,CAAC;AAE9B;;GAEG;AACH,qBAAa,UAAU,CAAC,GAAG,CAAC,OAAO,SAAS,eAAe,GAAG,eAAe;aAM3D,MAAM,EAAE,gBAAgB;aACxB,QAAQ,EAAE,QAAQ;aAClB,MAAM,EAAE,cAAc,CAAC,OAAO,CAAC;IAPhD;;OAEG;IACH,SAAgB,YAAY,EAAE,gBAAgB,CAAC;gBAE9B,MAAM,EAAE,gBAAgB,EACxB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,cAAc,CAAC,OAAO,CAAC;IAKhD;;;;;;;;;OASG;IACI,kBAAkB,CAAC,MAAM,EAAE,gBAAgB,GAAG;QACpD,IAAI,EAAE,aAAa,CAAC;QACpB,KAAK,EAAE,aAAa,CAAC;QACrB,gCAAgC,EAAE,aAAa,CAAC;KAChD;IA6CD;;;;OAIG;IACI,SAAS,CAAC,MAAM,EAAE,gBAAgB,GAAG,iBAAiB;IAgC7D;;OAEG;IACH,OAAO,CAAC,UAAU;IAelB,OAAO,CAAC,SAAS;CAIjB;AAED;;GAEG;AACH,MAAM,WAAW,OAAO;IACvB,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CAChC"}
1
+ {"version":3,"file":"view.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/typed-schema/view.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,iBAAiB,EACjB,KAAK,QAAQ,EACb,aAAa,EAIb,KAAK,gBAAgB,EACrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,KAAK,KAAK,EAAQ,MAAM,qBAAqB,CAAC;AACvD,OAAO,EACN,KAAK,gBAAgB,EAGrB,MAAM,4BAA4B,CAAC;AAEpC;;GAEG;AACH,qBAAa,UAAU;aAKL,MAAM,EAAE,gBAAgB;aACxB,QAAQ,EAAE,QAAQ;aAClB,YAAY,EAAE,gBAAgB;IAN/C;;OAEG;gBAEc,MAAM,EAAE,gBAAgB,EACxB,QAAQ,EAAE,QAAQ,EAClB,YAAY,EAAE,gBAAgB;IAG/C;;;;;;;;;OASG;IACI,kBAAkB,CAAC,MAAM,EAAE,gBAAgB,GAAG;QACpD,IAAI,EAAE,aAAa,CAAC;QACpB,KAAK,EAAE,aAAa,CAAC;QACrB,gCAAgC,EAAE,aAAa,CAAC;KAChD;IA6CD;;;;OAIG;IACI,SAAS,CAAC,MAAM,EAAE,gBAAgB,GAAG,iBAAiB;IAgC7D;;OAEG;IACH,OAAO,CAAC,UAAU;IAelB,OAAO,CAAC,SAAS;CAIjB;AAED;;GAEG;AACH,MAAM,WAAW,OAAO;IACvB,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CAChC"}
@@ -8,16 +8,17 @@ exports.ViewSchema = void 0;
8
8
  const index_js_1 = require("../../core/index.js");
9
9
  const index_js_2 = require("../../util/index.js");
10
10
  const index_js_3 = require("../modular-schema/index.js");
11
- const typedTreeSchema_js_1 = require("./typedTreeSchema.js");
12
11
  /**
13
12
  * A collection of View information for schema, including policy.
14
13
  */
15
14
  class ViewSchema {
16
- constructor(policy, adapters, schema) {
15
+ /**
16
+ * @param storedSchema - Cached conversion of view schema into a stored schema.
17
+ */
18
+ constructor(policy, adapters, storedSchema) {
17
19
  this.policy = policy;
18
20
  this.adapters = adapters;
19
- this.schema = schema;
20
- this.storedSchema = (0, typedTreeSchema_js_1.intoStoredSchema)(schema);
21
+ this.storedSchema = storedSchema;
21
22
  }
22
23
  /**
23
24
  * Determines the compatibility of a stored document
@@ -1 +1 @@
1
- {"version":3,"file":"view.js","sourceRoot":"","sources":["../../../src/feature-libraries/typed-schema/view.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kDAQ6B;AAC7B,kDAAuD;AACvD,yDAIoC;AAEpC,6DAI8B;AAE9B;;GAEG;AACH,MAAa,UAAU;IAKtB,YACiB,MAAwB,EACxB,QAAkB,EAClB,MAA+B;QAF/B,WAAM,GAAN,MAAM,CAAkB;QACxB,aAAQ,GAAR,QAAQ,CAAU;QAClB,WAAM,GAAN,MAAM,CAAyB;QAE/C,IAAI,CAAC,YAAY,GAAG,IAAA,qCAAgB,EAAC,MAAM,CAAC,CAAC;IAC9C,CAAC;IAED;;;;;;;;;OASG;IACI,kBAAkB,CAAC,MAAwB;QAKjD,yBAAyB;QACzB,0CAA0C;QAE1C,MAAM,IAAI,GAAG,IAAA,6BAAkB,EAAC,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,YAAY,CAAC;YACtE,CAAC,CAAC,wBAAa,CAAC,UAAU;YAC1B,CAAC,CAAC,yBAAyB;gBAC1B,qFAAqF;gBACrF,mCAAmC;gBACnC,wBAAa,CAAC,YAAY,CAAC;QAC7B,mEAAmE;QACnE,8CAA8C;QAC9C,MAAM,KAAK,GAAG,IAAA,6BAAkB,EAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,YAAY,EAAE,MAAM,CAAC;YACvE,CAAC,CAAC,wBAAa,CAAC,UAAU;YAC1B,CAAC,CAAC,yBAAyB;gBAC1B,qFAAqF;gBACrF,kDAAkD;gBA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CAAC,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;YAC/C,MAAM,YAAY,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;YAC5C,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;QAC3C,CAAC;QAED,iEAAiE;QACjE,OAAO,IAAI,4BAAiB,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACtD,CAAC;IAED;;OAEG;IACK,UAAU,CAAC,QAA+B;QACjD,IAAI,QAAQ,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;YAClC,MAAM,KAAK,GAAkC,IAAI,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;YACrE,KAAK,MAAM,WAAW,IAAI,IAAI,CAAC,QAAQ,EAAE,IAAI,IAAI,EAAE,EAAE,CAAC;gBACrD,IAAI,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC;oBAClC,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;oBAChC,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;gBAC/B,CAAC;YACF,CAAC;YAED,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC;QACvC,CAAC;QACD,OAAO,QAAQ,CAAC;IACjB,CAAC;IAEO,SAAS,CAAC,QAA8B;QAC/C,sDAAsD;QACtD,OAAO,QAAQ,CAAC;IACjB,CAAC;CACD;AAnID,gCAmIC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tAdaptedViewSchema,\n\ttype Adapters,\n\tCompatibility,\n\ttype TreeFieldStoredSchema,\n\ttype TreeNodeSchemaIdentifier,\n\ttype TreeNodeStoredSchema,\n\ttype TreeStoredSchema,\n} from \"../../core/index.js\";\nimport { type Named, fail } from \"../../util/index.js\";\nimport {\n\ttype FullSchemaPolicy,\n\tallowsRepoSuperset,\n\tisNeverTree,\n} from \"../modular-schema/index.js\";\n\nimport {\n\ttype FlexFieldSchema,\n\ttype FlexTreeSchema,\n\tintoStoredSchema,\n} from \"./typedTreeSchema.js\";\n\n/**\n * A collection of View information for schema, including policy.\n */\nexport class ViewSchema<out TSchema extends FlexFieldSchema = FlexFieldSchema> {\n\t/**\n\t * Cached conversion of `schema` into a stored schema.\n\t */\n\tpublic readonly storedSchema: TreeStoredSchema;\n\tpublic constructor(\n\t\tpublic readonly policy: FullSchemaPolicy,\n\t\tpublic readonly adapters: Adapters,\n\t\tpublic readonly schema: FlexTreeSchema<TSchema>,\n\t) {\n\t\tthis.storedSchema = intoStoredSchema(schema);\n\t}\n\n\t/**\n\t * Determines the compatibility of a stored document\n\t * (based on its stored schema) with a viewer (based on its view schema).\n\t *\n\t * Adapters can be provided to handle differences between the two schema.\n\t * Adapters should only use to types in the `view` SchemaRepository.\n\t *\n\t * TODO: this API violates the parse don't validate design philosophy.\n\t * It should be wrapped with (or replaced by) a parse style API.\n\t */\n\tpublic checkCompatibility(stored: TreeStoredSchema): {\n\t\tread: Compatibility;\n\t\twrite: Compatibility;\n\t\twriteAllowingStoredSchemaUpdates: Compatibility;\n\t} {\n\t\t// TODO: support adapters\n\t\t// const adapted = this.adaptRepo(stored);\n\n\t\tconst read = allowsRepoSuperset(this.policy, stored, this.storedSchema)\n\t\t\t? Compatibility.Compatible\n\t\t\t: // TODO: support adapters\n\t\t\t\t// : allowsRepoSuperset(this.policy, adapted.adaptedForViewSchema, this.storedSchema)\n\t\t\t\t// ? Compatibility.RequiresAdapters\n\t\t\t\tCompatibility.Incompatible;\n\t\t// TODO: Extract subset of adapters that are valid to use on stored\n\t\t// TODO: separate adapters from schema updates\n\t\tconst write = allowsRepoSuperset(this.policy, this.storedSchema, stored)\n\t\t\t? Compatibility.Compatible\n\t\t\t: // TODO: support adapters\n\t\t\t\t// : allowsRepoSuperset(this.policy, this.storedSchema, adapted.adaptedForViewSchema)\n\t\t\t\t// TODO: IThis assumes adapters are bidirectional.\n\t\t\t\t// Compatibility.RequiresAdapters\n\t\t\t\tCompatibility.Incompatible;\n\n\t\t// TODO: compute this properly (and maybe include the set of schema changes needed for it?).\n\t\t// Maybe updates would happen lazily when needed to store data?\n\t\t// When willingness to updates can avoid need for some adapters,\n\t\t// how should it be decided if the adapter should be used to avoid the update?\n\t\t// TODO: is this case actually bi-variant, making this correct if we did it for each schema independently?\n\t\tlet writeAllowingStoredSchemaUpdates =\n\t\t\t// TODO: This should consider just the updates needed\n\t\t\t// (ex: when view covers a subset of stored after stored has a update to that subset).\n\t\t\tallowsRepoSuperset(this.policy, stored, this.storedSchema)\n\t\t\t\t? Compatibility.Compatible\n\t\t\t\t: // TODO: this assumes adapters can translate in both directions. In general this will not be true.\n\t\t\t\t\t// TODO: this also assumes that schema updates to the adapted repo would translate to\n\t\t\t\t\t// updates on the stored schema, which is also likely untrue.\n\t\t\t\t\t// // TODO: support adapters\n\t\t\t\t\t// allowsRepoSuperset(this.policy, adapted.adaptedForViewSchema, this.storedSchema)\n\t\t\t\t\t// ? Compatibility.RequiresAdapters // Requires schema updates. TODO: consider adapters that can update writes.\n\t\t\t\t\tCompatibility.Incompatible;\n\n\t\t// Since the above does not consider partial updates,\n\t\t// we can improve the tolerance a bit by considering the op-op update:\n\t\twriteAllowingStoredSchemaUpdates = Math.max(writeAllowingStoredSchemaUpdates, write);\n\n\t\treturn { read, write, writeAllowingStoredSchemaUpdates };\n\t}\n\n\t/**\n\t * Compute a schema that `original` could be viewed as using adapters as needed.\n\t *\n\t * TODO: have a way for callers to get invalidated on schema updates.\n\t */\n\tpublic adaptRepo(stored: TreeStoredSchema): AdaptedViewSchema {\n\t\t// Sanity check on adapters:\n\t\t// it's probably a bug it they use the never types,\n\t\t// since there never is a reason to have a never type as an adapter input,\n\t\t// and its impossible for an adapter to be correctly implemented if its output type is never\n\t\t// (unless its input is also never).\n\t\tfor (const adapter of this.adapters?.tree ?? []) {\n\t\t\tif (\n\t\t\t\tisNeverTree(\n\t\t\t\t\tthis.policy,\n\t\t\t\t\tthis.storedSchema,\n\t\t\t\t\tthis.storedSchema.nodeSchema.get(adapter.output),\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\tfail(\"tree adapter for stored adapter.output should not be never\");\n\t\t\t}\n\t\t}\n\n\t\tconst adapted = {\n\t\t\trootFieldSchema: this.adaptField(stored.rootFieldSchema),\n\t\t\tnodeSchema: new Map<TreeNodeSchemaIdentifier, TreeNodeStoredSchema>(),\n\t\t};\n\n\t\tfor (const [key, schema] of stored.nodeSchema) {\n\t\t\tconst adapatedTree = this.adaptTree(schema);\n\t\t\tadapted.nodeSchema.set(key, adapatedTree);\n\t\t}\n\n\t\t// TODO: subset these adapters to the ones that were needed/used.\n\t\treturn new AdaptedViewSchema(this.adapters, adapted);\n\t}\n\n\t/**\n\t * Adapt original such that it allows member types which can be adapted to its specified types.\n\t */\n\tprivate adaptField(original: TreeFieldStoredSchema): TreeFieldStoredSchema {\n\t\tif (original.types !== undefined) {\n\t\t\tconst types: Set<TreeNodeSchemaIdentifier> = new Set(original.types);\n\t\t\tfor (const treeAdapter of this.adapters?.tree ?? []) {\n\t\t\t\tif (types.has(treeAdapter.input)) {\n\t\t\t\t\ttypes.delete(treeAdapter.input);\n\t\t\t\t\ttypes.add(treeAdapter.output);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn { kind: original.kind, types };\n\t\t}\n\t\treturn original;\n\t}\n\n\tprivate adaptTree(original: TreeNodeStoredSchema): TreeNodeStoredSchema {\n\t\t// TODO: support adapters like missing field adapters.\n\t\treturn original;\n\t}\n}\n\n/**\n * Record where a schema came from for error reporting purposes.\n */\nexport interface Sourced {\n\treadonly builder: Named<string>;\n}\n"]}
1
+ {"version":3,"file":"view.js","sourceRoot":"","sources":["../../../src/feature-libraries/typed-schema/view.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,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AAC,KAAK,CAAC,CAAC;YACrE,KAAK,MAAM,WAAW,IAAI,IAAI,CAAC,QAAQ,EAAE,IAAI,IAAI,EAAE,EAAE,CAAC;gBACrD,IAAI,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC;oBAClC,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;oBAChC,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;gBAC/B,CAAC;YACF,CAAC;YAED,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC;QACvC,CAAC;QACD,OAAO,QAAQ,CAAC;IACjB,CAAC;IAEO,SAAS,CAAC,QAA8B;QAC/C,sDAAsD;QACtD,OAAO,QAAQ,CAAC;IACjB,CAAC;CACD;AAhID,gCAgIC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tAdaptedViewSchema,\n\ttype Adapters,\n\tCompatibility,\n\ttype TreeFieldStoredSchema,\n\ttype TreeNodeSchemaIdentifier,\n\ttype TreeNodeStoredSchema,\n\ttype TreeStoredSchema,\n} from \"../../core/index.js\";\nimport { type Named, fail } from \"../../util/index.js\";\nimport {\n\ttype FullSchemaPolicy,\n\tallowsRepoSuperset,\n\tisNeverTree,\n} from \"../modular-schema/index.js\";\n\n/**\n * A collection of View information for schema, including policy.\n */\nexport class ViewSchema {\n\t/**\n\t * @param storedSchema - Cached conversion of view schema into a stored schema.\n\t */\n\tpublic constructor(\n\t\tpublic readonly policy: FullSchemaPolicy,\n\t\tpublic readonly adapters: Adapters,\n\t\tpublic readonly storedSchema: TreeStoredSchema,\n\t) {}\n\n\t/**\n\t * Determines the compatibility of a stored document\n\t * (based on its stored schema) with a viewer (based on its view schema).\n\t *\n\t * Adapters can be provided to handle differences between the two schema.\n\t * Adapters should only use to types in the `view` SchemaRepository.\n\t *\n\t * TODO: this API violates the parse don't validate design philosophy.\n\t * It should be wrapped with (or replaced by) a parse style API.\n\t */\n\tpublic checkCompatibility(stored: TreeStoredSchema): {\n\t\tread: Compatibility;\n\t\twrite: Compatibility;\n\t\twriteAllowingStoredSchemaUpdates: Compatibility;\n\t} {\n\t\t// TODO: support adapters\n\t\t// const adapted = this.adaptRepo(stored);\n\n\t\tconst read = allowsRepoSuperset(this.policy, stored, this.storedSchema)\n\t\t\t? Compatibility.Compatible\n\t\t\t: // TODO: support adapters\n\t\t\t\t// : allowsRepoSuperset(this.policy, adapted.adaptedForViewSchema, this.storedSchema)\n\t\t\t\t// ? Compatibility.RequiresAdapters\n\t\t\t\tCompatibility.Incompatible;\n\t\t// TODO: Extract subset of adapters that are valid to use on stored\n\t\t// TODO: separate adapters from schema updates\n\t\tconst write = allowsRepoSuperset(this.policy, this.storedSchema, stored)\n\t\t\t? Compatibility.Compatible\n\t\t\t: // TODO: support adapters\n\t\t\t\t// : allowsRepoSuperset(this.policy, this.storedSchema, adapted.adaptedForViewSchema)\n\t\t\t\t// TODO: IThis assumes adapters are bidirectional.\n\t\t\t\t// Compatibility.RequiresAdapters\n\t\t\t\tCompatibility.Incompatible;\n\n\t\t// TODO: compute this properly (and maybe include the set of schema changes needed for it?).\n\t\t// Maybe updates would happen lazily when needed to store data?\n\t\t// When willingness to updates can avoid need for some adapters,\n\t\t// how should it be decided if the adapter should be used to avoid the update?\n\t\t// TODO: is this case actually bi-variant, making this correct if we did it for each schema independently?\n\t\tlet writeAllowingStoredSchemaUpdates =\n\t\t\t// TODO: This should consider just the updates needed\n\t\t\t// (ex: when view covers a subset of stored after stored has a update to that subset).\n\t\t\tallowsRepoSuperset(this.policy, stored, this.storedSchema)\n\t\t\t\t? Compatibility.Compatible\n\t\t\t\t: // TODO: this assumes adapters can translate in both directions. In general this will not be true.\n\t\t\t\t\t// TODO: this also assumes that schema updates to the adapted repo would translate to\n\t\t\t\t\t// updates on the stored schema, which is also likely untrue.\n\t\t\t\t\t// // TODO: support adapters\n\t\t\t\t\t// allowsRepoSuperset(this.policy, adapted.adaptedForViewSchema, this.storedSchema)\n\t\t\t\t\t// ? Compatibility.RequiresAdapters // Requires schema updates. TODO: consider adapters that can update writes.\n\t\t\t\t\tCompatibility.Incompatible;\n\n\t\t// Since the above does not consider partial updates,\n\t\t// we can improve the tolerance a bit by considering the op-op update:\n\t\twriteAllowingStoredSchemaUpdates = Math.max(writeAllowingStoredSchemaUpdates, write);\n\n\t\treturn { read, write, writeAllowingStoredSchemaUpdates };\n\t}\n\n\t/**\n\t * Compute a schema that `original` could be viewed as using adapters as needed.\n\t *\n\t * TODO: have a way for callers to get invalidated on schema updates.\n\t */\n\tpublic adaptRepo(stored: TreeStoredSchema): AdaptedViewSchema {\n\t\t// Sanity check on adapters:\n\t\t// it's probably a bug it they use the never types,\n\t\t// since there never is a reason to have a never type as an adapter input,\n\t\t// and its impossible for an adapter to be correctly implemented if its output type is never\n\t\t// (unless its input is also never).\n\t\tfor (const adapter of this.adapters?.tree ?? []) {\n\t\t\tif (\n\t\t\t\tisNeverTree(\n\t\t\t\t\tthis.policy,\n\t\t\t\t\tthis.storedSchema,\n\t\t\t\t\tthis.storedSchema.nodeSchema.get(adapter.output),\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\tfail(\"tree adapter for stored adapter.output should not be never\");\n\t\t\t}\n\t\t}\n\n\t\tconst adapted = {\n\t\t\trootFieldSchema: this.adaptField(stored.rootFieldSchema),\n\t\t\tnodeSchema: new Map<TreeNodeSchemaIdentifier, TreeNodeStoredSchema>(),\n\t\t};\n\n\t\tfor (const [key, schema] of stored.nodeSchema) {\n\t\t\tconst adapatedTree = this.adaptTree(schema);\n\t\t\tadapted.nodeSchema.set(key, adapatedTree);\n\t\t}\n\n\t\t// TODO: subset these adapters to the ones that were needed/used.\n\t\treturn new AdaptedViewSchema(this.adapters, adapted);\n\t}\n\n\t/**\n\t * Adapt original such that it allows member types which can be adapted to its specified types.\n\t */\n\tprivate adaptField(original: TreeFieldStoredSchema): TreeFieldStoredSchema {\n\t\tif (original.types !== undefined) {\n\t\t\tconst types: Set<TreeNodeSchemaIdentifier> = new Set(original.types);\n\t\t\tfor (const treeAdapter of this.adapters?.tree ?? []) {\n\t\t\t\tif (types.has(treeAdapter.input)) {\n\t\t\t\t\ttypes.delete(treeAdapter.input);\n\t\t\t\t\ttypes.add(treeAdapter.output);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn { kind: original.kind, types };\n\t\t}\n\t\treturn original;\n\t}\n\n\tprivate adaptTree(original: TreeNodeStoredSchema): TreeNodeStoredSchema {\n\t\t// TODO: support adapters like missing field adapters.\n\t\treturn original;\n\t}\n}\n\n/**\n * Record where a schema came from for error reporting purposes.\n */\nexport interface Sourced {\n\treadonly builder: Named<string>;\n}\n"]}
package/dist/index.d.ts CHANGED
@@ -2,12 +2,12 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- export { EmptyKey, type FieldKey, type TreeValue, type FieldMapObject, type NodeData, type GenericTreeNode, type JsonableTree, type GenericFieldsNode, type TreeNodeSchemaIdentifier, type TreeFieldStoredSchema, ValueSchema, TreeNodeStoredSchema, type FieldKindIdentifier, type TreeTypeSet, type TreeStoredSchema, type Revertible, CommitKind, RevertibleStatus, type CommitMetadata, type StoredSchemaCollection, type ErasedTreeNodeSchemaDataFormat, ObjectNodeStoredSchema, MapNodeStoredSchema, LeafNodeStoredSchema, } from "./core/index.js";
5
+ export { EmptyKey, type FieldKey, type TreeValue, type FieldMapObject, type NodeData, type GenericTreeNode, type JsonableTree, type GenericFieldsNode, type TreeNodeSchemaIdentifier, type TreeFieldStoredSchema, ValueSchema, TreeNodeStoredSchema, type FieldKindIdentifier, type TreeTypeSet, type TreeStoredSchema, type Revertible, CommitKind, RevertibleStatus, type CommitMetadata, type StoredSchemaCollection, type ErasedTreeNodeSchemaDataFormat, ObjectNodeStoredSchema, MapNodeStoredSchema, LeafNodeStoredSchema, type RevertibleFactory, } from "./core/index.js";
6
6
  export { type Brand } from "./util/index.js";
7
- export { type Listeners, type IsListener, type Listenable, type Off, createEmitter, EventEmitter, type IEmitter, type HasListeners, type NoListenersCallback, } from "./events/index.js";
7
+ export { type Listeners, type IsListener, type Listenable, type Off, } from "./events/index.js";
8
8
  export { type LazyItem, TreeStatus, type Unenforced, TreeCompressionStrategy, } from "./feature-libraries/index.js";
9
- export { type ISharedTree, type SharedTreeOptions, ForestType, type SharedTreeContentSnapshot, type RevertibleFactory, type SharedTreeFormatOptions, SharedTreeFormatVersion, Tree, type TransactionConstraint, type NodeInDocumentConstraint, type RunTransaction, rollback, } from "./shared-tree/index.js";
10
- export { TreeArrayNode, type Unhydrated, IterableTreeArrayContent, TreeNode, type ITree, type TreeNodeSchema, TreeViewConfiguration, type ITreeViewConfiguration, type ITreeConfigurationOptions, type TreeView, type TreeViewEvents, SchemaFactory, type ImplicitFieldSchema, type TreeFieldFromImplicitField, type TreeChangeEvents, type NodeFromSchema, type TreeMapNode, type InsertableTreeNodeFromImplicitAllowedTypes, type TreeLeafValue, FieldKind, FieldSchema, type ImplicitAllowedTypes, type InsertableTreeFieldFromImplicitField, type InsertableTypedNode, NodeKind, type TreeObjectNode, type TreeNodeFromImplicitAllowedTypes, type TreeNodeSchemaClass, type SchemaCompatibilityStatus, type FieldProps, type InternalTreeNode, type WithType, type NodeChangedData, type TreeNodeApi, type TreeNodeSchemaCore, type AllowedTypes, type TreeObjectNodeUnsafe, type InsertableTreeNodeFromImplicitAllowedTypesUnsafe, type TreeArrayNodeUnsafe, type TreeMapNodeUnsafe, type InsertableObjectFromSchemaRecordUnsafe, type InsertableTreeFieldFromImplicitFieldUnsafe, type FieldSchemaUnsafe, type typeSchemaSymbol, type ValidateRecursiveSchema, type FixRecursiveArraySchema, adaptEnum, enumFromStrings, singletonSchema, typedObjectValues, type EmptyObject, test_RecursiveObject, test_RecursiveObject_base, test_RecursiveObjectPojoMode, type JsonTreeSchema, type JsonSchemaId, type JsonNodeSchema, type JsonNodeSchemaBase, type JsonLeafNodeSchema, type JsonMapNodeSchema, type JsonArrayNodeSchema, type JsonObjectNodeSchema, type JsonFieldSchema, type JsonSchemaRef, type JsonRefPath, type JsonSchemaType, type JsonLeafSchemaType, getJsonSchema, } from "./simple-tree/index.js";
9
+ export { type ISharedTree, type SharedTreeOptions, ForestType, type SharedTreeContentSnapshot, type SharedTreeFormatOptions, SharedTreeFormatVersion, Tree, type TransactionConstraint, type NodeInDocumentConstraint, type RunTransaction, rollback, } from "./shared-tree/index.js";
10
+ export { TreeArrayNode, type Unhydrated, IterableTreeArrayContent, TreeNode, type ITree, type TreeNodeSchema, TreeViewConfiguration, type ITreeViewConfiguration, type ITreeConfigurationOptions, type TreeView, type TreeViewEvents, SchemaFactory, type ImplicitFieldSchema, type TreeFieldFromImplicitField, type TreeChangeEvents, type NodeFromSchema, type TreeMapNode, type InsertableTreeNodeFromImplicitAllowedTypes, type TreeLeafValue, FieldKind, FieldSchema, type ImplicitAllowedTypes, type InsertableTreeFieldFromImplicitField, type InsertableTypedNode, NodeKind, type TreeObjectNode, type TreeNodeFromImplicitAllowedTypes, type TreeNodeSchemaClass, type SchemaCompatibilityStatus, type FieldProps, type InternalTreeNode, type WithType, type NodeChangedData, type TreeNodeApi, type TreeNodeSchemaCore, type AllowedTypes, type TreeObjectNodeUnsafe, type InsertableTreeNodeFromImplicitAllowedTypesUnsafe, type TreeArrayNodeUnsafe, type TreeMapNodeUnsafe, type InsertableObjectFromSchemaRecordUnsafe, type InsertableTreeFieldFromImplicitFieldUnsafe, type FieldSchemaUnsafe, type typeSchemaSymbol, type ValidateRecursiveSchema, type FixRecursiveArraySchema, adaptEnum, enumFromStrings, singletonSchema, typedObjectValues, type EmptyObject, test_RecursiveObject, test_RecursiveObject_base, test_RecursiveObjectPojoMode, TreeBeta, type TreeChangeEventsBeta, type JsonTreeSchema, type JsonSchemaId, type JsonNodeSchema, type JsonNodeSchemaBase, type JsonLeafNodeSchema, type JsonMapNodeSchema, type JsonArrayNodeSchema, type JsonObjectNodeSchema, type JsonFieldSchema, type JsonSchemaRef, type JsonRefPath, type JsonSchemaType, type JsonLeafSchemaType, getJsonSchema, } from "./simple-tree/index.js";
11
11
  export { SharedTree, configuredSharedTree } from "./treeFactory.js";
12
12
  export type { ICodecOptions, JsonValidator, SchemaValidationFunction } from "./codec/index.js";
13
13
  export { noopValidator } from "./codec/index.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,QAAQ,EACR,KAAK,QAAQ,EACb,KAAK,SAAS,EACd,KAAK,cAAc,EACnB,KAAK,QAAQ,EACb,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,wBAAwB,EAC7B,KAAK,qBAAqB,EAC1B,WAAW,EACX,oBAAoB,EACpB,KAAK,mBAAmB,EACxB,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,KAAK,UAAU,EACf,UAAU,EACV,gBAAgB,EAChB,KAAK,cAAc,EACnB,KAAK,sBAAsB,EAC3B,KAAK,8BAA8B,EACnC,sBAAsB,EACtB,mBAAmB,EACnB,oBAAoB,GACpB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAE7C,OAAO,EACN,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,GAAG,EAGR,aAAa,EACb,YAAY,EACZ,KAAK,QAAQ,EACb,KAAK,YAAY,EACjB,KAAK,mBAAmB,GACxB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACN,KAAK,QAAQ,EACb,UAAU,EACV,KAAK,UAAU,EACf,uBAAuB,GACvB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EACN,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,UAAU,EACV,KA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B,EACxB,KAAK,iBAAiB,EACtB,KAAK,sCAAsC,EAC3C,KAAK,0CAA0C,EAC/C,KAAK,iBAAiB,EAEtB,KAAK,gBAAgB,EAErB,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAE5B,SAAS,EACT,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,KAAK,WAAW,EAEhB,oBAAoB,EACpB,yBAAyB,EACzB,4BAA4B,EAE5B,QAAQ,EACR,KAAK,oBAAoB,EAEzB,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,aAAa,GACb,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAEpE,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAC/F,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEjE,OAAO,EACN,KAAK,SAAS,EACd,WAAW,EACX,KAAK,yBAAyB,EAC9B,KAAK,WAAW,GAChB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,aAAa,MAAM,oBAAoB,CAAC;AACpD,OAAO;AACN;;;GAGG;AACH,aAAa,GACb,CAAC;AAKF,YAAY,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC"}
package/dist/index.js CHANGED
@@ -27,7 +27,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
27
27
  return result;
28
28
  };
29
29
  Object.defineProperty(exports, "__esModule", { value: true });
30
- exports.InternalTypes = exports.BrandedType = exports.typeboxValidator = exports.noopValidator = exports.configuredSharedTree = exports.SharedTree = exports.getJsonSchema = exports.test_RecursiveObjectPojoMode = exports.test_RecursiveObject_base = exports.test_RecursiveObject = exports.typedObjectValues = exports.singletonSchema = exports.enumFromStrings = exports.adaptEnum = exports.NodeKind = exports.FieldSchema = exports.FieldKind = exports.SchemaFactory = exports.TreeViewConfiguration = exports.IterableTreeArrayContent = exports.TreeArrayNode = exports.rollback = exports.Tree = exports.SharedTreeFormatVersion = exports.ForestType = exports.TreeCompressionStrategy = exports.TreeStatus = exports.EventEmitter = exports.createEmitter = exports.LeafNodeStoredSchema = exports.MapNodeStoredSchema = exports.ObjectNodeStoredSchema = exports.RevertibleStatus = exports.CommitKind = exports.TreeNodeStoredSchema = exports.ValueSchema = exports.EmptyKey = void 0;
30
+ exports.InternalTypes = exports.BrandedType = exports.typeboxValidator = exports.noopValidator = exports.configuredSharedTree = exports.SharedTree = exports.getJsonSchema = exports.TreeBeta = exports.test_RecursiveObjectPojoMode = exports.test_RecursiveObject_base = exports.test_RecursiveObject = exports.typedObjectValues = exports.singletonSchema = exports.enumFromStrings = exports.adaptEnum = exports.NodeKind = exports.FieldSchema = exports.FieldKind = exports.SchemaFactory = exports.TreeViewConfiguration = exports.IterableTreeArrayContent = exports.TreeArrayNode = exports.rollback = exports.Tree = exports.SharedTreeFormatVersion = exports.ForestType = exports.TreeCompressionStrategy = exports.TreeStatus = exports.LeafNodeStoredSchema = exports.MapNodeStoredSchema = exports.ObjectNodeStoredSchema = exports.RevertibleStatus = exports.CommitKind = exports.TreeNodeStoredSchema = exports.ValueSchema = exports.EmptyKey = void 0;
31
31
  var index_js_1 = require("./core/index.js");
32
32
  Object.defineProperty(exports, "EmptyKey", { enumerable: true, get: function () { return index_js_1.EmptyKey; } });
33
33
  Object.defineProperty(exports, "ValueSchema", { enumerable: true, get: function () { return index_js_1.ValueSchema; } });
@@ -37,46 +37,43 @@ Object.defineProperty(exports, "RevertibleStatus", { enumerable: true, get: func
37
37
  Object.defineProperty(exports, "ObjectNodeStoredSchema", { enumerable: true, get: function () { return index_js_1.ObjectNodeStoredSchema; } });
38
38
  Object.defineProperty(exports, "MapNodeStoredSchema", { enumerable: true, get: function () { return index_js_1.MapNodeStoredSchema; } });
39
39
  Object.defineProperty(exports, "LeafNodeStoredSchema", { enumerable: true, get: function () { return index_js_1.LeafNodeStoredSchema; } });
40
- var index_js_2 = require("./events/index.js");
41
- // Alpha APIs for using event library to implement events externally.
42
- // If stabilizing these APIs, they should probably move out of the tree package first.
43
- Object.defineProperty(exports, "createEmitter", { enumerable: true, get: function () { return index_js_2.createEmitter; } });
44
- Object.defineProperty(exports, "EventEmitter", { enumerable: true, get: function () { return index_js_2.EventEmitter; } });
45
- var index_js_3 = require("./feature-libraries/index.js");
46
- Object.defineProperty(exports, "TreeStatus", { enumerable: true, get: function () { return index_js_3.TreeStatus; } });
47
- Object.defineProperty(exports, "TreeCompressionStrategy", { enumerable: true, get: function () { return index_js_3.TreeCompressionStrategy; } });
48
- var index_js_4 = require("./shared-tree/index.js");
49
- Object.defineProperty(exports, "ForestType", { enumerable: true, get: function () { return index_js_4.ForestType; } });
50
- Object.defineProperty(exports, "SharedTreeFormatVersion", { enumerable: true, get: function () { return index_js_4.SharedTreeFormatVersion; } });
51
- Object.defineProperty(exports, "Tree", { enumerable: true, get: function () { return index_js_4.Tree; } });
52
- Object.defineProperty(exports, "rollback", { enumerable: true, get: function () { return index_js_4.rollback; } });
53
- var index_js_5 = require("./simple-tree/index.js");
54
- Object.defineProperty(exports, "TreeArrayNode", { enumerable: true, get: function () { return index_js_5.TreeArrayNode; } });
55
- Object.defineProperty(exports, "IterableTreeArrayContent", { enumerable: true, get: function () { return index_js_5.IterableTreeArrayContent; } });
56
- Object.defineProperty(exports, "TreeViewConfiguration", { enumerable: true, get: function () { return index_js_5.TreeViewConfiguration; } });
57
- Object.defineProperty(exports, "SchemaFactory", { enumerable: true, get: function () { return index_js_5.SchemaFactory; } });
58
- Object.defineProperty(exports, "FieldKind", { enumerable: true, get: function () { return index_js_5.FieldKind; } });
59
- Object.defineProperty(exports, "FieldSchema", { enumerable: true, get: function () { return index_js_5.FieldSchema; } });
60
- Object.defineProperty(exports, "NodeKind", { enumerable: true, get: function () { return index_js_5.NodeKind; } });
40
+ var index_js_2 = require("./feature-libraries/index.js");
41
+ Object.defineProperty(exports, "TreeStatus", { enumerable: true, get: function () { return index_js_2.TreeStatus; } });
42
+ Object.defineProperty(exports, "TreeCompressionStrategy", { enumerable: true, get: function () { return index_js_2.TreeCompressionStrategy; } });
43
+ var index_js_3 = require("./shared-tree/index.js");
44
+ Object.defineProperty(exports, "ForestType", { enumerable: true, get: function () { return index_js_3.ForestType; } });
45
+ Object.defineProperty(exports, "SharedTreeFormatVersion", { enumerable: true, get: function () { return index_js_3.SharedTreeFormatVersion; } });
46
+ Object.defineProperty(exports, "Tree", { enumerable: true, get: function () { return index_js_3.Tree; } });
47
+ Object.defineProperty(exports, "rollback", { enumerable: true, get: function () { return index_js_3.rollback; } });
48
+ var index_js_4 = require("./simple-tree/index.js");
49
+ Object.defineProperty(exports, "TreeArrayNode", { enumerable: true, get: function () { return index_js_4.TreeArrayNode; } });
50
+ Object.defineProperty(exports, "IterableTreeArrayContent", { enumerable: true, get: function () { return index_js_4.IterableTreeArrayContent; } });
51
+ Object.defineProperty(exports, "TreeViewConfiguration", { enumerable: true, get: function () { return index_js_4.TreeViewConfiguration; } });
52
+ Object.defineProperty(exports, "SchemaFactory", { enumerable: true, get: function () { return index_js_4.SchemaFactory; } });
53
+ Object.defineProperty(exports, "FieldKind", { enumerable: true, get: function () { return index_js_4.FieldKind; } });
54
+ Object.defineProperty(exports, "FieldSchema", { enumerable: true, get: function () { return index_js_4.FieldSchema; } });
55
+ Object.defineProperty(exports, "NodeKind", { enumerable: true, get: function () { return index_js_4.NodeKind; } });
61
56
  // experimental @internal APIs:
62
- Object.defineProperty(exports, "adaptEnum", { enumerable: true, get: function () { return index_js_5.adaptEnum; } });
63
- Object.defineProperty(exports, "enumFromStrings", { enumerable: true, get: function () { return index_js_5.enumFromStrings; } });
64
- Object.defineProperty(exports, "singletonSchema", { enumerable: true, get: function () { return index_js_5.singletonSchema; } });
65
- Object.defineProperty(exports, "typedObjectValues", { enumerable: true, get: function () { return index_js_5.typedObjectValues; } });
57
+ Object.defineProperty(exports, "adaptEnum", { enumerable: true, get: function () { return index_js_4.adaptEnum; } });
58
+ Object.defineProperty(exports, "enumFromStrings", { enumerable: true, get: function () { return index_js_4.enumFromStrings; } });
59
+ Object.defineProperty(exports, "singletonSchema", { enumerable: true, get: function () { return index_js_4.singletonSchema; } });
60
+ Object.defineProperty(exports, "typedObjectValues", { enumerable: true, get: function () { return index_js_4.typedObjectValues; } });
66
61
  // test recursive schema for checking that d.ts files handles schema correctly
67
- Object.defineProperty(exports, "test_RecursiveObject", { enumerable: true, get: function () { return index_js_5.test_RecursiveObject; } });
68
- Object.defineProperty(exports, "test_RecursiveObject_base", { enumerable: true, get: function () { return index_js_5.test_RecursiveObject_base; } });
69
- Object.defineProperty(exports, "test_RecursiveObjectPojoMode", { enumerable: true, get: function () { return index_js_5.test_RecursiveObjectPojoMode; } });
70
- Object.defineProperty(exports, "getJsonSchema", { enumerable: true, get: function () { return index_js_5.getJsonSchema; } });
62
+ Object.defineProperty(exports, "test_RecursiveObject", { enumerable: true, get: function () { return index_js_4.test_RecursiveObject; } });
63
+ Object.defineProperty(exports, "test_RecursiveObject_base", { enumerable: true, get: function () { return index_js_4.test_RecursiveObject_base; } });
64
+ Object.defineProperty(exports, "test_RecursiveObjectPojoMode", { enumerable: true, get: function () { return index_js_4.test_RecursiveObjectPojoMode; } });
65
+ // Beta APIs
66
+ Object.defineProperty(exports, "TreeBeta", { enumerable: true, get: function () { return index_js_4.TreeBeta; } });
67
+ Object.defineProperty(exports, "getJsonSchema", { enumerable: true, get: function () { return index_js_4.getJsonSchema; } });
71
68
  var treeFactory_js_1 = require("./treeFactory.js");
72
69
  Object.defineProperty(exports, "SharedTree", { enumerable: true, get: function () { return treeFactory_js_1.SharedTree; } });
73
70
  Object.defineProperty(exports, "configuredSharedTree", { enumerable: true, get: function () { return treeFactory_js_1.configuredSharedTree; } });
74
- var index_js_6 = require("./codec/index.js");
75
- Object.defineProperty(exports, "noopValidator", { enumerable: true, get: function () { return index_js_6.noopValidator; } });
76
- var index_js_7 = require("./external-utilities/index.js");
77
- Object.defineProperty(exports, "typeboxValidator", { enumerable: true, get: function () { return index_js_7.typeboxValidator; } });
78
- var index_js_8 = require("./util/index.js");
79
- Object.defineProperty(exports, "BrandedType", { enumerable: true, get: function () { return index_js_8.BrandedType; } });
71
+ var index_js_5 = require("./codec/index.js");
72
+ Object.defineProperty(exports, "noopValidator", { enumerable: true, get: function () { return index_js_5.noopValidator; } });
73
+ var index_js_6 = require("./external-utilities/index.js");
74
+ Object.defineProperty(exports, "typeboxValidator", { enumerable: true, get: function () { return index_js_6.typeboxValidator; } });
75
+ var index_js_7 = require("./util/index.js");
76
+ Object.defineProperty(exports, "BrandedType", { enumerable: true, get: function () { return index_js_7.BrandedType; } });
80
77
  const InternalTypes = __importStar(require("./internalTypes.js"));
81
78
  exports.InternalTypes = InternalTypes;
82
79
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,4CAyByB;AAxBxB,oGAAA,QAAQ,OAAA;AAUR,uGAAA,WAAW,OAAA;AACX,gHAAA,oBAAoB,OAAA;AAKpB,sGAAA,UAAU,OAAA;AACV,4GAAA,gBAAgB,OAAA;AAIhB,kHAAA,sBAAsB,OAAA;AACtB,+GAAA,mBAAmB,OAAA;AACnB,gHAAA,oBAAoB,OAAA;AAIrB,8CAY2B;AAP1B,qEAAqE;AACrE,sFAAsF;AACtF,yGAAA,aAAa,OAAA;AACb,wGAAA,YAAY,OAAA;AAMb,yDAKsC;AAHrC,sGAAA,UAAU,OAAA;AAEV,mHAAA,uBAAuB,OAAA;AAGxB,mDAagC;AAV/B,sGAAA,UAAU,OAAA;AAIV,mHAAA,uBAAuB,OAAA;AACvB,gGAAA,IAAI,OAAA;AAIJ,oGAAA,QAAQ,OAAA;AAGT,mDAgFgC;AA/E/B,yGAAA,aAAa,OAAA;AAEb,oHAAA,wBAAwB,OAAA;AAIxB,iHAAA,qBAAqB,OAAA;AAKrB,yGAAA,aAAa,OAAA;AAQb,qGAAA,SAAS,OAAA;AACT,uGAAA,WAAW,OAAA;AAIX,oGAAA,QAAQ,OAAA;AA8BR,+BAA+B;AAC/B,qGAAA,SAAS,OAAA;AACT,2GAAA,eAAe,OAAA;AACf,2GAAA,eAAe,OAAA;AACf,6GAAA,iBAAiB,OAAA;AAEjB,8EAA8E;AAC9E,gHAAA,oBAAoB,OAAA;AACpB,qHAAA,yBAAyB,OAAA;AACzB,wHAAA,4BAA4B,OAAA;AAe5B,yGAAA,aAAa,OAAA;AAEd,mDAAoE;AAA3D,4GAAA,UAAU,OAAA;AAAE,sHAAA,oBAAoB,OAAA;AAGzC,6CAAiD;AAAxC,yGAAA,aAAa,OAAA;AACtB,0DAAiE;AAAxD,4GAAA,gBAAgB,OAAA;AAEzB,4CAKyB;AAHxB,uGAAA,WAAW,OAAA;AAKZ,kEAAoD;AAMnD,sCAAa","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\tEmptyKey,\n\ttype FieldKey,\n\ttype TreeValue,\n\ttype FieldMapObject,\n\ttype NodeData,\n\ttype GenericTreeNode,\n\ttype JsonableTree,\n\ttype GenericFieldsNode,\n\ttype TreeNodeSchemaIdentifier,\n\ttype TreeFieldStoredSchema,\n\tValueSchema,\n\tTreeNodeStoredSchema,\n\ttype FieldKindIdentifier,\n\ttype TreeTypeSet,\n\ttype TreeStoredSchema,\n\ttype Revertible,\n\tCommitKind,\n\tRevertibleStatus,\n\ttype CommitMetadata,\n\ttype StoredSchemaCollection,\n\ttype ErasedTreeNodeSchemaDataFormat,\n\tObjectNodeStoredSchema,\n\tMapNodeStoredSchema,\n\tLeafNodeStoredSchema,\n} from \"./core/index.js\";\nexport { type Brand } from \"./util/index.js\";\n\nexport {\n\ttype Listeners,\n\ttype IsListener,\n\ttype Listenable,\n\ttype Off,\n\t// Alpha APIs for using event library to implement events externally.\n\t// If stabilizing these APIs, they should probably move out of the tree package first.\n\tcreateEmitter,\n\tEventEmitter,\n\ttype IEmitter,\n\ttype HasListeners,\n\ttype NoListenersCallback,\n} from \"./events/index.js\";\n\nexport {\n\ttype LazyItem,\n\tTreeStatus,\n\ttype Unenforced,\n\tTreeCompressionStrategy,\n} from \"./feature-libraries/index.js\";\n\nexport {\n\ttype ISharedTree,\n\ttype SharedTreeOptions,\n\tForestType,\n\ttype SharedTreeContentSnapshot,\n\ttype RevertibleFactory,\n\ttype SharedTreeFormatOptions,\n\tSharedTreeFormatVersion,\n\tTree,\n\ttype TransactionConstraint,\n\ttype NodeInDocumentConstraint,\n\ttype RunTransaction,\n\trollback,\n} from \"./shared-tree/index.js\";\n\nexport {\n\tTreeArrayNode,\n\ttype Unhydrated,\n\tIterableTreeArrayContent,\n\tTreeNode,\n\ttype ITree,\n\ttype TreeNodeSchema,\n\tTreeViewConfiguration,\n\ttype ITreeViewConfiguration,\n\ttype ITreeConfigurationOptions,\n\ttype TreeView,\n\ttype TreeViewEvents,\n\tSchemaFactory,\n\ttype ImplicitFieldSchema,\n\ttype TreeFieldFromImplicitField,\n\ttype TreeChangeEvents,\n\ttype NodeFromSchema,\n\ttype TreeMapNode,\n\ttype InsertableTreeNodeFromImplicitAllowedTypes,\n\ttype TreeLeafValue,\n\tFieldKind,\n\tFieldSchema,\n\ttype ImplicitAllowedTypes,\n\ttype InsertableTreeFieldFromImplicitField,\n\ttype InsertableTypedNode,\n\tNodeKind,\n\ttype TreeObjectNode,\n\ttype TreeNodeFromImplicitAllowedTypes,\n\ttype TreeNodeSchemaClass,\n\ttype SchemaCompatibilityStatus,\n\ttype FieldProps,\n\ttype InternalTreeNode,\n\ttype WithType,\n\ttype NodeChangedData,\n\t// Types not really intended for public use, but used in links.\n\t// Can not be moved to internalTypes since doing so causes app code to throw errors like:\n\t// Error: src/simple-tree/objectNode.ts:72:1 - (ae-unresolved-link) The @link reference could not be resolved: The package \"@fluidframework/tree\" does not have an export \"TreeNodeApi\"\n\ttype TreeNodeApi,\n\ttype TreeNodeSchemaCore,\n\t// Types not really intended for public use, but used in inferred types exposed in the public API.\n\t// Can not be moved to internalTypes since doing so causes app code to throw errors like:\n\t// error TS2742: The inferred type of 'Inventory' cannot be named without a reference to '../node_modules/@fluidframework/tree/lib/internalTypes.js'. This is likely not portable. A type annotation is necessary.\n\ttype AllowedTypes,\n\ttype TreeObjectNodeUnsafe,\n\ttype InsertableTreeNodeFromImplicitAllowedTypesUnsafe,\n\ttype TreeArrayNodeUnsafe,\n\ttype TreeMapNodeUnsafe,\n\ttype InsertableObjectFromSchemaRecordUnsafe,\n\ttype InsertableTreeFieldFromImplicitFieldUnsafe,\n\ttype FieldSchemaUnsafe,\n\t// System types (not in Internal types for various reasons, like doc links or cannot be named errors).\n\ttype typeSchemaSymbol,\n\t// Recursive Schema APIs\n\ttype ValidateRecursiveSchema,\n\ttype FixRecursiveArraySchema,\n\t// experimental @internal APIs:\n\tadaptEnum,\n\tenumFromStrings,\n\tsingletonSchema,\n\ttypedObjectValues,\n\ttype EmptyObject,\n\t// test recursive schema for checking that d.ts files handles schema correctly\n\ttest_RecursiveObject,\n\ttest_RecursiveObject_base,\n\ttest_RecursiveObjectPojoMode,\n\t// Back to normal types\n\ttype JsonTreeSchema,\n\ttype JsonSchemaId,\n\ttype JsonNodeSchema,\n\ttype JsonNodeSchemaBase,\n\ttype JsonLeafNodeSchema,\n\ttype JsonMapNodeSchema,\n\ttype JsonArrayNodeSchema,\n\ttype JsonObjectNodeSchema,\n\ttype JsonFieldSchema,\n\ttype JsonSchemaRef,\n\ttype JsonRefPath,\n\ttype JsonSchemaType,\n\ttype JsonLeafSchemaType,\n\tgetJsonSchema,\n} from \"./simple-tree/index.js\";\nexport { SharedTree, configuredSharedTree } from \"./treeFactory.js\";\n\nexport type { ICodecOptions, JsonValidator, SchemaValidationFunction } from \"./codec/index.js\";\nexport { noopValidator } from \"./codec/index.js\";\nexport { typeboxValidator } from \"./external-utilities/index.js\";\n\nexport {\n\ttype Covariant,\n\tBrandedType,\n\ttype RestrictiveReadonlyRecord,\n\ttype MakeNominal,\n} from \"./util/index.js\";\n\nimport * as InternalTypes from \"./internalTypes.js\";\nexport {\n\t/**\n\t * Contains types used by the API, but which serve mechanical purposes and do not represent semantic concepts.\n\t * They are used internally to implement API aspects, but are not intended for use by external consumers.\n\t */\n\tInternalTypes,\n};\n\n// Internal/System types:\n// These would be put in `internalTypes` except doing so tents to cause errors like:\n// The inferred type of 'NodeMap' cannot be named without a reference to '../../node_modules/@fluidframework/tree/lib/internalTypes.js'. This is likely not portable. A type annotation is necessary.\nexport type { MapNodeInsertableData } from \"./simple-tree/index.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,4CA0ByB;AAzBxB,oGAAA,QAAQ,OAAA;AAUR,uGAAA,WAAW,OAAA;AACX,gHAAA,oBAAoB,OAAA;AAKpB,sGAAA,UAAU,OAAA;AACV,4GAAA,gBAAgB,OAAA;AAIhB,kHAAA,sBAAsB,OAAA;AACtB,+GAAA,mBAAmB,OAAA;AACnB,gHAAA,oBAAoB,OAAA;AAYrB,yDAKsC;AAHrC,sGAAA,UAAU,OAAA;AAEV,mHAAA,uBAAuB,OAAA;AAGxB,mDAYgC;AAT/B,sGAAA,UAAU,OAAA;AAGV,mHAAA,uBAAuB,OAAA;AACvB,gGAAA,IAAI,OAAA;AAIJ,oGAAA,QAAQ,OAAA;AAGT,mDAmFgC;AAlF/B,yGAAA,aAAa,OAAA;AAEb,oHAAA,wBAAwB,OAAA;AAIxB,iHAAA,qBAAqB,OAAA;AAKrB,yGAAA,aAAa,OAAA;AAQb,qGAAA,SAAS,OAAA;AACT,uGAAA,WAAW,OAAA;AAIX,oGAAA,QAAQ,OAAA;AA8BR,+BAA+B;AAC/B,qGAAA,SAAS,OAAA;AACT,2GAAA,eAAe,OAAA;AACf,2GAAA,eAAe,OAAA;AACf,6GAAA,iBAAiB,OAAA;AAEjB,8EAA8E;AAC9E,gHAAA,oBAAoB,OAAA;AACpB,qHAAA,yBAAyB,OAAA;AACzB,wHAAA,4BAA4B,OAAA;AAC5B,YAAY;AACZ,oGAAA,QAAQ,OAAA;AAgBR,yGAAA,aAAa,OAAA;AAEd,mDAAoE;AAA3D,4GAAA,UAAU,OAAA;AAAE,sHAAA,oBAAoB,OAAA;AAGzC,6CAAiD;AAAxC,yGAAA,aAAa,OAAA;AACtB,0DAAiE;AAAxD,4GAAA,gBAAgB,OAAA;AAEzB,4CAKyB;AAHxB,uGAAA,WAAW,OAAA;AAKZ,kEAAoD;AAMnD,sCAAa","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\tEmptyKey,\n\ttype FieldKey,\n\ttype TreeValue,\n\ttype FieldMapObject,\n\ttype NodeData,\n\ttype GenericTreeNode,\n\ttype JsonableTree,\n\ttype GenericFieldsNode,\n\ttype TreeNodeSchemaIdentifier,\n\ttype TreeFieldStoredSchema,\n\tValueSchema,\n\tTreeNodeStoredSchema,\n\ttype FieldKindIdentifier,\n\ttype TreeTypeSet,\n\ttype TreeStoredSchema,\n\ttype Revertible,\n\tCommitKind,\n\tRevertibleStatus,\n\ttype CommitMetadata,\n\ttype StoredSchemaCollection,\n\ttype ErasedTreeNodeSchemaDataFormat,\n\tObjectNodeStoredSchema,\n\tMapNodeStoredSchema,\n\tLeafNodeStoredSchema,\n\ttype RevertibleFactory,\n} from \"./core/index.js\";\nexport { type Brand } from \"./util/index.js\";\n\nexport {\n\ttype Listeners,\n\ttype IsListener,\n\ttype Listenable,\n\ttype Off,\n} from \"./events/index.js\";\n\nexport {\n\ttype LazyItem,\n\tTreeStatus,\n\ttype Unenforced,\n\tTreeCompressionStrategy,\n} from \"./feature-libraries/index.js\";\n\nexport {\n\ttype ISharedTree,\n\ttype SharedTreeOptions,\n\tForestType,\n\ttype SharedTreeContentSnapshot,\n\ttype SharedTreeFormatOptions,\n\tSharedTreeFormatVersion,\n\tTree,\n\ttype TransactionConstraint,\n\ttype NodeInDocumentConstraint,\n\ttype RunTransaction,\n\trollback,\n} from \"./shared-tree/index.js\";\n\nexport {\n\tTreeArrayNode,\n\ttype Unhydrated,\n\tIterableTreeArrayContent,\n\tTreeNode,\n\ttype ITree,\n\ttype TreeNodeSchema,\n\tTreeViewConfiguration,\n\ttype ITreeViewConfiguration,\n\ttype ITreeConfigurationOptions,\n\ttype TreeView,\n\ttype TreeViewEvents,\n\tSchemaFactory,\n\ttype ImplicitFieldSchema,\n\ttype TreeFieldFromImplicitField,\n\ttype TreeChangeEvents,\n\ttype NodeFromSchema,\n\ttype TreeMapNode,\n\ttype InsertableTreeNodeFromImplicitAllowedTypes,\n\ttype TreeLeafValue,\n\tFieldKind,\n\tFieldSchema,\n\ttype ImplicitAllowedTypes,\n\ttype InsertableTreeFieldFromImplicitField,\n\ttype InsertableTypedNode,\n\tNodeKind,\n\ttype TreeObjectNode,\n\ttype TreeNodeFromImplicitAllowedTypes,\n\ttype TreeNodeSchemaClass,\n\ttype SchemaCompatibilityStatus,\n\ttype FieldProps,\n\ttype InternalTreeNode,\n\ttype WithType,\n\ttype NodeChangedData,\n\t// Types not really intended for public use, but used in links.\n\t// Can not be moved to internalTypes since doing so causes app code to throw errors like:\n\t// Error: src/simple-tree/objectNode.ts:72:1 - (ae-unresolved-link) The @link reference could not be resolved: The package \"@fluidframework/tree\" does not have an export \"TreeNodeApi\"\n\ttype TreeNodeApi,\n\ttype TreeNodeSchemaCore,\n\t// Types not really intended for public use, but used in inferred types exposed in the public API.\n\t// Can not be moved to internalTypes since doing so causes app code to throw errors like:\n\t// error TS2742: The inferred type of 'Inventory' cannot be named without a reference to '../node_modules/@fluidframework/tree/lib/internalTypes.js'. This is likely not portable. A type annotation is necessary.\n\ttype AllowedTypes,\n\ttype TreeObjectNodeUnsafe,\n\ttype InsertableTreeNodeFromImplicitAllowedTypesUnsafe,\n\ttype TreeArrayNodeUnsafe,\n\ttype TreeMapNodeUnsafe,\n\ttype InsertableObjectFromSchemaRecordUnsafe,\n\ttype InsertableTreeFieldFromImplicitFieldUnsafe,\n\ttype FieldSchemaUnsafe,\n\t// System types (not in Internal types for various reasons, like doc links or cannot be named errors).\n\ttype typeSchemaSymbol,\n\t// Recursive Schema APIs\n\ttype ValidateRecursiveSchema,\n\ttype FixRecursiveArraySchema,\n\t// experimental @internal APIs:\n\tadaptEnum,\n\tenumFromStrings,\n\tsingletonSchema,\n\ttypedObjectValues,\n\ttype EmptyObject,\n\t// test recursive schema for checking that d.ts files handles schema correctly\n\ttest_RecursiveObject,\n\ttest_RecursiveObject_base,\n\ttest_RecursiveObjectPojoMode,\n\t// Beta APIs\n\tTreeBeta,\n\ttype TreeChangeEventsBeta,\n\t// Back to normal types\n\ttype JsonTreeSchema,\n\ttype JsonSchemaId,\n\ttype JsonNodeSchema,\n\ttype JsonNodeSchemaBase,\n\ttype JsonLeafNodeSchema,\n\ttype JsonMapNodeSchema,\n\ttype JsonArrayNodeSchema,\n\ttype JsonObjectNodeSchema,\n\ttype JsonFieldSchema,\n\ttype JsonSchemaRef,\n\ttype JsonRefPath,\n\ttype JsonSchemaType,\n\ttype JsonLeafSchemaType,\n\tgetJsonSchema,\n} from \"./simple-tree/index.js\";\nexport { SharedTree, configuredSharedTree } from \"./treeFactory.js\";\n\nexport type { ICodecOptions, JsonValidator, SchemaValidationFunction } from \"./codec/index.js\";\nexport { noopValidator } from \"./codec/index.js\";\nexport { typeboxValidator } from \"./external-utilities/index.js\";\n\nexport {\n\ttype Covariant,\n\tBrandedType,\n\ttype RestrictiveReadonlyRecord,\n\ttype MakeNominal,\n} from \"./util/index.js\";\n\nimport * as InternalTypes from \"./internalTypes.js\";\nexport {\n\t/**\n\t * Contains types used by the API, but which serve mechanical purposes and do not represent semantic concepts.\n\t * They are used internally to implement API aspects, but are not intended for use by external consumers.\n\t */\n\tInternalTypes,\n};\n\n// Internal/System types:\n// These would be put in `internalTypes` except doing so tents to cause errors like:\n// The inferred type of 'NodeMap' cannot be named without a reference to '../../node_modules/@fluidframework/tree/lib/internalTypes.js'. This is likely not portable. A type annotation is necessary.\nexport type { MapNodeInsertableData } from \"./simple-tree/index.js\";\n"]}
@@ -0,0 +1,83 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ /*
7
+ * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
8
+ * Generated by "flub generate entrypoints" in @fluid-tools/build-cli.
9
+ */
10
+
11
+ export {
12
+ // Unrestricted APIs
13
+ InternalTypes,
14
+
15
+ // @public APIs
16
+ AllowedTypes,
17
+ CommitKind,
18
+ CommitMetadata,
19
+ FieldKind,
20
+ FieldProps,
21
+ FieldSchema,
22
+ FieldSchemaUnsafe,
23
+ ITree,
24
+ ITreeConfigurationOptions,
25
+ ITreeViewConfiguration,
26
+ ImplicitAllowedTypes,
27
+ ImplicitFieldSchema,
28
+ InsertableObjectFromSchemaRecordUnsafe,
29
+ InsertableTreeFieldFromImplicitField,
30
+ InsertableTreeFieldFromImplicitFieldUnsafe,
31
+ InsertableTreeNodeFromImplicitAllowedTypes,
32
+ InsertableTreeNodeFromImplicitAllowedTypesUnsafe,
33
+ InsertableTypedNode,
34
+ InternalTreeNode,
35
+ IsListener,
36
+ IterableTreeArrayContent,
37
+ LazyItem,
38
+ Listenable,
39
+ Listeners,
40
+ MakeNominal,
41
+ MapNodeInsertableData,
42
+ NodeFromSchema,
43
+ NodeInDocumentConstraint,
44
+ NodeKind,
45
+ Off,
46
+ RestrictiveReadonlyRecord,
47
+ Revertible,
48
+ RevertibleFactory,
49
+ RevertibleStatus,
50
+ RunTransaction,
51
+ SchemaCompatibilityStatus,
52
+ SchemaFactory,
53
+ TransactionConstraint,
54
+ Tree,
55
+ TreeArrayNode,
56
+ TreeArrayNodeUnsafe,
57
+ TreeChangeEvents,
58
+ TreeFieldFromImplicitField,
59
+ TreeLeafValue,
60
+ TreeMapNode,
61
+ TreeMapNodeUnsafe,
62
+ TreeNode,
63
+ TreeNodeApi,
64
+ TreeNodeFromImplicitAllowedTypes,
65
+ TreeNodeSchema,
66
+ TreeNodeSchemaClass,
67
+ TreeNodeSchemaCore,
68
+ TreeObjectNode,
69
+ TreeObjectNodeUnsafe,
70
+ TreeStatus,
71
+ TreeView,
72
+ TreeViewConfiguration,
73
+ TreeViewEvents,
74
+ Unenforced,
75
+ Unhydrated,
76
+ ValidateRecursiveSchema,
77
+ WithType,
78
+ rollback,
79
+ typeSchemaSymbol,
80
+
81
+ // @legacy APIs
82
+ SharedTree
83
+ } from "./index.js";
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export declare const pkgName = "@fluidframework/tree";
8
- export declare const pkgVersion = "2.3.0-288113";
8
+ export declare const pkgVersion = "2.3.0";
9
9
  //# sourceMappingURL=packageVersion.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,yBAAyB,CAAC;AAC9C,eAAO,MAAM,UAAU,iBAAiB,CAAC"}
1
+ {"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,yBAAyB,CAAC;AAC9C,eAAO,MAAM,UAAU,UAAU,CAAC"}
@@ -8,5 +8,5 @@
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.pkgVersion = exports.pkgName = void 0;
10
10
  exports.pkgName = "@fluidframework/tree";
11
- exports.pkgVersion = "2.3.0-288113";
11
+ exports.pkgVersion = "2.3.0";
12
12
  //# sourceMappingURL=packageVersion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,sBAAsB,CAAC;AACjC,QAAA,UAAU,GAAG,cAAc,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/tree\";\nexport const pkgVersion = \"2.3.0-288113\";\n"]}
1
+ {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,sBAAsB,CAAC;AACjC,QAAA,UAAU,GAAG,OAAO,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/tree\";\nexport const pkgVersion = \"2.3.0\";\n"]}