@fluidframework/tree 2.3.0-288113 → 2.4.0-294316

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 (900) 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 +42 -54
  14. package/api-report/tree.beta.api.md +35 -16
  15. package/api-report/tree.legacy.alpha.api.md +571 -0
  16. package/api-report/tree.legacy.public.api.md +568 -0
  17. package/api-report/tree.public.api.md +22 -18
  18. package/dist/alpha.d.ts +103 -0
  19. package/dist/beta.d.ts +7 -2
  20. package/dist/core/index.d.ts +2 -2
  21. package/dist/core/index.d.ts.map +1 -1
  22. package/dist/core/index.js +4 -3
  23. package/dist/core/index.js.map +1 -1
  24. package/dist/core/rebase/index.d.ts +1 -1
  25. package/dist/core/rebase/index.d.ts.map +1 -1
  26. package/dist/core/rebase/index.js +2 -1
  27. package/dist/core/rebase/index.js.map +1 -1
  28. package/dist/core/rebase/types.d.ts +1 -0
  29. package/dist/core/rebase/types.d.ts.map +1 -1
  30. package/dist/core/rebase/types.js +8 -1
  31. package/dist/core/rebase/types.js.map +1 -1
  32. package/dist/core/{revertible/revertible.d.ts → revertible.d.ts} +12 -0
  33. package/dist/core/revertible.d.ts.map +1 -0
  34. package/dist/core/revertible.js.map +1 -0
  35. package/dist/core/schema-stored/format.d.ts +3 -3
  36. package/dist/core/schema-stored/format.js +1 -1
  37. package/dist/core/schema-stored/format.js.map +1 -1
  38. package/dist/core/schema-stored/schema.d.ts +2 -7
  39. package/dist/core/schema-stored/schema.d.ts.map +1 -1
  40. package/dist/core/schema-stored/schema.js +4 -6
  41. package/dist/core/schema-stored/schema.js.map +1 -1
  42. package/dist/core/schema-stored/storedSchemaRepository.d.ts +1 -1
  43. package/dist/core/schema-stored/storedSchemaRepository.d.ts.map +1 -1
  44. package/dist/core/tree/anchorSet.d.ts.map +1 -1
  45. package/dist/core/tree/anchorSet.js +6 -2
  46. package/dist/core/tree/anchorSet.js.map +1 -1
  47. package/dist/core/tree/detachedFieldIndex.d.ts +0 -1
  48. package/dist/core/tree/detachedFieldIndex.d.ts.map +1 -1
  49. package/dist/core/tree/detachedFieldIndex.js +1 -0
  50. package/dist/core/tree/detachedFieldIndex.js.map +1 -1
  51. package/dist/core/tree/visitDelta.d.ts +7 -2
  52. package/dist/core/tree/visitDelta.d.ts.map +1 -1
  53. package/dist/core/tree/visitDelta.js.map +1 -1
  54. package/dist/events/emitter.d.ts +127 -0
  55. package/dist/events/emitter.d.ts.map +1 -0
  56. package/dist/events/{events.js → emitter.js} +48 -30
  57. package/dist/events/emitter.js.map +1 -0
  58. package/dist/events/index.d.ts +2 -1
  59. package/dist/events/index.d.ts.map +1 -1
  60. package/dist/events/index.js +4 -5
  61. package/dist/events/index.js.map +1 -1
  62. package/dist/events/interop.d.ts +36 -0
  63. package/dist/events/interop.d.ts.map +1 -0
  64. package/dist/{core/revertible/index.d.ts → events/interop.js} +3 -2
  65. package/dist/events/interop.js.map +1 -0
  66. package/dist/events/listeners.d.ts +65 -0
  67. package/dist/events/listeners.d.ts.map +1 -0
  68. package/{lib/core/revertible/index.d.ts → dist/events/listeners.js} +3 -2
  69. package/dist/events/listeners.js.map +1 -0
  70. package/dist/feature-libraries/chunked-forest/chunkTree.d.ts +25 -7
  71. package/dist/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  72. package/dist/feature-libraries/chunked-forest/chunkTree.js +36 -15
  73. package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  74. package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts +4 -2
  75. package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  76. package/dist/feature-libraries/chunked-forest/chunkedForest.js +12 -5
  77. package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  78. package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts +15 -2
  79. package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
  80. package/dist/feature-libraries/chunked-forest/uniformChunk.js +28 -2
  81. package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  82. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts +3 -1
  83. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  84. package/dist/feature-libraries/default-schema/defaultEditBuilder.js +5 -4
  85. package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  86. package/dist/feature-libraries/flex-map-tree/index.d.ts +1 -1
  87. package/dist/feature-libraries/flex-map-tree/index.d.ts.map +1 -1
  88. package/dist/feature-libraries/flex-map-tree/index.js +2 -1
  89. package/dist/feature-libraries/flex-map-tree/index.js.map +1 -1
  90. package/dist/feature-libraries/flex-map-tree/mapTreeNode.d.ts +35 -33
  91. package/dist/feature-libraries/flex-map-tree/mapTreeNode.d.ts.map +1 -1
  92. package/dist/feature-libraries/flex-map-tree/mapTreeNode.js +82 -103
  93. package/dist/feature-libraries/flex-map-tree/mapTreeNode.js.map +1 -1
  94. package/dist/feature-libraries/flex-tree/context.d.ts +30 -14
  95. package/dist/feature-libraries/flex-tree/context.d.ts.map +1 -1
  96. package/dist/feature-libraries/flex-tree/context.js +10 -7
  97. package/dist/feature-libraries/flex-tree/context.js.map +1 -1
  98. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts +57 -190
  99. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  100. package/dist/feature-libraries/flex-tree/flexTreeTypes.js +15 -3
  101. package/dist/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  102. package/dist/feature-libraries/flex-tree/index.d.ts +2 -3
  103. package/dist/feature-libraries/flex-tree/index.d.ts.map +1 -1
  104. package/dist/feature-libraries/flex-tree/index.js.map +1 -1
  105. package/dist/feature-libraries/flex-tree/lazyEntity.d.ts +3 -3
  106. package/dist/feature-libraries/flex-tree/lazyEntity.d.ts.map +1 -1
  107. package/dist/feature-libraries/flex-tree/lazyEntity.js +2 -10
  108. package/dist/feature-libraries/flex-tree/lazyEntity.js.map +1 -1
  109. package/dist/feature-libraries/flex-tree/lazyField.d.ts +26 -28
  110. package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  111. package/dist/feature-libraries/flex-tree/lazyField.js +11 -14
  112. package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
  113. package/dist/feature-libraries/flex-tree/lazyNode.d.ts +5 -26
  114. package/dist/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  115. package/dist/feature-libraries/flex-tree/lazyNode.js +23 -74
  116. package/dist/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  117. package/dist/feature-libraries/flex-tree/unboxed.d.ts +4 -16
  118. package/dist/feature-libraries/flex-tree/unboxed.d.ts.map +1 -1
  119. package/dist/feature-libraries/flex-tree/unboxed.js +7 -41
  120. package/dist/feature-libraries/flex-tree/unboxed.js.map +1 -1
  121. package/dist/feature-libraries/flex-tree/utilities.d.ts +2 -2
  122. package/dist/feature-libraries/flex-tree/utilities.d.ts.map +1 -1
  123. package/dist/feature-libraries/flex-tree/utilities.js +3 -6
  124. package/dist/feature-libraries/flex-tree/utilities.js.map +1 -1
  125. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  126. package/dist/feature-libraries/forest-summary/forestSummarizer.js +4 -1
  127. package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  128. package/dist/feature-libraries/index.d.ts +3 -5
  129. package/dist/feature-libraries/index.d.ts.map +1 -1
  130. package/dist/feature-libraries/index.js +5 -11
  131. package/dist/feature-libraries/index.js.map +1 -1
  132. package/dist/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
  133. package/dist/feature-libraries/modular-schema/comparison.js +3 -6
  134. package/dist/feature-libraries/modular-schema/comparison.js.map +1 -1
  135. package/dist/feature-libraries/modular-schema/discrepancies.d.ts.map +1 -1
  136. package/dist/feature-libraries/modular-schema/discrepancies.js +3 -13
  137. package/dist/feature-libraries/modular-schema/discrepancies.js.map +1 -1
  138. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js +4 -1
  139. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  140. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +9 -1
  141. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  142. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +73 -22
  143. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  144. package/dist/feature-libraries/schema-edits/schemaChangeFormat.d.ts +6 -6
  145. package/dist/feature-libraries/schema-index/format.d.ts +3 -3
  146. package/dist/feature-libraries/sequence-field/compose.d.ts.map +1 -1
  147. package/dist/feature-libraries/sequence-field/compose.js +3 -0
  148. package/dist/feature-libraries/sequence-field/compose.js.map +1 -1
  149. package/dist/feature-libraries/sequence-field/utils.d.ts.map +1 -1
  150. package/dist/feature-libraries/sequence-field/utils.js +1 -4
  151. package/dist/feature-libraries/sequence-field/utils.js.map +1 -1
  152. package/dist/feature-libraries/storedToViewSchema.d.ts.map +1 -1
  153. package/dist/feature-libraries/storedToViewSchema.js +2 -4
  154. package/dist/feature-libraries/storedToViewSchema.js.map +1 -1
  155. package/dist/feature-libraries/typed-schema/flexList.d.ts +3 -3
  156. package/dist/feature-libraries/typed-schema/flexList.js.map +1 -1
  157. package/dist/feature-libraries/typed-schema/index.d.ts +2 -2
  158. package/dist/feature-libraries/typed-schema/index.d.ts.map +1 -1
  159. package/dist/feature-libraries/typed-schema/index.js +2 -2
  160. package/dist/feature-libraries/typed-schema/index.js.map +1 -1
  161. package/dist/feature-libraries/typed-schema/schemaCollection.d.ts.map +1 -1
  162. package/dist/feature-libraries/typed-schema/schemaCollection.js +8 -10
  163. package/dist/feature-libraries/typed-schema/schemaCollection.js.map +1 -1
  164. package/dist/feature-libraries/typed-schema/typedTreeSchema.d.ts +17 -48
  165. package/dist/feature-libraries/typed-schema/typedTreeSchema.d.ts.map +1 -1
  166. package/dist/feature-libraries/typed-schema/typedTreeSchema.js +5 -37
  167. package/dist/feature-libraries/typed-schema/typedTreeSchema.js.map +1 -1
  168. package/dist/feature-libraries/typed-schema/view.d.ts +4 -6
  169. package/dist/feature-libraries/typed-schema/view.d.ts.map +1 -1
  170. package/dist/feature-libraries/typed-schema/view.js +5 -4
  171. package/dist/feature-libraries/typed-schema/view.js.map +1 -1
  172. package/dist/index.d.ts +4 -4
  173. package/dist/index.d.ts.map +1 -1
  174. package/dist/index.js +33 -36
  175. package/dist/index.js.map +1 -1
  176. package/dist/legacy.d.ts +84 -0
  177. package/dist/packageVersion.d.ts +1 -1
  178. package/dist/packageVersion.js +1 -1
  179. package/dist/packageVersion.js.map +1 -1
  180. package/dist/public.d.ts +1 -1
  181. package/dist/shared-tree/checkoutFlexTreeView.d.ts +53 -0
  182. package/dist/shared-tree/checkoutFlexTreeView.d.ts.map +1 -0
  183. package/dist/shared-tree/{treeView.js → checkoutFlexTreeView.js} +28 -6
  184. package/dist/shared-tree/checkoutFlexTreeView.js.map +1 -0
  185. package/dist/shared-tree/index.d.ts +3 -3
  186. package/dist/shared-tree/index.d.ts.map +1 -1
  187. package/dist/shared-tree/index.js +2 -2
  188. package/dist/shared-tree/index.js.map +1 -1
  189. package/dist/shared-tree/schematizeTree.d.ts +15 -4
  190. package/dist/shared-tree/schematizeTree.d.ts.map +1 -1
  191. package/dist/shared-tree/schematizeTree.js +7 -8
  192. package/dist/shared-tree/schematizeTree.js.map +1 -1
  193. package/dist/shared-tree/schematizingTreeView.d.ts +10 -4
  194. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  195. package/dist/shared-tree/schematizingTreeView.js +28 -12
  196. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  197. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  198. package/dist/shared-tree/sharedTree.js +2 -2
  199. package/dist/shared-tree/sharedTree.js.map +1 -1
  200. package/dist/shared-tree/sharedTreeChangeEnricher.d.ts +3 -1
  201. package/dist/shared-tree/sharedTreeChangeEnricher.d.ts.map +1 -1
  202. package/dist/shared-tree/sharedTreeChangeEnricher.js +6 -2
  203. package/dist/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
  204. package/dist/shared-tree/sharedTreeChangeFamily.d.ts +3 -1
  205. package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  206. package/dist/shared-tree/sharedTreeChangeFamily.js +3 -2
  207. package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  208. package/dist/shared-tree/sharedTreeEditBuilder.d.ts +2 -1
  209. package/dist/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
  210. package/dist/shared-tree/sharedTreeEditBuilder.js +2 -2
  211. package/dist/shared-tree/sharedTreeEditBuilder.js.map +1 -1
  212. package/dist/shared-tree/treeApi.d.ts +1 -3
  213. package/dist/shared-tree/treeApi.d.ts.map +1 -1
  214. package/dist/shared-tree/treeApi.js +6 -4
  215. package/dist/shared-tree/treeApi.js.map +1 -1
  216. package/dist/shared-tree/treeCheckout.d.ts +2 -13
  217. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  218. package/dist/shared-tree/treeCheckout.js +17 -1
  219. package/dist/shared-tree/treeCheckout.js.map +1 -1
  220. package/dist/shared-tree-core/branch.js +1 -1
  221. package/dist/shared-tree-core/branch.js.map +1 -1
  222. package/dist/simple-tree/api/create.d.ts.map +1 -1
  223. package/dist/simple-tree/api/create.js +1 -1
  224. package/dist/simple-tree/api/create.js.map +1 -1
  225. package/{lib/simple-tree → dist/simple-tree/api}/getJsonSchema.d.ts +1 -1
  226. package/dist/simple-tree/api/getJsonSchema.d.ts.map +1 -0
  227. package/dist/simple-tree/{getJsonSchema.js → api/getJsonSchema.js} +1 -1
  228. package/dist/simple-tree/api/getJsonSchema.js.map +1 -0
  229. package/{lib/simple-tree → dist/simple-tree/api}/getSimpleSchema.d.ts +1 -1
  230. package/dist/simple-tree/api/getSimpleSchema.d.ts.map +1 -0
  231. package/dist/simple-tree/{getSimpleSchema.js → api/getSimpleSchema.js} +1 -1
  232. package/dist/simple-tree/api/getSimpleSchema.js.map +1 -0
  233. package/dist/simple-tree/api/index.d.ts +5 -0
  234. package/dist/simple-tree/api/index.d.ts.map +1 -1
  235. package/dist/simple-tree/api/index.js +7 -1
  236. package/dist/simple-tree/api/index.js.map +1 -1
  237. package/{lib/simple-tree → dist/simple-tree/api}/jsonSchema.d.ts +14 -15
  238. package/dist/simple-tree/api/jsonSchema.d.ts.map +1 -0
  239. package/dist/simple-tree/api/jsonSchema.js.map +1 -0
  240. package/dist/simple-tree/api/schemaFactory.d.ts +53 -16
  241. package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
  242. package/dist/simple-tree/api/schemaFactory.js +49 -12
  243. package/dist/simple-tree/api/schemaFactory.js.map +1 -1
  244. package/dist/simple-tree/{simpleSchema.d.ts → api/simpleSchema.d.ts} +8 -4
  245. package/dist/simple-tree/api/simpleSchema.d.ts.map +1 -0
  246. package/dist/simple-tree/api/simpleSchema.js.map +1 -0
  247. package/dist/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -0
  248. package/dist/simple-tree/{simpleSchemaToJsonSchema.js → api/simpleSchemaToJsonSchema.js} +34 -21
  249. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -0
  250. package/dist/simple-tree/api/tree.d.ts +5 -21
  251. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  252. package/dist/simple-tree/api/tree.js +3 -38
  253. package/dist/simple-tree/api/tree.js.map +1 -1
  254. package/dist/simple-tree/api/treeApiBeta.d.ts +79 -0
  255. package/dist/simple-tree/api/treeApiBeta.d.ts.map +1 -0
  256. package/dist/simple-tree/api/treeApiBeta.js +26 -0
  257. package/dist/simple-tree/api/treeApiBeta.js.map +1 -0
  258. package/dist/simple-tree/api/treeNodeApi.d.ts +1 -1
  259. package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  260. package/dist/simple-tree/api/treeNodeApi.js +21 -19
  261. package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
  262. package/dist/simple-tree/api/verboseTree.js +2 -2
  263. package/dist/simple-tree/api/verboseTree.js.map +1 -1
  264. package/dist/simple-tree/{viewSchemaToSimpleSchema.d.ts → api/viewSchemaToSimpleSchema.d.ts} +1 -1
  265. package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -0
  266. package/dist/simple-tree/{viewSchemaToSimpleSchema.js → api/viewSchemaToSimpleSchema.js} +8 -4
  267. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -0
  268. package/dist/simple-tree/arrayNode.d.ts +2 -2
  269. package/dist/simple-tree/arrayNode.d.ts.map +1 -1
  270. package/dist/simple-tree/arrayNode.js +30 -21
  271. package/dist/simple-tree/arrayNode.js.map +1 -1
  272. package/dist/simple-tree/core/index.d.ts +3 -3
  273. package/dist/simple-tree/core/index.d.ts.map +1 -1
  274. package/dist/simple-tree/core/index.js +4 -1
  275. package/dist/simple-tree/core/index.js.map +1 -1
  276. package/dist/simple-tree/core/schemaCaching.d.ts +5 -0
  277. package/dist/simple-tree/core/schemaCaching.d.ts.map +1 -1
  278. package/dist/simple-tree/core/schemaCaching.js +10 -1
  279. package/dist/simple-tree/core/schemaCaching.js.map +1 -1
  280. package/dist/simple-tree/core/treeNodeKernel.d.ts +61 -3
  281. package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  282. package/dist/simple-tree/core/treeNodeKernel.js +166 -13
  283. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
  284. package/dist/simple-tree/core/treeNodeSchema.d.ts +1 -1
  285. package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
  286. package/dist/simple-tree/core/types.d.ts +17 -20
  287. package/dist/simple-tree/core/types.d.ts.map +1 -1
  288. package/dist/simple-tree/core/types.js.map +1 -1
  289. package/dist/simple-tree/core/withType.d.ts +3 -2
  290. package/dist/simple-tree/core/withType.d.ts.map +1 -1
  291. package/dist/simple-tree/core/withType.js.map +1 -1
  292. package/dist/simple-tree/index.d.ts +8 -10
  293. package/dist/simple-tree/index.d.ts.map +1 -1
  294. package/dist/simple-tree/index.js +15 -6
  295. package/dist/simple-tree/index.js.map +1 -1
  296. package/dist/simple-tree/leafNodeSchema.d.ts +7 -9
  297. package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
  298. package/dist/simple-tree/leafNodeSchema.js +13 -11
  299. package/dist/simple-tree/leafNodeSchema.js.map +1 -1
  300. package/dist/simple-tree/mapNode.d.ts +1 -1
  301. package/dist/simple-tree/mapNode.d.ts.map +1 -1
  302. package/dist/simple-tree/mapNode.js +38 -29
  303. package/dist/simple-tree/mapNode.js.map +1 -1
  304. package/dist/simple-tree/objectNode.d.ts +9 -7
  305. package/dist/simple-tree/objectNode.d.ts.map +1 -1
  306. package/dist/simple-tree/objectNode.js +37 -31
  307. package/dist/simple-tree/objectNode.js.map +1 -1
  308. package/dist/simple-tree/proxies.d.ts +1 -14
  309. package/dist/simple-tree/proxies.d.ts.map +1 -1
  310. package/dist/simple-tree/proxies.js +12 -15
  311. package/dist/simple-tree/proxies.js.map +1 -1
  312. package/dist/simple-tree/proxyBinding.d.ts +2 -62
  313. package/dist/simple-tree/proxyBinding.d.ts.map +1 -1
  314. package/dist/simple-tree/proxyBinding.js +8 -181
  315. package/dist/simple-tree/proxyBinding.js.map +1 -1
  316. package/dist/simple-tree/schemaTypes.d.ts +51 -11
  317. package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
  318. package/dist/simple-tree/schemaTypes.js +14 -4
  319. package/dist/simple-tree/schemaTypes.js.map +1 -1
  320. package/dist/simple-tree/toFlexSchema.d.ts +11 -1
  321. package/dist/simple-tree/toFlexSchema.d.ts.map +1 -1
  322. package/dist/simple-tree/toFlexSchema.js +54 -31
  323. package/dist/simple-tree/toFlexSchema.js.map +1 -1
  324. package/dist/simple-tree/toMapTree.d.ts +25 -37
  325. package/dist/simple-tree/toMapTree.d.ts.map +1 -1
  326. package/dist/simple-tree/toMapTree.js +53 -16
  327. package/dist/simple-tree/toMapTree.js.map +1 -1
  328. package/dist/simple-tree/treeNodeValid.d.ts.map +1 -1
  329. package/dist/simple-tree/treeNodeValid.js +7 -10
  330. package/dist/simple-tree/treeNodeValid.js.map +1 -1
  331. package/dist/simple-tree/typesUnsafe.d.ts +13 -13
  332. package/dist/simple-tree/typesUnsafe.js.map +1 -1
  333. package/dist/simple-tree/walkSchema.d.ts +26 -0
  334. package/dist/simple-tree/walkSchema.d.ts.map +1 -0
  335. package/dist/simple-tree/walkSchema.js +49 -0
  336. package/dist/simple-tree/walkSchema.js.map +1 -0
  337. package/dist/treeFactory.d.ts +2 -1
  338. package/dist/treeFactory.d.ts.map +1 -1
  339. package/dist/treeFactory.js +2 -1
  340. package/dist/treeFactory.js.map +1 -1
  341. package/dist/util/typeUtils.d.ts +2 -2
  342. package/dist/util/typeUtils.js.map +1 -1
  343. package/legacy.d.ts +11 -0
  344. package/lib/alpha.d.ts +103 -0
  345. package/lib/beta.d.ts +7 -2
  346. package/lib/core/index.d.ts +2 -2
  347. package/lib/core/index.d.ts.map +1 -1
  348. package/lib/core/index.js +2 -2
  349. package/lib/core/index.js.map +1 -1
  350. package/lib/core/rebase/index.d.ts +1 -1
  351. package/lib/core/rebase/index.d.ts.map +1 -1
  352. package/lib/core/rebase/index.js +1 -1
  353. package/lib/core/rebase/index.js.map +1 -1
  354. package/lib/core/rebase/types.d.ts +1 -0
  355. package/lib/core/rebase/types.d.ts.map +1 -1
  356. package/lib/core/rebase/types.js +6 -0
  357. package/lib/core/rebase/types.js.map +1 -1
  358. package/lib/core/{revertible/revertible.d.ts → revertible.d.ts} +12 -0
  359. package/lib/core/revertible.d.ts.map +1 -0
  360. package/lib/core/revertible.js.map +1 -0
  361. package/lib/core/schema-stored/format.d.ts +3 -3
  362. package/lib/core/schema-stored/format.js +1 -1
  363. package/lib/core/schema-stored/format.js.map +1 -1
  364. package/lib/core/schema-stored/schema.d.ts +2 -7
  365. package/lib/core/schema-stored/schema.d.ts.map +1 -1
  366. package/lib/core/schema-stored/schema.js +4 -6
  367. package/lib/core/schema-stored/schema.js.map +1 -1
  368. package/lib/core/schema-stored/storedSchemaRepository.d.ts +1 -1
  369. package/lib/core/schema-stored/storedSchemaRepository.d.ts.map +1 -1
  370. package/lib/core/tree/anchorSet.d.ts.map +1 -1
  371. package/lib/core/tree/anchorSet.js +6 -2
  372. package/lib/core/tree/anchorSet.js.map +1 -1
  373. package/lib/core/tree/detachedFieldIndex.d.ts +0 -1
  374. package/lib/core/tree/detachedFieldIndex.d.ts.map +1 -1
  375. package/lib/core/tree/detachedFieldIndex.js +1 -0
  376. package/lib/core/tree/detachedFieldIndex.js.map +1 -1
  377. package/lib/core/tree/visitDelta.d.ts +7 -2
  378. package/lib/core/tree/visitDelta.d.ts.map +1 -1
  379. package/lib/core/tree/visitDelta.js.map +1 -1
  380. package/lib/events/emitter.d.ts +127 -0
  381. package/lib/events/emitter.d.ts.map +1 -0
  382. package/lib/events/{events.js → emitter.js} +48 -29
  383. package/lib/events/emitter.js.map +1 -0
  384. package/lib/events/index.d.ts +2 -1
  385. package/lib/events/index.d.ts.map +1 -1
  386. package/lib/events/index.js +1 -1
  387. package/lib/events/index.js.map +1 -1
  388. package/lib/events/interop.d.ts +36 -0
  389. package/lib/events/interop.d.ts.map +1 -0
  390. package/{src/core/revertible/index.ts → lib/events/interop.js} +2 -2
  391. package/lib/events/interop.js.map +1 -0
  392. package/lib/events/listeners.d.ts +65 -0
  393. package/lib/events/listeners.d.ts.map +1 -0
  394. package/lib/{core/revertible/index.js → events/listeners.js} +2 -2
  395. package/lib/events/listeners.js.map +1 -0
  396. package/lib/feature-libraries/chunked-forest/chunkTree.d.ts +25 -7
  397. package/lib/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  398. package/lib/feature-libraries/chunked-forest/chunkTree.js +37 -16
  399. package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  400. package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts +4 -2
  401. package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  402. package/lib/feature-libraries/chunked-forest/chunkedForest.js +12 -5
  403. package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  404. package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts +15 -2
  405. package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
  406. package/lib/feature-libraries/chunked-forest/uniformChunk.js +28 -2
  407. package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  408. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts +3 -1
  409. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  410. package/lib/feature-libraries/default-schema/defaultEditBuilder.js +5 -4
  411. package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  412. package/lib/feature-libraries/flex-map-tree/index.d.ts +1 -1
  413. package/lib/feature-libraries/flex-map-tree/index.d.ts.map +1 -1
  414. package/lib/feature-libraries/flex-map-tree/index.js +1 -1
  415. package/lib/feature-libraries/flex-map-tree/index.js.map +1 -1
  416. package/lib/feature-libraries/flex-map-tree/mapTreeNode.d.ts +35 -33
  417. package/lib/feature-libraries/flex-map-tree/mapTreeNode.d.ts.map +1 -1
  418. package/lib/feature-libraries/flex-map-tree/mapTreeNode.js +83 -104
  419. package/lib/feature-libraries/flex-map-tree/mapTreeNode.js.map +1 -1
  420. package/lib/feature-libraries/flex-tree/context.d.ts +30 -14
  421. package/lib/feature-libraries/flex-tree/context.d.ts.map +1 -1
  422. package/lib/feature-libraries/flex-tree/context.js +10 -7
  423. package/lib/feature-libraries/flex-tree/context.js.map +1 -1
  424. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts +57 -190
  425. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  426. package/lib/feature-libraries/flex-tree/flexTreeTypes.js +15 -2
  427. package/lib/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  428. package/lib/feature-libraries/flex-tree/index.d.ts +2 -3
  429. package/lib/feature-libraries/flex-tree/index.d.ts.map +1 -1
  430. package/lib/feature-libraries/flex-tree/index.js +1 -1
  431. package/lib/feature-libraries/flex-tree/index.js.map +1 -1
  432. package/lib/feature-libraries/flex-tree/lazyEntity.d.ts +3 -3
  433. package/lib/feature-libraries/flex-tree/lazyEntity.d.ts.map +1 -1
  434. package/lib/feature-libraries/flex-tree/lazyEntity.js +2 -10
  435. package/lib/feature-libraries/flex-tree/lazyEntity.js.map +1 -1
  436. package/lib/feature-libraries/flex-tree/lazyField.d.ts +26 -28
  437. package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  438. package/lib/feature-libraries/flex-tree/lazyField.js +11 -13
  439. package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
  440. package/lib/feature-libraries/flex-tree/lazyNode.d.ts +5 -26
  441. package/lib/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  442. package/lib/feature-libraries/flex-tree/lazyNode.js +23 -72
  443. package/lib/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  444. package/lib/feature-libraries/flex-tree/unboxed.d.ts +4 -16
  445. package/lib/feature-libraries/flex-tree/unboxed.d.ts.map +1 -1
  446. package/lib/feature-libraries/flex-tree/unboxed.js +5 -37
  447. package/lib/feature-libraries/flex-tree/unboxed.js.map +1 -1
  448. package/lib/feature-libraries/flex-tree/utilities.d.ts +2 -2
  449. package/lib/feature-libraries/flex-tree/utilities.d.ts.map +1 -1
  450. package/lib/feature-libraries/flex-tree/utilities.js +3 -6
  451. package/lib/feature-libraries/flex-tree/utilities.js.map +1 -1
  452. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  453. package/lib/feature-libraries/forest-summary/forestSummarizer.js +4 -1
  454. package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  455. package/lib/feature-libraries/index.d.ts +3 -5
  456. package/lib/feature-libraries/index.d.ts.map +1 -1
  457. package/lib/feature-libraries/index.js +5 -5
  458. package/lib/feature-libraries/index.js.map +1 -1
  459. package/lib/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
  460. package/lib/feature-libraries/modular-schema/comparison.js +3 -6
  461. package/lib/feature-libraries/modular-schema/comparison.js.map +1 -1
  462. package/lib/feature-libraries/modular-schema/discrepancies.d.ts.map +1 -1
  463. package/lib/feature-libraries/modular-schema/discrepancies.js +3 -13
  464. package/lib/feature-libraries/modular-schema/discrepancies.js.map +1 -1
  465. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js +4 -1
  466. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  467. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +9 -1
  468. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  469. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +74 -23
  470. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  471. package/lib/feature-libraries/schema-edits/schemaChangeFormat.d.ts +6 -6
  472. package/lib/feature-libraries/schema-index/format.d.ts +3 -3
  473. package/lib/feature-libraries/sequence-field/compose.d.ts.map +1 -1
  474. package/lib/feature-libraries/sequence-field/compose.js +3 -0
  475. package/lib/feature-libraries/sequence-field/compose.js.map +1 -1
  476. package/lib/feature-libraries/sequence-field/utils.d.ts.map +1 -1
  477. package/lib/feature-libraries/sequence-field/utils.js +2 -5
  478. package/lib/feature-libraries/sequence-field/utils.js.map +1 -1
  479. package/lib/feature-libraries/storedToViewSchema.d.ts.map +1 -1
  480. package/lib/feature-libraries/storedToViewSchema.js +3 -5
  481. package/lib/feature-libraries/storedToViewSchema.js.map +1 -1
  482. package/lib/feature-libraries/typed-schema/flexList.d.ts +3 -3
  483. package/lib/feature-libraries/typed-schema/flexList.js.map +1 -1
  484. package/lib/feature-libraries/typed-schema/index.d.ts +2 -2
  485. package/lib/feature-libraries/typed-schema/index.d.ts.map +1 -1
  486. package/lib/feature-libraries/typed-schema/index.js +2 -2
  487. package/lib/feature-libraries/typed-schema/index.js.map +1 -1
  488. package/lib/feature-libraries/typed-schema/schemaCollection.d.ts.map +1 -1
  489. package/lib/feature-libraries/typed-schema/schemaCollection.js +9 -11
  490. package/lib/feature-libraries/typed-schema/schemaCollection.js.map +1 -1
  491. package/lib/feature-libraries/typed-schema/typedTreeSchema.d.ts +17 -48
  492. package/lib/feature-libraries/typed-schema/typedTreeSchema.d.ts.map +1 -1
  493. package/lib/feature-libraries/typed-schema/typedTreeSchema.js +5 -36
  494. package/lib/feature-libraries/typed-schema/typedTreeSchema.js.map +1 -1
  495. package/lib/feature-libraries/typed-schema/view.d.ts +4 -6
  496. package/lib/feature-libraries/typed-schema/view.d.ts.map +1 -1
  497. package/lib/feature-libraries/typed-schema/view.js +5 -4
  498. package/lib/feature-libraries/typed-schema/view.js.map +1 -1
  499. package/lib/index.d.ts +4 -4
  500. package/lib/index.d.ts.map +1 -1
  501. package/lib/index.js +3 -5
  502. package/lib/index.js.map +1 -1
  503. package/lib/legacy.d.ts +84 -0
  504. package/lib/packageVersion.d.ts +1 -1
  505. package/lib/packageVersion.js +1 -1
  506. package/lib/packageVersion.js.map +1 -1
  507. package/lib/public.d.ts +1 -1
  508. package/lib/shared-tree/checkoutFlexTreeView.d.ts +53 -0
  509. package/lib/shared-tree/checkoutFlexTreeView.d.ts.map +1 -0
  510. package/lib/shared-tree/{treeView.js → checkoutFlexTreeView.js} +26 -5
  511. package/lib/shared-tree/checkoutFlexTreeView.js.map +1 -0
  512. package/lib/shared-tree/index.d.ts +3 -3
  513. package/lib/shared-tree/index.d.ts.map +1 -1
  514. package/lib/shared-tree/index.js +1 -1
  515. package/lib/shared-tree/index.js.map +1 -1
  516. package/lib/shared-tree/schematizeTree.d.ts +15 -4
  517. package/lib/shared-tree/schematizeTree.d.ts.map +1 -1
  518. package/lib/shared-tree/schematizeTree.js +8 -9
  519. package/lib/shared-tree/schematizeTree.js.map +1 -1
  520. package/lib/shared-tree/schematizingTreeView.d.ts +10 -4
  521. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  522. package/lib/shared-tree/schematizingTreeView.js +29 -13
  523. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  524. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  525. package/lib/shared-tree/sharedTree.js +2 -2
  526. package/lib/shared-tree/sharedTree.js.map +1 -1
  527. package/lib/shared-tree/sharedTreeChangeEnricher.d.ts +3 -1
  528. package/lib/shared-tree/sharedTreeChangeEnricher.d.ts.map +1 -1
  529. package/lib/shared-tree/sharedTreeChangeEnricher.js +6 -2
  530. package/lib/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
  531. package/lib/shared-tree/sharedTreeChangeFamily.d.ts +3 -1
  532. package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  533. package/lib/shared-tree/sharedTreeChangeFamily.js +3 -2
  534. package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  535. package/lib/shared-tree/sharedTreeEditBuilder.d.ts +2 -1
  536. package/lib/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
  537. package/lib/shared-tree/sharedTreeEditBuilder.js +2 -2
  538. package/lib/shared-tree/sharedTreeEditBuilder.js.map +1 -1
  539. package/lib/shared-tree/treeApi.d.ts +1 -3
  540. package/lib/shared-tree/treeApi.d.ts.map +1 -1
  541. package/lib/shared-tree/treeApi.js +7 -5
  542. package/lib/shared-tree/treeApi.js.map +1 -1
  543. package/lib/shared-tree/treeCheckout.d.ts +2 -13
  544. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  545. package/lib/shared-tree/treeCheckout.js +18 -2
  546. package/lib/shared-tree/treeCheckout.js.map +1 -1
  547. package/lib/shared-tree-core/branch.js +1 -1
  548. package/lib/shared-tree-core/branch.js.map +1 -1
  549. package/lib/simple-tree/api/create.d.ts.map +1 -1
  550. package/lib/simple-tree/api/create.js +2 -2
  551. package/lib/simple-tree/api/create.js.map +1 -1
  552. package/{dist/simple-tree → lib/simple-tree/api}/getJsonSchema.d.ts +1 -1
  553. package/lib/simple-tree/api/getJsonSchema.d.ts.map +1 -0
  554. package/lib/simple-tree/{getJsonSchema.js → api/getJsonSchema.js} +1 -1
  555. package/lib/simple-tree/api/getJsonSchema.js.map +1 -0
  556. package/{dist/simple-tree → lib/simple-tree/api}/getSimpleSchema.d.ts +1 -1
  557. package/lib/simple-tree/api/getSimpleSchema.d.ts.map +1 -0
  558. package/lib/simple-tree/{getSimpleSchema.js → api/getSimpleSchema.js} +1 -1
  559. package/lib/simple-tree/api/getSimpleSchema.js.map +1 -0
  560. package/lib/simple-tree/api/index.d.ts +5 -0
  561. package/lib/simple-tree/api/index.d.ts.map +1 -1
  562. package/lib/simple-tree/api/index.js +3 -0
  563. package/lib/simple-tree/api/index.js.map +1 -1
  564. package/{dist/simple-tree → lib/simple-tree/api}/jsonSchema.d.ts +14 -15
  565. package/lib/simple-tree/api/jsonSchema.d.ts.map +1 -0
  566. package/lib/simple-tree/api/jsonSchema.js.map +1 -0
  567. package/lib/simple-tree/api/schemaFactory.d.ts +53 -16
  568. package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
  569. package/lib/simple-tree/api/schemaFactory.js +49 -12
  570. package/lib/simple-tree/api/schemaFactory.js.map +1 -1
  571. package/lib/simple-tree/{simpleSchema.d.ts → api/simpleSchema.d.ts} +8 -4
  572. package/lib/simple-tree/api/simpleSchema.d.ts.map +1 -0
  573. package/lib/simple-tree/api/simpleSchema.js.map +1 -0
  574. package/lib/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -0
  575. package/lib/simple-tree/{simpleSchemaToJsonSchema.js → api/simpleSchemaToJsonSchema.js} +35 -22
  576. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -0
  577. package/lib/simple-tree/api/tree.d.ts +5 -21
  578. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  579. package/lib/simple-tree/api/tree.js +2 -34
  580. package/lib/simple-tree/api/tree.js.map +1 -1
  581. package/lib/simple-tree/api/treeApiBeta.d.ts +79 -0
  582. package/lib/simple-tree/api/treeApiBeta.d.ts.map +1 -0
  583. package/lib/simple-tree/api/treeApiBeta.js +23 -0
  584. package/lib/simple-tree/api/treeApiBeta.js.map +1 -0
  585. package/lib/simple-tree/api/treeNodeApi.d.ts +1 -1
  586. package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  587. package/lib/simple-tree/api/treeNodeApi.js +23 -21
  588. package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
  589. package/lib/simple-tree/api/verboseTree.js +1 -1
  590. package/lib/simple-tree/api/verboseTree.js.map +1 -1
  591. package/lib/simple-tree/{viewSchemaToSimpleSchema.d.ts → api/viewSchemaToSimpleSchema.d.ts} +1 -1
  592. package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -0
  593. package/lib/simple-tree/{viewSchemaToSimpleSchema.js → api/viewSchemaToSimpleSchema.js} +8 -4
  594. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -0
  595. package/lib/simple-tree/arrayNode.d.ts +2 -2
  596. package/lib/simple-tree/arrayNode.d.ts.map +1 -1
  597. package/lib/simple-tree/arrayNode.js +33 -24
  598. package/lib/simple-tree/arrayNode.js.map +1 -1
  599. package/lib/simple-tree/core/index.d.ts +3 -3
  600. package/lib/simple-tree/core/index.d.ts.map +1 -1
  601. package/lib/simple-tree/core/index.js +2 -2
  602. package/lib/simple-tree/core/index.js.map +1 -1
  603. package/lib/simple-tree/core/schemaCaching.d.ts +5 -0
  604. package/lib/simple-tree/core/schemaCaching.d.ts.map +1 -1
  605. package/lib/simple-tree/core/schemaCaching.js +8 -0
  606. package/lib/simple-tree/core/schemaCaching.js.map +1 -1
  607. package/lib/simple-tree/core/treeNodeKernel.d.ts +61 -3
  608. package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  609. package/lib/simple-tree/core/treeNodeKernel.js +156 -5
  610. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
  611. package/lib/simple-tree/core/treeNodeSchema.d.ts +1 -1
  612. package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
  613. package/lib/simple-tree/core/types.d.ts +17 -20
  614. package/lib/simple-tree/core/types.d.ts.map +1 -1
  615. package/lib/simple-tree/core/types.js.map +1 -1
  616. package/lib/simple-tree/core/withType.d.ts +3 -2
  617. package/lib/simple-tree/core/withType.d.ts.map +1 -1
  618. package/lib/simple-tree/core/withType.js.map +1 -1
  619. package/lib/simple-tree/index.d.ts +8 -10
  620. package/lib/simple-tree/index.d.ts.map +1 -1
  621. package/lib/simple-tree/index.js +5 -5
  622. package/lib/simple-tree/index.js.map +1 -1
  623. package/lib/simple-tree/leafNodeSchema.d.ts +7 -9
  624. package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
  625. package/lib/simple-tree/leafNodeSchema.js +14 -12
  626. package/lib/simple-tree/leafNodeSchema.js.map +1 -1
  627. package/lib/simple-tree/mapNode.d.ts +1 -1
  628. package/lib/simple-tree/mapNode.d.ts.map +1 -1
  629. package/lib/simple-tree/mapNode.js +38 -29
  630. package/lib/simple-tree/mapNode.js.map +1 -1
  631. package/lib/simple-tree/objectNode.d.ts +9 -7
  632. package/lib/simple-tree/objectNode.d.ts.map +1 -1
  633. package/lib/simple-tree/objectNode.js +40 -34
  634. package/lib/simple-tree/objectNode.js.map +1 -1
  635. package/lib/simple-tree/proxies.d.ts +1 -14
  636. package/lib/simple-tree/proxies.d.ts.map +1 -1
  637. package/lib/simple-tree/proxies.js +11 -14
  638. package/lib/simple-tree/proxies.js.map +1 -1
  639. package/lib/simple-tree/proxyBinding.d.ts +2 -62
  640. package/lib/simple-tree/proxyBinding.d.ts.map +1 -1
  641. package/lib/simple-tree/proxyBinding.js +6 -174
  642. package/lib/simple-tree/proxyBinding.js.map +1 -1
  643. package/lib/simple-tree/schemaTypes.d.ts +51 -11
  644. package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
  645. package/lib/simple-tree/schemaTypes.js +14 -4
  646. package/lib/simple-tree/schemaTypes.js.map +1 -1
  647. package/lib/simple-tree/toFlexSchema.d.ts +11 -1
  648. package/lib/simple-tree/toFlexSchema.d.ts.map +1 -1
  649. package/lib/simple-tree/toFlexSchema.js +29 -8
  650. package/lib/simple-tree/toFlexSchema.js.map +1 -1
  651. package/lib/simple-tree/toMapTree.d.ts +25 -37
  652. package/lib/simple-tree/toMapTree.d.ts.map +1 -1
  653. package/lib/simple-tree/toMapTree.js +54 -17
  654. package/lib/simple-tree/toMapTree.js.map +1 -1
  655. package/lib/simple-tree/treeNodeValid.d.ts.map +1 -1
  656. package/lib/simple-tree/treeNodeValid.js +8 -11
  657. package/lib/simple-tree/treeNodeValid.js.map +1 -1
  658. package/lib/simple-tree/typesUnsafe.d.ts +13 -13
  659. package/lib/simple-tree/typesUnsafe.js.map +1 -1
  660. package/lib/simple-tree/walkSchema.d.ts +26 -0
  661. package/lib/simple-tree/walkSchema.d.ts.map +1 -0
  662. package/lib/simple-tree/walkSchema.js +43 -0
  663. package/lib/simple-tree/walkSchema.js.map +1 -0
  664. package/lib/treeFactory.d.ts +2 -1
  665. package/lib/treeFactory.d.ts.map +1 -1
  666. package/lib/treeFactory.js +2 -1
  667. package/lib/treeFactory.js.map +1 -1
  668. package/lib/tsdoc-metadata.json +1 -1
  669. package/lib/util/typeUtils.d.ts +2 -2
  670. package/lib/util/typeUtils.js.map +1 -1
  671. package/package.json +68 -26
  672. package/src/core/index.ts +2 -1
  673. package/src/core/rebase/index.ts +1 -0
  674. package/src/core/rebase/types.ts +11 -0
  675. package/src/core/{revertible/revertible.ts → revertible.ts} +15 -0
  676. package/src/core/schema-stored/format.ts +1 -1
  677. package/src/core/schema-stored/schema.ts +7 -13
  678. package/src/core/tree/anchorSet.ts +18 -3
  679. package/src/core/tree/detachedFieldIndex.ts +6 -5
  680. package/src/core/tree/visitDelta.ts +7 -2
  681. package/src/events/{events.ts → emitter.ts} +52 -139
  682. package/src/events/index.ts +7 -7
  683. package/src/events/interop.ts +49 -0
  684. package/src/events/listeners.ts +68 -0
  685. package/src/feature-libraries/chunked-forest/chunkTree.ts +63 -18
  686. package/src/feature-libraries/chunked-forest/chunkedForest.ts +18 -4
  687. package/src/feature-libraries/chunked-forest/uniformChunk.ts +33 -0
  688. package/src/feature-libraries/default-schema/defaultEditBuilder.ts +5 -3
  689. package/src/feature-libraries/flex-map-tree/index.ts +1 -0
  690. package/src/feature-libraries/flex-map-tree/mapTreeNode.ts +135 -210
  691. package/src/feature-libraries/flex-tree/README.md +4 -75
  692. package/src/feature-libraries/flex-tree/context.ts +37 -16
  693. package/src/feature-libraries/flex-tree/flexTreeTypes.ts +69 -291
  694. package/src/feature-libraries/flex-tree/index.ts +7 -13
  695. package/src/feature-libraries/flex-tree/lazyEntity.ts +2 -11
  696. package/src/feature-libraries/flex-tree/lazyField.ts +49 -73
  697. package/src/feature-libraries/flex-tree/lazyNode.ts +25 -154
  698. package/src/feature-libraries/flex-tree/unboxed.ts +9 -68
  699. package/src/feature-libraries/flex-tree/utilities.ts +4 -8
  700. package/src/feature-libraries/forest-summary/forestSummarizer.ts +4 -1
  701. package/src/feature-libraries/index.ts +2 -27
  702. package/src/feature-libraries/modular-schema/comparison.ts +4 -6
  703. package/src/feature-libraries/modular-schema/discrepancies.ts +7 -16
  704. package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +4 -1
  705. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +111 -14
  706. package/src/feature-libraries/sequence-field/compose.ts +3 -0
  707. package/src/feature-libraries/sequence-field/utils.ts +2 -4
  708. package/src/feature-libraries/storedToViewSchema.ts +5 -6
  709. package/src/feature-libraries/typed-schema/flexList.ts +3 -3
  710. package/src/feature-libraries/typed-schema/index.ts +1 -3
  711. package/src/feature-libraries/typed-schema/schemaCollection.ts +15 -17
  712. package/src/feature-libraries/typed-schema/typedTreeSchema.ts +35 -127
  713. package/src/feature-libraries/typed-schema/view.ts +4 -13
  714. package/src/index.ts +5 -8
  715. package/src/packageVersion.ts +1 -1
  716. package/src/shared-tree/checkoutFlexTreeView.ts +89 -0
  717. package/src/shared-tree/index.ts +2 -7
  718. package/src/shared-tree/schematizeTree.ts +23 -12
  719. package/src/shared-tree/schematizingTreeView.ts +38 -24
  720. package/src/shared-tree/sharedTree.ts +6 -1
  721. package/src/shared-tree/sharedTreeChangeEnricher.ts +6 -1
  722. package/src/shared-tree/sharedTreeChangeFamily.ts +7 -1
  723. package/src/shared-tree/sharedTreeEditBuilder.ts +9 -4
  724. package/src/shared-tree/treeApi.ts +10 -10
  725. package/src/shared-tree/treeCheckout.ts +26 -15
  726. package/src/shared-tree-core/branch.ts +1 -1
  727. package/src/simple-tree/ProxyBinding.md +23 -23
  728. package/src/simple-tree/api/create.ts +8 -3
  729. package/src/simple-tree/{getJsonSchema.ts → api/getJsonSchema.ts} +3 -3
  730. package/src/simple-tree/{getSimpleSchema.ts → api/getSimpleSchema.ts} +3 -3
  731. package/src/simple-tree/api/index.ts +20 -0
  732. package/src/simple-tree/{jsonSchema.ts → api/jsonSchema.ts} +20 -18
  733. package/src/simple-tree/api/schemaFactory.ts +56 -19
  734. package/src/simple-tree/{simpleSchema.ts → api/simpleSchema.ts} +9 -4
  735. package/src/simple-tree/{simpleSchemaToJsonSchema.ts → api/simpleSchemaToJsonSchema.ts} +43 -22
  736. package/src/simple-tree/api/tree.ts +7 -71
  737. package/src/simple-tree/api/treeApiBeta.ts +101 -0
  738. package/src/simple-tree/api/treeNodeApi.ts +32 -23
  739. package/src/simple-tree/api/verboseTree.ts +1 -1
  740. package/src/simple-tree/{viewSchemaToSimpleSchema.ts → api/viewSchemaToSimpleSchema.ts} +11 -6
  741. package/src/simple-tree/arrayNode.ts +37 -31
  742. package/src/simple-tree/core/index.ts +4 -1
  743. package/src/simple-tree/core/schemaCaching.ts +10 -0
  744. package/src/simple-tree/core/treeNodeKernel.ts +198 -5
  745. package/src/simple-tree/core/treeNodeSchema.ts +1 -1
  746. package/src/simple-tree/core/types.ts +16 -27
  747. package/src/simple-tree/core/withType.ts +3 -1
  748. package/src/simple-tree/index.ts +30 -21
  749. package/src/simple-tree/leafNodeSchema.ts +24 -28
  750. package/src/simple-tree/mapNode.ts +47 -29
  751. package/src/simple-tree/objectNode.ts +51 -46
  752. package/src/simple-tree/proxies.ts +22 -51
  753. package/src/simple-tree/proxyBinding.ts +3 -254
  754. package/src/simple-tree/schemaTypes.ts +63 -13
  755. package/src/simple-tree/toFlexSchema.ts +40 -7
  756. package/src/simple-tree/toMapTree.ts +113 -79
  757. package/src/simple-tree/treeNodeValid.ts +10 -13
  758. package/src/simple-tree/typesUnsafe.ts +13 -13
  759. package/src/simple-tree/walkSchema.ts +81 -0
  760. package/src/treeFactory.ts +2 -1
  761. package/src/util/typeUtils.ts +2 -2
  762. package/dist/core/revertible/index.d.ts.map +0 -1
  763. package/dist/core/revertible/index.js +0 -10
  764. package/dist/core/revertible/index.js.map +0 -1
  765. package/dist/core/revertible/revertible.d.ts.map +0 -1
  766. package/dist/core/revertible/revertible.js.map +0 -1
  767. package/dist/domains/index.d.ts +0 -8
  768. package/dist/domains/index.d.ts.map +0 -1
  769. package/dist/domains/index.js +0 -20
  770. package/dist/domains/index.js.map +0 -1
  771. package/dist/domains/json/index.d.ts +0 -7
  772. package/dist/domains/json/index.d.ts.map +0 -1
  773. package/dist/domains/json/index.js +0 -17
  774. package/dist/domains/json/index.js.map +0 -1
  775. package/dist/domains/json/jsonCursor.d.ts +0 -52
  776. package/dist/domains/json/jsonCursor.d.ts.map +0 -1
  777. package/dist/domains/json/jsonCursor.js +0 -197
  778. package/dist/domains/json/jsonCursor.js.map +0 -1
  779. package/dist/domains/json/jsonDomainSchema.d.ts +0 -24
  780. package/dist/domains/json/jsonDomainSchema.d.ts.map +0 -1
  781. package/dist/domains/json/jsonDomainSchema.js +0 -32
  782. package/dist/domains/json/jsonDomainSchema.js.map +0 -1
  783. package/dist/domains/leafDomain.d.ts +0 -72
  784. package/dist/domains/leafDomain.d.ts.map +0 -1
  785. package/dist/domains/leafDomain.js +0 -88
  786. package/dist/domains/leafDomain.js.map +0 -1
  787. package/dist/domains/schemaBuilder.d.ts +0 -103
  788. package/dist/domains/schemaBuilder.d.ts.map +0 -1
  789. package/dist/domains/schemaBuilder.js +0 -121
  790. package/dist/domains/schemaBuilder.js.map +0 -1
  791. package/dist/domains/testRecursiveDomain.d.ts +0 -17
  792. package/dist/domains/testRecursiveDomain.d.ts.map +0 -1
  793. package/dist/domains/testRecursiveDomain.js +0 -35
  794. package/dist/domains/testRecursiveDomain.js.map +0 -1
  795. package/dist/events/events.d.ts +0 -207
  796. package/dist/events/events.d.ts.map +0 -1
  797. package/dist/events/events.js.map +0 -1
  798. package/dist/feature-libraries/schemaBuilder.d.ts +0 -31
  799. package/dist/feature-libraries/schemaBuilder.d.ts.map +0 -1
  800. package/dist/feature-libraries/schemaBuilder.js +0 -40
  801. package/dist/feature-libraries/schemaBuilder.js.map +0 -1
  802. package/dist/feature-libraries/schemaBuilderBase.d.ts +0 -191
  803. package/dist/feature-libraries/schemaBuilderBase.d.ts.map +0 -1
  804. package/dist/feature-libraries/schemaBuilderBase.js +0 -201
  805. package/dist/feature-libraries/schemaBuilderBase.js.map +0 -1
  806. package/dist/shared-tree/treeView.d.ts +0 -73
  807. package/dist/shared-tree/treeView.d.ts.map +0 -1
  808. package/dist/shared-tree/treeView.js.map +0 -1
  809. package/dist/simple-tree/getJsonSchema.d.ts.map +0 -1
  810. package/dist/simple-tree/getJsonSchema.js.map +0 -1
  811. package/dist/simple-tree/getSimpleSchema.d.ts.map +0 -1
  812. package/dist/simple-tree/getSimpleSchema.js.map +0 -1
  813. package/dist/simple-tree/jsonSchema.d.ts.map +0 -1
  814. package/dist/simple-tree/jsonSchema.js.map +0 -1
  815. package/dist/simple-tree/simpleSchema.d.ts.map +0 -1
  816. package/dist/simple-tree/simpleSchema.js.map +0 -1
  817. package/dist/simple-tree/simpleSchemaToJsonSchema.d.ts.map +0 -1
  818. package/dist/simple-tree/simpleSchemaToJsonSchema.js.map +0 -1
  819. package/dist/simple-tree/viewSchemaToSimpleSchema.d.ts.map +0 -1
  820. package/dist/simple-tree/viewSchemaToSimpleSchema.js.map +0 -1
  821. package/lib/core/revertible/index.d.ts.map +0 -1
  822. package/lib/core/revertible/index.js.map +0 -1
  823. package/lib/core/revertible/revertible.d.ts.map +0 -1
  824. package/lib/core/revertible/revertible.js.map +0 -1
  825. package/lib/domains/index.d.ts +0 -8
  826. package/lib/domains/index.d.ts.map +0 -1
  827. package/lib/domains/index.js +0 -8
  828. package/lib/domains/index.js.map +0 -1
  829. package/lib/domains/json/index.d.ts +0 -7
  830. package/lib/domains/json/index.d.ts.map +0 -1
  831. package/lib/domains/json/index.js +0 -7
  832. package/lib/domains/json/index.js.map +0 -1
  833. package/lib/domains/json/jsonCursor.d.ts +0 -52
  834. package/lib/domains/json/jsonCursor.d.ts.map +0 -1
  835. package/lib/domains/json/jsonCursor.js +0 -192
  836. package/lib/domains/json/jsonCursor.js.map +0 -1
  837. package/lib/domains/json/jsonDomainSchema.d.ts +0 -24
  838. package/lib/domains/json/jsonDomainSchema.d.ts.map +0 -1
  839. package/lib/domains/json/jsonDomainSchema.js +0 -29
  840. package/lib/domains/json/jsonDomainSchema.js.map +0 -1
  841. package/lib/domains/leafDomain.d.ts +0 -72
  842. package/lib/domains/leafDomain.d.ts.map +0 -1
  843. package/lib/domains/leafDomain.js +0 -85
  844. package/lib/domains/leafDomain.js.map +0 -1
  845. package/lib/domains/schemaBuilder.d.ts +0 -103
  846. package/lib/domains/schemaBuilder.d.ts.map +0 -1
  847. package/lib/domains/schemaBuilder.js +0 -117
  848. package/lib/domains/schemaBuilder.js.map +0 -1
  849. package/lib/domains/testRecursiveDomain.d.ts +0 -17
  850. package/lib/domains/testRecursiveDomain.d.ts.map +0 -1
  851. package/lib/domains/testRecursiveDomain.js +0 -32
  852. package/lib/domains/testRecursiveDomain.js.map +0 -1
  853. package/lib/events/events.d.ts +0 -207
  854. package/lib/events/events.d.ts.map +0 -1
  855. package/lib/events/events.js.map +0 -1
  856. package/lib/feature-libraries/schemaBuilder.d.ts +0 -31
  857. package/lib/feature-libraries/schemaBuilder.d.ts.map +0 -1
  858. package/lib/feature-libraries/schemaBuilder.js +0 -36
  859. package/lib/feature-libraries/schemaBuilder.js.map +0 -1
  860. package/lib/feature-libraries/schemaBuilderBase.d.ts +0 -191
  861. package/lib/feature-libraries/schemaBuilderBase.d.ts.map +0 -1
  862. package/lib/feature-libraries/schemaBuilderBase.js +0 -195
  863. package/lib/feature-libraries/schemaBuilderBase.js.map +0 -1
  864. package/lib/shared-tree/treeView.d.ts +0 -73
  865. package/lib/shared-tree/treeView.d.ts.map +0 -1
  866. package/lib/shared-tree/treeView.js.map +0 -1
  867. package/lib/simple-tree/getJsonSchema.d.ts.map +0 -1
  868. package/lib/simple-tree/getJsonSchema.js.map +0 -1
  869. package/lib/simple-tree/getSimpleSchema.d.ts.map +0 -1
  870. package/lib/simple-tree/getSimpleSchema.js.map +0 -1
  871. package/lib/simple-tree/jsonSchema.d.ts.map +0 -1
  872. package/lib/simple-tree/jsonSchema.js.map +0 -1
  873. package/lib/simple-tree/simpleSchema.d.ts.map +0 -1
  874. package/lib/simple-tree/simpleSchema.js.map +0 -1
  875. package/lib/simple-tree/simpleSchemaToJsonSchema.d.ts.map +0 -1
  876. package/lib/simple-tree/simpleSchemaToJsonSchema.js.map +0 -1
  877. package/lib/simple-tree/viewSchemaToSimpleSchema.d.ts.map +0 -1
  878. package/lib/simple-tree/viewSchemaToSimpleSchema.js.map +0 -1
  879. package/src/domains/README.md +0 -6
  880. package/src/domains/fence.json +0 -5
  881. package/src/domains/index.ts +0 -19
  882. package/src/domains/json/fence.json +0 -5
  883. package/src/domains/json/index.ts +0 -13
  884. package/src/domains/json/jsonCursor.ts +0 -247
  885. package/src/domains/json/jsonDomainSchema.ts +0 -47
  886. package/src/domains/leafDomain.ts +0 -97
  887. package/src/domains/schemaBuilder.ts +0 -153
  888. package/src/domains/testRecursiveDomain.ts +0 -38
  889. package/src/events/fence.json +0 -5
  890. package/src/feature-libraries/schemaBuilder.ts +0 -45
  891. package/src/feature-libraries/schemaBuilderBase.ts +0 -393
  892. package/src/shared-tree/treeView.ts +0 -113
  893. /package/dist/core/{revertible/revertible.js → revertible.js} +0 -0
  894. /package/dist/simple-tree/{jsonSchema.js → api/jsonSchema.js} +0 -0
  895. /package/dist/simple-tree/{simpleSchema.js → api/simpleSchema.js} +0 -0
  896. /package/dist/simple-tree/{simpleSchemaToJsonSchema.d.ts → api/simpleSchemaToJsonSchema.d.ts} +0 -0
  897. /package/lib/core/{revertible/revertible.js → revertible.js} +0 -0
  898. /package/lib/simple-tree/{jsonSchema.js → api/jsonSchema.js} +0 -0
  899. /package/lib/simple-tree/{simpleSchema.js → api/simpleSchema.js} +0 -0
  900. /package/lib/simple-tree/{simpleSchemaToJsonSchema.d.ts → api/simpleSchemaToJsonSchema.d.ts} +0 -0
