@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
@@ -1 +0,0 @@
1
- {"version":3,"file":"events.js","sourceRoot":"","sources":["../../src/events/events.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAy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Z,GAAG,IAA+B;QAElC,OAAO,KAAK,CAAC,cAAc,CAAC,SAAS,EAAE,GAAG,IAAI,CAAC,CAAC;IACjD,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IEvent } from \"@fluidframework/core-interfaces\";\nimport { getOrCreate } from \"../util/index.js\";\n\n/**\n * Convert a union of types to an intersection of those types. Useful for `TransformEvents`.\n * @privateRemarks\n * First an always true extends clause is used (T extends T) to distribute T into to a union of types contravariant over each member of the T union.\n * Then the constraint on the type parameter in this new context is inferred, giving the intersection.\n */\nexport type UnionToIntersection<T> = (T extends T ? (k: T) => unknown : never) extends (\n\tk: infer U,\n) => unknown\n\t? U\n\t: never;\n\n/**\n * `true` iff the given type is an acceptable shape for a {@link Listeners | event} listener\n * @public\n */\nexport type IsListener<TListener> = TListener extends (...args: any[]) => void ? true : false;\n\n/**\n * Used to specify the kinds of events emitted by a {@link Listenable}.\n *\n * @remarks\n * Any object type is a valid {@link Listeners}, but only the {@link IsListener | event-like} properties of that\n * type will be included.\n *\n * @example\n * ```typescript\n * interface MyEvents {\n * load: (user: string, data: IUserData) => void;\n * error: (errorCode: number) => void;\n * }\n * ```\n *\n * @public\n */\nexport type Listeners<T extends object> = {\n\t[P in (string | symbol) & keyof T as IsListener<T[P]> extends true ? P : never]: T[P];\n};\n\n/**\n * Converts a {@link Listeners} type (i.e. the event registry for a {@link Listenable}) into a type consumable\n * by an IEventProvider from `@fluidframework/core-interfaces`.\n * @param E - the `Events` type to transform\n * @param Target - an optional `IEvent` type that will be merged into the result along with the transformed `E`\n *\n * @example\n *\n * ```typescript\n * interface MyEvents {\n * load: (user: string, data: IUserData) => void;\n * error: (errorCode: number) => void;\n * }\n *\n * class MySharedObject extends SharedObject<TransformEvents<MyEvents, ISharedObjectEvents>> {\n * // ...\n * }\n * ```\n */\nexport type TransformListeners<\n\tTListeners extends Listeners<TListeners>,\n\tTTarget extends IEvent = IEvent,\n> = {\n\t[P in keyof Listeners<TListeners>]: (event: P, listener: TListeners[P]) => void;\n} extends Record<string | number | symbol, infer Z>\n\t? UnionToIntersection<Z> & TTarget\n\t: never;\n\n/**\n * An object which allows the registration of listeners so that subscribers can be notified when an event happens.\n * @param TListeners - All the {@link Listeners | events} that this subscribable supports\n *\n * @privateRemarks\n * `EventEmitter` can be used as a base class to implement this via extension.\n * ```ts\n * type MyEventEmitter = IEventEmitter<{\n * load: (user: string, data: IUserData) => void;\n * error: (errorCode: number) => void;\n * }>\n * ```\n * {@link createEmitter} can help implement this interface via delegation.\n *\n * @sealed @public\n */\nexport interface Listenable<TListeners extends object> {\n\t/**\n\t * Register an event listener.\n\t * @param eventName - the name of the event\n\t * @param listener - the handler to run when the event is fired by the emitter\n\t * @returns a {@link Off | function} which will deregister the listener when called.\n\t * This deregistration function is idempotent and therefore may be safely called more than once with no effect.\n\t * @remarks Do not register the exact same `listener` object for the same event more than once.\n\t * Doing so will result in undefined behavior, and is not guaranteed to behave the same in future versions of this library.\n\t */\n\ton<K extends keyof Listeners<TListeners>>(eventName: K, listener: TListeners[K]): Off;\n}\n\n/**\n * A function that, when called, will deregister an event listener subscription that was previously registered.\n * @remarks\n * It is returned by the {@link Listenable.on | event registration function} when event registration occurs.\n * @public\n */\nexport type Off = () => void;\n\n/**\n * Interface for an event emitter that can emit typed events to subscribed listeners.\n * @sealed @alpha\n */\nexport interface IEmitter<TListeners extends Listeners<TListeners>> {\n\t/**\n\t * Emits an event with the specified name and arguments, notifying all subscribers by calling their registered listener functions.\n\t * @param eventName - the name of the event to fire\n\t * @param args - the arguments passed to the event listener functions\n\t */\n\temit<K extends keyof Listeners<TListeners>>(\n\t\teventName: K,\n\t\t...args: Parameters<TListeners[K]>\n\t): void;\n\n\t/**\n\t * Emits an event with the specified name and arguments, notifying all subscribers by calling their registered listener functions.\n\t * It also collects the return values of all listeners into an array.\n\t *\n\t * Warning: This method should be used with caution. It deviates from the standard event-based integration pattern as creates substantial coupling between the emitter and its listeners.\n\t * For the majority of use-cases it is recommended to use the standard {@link IEmitter.emit} functionality.\n\t * @param eventName - the name of the event to fire\n\t * @param args - the arguments passed to the event listener functions\n\t * @returns An array of the return values of each listener, preserving the order listeners were called.\n\t */\n\temitAndCollect<K extends keyof Listeners<TListeners>>(\n\t\teventName: K,\n\t\t...args: Parameters<TListeners[K]>\n\t): ReturnType<TListeners[K]>[];\n}\n\n/**\n * Create a {@link Listenable} that can be instructed to emit events via the {@link IEmitter} interface.\n *\n * A class can delegate handling {@link Listenable} to the returned value while using it to emit the events.\n * See also `EventEmitter` which be used as a base class to implement {@link Listenable} via extension.\n * @alpha\n */\nexport function createEmitter<TListeners extends object>(\n\tnoListeners?: NoListenersCallback<TListeners>,\n): Listenable<TListeners> & IEmitter<TListeners> & HasListeners<TListeners> {\n\treturn new ComposableEventEmitter<TListeners>(noListeners);\n}\n\n/**\n * Called when the last listener for `eventName` is removed.\n * Useful for determining when to clean up resources related to detecting when the event might occurs.\n * @alpha\n */\nexport type NoListenersCallback<TListeners extends object> = (\n\teventName: keyof Listeners<TListeners>,\n) => void;\n\n/**\n * Allows querying if an object has listeners.\n * @sealed @alpha\n */\nexport interface HasListeners<TListeners extends Listeners<TListeners>> {\n\t/**\n\t * When no `eventName` is provided, returns true iff there are any listeners.\n\t *\n\t * When `eventName` is provided, returns true iff there are listeners for that event.\n\t *\n\t * @remarks\n\t * This can be used to know when its safe to cleanup data-structures which only exist to fire events for their listeners.\n\t */\n\thasListeners(eventName?: keyof Listeners<TListeners>): boolean;\n}\n\n/**\n * Provides an API for subscribing to and listening to events.\n *\n * @remarks Classes wishing to emit events may either extend this class or compose over it.\n *\n * @example Extending this class\n *\n * ```typescript\n * interface MyEvents {\n * \"loaded\": () => void;\n * }\n *\n * class MyClass extends EventEmitter<MyEvents> {\n * private load() {\n * this.emit(\"loaded\");\n * }\n * }\n * ```\n *\n * @example Composing over this class\n *\n * ```typescript\n * class MyClass implements ISubscribable<MyEvents> {\n * private readonly events = createEmitter<MyEvents>();\n *\n * private load() {\n * this.events.emit(\"loaded\");\n * }\n *\n * public on<K extends keyof MyEvents>(eventName: K, listener: MyEvents[K]): Off {\n * return this.events.on(eventName, listener);\n * }\n * }\n * ```\n * @alpha\n */\nexport class EventEmitter<TListeners extends Listeners<TListeners>>\n\timplements Listenable<TListeners>, HasListeners<TListeners>\n{\n\tprotected readonly listeners = new Map<\n\t\tkeyof TListeners,\n\t\tMap<Off, (...args: any[]) => TListeners[keyof TListeners]>\n\t>();\n\n\t// Because this is protected and not public, calling this externally (not from a subclass) makes sending events to the constructed instance impossible.\n\t// Instead, use the static `create` function to get an instance which allows emitting events.\n\tprotected constructor(private readonly noListeners?: NoListenersCallback<TListeners>) {}\n\n\tprotected emit<K extends keyof TListeners>(\n\t\teventName: K,\n\t\t...args: Parameters<TListeners[K]>\n\t): void {\n\t\tconst listeners = this.listeners.get(eventName);\n\t\tif (listeners !== undefined) {\n\t\t\t// Current TS (5.4.5) cannot spread `args` into `listener()`, but assigning to an array first makes it work.\n\t\t\tconst argArray: unknown[] = args;\n\n\t\t\t// This explicitly copies listeners so that new listeners added during this call to emit will not receive this event.\n\t\t\tfor (const [off, listener] of [...listeners]) {\n\t\t\t\t// If listener has been unsubscribed while invoking other listeners, skip it.\n\t\t\t\tif (listeners.has(off)) {\n\t\t\t\t\tlistener(...argArray);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected emitAndCollect<K extends keyof TListeners>(\n\t\teventName: K,\n\t\t...args: Parameters<TListeners[K]>\n\t): ReturnType<TListeners[K]>[] {\n\t\tconst listeners = this.listeners.get(eventName);\n\t\tif (listeners !== undefined) {\n\t\t\tconst argArray: unknown[] = args;\n\t\t\tconst resultArray: ReturnType<TListeners[K]>[] = [];\n\t\t\tfor (const listener of [...listeners.values()]) {\n\t\t\t\tresultArray.push(listener(...argArray));\n\t\t\t}\n\t\t\treturn resultArray;\n\t\t}\n\t\treturn [];\n\t}\n\n\t/**\n\t * Register an event listener.\n\t * @param eventName - the name of the event\n\t * @param listener - the handler to run when the event is fired by the emitter\n\t * @returns a function which will deregister the listener when run.\n\t * This function will error if called more than once.\n\t */\n\tpublic on<K extends keyof Listeners<TListeners>>(\n\t\teventName: K,\n\t\tlistener: TListeners[K],\n\t): Off {\n\t\tconst off: Off = () => {\n\t\t\tconst currentListeners = this.listeners.get(eventName);\n\t\t\tif (currentListeners?.delete(off) === true) {\n\t\t\t\tif (currentListeners.size === 0) {\n\t\t\t\t\tthis.listeners.delete(eventName);\n\t\t\t\t\tthis.noListeners?.(eventName);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tgetOrCreate(this.listeners, eventName, () => new Map()).set(off, listener);\n\t\treturn off;\n\t}\n\n\tpublic hasListeners(eventName?: keyof TListeners): boolean {\n\t\tif (eventName === undefined) {\n\t\t\treturn this.listeners.size !== 0;\n\t\t}\n\t\treturn this.listeners.has(eventName);\n\t}\n}\n\n/**\n * This class exposes the constructor and the `emit` method of `EventEmitter`, elevating them from protected to public\n */\nexport class ComposableEventEmitter<TListeners extends Listeners<TListeners>>\n\textends EventEmitter<TListeners>\n\timplements IEmitter<TListeners>\n{\n\tpublic constructor(noListeners?: NoListenersCallback<TListeners>) {\n\t\tsuper(noListeners);\n\t}\n\n\tpublic override emit<K extends keyof TListeners>(\n\t\teventName: K,\n\t\t...args: Parameters<TListeners[K]>\n\t): void {\n\t\treturn super.emit(eventName, ...args);\n\t}\n\n\tpublic override emitAndCollect<K extends keyof TListeners>(\n\t\teventName: K,\n\t\t...args: Parameters<TListeners[K]>\n\t): ReturnType<TListeners[K]>[] {\n\t\treturn super.emitAndCollect(eventName, ...args);\n\t}\n}\n"]}
@@ -1,31 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- import type { ValueSchema } from "../core/index.js";
6
- import { FieldKinds } from "./default-schema/index.js";
7
- import { SchemaBuilderBase, type SchemaBuilderOptions } from "./schemaBuilderBase.js";
8
- import { LeafNodeSchema } from "./typed-schema/index.js";
9
- /**
10
- * Extends {@link SchemaBuilderBase} with functionality only used to create built in special libraries.
11
- * Defaults to "required" fields.
12
- * @privateRemarks Should not be package exported.
13
- */
14
- export declare class SchemaBuilderInternal<TScope extends `com.fluidframework.${string}`> extends SchemaBuilderBase<TScope, typeof FieldKinds.required> {
15
- constructor(options: SchemaBuilderOptions<TScope>);
16
- /**
17
- * Define (and add to this library) a {@link TreeNodeSchema} for a node that wraps a value.
18
- * Such nodes will be implicitly unwrapped to the value in some APIs.
19
- *
20
- * The name must be unique among all TreeNodeSchema in the the document schema.
21
- *
22
- * In addition to the normal properties of all nodes (having a schema for example),
23
- * Leaf nodes only contain a value.
24
- * Leaf nodes cannot have fields.
25
- *
26
- * TODO: Maybe ban undefined from allowed values here.
27
- * TODO: Decide and document how unwrapping works for non-primitive terminals.
28
- */
29
- leaf<Name extends string, const T extends ValueSchema>(name: Name, t: T): LeafNodeSchema<`${TScope}.${Name}`, T>;
30
- }
31
- //# sourceMappingURL=schemaBuilder.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schemaBuilder.d.ts","sourceRoot":"","sources":["../../src/feature-libraries/schemaBuilder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,KAAK,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACtF,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEzD;;;;GAIG;AACH,qBAAa,qBAAqB,CACjC,MAAM,SAAS,sBAAsB,MAAM,EAAE,CAC5C,SAAQ,iBAAiB,CAAC,MAAM,EAAE,OAAO,UAAU,CAAC,QAAQ,CAAC;gBAC3C,OAAO,EAAE,oBAAoB,CAAC,MAAM,CAAC;IAIxD;;;;;;;;;;;;OAYG;IACI,IAAI,CAAC,IAAI,SAAS,MAAM,EAAE,KAAK,CAAC,CAAC,SAAS,WAAW,EAC3D,IAAI,EAAE,IAAI,EACV,CAAC,EAAE,CAAC,GACF,cAAc,CAAC,GAAG,MAAM,IAAI,IAAI,EAAE,EAAE,CAAC,CAAC;CAKzC"}
@@ -1,36 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- import { FieldKinds } from "./default-schema/index.js";
6
- import { SchemaBuilderBase } from "./schemaBuilderBase.js";
7
- import { LeafNodeSchema } from "./typed-schema/index.js";
8
- /**
9
- * Extends {@link SchemaBuilderBase} with functionality only used to create built in special libraries.
10
- * Defaults to "required" fields.
11
- * @privateRemarks Should not be package exported.
12
- */
13
- export class SchemaBuilderInternal extends SchemaBuilderBase {
14
- constructor(options) {
15
- super(FieldKinds.required, options);
16
- }
17
- /**
18
- * Define (and add to this library) a {@link TreeNodeSchema} for a node that wraps a value.
19
- * Such nodes will be implicitly unwrapped to the value in some APIs.
20
- *
21
- * The name must be unique among all TreeNodeSchema in the the document schema.
22
- *
23
- * In addition to the normal properties of all nodes (having a schema for example),
24
- * Leaf nodes only contain a value.
25
- * Leaf nodes cannot have fields.
26
- *
27
- * TODO: Maybe ban undefined from allowed values here.
28
- * TODO: Decide and document how unwrapping works for non-primitive terminals.
29
- */
30
- leaf(name, t) {
31
- const schema = LeafNodeSchema.create(this, this.scoped(name), t);
32
- this.addNodeSchema(schema);
33
- return schema;
34
- }
35
- }
36
- //# sourceMappingURL=schemaBuilder.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schemaBuilder.js","sourceRoot":"","sources":["../../src/feature-libraries/schemaBuilder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAA6B,MAAM,wBAAwB,CAAC;AACtF,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEzD;;;;GAIG;AACH,MAAM,OAAO,qBAEX,SAAQ,iBAAqD;IAC9D,YAAmB,OAAqC;QACvD,KAAK,CAAC,UAAU,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACrC,CAAC;IAED;;;;;;;;;;;;OAYG;IACI,IAAI,CACV,IAAU,EACV,CAAI;QAEJ,MAAM,MAAM,GAAG,cAAc,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;QACjE,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;QAC3B,OAAO,MAAM,CAAC;IACf,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ValueSchema } from \"../core/index.js\";\n\nimport { FieldKinds } from \"./default-schema/index.js\";\nimport { SchemaBuilderBase, type SchemaBuilderOptions } from \"./schemaBuilderBase.js\";\nimport { LeafNodeSchema } from \"./typed-schema/index.js\";\n\n/**\n * Extends {@link SchemaBuilderBase} with functionality only used to create built in special libraries.\n * Defaults to \"required\" fields.\n * @privateRemarks Should not be package exported.\n */\nexport class SchemaBuilderInternal<\n\tTScope extends `com.fluidframework.${string}`,\n> extends SchemaBuilderBase<TScope, typeof FieldKinds.required> {\n\tpublic constructor(options: SchemaBuilderOptions<TScope>) {\n\t\tsuper(FieldKinds.required, options);\n\t}\n\n\t/**\n\t * Define (and add to this library) a {@link TreeNodeSchema} for a node that wraps a value.\n\t * Such nodes will be implicitly unwrapped to the value in some APIs.\n\t *\n\t * The name must be unique among all TreeNodeSchema in the the document schema.\n\t *\n\t * In addition to the normal properties of all nodes (having a schema for example),\n\t * Leaf nodes only contain a value.\n\t * Leaf nodes cannot have fields.\n\t *\n\t * TODO: Maybe ban undefined from allowed values here.\n\t * TODO: Decide and document how unwrapping works for non-primitive terminals.\n\t */\n\tpublic leaf<Name extends string, const T extends ValueSchema>(\n\t\tname: Name,\n\t\tt: T,\n\t): LeafNodeSchema<`${TScope}.${Name}`, T> {\n\t\tconst schema = LeafNodeSchema.create(this, this.scoped(name), t);\n\t\tthis.addNodeSchema(schema);\n\t\treturn schema;\n\t}\n}\n"]}
@@ -1,191 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- import type { TreeNodeSchemaIdentifier } from "../core/index.js";
6
- import { type Assume, type RestrictiveReadonlyRecord } from "../util/index.js";
7
- import type { FlexFieldKind } from "./modular-schema/index.js";
8
- import { Any, type FlexAllowedTypes, FlexFieldSchema, type FlexList, type FlexMapFieldSchema, FlexMapNodeSchema, FlexObjectNodeSchema, type FlexTreeNodeSchema, type FlexTreeSchema, type SchemaCollection, type SchemaLibraryData, type SchemaLintConfiguration, type Unenforced } from "./typed-schema/index.js";
9
- /**
10
- * Configuration for a SchemaBuilder.
11
- */
12
- export interface SchemaBuilderOptions<TScope extends string = string> {
13
- /**
14
- * Prefix appended to the identifiers of all {@link FlexTreeNodeSchema} produced by this builder.
15
- * Use of [Reverse domain name notation](https://en.wikipedia.org/wiki/Reverse_domain_name_notation) or a UUIDv4 is recommended to avoid collisions.
16
- */
17
- scope: TScope;
18
- /**
19
- * Name used to refer to this builder in error messages.
20
- * Has no impact on the actual generated schema.
21
- * Defaults to scope.
22
- */
23
- name?: string;
24
- /**
25
- * Optional configuration for "linting".
26
- * See {@link SchemaLintConfiguration}. Currently defaults to enabling all lints.
27
- */
28
- lint?: Partial<SchemaLintConfiguration>;
29
- /**
30
- * Libraries to include in this one.
31
- *
32
- * @remarks
33
- * Unlike adding of individual schema, adding of libraries is idempotent.
34
- * If a single library is added multiple times (even indirectly via libraries it was added into),
35
- * only a single copy will be included, so they will not conflict.
36
- * This allows adding any library this one depends on without risk of conflicts for users of this library.
37
- * Contents within the added libraries can still conflict however.
38
- * Such errors will be reported when finalizing this builder into a library or document schema.
39
- */
40
- libraries?: SchemaLibrary[];
41
- }
42
- /**
43
- * Builds schema libraries, and the schema within them.
44
- * *
45
- * @privateRemarks
46
- * This class does not directly depend on any specific field kinds,
47
- * or bake in any defaults that might have compatibility implications.
48
- * All use of such implicit defaults is done by subclasses, which thus get versioning implications.
49
- */
50
- export declare class SchemaBuilderBase<TScope extends string, TDefaultKind extends FlexFieldKind, TName extends number | string = string> {
51
- private readonly defaultKind;
52
- private readonly lintConfiguration;
53
- private readonly libraries;
54
- private finalized;
55
- private readonly treeNodeSchema;
56
- private readonly adapters;
57
- /**
58
- * Prefix appended to the identifiers of all {@link FlexTreeNodeSchema} produced by this builder.
59
- */
60
- readonly scope: TScope;
61
- /**
62
- * Used in error messages to identify content produced by this builder.
63
- */
64
- readonly name: string;
65
- /**
66
- * @param defaultKind - The default field kind to use when inferring a {@link FlexFieldSchema} from {@link FlexImplicitAllowedTypes}.
67
- */
68
- constructor(defaultKind: TDefaultKind, options: SchemaBuilderOptions<TScope>);
69
- protected scoped<Name extends TName>(name: Name): TreeNodeSchemaIdentifier<`${TScope}.${Name}`>;
70
- /**
71
- * Adds more libraries to this one.
72
- *
73
- * Unlike adding of individual schema, adding of libraries is idempotent.
74
- * If a single library is added multiple times (even indirectly via libraries it was added into),
75
- * only a single copy will be included, so they will not conflict.
76
- * This allows adding any library this one depends on without risk of conflicts for users of this library.
77
- * Contents within the added libraries can still conflict however.
78
- * Such errors will be reported when finalizing this builder into a library of document schema.
79
- */
80
- private addLibraries;
81
- protected addNodeSchema<T extends FlexTreeNodeSchema>(schema: T): void;
82
- private finalizeCommon;
83
- /**
84
- * Produce SchemaLibraries which capture the content added to this builder, as well as any additional SchemaLibraries that were added to it.
85
- * May only be called once after adding content to builder is complete.
86
- */
87
- intoLibrary(): SchemaLibrary;
88
- /**
89
- * Produce a TreeSchema which captures the content added to this builder, any additional SchemaLibraries that were added to it and a root field.
90
- * Can be used with schematize to provide schema aware access to document content.
91
- *
92
- * @remarks
93
- * May only be called once after adding content to builder is complete.
94
- */
95
- intoSchema<const TSchema extends FlexImplicitFieldSchema>(root: TSchema): FlexTreeSchema<NormalizeField<TSchema, TDefaultKind>>;
96
- /**
97
- * Define (and add to this library) a {@link FlexObjectNodeSchema}.
98
- *
99
- * The name must be unique among all TreeNodeSchema in the the document schema.
100
- */
101
- object<const Name extends TName, const T extends RestrictiveReadonlyRecord<string, FlexImplicitFieldSchema>>(name: Name, t: T): FlexObjectNodeSchema<`${TScope}.${Name}`, {
102
- [key in keyof T]: NormalizeField<T[key], TDefaultKind>;
103
- }>;
104
- /**
105
- * Same as `object` but with less type safety and works for recursive objects.
106
- * Reduced type safety is a side effect of a workaround for a TypeScript limitation.
107
- *
108
- * See {@link Unenforced} for details.
109
- *
110
- * TODO: Make this work with ImplicitFieldSchema.
111
- */
112
- objectRecursive<const Name extends TName, const T extends Unenforced<RestrictiveReadonlyRecord<string, FlexImplicitFieldSchema>>>(name: Name, t: T): FlexObjectNodeSchema<`${TScope}.${Name}`, T>;
113
- /**
114
- * Define (and add to this library) a {@link FlexMapNodeSchema}.
115
- */
116
- map<Name extends TName, const T extends FlexMapFieldSchema>(name: Name, fieldSchema: T): FlexMapNodeSchema<`${TScope}.${Name}`, T>;
117
- /**
118
- * Same as `map` but with less type safety and works for recursive objects.
119
- * Reduced type safety is a side effect of a workaround for a TypeScript limitation.
120
- *
121
- * See {@link Unenforced} for details.
122
- *
123
- * TODO: Make this work with ImplicitFieldSchema.
124
- */
125
- mapRecursive<Name extends TName, const T extends Unenforced<FlexMapFieldSchema>>(name: Name, t: T): FlexMapNodeSchema<`${TScope}.${Name}`, T>;
126
- /**
127
- * Define a {@link FlexFieldSchema}.
128
- *
129
- * @param kind - The [kind](https://en.wikipedia.org/wiki/Kind_(type_theory)) of this field.
130
- * Determine the multiplicity, viewing and editing APIs as well as the merge resolution policy.
131
- * @param allowedTypes - What types of children are allowed in this field.
132
- * @returns a {@link FlexFieldSchema} which can be used as a object field (see {@link SchemaBuilderBase.object}),
133
- * a map field (see {@link SchemaBuilderBase.map}), a field node (see {@link SchemaBuilderBase.fieldNode}) or the root field (see {@link SchemaBuilderBase.intoSchema}).
134
- *
135
- * @privateRemarks
136
- * TODO:
137
- * If a solution to TreeFieldSchema not being able to have extends clauses gets found,
138
- * consider just having users do `new TreeFieldSchema` instead?
139
- */
140
- static field<Kind extends FlexFieldKind, T extends FlexImplicitAllowedTypes>(kind: Kind, allowedTypes: T): FlexFieldSchema<Kind, NormalizeAllowedTypes<T>>;
141
- /**
142
- * Define a schema for a field.
143
- * Same as {@link SchemaBuilderBase.field} but is less type safe and supports recursive types.
144
- * This API is less safe to work around a [limitation of TypeScript](https://github.com/microsoft/TypeScript/issues/55758).
145
- *
146
- * T must extends `AllowedTypes`: This cannot be enforced via TypeScript since such an "extends" clauses cause recursive types to error with:
147
- * "'theSchema' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer."
148
- *
149
- * TODO: Try and find a way to provide a more specific type without triggering the above error.
150
- */
151
- static fieldRecursive<Kind extends FlexFieldKind, T extends FlexList<Unenforced<FlexTreeNodeSchema>>>(kind: Kind, ...allowedTypes: T): FlexFieldSchema<Kind, T>;
152
- /**
153
- * Normalizes an {@link FlexImplicitFieldSchema} into a {@link FlexFieldSchema} using this schema builder's `defaultKind`.
154
- */
155
- protected normalizeField<TSchema extends FlexImplicitFieldSchema>(schema: TSchema): NormalizeField<TSchema, TDefaultKind>;
156
- }
157
- /**
158
- * Schema information collected by a SchemaBuilder, including referenced libraries.
159
- * Can be aggregated into other libraries by adding to their builders.
160
- */
161
- export interface SchemaLibrary extends SchemaCollection {
162
- /**
163
- * Schema data aggregated from a collection of libraries by a SchemaBuilder.
164
- */
165
- readonly libraries: ReadonlySet<SchemaLibraryData>;
166
- }
167
- /**
168
- * Generalized version of AllowedTypes allowing for more concise expressions in some cases.
169
- */
170
- export type FlexImplicitAllowedTypes = FlexAllowedTypes | FlexTreeNodeSchema | Any;
171
- /**
172
- * Normalizes an {@link FlexImplicitAllowedTypes} into {@link FlexAllowedTypes}.
173
- */
174
- export type NormalizeAllowedTypes<TSchema extends FlexImplicitAllowedTypes> = TSchema extends FlexTreeNodeSchema ? readonly [TSchema] : TSchema extends Any ? readonly [Any] : TSchema;
175
- /**
176
- * Normalizes an {@link FlexImplicitAllowedTypes} into {@link FlexAllowedTypes}.
177
- */
178
- export declare function normalizeAllowedTypes<TSchema extends FlexImplicitAllowedTypes>(schema: TSchema): NormalizeAllowedTypes<TSchema>;
179
- /**
180
- * Normalizes an {@link FlexImplicitFieldSchema} into a {@link FlexFieldSchema}.
181
- */
182
- export type NormalizeField<TSchema extends FlexImplicitFieldSchema, TDefault extends FlexFieldKind> = TSchema extends FlexFieldSchema ? TSchema : FlexFieldSchema<TDefault, NormalizeAllowedTypes<Assume<TSchema, FlexImplicitAllowedTypes>>>;
183
- /**
184
- * Normalizes an {@link FlexImplicitFieldSchema} into a {@link FlexFieldSchema}.
185
- */
186
- export declare function normalizeField<TSchema extends FlexImplicitFieldSchema, TDefault extends FlexFieldKind>(schema: TSchema, defaultKind: TDefault): NormalizeField<TSchema, TDefault>;
187
- /**
188
- * Type that when combined with a default {@link FlexFieldKind} can be normalized into a {@link FlexFieldSchema}.
189
- */
190
- export type FlexImplicitFieldSchema = FlexFieldSchema | FlexImplicitAllowedTypes;
191
- //# sourceMappingURL=schemaBuilderBase.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schemaBuilderBase.d.ts","sourceRoot":"","sources":["../../src/feature-libraries/schemaBuilderBase.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAY,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EACN,KAAK,MAAM,EACX,KAAK,yBAAyB,EAE9B,MAAM,kBAAkB,CAAC;AAG1B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EACN,GAAG,EACH,KAAK,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AqB,CAAC,OAAO,CAAC,CAShC;AAED;;GAEG;AACH,MAAM,MAAM,cAAc,CACzB,OAAO,SAAS,uBAAuB,EACvC,QAAQ,SAAS,aAAa,IAC3B,OAAO,SAAS,eAAe,GAChC,OAAO,GACP,eAAe,CACf,QAAQ,EACR,qBAAqB,CAAC,MAAM,CAAC,OAAO,EAAE,wBAAwB,CAAC,CAAC,CAChE,CAAC;AAEJ;;GAEG;AACH,wBAAgB,cAAc,CAC7B,OAAO,SAAS,uBAAuB,EACvC,QAAQ,SAAS,aAAa,EAC7B,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,GAAG,cAAc,CAAC,OAAO,EAAE,QAAQ,CAAC,CAS3E;AAED;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG,eAAe,GAAG,wBAAwB,CAAC"}
@@ -1,195 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- import { assert } from "@fluidframework/core-utils/internal";
6
- import { transformObjectMap, } from "../util/index.js";
7
- import { defaultSchemaPolicy } from "./default-schema/index.js";
8
- import { Any, FlexFieldSchema, FlexMapNodeSchema, FlexObjectNodeSchema, TreeNodeSchemaBase, aggregateSchemaLibraries, schemaLintDefault, } from "./typed-schema/index.js";
9
- /**
10
- * Builds schema libraries, and the schema within them.
11
- * *
12
- * @privateRemarks
13
- * This class does not directly depend on any specific field kinds,
14
- * or bake in any defaults that might have compatibility implications.
15
- * All use of such implicit defaults is done by subclasses, which thus get versioning implications.
16
- */
17
- export class SchemaBuilderBase {
18
- /**
19
- * @param defaultKind - The default field kind to use when inferring a {@link FlexFieldSchema} from {@link FlexImplicitAllowedTypes}.
20
- */
21
- constructor(defaultKind, options) {
22
- this.defaultKind = defaultKind;
23
- this.finalized = false;
24
- this.treeNodeSchema = new Map();
25
- this.adapters = {};
26
- this.name = options.name ?? options.scope;
27
- this.lintConfiguration = { ...schemaLintDefault, ...options.lint };
28
- this.libraries = new Set();
29
- this.addLibraries(...(options.libraries ?? []));
30
- this.scope = options.scope;
31
- }
32
- scoped(name) {
33
- return `${this.scope}.${name}`;
34
- }
35
- /**
36
- * Adds more libraries to this one.
37
- *
38
- * Unlike adding of individual schema, adding of libraries is idempotent.
39
- * If a single library is added multiple times (even indirectly via libraries it was added into),
40
- * only a single copy will be included, so they will not conflict.
41
- * This allows adding any library this one depends on without risk of conflicts for users of this library.
42
- * Contents within the added libraries can still conflict however.
43
- * Such errors will be reported when finalizing this builder into a library of document schema.
44
- */
45
- addLibraries(...libraries) {
46
- for (const libs of libraries) {
47
- for (const lib of libs.libraries) {
48
- this.libraries.add(lib);
49
- }
50
- }
51
- }
52
- addNodeSchema(schema) {
53
- assert(!this.treeNodeSchema.has(schema.name), 0x799 /* Conflicting TreeNodeSchema names */);
54
- this.treeNodeSchema.set(schema.name, schema);
55
- }
56
- finalizeCommon(field) {
57
- assert(!this.finalized, 0x79a /* SchemaBuilder can only be finalized once. */);
58
- this.finalized = true;
59
- this.libraries.add({
60
- name: this.name,
61
- nodeSchema: this.treeNodeSchema,
62
- adapters: this.adapters,
63
- });
64
- // Check for errors and aggregate data
65
- return aggregateSchemaLibraries(this.name, this.lintConfiguration, this.libraries, field);
66
- }
67
- /**
68
- * Produce SchemaLibraries which capture the content added to this builder, as well as any additional SchemaLibraries that were added to it.
69
- * May only be called once after adding content to builder is complete.
70
- */
71
- intoLibrary() {
72
- const aggregated = this.finalizeCommon();
73
- // Full library set (instead of just aggregated) is kept since it is required to handle deduplication of libraries included through different paths.
74
- return { nodeSchema: aggregated.nodeSchema, libraries: this.libraries };
75
- }
76
- /**
77
- * Produce a TreeSchema which captures the content added to this builder, any additional SchemaLibraries that were added to it and a root field.
78
- * Can be used with schematize to provide schema aware access to document content.
79
- *
80
- * @remarks
81
- * May only be called once after adding content to builder is complete.
82
- */
83
- intoSchema(root) {
84
- // return this.toDocumentSchemaInternal(normalizeField(root, DefaultFieldKind));
85
- const field = this.normalizeField(root);
86
- const library = this.finalizeCommon(field);
87
- const typed = {
88
- nodeSchema: library.nodeSchema,
89
- adapters: library.adapters,
90
- rootFieldSchema: field,
91
- policy: defaultSchemaPolicy,
92
- };
93
- return typed;
94
- }
95
- /**
96
- * Define (and add to this library) a {@link FlexObjectNodeSchema}.
97
- *
98
- * The name must be unique among all TreeNodeSchema in the the document schema.
99
- */
100
- object(name, t) {
101
- const schema = FlexObjectNodeSchema.create(this, this.scoped(name), transformObjectMap(t, (field) => this.normalizeField(field)));
102
- this.addNodeSchema(schema);
103
- return schema;
104
- }
105
- /**
106
- * Same as `object` but with less type safety and works for recursive objects.
107
- * Reduced type safety is a side effect of a workaround for a TypeScript limitation.
108
- *
109
- * See {@link Unenforced} for details.
110
- *
111
- * TODO: Make this work with ImplicitFieldSchema.
112
- */
113
- objectRecursive(name, t) {
114
- return this.object(name, t);
115
- }
116
- /**
117
- * Define (and add to this library) a {@link FlexMapNodeSchema}.
118
- */
119
- map(name, fieldSchema) {
120
- const schema = FlexMapNodeSchema.create(this, this.scoped(name), fieldSchema);
121
- this.addNodeSchema(schema);
122
- return schema;
123
- }
124
- /**
125
- * Same as `map` but with less type safety and works for recursive objects.
126
- * Reduced type safety is a side effect of a workaround for a TypeScript limitation.
127
- *
128
- * See {@link Unenforced} for details.
129
- *
130
- * TODO: Make this work with ImplicitFieldSchema.
131
- */
132
- mapRecursive(name, t) {
133
- return this.map(name, t);
134
- }
135
- /**
136
- * Define a {@link FlexFieldSchema}.
137
- *
138
- * @param kind - The [kind](https://en.wikipedia.org/wiki/Kind_(type_theory)) of this field.
139
- * Determine the multiplicity, viewing and editing APIs as well as the merge resolution policy.
140
- * @param allowedTypes - What types of children are allowed in this field.
141
- * @returns a {@link FlexFieldSchema} which can be used as a object field (see {@link SchemaBuilderBase.object}),
142
- * a map field (see {@link SchemaBuilderBase.map}), a field node (see {@link SchemaBuilderBase.fieldNode}) or the root field (see {@link SchemaBuilderBase.intoSchema}).
143
- *
144
- * @privateRemarks
145
- * TODO:
146
- * If a solution to TreeFieldSchema not being able to have extends clauses gets found,
147
- * consider just having users do `new TreeFieldSchema` instead?
148
- */
149
- static field(kind, allowedTypes) {
150
- return FlexFieldSchema.create(kind, normalizeAllowedTypes(allowedTypes));
151
- }
152
- /**
153
- * Define a schema for a field.
154
- * Same as {@link SchemaBuilderBase.field} but is less type safe and supports recursive types.
155
- * This API is less safe to work around a [limitation of TypeScript](https://github.com/microsoft/TypeScript/issues/55758).
156
- *
157
- * T must extends `AllowedTypes`: This cannot be enforced via TypeScript since such an "extends" clauses cause recursive types to error with:
158
- * "'theSchema' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer."
159
- *
160
- * TODO: Try and find a way to provide a more specific type without triggering the above error.
161
- */
162
- static fieldRecursive(kind, ...allowedTypes) {
163
- return FlexFieldSchema.createUnsafe(kind, allowedTypes);
164
- }
165
- /**
166
- * Normalizes an {@link FlexImplicitFieldSchema} into a {@link FlexFieldSchema} using this schema builder's `defaultKind`.
167
- */
168
- normalizeField(schema) {
169
- return normalizeField(schema, this.defaultKind);
170
- }
171
- }
172
- /**
173
- * Normalizes an {@link FlexImplicitAllowedTypes} into {@link FlexAllowedTypes}.
174
- */
175
- export function normalizeAllowedTypes(schema) {
176
- if (schema === Any) {
177
- return [Any];
178
- }
179
- if (schema instanceof TreeNodeSchemaBase) {
180
- return [schema];
181
- }
182
- assert(Array.isArray(schema), 0x7c6 /* invalid ImplicitAllowedTypes */);
183
- return schema;
184
- }
185
- /**
186
- * Normalizes an {@link FlexImplicitFieldSchema} into a {@link FlexFieldSchema}.
187
- */
188
- export function normalizeField(schema, defaultKind) {
189
- if (schema instanceof FlexFieldSchema) {
190
- return schema;
191
- }
192
- const allowedTypes = normalizeAllowedTypes(schema);
193
- return FlexFieldSchema.create(defaultKind, allowedTypes);
194
- }
195
- //# sourceMappingURL=schemaBuilderBase.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schemaBuilderBase.js","sourceRoot":"","sources":["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AAM,CAAC,cAAc,CAI1B,IAAU,EAAE,GAAG,YAAe;QAC/B,OAAO,eAAe,CAAC,YAAY,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;IACzD,CAAC;IAED;;OAEG;IACO,cAAc,CACvB,MAAe;QAEf,OAAO,cAAc,CAAC,MAAM,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IACjD,CAAC;CACD;AA4BD;;GAEG;AACH,MAAM,UAAU,qBAAqB,CACpC,MAAe;IAEf,IAAI,MAAM,KAAK,GAAG,EAAE,CAAC;QACpB,OAAO,CAAC,GAAG,CAA8C,CAAC;IAC3D,CAAC;IACD,IAAI,MAAM,YAAY,kBAAkB,EAAE,CAAC;QAC1C,OAAO,CAAC,MAAM,CAA8C,CAAC;IAC9D,CAAC;IACD,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC,kCAAkC,CAAC,CAAC;IACxE,OAAO,MAAmD,CAAC;AAC5D,CAAC;AAeD;;GAEG;AACH,MAAM,UAAU,cAAc,CAG5B,MAAe,EAAE,WAAqB;IACvC,IAAI,MAAM,YAAY,eAAe,EAAE,CAAC;QACvC,OAAO,MAA2C,CAAC;IACpD,CAAC;IACD,MAAM,YAAY,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC;IACnD,OAAO,eAAe,CAAC,MAAM,CAAC,WAAW,EAAE,YAAY,CAGtD,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\n\nimport type { Adapters, TreeNodeSchemaIdentifier } from \"../core/index.js\";\nimport {\n\ttype Assume,\n\ttype RestrictiveReadonlyRecord,\n\ttransformObjectMap,\n} from \"../util/index.js\";\n\nimport { defaultSchemaPolicy } from \"./default-schema/index.js\";\nimport type { FlexFieldKind } from \"./modular-schema/index.js\";\nimport {\n\tAny,\n\ttype FlexAllowedTypes,\n\tFlexFieldSchema,\n\ttype FlexList,\n\ttype FlexMapFieldSchema,\n\tFlexMapNodeSchema,\n\tFlexObjectNodeSchema,\n\ttype FlexTreeNodeSchema,\n\ttype FlexTreeSchema,\n\ttype SchemaCollection,\n\ttype SchemaLibraryData,\n\ttype SchemaLintConfiguration,\n\tTreeNodeSchemaBase,\n\ttype Unenforced,\n\taggregateSchemaLibraries,\n\tschemaLintDefault,\n} from \"./typed-schema/index.js\";\n\n/**\n * Configuration for a SchemaBuilder.\n */\nexport interface SchemaBuilderOptions<TScope extends string = string> {\n\t/**\n\t * Prefix appended to the identifiers of all {@link FlexTreeNodeSchema} produced by this builder.\n\t * Use of [Reverse domain name notation](https://en.wikipedia.org/wiki/Reverse_domain_name_notation) or a UUIDv4 is recommended to avoid collisions.\n\t */\n\tscope: TScope;\n\n\t/**\n\t * Name used to refer to this builder in error messages.\n\t * Has no impact on the actual generated schema.\n\t * Defaults to scope.\n\t */\n\tname?: string;\n\n\t/**\n\t * Optional configuration for \"linting\".\n\t * See {@link SchemaLintConfiguration}. Currently defaults to enabling all lints.\n\t */\n\tlint?: Partial<SchemaLintConfiguration>;\n\n\t/**\n\t * Libraries to include in this one.\n\t *\n\t * @remarks\n\t * Unlike adding of individual schema, adding of libraries is idempotent.\n\t * If a single library is added multiple times (even indirectly via libraries it was added into),\n\t * only a single copy will be included, so they will not conflict.\n\t * This allows adding any library this one depends on without risk of conflicts for users of this library.\n\t * Contents within the added libraries can still conflict however.\n\t * Such errors will be reported when finalizing this builder into a library or document schema.\n\t */\n\tlibraries?: SchemaLibrary[];\n}\n\n/**\n * Builds schema libraries, and the schema within them.\n * *\n * @privateRemarks\n * This class does not directly depend on any specific field kinds,\n * or bake in any defaults that might have compatibility implications.\n * All use of such implicit defaults is done by subclasses, which thus get versioning implications.\n */\nexport class SchemaBuilderBase<\n\tTScope extends string,\n\tTDefaultKind extends FlexFieldKind,\n\tTName extends number | string = string,\n> {\n\tprivate readonly lintConfiguration: SchemaLintConfiguration;\n\tprivate readonly libraries: Set<SchemaLibraryData>;\n\tprivate finalized: boolean = false;\n\tprivate readonly treeNodeSchema: Map<TreeNodeSchemaIdentifier, FlexTreeNodeSchema> =\n\t\tnew Map();\n\tprivate readonly adapters: Adapters = {};\n\t/**\n\t * Prefix appended to the identifiers of all {@link FlexTreeNodeSchema} produced by this builder.\n\t */\n\tpublic readonly scope: TScope;\n\n\t/**\n\t * Used in error messages to identify content produced by this builder.\n\t */\n\tpublic readonly name: string;\n\n\t/**\n\t * @param defaultKind - The default field kind to use when inferring a {@link FlexFieldSchema} from {@link FlexImplicitAllowedTypes}.\n\t */\n\tpublic constructor(\n\t\tprivate readonly defaultKind: TDefaultKind,\n\t\toptions: SchemaBuilderOptions<TScope>,\n\t) {\n\t\tthis.name = options.name ?? options.scope;\n\t\tthis.lintConfiguration = { ...schemaLintDefault, ...options.lint };\n\t\tthis.libraries = new Set();\n\t\tthis.addLibraries(...(options.libraries ?? []));\n\t\tthis.scope = options.scope;\n\t}\n\n\tprotected scoped<Name extends TName>(\n\t\tname: Name,\n\t): TreeNodeSchemaIdentifier<`${TScope}.${Name}`> {\n\t\treturn `${this.scope}.${name}` as TreeNodeSchemaIdentifier<`${TScope}.${Name}`>;\n\t}\n\n\t/**\n\t * Adds more libraries to this one.\n\t *\n\t * Unlike adding of individual schema, adding of libraries is idempotent.\n\t * If a single library is added multiple times (even indirectly via libraries it was added into),\n\t * only a single copy will be included, so they will not conflict.\n\t * This allows adding any library this one depends on without risk of conflicts for users of this library.\n\t * Contents within the added libraries can still conflict however.\n\t * Such errors will be reported when finalizing this builder into a library of document schema.\n\t */\n\tprivate addLibraries(...libraries: SchemaLibrary[]): void {\n\t\tfor (const libs of libraries) {\n\t\t\tfor (const lib of libs.libraries) {\n\t\t\t\tthis.libraries.add(lib);\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected addNodeSchema<T extends FlexTreeNodeSchema>(schema: T): void {\n\t\tassert(\n\t\t\t!this.treeNodeSchema.has(schema.name),\n\t\t\t0x799 /* Conflicting TreeNodeSchema names */,\n\t\t);\n\t\tthis.treeNodeSchema.set(schema.name, schema);\n\t}\n\n\tprivate finalizeCommon(field?: FlexFieldSchema): SchemaLibraryData {\n\t\tassert(!this.finalized, 0x79a /* SchemaBuilder can only be finalized once. */);\n\t\tthis.finalized = true;\n\t\tthis.libraries.add({\n\t\t\tname: this.name,\n\t\t\tnodeSchema: this.treeNodeSchema,\n\t\t\tadapters: this.adapters,\n\t\t});\n\n\t\t// Check for errors and aggregate data\n\t\treturn aggregateSchemaLibraries(this.name, this.lintConfiguration, this.libraries, field);\n\t}\n\n\t/**\n\t * Produce SchemaLibraries which capture the content added to this builder, as well as any additional SchemaLibraries that were added to it.\n\t * May only be called once after adding content to builder is complete.\n\t */\n\tpublic intoLibrary(): SchemaLibrary {\n\t\tconst aggregated = this.finalizeCommon();\n\n\t\t// Full library set (instead of just aggregated) is kept since it is required to handle deduplication of libraries included through different paths.\n\t\treturn { nodeSchema: aggregated.nodeSchema, libraries: this.libraries };\n\t}\n\n\t/**\n\t * Produce a TreeSchema which captures the content added to this builder, any additional SchemaLibraries that were added to it and a root field.\n\t * Can be used with schematize to provide schema aware access to document content.\n\t *\n\t * @remarks\n\t * May only be called once after adding content to builder is complete.\n\t */\n\tpublic intoSchema<const TSchema extends FlexImplicitFieldSchema>(\n\t\troot: TSchema,\n\t): FlexTreeSchema<NormalizeField<TSchema, TDefaultKind>> {\n\t\t// return this.toDocumentSchemaInternal(normalizeField(root, DefaultFieldKind));\n\t\tconst field: NormalizeField<TSchema, TDefaultKind> = this.normalizeField(root);\n\t\tconst library = this.finalizeCommon(field);\n\n\t\tconst typed: FlexTreeSchema<NormalizeField<TSchema, TDefaultKind>> = {\n\t\t\tnodeSchema: library.nodeSchema,\n\t\t\tadapters: library.adapters,\n\t\t\trootFieldSchema: field,\n\t\t\tpolicy: defaultSchemaPolicy,\n\t\t};\n\t\treturn typed;\n\t}\n\n\t/**\n\t * Define (and add to this library) a {@link FlexObjectNodeSchema}.\n\t *\n\t * The name must be unique among all TreeNodeSchema in the the document schema.\n\t */\n\tpublic object<\n\t\tconst Name extends TName,\n\t\tconst T extends RestrictiveReadonlyRecord<string, FlexImplicitFieldSchema>,\n\t>(\n\t\tname: Name,\n\t\tt: T,\n\t): FlexObjectNodeSchema<\n\t\t`${TScope}.${Name}`,\n\t\t{ [key in keyof T]: NormalizeField<T[key], TDefaultKind> }\n\t> {\n\t\tconst schema = FlexObjectNodeSchema.create(\n\t\t\tthis,\n\t\t\tthis.scoped(name),\n\t\t\ttransformObjectMap(t, (field): FlexFieldSchema => this.normalizeField(field)) as {\n\t\t\t\t[key in keyof T]: NormalizeField<T[key], TDefaultKind>;\n\t\t\t},\n\t\t);\n\t\tthis.addNodeSchema(schema);\n\t\treturn schema;\n\t}\n\n\t/**\n\t * Same as `object` but with less type safety and works for recursive objects.\n\t * Reduced type safety is a side effect of a workaround for a TypeScript limitation.\n\t *\n\t * See {@link Unenforced} for details.\n\t *\n\t * TODO: Make this work with ImplicitFieldSchema.\n\t */\n\tpublic objectRecursive<\n\t\tconst Name extends TName,\n\t\tconst T extends Unenforced<RestrictiveReadonlyRecord<string, FlexImplicitFieldSchema>>,\n\t>(name: Name, t: T): FlexObjectNodeSchema<`${TScope}.${Name}`, T> {\n\t\treturn this.object(\n\t\t\tname,\n\t\t\tt as unknown as RestrictiveReadonlyRecord<string, FlexImplicitFieldSchema>,\n\t\t) as unknown as FlexObjectNodeSchema<`${TScope}.${Name}`, T>;\n\t}\n\n\t/**\n\t * Define (and add to this library) a {@link FlexMapNodeSchema}.\n\t */\n\tpublic map<Name extends TName, const T extends FlexMapFieldSchema>(\n\t\tname: Name,\n\t\tfieldSchema: T,\n\t): FlexMapNodeSchema<`${TScope}.${Name}`, T> {\n\t\tconst schema = FlexMapNodeSchema.create(this, this.scoped(name), fieldSchema);\n\t\tthis.addNodeSchema(schema);\n\t\treturn schema;\n\t}\n\n\t/**\n\t * Same as `map` but with less type safety and works for recursive objects.\n\t * Reduced type safety is a side effect of a workaround for a TypeScript limitation.\n\t *\n\t * See {@link Unenforced} for details.\n\t *\n\t * TODO: Make this work with ImplicitFieldSchema.\n\t */\n\tpublic mapRecursive<Name extends TName, const T extends Unenforced<FlexMapFieldSchema>>(\n\t\tname: Name,\n\t\tt: T,\n\t): FlexMapNodeSchema<`${TScope}.${Name}`, T> {\n\t\treturn this.map(name, t as FlexMapFieldSchema) as FlexMapNodeSchema<\n\t\t\t`${TScope}.${Name}`,\n\t\t\tT\n\t\t>;\n\t}\n\n\t/**\n\t * Define a {@link FlexFieldSchema}.\n\t *\n\t * @param kind - The [kind](https://en.wikipedia.org/wiki/Kind_(type_theory)) 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 children are allowed in this field.\n\t * @returns a {@link FlexFieldSchema} which can be used as a object field (see {@link SchemaBuilderBase.object}),\n\t * a map field (see {@link SchemaBuilderBase.map}), a field node (see {@link SchemaBuilderBase.fieldNode}) or the root field (see {@link SchemaBuilderBase.intoSchema}).\n\t *\n\t * @privateRemarks\n\t * TODO:\n\t * If a solution to TreeFieldSchema not being able to have extends clauses gets found,\n\t * consider just having users do `new TreeFieldSchema` instead?\n\t */\n\tpublic static field<Kind extends FlexFieldKind, T extends FlexImplicitAllowedTypes>(\n\t\tkind: Kind,\n\t\tallowedTypes: T,\n\t): FlexFieldSchema<Kind, NormalizeAllowedTypes<T>> {\n\t\treturn FlexFieldSchema.create(kind, normalizeAllowedTypes(allowedTypes));\n\t}\n\n\t/**\n\t * Define a schema for a field.\n\t * Same as {@link SchemaBuilderBase.field} but is less type safe and supports recursive types.\n\t * This API is less safe to work around a [limitation of TypeScript](https://github.com/microsoft/TypeScript/issues/55758).\n\t *\n\t * T must extends `AllowedTypes`: This cannot be enforced via TypeScript since such an \"extends\" clauses cause recursive types to error with:\n\t * \"'theSchema' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.\"\n\t *\n\t * TODO: Try and find a way to provide a more specific type without triggering the above error.\n\t */\n\tpublic static fieldRecursive<\n\t\tKind extends FlexFieldKind,\n\t\t// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-arguments\n\t\tT extends FlexList<Unenforced<FlexTreeNodeSchema>>,\n\t>(kind: Kind, ...allowedTypes: T): FlexFieldSchema<Kind, T> {\n\t\treturn FlexFieldSchema.createUnsafe(kind, allowedTypes);\n\t}\n\n\t/**\n\t * Normalizes an {@link FlexImplicitFieldSchema} into a {@link FlexFieldSchema} using this schema builder's `defaultKind`.\n\t */\n\tprotected normalizeField<TSchema extends FlexImplicitFieldSchema>(\n\t\tschema: TSchema,\n\t): NormalizeField<TSchema, TDefaultKind> {\n\t\treturn normalizeField(schema, this.defaultKind);\n\t}\n}\n\n/**\n * Schema information collected by a SchemaBuilder, including referenced libraries.\n * Can be aggregated into other libraries by adding to their builders.\n */\nexport interface SchemaLibrary extends SchemaCollection {\n\t/**\n\t * Schema data aggregated from a collection of libraries by a SchemaBuilder.\n\t */\n\treadonly libraries: ReadonlySet<SchemaLibraryData>;\n}\n\n/**\n * Generalized version of AllowedTypes allowing for more concise expressions in some cases.\n */\nexport type FlexImplicitAllowedTypes = FlexAllowedTypes | FlexTreeNodeSchema | Any;\n\n/**\n * Normalizes an {@link FlexImplicitAllowedTypes} into {@link FlexAllowedTypes}.\n */\nexport type NormalizeAllowedTypes<TSchema extends FlexImplicitAllowedTypes> =\n\tTSchema extends FlexTreeNodeSchema\n\t\t? readonly [TSchema]\n\t\t: TSchema extends Any\n\t\t\t? readonly [Any]\n\t\t\t: TSchema;\n\n/**\n * Normalizes an {@link FlexImplicitAllowedTypes} into {@link FlexAllowedTypes}.\n */\nexport function normalizeAllowedTypes<TSchema extends FlexImplicitAllowedTypes>(\n\tschema: TSchema,\n): NormalizeAllowedTypes<TSchema> {\n\tif (schema === Any) {\n\t\treturn [Any] as unknown as NormalizeAllowedTypes<TSchema>;\n\t}\n\tif (schema instanceof TreeNodeSchemaBase) {\n\t\treturn [schema] as unknown as NormalizeAllowedTypes<TSchema>;\n\t}\n\tassert(Array.isArray(schema), 0x7c6 /* invalid ImplicitAllowedTypes */);\n\treturn schema as unknown as NormalizeAllowedTypes<TSchema>;\n}\n\n/**\n * Normalizes an {@link FlexImplicitFieldSchema} into a {@link FlexFieldSchema}.\n */\nexport type NormalizeField<\n\tTSchema extends FlexImplicitFieldSchema,\n\tTDefault extends FlexFieldKind,\n> = TSchema extends FlexFieldSchema\n\t? TSchema\n\t: FlexFieldSchema<\n\t\t\tTDefault,\n\t\t\tNormalizeAllowedTypes<Assume<TSchema, FlexImplicitAllowedTypes>>\n\t\t>;\n\n/**\n * Normalizes an {@link FlexImplicitFieldSchema} into a {@link FlexFieldSchema}.\n */\nexport function normalizeField<\n\tTSchema extends FlexImplicitFieldSchema,\n\tTDefault extends FlexFieldKind,\n>(schema: TSchema, defaultKind: TDefault): NormalizeField<TSchema, TDefault> {\n\tif (schema instanceof FlexFieldSchema) {\n\t\treturn schema as NormalizeField<TSchema, TDefault>;\n\t}\n\tconst allowedTypes = normalizeAllowedTypes(schema);\n\treturn FlexFieldSchema.create(defaultKind, allowedTypes) as unknown as NormalizeField<\n\t\tTSchema,\n\t\tTDefault\n\t>;\n}\n\n/**\n * Type that when combined with a default {@link FlexFieldKind} can be normalized into a {@link FlexFieldSchema}.\n */\nexport type FlexImplicitFieldSchema = FlexFieldSchema | FlexImplicitAllowedTypes;\n"]}
@@ -1,73 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- import { type Context, type FlexFieldSchema, type FlexTreeContext, type FlexTreeSchema, type FlexTreeTypedField, type NodeKeyManager } from "../feature-libraries/index.js";
6
- import { type IDisposable, disposeSymbol } from "../util/index.js";
7
- import type { ITreeCheckout, ITreeCheckoutFork } from "./treeCheckout.js";
8
- /**
9
- * The portion of {@link FlexTreeView} that does not depend on the schema's type.
10
- * @privateRemarks
11
- * Since {@link FlexTreeView}'s schema is invariant, `FlexTreeView<FlexFieldSchema>` does not cover this use case.
12
- */
13
- export interface FlexTreeViewGeneric extends IDisposable {
14
- /**
15
- * Context for controlling the FlexTree nodes produced from {@link FlexTreeView.flexTree}.
16
- *
17
- * @remarks
18
- * This is an owning reference: disposing of this view disposes its context.
19
- */
20
- readonly context: FlexTreeContext;
21
- /**
22
- * Access non-view schema specific aspects of of this branch.
23
- *
24
- * @remarks
25
- * This is a non-owning reference: disposing of this view does not impact the branch.
26
- */
27
- readonly checkout: ITreeCheckout;
28
- }
29
- /**
30
- * An editable view of a (version control style) branch of a shared tree.
31
- * @privateRemarks
32
- * TODO:
33
- * If schema aware APIs are removed from flex tree, this can be combined with {@link FlexTreeViewGeneric}.
34
- */
35
- export interface FlexTreeView<in out TRoot extends FlexFieldSchema> extends FlexTreeViewGeneric {
36
- /**
37
- * Get a typed view of the tree content using the flex-tree API.
38
- */
39
- readonly flexTree: FlexTreeTypedField<TRoot>;
40
- /**
41
- * Spawn a new view which is based off of the current state of this view.
42
- * Any mutations of the new view will not apply to this view until the new view is merged back into this view via `merge()`.
43
- */
44
- fork(): ITreeViewFork<TRoot>;
45
- }
46
- /**
47
- * Branch (like in a version control system) of SharedTree.
48
- *
49
- * {@link FlexTreeView} that has forked off of the main trunk/branch.
50
- */
51
- export interface ITreeViewFork<in out TRoot extends FlexFieldSchema> extends FlexTreeView<TRoot> {
52
- readonly checkout: ITreeCheckoutFork;
53
- }
54
- /**
55
- * Implementation of FlexTreeView wrapping a ITreeCheckout.
56
- */
57
- export declare class CheckoutFlexTreeView<in out TRoot extends FlexFieldSchema, out TCheckout extends ITreeCheckout = ITreeCheckout> implements FlexTreeView<TRoot> {
58
- readonly checkout: TCheckout;
59
- readonly schema: FlexTreeSchema<TRoot>;
60
- readonly nodeKeyManager: NodeKeyManager;
61
- private readonly onDispose?;
62
- readonly context: Context;
63
- readonly flexTree: FlexTreeTypedField<TRoot>;
64
- constructor(checkout: TCheckout, schema: FlexTreeSchema<TRoot>, nodeKeyManager: NodeKeyManager, onDispose?: (() => void) | undefined);
65
- [disposeSymbol](): void;
66
- fork(): CheckoutFlexTreeView<TRoot, ITreeCheckout & ITreeCheckoutFork>;
67
- }
68
- /**
69
- * Maps the context of every {@link CheckoutFlexTreeView} to the view.
70
- * In practice, this allows the view or checkout to be obtained from a flex node by first getting the context from the flex node and then using this map.
71
- */
72
- export declare const contextToTreeView: WeakMap<Context, FlexTreeViewGeneric>;
73
- //# sourceMappingURL=treeView.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"treeView.d.ts","sourceRoot":"","sources":["../../src/shared-tree/treeView.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,OAAO,EACZ,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EAEnB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,KAAK,WAAW,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEnE,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAE1E;;;;GAIG;AACH,MAAM,WAAW,mBAAoB,SAAQ,WAAW;IACvD;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC;IAElC;;;;;OAKG;IACH,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC;CACjC;AAED;;;;;GAKG;AACH,MAAM,WAAW,YAAY,CAAC,EAAE,CAAC,GAAG,CAAC,KAAK,SAAS,eAAe,CACjE,SAAQ,mBAAmB;IAC3B;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAE7C;;;OAGG;IACH,IAAI,IAAI,aAAa,CAAC,KAAK,CAAC,CAAC;CAC7B;AAED;;;;GAIG;AACH,MAAM,WAAW,aAAa,CAAC,EAAE,CAAC,GAAG,CAA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