@@ -4,12 +4,11 @@
4
4
  */
5
5
  var _a;
6
6
  import { assert } from "@fluidframework/core-utils/internal";
7
- import { NodeKind, tryGetSimpleNodeSchema, isTreeNode, TreeNodeKernel, privateToken, TreeNode, } from "./core/index.js";
7
+ import { NodeKind, tryGetSimpleNodeSchema, isTreeNode, TreeNodeKernel, privateToken, TreeNode, typeSchemaSymbol, } from "./core/index.js";
8
8
  import { isFlexTreeNode, markEager, } from "../feature-libraries/index.js";
9
9
  import { UsageError } from "@fluidframework/telemetry-utils/internal";
10
10
  import { fail } from "../util/index.js";
11
11
  import { getFlexSchema } from "./toFlexSchema.js";
12
- import { getOrCreateInnerNode, setInnerNode } from "./proxyBinding.js";
13
12
  /**
14
13
  * Class which all {@link TreeNode}s must extend.
15
14
  * Since this is not exported, it allows robust detection of attempts to create TreeNodes which do not go through SchemaFactory which is the only place which exposes classes that extend this.
@@ -82,13 +81,13 @@ export class TreeNodeValid extends TreeNode {
82
81
  // TODO: update this once we have better support for deep-copying and move operations.
83
82
  throw new UsageError("Existing nodes may not be used as the constructor parameter for a new node. The existing node may be used directly instead of creating a new one, used as a child of the new node (if it has not yet been inserted into the tree). If the desired result is copying the provided node, it must be deep copied (since any child node would be parented under both the new and old nodes). Currently no API is provided to make deep copies, but it can be done manually with object spreads - for example `new Foo({...oldFoo})` will work if all fields of `oldFoo` are leaf nodes.");
84
83
  }
85
- const node = isFlexTreeNode(input)
86
- ? input
87
- : schema.buildRawNode(this, input);
88
- assert(tryGetSimpleNodeSchema(node.schema) === schema, 0x83b /* building node with wrong schema */);
84
+ const node = isFlexTreeNode(input) ? input : schema.buildRawNode(this, input);
85
+ assert(tryGetSimpleNodeSchema(node.flexSchema) === schema, 0x83b /* building node with wrong schema */);
89
86
  const result = schema.prepareInstance(this, node);
90
- new TreeNodeKernel(result, schema);
91
- setInnerNode(result, node);
87
+ // The TreeNodeKernel associates itself the TreeNode (result here, not node) so it can be looked up later via getKernel.
88
+ // If desired this could be put in a non-enumerable symbol property for lookup instead, but that gets messy going through proxies,
89
+ // so just relying on the WeakMap seems like the cleanest approach.
90
+ new TreeNodeKernel(result, schema, node);
92
91
  return result;
93
92
  }
94
93
  }
@@ -126,9 +125,7 @@ const customInspectSymbol = Symbol.for("nodejs.util.inspect.custom");
126
125
  * Node inspecting function for use with {@link customInspectSymbol}.
127
126
  */
128
127
  function inspectNodeFunction(depth, options, inspect) {
129
- // TODO: replicated from tryGetSchema to avoid cycle.
130
- // This case could be optimized, for example by placing the simple schema in a symbol on tree nodes.
131
- const schema = tryGetSimpleNodeSchema(getOrCreateInnerNode(this).schema);
128
+ const schema = this[typeSchemaSymbol];
132
129
  const title = `${schema.name}: ${NodeKind[schema.kind]} Node (${schema.identifier})`;
133
130
  if (depth < 2) {
134
131
  const short = shortContent(this);
@@ -1 +1 @@
1
- {"version":3,"file":"treeNodeValid.js","sourceRoot":"","sources":["../../src/simple-tree/treeNodeValid.ts"],"names":[],"mappings":"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","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\ttype TreeNodeSchema,\n\ttype TreeNodeSchemaClass,\n\tNodeKind,\n\ttryGetSimpleNodeSchema,\n\tisTreeNode,\n\tTreeNodeKernel,\n\tprivateToken,\n\tTreeNode,\n\ttype InternalTreeNode,\n} from \"./core/index.js\";\nimport {\n\ttype FlexTreeNode,\n\ttype MapTreeNode,\n\tisFlexTreeNode,\n\tmarkEager,\n} from \"../feature-libraries/index.js\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\nimport { fail } from \"../util/index.js\";\n\nimport { getFlexSchema } from \"./toFlexSchema.js\";\nimport { getOrCreateInnerNode, setInnerNode } from \"./proxyBinding.js\";\n\n/**\n * Class which all {@link TreeNode}s must extend.\n * Since this is not exported, it allows robust detection of attempts to create TreeNodes which do not go through SchemaFactory which is the only place which exposes classes that extend this.\n *\n * This has static members which schema classes can override to provide schema specific functionality.\n * These static members are only intended to be used / overridden by code within this package, and are used by the various node kinds.\n * Access to these static members has to be done via `this.constructor.staticMember` to support the overrides, and thus can only be used in the constructor, after the base constructor has been invoked.\n */\nexport abstract class TreeNodeValid<TInput> extends TreeNode {\n\t/**\n\t * Schema classes can override this to control what happens at the end of the constructor.\n\t * The return value from this is returned from the constructor, allowing substituting a proxy if desired.\n\t *\n\t * This is not simply done in the derived constructor to enable:\n\t * - this class to access the value which is being returned before it's returned from the constructor.\n\t * - the derived class to be provided the input `FlexTreeNode` without relying on a field on the node to hold it.\n\t */\n\tprotected static prepareInstance<T>(\n\t\tthis: typeof TreeNodeValid<T>,\n\t\tinstance: TreeNodeValid<T>,\n\t\tinput: FlexTreeNode,\n\t): TreeNodeValid<T> {\n\t\treturn instance;\n\t}\n\n\t/**\n\t * Schema classes must override to provide an implementation of RawTreeNode construction.\n\t */\n\tprotected static buildRawNode<T>(\n\t\tthis: typeof TreeNodeValid<T>,\n\t\tinstance: TreeNodeValid<T>,\n\t\tinput: T,\n\t): MapTreeNode {\n\t\treturn fail(\"Schema must override buildRawNode\");\n\t}\n\n\t/**\n\t * Schema classes can override to provide a callback that is called once when the first node is constructed.\n\t * This is a good place to perform extra validation and cache schema derived data needed for the implementation of the node.\n\t */\n\tprotected static oneTimeSetup<T>(this: typeof TreeNodeValid<T>): void {}\n\n\t/**\n\t * The most derived constructor (the one invoked with the `new` operator, not a parent class constructor invoked with as `super`) used to construct an instance of this type.\n\t * @remarks\n\t * Captured when an instance is constructed.\n\t *\n\t * Used to ensure that some derived class (which must override this member, defaulting it to `undefined`) is only instantiated with a single \"most derived\" class (the constructor actually invoked the the user with `new`).\n\t *\n\t * Typically this is override in the class that statically implements {@link TreeNodeSchema} to enforce that all nodes using that schema use the same class and not different subclasses of it.\n\t *\n\t * Also used to detect if oneTimeSetup has run.\n\t *\n\t * @privateRemarks\n\t * This defaults to \"default\", which is used to trigger an error if not overridden in the derived class.\n\t *\n\t * The value of this on TreeNodeValid must only be overridden by base classes and never modified.\n\t * Ways to enforce this immutability prevent it from being overridden,\n\t * so code modifying constructorCached should be extra careful to avoid accidentally modifying the base/inherited value.\n\t */\n\tprotected static constructorCached: MostDerivedData | \"default\" | undefined = \"default\";\n\n\t/**\n\t * Indicate that `this` is the most derived version of a schema, and thus the only one allowed to be used (other than by being subclassed a single time).\n\t */\n\tpublic static markMostDerived(this: typeof TreeNodeValid & TreeNodeSchema): MostDerivedData {\n\t\tassert(this.constructorCached !== \"default\", 0x95f /* invalid schema class */);\n\n\t\tif (this.constructorCached === undefined) {\n\t\t\t// Set the constructorCached on the layer of the prototype chain that declared it.\n\t\t\t// This is necessary to ensure there is only one subclass of that type used:\n\t\t\t// if constructorCached was simply set on `schema`,\n\t\t\t// then a base classes between `schema` (exclusive) and where `constructorCached` is set (inclusive) and other subclasses of them\n\t\t\t// would not see the stored `constructorCached`, and the validation above against multiple derived classes would not work.\n\n\t\t\t// This is not just an alias of `this`, but a reference to the item in the prototype chain being walked, which happens to start at `this`.\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-this-alias\n\t\t\tlet schemaBase: typeof TreeNodeValid = this;\n\t\t\twhile (!Object.prototype.hasOwnProperty.call(schemaBase, \"constructorCached\")) {\n\t\t\t\tschemaBase = Reflect.getPrototypeOf(schemaBase) as typeof TreeNodeValid;\n\t\t\t}\n\t\t\tassert(schemaBase.constructorCached === undefined, 0x962 /* overwriting wrong cache */);\n\t\t\tschemaBase.constructorCached = { constructor: this, oneTimeInitialized: false };\n\t\t\tassert(\n\t\t\t\tthis.constructorCached === schemaBase.constructorCached,\n\t\t\t\t0x9b5 /* Inheritance should work */,\n\t\t\t);\n\t\t\treturn this.constructorCached;\n\t\t} else if (this.constructorCached.constructor === this) {\n\t\t\treturn this.constructorCached;\n\t\t}\n\n\t\tthrow new UsageError(\n\t\t\t`Two schema classes were used (${this.name} and ${\n\t\t\t\tthis.constructorCached.constructor.name\n\t\t\t}) which derived from the same SchemaFactory generated class (${JSON.stringify(\n\t\t\t\tthis.identifier,\n\t\t\t)}). This is invalid.`,\n\t\t);\n\t}\n\n\tpublic constructor(input: TInput | InternalTreeNode) {\n\t\tsuper(privateToken);\n\t\tconst schema = this.constructor as typeof TreeNodeValid & TreeNodeSchema;\n\t\tconst cache = schema.markMostDerived();\n\t\tif (!cache.oneTimeInitialized) {\n\t\t\tconst flexSchema = getFlexSchema(schema);\n\t\t\tassert(\n\t\t\t\ttryGetSimpleNodeSchema(flexSchema) === schema,\n\t\t\t\t0x961 /* Schema class not properly configured */,\n\t\t\t);\n\t\t\tschema.oneTimeSetup();\n\t\t\tcache.oneTimeInitialized = true;\n\t\t}\n\n\t\tif (isTreeNode(input)) {\n\t\t\t// TODO: update this once we have better support for deep-copying and move operations.\n\t\t\tthrow new UsageError(\n\t\t\t\t\"Existing nodes may not be used as the constructor parameter for a new node. The existing node may be used directly instead of creating a new one, used as a child of the new node (if it has not yet been inserted into the tree). If the desired result is copying the provided node, it must be deep copied (since any child node would be parented under both the new and old nodes). Currently no API is provided to make deep copies, but it can be done manually with object spreads - for example `new Foo({...oldFoo})` will work if all fields of `oldFoo` are leaf nodes.\",\n\t\t\t);\n\t\t}\n\n\t\tconst node: FlexTreeNode = isFlexTreeNode(input)\n\t\t\t? input\n\t\t\t: schema.buildRawNode(this, input);\n\t\tassert(\n\t\t\ttryGetSimpleNodeSchema(node.schema) === schema,\n\t\t\t0x83b /* building node with wrong schema */,\n\t\t);\n\n\t\tconst result = schema.prepareInstance(this, node);\n\t\tnew TreeNodeKernel(result, schema);\n\t\tsetInnerNode(result, node);\n\t\treturn result;\n\t}\n}\n// Class objects are functions (callable), so we need a strong way to distinguish between `schema` and `() => schema` when used as a `LazyItem`.\nmarkEager(TreeNodeValid);\n\n/**\n * Data cached about the most derived type in a schema's class hierarchy.\n * @remarks\n * The most derived type is the only one allowed to be referenced by other schema or constructed as a node.\n * It has to be discovered lazily (when a node is constructed or when a {@link TreeViewConfiguration} is made),\n * since JavaScript provides no way to find derived classes, or inject static class initialization time logic into base classes.\n * Additionally since schema can reference other schema through lazy references which might be forward or recursive references,\n * this can not be evaluated for one schema when referenced by another schema.\n *\n * See {@link TreeNodeValid.constructorCached} and {@link TreeNodeValid.markMostDerived}.\n */\nexport interface MostDerivedData {\n\treadonly constructor: typeof TreeNodeValid & TreeNodeSchema;\n\toneTimeInitialized: boolean;\n}\n\n// #region NodeJS custom inspect for TreeNodes.\n\n/**\n * Used to customize \"inspect\" behavior in NodeJS.\n * See https://nodejs.org/api/util.html#utilinspectcustom for details.\n *\n * VS-Code's debugger also uses this to inspect objects,\n * see https://github.com/microsoft/vscode-js-debug/blob/64df2686c92bac402909dee5c3c389bbb7a81f6d/src/adapter/templates/getStringyProps.ts#L11 for details.\n */\nconst customInspectSymbol = Symbol.for(\"nodejs.util.inspect.custom\");\n\n/**\n * Node inspecting function for use with {@link customInspectSymbol}.\n */\nfunction inspectNodeFunction(\n\tthis: TreeNodeValid<unknown>,\n\tdepth: number,\n\toptions?: unknown,\n\tinspect?: unknown,\n): unknown {\n\t// TODO: replicated from tryGetSchema to avoid cycle.\n\t// This case could be optimized, for example by placing the simple schema in a symbol on tree nodes.\n\tconst schema = tryGetSimpleNodeSchema(\n\t\tgetOrCreateInnerNode(this).schema,\n\t) as TreeNodeSchemaClass;\n\tconst title = `${schema.name}: ${NodeKind[schema.kind]} Node (${schema.identifier})`;\n\n\tif (depth < 2) {\n\t\tconst short = shortContent(this);\n\t\tif (short !== undefined) {\n\t\t\treturn `${title} ${short}`;\n\t\t}\n\t\treturn title;\n\t}\n\tconst content = `${title} ${JSON.stringify(this)}`;\n\treturn content;\n}\n\n/**\n * If the node has no items, a short JSON string for it.\n */\nfunction shortContent(node: TreeNodeValid<unknown>): string | undefined {\n\tif (Object.values(node).length === 0) {\n\t\treturn JSON.stringify(node);\n\t}\n\treturn undefined;\n}\n\n/**\n * Add inherited non-enumerable symbol for NodeJS inspection to all nodes.\n *\n * See {@link customInspectSymbol}.\n */\nObject.defineProperty(TreeNodeValid.prototype, customInspectSymbol, {\n\tvalue: inspectNodeFunction,\n\tenumerable: false,\n});\n\n// #endregion\n\n// #region Browser custom debug format for TreeNodes\n\n// This section has side-effects, so including it in this file ensures its loaded whenever TreeNodes could exist.\n// Supported in at least Chrome and FireFox, more details at https://firefox-source-docs.mozilla.org/devtools-user/custom_formatters/index.html\n// For this to work the browser's dev tools generally have to \"Enable custom formatters\".\n\n// This formatter is inspired by https://github.com/andrewdavey/immutable-devtools/blob/master/src/createFormatters.js which provides a similar formatter for the immutable.js library.\n\nconst globals = typeof window === \"undefined\" ? globalThis : window;\nconst formatters = ((\n\tglobals as { devtoolsFormatters?: DevtoolsFormatter.DevtoolsFormatter[] }\n).devtoolsFormatters ??= []);\n\nconst nodeFormatter: DevtoolsFormatter.DevtoolsFormatter = {\n\theader(object, config) {\n\t\tif (isTreeNode(object)) {\n\t\t\treturn [\"span\", `${inspectNodeFunction.call(object, 1)}`];\n\t\t}\n\t\treturn null;\n\t},\n\tbody(object, config): DevtoolsFormatter.Item {\n\t\tconst children: DevtoolsFormatter.Item[] = [];\n\t\tfor (const [key, value] of Object.entries(object as TreeNode)) {\n\t\t\tchildren.push([\"li\", [\"span\", `${key}: `], formattedReference(value)]);\n\t\t}\n\n\t\t// TODO:\n\t\t// for array nodes, this isn't great since (at least in FireFox) the list items show up with a prefixed number starting from 1.\n\t\t// This looks messy when followed by the array index.\n\t\t// Find a way to hide the list index.\n\t\t// { style: 'list-style-type: none` } did not seem to work.\n\n\t\treturn [\"ol\", ...children];\n\t},\n\thasBody(object, config) {\n\t\treturn shortContent(object as TreeNodeValid<undefined>) === undefined;\n\t},\n};\n\nfunction formattedReference(\n\tobject: unknown,\n\tconfig?: DevtoolsFormatter.ObjectConfig,\n): DevtoolsFormatter.Item {\n\tif (typeof object === \"undefined\") {\n\t\treturn [\"span\", \"undefined\"];\n\t} else if (object === \"null\") {\n\t\treturn [\"span\", \"null\"];\n\t}\n\n\treturn [\"object\", { object, config }];\n}\n\nformatters.push(nodeFormatter);\n\n// #endregion\n\n// These types are based on https://github.com/BenjaminAster/Better-TypeScript/blob/main/types/devtools-formatters.d.ts\n// however the original package causes multiple compile errors due to some of its other types it used, so the relevant part has been extracted and adjusted to better match our conventions.\ndeclare namespace DevtoolsFormatter {\n\ttype ObjectConfig = Record<string | symbol, unknown>;\n\n\ttype ElementTagName = \"div\" | \"span\" | \"ol\" | \"li\" | \"table\" | \"tr\" | \"td\";\n\n\ttype ElementTemplate = StyledElementTemplate | UnstyledElementTemplate;\n\n\ttype StyledElementTemplate = readonly [\n\t\tElementTagName,\n\t\t{\n\t\t\tstyle?: string;\n\t\t},\n\t\t...Item[],\n\t];\n\n\ttype UnstyledElementTemplate = readonly [ElementTagName, ...Item[]];\n\n\ttype ObjectReference = readonly [\n\t\t\"object\",\n\t\t{\n\t\t\tobject: unknown;\n\t\t\tconfig?: ObjectConfig;\n\t\t},\n\t];\n\n\ttype Item = string | ElementTemplate | ObjectReference;\n\n\tinterface DevtoolsFormatter {\n\t\theader(\n\t\t\tobject?: unknown,\n\t\t\tconfig?: ObjectConfig,\n\t\t\t// eslint-disable-next-line @rushstack/no-new-null\n\t\t): Item | null;\n\t\thasBody(object?: unknown, config?: ObjectConfig): boolean;\n\t\tbody(object?: unknown, config?: ObjectConfig): Item;\n\t}\n}\n"]}
1
+ {"version":3,"file":"treeNodeValid.js","sourceRoot":"","sources":["../../src/simple-tree/treeNodeValid.ts"],"names":[],"mappings":"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","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\ttype TreeNodeSchema,\n\tNodeKind,\n\ttryGetSimpleNodeSchema,\n\tisTreeNode,\n\tTreeNodeKernel,\n\tprivateToken,\n\tTreeNode,\n\ttype InternalTreeNode,\n\ttypeSchemaSymbol,\n\ttype InnerNode,\n} from \"./core/index.js\";\nimport {\n\ttype FlexTreeNode,\n\ttype MapTreeNode,\n\tisFlexTreeNode,\n\tmarkEager,\n} from \"../feature-libraries/index.js\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\nimport { fail } from \"../util/index.js\";\n\nimport { getFlexSchema } from \"./toFlexSchema.js\";\n\n/**\n * Class which all {@link TreeNode}s must extend.\n * Since this is not exported, it allows robust detection of attempts to create TreeNodes which do not go through SchemaFactory which is the only place which exposes classes that extend this.\n *\n * This has static members which schema classes can override to provide schema specific functionality.\n * These static members are only intended to be used / overridden by code within this package, and are used by the various node kinds.\n * Access to these static members has to be done via `this.constructor.staticMember` to support the overrides, and thus can only be used in the constructor, after the base constructor has been invoked.\n */\nexport abstract class TreeNodeValid<TInput> extends TreeNode {\n\t/**\n\t * Schema classes can override this to control what happens at the end of the constructor.\n\t * The return value from this is returned from the constructor, allowing substituting a proxy if desired.\n\t *\n\t * This is not simply done in the derived constructor to enable:\n\t * - this class to access the value which is being returned before it's returned from the constructor.\n\t * - the derived class to be provided the input `FlexTreeNode` without relying on a field on the node to hold it.\n\t */\n\tprotected static prepareInstance<T>(\n\t\tthis: typeof TreeNodeValid<T>,\n\t\tinstance: TreeNodeValid<T>,\n\t\tinput: FlexTreeNode,\n\t): TreeNodeValid<T> {\n\t\treturn instance;\n\t}\n\n\t/**\n\t * Schema classes must override to provide an implementation of RawTreeNode construction.\n\t */\n\tprotected static buildRawNode<T>(\n\t\tthis: typeof TreeNodeValid<T>,\n\t\tinstance: TreeNodeValid<T>,\n\t\tinput: T,\n\t): MapTreeNode {\n\t\treturn fail(\"Schema must override buildRawNode\");\n\t}\n\n\t/**\n\t * Schema classes can override to provide a callback that is called once when the first node is constructed.\n\t * This is a good place to perform extra validation and cache schema derived data needed for the implementation of the node.\n\t */\n\tprotected static oneTimeSetup<T>(this: typeof TreeNodeValid<T>): void {}\n\n\t/**\n\t * The most derived constructor (the one invoked with the `new` operator, not a parent class constructor invoked with as `super`) used to construct an instance of this type.\n\t * @remarks\n\t * Captured when an instance is constructed.\n\t *\n\t * Used to ensure that some derived class (which must override this member, defaulting it to `undefined`) is only instantiated with a single \"most derived\" class (the constructor actually invoked the the user with `new`).\n\t *\n\t * Typically this is override in the class that statically implements {@link TreeNodeSchema} to enforce that all nodes using that schema use the same class and not different subclasses of it.\n\t *\n\t * Also used to detect if oneTimeSetup has run.\n\t *\n\t * @privateRemarks\n\t * This defaults to \"default\", which is used to trigger an error if not overridden in the derived class.\n\t *\n\t * The value of this on TreeNodeValid must only be overridden by base classes and never modified.\n\t * Ways to enforce this immutability prevent it from being overridden,\n\t * so code modifying constructorCached should be extra careful to avoid accidentally modifying the base/inherited value.\n\t */\n\tprotected static constructorCached: MostDerivedData | \"default\" | undefined = \"default\";\n\n\t/**\n\t * Indicate that `this` is the most derived version of a schema, and thus the only one allowed to be used (other than by being subclassed a single time).\n\t */\n\tpublic static markMostDerived(this: typeof TreeNodeValid & TreeNodeSchema): MostDerivedData {\n\t\tassert(this.constructorCached !== \"default\", 0x95f /* invalid schema class */);\n\n\t\tif (this.constructorCached === undefined) {\n\t\t\t// Set the constructorCached on the layer of the prototype chain that declared it.\n\t\t\t// This is necessary to ensure there is only one subclass of that type used:\n\t\t\t// if constructorCached was simply set on `schema`,\n\t\t\t// then a base classes between `schema` (exclusive) and where `constructorCached` is set (inclusive) and other subclasses of them\n\t\t\t// would not see the stored `constructorCached`, and the validation above against multiple derived classes would not work.\n\n\t\t\t// This is not just an alias of `this`, but a reference to the item in the prototype chain being walked, which happens to start at `this`.\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-this-alias\n\t\t\tlet schemaBase: typeof TreeNodeValid = this;\n\t\t\twhile (!Object.prototype.hasOwnProperty.call(schemaBase, \"constructorCached\")) {\n\t\t\t\tschemaBase = Reflect.getPrototypeOf(schemaBase) as typeof TreeNodeValid;\n\t\t\t}\n\t\t\tassert(schemaBase.constructorCached === undefined, 0x962 /* overwriting wrong cache */);\n\t\t\tschemaBase.constructorCached = { constructor: this, oneTimeInitialized: false };\n\t\t\tassert(\n\t\t\t\tthis.constructorCached === schemaBase.constructorCached,\n\t\t\t\t0x9b5 /* Inheritance should work */,\n\t\t\t);\n\t\t\treturn this.constructorCached;\n\t\t} else if (this.constructorCached.constructor === this) {\n\t\t\treturn this.constructorCached;\n\t\t}\n\n\t\tthrow new UsageError(\n\t\t\t`Two schema classes were used (${this.name} and ${\n\t\t\t\tthis.constructorCached.constructor.name\n\t\t\t}) which derived from the same SchemaFactory generated class (${JSON.stringify(\n\t\t\t\tthis.identifier,\n\t\t\t)}). This is invalid.`,\n\t\t);\n\t}\n\n\tpublic constructor(input: TInput | InternalTreeNode) {\n\t\tsuper(privateToken);\n\t\tconst schema = this.constructor as typeof TreeNodeValid & TreeNodeSchema;\n\t\tconst cache = schema.markMostDerived();\n\t\tif (!cache.oneTimeInitialized) {\n\t\t\tconst flexSchema = getFlexSchema(schema);\n\t\t\tassert(\n\t\t\t\ttryGetSimpleNodeSchema(flexSchema) === schema,\n\t\t\t\t0x961 /* Schema class not properly configured */,\n\t\t\t);\n\t\t\tschema.oneTimeSetup();\n\t\t\tcache.oneTimeInitialized = true;\n\t\t}\n\n\t\tif (isTreeNode(input)) {\n\t\t\t// TODO: update this once we have better support for deep-copying and move operations.\n\t\t\tthrow new UsageError(\n\t\t\t\t\"Existing nodes may not be used as the constructor parameter for a new node. The existing node may be used directly instead of creating a new one, used as a child of the new node (if it has not yet been inserted into the tree). If the desired result is copying the provided node, it must be deep copied (since any child node would be parented under both the new and old nodes). Currently no API is provided to make deep copies, but it can be done manually with object spreads - for example `new Foo({...oldFoo})` will work if all fields of `oldFoo` are leaf nodes.\",\n\t\t\t);\n\t\t}\n\n\t\tconst node: InnerNode = isFlexTreeNode(input) ? input : schema.buildRawNode(this, input);\n\t\tassert(\n\t\t\ttryGetSimpleNodeSchema(node.flexSchema) === schema,\n\t\t\t0x83b /* building node with wrong schema */,\n\t\t);\n\n\t\tconst result = schema.prepareInstance(this, node);\n\t\t// The TreeNodeKernel associates itself the TreeNode (result here, not node) so it can be looked up later via getKernel.\n\t\t// If desired this could be put in a non-enumerable symbol property for lookup instead, but that gets messy going through proxies,\n\t\t// so just relying on the WeakMap seems like the cleanest approach.\n\t\tnew TreeNodeKernel(result, schema, node);\n\n\t\treturn result;\n\t}\n}\n// Class objects are functions (callable), so we need a strong way to distinguish between `schema` and `() => schema` when used as a `LazyItem`.\nmarkEager(TreeNodeValid);\n\n/**\n * Data cached about the most derived type in a schema's class hierarchy.\n * @remarks\n * The most derived type is the only one allowed to be referenced by other schema or constructed as a node.\n * It has to be discovered lazily (when a node is constructed or when a {@link TreeViewConfiguration} is made),\n * since JavaScript provides no way to find derived classes, or inject static class initialization time logic into base classes.\n * Additionally since schema can reference other schema through lazy references which might be forward or recursive references,\n * this can not be evaluated for one schema when referenced by another schema.\n *\n * See {@link TreeNodeValid.constructorCached} and {@link TreeNodeValid.markMostDerived}.\n */\nexport interface MostDerivedData {\n\treadonly constructor: typeof TreeNodeValid & TreeNodeSchema;\n\toneTimeInitialized: boolean;\n}\n\n// #region NodeJS custom inspect for TreeNodes.\n\n/**\n * Used to customize \"inspect\" behavior in NodeJS.\n * See https://nodejs.org/api/util.html#utilinspectcustom for details.\n *\n * VS-Code's debugger also uses this to inspect objects,\n * see https://github.com/microsoft/vscode-js-debug/blob/64df2686c92bac402909dee5c3c389bbb7a81f6d/src/adapter/templates/getStringyProps.ts#L11 for details.\n */\nconst customInspectSymbol = Symbol.for(\"nodejs.util.inspect.custom\");\n\n/**\n * Node inspecting function for use with {@link customInspectSymbol}.\n */\nfunction inspectNodeFunction(\n\tthis: TreeNodeValid<unknown>,\n\tdepth: number,\n\toptions?: unknown,\n\tinspect?: unknown,\n): unknown {\n\tconst schema = this[typeSchemaSymbol];\n\tconst title = `${schema.name}: ${NodeKind[schema.kind]} Node (${schema.identifier})`;\n\n\tif (depth < 2) {\n\t\tconst short = shortContent(this);\n\t\tif (short !== undefined) {\n\t\t\treturn `${title} ${short}`;\n\t\t}\n\t\treturn title;\n\t}\n\tconst content = `${title} ${JSON.stringify(this)}`;\n\treturn content;\n}\n\n/**\n * If the node has no items, a short JSON string for it.\n */\nfunction shortContent(node: TreeNodeValid<unknown>): string | undefined {\n\tif (Object.values(node).length === 0) {\n\t\treturn JSON.stringify(node);\n\t}\n\treturn undefined;\n}\n\n/**\n * Add inherited non-enumerable symbol for NodeJS inspection to all nodes.\n *\n * See {@link customInspectSymbol}.\n */\nObject.defineProperty(TreeNodeValid.prototype, customInspectSymbol, {\n\tvalue: inspectNodeFunction,\n\tenumerable: false,\n});\n\n// #endregion\n\n// #region Browser custom debug format for TreeNodes\n\n// This section has side-effects, so including it in this file ensures its loaded whenever TreeNodes could exist.\n// Supported in at least Chrome and FireFox, more details at https://firefox-source-docs.mozilla.org/devtools-user/custom_formatters/index.html\n// For this to work the browser's dev tools generally have to \"Enable custom formatters\".\n\n// This formatter is inspired by https://github.com/andrewdavey/immutable-devtools/blob/master/src/createFormatters.js which provides a similar formatter for the immutable.js library.\n\nconst globals = typeof window === \"undefined\" ? globalThis : window;\nconst formatters = ((\n\tglobals as { devtoolsFormatters?: DevtoolsFormatter.DevtoolsFormatter[] }\n).devtoolsFormatters ??= []);\n\nconst nodeFormatter: DevtoolsFormatter.DevtoolsFormatter = {\n\theader(object, config) {\n\t\tif (isTreeNode(object)) {\n\t\t\treturn [\"span\", `${inspectNodeFunction.call(object, 1)}`];\n\t\t}\n\t\treturn null;\n\t},\n\tbody(object, config): DevtoolsFormatter.Item {\n\t\tconst children: DevtoolsFormatter.Item[] = [];\n\t\tfor (const [key, value] of Object.entries(object as TreeNode)) {\n\t\t\tchildren.push([\"li\", [\"span\", `${key}: `], formattedReference(value)]);\n\t\t}\n\n\t\t// TODO:\n\t\t// for array nodes, this isn't great since (at least in FireFox) the list items show up with a prefixed number starting from 1.\n\t\t// This looks messy when followed by the array index.\n\t\t// Find a way to hide the list index.\n\t\t// { style: 'list-style-type: none` } did not seem to work.\n\n\t\treturn [\"ol\", ...children];\n\t},\n\thasBody(object, config) {\n\t\treturn shortContent(object as TreeNodeValid<undefined>) === undefined;\n\t},\n};\n\nfunction formattedReference(\n\tobject: unknown,\n\tconfig?: DevtoolsFormatter.ObjectConfig,\n): DevtoolsFormatter.Item {\n\tif (typeof object === \"undefined\") {\n\t\treturn [\"span\", \"undefined\"];\n\t} else if (object === \"null\") {\n\t\treturn [\"span\", \"null\"];\n\t}\n\n\treturn [\"object\", { object, config }];\n}\n\nformatters.push(nodeFormatter);\n\n// #endregion\n\n// These types are based on https://github.com/BenjaminAster/Better-TypeScript/blob/main/types/devtools-formatters.d.ts\n// however the original package causes multiple compile errors due to some of its other types it used, so the relevant part has been extracted and adjusted to better match our conventions.\ndeclare namespace DevtoolsFormatter {\n\ttype ObjectConfig = Record<string | symbol, unknown>;\n\n\ttype ElementTagName = \"div\" | \"span\" | \"ol\" | \"li\" | \"table\" | \"tr\" | \"td\";\n\n\ttype ElementTemplate = StyledElementTemplate | UnstyledElementTemplate;\n\n\ttype StyledElementTemplate = readonly [\n\t\tElementTagName,\n\t\t{\n\t\t\tstyle?: string;\n\t\t},\n\t\t...Item[],\n\t];\n\n\ttype UnstyledElementTemplate = readonly [ElementTagName, ...Item[]];\n\n\ttype ObjectReference = readonly [\n\t\t\"object\",\n\t\t{\n\t\t\tobject: unknown;\n\t\t\tconfig?: ObjectConfig;\n\t\t},\n\t];\n\n\ttype Item = string | ElementTemplate | ObjectReference;\n\n\tinterface DevtoolsFormatter {\n\t\theader(\n\t\t\tobject?: unknown,\n\t\t\tconfig?: ObjectConfig,\n\t\t\t// eslint-disable-next-line @rushstack/no-new-null\n\t\t): Item | null;\n\t\thasBody(object?: unknown, config?: ObjectConfig): boolean;\n\t\tbody(object?: unknown, config?: ObjectConfig): Item;\n\t}\n}\n"]}
@@ -11,7 +11,7 @@ import type { TreeArrayNodeBase, TreeArrayNode } from "./arrayNode.js";
11
11
  * {@link Unenforced} version of `ObjectFromSchemaRecord`.
12
12
  * @remarks
13
13
  * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
14
- * @public
14
+ * @system @public
15
15
  */
16
16
  export type ObjectFromSchemaRecordUnsafe<T extends Unenforced<RestrictiveReadonlyRecord<string, ImplicitFieldSchema>>> = {
17
17
  -readonly [Property in keyof T]: TreeFieldFromImplicitFieldUnsafe<T[Property]>;
@@ -20,35 +20,35 @@ export type ObjectFromSchemaRecordUnsafe<T extends Unenforced<RestrictiveReadonl
20
20
  * {@link Unenforced} version of {@link TreeObjectNode}.
21
21
  * @remarks
22
22
  * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
23
- * @public
23
+ * @system @public
24
24
  */
25
25
  export type TreeObjectNodeUnsafe<T extends Unenforced<RestrictiveReadonlyRecord<string, ImplicitFieldSchema>>, TypeName extends string = string> = TreeNode & ObjectFromSchemaRecordUnsafe<T> & WithType<TypeName, NodeKind.Object>;
26
26
  /**
27
27
  * {@link Unenforced} version of {@link TreeFieldFromImplicitField}.
28
28
  * @remarks
29
29
  * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
30
- * @public
30
+ * @system @public
31
31
  */
32
32
  export type TreeFieldFromImplicitFieldUnsafe<TSchema extends Unenforced<ImplicitFieldSchema>> = TSchema extends FieldSchemaUnsafe<infer Kind, infer Types> ? ApplyKind<TreeNodeFromImplicitAllowedTypesUnsafe<Types>, Kind, false> : TSchema extends ImplicitAllowedTypes ? TreeNodeFromImplicitAllowedTypesUnsafe<TSchema> : unknown;
33
33
  /**
34
34
  * {@link Unenforced} version of {@link TreeNodeFromImplicitAllowedTypes}.
35
35
  * @remarks
36
36
  * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
37
- * @public
37
+ * @system @public
38
38
  */
39
39
  export type TreeNodeFromImplicitAllowedTypesUnsafe<TSchema extends Unenforced<ImplicitAllowedTypes>> = TSchema extends ImplicitAllowedTypes ? TreeNodeFromImplicitAllowedTypes<TSchema> : TSchema extends TreeNodeSchema ? NodeFromSchema<TSchema> : TSchema extends AllowedTypes ? NodeFromSchema<FlexListToUnion<TSchema>> : unknown;
40
40
  /**
41
41
  * {@link Unenforced} version of {@link InsertableTreeNodeFromImplicitAllowedTypes}.
42
42
  * @remarks
43
43
  * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
44
- * @public
44
+ * @system @public
45
45
  */
46
46
  export type InsertableTreeNodeFromImplicitAllowedTypesUnsafe<TSchema extends Unenforced<ImplicitAllowedTypes>> = TSchema extends AllowedTypes ? InsertableTypedNodeUnsafe<FlexListToUnion<TSchema>> : InsertableTypedNodeUnsafe<TSchema>;
47
47
  /**
48
48
  * {@link Unenforced} version of {@link InsertableTypedNode}.
49
49
  * @remarks
50
50
  * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
51
- * @public
51
+ * @system @public
52
52
  */
53
53
  export type InsertableTypedNodeUnsafe<T extends Unenforced<TreeNodeSchema>> = [
54
54
  Unhydrated<NodeFromSchemaUnsafe<T>> | (T extends {
@@ -59,21 +59,21 @@ export type InsertableTypedNodeUnsafe<T extends Unenforced<TreeNodeSchema>> = [
59
59
  * {@link Unenforced} version of {@link NodeFromSchema}.
60
60
  * @remarks
61
61
  * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
62
- * @public
62
+ * @system @public
63
63
  */
64
64
  export type NodeFromSchemaUnsafe<T extends Unenforced<TreeNodeSchema>> = T extends TreeNodeSchema<string, NodeKind, infer TNode> ? TNode : never;
65
65
  /**
66
66
  * {@link Unenforced} version of {@link InsertableTreeNodeFromImplicitAllowedTypes}.
67
67
  * @remarks
68
68
  * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
69
- * @public
69
+ * @system @public
70
70
  */
71
71
  export type NodeBuilderDataUnsafe<T extends Unenforced<TreeNodeSchema>> = T extends TreeNodeSchema<string, NodeKind, unknown, infer TBuild> ? TBuild : never;
72
72
  /**
73
73
  * {@link Unenforced} version of {@link (TreeArrayNode:interface)}.
74
74
  * @remarks
75
75
  * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
76
- * @sealed @public
76
+ * @system @sealed @public
77
77
  */
78
78
  export interface TreeArrayNodeUnsafe<TAllowedTypes extends Unenforced<ImplicitAllowedTypes>> extends TreeArrayNodeBase<TreeNodeFromImplicitAllowedTypesUnsafe<TAllowedTypes>, InsertableTreeNodeFromImplicitAllowedTypesUnsafe<TAllowedTypes>, TreeArrayNode> {
79
79
  }
@@ -81,7 +81,7 @@ export interface TreeArrayNodeUnsafe<TAllowedTypes extends Unenforced<ImplicitAl
81
81
  * {@link Unenforced} version of {@link TreeMapNode}.
82
82
  * @remarks
83
83
  * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
84
- * @sealed @public
84
+ * @system @sealed @public
85
85
  */
86
86
  export interface TreeMapNodeUnsafe<T extends Unenforced<ImplicitAllowedTypes>> extends ReadonlyMapInlined<string, T>, TreeNode {
87
87
  /**
@@ -128,14 +128,14 @@ export interface ReadonlyMapInlined<K, T extends Unenforced<ImplicitAllowedTypes
128
128
  * {@link Unenforced} version of `FieldHasDefault`.
129
129
  * @remarks
130
130
  * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
131
- * @sealed @public
131
+ * @system @sealed @public
132
132
  */
133
133
  export type FieldHasDefaultUnsafe<T extends Unenforced<ImplicitFieldSchema>> = T extends FieldSchemaUnsafe<FieldKind.Optional | FieldKind.Identifier, Unenforced<ImplicitAllowedTypes>> ? true : false;
134
134
  /**
135
135
  * {@link Unenforced} version of `InsertableObjectFromSchemaRecord`.
136
136
  * @remarks
137
137
  * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
138
- * @public
138
+ * @system @public
139
139
  */
140
140
  export type InsertableObjectFromSchemaRecordUnsafe<T extends Unenforced<RestrictiveReadonlyRecord<string, ImplicitFieldSchema>>> = {
141
141
  readonly [Property in keyof T as FieldHasDefaultUnsafe<T[Property]> extends false ? Property : never]: InsertableTreeFieldFromImplicitFieldUnsafe<T[Property]>;
@@ -146,7 +146,7 @@ export type InsertableObjectFromSchemaRecordUnsafe<T extends Unenforced<Restrict
146
146
  * {@link Unenforced} version of {@link InsertableTreeFieldFromImplicitField}.
147
147
  * @remarks
148
148
  * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
149
- * @public
149
+ * @system @public
150
150
  */
151
151
  export type InsertableTreeFieldFromImplicitFieldUnsafe<TSchema extends Unenforced<ImplicitFieldSchema>> = TSchema extends FieldSchemaUnsafe<infer Kind, infer Types> ? ApplyKind<InsertableTreeNodeFromImplicitAllowedTypesUnsafe<Types>, Kind, true> : InsertableTreeNodeFromImplicitAllowedTypesUnsafe<TSchema>;
152
152
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"typesUnsafe.js","sourceRoot":"","sources":["../../src/simple-tree/typesUnsafe.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAuRH,sDAAsD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { FlexListToUnion, Unenforced } from \"../feature-libraries/index.js\";\nimport type { RestrictiveReadonlyRecord, _InlineTrick } from \"../util/index.js\";\n\nimport type {\n\tAllowedTypes,\n\tApplyKind,\n\tFieldKind,\n\tFieldSchema,\n\tImplicitAllowedTypes,\n\tImplicitFieldSchema,\n\tNodeFromSchema,\n\tTreeNodeFromImplicitAllowedTypes,\n} from \"./schemaTypes.js\";\nimport type {\n\tNodeKind,\n\tTreeNodeSchema,\n\tWithType,\n\tTreeNode,\n\tUnhydrated,\n} from \"./core/index.js\";\nimport type { TreeArrayNodeBase, TreeArrayNode } from \"./arrayNode.js\";\n\n/*\n * TODO:\n * Below are a bunch of \"unsafe\" versions of types from \"schemaTypes.ts\".\n * These types duplicate the ones in \"schemaTypes.ts\", except with some of the extends clauses unenforced.\n * This is not great for type safety or maintainability.\n * Eventually it would be great to do at least one of the following:\n * 1. Find a way to avoid needing these entirely, possibly by improving TSC's recursive type support.\n * 2. Deduplicate the safe and unsafe types (possibly by having the safe one call the unsafe ones, or some other trick).\n * 3. Add type tests that check that the two copies of these types produce identical results.\n */\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\n/**\n * {@link Unenforced} version of `ObjectFromSchemaRecord`.\n * @remarks\n * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.\n * @public\n */\nexport type ObjectFromSchemaRecordUnsafe<\n\tT extends Unenforced<RestrictiveReadonlyRecord<string, ImplicitFieldSchema>>,\n> = {\n\t-readonly [Property in keyof T]: TreeFieldFromImplicitFieldUnsafe<T[Property]>;\n};\n\n/**\n * {@link Unenforced} version of {@link TreeObjectNode}.\n * @remarks\n * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.\n * @public\n */\nexport type TreeObjectNodeUnsafe<\n\tT extends Unenforced<RestrictiveReadonlyRecord<string, ImplicitFieldSchema>>,\n\tTypeName extends string = string,\n> = TreeNode & ObjectFromSchemaRecordUnsafe<T> & WithType<TypeName, NodeKind.Object>;\n\n/**\n * {@link Unenforced} version of {@link TreeFieldFromImplicitField}.\n * @remarks\n * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.\n * @public\n */\nexport type TreeFieldFromImplicitFieldUnsafe<TSchema extends Unenforced<ImplicitFieldSchema>> =\n\tTSchema extends FieldSchemaUnsafe<infer Kind, infer Types>\n\t\t? ApplyKind<TreeNodeFromImplicitAllowedTypesUnsafe<Types>, Kind, false>\n\t\t: TSchema extends ImplicitAllowedTypes\n\t\t\t? TreeNodeFromImplicitAllowedTypesUnsafe<TSchema>\n\t\t\t: unknown;\n\n/**\n * {@link Unenforced} version of {@link TreeNodeFromImplicitAllowedTypes}.\n * @remarks\n * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.\n * @public\n */\nexport type TreeNodeFromImplicitAllowedTypesUnsafe<\n\tTSchema extends Unenforced<ImplicitAllowedTypes>,\n> = TSchema extends ImplicitAllowedTypes\n\t? TreeNodeFromImplicitAllowedTypes<TSchema>\n\t: TSchema extends TreeNodeSchema\n\t\t? NodeFromSchema<TSchema>\n\t\t: TSchema extends AllowedTypes\n\t\t\t? NodeFromSchema<FlexListToUnion<TSchema>>\n\t\t\t: unknown;\n\n/**\n * {@link Unenforced} version of {@link InsertableTreeNodeFromImplicitAllowedTypes}.\n * @remarks\n * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.\n * @public\n */\nexport type InsertableTreeNodeFromImplicitAllowedTypesUnsafe<\n\tTSchema extends Unenforced<ImplicitAllowedTypes>,\n> = TSchema extends AllowedTypes\n\t? InsertableTypedNodeUnsafe<FlexListToUnion<TSchema>>\n\t: InsertableTypedNodeUnsafe<TSchema>;\n\n/**\n * {@link Unenforced} version of {@link InsertableTypedNode}.\n * @remarks\n * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.\n * @public\n */\nexport type InsertableTypedNodeUnsafe<T extends Unenforced<TreeNodeSchema>> = [\n\t| Unhydrated<NodeFromSchemaUnsafe<T>>\n\t| (T extends { implicitlyConstructable: true } ? NodeBuilderDataUnsafe<T> : never),\n][_InlineTrick];\n\n/**\n * {@link Unenforced} version of {@link NodeFromSchema}.\n * @remarks\n * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.\n * @public\n */\nexport type NodeFromSchemaUnsafe<T extends Unenforced<TreeNodeSchema>> =\n\tT extends TreeNodeSchema<string, NodeKind, infer TNode> ? TNode : never;\n\n/**\n * {@link Unenforced} version of {@link InsertableTreeNodeFromImplicitAllowedTypes}.\n * @remarks\n * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.\n * @public\n */\nexport type NodeBuilderDataUnsafe<T extends Unenforced<TreeNodeSchema>> =\n\tT extends TreeNodeSchema<string, NodeKind, unknown, infer TBuild> ? TBuild : never;\n\n/**\n * {@link Unenforced} version of {@link (TreeArrayNode:interface)}.\n * @remarks\n * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.\n * @sealed @public\n */\nexport interface TreeArrayNodeUnsafe<TAllowedTypes extends Unenforced<ImplicitAllowedTypes>>\n\textends TreeArrayNodeBase<\n\t\tTreeNodeFromImplicitAllowedTypesUnsafe<TAllowedTypes>,\n\t\tInsertableTreeNodeFromImplicitAllowedTypesUnsafe<TAllowedTypes>,\n\t\tTreeArrayNode\n\t> {}\n\n/**\n * {@link Unenforced} version of {@link TreeMapNode}.\n * @remarks\n * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.\n * @sealed @public\n */\nexport interface TreeMapNodeUnsafe<T extends Unenforced<ImplicitAllowedTypes>>\n\textends ReadonlyMapInlined<string, T>,\n\t\tTreeNode {\n\t/**\n\t * {@inheritdoc TreeMapNode.set}\n\t */\n\tset(\n\t\tkey: string,\n\t\tvalue: InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T> | undefined,\n\t): void;\n\n\t/**\n\t * {@inheritdoc TreeMapNode.delete}\n\t */\n\tdelete(key: string): void;\n}\n\n/**\n * Copy of TypeScript's ReadonlyMap, but with `TreeNodeFromImplicitAllowedTypesUnsafe<T>` inlined into it.\n * Using this instead of ReadonlyMap in TreeMapNodeUnsafe is necessary to make recursive map schema not generate compile errors in the d.ts files when exported.\n * @remarks\n * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.\n * @privateRemarks\n * This is the same as `ReadonlyMap<K, TreeNodeFromImplicitAllowedTypesUnsafe<T>>` (Checked in test),\n * except that it avoids the above mentioned compile error.\n * Authored by manually inlining ReadonlyMap from from the TypeScript lib which can be found by navigating to the definition of `ReadonlyMap`.\n * @system @sealed @public\n */\nexport interface ReadonlyMapInlined<K, T extends Unenforced<ImplicitAllowedTypes>> {\n\t/** Returns an iterable of entries in the map. */\n\t[Symbol.iterator](): IterableIterator<[K, TreeNodeFromImplicitAllowedTypesUnsafe<T>]>;\n\n\t/**\n\t * Returns an iterable of key, value pairs for every entry in the map.\n\t */\n\tentries(): IterableIterator<[K, TreeNodeFromImplicitAllowedTypesUnsafe<T>]>;\n\n\t/**\n\t * Returns an iterable of keys in the map\n\t */\n\tkeys(): IterableIterator<K>;\n\n\t/**\n\t * Returns an iterable of values in the map\n\t */\n\tvalues(): IterableIterator<TreeNodeFromImplicitAllowedTypesUnsafe<T>>;\n\n\tforEach(\n\t\tcallbackfn: (\n\t\t\tvalue: TreeNodeFromImplicitAllowedTypesUnsafe<T>,\n\t\t\tkey: K,\n\t\t\tmap: ReadonlyMap<K, TreeNodeFromImplicitAllowedTypesUnsafe<T>>,\n\t\t) => void,\n\t\tthisArg?: any,\n\t): void;\n\tget(key: K): TreeNodeFromImplicitAllowedTypesUnsafe<T> | undefined;\n\thas(key: K): boolean;\n\treadonly size: number;\n}\n\n/**\n * {@link Unenforced} version of `FieldHasDefault`.\n * @remarks\n * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.\n * @sealed @public\n */\nexport type FieldHasDefaultUnsafe<T extends Unenforced<ImplicitFieldSchema>> =\n\tT extends FieldSchemaUnsafe<\n\t\tFieldKind.Optional | FieldKind.Identifier,\n\t\tUnenforced<ImplicitAllowedTypes>\n\t>\n\t\t? true\n\t\t: false;\n\n/**\n * {@link Unenforced} version of `InsertableObjectFromSchemaRecord`.\n * @remarks\n * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.\n * @public\n */\nexport type InsertableObjectFromSchemaRecordUnsafe<\n\tT extends Unenforced<RestrictiveReadonlyRecord<string, ImplicitFieldSchema>>,\n> = {\n\t// Field might not have a default, so make it required:\n\treadonly [Property in keyof T as FieldHasDefaultUnsafe<T[Property]> extends false\n\t\t? Property\n\t\t: never]: InsertableTreeFieldFromImplicitFieldUnsafe<T[Property]>;\n} & {\n\t// Field might have a default, so allow optional.\n\t// Note that if the field could be either, this returns boolean, causing both fields to exist, resulting in required.\n\treadonly [Property in keyof T as FieldHasDefaultUnsafe<T[Property]> extends true\n\t\t? Property\n\t\t: never]?: InsertableTreeFieldFromImplicitFieldUnsafe<T[Property]>;\n};\n\n/**\n * {@link Unenforced} version of {@link InsertableTreeFieldFromImplicitField}.\n * @remarks\n * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.\n * @public\n */\nexport type InsertableTreeFieldFromImplicitFieldUnsafe<\n\tTSchema extends Unenforced<ImplicitFieldSchema>,\n> = TSchema extends FieldSchemaUnsafe<infer Kind, infer Types>\n\t? ApplyKind<InsertableTreeNodeFromImplicitAllowedTypesUnsafe<Types>, Kind, true>\n\t: InsertableTreeNodeFromImplicitAllowedTypesUnsafe<TSchema>;\n\n/**\n * {@link Unenforced} version of {@link FieldSchema}.\n * @remarks\n * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.\n * @public\n */\nexport interface FieldSchemaUnsafe<\n\tout Kind extends FieldKind,\n\tout Types extends Unenforced<ImplicitAllowedTypes>,\n> extends FieldSchema<Kind, any> {\n\t/**\n\t * {@inheritDoc FieldSchema.kind}\n\t */\n\treadonly kind: Kind;\n\t/**\n\t * {@inheritDoc FieldSchema.allowedTypes}\n\t */\n\treadonly allowedTypes: Types;\n\t/**\n\t * {@inheritDoc FieldSchema.allowedTypeSet}\n\t */\n\treadonly allowedTypeSet: ReadonlySet<TreeNodeSchema>;\n}\n\n/* eslint-enable @typescript-eslint/no-explicit-any */\n"]}
1
+ {"version":3,"file":"typesUnsafe.js","sourceRoot":"","sources":["../../src/simple-tree/typesUnsafe.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAuRH,sDAAsD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { FlexListToUnion, Unenforced } from \"../feature-libraries/index.js\";\nimport type { RestrictiveReadonlyRecord, _InlineTrick } from \"../util/index.js\";\n\nimport type {\n\tAllowedTypes,\n\tApplyKind,\n\tFieldKind,\n\tFieldSchema,\n\tImplicitAllowedTypes,\n\tImplicitFieldSchema,\n\tNodeFromSchema,\n\tTreeNodeFromImplicitAllowedTypes,\n} from \"./schemaTypes.js\";\nimport type {\n\tNodeKind,\n\tTreeNodeSchema,\n\tWithType,\n\tTreeNode,\n\tUnhydrated,\n} from \"./core/index.js\";\nimport type { TreeArrayNodeBase, TreeArrayNode } from \"./arrayNode.js\";\n\n/*\n * TODO:\n * Below are a bunch of \"unsafe\" versions of types from \"schemaTypes.ts\".\n * These types duplicate the ones in \"schemaTypes.ts\", except with some of the extends clauses unenforced.\n * This is not great for type safety or maintainability.\n * Eventually it would be great to do at least one of the following:\n * 1. Find a way to avoid needing these entirely, possibly by improving TSC's recursive type support.\n * 2. Deduplicate the safe and unsafe types (possibly by having the safe one call the unsafe ones, or some other trick).\n * 3. Add type tests that check that the two copies of these types produce identical results.\n */\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\n/**\n * {@link Unenforced} version of `ObjectFromSchemaRecord`.\n * @remarks\n * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.\n * @system @public\n */\nexport type ObjectFromSchemaRecordUnsafe<\n\tT extends Unenforced<RestrictiveReadonlyRecord<string, ImplicitFieldSchema>>,\n> = {\n\t-readonly [Property in keyof T]: TreeFieldFromImplicitFieldUnsafe<T[Property]>;\n};\n\n/**\n * {@link Unenforced} version of {@link TreeObjectNode}.\n * @remarks\n * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.\n * @system @public\n */\nexport type TreeObjectNodeUnsafe<\n\tT extends Unenforced<RestrictiveReadonlyRecord<string, ImplicitFieldSchema>>,\n\tTypeName extends string = string,\n> = TreeNode & ObjectFromSchemaRecordUnsafe<T> & WithType<TypeName, NodeKind.Object>;\n\n/**\n * {@link Unenforced} version of {@link TreeFieldFromImplicitField}.\n * @remarks\n * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.\n * @system @public\n */\nexport type TreeFieldFromImplicitFieldUnsafe<TSchema extends Unenforced<ImplicitFieldSchema>> =\n\tTSchema extends FieldSchemaUnsafe<infer Kind, infer Types>\n\t\t? ApplyKind<TreeNodeFromImplicitAllowedTypesUnsafe<Types>, Kind, false>\n\t\t: TSchema extends ImplicitAllowedTypes\n\t\t\t? TreeNodeFromImplicitAllowedTypesUnsafe<TSchema>\n\t\t\t: unknown;\n\n/**\n * {@link Unenforced} version of {@link TreeNodeFromImplicitAllowedTypes}.\n * @remarks\n * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.\n * @system @public\n */\nexport type TreeNodeFromImplicitAllowedTypesUnsafe<\n\tTSchema extends Unenforced<ImplicitAllowedTypes>,\n> = TSchema extends ImplicitAllowedTypes\n\t? TreeNodeFromImplicitAllowedTypes<TSchema>\n\t: TSchema extends TreeNodeSchema\n\t\t? NodeFromSchema<TSchema>\n\t\t: TSchema extends AllowedTypes\n\t\t\t? NodeFromSchema<FlexListToUnion<TSchema>>\n\t\t\t: unknown;\n\n/**\n * {@link Unenforced} version of {@link InsertableTreeNodeFromImplicitAllowedTypes}.\n * @remarks\n * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.\n * @system @public\n */\nexport type InsertableTreeNodeFromImplicitAllowedTypesUnsafe<\n\tTSchema extends Unenforced<ImplicitAllowedTypes>,\n> = TSchema extends AllowedTypes\n\t? InsertableTypedNodeUnsafe<FlexListToUnion<TSchema>>\n\t: InsertableTypedNodeUnsafe<TSchema>;\n\n/**\n * {@link Unenforced} version of {@link InsertableTypedNode}.\n * @remarks\n * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.\n * @system @public\n */\nexport type InsertableTypedNodeUnsafe<T extends Unenforced<TreeNodeSchema>> = [\n\t| Unhydrated<NodeFromSchemaUnsafe<T>>\n\t| (T extends { implicitlyConstructable: true } ? NodeBuilderDataUnsafe<T> : never),\n][_InlineTrick];\n\n/**\n * {@link Unenforced} version of {@link NodeFromSchema}.\n * @remarks\n * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.\n * @system @public\n */\nexport type NodeFromSchemaUnsafe<T extends Unenforced<TreeNodeSchema>> =\n\tT extends TreeNodeSchema<string, NodeKind, infer TNode> ? TNode : never;\n\n/**\n * {@link Unenforced} version of {@link InsertableTreeNodeFromImplicitAllowedTypes}.\n * @remarks\n * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.\n * @system @public\n */\nexport type NodeBuilderDataUnsafe<T extends Unenforced<TreeNodeSchema>> =\n\tT extends TreeNodeSchema<string, NodeKind, unknown, infer TBuild> ? TBuild : never;\n\n/**\n * {@link Unenforced} version of {@link (TreeArrayNode:interface)}.\n * @remarks\n * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.\n * @system @sealed @public\n */\nexport interface TreeArrayNodeUnsafe<TAllowedTypes extends Unenforced<ImplicitAllowedTypes>>\n\textends TreeArrayNodeBase<\n\t\tTreeNodeFromImplicitAllowedTypesUnsafe<TAllowedTypes>,\n\t\tInsertableTreeNodeFromImplicitAllowedTypesUnsafe<TAllowedTypes>,\n\t\tTreeArrayNode\n\t> {}\n\n/**\n * {@link Unenforced} version of {@link TreeMapNode}.\n * @remarks\n * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.\n * @system @sealed @public\n */\nexport interface TreeMapNodeUnsafe<T extends Unenforced<ImplicitAllowedTypes>>\n\textends ReadonlyMapInlined<string, T>,\n\t\tTreeNode {\n\t/**\n\t * {@inheritdoc TreeMapNode.set}\n\t */\n\tset(\n\t\tkey: string,\n\t\tvalue: InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T> | undefined,\n\t): void;\n\n\t/**\n\t * {@inheritdoc TreeMapNode.delete}\n\t */\n\tdelete(key: string): void;\n}\n\n/**\n * Copy of TypeScript's ReadonlyMap, but with `TreeNodeFromImplicitAllowedTypesUnsafe<T>` inlined into it.\n * Using this instead of ReadonlyMap in TreeMapNodeUnsafe is necessary to make recursive map schema not generate compile errors in the d.ts files when exported.\n * @remarks\n * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.\n * @privateRemarks\n * This is the same as `ReadonlyMap<K, TreeNodeFromImplicitAllowedTypesUnsafe<T>>` (Checked in test),\n * except that it avoids the above mentioned compile error.\n * Authored by manually inlining ReadonlyMap from from the TypeScript lib which can be found by navigating to the definition of `ReadonlyMap`.\n * @system @sealed @public\n */\nexport interface ReadonlyMapInlined<K, T extends Unenforced<ImplicitAllowedTypes>> {\n\t/** Returns an iterable of entries in the map. */\n\t[Symbol.iterator](): IterableIterator<[K, TreeNodeFromImplicitAllowedTypesUnsafe<T>]>;\n\n\t/**\n\t * Returns an iterable of key, value pairs for every entry in the map.\n\t */\n\tentries(): IterableIterator<[K, TreeNodeFromImplicitAllowedTypesUnsafe<T>]>;\n\n\t/**\n\t * Returns an iterable of keys in the map\n\t */\n\tkeys(): IterableIterator<K>;\n\n\t/**\n\t * Returns an iterable of values in the map\n\t */\n\tvalues(): IterableIterator<TreeNodeFromImplicitAllowedTypesUnsafe<T>>;\n\n\tforEach(\n\t\tcallbackfn: (\n\t\t\tvalue: TreeNodeFromImplicitAllowedTypesUnsafe<T>,\n\t\t\tkey: K,\n\t\t\tmap: ReadonlyMap<K, TreeNodeFromImplicitAllowedTypesUnsafe<T>>,\n\t\t) => void,\n\t\tthisArg?: any,\n\t): void;\n\tget(key: K): TreeNodeFromImplicitAllowedTypesUnsafe<T> | undefined;\n\thas(key: K): boolean;\n\treadonly size: number;\n}\n\n/**\n * {@link Unenforced} version of `FieldHasDefault`.\n * @remarks\n * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.\n * @system @sealed @public\n */\nexport type FieldHasDefaultUnsafe<T extends Unenforced<ImplicitFieldSchema>> =\n\tT extends FieldSchemaUnsafe<\n\t\tFieldKind.Optional | FieldKind.Identifier,\n\t\tUnenforced<ImplicitAllowedTypes>\n\t>\n\t\t? true\n\t\t: false;\n\n/**\n * {@link Unenforced} version of `InsertableObjectFromSchemaRecord`.\n * @remarks\n * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.\n * @system @public\n */\nexport type InsertableObjectFromSchemaRecordUnsafe<\n\tT extends Unenforced<RestrictiveReadonlyRecord<string, ImplicitFieldSchema>>,\n> = {\n\t// Field might not have a default, so make it required:\n\treadonly [Property in keyof T as FieldHasDefaultUnsafe<T[Property]> extends false\n\t\t? Property\n\t\t: never]: InsertableTreeFieldFromImplicitFieldUnsafe<T[Property]>;\n} & {\n\t// Field might have a default, so allow optional.\n\t// Note that if the field could be either, this returns boolean, causing both fields to exist, resulting in required.\n\treadonly [Property in keyof T as FieldHasDefaultUnsafe<T[Property]> extends true\n\t\t? Property\n\t\t: never]?: InsertableTreeFieldFromImplicitFieldUnsafe<T[Property]>;\n};\n\n/**\n * {@link Unenforced} version of {@link InsertableTreeFieldFromImplicitField}.\n * @remarks\n * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.\n * @system @public\n */\nexport type InsertableTreeFieldFromImplicitFieldUnsafe<\n\tTSchema extends Unenforced<ImplicitFieldSchema>,\n> = TSchema extends FieldSchemaUnsafe<infer Kind, infer Types>\n\t? ApplyKind<InsertableTreeNodeFromImplicitAllowedTypesUnsafe<Types>, Kind, true>\n\t: InsertableTreeNodeFromImplicitAllowedTypesUnsafe<TSchema>;\n\n/**\n * {@link Unenforced} version of {@link FieldSchema}.\n * @remarks\n * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.\n * @public\n */\nexport interface FieldSchemaUnsafe<\n\tout Kind extends FieldKind,\n\tout Types extends Unenforced<ImplicitAllowedTypes>,\n> extends FieldSchema<Kind, any> {\n\t/**\n\t * {@inheritDoc FieldSchema.kind}\n\t */\n\treadonly kind: Kind;\n\t/**\n\t * {@inheritDoc FieldSchema.allowedTypes}\n\t */\n\treadonly allowedTypes: Types;\n\t/**\n\t * {@inheritDoc FieldSchema.allowedTypeSet}\n\t */\n\treadonly allowedTypeSet: ReadonlySet<TreeNodeSchema>;\n}\n\n/* eslint-enable @typescript-eslint/no-explicit-any */\n"]}
@@ -0,0 +1,26 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { type TreeNodeSchema } from "./core/index.js";
6
+ import { type ImplicitFieldSchema } from "./schemaTypes.js";
7
+ export declare function walkNodeSchema(schema: TreeNodeSchema, visitor: SchemaVisitor, visitedSet: Set<TreeNodeSchema>): void;
8
+ export declare function walkFieldSchema(schema: ImplicitFieldSchema, visitor: SchemaVisitor, visitedSet?: Set<TreeNodeSchema>): void;
9
+ export declare function walkAllowedTypes(allowedTypes: Iterable<TreeNodeSchema>, visitor: SchemaVisitor, visitedSet: Set<TreeNodeSchema>): void;
10
+ /**
11
+ * Callbacks for use in {@link walkFieldSchema} / {@link walkAllowedTypes} / {@link walkNodeSchema}.
12
+ */
13
+ export interface SchemaVisitor {
14
+ /**
15
+ * Called once for each node schema.
16
+ */
17
+ node?: (schema: TreeNodeSchema) => void;
18
+ /**
19
+ * Called once for each set of allowed types.
20
+ * Includes implicit allowed types (when a single type was used instead of an array).
21
+ *
22
+ * This includes every field, but also the allowed types array for maps and arrays and the root if starting at {@link walkAllowedTypes}.
23
+ */
24
+ allowedTypes?: (allowedTypes: Iterable<TreeNodeSchema>) => void;
25
+ }
26
+ //# sourceMappingURL=walkSchema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"walkSchema.d.ts","sourceRoot":"","sources":["../../src/simple-tree/walkSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,KAAK,cAAc,EAAY,MAAM,iBAAiB,CAAC;AAGhE,OAAO,EAGN,KAAK,mBAAmB,EAExB,MAAM,kBAAkB,CAAC;AAE1B,wBAAgB,cAAc,CAC7B,MAAM,EAAE,cAAc,EACtB,OAAO,EAAE,aAAa,EACtB,UAAU,EAAE,GAAG,CAAC,cAAc,CAAC,GAC7B,IAAI,CAwBN;AAED,wBAAgB,eAAe,CAC9B,MAAM,EAAE,mBAAmB,EAC3B,OAAO,EAAE,aAAa,EACtB,UAAU,GAAE,GAAG,CAAC,cAAc,CAAa,GACzC,IAAI,CAEN;AAED,wBAAgB,gBAAgB,CAC/B,YAAY,EAAE,QAAQ,CAAC,cAAc,CAAC,EACtC,OAAO,EAAE,aAAa,EACtB,UAAU,EAAE,GAAG,CAAC,cAAc,CAAC,GAC7B,IAAI,CAKN;AACD;;GAEG;AAEH,MAAM,WAAW,aAAa;IAC7B;;OAEG;IACH,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,cAAc,KAAK,IAAI,CAAC;IACxC;;;;;OAKG;IACH,YAAY,CAAC,EAAE,CAAC,YAAY,EAAE,QAAQ,CAAC,cAAc,CAAC,KAAK,IAAI,CAAC;CAChE"}
@@ -0,0 +1,43 @@
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 { NodeKind } from "./core/index.js";
7
+ import { LeafNodeSchema } from "./leafNodeSchema.js";
8
+ import { isObjectNodeSchema } from "./objectNodeTypes.js";
9
+ import { normalizeAllowedTypes, normalizeFieldSchema, } from "./schemaTypes.js";
10
+ export function walkNodeSchema(schema, visitor, visitedSet) {
11
+ if (visitedSet.has(schema)) {
12
+ return;
13
+ }
14
+ visitedSet.add(schema);
15
+ if (schema instanceof LeafNodeSchema) {
16
+ // nothing to do
17
+ }
18
+ else if (isObjectNodeSchema(schema)) {
19
+ for (const field of schema.fields.values()) {
20
+ walkFieldSchema(field, visitor, visitedSet);
21
+ }
22
+ }
23
+ else {
24
+ assert(schema.kind === NodeKind.Array || schema.kind === NodeKind.Map, 0x9b3 /* invalid schema */);
25
+ const childTypes = schema.info;
26
+ walkAllowedTypes(normalizeAllowedTypes(childTypes), visitor, visitedSet);
27
+ }
28
+ // This visit is done at the end so the traversal order is most inner types first.
29
+ // This was picked since when fixing errors,
30
+ // working from the inner types out to the types that use them will probably go better than the reverse.
31
+ // This does not however ensure all types referenced by a type are visited before it, since in recursive cases thats impossible.
32
+ visitor.node?.(schema);
33
+ }
34
+ export function walkFieldSchema(schema, visitor, visitedSet = new Set()) {
35
+ walkAllowedTypes(normalizeFieldSchema(schema).allowedTypeSet, visitor, visitedSet);
36
+ }
37
+ export function walkAllowedTypes(allowedTypes, visitor, visitedSet) {
38
+ for (const childType of allowedTypes) {
39
+ walkNodeSchema(childType, visitor, visitedSet);
40
+ }
41
+ visitor.allowedTypes?.(allowedTypes);
42
+ }
43
+ //# sourceMappingURL=walkSchema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"walkSchema.js","sourceRoot":"","sources":["../../src/simple-tree/walkSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAC7D,OAAO,EAAuB,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAEN,qBAAqB,EAErB,oBAAoB,GACpB,MAAM,kBAAkB,CAAC;AAE1B,MAAM,UAAU,cAAc,CAC7B,MAAsB,EACtB,OAAsB,EACtB,UAA+B;IAE/B,IAAI,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC;QAC5B,OAAO;IACR,CAAC;IACD,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACvB,IAAI,MAAM,YAAY,cAAc,EAAE,CAAC;QACtC,gBAAgB;IACjB,CAAC;SAAM,IAAI,kBAAkB,CAAC,MAAM,CAAC,EAAE,CAAC;QACvC,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC;YAC5C,eAAe,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;QAC7C,CAAC;IACF,CAAC;SAAM,CAAC;QACP,MAAM,CACL,MAAM,CAAC,IAAI,KAAK,QAAQ,CAAC,KAAK,IAAI,MAAM,CAAC,IAAI,KAAK,QAAQ,CAAC,GAAG,EAC9D,KAAK,CAAC,oBAAoB,CAC1B,CAAC;QACF,MAAM,UAAU,GAAG,MAAM,CAAC,IAA4B,CAAC;QACvD,gBAAgB,CAAC,qBAAqB,CAAC,UAAU,CAAC,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;IAC1E,CAAC;IACD,kFAAkF;IAClF,4CAA4C;IAC5C,wGAAwG;IACxG,gIAAgI;IAChI,OAAO,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,CAAC;AACxB,CAAC;AAED,MAAM,UAAU,eAAe,CAC9B,MAA2B,EAC3B,OAAsB,EACtB,aAAkC,IAAI,GAAG,EAAE;IAE3C,gBAAgB,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,cAAc,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;AACpF,CAAC;AAED,MAAM,UAAU,gBAAgB,CAC/B,YAAsC,EACtC,OAAsB,EACtB,UAA+B;IAE/B,KAAK,MAAM,SAAS,IAAI,YAAY,EAAE,CAAC;QACtC,cAAc,CAAC,SAAS,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;IAChD,CAAC;IACD,OAAO,CAAC,YAAY,EAAE,CAAC,YAAY,CAAC,CAAC;AACtC,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\";\nimport { type TreeNodeSchema, NodeKind } from \"./core/index.js\";\nimport { LeafNodeSchema } from \"./leafNodeSchema.js\";\nimport { isObjectNodeSchema } from \"./objectNodeTypes.js\";\nimport {\n\ttype ImplicitAllowedTypes,\n\tnormalizeAllowedTypes,\n\ttype ImplicitFieldSchema,\n\tnormalizeFieldSchema,\n} from \"./schemaTypes.js\";\n\nexport function walkNodeSchema(\n\tschema: TreeNodeSchema,\n\tvisitor: SchemaVisitor,\n\tvisitedSet: Set<TreeNodeSchema>,\n): void {\n\tif (visitedSet.has(schema)) {\n\t\treturn;\n\t}\n\tvisitedSet.add(schema);\n\tif (schema instanceof LeafNodeSchema) {\n\t\t// nothing to do\n\t} else if (isObjectNodeSchema(schema)) {\n\t\tfor (const field of schema.fields.values()) {\n\t\t\twalkFieldSchema(field, visitor, visitedSet);\n\t\t}\n\t} else {\n\t\tassert(\n\t\t\tschema.kind === NodeKind.Array || schema.kind === NodeKind.Map,\n\t\t\t0x9b3 /* invalid schema */,\n\t\t);\n\t\tconst childTypes = schema.info as ImplicitAllowedTypes;\n\t\twalkAllowedTypes(normalizeAllowedTypes(childTypes), visitor, visitedSet);\n\t}\n\t// This visit is done at the end so the traversal order is most inner types first.\n\t// This was picked since when fixing errors,\n\t// working from the inner types out to the types that use them will probably go better than the reverse.\n\t// This does not however ensure all types referenced by a type are visited before it, since in recursive cases thats impossible.\n\tvisitor.node?.(schema);\n}\n\nexport function walkFieldSchema(\n\tschema: ImplicitFieldSchema,\n\tvisitor: SchemaVisitor,\n\tvisitedSet: Set<TreeNodeSchema> = new Set(),\n): void {\n\twalkAllowedTypes(normalizeFieldSchema(schema).allowedTypeSet, visitor, visitedSet);\n}\n\nexport function walkAllowedTypes(\n\tallowedTypes: Iterable<TreeNodeSchema>,\n\tvisitor: SchemaVisitor,\n\tvisitedSet: Set<TreeNodeSchema>,\n): void {\n\tfor (const childType of allowedTypes) {\n\t\twalkNodeSchema(childType, visitor, visitedSet);\n\t}\n\tvisitor.allowedTypes?.(allowedTypes);\n}\n/**\n * Callbacks for use in {@link walkFieldSchema} / {@link walkAllowedTypes} / {@link walkNodeSchema}.\n */\n\nexport interface SchemaVisitor {\n\t/**\n\t * Called once for each node schema.\n\t */\n\tnode?: (schema: TreeNodeSchema) => void;\n\t/**\n\t * Called once for each set of allowed types.\n\t * Includes implicit allowed types (when a single type was used instead of an array).\n\t *\n\t * This includes every field, but also the allowed types array for maps and arrays and the root if starting at {@link walkAllowedTypes}.\n\t */\n\tallowedTypes?: (allowedTypes: Iterable<TreeNodeSchema>) => void;\n}\n"]}
@@ -23,7 +23,8 @@ export declare class TreeFactory implements IChannelFactory<ITree> {
23
23
  /**
24
24
  * SharedTree is a hierarchical data structure for collaboratively editing strongly typed JSON-like trees
25
25
  * of objects, arrays, and other data types.
26
- * @internal
26
+ * @legacy
27
+ * @alpha
27
28
  */
28
29
  export declare const SharedTree: ISharedObjectKind<ITree> & SharedObjectKind<ITree>;
29
30
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"treeFactory.d.ts","sourceRoot":"","sources":["../src/treeFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,kBAAkB,EAClB,eAAe,EACf,sBAAsB,EACtB,gBAAgB,EAChB,MAAM,gDAAgD,CAAC;AACxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EACN,KAAK,iBAAiB,EAEtB,MAAM,6CAA6C,CAAC;AAGrD,OAAO,EAAE,UAAU,IAAI,cAAc,EAAE,KAAK,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC9F,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAEpD;;GAEG;AACH,qBAAa,WAAY,YAAW,eAAe,CAAC,KAAK,CAAC;IAWtC,OAAO,CAAC,QAAQ,CAAC,OAAO;IAV3C,gBAAuB,IAAI,4CAA4C;IACvE,gBAAuB,UAAU,EAAE,kBAAkB,CAInD;IAEF,SAAgB,IAAI,4CAAoB;IACxC,SAAgB,UAAU,EAAE,kBAAkB,CAA0B;gBAEpC,OAAO,EAAE,iBAAiB;IAEjD,IAAI,CAChB,OAAO,EAAE,sBAAsB,EAC/B,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,gBAAgB,EAC1B,iBAAiB,EAAE,QAAQ,CAAC,kBAAkB,CAAC,GAC7C,OAAO,CAAC,cAAc,CAAC;IAMnB,MAAM,CAAC,OAAO,EAAE,sBAAsB,EAAE,EAAE,EAAE,MAAM,GAAG,cAAc;CAK1E;AAED;;;;GAIG;AACH,eAAO,MAAM,UAAU,oDAA2B,CAAC;AAEnD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,oBAAoB,CACnC,OAAO,EAAE,iBAAiB,GACxB,iBAAiB,CAAC,KAAK,CAAC,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAOpD"}
1
+ {"version":3,"file":"treeFactory.d.ts","sourceRoot":"","sources":["../src/treeFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,kBAAkB,EAClB,eAAe,EACf,sBAAsB,EACtB,gBAAgB,EAChB,MAAM,gDAAgD,CAAC;AACxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EACN,KAAK,iBAAiB,EAEtB,MAAM,6CAA6C,CAAC;AAGrD,OAAO,EAAE,UAAU,IAAI,cAAc,EAAE,KAAK,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC9F,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAEpD;;GAEG;AACH,qBAAa,WAAY,YAAW,eAAe,CAAC,KAAK,CAAC;IAWtC,OAAO,CAAC,QAAQ,CAAC,OAAO;IAV3C,gBAAuB,IAAI,4CAA4C;IACvE,gBAAuB,UAAU,EAAE,kBAAkB,CAInD;IAEF,SAAgB,IAAI,4CAAoB;IACxC,SAAgB,UAAU,EAAE,kBAAkB,CAA0B;gBAEpC,OAAO,EAAE,iBAAiB;IAEjD,IAAI,CAChB,OAAO,EAAE,sBAAsB,EAC/B,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,gBAAgB,EAC1B,iBAAiB,EAAE,QAAQ,CAAC,kBAAkB,CAAC,GAC7C,OAAO,CAAC,cAAc,CAAC;IAMnB,MAAM,CAAC,OAAO,EAAE,sBAAsB,EAAE,EAAE,EAAE,MAAM,GAAG,cAAc;CAK1E;AAED;;;;;GAKG;AACH,eAAO,MAAM,UAAU,oDAA2B,CAAC;AAEnD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,oBAAoB,CACnC,OAAO,EAAE,iBAAiB,GACxB,iBAAiB,CAAC,KAAK,CAAC,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAOpD"}
@@ -36,7 +36,8 @@ TreeFactory.attributes = {
36
36
  /**
37
37
  * SharedTree is a hierarchical data structure for collaboratively editing strongly typed JSON-like trees
38
38
  * of objects, arrays, and other data types.
39
- * @internal
39
+ * @legacy
40
+ * @alpha
40
41
  */
41
42
  export const SharedTree = configuredSharedTree({});
42
43
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"treeFactory.js","sourceRoot":"","sources":["../src/treeFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AASH,OAAO,EAEN,sBAAsB,GACtB,MAAM,6CAA6C,CAAC;AAErD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,UAAU,IAAI,cAAc,EAA0B,MAAM,wBAAwB,CAAC;AAG9F;;GAEG;AACH,MAAM,OAAO,WAAW;IAWvB,YAAoC,OAA0B;QAA1B,YAAO,GAAP,OAAO,CAAmB;QAH9C,SAAI,GAAG,EAAW,CAAC,IAAI,CAAC;QACxB,eAAU,GAAuB,EAAW,CAAC,UAAU,CAAC;IAEP,CAAC;IAE3D,KAAK,CAAC,IAAI,CAChB,OAA+B,EAC/B,EAAU,EACV,QAA0B,EAC1B,iBAA+C;QAE/C,MAAM,IAAI,GAAG,IAAI,cAAc,CAAC,EAAE,EAAE,OAAO,EAAE,iBAAiB,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAC9E,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC1B,OAAO,IAAI,CAAC;IACb,CAAC;IAEM,MAAM,CAAC,OAA+B,EAAE,EAAU;QACxD,MAAM,IAAI,GAAG,IAAI,cAAc,CAAC,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAC5E,IAAI,CAAC,eAAe,EAAE,CAAC;QACvB,OAAO,IAAI,CAAC;IACb,CAAC;;;AA3BsB,gBAAI,GAAG,wCAAwC,AAA3C,CAA4C;AAChD,sBAAU,GAAuB;IACvD,IAAI,EAAE,EAAI,CAAC,IAAI;IACf,qBAAqB,EAAE,OAAO;IAC9B,cAAc,EAAE,UAAU;CAC1B,AAJgC,CAI/B;AAyBH;;;;GAIG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,oBAAoB,CAAC,EAAE,CAAC,CAAC;AAEnD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,oBAAoB,CACnC,OAA0B;IAE1B,MAAM,iBAAkB,SAAQ,WAAW;QAC1C;YACC,KAAK,CAAC,OAAO,CAAC,CAAC;QAChB,CAAC;KACD;IACD,OAAO,sBAAsB,CAAQ,iBAAiB,CAAC,CAAC;AACzD,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tIChannelAttributes,\n\tIChannelFactory,\n\tIFluidDataStoreRuntime,\n\tIChannelServices,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport type { SharedObjectKind } from \"@fluidframework/shared-object-base\";\nimport {\n\ttype ISharedObjectKind,\n\tcreateSharedObjectKind,\n} from \"@fluidframework/shared-object-base/internal\";\n\nimport { pkgVersion } from \"./packageVersion.js\";\nimport { SharedTree as SharedTreeImpl, type SharedTreeOptions } from \"./shared-tree/index.js\";\nimport type { ITree } from \"./simple-tree/index.js\";\n\n/**\n * A channel factory that creates an {@link ITree}.\n */\nexport class TreeFactory implements IChannelFactory<ITree> {\n\tpublic static readonly Type = \"https://graph.microsoft.com/types/tree\";\n\tpublic static readonly attributes: IChannelAttributes = {\n\t\ttype: this.Type,\n\t\tsnapshotFormatVersion: \"0.0.0\",\n\t\tpackageVersion: pkgVersion,\n\t};\n\n\tpublic readonly type = TreeFactory.Type;\n\tpublic readonly attributes: IChannelAttributes = TreeFactory.attributes;\n\n\tpublic constructor(private readonly options: SharedTreeOptions) {}\n\n\tpublic async load(\n\t\truntime: IFluidDataStoreRuntime,\n\t\tid: string,\n\t\tservices: IChannelServices,\n\t\tchannelAttributes: Readonly<IChannelAttributes>,\n\t): Promise<SharedTreeImpl> {\n\t\tconst tree = new SharedTreeImpl(id, runtime, channelAttributes, this.options);\n\t\tawait tree.load(services);\n\t\treturn tree;\n\t}\n\n\tpublic create(runtime: IFluidDataStoreRuntime, id: string): SharedTreeImpl {\n\t\tconst tree = new SharedTreeImpl(id, runtime, this.attributes, this.options);\n\t\ttree.initializeLocal();\n\t\treturn tree;\n\t}\n}\n\n/**\n * SharedTree is a hierarchical data structure for collaboratively editing strongly typed JSON-like trees\n * of objects, arrays, and other data types.\n * @internal\n */\nexport const SharedTree = configuredSharedTree({});\n\n/**\n * {@link SharedTree} but allowing a non-default configuration.\n * @remarks\n * This is useful for debugging and testing to opt into extra validation or see if opting out of some optimizations fixes an issue.\n * @example\n * ```typescript\n * import {\n * \tForestType,\n * \tTreeCompressionStrategy,\n * \tconfiguredSharedTree,\n * \ttypeboxValidator,\n * \t// eslint-disable-next-line import/no-internal-modules\n * } from \"@fluidframework/tree/internal\";\n * const SharedTree = configuredSharedTree({\n * \tforest: ForestType.Reference,\n * \tjsonValidator: typeboxValidator,\n * \ttreeEncodeType: TreeCompressionStrategy.Uncompressed,\n * });\n * ```\n * @privateRemarks\n * TODO:\n * Expose Ajv validator for better error message quality somehow.\n * Maybe as part of a test utils or dev-tool package?\n * @internal\n */\nexport function configuredSharedTree(\n\toptions: SharedTreeOptions,\n): ISharedObjectKind<ITree> & SharedObjectKind<ITree> {\n\tclass ConfiguredFactory extends TreeFactory {\n\t\tpublic constructor() {\n\t\t\tsuper(options);\n\t\t}\n\t}\n\treturn createSharedObjectKind<ITree>(ConfiguredFactory);\n}\n"]}
1
+ {"version":3,"file":"treeFactory.js","sourceRoot":"","sources":["../src/treeFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AASH,OAAO,EAEN,sBAAsB,GACtB,MAAM,6CAA6C,CAAC;AAErD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,UAAU,IAAI,cAAc,EAA0B,MAAM,wBAAwB,CAAC;AAG9F;;GAEG;AACH,MAAM,OAAO,WAAW;IAWvB,YAAoC,OAA0B;QAA1B,YAAO,GAAP,OAAO,CAAmB;QAH9C,SAAI,GAAG,EAAW,CAAC,IAAI,CAAC;QACxB,eAAU,GAAuB,EAAW,CAAC,UAAU,CAAC;IAEP,CAAC;IAE3D,KAAK,CAAC,IAAI,CAChB,OAA+B,EAC/B,EAAU,EACV,QAA0B,EAC1B,iBAA+C;QAE/C,MAAM,IAAI,GAAG,IAAI,cAAc,CAAC,EAAE,EAAE,OAAO,EAAE,iBAAiB,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAC9E,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC1B,OAAO,IAAI,CAAC;IACb,CAAC;IAEM,MAAM,CAAC,OAA+B,EAAE,EAAU;QACxD,MAAM,IAAI,GAAG,IAAI,cAAc,CAAC,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAC5E,IAAI,CAAC,eAAe,EAAE,CAAC;QACvB,OAAO,IAAI,CAAC;IACb,CAAC;;;AA3BsB,gBAAI,GAAG,wCAAwC,AAA3C,CAA4C;AAChD,sBAAU,GAAuB;IACvD,IAAI,EAAE,EAAI,CAAC,IAAI;IACf,qBAAqB,EAAE,OAAO;IAC9B,cAAc,EAAE,UAAU;CAC1B,AAJgC,CAI/B;AAyBH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,oBAAoB,CAAC,EAAE,CAAC,CAAC;AAEnD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,oBAAoB,CACnC,OAA0B;IAE1B,MAAM,iBAAkB,SAAQ,WAAW;QAC1C;YACC,KAAK,CAAC,OAAO,CAAC,CAAC;QAChB,CAAC;KACD;IACD,OAAO,sBAAsB,CAAQ,iBAAiB,CAAC,CAAC;AACzD,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tIChannelAttributes,\n\tIChannelFactory,\n\tIFluidDataStoreRuntime,\n\tIChannelServices,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport type { SharedObjectKind } from \"@fluidframework/shared-object-base\";\nimport {\n\ttype ISharedObjectKind,\n\tcreateSharedObjectKind,\n} from \"@fluidframework/shared-object-base/internal\";\n\nimport { pkgVersion } from \"./packageVersion.js\";\nimport { SharedTree as SharedTreeImpl, type SharedTreeOptions } from \"./shared-tree/index.js\";\nimport type { ITree } from \"./simple-tree/index.js\";\n\n/**\n * A channel factory that creates an {@link ITree}.\n */\nexport class TreeFactory implements IChannelFactory<ITree> {\n\tpublic static readonly Type = \"https://graph.microsoft.com/types/tree\";\n\tpublic static readonly attributes: IChannelAttributes = {\n\t\ttype: this.Type,\n\t\tsnapshotFormatVersion: \"0.0.0\",\n\t\tpackageVersion: pkgVersion,\n\t};\n\n\tpublic readonly type = TreeFactory.Type;\n\tpublic readonly attributes: IChannelAttributes = TreeFactory.attributes;\n\n\tpublic constructor(private readonly options: SharedTreeOptions) {}\n\n\tpublic async load(\n\t\truntime: IFluidDataStoreRuntime,\n\t\tid: string,\n\t\tservices: IChannelServices,\n\t\tchannelAttributes: Readonly<IChannelAttributes>,\n\t): Promise<SharedTreeImpl> {\n\t\tconst tree = new SharedTreeImpl(id, runtime, channelAttributes, this.options);\n\t\tawait tree.load(services);\n\t\treturn tree;\n\t}\n\n\tpublic create(runtime: IFluidDataStoreRuntime, id: string): SharedTreeImpl {\n\t\tconst tree = new SharedTreeImpl(id, runtime, this.attributes, this.options);\n\t\ttree.initializeLocal();\n\t\treturn tree;\n\t}\n}\n\n/**\n * SharedTree is a hierarchical data structure for collaboratively editing strongly typed JSON-like trees\n * of objects, arrays, and other data types.\n * @legacy\n * @alpha\n */\nexport const SharedTree = configuredSharedTree({});\n\n/**\n * {@link SharedTree} but allowing a non-default configuration.\n * @remarks\n * This is useful for debugging and testing to opt into extra validation or see if opting out of some optimizations fixes an issue.\n * @example\n * ```typescript\n * import {\n * \tForestType,\n * \tTreeCompressionStrategy,\n * \tconfiguredSharedTree,\n * \ttypeboxValidator,\n * \t// eslint-disable-next-line import/no-internal-modules\n * } from \"@fluidframework/tree/internal\";\n * const SharedTree = configuredSharedTree({\n * \tforest: ForestType.Reference,\n * \tjsonValidator: typeboxValidator,\n * \ttreeEncodeType: TreeCompressionStrategy.Uncompressed,\n * });\n * ```\n * @privateRemarks\n * TODO:\n * Expose Ajv validator for better error message quality somehow.\n * Maybe as part of a test utils or dev-tool package?\n * @internal\n */\nexport function configuredSharedTree(\n\toptions: SharedTreeOptions,\n): ISharedObjectKind<ITree> & SharedObjectKind<ITree> {\n\tclass ConfiguredFactory extends TreeFactory {\n\t\tpublic constructor() {\n\t\t\tsuper(options);\n\t\t}\n\t}\n\treturn createSharedObjectKind<ITree>(ConfiguredFactory);\n}\n"]}
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.45.1"
8
+ "packageVersion": "7.47.8"
9
9
  }
10
10
  ]
11
11
  }
@@ -8,7 +8,7 @@
8
8
  /**
9
9
  * Return a type thats equivalent to the input, but with different IntelliSense.
10
10
  * This tends to convert unions and intersections into objects.
11
- * @public
11
+ * @system @public
12
12
  */
13
13
  export type FlattenKeys<T> = [{
14
14
  [Property in keyof T]: T[Property];
@@ -71,7 +71,7 @@ export type AllowOptional<T> = [
71
71
  *
72
72
  * This constant is defined to provide a way to find this documentation from types which use this pattern,
73
73
  * and to locate types which use this pattern in case they need updating for compiler changes.
74
- * @public
74
+ * @system @public
75
75
  */
76
76
  export type _InlineTrick = 0;
77
77
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"typeUtils.js","sourceRoot":"","sources":["../../src/util/typeUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA4HH,wIAAwI;AACxI,CAAC;IAwBA,qDAAqD;AACtD,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Utilities for manipulating types.\n */\n\n/**\n * Return a type thats equivalent to the input, but with different IntelliSense.\n * This tends to convert unions and intersections into objects.\n * @public\n */\nexport type FlattenKeys<T> = [{ [Property in keyof T]: T[Property] }][_InlineTrick];\n\n/**\n * Remove all fields which permit undefined from `T`.\n */\nexport type RequiredFields<T> = [\n\t{\n\t\t[P in keyof T as undefined extends T[P] ? never : P]: T[P];\n\t},\n][_InlineTrick];\n\n/**\n * Extract fields which permit undefined but can also hold other types.\n */\nexport type OptionalFields<T> = [\n\t{\n\t\t[P in keyof T as undefined extends T[P]\n\t\t\t? T[P] extends undefined\n\t\t\t\t? never\n\t\t\t\t: P\n\t\t\t: never]?: T[P];\n\t},\n][_InlineTrick];\n\n/**\n * Converts properties of an object which permit undefined into optional properties.\n * Removes fields which only allow undefined.\n *\n * @remarks\n * This version does not flatten the resulting type.\n * This version exists because some cases recursive types need to avoid this\n * flattening since it causes complication issues.\n *\n * See also `AllowOptional`.\n */\n// export type AllowOptionalNotFlattened<T> = [RequiredFields<T> & OptionalFields<T>][_InlineTrick];\nexport type AllowOptionalNotFlattened<T> = [\n\tRequiredFields<T> & OptionalFields<T>,\n][_InlineTrick];\n\n/**\n * Converts properties of an object which permit undefined into optional properties.\n * Removes fields which only allow undefined.\n */\nexport type AllowOptional<T> = [\n\tFlattenKeys<RequiredFields<T> & OptionalFields<T>>,\n][_InlineTrick];\n\n/**\n * Use for trick to \"inline\" generic types.\n *\n * @remarks\n * The TypeScript compiler can be convinced to inline a generic type\n * (so the result of evaluating the generic type show up in IntelliSense and error messages instead of just the invocation of the generic type)\n * by creating an object with a field, and returning the type of that field.\n *\n * For example:\n * ```typescript\n * type MyGeneric<T1, T2> = {x: T1 extends [] ? T1 : T2 };\n * type MyGenericExpanded<T1, T2> = [{x: T1 extends [] ? T1 : T2 }][_InlineTrick]\n *\n * // Type is MyGeneric<5, string>\n * const foo: MyGeneric<5, string> = {x: \"x\"}\n * // Type is {x: \"x\"}\n * const foo2: MyGenericExpanded<5, string> = {x: \"x\"}\n * ```\n *\n * This constant is defined to provide a way to find this documentation from types which use this pattern,\n * and to locate types which use this pattern in case they need updating for compiler changes.\n * @public\n */\nexport type _InlineTrick = 0;\n\n/**\n * Use for trick to prevent self reference error `ts(2456)`.\n *\n * Prefix a type expression with `K extends _RecursiveTrick ? _RecursiveTrick : ` for some K to break the cycle.\n *\n * @remarks\n * The TypeScript compiler handles some cases of recursive types, but not others.\n * Sometimes adding an otherwise needless conditional can make a type compile.\n * Use this type in such cases.\n *\n *For example:\n * ```typescript\n * // The TypeScript compiler can't handle this case\n * type Broken<T> = FlattenKeys<\n *\t{\n * \t\t[K in keyof T]: 0;\n * \t} & {\n * \t\t[K in keyof T]: Broken<T[K]>;\n * \t}\n * >;\n *\n * // Adding `K extends _RecursiveTrick ? _RecursiveTrick :` makes it compile, and has no effect on the type produced.\n * type Works<T> = FlattenKeys<\n * \t{\n * \t\t[K in keyof T]: 0;\n * \t} & {\n * \t\t// Trick added here. Since `k` never extends `never`, the second conditional option is always taken,\n * \t\t// making this equivalent to the broken version, except this one compiles.\n * \t\t[K in keyof T]: K extends _RecursiveTrick ? _RecursiveTrick : Works<T[K]>;\n * \t}\n * >;\n * ```\n *\n * This trick appears to start working in TypeScript 4.1 and is confirmed to still work in 5.0.4.\n *\n * This constant is defined to provide a way to find this documentation from types which use this pattern,\n * and to locate types which use this pattern in case they need updating for compiler changes.\n */\nexport type _RecursiveTrick = never;\n\n// This block is kept here to ensure the above example behaves as documented, and can be copied into the example to update it as needed.\n{\n\t/* eslint-disable @typescript-eslint/no-unused-vars */\n\n\t// @ts-expect-error The TypeScript compiler can't handle this case\n\ttype Broken<T> = FlattenKeys<\n\t\t{\n\t\t\t[K in keyof T]: 0;\n\t\t} & {\n\t\t\t// @ts-expect-error Same error as above.\n\t\t\t[K in keyof T]: Broken<T[K]>;\n\t\t}\n\t>;\n\n\t// Adding `K extends _RecursiveTrick ? _RecursiveTrick:` OR `T extends _RecursiveTrick ? _RecursiveTrick :` makes it compile and has no effect on the type produced.\n\ttype Works<T> = FlattenKeys<\n\t\t{\n\t\t\t[K in keyof T]: 0;\n\t\t} & {\n\t\t\t// Trick added here. Since `K` never extends `never`, the second conditional option is always taken,\n\t\t\t// making this equivalent to the broken version, except this one compiles.\n\t\t\t[K in keyof T]: T extends _RecursiveTrick ? _RecursiveTrick : Works<T[K]>;\n\t\t}\n\t>;\n\n\t/* eslint-enable @typescript-eslint/no-unused-vars */\n}\n\n/**\n * Alternative to the built in Record type which does not permit unexpected members,\n * and is readonly.\n *\n * @privateRemarks\n * `number` is not allowed as a key here since doing so causes the compiler to reject recursive schema.\n * The cause for this is unclear, but empirically it was the case when this comment was written.\n * @public\n */\nexport type RestrictiveReadonlyRecord<K extends symbol | string, T> = {\n\treadonly [P in symbol | string]: P extends K ? T : never;\n};\n\n/**\n * Assume that `TInput` is a `TAssumeToBe`.\n *\n * @remarks\n * This is useful in generic code when it is impractical (or messy)\n * to to convince the compiler that a generic type `TInput` will extend `TAssumeToBe`.\n * In these cases `TInput` can be replaced with `Assume<TInput, TAssumeToBe>` to allow compilation of the generic code.\n * When the generic code is parameterized with a concrete type, if that type actually does extend `TAssumeToBe`,\n * it will behave like `TInput` was used directly.\n */\nexport type Assume<TInput, TAssumeToBe> = [TInput] extends [TAssumeToBe]\n\t? TInput\n\t: TAssumeToBe;\n"]}
1
+ {"version":3,"file":"typeUtils.js","sourceRoot":"","sources":["../../src/util/typeUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA4HH,wIAAwI;AACxI,CAAC;IAwBA,qDAAqD;AACtD,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Utilities for manipulating types.\n */\n\n/**\n * Return a type thats equivalent to the input, but with different IntelliSense.\n * This tends to convert unions and intersections into objects.\n * @system @public\n */\nexport type FlattenKeys<T> = [{ [Property in keyof T]: T[Property] }][_InlineTrick];\n\n/**\n * Remove all fields which permit undefined from `T`.\n */\nexport type RequiredFields<T> = [\n\t{\n\t\t[P in keyof T as undefined extends T[P] ? never : P]: T[P];\n\t},\n][_InlineTrick];\n\n/**\n * Extract fields which permit undefined but can also hold other types.\n */\nexport type OptionalFields<T> = [\n\t{\n\t\t[P in keyof T as undefined extends T[P]\n\t\t\t? T[P] extends undefined\n\t\t\t\t? never\n\t\t\t\t: P\n\t\t\t: never]?: T[P];\n\t},\n][_InlineTrick];\n\n/**\n * Converts properties of an object which permit undefined into optional properties.\n * Removes fields which only allow undefined.\n *\n * @remarks\n * This version does not flatten the resulting type.\n * This version exists because some cases recursive types need to avoid this\n * flattening since it causes complication issues.\n *\n * See also `AllowOptional`.\n */\n// export type AllowOptionalNotFlattened<T> = [RequiredFields<T> & OptionalFields<T>][_InlineTrick];\nexport type AllowOptionalNotFlattened<T> = [\n\tRequiredFields<T> & OptionalFields<T>,\n][_InlineTrick];\n\n/**\n * Converts properties of an object which permit undefined into optional properties.\n * Removes fields which only allow undefined.\n */\nexport type AllowOptional<T> = [\n\tFlattenKeys<RequiredFields<T> & OptionalFields<T>>,\n][_InlineTrick];\n\n/**\n * Use for trick to \"inline\" generic types.\n *\n * @remarks\n * The TypeScript compiler can be convinced to inline a generic type\n * (so the result of evaluating the generic type show up in IntelliSense and error messages instead of just the invocation of the generic type)\n * by creating an object with a field, and returning the type of that field.\n *\n * For example:\n * ```typescript\n * type MyGeneric<T1, T2> = {x: T1 extends [] ? T1 : T2 };\n * type MyGenericExpanded<T1, T2> = [{x: T1 extends [] ? T1 : T2 }][_InlineTrick]\n *\n * // Type is MyGeneric<5, string>\n * const foo: MyGeneric<5, string> = {x: \"x\"}\n * // Type is {x: \"x\"}\n * const foo2: MyGenericExpanded<5, string> = {x: \"x\"}\n * ```\n *\n * This constant is defined to provide a way to find this documentation from types which use this pattern,\n * and to locate types which use this pattern in case they need updating for compiler changes.\n * @system @public\n */\nexport type _InlineTrick = 0;\n\n/**\n * Use for trick to prevent self reference error `ts(2456)`.\n *\n * Prefix a type expression with `K extends _RecursiveTrick ? _RecursiveTrick : ` for some K to break the cycle.\n *\n * @remarks\n * The TypeScript compiler handles some cases of recursive types, but not others.\n * Sometimes adding an otherwise needless conditional can make a type compile.\n * Use this type in such cases.\n *\n *For example:\n * ```typescript\n * // The TypeScript compiler can't handle this case\n * type Broken<T> = FlattenKeys<\n *\t{\n * \t\t[K in keyof T]: 0;\n * \t} & {\n * \t\t[K in keyof T]: Broken<T[K]>;\n * \t}\n * >;\n *\n * // Adding `K extends _RecursiveTrick ? _RecursiveTrick :` makes it compile, and has no effect on the type produced.\n * type Works<T> = FlattenKeys<\n * \t{\n * \t\t[K in keyof T]: 0;\n * \t} & {\n * \t\t// Trick added here. Since `k` never extends `never`, the second conditional option is always taken,\n * \t\t// making this equivalent to the broken version, except this one compiles.\n * \t\t[K in keyof T]: K extends _RecursiveTrick ? _RecursiveTrick : Works<T[K]>;\n * \t}\n * >;\n * ```\n *\n * This trick appears to start working in TypeScript 4.1 and is confirmed to still work in 5.0.4.\n *\n * This constant is defined to provide a way to find this documentation from types which use this pattern,\n * and to locate types which use this pattern in case they need updating for compiler changes.\n */\nexport type _RecursiveTrick = never;\n\n// This block is kept here to ensure the above example behaves as documented, and can be copied into the example to update it as needed.\n{\n\t/* eslint-disable @typescript-eslint/no-unused-vars */\n\n\t// @ts-expect-error The TypeScript compiler can't handle this case\n\ttype Broken<T> = FlattenKeys<\n\t\t{\n\t\t\t[K in keyof T]: 0;\n\t\t} & {\n\t\t\t// @ts-expect-error Same error as above.\n\t\t\t[K in keyof T]: Broken<T[K]>;\n\t\t}\n\t>;\n\n\t// Adding `K extends _RecursiveTrick ? _RecursiveTrick:` OR `T extends _RecursiveTrick ? _RecursiveTrick :` makes it compile and has no effect on the type produced.\n\ttype Works<T> = FlattenKeys<\n\t\t{\n\t\t\t[K in keyof T]: 0;\n\t\t} & {\n\t\t\t// Trick added here. Since `K` never extends `never`, the second conditional option is always taken,\n\t\t\t// making this equivalent to the broken version, except this one compiles.\n\t\t\t[K in keyof T]: T extends _RecursiveTrick ? _RecursiveTrick : Works<T[K]>;\n\t\t}\n\t>;\n\n\t/* eslint-enable @typescript-eslint/no-unused-vars */\n}\n\n/**\n * Alternative to the built in Record type which does not permit unexpected members,\n * and is readonly.\n *\n * @privateRemarks\n * `number` is not allowed as a key here since doing so causes the compiler to reject recursive schema.\n * The cause for this is unclear, but empirically it was the case when this comment was written.\n * @public\n */\nexport type RestrictiveReadonlyRecord<K extends symbol | string, T> = {\n\treadonly [P in symbol | string]: P extends K ? T : never;\n};\n\n/**\n * Assume that `TInput` is a `TAssumeToBe`.\n *\n * @remarks\n * This is useful in generic code when it is impractical (or messy)\n * to to convince the compiler that a generic type `TInput` will extend `TAssumeToBe`.\n * In these cases `TInput` can be replaced with `Assume<TInput, TAssumeToBe>` to allow compilation of the generic code.\n * When the generic code is parameterized with a concrete type, if that type actually does extend `TAssumeToBe`,\n * it will behave like `TInput` was used directly.\n */\nexport type Assume<TInput, TAssumeToBe> = [TInput] extends [TAssumeToBe]\n\t? TInput\n\t: TAssumeToBe;\n"]}