@fluidframework/tree 2.4.0-297385 → 2.4.0-299707

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 (349) hide show
  1. package/.dependency-cruiser-known-violations.json +0 -14
  2. package/api-report/tree.alpha.api.md +100 -0
  3. package/dist/alpha.d.ts +20 -1
  4. package/dist/codec/codec.d.ts +4 -4
  5. package/dist/codec/codec.js.map +1 -1
  6. package/dist/codec/noopValidator.d.ts +1 -1
  7. package/dist/codec/noopValidator.js +1 -1
  8. package/dist/codec/noopValidator.js.map +1 -1
  9. package/dist/core/tree/anchorSet.d.ts +159 -2
  10. package/dist/core/tree/anchorSet.d.ts.map +1 -1
  11. package/dist/core/tree/anchorSet.js +54 -12
  12. package/dist/core/tree/anchorSet.js.map +1 -1
  13. package/dist/external-utilities/typeboxValidator.d.ts +1 -1
  14. package/dist/external-utilities/typeboxValidator.js +1 -1
  15. package/dist/external-utilities/typeboxValidator.js.map +1 -1
  16. package/dist/feature-libraries/flex-tree/lazyField.d.ts +4 -0
  17. package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  18. package/dist/feature-libraries/flex-tree/lazyField.js +38 -6
  19. package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
  20. package/dist/feature-libraries/index.d.ts +0 -1
  21. package/dist/feature-libraries/index.d.ts.map +1 -1
  22. package/dist/feature-libraries/index.js +46 -49
  23. package/dist/feature-libraries/index.js.map +1 -1
  24. package/dist/feature-libraries/treeCompressionUtils.d.ts +1 -1
  25. package/dist/feature-libraries/treeCompressionUtils.js +1 -1
  26. package/dist/feature-libraries/treeCompressionUtils.js.map +1 -1
  27. package/dist/index.d.ts +6 -5
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/index.js +4 -2
  30. package/dist/index.js.map +1 -1
  31. package/dist/internalTypes.d.ts +1 -1
  32. package/dist/internalTypes.d.ts.map +1 -1
  33. package/dist/internalTypes.js.map +1 -1
  34. package/dist/packageVersion.d.ts +1 -1
  35. package/dist/packageVersion.js +1 -1
  36. package/dist/packageVersion.js.map +1 -1
  37. package/dist/shared-tree/index.d.ts +2 -1
  38. package/dist/shared-tree/index.d.ts.map +1 -1
  39. package/dist/shared-tree/index.js +5 -1
  40. package/dist/shared-tree/index.js.map +1 -1
  41. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  42. package/dist/shared-tree/schematizingTreeView.js +1 -14
  43. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  44. package/dist/shared-tree/sharedTree.d.ts +24 -9
  45. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  46. package/dist/shared-tree/sharedTree.js +20 -8
  47. package/dist/shared-tree/sharedTree.js.map +1 -1
  48. package/dist/simple-tree/api/conciseTree.d.ts +29 -0
  49. package/dist/simple-tree/api/conciseTree.d.ts.map +1 -0
  50. package/dist/simple-tree/api/conciseTree.js +25 -0
  51. package/dist/simple-tree/api/conciseTree.js.map +1 -0
  52. package/dist/simple-tree/api/customTree.d.ts +44 -0
  53. package/dist/simple-tree/api/customTree.d.ts.map +1 -0
  54. package/dist/simple-tree/api/customTree.js +63 -0
  55. package/dist/simple-tree/api/customTree.js.map +1 -0
  56. package/dist/simple-tree/api/index.d.ts +6 -1
  57. package/dist/simple-tree/api/index.d.ts.map +1 -1
  58. package/dist/simple-tree/api/index.js +5 -1
  59. package/dist/simple-tree/api/index.js.map +1 -1
  60. package/dist/simple-tree/api/schemaCreationUtilities.d.ts +41 -26
  61. package/dist/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -1
  62. package/dist/simple-tree/api/schemaCreationUtilities.js +43 -15
  63. package/dist/simple-tree/api/schemaCreationUtilities.js.map +1 -1
  64. package/dist/simple-tree/api/schemaFactory.d.ts +1 -2
  65. package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
  66. package/dist/simple-tree/api/schemaFactory.js +8 -8
  67. package/dist/simple-tree/api/schemaFactory.js.map +1 -1
  68. package/dist/simple-tree/api/schemaFactoryRecursive.d.ts +1 -2
  69. package/dist/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
  70. package/dist/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
  71. package/dist/simple-tree/api/storedSchema.d.ts +78 -0
  72. package/dist/simple-tree/api/storedSchema.d.ts.map +1 -0
  73. package/dist/simple-tree/api/storedSchema.js +107 -0
  74. package/dist/simple-tree/api/storedSchema.js.map +1 -0
  75. package/dist/simple-tree/api/testRecursiveDomain.d.ts +10 -10
  76. package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  77. package/dist/simple-tree/api/treeNodeApi.js +5 -5
  78. package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
  79. package/dist/simple-tree/{typesUnsafe.d.ts → api/typesUnsafe.d.ts} +14 -5
  80. package/dist/simple-tree/api/typesUnsafe.d.ts.map +1 -0
  81. package/dist/simple-tree/api/typesUnsafe.js.map +1 -0
  82. package/dist/simple-tree/api/verboseTree.d.ts +6 -20
  83. package/dist/simple-tree/api/verboseTree.d.ts.map +1 -1
  84. package/dist/simple-tree/api/verboseTree.js +10 -48
  85. package/dist/simple-tree/api/verboseTree.js.map +1 -1
  86. package/dist/simple-tree/arrayNode.d.ts.map +1 -1
  87. package/dist/simple-tree/arrayNode.js +1 -2
  88. package/dist/simple-tree/arrayNode.js.map +1 -1
  89. package/dist/simple-tree/core/index.d.ts +1 -1
  90. package/dist/simple-tree/core/index.d.ts.map +1 -1
  91. package/dist/simple-tree/core/index.js +2 -1
  92. package/dist/simple-tree/core/index.js.map +1 -1
  93. package/dist/simple-tree/core/treeNodeKernel.d.ts +9 -0
  94. package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  95. package/dist/simple-tree/core/treeNodeKernel.js +14 -1
  96. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
  97. package/dist/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  98. package/dist/simple-tree/core/unhydratedFlexTree.js +3 -1
  99. package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  100. package/dist/simple-tree/flexList.d.ts.map +1 -0
  101. package/dist/simple-tree/flexList.js.map +1 -0
  102. package/dist/simple-tree/index.d.ts +3 -4
  103. package/dist/simple-tree/index.d.ts.map +1 -1
  104. package/dist/simple-tree/index.js +5 -3
  105. package/dist/simple-tree/index.js.map +1 -1
  106. package/dist/simple-tree/mapNode.d.ts.map +1 -1
  107. package/dist/simple-tree/mapNode.js +2 -3
  108. package/dist/simple-tree/mapNode.js.map +1 -1
  109. package/dist/simple-tree/objectNode.d.ts.map +1 -1
  110. package/dist/simple-tree/objectNode.js +3 -4
  111. package/dist/simple-tree/objectNode.js.map +1 -1
  112. package/dist/simple-tree/schemaTypes.d.ts +2 -1
  113. package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
  114. package/dist/simple-tree/schemaTypes.js +5 -5
  115. package/dist/simple-tree/schemaTypes.js.map +1 -1
  116. package/dist/simple-tree/toFlexSchema.d.ts.map +1 -1
  117. package/dist/simple-tree/toFlexSchema.js +13 -15
  118. package/dist/simple-tree/toFlexSchema.js.map +1 -1
  119. package/dist/simple-tree/toMapTree.js +3 -3
  120. package/dist/simple-tree/toMapTree.js.map +1 -1
  121. package/dist/simple-tree/treeNodeValid.d.ts.map +1 -1
  122. package/dist/simple-tree/treeNodeValid.js +2 -1
  123. package/dist/simple-tree/treeNodeValid.js.map +1 -1
  124. package/dist/treeFactory.d.ts +1 -0
  125. package/dist/treeFactory.d.ts.map +1 -1
  126. package/dist/treeFactory.js +1 -0
  127. package/dist/treeFactory.js.map +1 -1
  128. package/dist/util/utils.d.ts +10 -8
  129. package/dist/util/utils.d.ts.map +1 -1
  130. package/dist/util/utils.js.map +1 -1
  131. package/docs/main/detached-trees.md +8 -8
  132. package/lib/alpha.d.ts +20 -1
  133. package/lib/codec/codec.d.ts +4 -4
  134. package/lib/codec/codec.js.map +1 -1
  135. package/lib/codec/noopValidator.d.ts +1 -1
  136. package/lib/codec/noopValidator.js +1 -1
  137. package/lib/codec/noopValidator.js.map +1 -1
  138. package/lib/core/tree/anchorSet.d.ts +159 -2
  139. package/lib/core/tree/anchorSet.d.ts.map +1 -1
  140. package/lib/core/tree/anchorSet.js +54 -12
  141. package/lib/core/tree/anchorSet.js.map +1 -1
  142. package/lib/external-utilities/typeboxValidator.d.ts +1 -1
  143. package/lib/external-utilities/typeboxValidator.js +1 -1
  144. package/lib/external-utilities/typeboxValidator.js.map +1 -1
  145. package/lib/feature-libraries/flex-tree/lazyField.d.ts +4 -0
  146. package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  147. package/lib/feature-libraries/flex-tree/lazyField.js +36 -5
  148. package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
  149. package/lib/feature-libraries/index.d.ts +0 -1
  150. package/lib/feature-libraries/index.d.ts.map +1 -1
  151. package/lib/feature-libraries/index.js +0 -1
  152. package/lib/feature-libraries/index.js.map +1 -1
  153. package/lib/feature-libraries/treeCompressionUtils.d.ts +1 -1
  154. package/lib/feature-libraries/treeCompressionUtils.js +1 -1
  155. package/lib/feature-libraries/treeCompressionUtils.js.map +1 -1
  156. package/lib/index.d.ts +6 -5
  157. package/lib/index.d.ts.map +1 -1
  158. package/lib/index.js +3 -3
  159. package/lib/index.js.map +1 -1
  160. package/lib/internalTypes.d.ts +1 -1
  161. package/lib/internalTypes.d.ts.map +1 -1
  162. package/lib/internalTypes.js.map +1 -1
  163. package/lib/packageVersion.d.ts +1 -1
  164. package/lib/packageVersion.js +1 -1
  165. package/lib/packageVersion.js.map +1 -1
  166. package/lib/shared-tree/index.d.ts +2 -1
  167. package/lib/shared-tree/index.d.ts.map +1 -1
  168. package/lib/shared-tree/index.js +2 -1
  169. package/lib/shared-tree/index.js.map +1 -1
  170. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  171. package/lib/shared-tree/schematizingTreeView.js +2 -15
  172. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  173. package/lib/shared-tree/sharedTree.d.ts +24 -9
  174. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  175. package/lib/shared-tree/sharedTree.js +19 -8
  176. package/lib/shared-tree/sharedTree.js.map +1 -1
  177. package/lib/simple-tree/api/conciseTree.d.ts +29 -0
  178. package/lib/simple-tree/api/conciseTree.d.ts.map +1 -0
  179. package/lib/simple-tree/api/conciseTree.js +21 -0
  180. package/lib/simple-tree/api/conciseTree.js.map +1 -0
  181. package/lib/simple-tree/api/customTree.d.ts +44 -0
  182. package/lib/simple-tree/api/customTree.d.ts.map +1 -0
  183. package/lib/simple-tree/api/customTree.js +59 -0
  184. package/lib/simple-tree/api/customTree.js.map +1 -0
  185. package/lib/simple-tree/api/index.d.ts +6 -1
  186. package/lib/simple-tree/api/index.d.ts.map +1 -1
  187. package/lib/simple-tree/api/index.js +1 -0
  188. package/lib/simple-tree/api/index.js.map +1 -1
  189. package/lib/simple-tree/api/schemaCreationUtilities.d.ts +41 -26
  190. package/lib/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -1
  191. package/lib/simple-tree/api/schemaCreationUtilities.js +43 -15
  192. package/lib/simple-tree/api/schemaCreationUtilities.js.map +1 -1
  193. package/lib/simple-tree/api/schemaFactory.d.ts +1 -2
  194. package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
  195. package/lib/simple-tree/api/schemaFactory.js +1 -1
  196. package/lib/simple-tree/api/schemaFactory.js.map +1 -1
  197. package/lib/simple-tree/api/schemaFactoryRecursive.d.ts +1 -2
  198. package/lib/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
  199. package/lib/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
  200. package/lib/simple-tree/api/storedSchema.d.ts +78 -0
  201. package/lib/simple-tree/api/storedSchema.d.ts.map +1 -0
  202. package/lib/simple-tree/api/storedSchema.js +101 -0
  203. package/lib/simple-tree/api/storedSchema.js.map +1 -0
  204. package/lib/simple-tree/api/testRecursiveDomain.d.ts +10 -10
  205. package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  206. package/lib/simple-tree/api/treeNodeApi.js +3 -3
  207. package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
  208. package/lib/simple-tree/{typesUnsafe.d.ts → api/typesUnsafe.d.ts} +14 -5
  209. package/lib/simple-tree/api/typesUnsafe.d.ts.map +1 -0
  210. package/lib/simple-tree/api/typesUnsafe.js.map +1 -0
  211. package/lib/simple-tree/api/verboseTree.d.ts +6 -20
  212. package/lib/simple-tree/api/verboseTree.d.ts.map +1 -1
  213. package/lib/simple-tree/api/verboseTree.js +11 -49
  214. package/lib/simple-tree/api/verboseTree.js.map +1 -1
  215. package/lib/simple-tree/arrayNode.d.ts.map +1 -1
  216. package/lib/simple-tree/arrayNode.js +1 -2
  217. package/lib/simple-tree/arrayNode.js.map +1 -1
  218. package/lib/simple-tree/core/index.d.ts +1 -1
  219. package/lib/simple-tree/core/index.d.ts.map +1 -1
  220. package/lib/simple-tree/core/index.js +1 -1
  221. package/lib/simple-tree/core/index.js.map +1 -1
  222. package/lib/simple-tree/core/treeNodeKernel.d.ts +9 -0
  223. package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  224. package/lib/simple-tree/core/treeNodeKernel.js +12 -0
  225. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
  226. package/lib/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  227. package/lib/simple-tree/core/unhydratedFlexTree.js +3 -1
  228. package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  229. package/lib/simple-tree/flexList.d.ts.map +1 -0
  230. package/lib/simple-tree/flexList.js.map +1 -0
  231. package/lib/simple-tree/index.d.ts +3 -4
  232. package/lib/simple-tree/index.d.ts.map +1 -1
  233. package/lib/simple-tree/index.js +2 -3
  234. package/lib/simple-tree/index.js.map +1 -1
  235. package/lib/simple-tree/mapNode.d.ts.map +1 -1
  236. package/lib/simple-tree/mapNode.js +1 -2
  237. package/lib/simple-tree/mapNode.js.map +1 -1
  238. package/lib/simple-tree/objectNode.d.ts.map +1 -1
  239. package/lib/simple-tree/objectNode.js +1 -2
  240. package/lib/simple-tree/objectNode.js.map +1 -1
  241. package/lib/simple-tree/schemaTypes.d.ts +2 -1
  242. package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
  243. package/lib/simple-tree/schemaTypes.js +1 -1
  244. package/lib/simple-tree/schemaTypes.js.map +1 -1
  245. package/lib/simple-tree/toFlexSchema.d.ts.map +1 -1
  246. package/lib/simple-tree/toFlexSchema.js +1 -3
  247. package/lib/simple-tree/toFlexSchema.js.map +1 -1
  248. package/lib/simple-tree/toMapTree.js +3 -3
  249. package/lib/simple-tree/toMapTree.js.map +1 -1
  250. package/lib/simple-tree/treeNodeValid.d.ts.map +1 -1
  251. package/lib/simple-tree/treeNodeValid.js +2 -1
  252. package/lib/simple-tree/treeNodeValid.js.map +1 -1
  253. package/lib/treeFactory.d.ts +1 -0
  254. package/lib/treeFactory.d.ts.map +1 -1
  255. package/lib/treeFactory.js +1 -0
  256. package/lib/treeFactory.js.map +1 -1
  257. package/lib/util/utils.d.ts +10 -8
  258. package/lib/util/utils.d.ts.map +1 -1
  259. package/lib/util/utils.js.map +1 -1
  260. package/package.json +26 -25
  261. package/src/codec/codec.ts +4 -4
  262. package/src/codec/noopValidator.ts +1 -1
  263. package/src/core/tree/anchorSet.ts +63 -13
  264. package/src/external-utilities/typeboxValidator.ts +1 -1
  265. package/src/feature-libraries/flex-tree/lazyField.ts +44 -7
  266. package/src/feature-libraries/index.ts +0 -10
  267. package/src/feature-libraries/treeCompressionUtils.ts +1 -1
  268. package/src/index.ts +17 -6
  269. package/src/internalTypes.ts +1 -1
  270. package/src/packageVersion.ts +1 -1
  271. package/src/shared-tree/index.ts +5 -0
  272. package/src/shared-tree/schematizingTreeView.ts +7 -16
  273. package/src/shared-tree/sharedTree.ts +52 -22
  274. package/src/simple-tree/api/conciseTree.ts +58 -0
  275. package/src/simple-tree/api/customTree.ts +119 -0
  276. package/src/simple-tree/api/index.ts +34 -1
  277. package/src/simple-tree/api/schemaCreationUtilities.ts +55 -36
  278. package/src/simple-tree/api/schemaFactory.ts +4 -6
  279. package/src/simple-tree/api/schemaFactoryRecursive.ts +1 -2
  280. package/src/simple-tree/api/storedSchema.ts +126 -0
  281. package/src/simple-tree/api/treeNodeApi.ts +3 -8
  282. package/src/simple-tree/{typesUnsafe.ts → api/typesUnsafe.ts} +15 -5
  283. package/src/simple-tree/api/verboseTree.ts +21 -76
  284. package/src/simple-tree/arrayNode.ts +1 -1
  285. package/src/simple-tree/core/index.ts +1 -0
  286. package/src/simple-tree/core/treeNodeKernel.ts +13 -0
  287. package/src/simple-tree/core/unhydratedFlexTree.ts +6 -1
  288. package/src/simple-tree/index.ts +26 -20
  289. package/src/simple-tree/mapNode.ts +1 -1
  290. package/src/simple-tree/objectNode.ts +1 -1
  291. package/src/simple-tree/schemaTypes.ts +2 -6
  292. package/src/simple-tree/toFlexSchema.ts +1 -3
  293. package/src/simple-tree/toMapTree.ts +3 -3
  294. package/src/simple-tree/treeNodeValid.ts +2 -1
  295. package/src/treeFactory.ts +1 -0
  296. package/src/util/utils.ts +10 -8
  297. package/dist/feature-libraries/flex-tree/unboxed.d.ts +0 -12
  298. package/dist/feature-libraries/flex-tree/unboxed.d.ts.map +0 -1
  299. package/dist/feature-libraries/flex-tree/unboxed.js +0 -20
  300. package/dist/feature-libraries/flex-tree/unboxed.js.map +0 -1
  301. package/dist/feature-libraries/typed-schema/flexList.d.ts.map +0 -1
  302. package/dist/feature-libraries/typed-schema/flexList.js.map +0 -1
  303. package/dist/feature-libraries/typed-schema/index.d.ts +0 -7
  304. package/dist/feature-libraries/typed-schema/index.d.ts.map +0 -1
  305. package/dist/feature-libraries/typed-schema/index.js +0 -12
  306. package/dist/feature-libraries/typed-schema/index.js.map +0 -1
  307. package/dist/feature-libraries/typed-schema/typedTreeSchema.d.ts +0 -14
  308. package/dist/feature-libraries/typed-schema/typedTreeSchema.d.ts.map +0 -1
  309. package/dist/feature-libraries/typed-schema/typedTreeSchema.js +0 -7
  310. package/dist/feature-libraries/typed-schema/typedTreeSchema.js.map +0 -1
  311. package/dist/simple-tree/proxyBinding.d.ts +0 -15
  312. package/dist/simple-tree/proxyBinding.d.ts.map +0 -1
  313. package/dist/simple-tree/proxyBinding.js +0 -22
  314. package/dist/simple-tree/proxyBinding.js.map +0 -1
  315. package/dist/simple-tree/typesUnsafe.d.ts.map +0 -1
  316. package/dist/simple-tree/typesUnsafe.js.map +0 -1
  317. package/lib/feature-libraries/flex-tree/unboxed.d.ts +0 -12
  318. package/lib/feature-libraries/flex-tree/unboxed.d.ts.map +0 -1
  319. package/lib/feature-libraries/flex-tree/unboxed.js +0 -16
  320. package/lib/feature-libraries/flex-tree/unboxed.js.map +0 -1
  321. package/lib/feature-libraries/typed-schema/flexList.d.ts.map +0 -1
  322. package/lib/feature-libraries/typed-schema/flexList.js.map +0 -1
  323. package/lib/feature-libraries/typed-schema/index.d.ts +0 -7
  324. package/lib/feature-libraries/typed-schema/index.d.ts.map +0 -1
  325. package/lib/feature-libraries/typed-schema/index.js +0 -6
  326. package/lib/feature-libraries/typed-schema/index.js.map +0 -1
  327. package/lib/feature-libraries/typed-schema/typedTreeSchema.d.ts +0 -14
  328. package/lib/feature-libraries/typed-schema/typedTreeSchema.d.ts.map +0 -1
  329. package/lib/feature-libraries/typed-schema/typedTreeSchema.js +0 -6
  330. package/lib/feature-libraries/typed-schema/typedTreeSchema.js.map +0 -1
  331. package/lib/simple-tree/proxyBinding.d.ts +0 -15
  332. package/lib/simple-tree/proxyBinding.d.ts.map +0 -1
  333. package/lib/simple-tree/proxyBinding.js +0 -18
  334. package/lib/simple-tree/proxyBinding.js.map +0 -1
  335. package/lib/simple-tree/typesUnsafe.d.ts.map +0 -1
  336. package/lib/simple-tree/typesUnsafe.js.map +0 -1
  337. package/src/feature-libraries/flex-tree/unboxed.ts +0 -24
  338. package/src/feature-libraries/typed-schema/README.md +0 -6
  339. package/src/feature-libraries/typed-schema/index.ts +0 -16
  340. package/src/feature-libraries/typed-schema/typedTreeSchema.ts +0 -14
  341. package/src/simple-tree/proxyBinding.ts +0 -20
  342. /package/dist/simple-tree/{typesUnsafe.js → api/typesUnsafe.js} +0 -0
  343. /package/dist/{feature-libraries/typed-schema → simple-tree}/flexList.d.ts +0 -0
  344. /package/dist/{feature-libraries/typed-schema → simple-tree}/flexList.js +0 -0
  345. /package/lib/simple-tree/{typesUnsafe.js → api/typesUnsafe.js} +0 -0
  346. /package/lib/{feature-libraries/typed-schema → simple-tree}/flexList.d.ts +0 -0
  347. /package/lib/{feature-libraries/typed-schema → simple-tree}/flexList.js +0 -0
  348. /package/src/simple-tree/{ProxyBinding.md → core/TreeNodeBinding.md} +0 -0
  349. /package/src/{feature-libraries/typed-schema → simple-tree}/flexList.ts +0 -0
@@ -5,7 +5,7 @@
5
5
  export { type ITree, type TreeView, type ViewableTree, type TreeViewEvents, TreeViewConfiguration, type ITreeViewConfiguration, type SchemaCompatibilityStatus, type ITreeConfigurationOptions, } from "./tree.js";
6
6
  export { SchemaFactory, type ScopedSchemaName } from "./schemaFactory.js";
7
7
  export type { ValidateRecursiveSchema, FixRecursiveArraySchema, } from "./schemaFactoryRecursive.js";
8
- export { adaptEnum, enumFromStrings, singletonSchema, typedObjectValues, type EmptyObject, } from "./schemaCreationUtilities.js";
8
+ export { adaptEnum, enumFromStrings, singletonSchema, typedObjectValues, } from "./schemaCreationUtilities.js";
9
9
  export { treeNodeApi, type TreeNodeApi } from "./treeNodeApi.js";
10
10
  export { createFromInsertable, cursorFromInsertable } from "./create.js";
11
11
  export type { SimpleTreeSchema } from "./simpleSchema.js";
@@ -13,6 +13,11 @@ export { type JsonSchemaId, type JsonSchemaType, type JsonObjectNodeSchema, type
13
13
  export { getJsonSchema } from "./getJsonSchema.js";
14
14
  export { getSimpleSchema } from "./getSimpleSchema.js";
15
15
  export { ViewSchema } from "./view.js";
16
+ export type { Unenforced, FieldHasDefaultUnsafe, ObjectFromSchemaRecordUnsafe, TreeObjectNodeUnsafe, TreeFieldFromImplicitFieldUnsafe, TreeNodeFromImplicitAllowedTypesUnsafe, FieldSchemaUnsafe, InsertableTreeNodeFromImplicitAllowedTypesUnsafe, TreeArrayNodeUnsafe, TreeMapNodeUnsafe, InsertableObjectFromSchemaRecordUnsafe, InsertableTreeFieldFromImplicitFieldUnsafe, InsertableTypedNodeUnsafe, NodeBuilderDataUnsafe, NodeFromSchemaUnsafe, ReadonlyMapInlined, } from "./typesUnsafe.js";
17
+ export type { VerboseTreeNode, ParseOptions, VerboseTree, } from "./verboseTree.js";
18
+ export type { EncodeOptions } from "./customTree.js";
19
+ export type { ConciseTree } from "./conciseTree.js";
16
20
  export { TreeBeta, type NodeChangedData, type TreeChangeEventsBeta } from "./treeApiBeta.js";
21
+ export { extractPersistedSchema, comparePersistedSchemaInternal, comparePersistedSchema, } from "./storedSchema.js";
17
22
  export { RecursiveObject as test_RecursiveObject, base as test_RecursiveObject_base, RecursiveObjectPojoMode as test_RecursiveObjectPojoMode, } from "./testRecursiveDomain.js";
18
23
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,KAAK,EACV,KAAK,QAAQ,EACb,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,qBAAqB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,yBAAyB,EAC9B,KAAK,yBAAyB,GAC9B,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,aAAa,EAAE,KAAK,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC1E,YAAY,EACX,uBAAuB,EACvB,uBAAuB,GACvB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACN,SAAS,EACT,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,KAAK,WAAW,GAChB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,KAA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F,OAAO,EACN,sBAAsB,EACtB,8BAA8B,EAC9B,sBAAsB,GACtB,MAAM,mBAAmB,CAAC;AAI3B,OAAO,EACN,eAAe,IAAI,oBAAoB,EACvC,IAAI,IAAI,yBAAyB,EACjC,uBAAuB,IAAI,4BAA4B,GACvD,MAAM,0BAA0B,CAAC"}
@@ -4,7 +4,7 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.test_RecursiveObjectPojoMode = exports.test_RecursiveObject_base = exports.test_RecursiveObject = exports.TreeBeta = exports.ViewSchema = exports.getSimpleSchema = exports.getJsonSchema = exports.cursorFromInsertable = exports.createFromInsertable = exports.treeNodeApi = exports.typedObjectValues = exports.singletonSchema = exports.enumFromStrings = exports.adaptEnum = exports.SchemaFactory = exports.TreeViewConfiguration = void 0;
7
+ exports.test_RecursiveObjectPojoMode = exports.test_RecursiveObject_base = exports.test_RecursiveObject = exports.comparePersistedSchema = exports.comparePersistedSchemaInternal = exports.extractPersistedSchema = exports.TreeBeta = exports.ViewSchema = exports.getSimpleSchema = exports.getJsonSchema = exports.cursorFromInsertable = exports.createFromInsertable = exports.treeNodeApi = exports.typedObjectValues = exports.singletonSchema = exports.enumFromStrings = exports.adaptEnum = exports.SchemaFactory = exports.TreeViewConfiguration = void 0;
8
8
  var tree_js_1 = require("./tree.js");
9
9
  Object.defineProperty(exports, "TreeViewConfiguration", { enumerable: true, get: function () { return tree_js_1.TreeViewConfiguration; } });
10
10
  var schemaFactory_js_1 = require("./schemaFactory.js");
@@ -27,6 +27,10 @@ var view_js_1 = require("./view.js");
27
27
  Object.defineProperty(exports, "ViewSchema", { enumerable: true, get: function () { return view_js_1.ViewSchema; } });
28
28
  var treeApiBeta_js_1 = require("./treeApiBeta.js");
29
29
  Object.defineProperty(exports, "TreeBeta", { enumerable: true, get: function () { return treeApiBeta_js_1.TreeBeta; } });
30
+ var storedSchema_js_1 = require("./storedSchema.js");
31
+ Object.defineProperty(exports, "extractPersistedSchema", { enumerable: true, get: function () { return storedSchema_js_1.extractPersistedSchema; } });
32
+ Object.defineProperty(exports, "comparePersistedSchemaInternal", { enumerable: true, get: function () { return storedSchema_js_1.comparePersistedSchemaInternal; } });
33
+ Object.defineProperty(exports, "comparePersistedSchema", { enumerable: true, get: function () { return storedSchema_js_1.comparePersistedSchema; } });
30
34
  // Exporting the schema (RecursiveObject) to test that recursive types are working correctly.
31
35
  // These are `@internal` so they can't be included in the `InternalClassTreeTypes` due to https://github.com/microsoft/rushstack/issues/3639
32
36
  var testRecursiveDomain_js_1 = require("./testRecursiveDomain.js");
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/simple-tree/api/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,qCASmB;AAJlB,gHAAA,qBAAqB,OAAA;AAKtB,uDAA0E;AAAjE,iHAAA,aAAa,OAAA;AAKtB,2EAMsC;AALrC,uHAAA,SAAS,OAAA;AACT,6HAAA,eAAe,OAAA;AACf,6HAAA,eAAe,OAAA;AACf,+HAAA,iBAAiB,OAAA;AAGlB,mDAAiE;AAAxD,6GAAA,WAAW,OAAA;AACpB,yCAAyE;AAAhE,iHAAA,oBAAoB,OAAA;AAAE,iHAAA,oBAAoB,OAAA;AAiBnD,uDAAmD;AAA1C,iHAAA,aAAa,OAAA;AACtB,2DAAuD;AAA9C,qHAAA,eAAe,OAAA;AACxB,qCAAuC;AAA9B,qGAAA,UAAU,OAAA;AAEnB,mDAA6F;AAApF,0GAAA,QAAQ,OAAA;AAEjB,6FAA6F;AAC7F,4IAA4I;AAC5I,mEAIkC;AAHjC,8HAAA,eAAe,OAAwB;AACvC,mIAAA,IAAI,OAA6B;AACjC,sIAAA,uBAAuB,OAAgC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\ttype ITree,\n\ttype TreeView,\n\ttype ViewableTree,\n\ttype TreeViewEvents,\n\tTreeViewConfiguration,\n\ttype ITreeViewConfiguration,\n\ttype SchemaCompatibilityStatus,\n\ttype ITreeConfigurationOptions,\n} from \"./tree.js\";\nexport { SchemaFactory, type ScopedSchemaName } from \"./schemaFactory.js\";\nexport type {\n\tValidateRecursiveSchema,\n\tFixRecursiveArraySchema,\n} from \"./schemaFactoryRecursive.js\";\nexport {\n\tadaptEnum,\n\tenumFromStrings,\n\tsingletonSchema,\n\ttypedObjectValues,\n\ttype EmptyObject,\n} from \"./schemaCreationUtilities.js\";\nexport { treeNodeApi, type TreeNodeApi } from \"./treeNodeApi.js\";\nexport { createFromInsertable, cursorFromInsertable } from \"./create.js\";\nexport type { SimpleTreeSchema } from \"./simpleSchema.js\";\nexport {\n\ttype JsonSchemaId,\n\ttype JsonSchemaType,\n\ttype JsonObjectNodeSchema,\n\ttype JsonArrayNodeSchema,\n\ttype JsonMapNodeSchema,\n\ttype JsonLeafNodeSchema,\n\ttype JsonSchemaRef,\n\ttype JsonRefPath,\n\ttype JsonNodeSchema,\n\ttype JsonNodeSchemaBase,\n\ttype JsonTreeSchema,\n\ttype JsonFieldSchema,\n\ttype JsonLeafSchemaType,\n} from \"./jsonSchema.js\";\nexport { getJsonSchema } from \"./getJsonSchema.js\";\nexport { getSimpleSchema } from \"./getSimpleSchema.js\";\nexport { ViewSchema } from \"./view.js\";\n\nexport { TreeBeta, type NodeChangedData, type TreeChangeEventsBeta } from \"./treeApiBeta.js\";\n\n// Exporting the schema (RecursiveObject) to test that recursive types are working correctly.\n// These are `@internal` so they can't be included in the `InternalClassTreeTypes` due to https://github.com/microsoft/rushstack/issues/3639\nexport {\n\tRecursiveObject as test_RecursiveObject,\n\tbase as test_RecursiveObject_base,\n\tRecursiveObjectPojoMode as test_RecursiveObjectPojoMode,\n} from \"./testRecursiveDomain.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/simple-tree/api/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,qCASmB;AAJlB,gHAAA,qBAAqB,OAAA;AAKtB,uDAA0E;AAAjE,iHAAA,aAAa,OAAA;AAKtB,2EAKsC;AAJrC,uHAAA,SAAS,OAAA;AACT,6HAAA,eAAe,OAAA;AACf,6HAAA,eAAe,OAAA;AACf,+HAAA,iBAAiB,OAAA;AAElB,mDAAiE;AAAxD,6GAAA,WAAW,OAAA;AACpB,yCAAyE;AAAhE,iHAAA,oBAAoB,OAAA;AAAE,iHAAA,oBAAoB,OAAA;AAiBnD,uDAAmD;AAA1C,iHAAA,aAAa,OAAA;AACtB,2DAAuD;AAA9C,qHAAA,eAAe,OAAA;AACxB,qCAAuC;AAA9B,qGAAA,UAAU,OAAA;AA8BnB,mDAA6F;AAApF,0GAAA,QAAQ,OAAA;AAEjB,qDAI2B;AAH1B,yHAAA,sBAAsB,OAAA;AACtB,iIAAA,8BAA8B,OAAA;AAC9B,yHAAA,sBAAsB,OAAA;AAGvB,6FAA6F;AAC7F,4IAA4I;AAC5I,mEAIkC;AAHjC,8HAAA,eAAe,OAAwB;AACvC,mIAAA,IAAI,OAA6B;AACjC,sIAAA,uBAAuB,OAAgC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\ttype ITree,\n\ttype TreeView,\n\ttype ViewableTree,\n\ttype TreeViewEvents,\n\tTreeViewConfiguration,\n\ttype ITreeViewConfiguration,\n\ttype SchemaCompatibilityStatus,\n\ttype ITreeConfigurationOptions,\n} from \"./tree.js\";\nexport { SchemaFactory, type ScopedSchemaName } from \"./schemaFactory.js\";\nexport type {\n\tValidateRecursiveSchema,\n\tFixRecursiveArraySchema,\n} from \"./schemaFactoryRecursive.js\";\nexport {\n\tadaptEnum,\n\tenumFromStrings,\n\tsingletonSchema,\n\ttypedObjectValues,\n} from \"./schemaCreationUtilities.js\";\nexport { treeNodeApi, type TreeNodeApi } from \"./treeNodeApi.js\";\nexport { createFromInsertable, cursorFromInsertable } from \"./create.js\";\nexport type { SimpleTreeSchema } from \"./simpleSchema.js\";\nexport {\n\ttype JsonSchemaId,\n\ttype JsonSchemaType,\n\ttype JsonObjectNodeSchema,\n\ttype JsonArrayNodeSchema,\n\ttype JsonMapNodeSchema,\n\ttype JsonLeafNodeSchema,\n\ttype JsonSchemaRef,\n\ttype JsonRefPath,\n\ttype JsonNodeSchema,\n\ttype JsonNodeSchemaBase,\n\ttype JsonTreeSchema,\n\ttype JsonFieldSchema,\n\ttype JsonLeafSchemaType,\n} from \"./jsonSchema.js\";\nexport { getJsonSchema } from \"./getJsonSchema.js\";\nexport { getSimpleSchema } from \"./getSimpleSchema.js\";\nexport { ViewSchema } from \"./view.js\";\nexport type {\n\tUnenforced,\n\tFieldHasDefaultUnsafe,\n\tObjectFromSchemaRecordUnsafe,\n\tTreeObjectNodeUnsafe,\n\tTreeFieldFromImplicitFieldUnsafe,\n\tTreeNodeFromImplicitAllowedTypesUnsafe,\n\tFieldSchemaUnsafe,\n\tInsertableTreeNodeFromImplicitAllowedTypesUnsafe,\n\tTreeArrayNodeUnsafe,\n\tTreeMapNodeUnsafe,\n\tInsertableObjectFromSchemaRecordUnsafe,\n\tInsertableTreeFieldFromImplicitFieldUnsafe,\n\tInsertableTypedNodeUnsafe,\n\tNodeBuilderDataUnsafe,\n\tNodeFromSchemaUnsafe,\n\tReadonlyMapInlined,\n} from \"./typesUnsafe.js\";\n\nexport type {\n\tVerboseTreeNode,\n\tParseOptions,\n\tVerboseTree,\n} from \"./verboseTree.js\";\n\nexport type { EncodeOptions } from \"./customTree.js\";\n\nexport type { ConciseTree } from \"./conciseTree.js\";\n\nexport { TreeBeta, type NodeChangedData, type TreeChangeEventsBeta } from \"./treeApiBeta.js\";\n\nexport {\n\textractPersistedSchema,\n\tcomparePersistedSchemaInternal,\n\tcomparePersistedSchema,\n} from \"./storedSchema.js\";\n\n// Exporting the schema (RecursiveObject) to test that recursive types are working correctly.\n// These are `@internal` so they can't be included in the `InternalClassTreeTypes` due to https://github.com/microsoft/rushstack/issues/3639\nexport {\n\tRecursiveObject as test_RecursiveObject,\n\tbase as test_RecursiveObject_base,\n\tRecursiveObjectPojoMode as test_RecursiveObjectPojoMode,\n} from \"./testRecursiveDomain.js\";\n"]}
@@ -3,61 +3,75 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import type { SchemaFactory, ScopedSchemaName } from "./schemaFactory.js";
6
- import type { NodeKind, TreeNodeSchemaClass, TreeNode } from "../core/index.js";
7
- import type { ObjectFromSchemaRecord } from "../objectNode.js";
8
- /**
9
- * Empty Object for use in type computations that should contribute no fields when `&`ed with another type.
10
- * @internal
11
- */
12
- export type EmptyObject = {};
6
+ import type { NodeKind, TreeNode, TreeNodeSchemaClass } from "../core/index.js";
13
7
  /**
14
8
  * Create a schema for a node with no state.
15
9
  * @remarks
16
10
  * This is commonly used in unions when the only information needed is which kind of node the value is.
17
11
  * Enums are a common example of this pattern.
18
- * @internal
12
+ * @see {@link adaptEnum}
13
+ * @alpha
19
14
  */
20
- export declare function singletonSchema<TScope extends string, TName extends string | number>(factory: SchemaFactory<TScope, TName>, name: TName): TreeNodeSchemaClass<ScopedSchemaName<TScope, TName>, NodeKind.Object, object & TreeNode & ObjectFromSchemaRecord<EmptyObject> & {
15
+ export declare function singletonSchema<TScope extends string, TName extends string | number>(factory: SchemaFactory<TScope, TName>, name: TName): TreeNodeSchemaClass<ScopedSchemaName<TScope, TName>, NodeKind.Object, TreeNode & {
21
16
  readonly value: TName;
22
- }, object & {}, true, unknown> & (new () => object & TreeNode & ObjectFromSchemaRecord<EmptyObject> & {
17
+ }, never, true, unknown> & (new () => TreeNode & {
23
18
  readonly value: TName;
24
19
  });
25
20
  /**
26
21
  * Converts an enum into a collection of schema which can be used in a union.
27
22
  * @remarks
28
23
  * Currently only supports `string` enums.
24
+ * The string value of the enum is used as the name of the schema: callers must ensure that it is stable and unique.
25
+ * Consider making a dedicated schema factory with a nested scope to avoid the enum members colliding with other schema.
29
26
  * @example
30
27
  * ```typescript
28
+ * const schemaFactory = new SchemaFactory("com.myApp");
29
+ * // An enum for use in the tree. Must have string keys.
31
30
  * enum Mode {
32
31
  * a = "A",
33
32
  * b = "B",
34
33
  * }
35
- * const ModeNodes = adaptEnum(schema, Mode);
34
+ * // Define the schema for each member of the enum using a nested scope to group them together.
35
+ * const ModeNodes = adaptEnum(new SchemaFactory(`${schemaFactory.scope}.Mode`), Mode);
36
+ * // Defined the types of the nodes which correspond to this the schema.
36
37
  * type ModeNodes = NodeFromSchema<(typeof ModeNodes)[keyof typeof ModeNodes]>;
37
- * const nodeFromString: ModeNodes = ModeNodes(Mode.a);
38
- * const nodeFromSchema: ModeNodes = new ModeNodes.a();
39
- * const nameFromNode: Mode = nodeFromSchema.value;
38
+ * // An example schema which has an enum as a child.
40
39
  * class Parent extends schemaFactory.object("Parent", {
40
+ * // typedObjectValues extracts a list of all the fields of ModeNodes, which are the schema for each enum member.
41
+ * // This means any member of the enum is allowed in this field.
41
42
  * mode: typedObjectValues(ModeNodes),
42
43
  * }) {}
44
+ *
45
+ * // Example usage of enum-based nodes, showing what type to use and that `.value` can be used to read out the enum value.
46
+ * function getValue(node: ModeNodes): Mode {
47
+ * return node.value;
48
+ * }
49
+ *
50
+ * // Example constructing a tree containing an enum node from an enum value.
51
+ * // The syntax `new ModeNodes.a()` is also supported.
52
+ * function setValue(node: Parent): void {
53
+ * node.mode = ModeNodes(Mode.a);
54
+ * }
43
55
  * ```
44
56
  * @privateRemarks
45
57
  * TODO:
46
- * Extends this to support numeric enums.
47
- * Maybe require an explicit nested scope to group them under, or at least a warning about collisions.
48
- * Maybe just provide `SchemaFactory.nested` to east creating nested scopes?
49
- * @internal
58
+ * Extend this to support numeric enums.
59
+ * Maybe provide `SchemaFactory.nested` to ease creating nested scopes?
60
+ * @see {@link enumFromStrings} for a similar function that works on arrays of strings instead of an enum.
61
+ * @alpha
50
62
  */
51
- export declare function adaptEnum<TScope extends string, const TEnum extends Record<string, string>>(factory: SchemaFactory<TScope>, members: TEnum): (<TValue extends TEnum[keyof TEnum]>(value: TValue) => object & TreeNode & ObjectFromSchemaRecord<EmptyObject> & {
63
+ export declare function adaptEnum<TScope extends string, const TEnum extends Record<string, string | number>>(factory: SchemaFactory<TScope>, members: TEnum): (<TValue extends TEnum[keyof TEnum]>(value: TValue) => TreeNode & {
52
64
  readonly value: TValue;
53
- }) & { readonly [Property in keyof TEnum]: TreeNodeSchemaClass<ScopedSchemaName<TScope, TEnum[Property]>, NodeKind.Object, object & TreeNode & ObjectFromSchemaRecord<EmptyObject> & {
65
+ }) & { readonly [Property in keyof TEnum]: TreeNodeSchemaClass<ScopedSchemaName<TScope, TEnum[Property]>, NodeKind.Object, TreeNode & {
54
66
  readonly value: TEnum[Property];
55
- }, object & {}, true, unknown> & (new () => object & TreeNode & ObjectFromSchemaRecord<EmptyObject> & {
67
+ }, never, true, unknown> & (new () => TreeNode & {
56
68
  readonly value: TEnum[Property];
57
69
  }); };
58
70
  /**
59
71
  * `Object.values`, but with more specific types.
60
- * @internal
72
+ * @remarks
73
+ * Useful with collections of schema, like those returned by {@link adaptEnum} or {@link enumFromStrings}.
74
+ * @alpha
61
75
  */
62
76
  export declare function typedObjectValues<TKey extends string, TValues>(object: Record<TKey, TValues>): TValues[];
63
77
  /**
@@ -77,13 +91,14 @@ export declare function typedObjectValues<TKey extends string, TValues>(object:
77
91
  *
78
92
  * class Parent extends schemaFactory.object("Parent", { mode: typedObjectValues(Mode) }) {}
79
93
  * ```
80
- * @internal
94
+ * @see {@link adaptEnum} for a similar function that works on enums instead of arrays of strings.
95
+ * @alpha
81
96
  */
82
- export declare function enumFromStrings<TScope extends string, const Members extends string>(factory: SchemaFactory<TScope>, members: readonly Members[]): (<TValue extends Members>(value: TValue) => object & TreeNode & ObjectFromSchemaRecord<EmptyObject> & {
97
+ export declare function enumFromStrings<TScope extends string, const Members extends string>(factory: SchemaFactory<TScope>, members: readonly Members[]): (<TValue extends Members>(value: TValue) => TreeNode & {
83
98
  readonly value: TValue;
84
- }) & Record<Members, TreeNodeSchemaClass<ScopedSchemaName<TScope, Members>, NodeKind.Object, object & TreeNode & ObjectFromSchemaRecord<EmptyObject> & {
99
+ }) & Record<Members, TreeNodeSchemaClass<ScopedSchemaName<TScope, Members>, NodeKind.Object, TreeNode & {
85
100
  readonly value: Members;
86
- }, object & {}, true, unknown> & (new () => object & TreeNode & ObjectFromSchemaRecord<EmptyObject> & {
101
+ }, never, true, unknown> & (new () => TreeNode & {
87
102
  readonly value: Members;
88
103
  })>;
89
104
  //# sourceMappingURL=schemaCreationUtilities.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schemaCreationUtilities.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/schemaCreationUtilities.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE1E,OAAO,KAAK,EAAE,QAAQ,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAChF,OAAO,KAAK,EAEX,sBAAsB,EACtB,MAAM,kBAAkB,CAAC;AAE1B;;;GAGG;AAIH,MAAM,MAAM,WAAW,GAAG,EAAE,CAAC;AAE7B;;;;;;GAMG;AAGH,wBAAgB,eAAe,CAAC,MAAM,SAAS,MAAM,EAAE,KAAK,SAAS,MAAM,GAAG,MAAM,EACnF,OAAO,EAAE,aAAa,CAAC,MAAM,EAAE,KAAK,CAAC,EACrC,IAAI,EAAE,KAAK;oBAa8C,KAAK;;oBAAL,KAAK;GAiB9D;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,wBAAgB,SAAS,CAAC,MAAM,SAAS,MAAM,EAAE,KAAK,CAAC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC1F,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,EAC9B,OAAO,EAAE,KAAK,+CAmBoC,MAAM;;;;;;MAgBxD;AAED;;;GAG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IAAI,EAAE,OAAO,CAAC,GAC3B,OAAO,EAAE,CAEX;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,wBAAgB,eAAe,CAAC,MAAM,SAAS,MAAM,EAAE,KAAK,CAAC,OAAO,SAAS,MAAM,EAClF,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,EAC9B,OAAO,EAAE,SAAS,OAAO,EAAE,oCASwB,MAAM;;;;;;IAgBzD"}
@@ -7,12 +7,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.enumFromStrings = exports.typedObjectValues = exports.adaptEnum = exports.singletonSchema = void 0;
8
8
  const internal_1 = require("@fluidframework/telemetry-utils/internal");
9
9
  const index_js_1 = require("../../util/index.js");
10
+ /*
11
+ * This file does two things:
12
+ *
13
+ * 1. Provides tools for making schema for cases like enums.
14
+ *
15
+ * 2. Demonstrates the kinds of schema utilities apps can write.
16
+ * Nothing in here needs access to package internal APIs.
17
+ */
10
18
  /**
11
19
  * Create a schema for a node with no state.
12
20
  * @remarks
13
21
  * This is commonly used in unions when the only information needed is which kind of node the value is.
14
22
  * Enums are a common example of this pattern.
15
- * @internal
23
+ * @see {@link adaptEnum}
24
+ * @alpha
16
25
  */
17
26
  // Return type is intentionally derived.
18
27
  // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
@@ -38,27 +47,44 @@ exports.singletonSchema = singletonSchema;
38
47
  * Converts an enum into a collection of schema which can be used in a union.
39
48
  * @remarks
40
49
  * Currently only supports `string` enums.
50
+ * The string value of the enum is used as the name of the schema: callers must ensure that it is stable and unique.
51
+ * Consider making a dedicated schema factory with a nested scope to avoid the enum members colliding with other schema.
41
52
  * @example
42
53
  * ```typescript
54
+ * const schemaFactory = new SchemaFactory("com.myApp");
55
+ * // An enum for use in the tree. Must have string keys.
43
56
  * enum Mode {
44
57
  * a = "A",
45
58
  * b = "B",
46
59
  * }
47
- * const ModeNodes = adaptEnum(schema, Mode);
60
+ * // Define the schema for each member of the enum using a nested scope to group them together.
61
+ * const ModeNodes = adaptEnum(new SchemaFactory(`${schemaFactory.scope}.Mode`), Mode);
62
+ * // Defined the types of the nodes which correspond to this the schema.
48
63
  * type ModeNodes = NodeFromSchema<(typeof ModeNodes)[keyof typeof ModeNodes]>;
49
- * const nodeFromString: ModeNodes = ModeNodes(Mode.a);
50
- * const nodeFromSchema: ModeNodes = new ModeNodes.a();
51
- * const nameFromNode: Mode = nodeFromSchema.value;
64
+ * // An example schema which has an enum as a child.
52
65
  * class Parent extends schemaFactory.object("Parent", {
66
+ * // typedObjectValues extracts a list of all the fields of ModeNodes, which are the schema for each enum member.
67
+ * // This means any member of the enum is allowed in this field.
53
68
  * mode: typedObjectValues(ModeNodes),
54
69
  * }) {}
70
+ *
71
+ * // Example usage of enum-based nodes, showing what type to use and that `.value` can be used to read out the enum value.
72
+ * function getValue(node: ModeNodes): Mode {
73
+ * return node.value;
74
+ * }
75
+ *
76
+ * // Example constructing a tree containing an enum node from an enum value.
77
+ * // The syntax `new ModeNodes.a()` is also supported.
78
+ * function setValue(node: Parent): void {
79
+ * node.mode = ModeNodes(Mode.a);
80
+ * }
55
81
  * ```
56
82
  * @privateRemarks
57
83
  * TODO:
58
- * Extends this to support numeric enums.
59
- * Maybe require an explicit nested scope to group them under, or at least a warning about collisions.
60
- * Maybe just provide `SchemaFactory.nested` to east creating nested scopes?
61
- * @internal
84
+ * Extend this to support numeric enums.
85
+ * Maybe provide `SchemaFactory.nested` to ease creating nested scopes?
86
+ * @see {@link enumFromStrings} for a similar function that works on arrays of strings instead of an enum.
87
+ * @alpha
62
88
  */
63
89
  // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
64
90
  function adaptEnum(factory, members) {
@@ -69,7 +95,7 @@ function adaptEnum(factory, members) {
69
95
  }
70
96
  // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
71
97
  const factoryOut = (value) => {
72
- return new out[inverse.get(value) ?? (0, index_js_1.fail)("missing enum value")]({});
98
+ return new out[inverse.get(value) ?? (0, index_js_1.fail)("missing enum value")]();
73
99
  };
74
100
  const out = factoryOut;
75
101
  for (const [key, value] of Object.entries(members)) {
@@ -85,7 +111,9 @@ function adaptEnum(factory, members) {
85
111
  exports.adaptEnum = adaptEnum;
86
112
  /**
87
113
  * `Object.values`, but with more specific types.
88
- * @internal
114
+ * @remarks
115
+ * Useful with collections of schema, like those returned by {@link adaptEnum} or {@link enumFromStrings}.
116
+ * @alpha
89
117
  */
90
118
  function typedObjectValues(object) {
91
119
  return Object.values(object);
@@ -108,7 +136,8 @@ exports.typedObjectValues = typedObjectValues;
108
136
  *
109
137
  * class Parent extends schemaFactory.object("Parent", { mode: typedObjectValues(Mode) }) {}
110
138
  * ```
111
- * @internal
139
+ * @see {@link adaptEnum} for a similar function that works on enums instead of arrays of strings.
140
+ * @alpha
112
141
  */
113
142
  // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
114
143
  function enumFromStrings(factory, members) {
@@ -118,7 +147,7 @@ function enumFromStrings(factory, members) {
118
147
  }
119
148
  // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
120
149
  const factoryOut = (value) => {
121
- return new out[value]({});
150
+ return new out[value]();
122
151
  };
123
152
  const out = factoryOut;
124
153
  for (const name of members) {
@@ -132,8 +161,7 @@ function enumFromStrings(factory, members) {
132
161
  return out;
133
162
  }
134
163
  exports.enumFromStrings = enumFromStrings;
135
- // TODO: Why does this one generate an invalid d.ts file if exported?
136
- // Tracked by https://github.com/microsoft/TypeScript/issues/58688
164
+ // TODO: This generates an invalid d.ts file if exported due to a bug https://github.com/microsoft/TypeScript/issues/58688.
137
165
  // TODO: replace enumFromStrings above with this simpler implementation when the TypeScript bug is resolved.
138
166
  // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
139
167
  function _enumFromStrings2(factory, members) {
@@ -1 +1 @@
1
- {"version":3,"file":"schemaCreationUtilities.js","sourceRoot":"","sources":["../../../src/simple-tree/api/schemaCreationUtilities.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,uE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AAC;IAED,OAAO,GAAG,CAAC;AACZ,CAAC;AA3BD,0CA2BC;AAED,qEAAqE;AACrE,kEAAkE;AAClE,4GAA4G;AAC5G,4EAA4E;AAC5E,SAAS,iBAAiB,CACzB,OAA8B,EAC9B,OAAgB;IAEhB,MAAM,UAAU,GAIZ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACxB,KAAK,MAAM,IAAI,IAAI,OAAO,EAAE,CAAC;QAC5B,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,IAAI,EAAE;YACvC,UAAU,EAAE,IAAI;YAChB,YAAY,EAAE,KAAK;YACnB,QAAQ,EAAE,KAAK;YACf,KAAK,EAAE,IAAI;SACX,CAAC,CAAC;IACJ,CAAC;IAED,OAAO,SAAS,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;AACvC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { fail } from \"../../util/index.js\";\n\nimport type { SchemaFactory, ScopedSchemaName } from \"./schemaFactory.js\";\nimport type { NodeFromSchema } from \"../schemaTypes.js\";\nimport type { NodeKind, TreeNodeSchemaClass, TreeNode } from \"../core/index.js\";\nimport type {\n\tInsertableObjectFromSchemaRecord,\n\tObjectFromSchemaRecord,\n} from \"../objectNode.js\";\n\n/**\n * Empty Object for use in type computations that should contribute no fields when `&`ed with another type.\n * @internal\n */\n// Using {} instead of interface {} or Record<string, never> for empty object here produces better IntelliSense in the generated types than `Record<string, never>` recommended by the linter.\n// Making this a type instead of an interface prevents it from showing up in IntelliSense, and also avoids breaking the typing somehow.\n// eslint-disable-next-line @typescript-eslint/ban-types, @typescript-eslint/consistent-type-definitions\nexport type EmptyObject = {};\n\n/**\n * Create a schema for a node with no state.\n * @remarks\n * This is commonly used in unions when the only information needed is which kind of node the value is.\n * Enums are a common example of this pattern.\n * @internal\n */\n// Return type is intentionally derived.\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nexport function singletonSchema<TScope extends string, TName extends string | number>(\n\tfactory: SchemaFactory<TScope, TName>,\n\tname: TName,\n) {\n\tclass SingletonSchema extends factory.object(name, {}) {\n\t\tpublic constructor(data?: EmptyObject) {\n\t\t\tsuper(data ?? {});\n\t\t}\n\t\tpublic get value(): TName {\n\t\t\treturn name;\n\t\t}\n\t}\n\n\ttype NodeType = object &\n\t\tTreeNode &\n\t\tObjectFromSchemaRecord<EmptyObject> & { readonly value: TName };\n\n\t// Returning SingletonSchema without a type conversion results in TypeScript generating something like `readonly \"__#124291@#brand\": unknown;`\n\t// for the private brand field of TreeNode.\n\t// This numeric id doesn't seem to be stable over incremental builds, and thus causes diffs in the API extractor reports.\n\t// This is avoided by doing this type conversion.\n\t// The conversion is done via assignment instead of `as` to get stronger type safety.\n\tconst toReturn: TreeNodeSchemaClass<\n\t\tScopedSchemaName<TScope, TName>,\n\t\tNodeKind.Object,\n\t\tNodeType,\n\t\tobject & InsertableObjectFromSchemaRecord<EmptyObject>,\n\t\ttrue\n\t> &\n\t\t(new () => NodeType) = SingletonSchema;\n\n\treturn toReturn;\n}\n\n/**\n * Converts an enum into a collection of schema which can be used in a union.\n * @remarks\n * Currently only supports `string` enums.\n * @example\n * ```typescript\n * enum Mode {\n * \ta = \"A\",\n * \tb = \"B\",\n * }\n * const ModeNodes = adaptEnum(schema, Mode);\n * type ModeNodes = NodeFromSchema<(typeof ModeNodes)[keyof typeof ModeNodes]>;\n * const nodeFromString: ModeNodes = ModeNodes(Mode.a);\n * const nodeFromSchema: ModeNodes = new ModeNodes.a();\n * const nameFromNode: Mode = nodeFromSchema.value;\n * class Parent extends schemaFactory.object(\"Parent\", {\n * \tmode: typedObjectValues(ModeNodes),\n * }) {}\n * ```\n * @privateRemarks\n * TODO:\n * Extends this to support numeric enums.\n * Maybe require an explicit nested scope to group them under, or at least a warning about collisions.\n * Maybe just provide `SchemaFactory.nested` to east creating nested scopes?\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nexport function adaptEnum<TScope extends string, const TEnum extends Record<string, string>>(\n\tfactory: SchemaFactory<TScope>,\n\tmembers: TEnum,\n) {\n\ttype Values = TEnum[keyof TEnum];\n\tconst values = Object.values(members) as Values[];\n\tconst inverse = new Map(Object.entries(members).map(([key, value]) => [value, key])) as Map<\n\t\tValues,\n\t\tkeyof TEnum\n\t>;\n\n\tif (inverse.size !== values.length) {\n\t\tthrow new UsageError(\"All members of enums must have distinct values.\");\n\t}\n\n\ttype TOut = {\n\t\treadonly [Property in keyof TEnum]: ReturnType<\n\t\t\ttypeof singletonSchema<TScope, TEnum[Property]>\n\t\t>;\n\t};\n\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n\tconst factoryOut = <TValue extends Values>(value: TValue) => {\n\t\treturn new out[inverse.get(value) ?? fail(\"missing enum value\")]({}) as NodeFromSchema<\n\t\t\tReturnType<typeof singletonSchema<TScope, TValue>>\n\t\t>;\n\t};\n\tconst out = factoryOut as typeof factoryOut & TOut;\n\tfor (const [key, value] of Object.entries(members)) {\n\t\tObject.defineProperty(out, key, {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: false,\n\t\t\twritable: false,\n\t\t\tvalue: singletonSchema(factory, value),\n\t\t});\n\t}\n\n\treturn out;\n}\n\n/**\n * `Object.values`, but with more specific types.\n * @internal\n */\nexport function typedObjectValues<TKey extends string, TValues>(\n\tobject: Record<TKey, TValues>,\n): TValues[] {\n\treturn Object.values(object);\n}\n\n/**\n * Converts an array of distinct strings into a collection of schema which can be used like an enum style union.\n * @remarks\n * The returned collection is also a function which can be used to convert strings into {@link Unhydrated} nodes in the union.\n * Each node type has a `.value` getter which returns the associated string.\n *\n * The produced nodes use the provided strings as their `name`, and don't store any data beyond that.\n * @example\n * ```typescript\n * const Mode = enumFromStrings(schemaFactory, [\"Fun\", \"Cool\"]);\n * type Mode = NodeFromSchema<(typeof Mode)[keyof typeof Mode]>;\n * const nodeFromString: Mode = Mode(\"Fun\");\n * const nodeFromSchema: Mode = new Mode.Fun();\n * const nameFromNode = nodeFromSchema.value;\n *\n * class Parent extends schemaFactory.object(\"Parent\", { mode: typedObjectValues(Mode) }) {}\n * ```\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nexport function enumFromStrings<TScope extends string, const Members extends string>(\n\tfactory: SchemaFactory<TScope>,\n\tmembers: readonly Members[],\n) {\n\tconst names = new Set(members);\n\tif (names.size !== members.length) {\n\t\tthrow new UsageError(\"All members of enums must have distinct names\");\n\t}\n\n\ttype TOut = Record<Members, ReturnType<typeof singletonSchema<TScope, Members>>>;\n\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n\tconst factoryOut = <TValue extends Members>(value: TValue) => {\n\t\treturn new out[value]({}) as NodeFromSchema<\n\t\t\tReturnType<typeof singletonSchema<TScope, TValue>>\n\t\t>;\n\t};\n\tconst out = factoryOut as typeof factoryOut & TOut;\n\tfor (const name of members) {\n\t\tObject.defineProperty(out, name, {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: false,\n\t\t\twritable: false,\n\t\t\tvalue: singletonSchema(factory, name),\n\t\t});\n\t}\n\n\treturn out;\n}\n\n// TODO: Why does this one generate an invalid d.ts file if exported?\n// Tracked by https://github.com/microsoft/TypeScript/issues/58688\n// TODO: replace enumFromStrings above with this simpler implementation when the TypeScript bug is resolved.\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nfunction _enumFromStrings2<TScope extends string, const Members extends readonly string[]>(\n\tfactory: SchemaFactory<TScope>,\n\tmembers: Members,\n) {\n\tconst enumObject: {\n\t\t[key in keyof Members as Members[key] extends string\n\t\t\t? Members[key]\n\t\t\t: string]: Members[key] extends string ? Members[key] : string;\n\t} = Object.create(null);\n\tfor (const name of members) {\n\t\tObject.defineProperty(enumObject, name, {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: false,\n\t\t\twritable: false,\n\t\t\tvalue: name,\n\t\t});\n\t}\n\n\treturn adaptEnum(factory, enumObject);\n}\n"]}
1
+ {"version":3,"file":"schemaCreationUtilities.js","sourceRoot":"","sources":["../../../src/simple-tree/api/schemaCreationUtilities.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,uEAAsE;AAEtE,kDAA2C;AAW3C;;;;;;;GAOG;AAEH;;;;;;;GAOG;AACH,wCAAwC;AACxC,4EAA4E;AAC5E,SAAgB,eAAe,CAC9B,OAAqC,EACrC,IAAW;IAEX,MAAM,eAAgB,SAAQ,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC;QACrD,YAAmB,IAAuB;YACzC,KAAK,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC;QACnB,CAAC;QACD,IAAW,KAAK;YACf,OAAO,IAAI,CAAC;QACb,CAAC;KACD;IAID,8IAA8I;IAC9I,2CAA2C;IAC3C,yHAAyH;IACzH,iDAAiD;IACjD,qFAAqF;IACrF,MAAM,QAAQ,GAOU,eAAe,CAAC;IAExC,OAAO,QAAQ,CAAC;AACjB,CAAC;AA9BD,0CA8BC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,4EAA4E;AAC5E,SAAgB,SAAS,CAGvB,OAA8B,EAAE,OAAc;IAE/C,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAa,CAAC;IAClD,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAGlF,CAAC;IAEF,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,CAAC,MAAM,EAAE,CAAC;QACpC,MAAM,IAAI,qBAAU,CAAC,iDAAiD,CAAC,CAAC;IACzE,CAAC;IAOD,4EAA4E;IAC5E,MAAM,UAAU,GAAG,CAAw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AC,GAAG,EAAE,IAAI,EAAE;YAChC,UAAU,EAAE,IAAI;YAChB,YAAY,EAAE,KAAK;YACnB,QAAQ,EAAE,KAAK;YACf,KAAK,EAAE,eAAe,CAAC,OAAO,EAAE,IAAI,CAAC;SACrC,CAAC,CAAC;IACJ,CAAC;IAED,OAAO,GAAG,CAAC;AACZ,CAAC;AA3BD,0CA2BC;AAED,2HAA2H;AAC3H,4GAA4G;AAC5G,4EAA4E;AAC5E,SAAS,iBAAiB,CACzB,OAA8B,EAC9B,OAAgB;IAEhB,MAAM,UAAU,GAIZ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACxB,KAAK,MAAM,IAAI,IAAI,OAAO,EAAE,CAAC;QAC5B,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,IAAI,EAAE;YACvC,UAAU,EAAE,IAAI;YAChB,YAAY,EAAE,KAAK;YACnB,QAAQ,EAAE,KAAK;YACf,KAAK,EAAE,IAAI;SACX,CAAC,CAAC;IACJ,CAAC;IAED,OAAO,SAAS,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;AACvC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { fail } from \"../../util/index.js\";\n\nimport type { SchemaFactory, ScopedSchemaName } from \"./schemaFactory.js\";\nimport type { NodeFromSchema } from \"../schemaTypes.js\";\nimport type {\n\tInternalTreeNode,\n\tNodeKind,\n\tTreeNode,\n\tTreeNodeSchemaClass,\n} from \"../core/index.js\";\n\n/*\n * This file does two things:\n *\n * 1. Provides tools for making schema for cases like enums.\n *\n * 2. Demonstrates the kinds of schema utilities apps can write.\n * Nothing in here needs access to package internal APIs.\n */\n\n/**\n * Create a schema for a node with no state.\n * @remarks\n * This is commonly used in unions when the only information needed is which kind of node the value is.\n * Enums are a common example of this pattern.\n * @see {@link adaptEnum}\n * @alpha\n */\n// Return type is intentionally derived.\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nexport function singletonSchema<TScope extends string, TName extends string | number>(\n\tfactory: SchemaFactory<TScope, TName>,\n\tname: TName,\n) {\n\tclass SingletonSchema extends factory.object(name, {}) {\n\t\tpublic constructor(data?: InternalTreeNode) {\n\t\t\tsuper(data ?? {});\n\t\t}\n\t\tpublic get value(): TName {\n\t\t\treturn name;\n\t\t}\n\t}\n\n\ttype NodeType = TreeNode & { readonly value: TName };\n\n\t// Returning SingletonSchema without a type conversion results in TypeScript generating something like `readonly \"__#124291@#brand\": unknown;`\n\t// for the private brand field of TreeNode.\n\t// This numeric id doesn't seem to be stable over incremental builds, and thus causes diffs in the API extractor reports.\n\t// This is avoided by doing this type conversion.\n\t// The conversion is done via assignment instead of `as` to get stronger type safety.\n\tconst toReturn: TreeNodeSchemaClass<\n\t\tScopedSchemaName<TScope, TName>,\n\t\tNodeKind.Object,\n\t\tNodeType,\n\t\tnever,\n\t\ttrue\n\t> &\n\t\t(new () => NodeType) = SingletonSchema;\n\n\treturn toReturn;\n}\n\n/**\n * Converts an enum into a collection of schema which can be used in a union.\n * @remarks\n * Currently only supports `string` enums.\n * The string value of the enum is used as the name of the schema: callers must ensure that it is stable and unique.\n * Consider making a dedicated schema factory with a nested scope to avoid the enum members colliding with other schema.\n * @example\n * ```typescript\n * const schemaFactory = new SchemaFactory(\"com.myApp\");\n * // An enum for use in the tree. Must have string keys.\n * enum Mode {\n * \ta = \"A\",\n * \tb = \"B\",\n * }\n * // Define the schema for each member of the enum using a nested scope to group them together.\n * const ModeNodes = adaptEnum(new SchemaFactory(`${schemaFactory.scope}.Mode`), Mode);\n * // Defined the types of the nodes which correspond to this the schema.\n * type ModeNodes = NodeFromSchema<(typeof ModeNodes)[keyof typeof ModeNodes]>;\n * // An example schema which has an enum as a child.\n * class Parent extends schemaFactory.object(\"Parent\", {\n * \t// typedObjectValues extracts a list of all the fields of ModeNodes, which are the schema for each enum member.\n * \t// This means any member of the enum is allowed in this field.\n * \tmode: typedObjectValues(ModeNodes),\n * }) {}\n *\n * // Example usage of enum-based nodes, showing what type to use and that `.value` can be used to read out the enum value.\n * function getValue(node: ModeNodes): Mode {\n * \treturn node.value;\n * }\n *\n * // Example constructing a tree containing an enum node from an enum value.\n * // The syntax `new ModeNodes.a()` is also supported.\n * function setValue(node: Parent): void {\n * \tnode.mode = ModeNodes(Mode.a);\n * }\n * ```\n * @privateRemarks\n * TODO:\n * Extend this to support numeric enums.\n * Maybe provide `SchemaFactory.nested` to ease creating nested scopes?\n * @see {@link enumFromStrings} for a similar function that works on arrays of strings instead of an enum.\n * @alpha\n */\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nexport function adaptEnum<\n\tTScope extends string,\n\tconst TEnum extends Record<string, string | number>,\n>(factory: SchemaFactory<TScope>, members: TEnum) {\n\ttype Values = TEnum[keyof TEnum];\n\tconst values = Object.values(members) as Values[];\n\tconst inverse = new Map(Object.entries(members).map(([key, value]) => [value, key])) as Map<\n\t\tValues,\n\t\tkeyof TEnum\n\t>;\n\n\tif (inverse.size !== values.length) {\n\t\tthrow new UsageError(\"All members of enums must have distinct values.\");\n\t}\n\n\ttype TOut = {\n\t\treadonly [Property in keyof TEnum]: ReturnType<\n\t\t\ttypeof singletonSchema<TScope, TEnum[Property]>\n\t\t>;\n\t};\n\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n\tconst factoryOut = <TValue extends Values>(value: TValue) => {\n\t\treturn new out[inverse.get(value) ?? fail(\"missing enum value\")]() as NodeFromSchema<\n\t\t\tReturnType<typeof singletonSchema<TScope, TValue>>\n\t\t>;\n\t};\n\tconst out = factoryOut as typeof factoryOut & TOut;\n\tfor (const [key, value] of Object.entries(members)) {\n\t\tObject.defineProperty(out, key, {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: false,\n\t\t\twritable: false,\n\t\t\tvalue: singletonSchema(factory, value),\n\t\t});\n\t}\n\n\treturn out;\n}\n\n/**\n * `Object.values`, but with more specific types.\n * @remarks\n * Useful with collections of schema, like those returned by {@link adaptEnum} or {@link enumFromStrings}.\n * @alpha\n */\nexport function typedObjectValues<TKey extends string, TValues>(\n\tobject: Record<TKey, TValues>,\n): TValues[] {\n\treturn Object.values(object);\n}\n\n/**\n * Converts an array of distinct strings into a collection of schema which can be used like an enum style union.\n * @remarks\n * The returned collection is also a function which can be used to convert strings into {@link Unhydrated} nodes in the union.\n * Each node type has a `.value` getter which returns the associated string.\n *\n * The produced nodes use the provided strings as their `name`, and don't store any data beyond that.\n * @example\n * ```typescript\n * const Mode = enumFromStrings(schemaFactory, [\"Fun\", \"Cool\"]);\n * type Mode = NodeFromSchema<(typeof Mode)[keyof typeof Mode]>;\n * const nodeFromString: Mode = Mode(\"Fun\");\n * const nodeFromSchema: Mode = new Mode.Fun();\n * const nameFromNode = nodeFromSchema.value;\n *\n * class Parent extends schemaFactory.object(\"Parent\", { mode: typedObjectValues(Mode) }) {}\n * ```\n * @see {@link adaptEnum} for a similar function that works on enums instead of arrays of strings.\n * @alpha\n */\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nexport function enumFromStrings<TScope extends string, const Members extends string>(\n\tfactory: SchemaFactory<TScope>,\n\tmembers: readonly Members[],\n) {\n\tconst names = new Set(members);\n\tif (names.size !== members.length) {\n\t\tthrow new UsageError(\"All members of enums must have distinct names\");\n\t}\n\n\ttype TOut = Record<Members, ReturnType<typeof singletonSchema<TScope, Members>>>;\n\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n\tconst factoryOut = <TValue extends Members>(value: TValue) => {\n\t\treturn new out[value]() as NodeFromSchema<\n\t\t\tReturnType<typeof singletonSchema<TScope, TValue>>\n\t\t>;\n\t};\n\tconst out = factoryOut as typeof factoryOut & TOut;\n\tfor (const name of members) {\n\t\tObject.defineProperty(out, name, {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: false,\n\t\t\twritable: false,\n\t\t\tvalue: singletonSchema(factory, name),\n\t\t});\n\t}\n\n\treturn out;\n}\n\n// TODO: This generates an invalid d.ts file if exported due to a bug https://github.com/microsoft/TypeScript/issues/58688.\n// TODO: replace enumFromStrings above with this simpler implementation when the TypeScript bug is resolved.\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nfunction _enumFromStrings2<TScope extends string, const Members extends readonly string[]>(\n\tfactory: SchemaFactory<TScope>,\n\tmembers: Members,\n) {\n\tconst enumObject: {\n\t\t[key in keyof Members as Members[key] extends string\n\t\t\t? Members[key]\n\t\t\t: string]: Members[key] extends string ? Members[key] : string;\n\t} = Object.create(null);\n\tfor (const name of members) {\n\t\tObject.defineProperty(enumObject, name, {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: false,\n\t\t\twritable: false,\n\t\t\tvalue: name,\n\t\t});\n\t}\n\n\treturn adaptEnum(factory, enumObject);\n}\n"]}
@@ -4,14 +4,13 @@
4
4
  */
5
5
  import type { IFluidHandle as _dummyImport } from "@fluidframework/core-interfaces";
6
6
  import type { TreeValue } from "../../core/index.js";
7
- import { type Unenforced } from "../../feature-libraries/index.js";
8
7
  import { type RestrictiveStringRecord } from "../../util/index.js";
9
8
  import { FieldKind, type FieldSchema, type ImplicitAllowedTypes, type ImplicitFieldSchema, type InsertableTreeNodeFromImplicitAllowedTypes, type FieldProps } from "../schemaTypes.js";
10
9
  import type { NodeKind, WithType, TreeNodeSchema, TreeNodeSchemaClass, TreeNodeSchemaNonClass } from "../core/index.js";
11
10
  import { type TreeArrayNode } from "../arrayNode.js";
12
11
  import { type InsertableObjectFromSchemaRecord, type TreeObjectNode } from "../objectNode.js";
13
12
  import { type MapNodeInsertableData, type TreeMapNode } from "../mapNode.js";
14
- import type { FieldSchemaUnsafe, FieldHasDefaultUnsafe, InsertableTreeFieldFromImplicitFieldUnsafe, InsertableTreeNodeFromImplicitAllowedTypesUnsafe, TreeArrayNodeUnsafe, TreeMapNodeUnsafe, TreeObjectNodeUnsafe } from "../typesUnsafe.js";
13
+ import type { FieldSchemaUnsafe, FieldHasDefaultUnsafe, InsertableTreeFieldFromImplicitFieldUnsafe, InsertableTreeNodeFromImplicitAllowedTypesUnsafe, TreeArrayNodeUnsafe, TreeMapNodeUnsafe, TreeObjectNodeUnsafe, Unenforced } from "./typesUnsafe.js";
15
14
  /**
16
15
  * Gets the leaf domain schema compatible with a given {@link TreeValue}.
17
16
  */
@@ -1 +1 @@
1
- {"version":3,"file":"schemaFactory.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/schemaFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,KAAK,EAAE,YAAY,IAAI,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAIpF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAEN,KAAK,UAAU,EAEf,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACN,KAAK,uBAAuB,EAG5B,MAAM,qBAAqB,CAAC;AAU7B,OAAO,EACN,SAAS,EACT,KAAK,WAAW,EAChB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,0CAA0C,EAC/C,KAAK,UAAU,EAIf,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EACX,QAAQ,EACR,QAAQ,EACR,cAAc,EACd,mBAAmB,EACnB,sBAAsB,EAEtB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,KAAK,aAAa,EAAe,MAAM,iBAAiB,CAAC;AAClE,OAAO,EACN,KAAK,gCAAgC,EACrC,KAAK,cAAc,EAEnB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,KAAK,qBAAqB,EAAE,KAAK,WAAW,EAAa,MAAM,eAAe,CAAC;AACxF,OAAO,KAAK,EACX,iBAAiB,EAMjB,qBAAqB,EAErB,0CAA0C,EAE1C,gDAAgD,EAChD,mBAAmB,EACnB,iBAAiB,EACjB,oBAAoB,EACpB,MAAM,mBAAmB,CAAC;AAG3B;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,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CAAC;SAAC,CAC7D;;CAQJ;AAED,wBAAgB,cAAc,CAAC,KAAK,CAAC,CAAC,SAAS,MAAM,EACpD,cAAc,EAAE,CAAC,EACjB,YAAY,EAAE,cAAc,GAAG,SAAS,cAAc,EAAE,GACtD,GAAG,CAAC,IAAI,MAAM,GAAG,CAmBnB;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,cAAc,GAAG,IAAI,CAelE"}
@@ -8,16 +8,16 @@ exports.markSchemaMostDerived = exports.structuralName = exports.SchemaFactory =
8
8
  const internal_1 = require("@fluidframework/core-utils/internal");
9
9
  const internal_2 = require("@fluidframework/telemetry-utils/internal");
10
10
  const internal_3 = require("@fluidframework/runtime-utils/internal");
11
- const index_js_1 = require("../../feature-libraries/index.js");
12
- const index_js_2 = require("../../util/index.js");
11
+ const index_js_1 = require("../../util/index.js");
13
12
  const leafNodeSchema_js_1 = require("../leafNodeSchema.js");
14
13
  const schemaTypes_js_1 = require("../schemaTypes.js");
15
- const index_js_3 = require("../core/index.js");
14
+ const index_js_2 = require("../core/index.js");
16
15
  const arrayNode_js_1 = require("../arrayNode.js");
17
16
  const objectNode_js_1 = require("../objectNode.js");
18
17
  const mapNode_js_1 = require("../mapNode.js");
19
18
  const schemaFactoryRecursive_js_1 = require("./schemaFactoryRecursive.js");
20
19
  const treeNodeValid_js_1 = require("../treeNodeValid.js");
20
+ const flexList_js_1 = require("../flexList.js");
21
21
  /**
22
22
  * Gets the leaf domain schema compatible with a given {@link TreeValue}.
23
23
  */
@@ -225,7 +225,7 @@ class SchemaFactory {
225
225
  if (allowedTypes === undefined) {
226
226
  const types = nameOrAllowedTypes;
227
227
  const fullName = structuralName("Map", types);
228
- return (0, index_js_2.getOrCreate)(this.structuralTypes, fullName, () => this.namedMap(fullName, nameOrAllowedTypes, false, true));
228
+ return (0, index_js_1.getOrCreate)(this.structuralTypes, fullName, () => this.namedMap(fullName, nameOrAllowedTypes, false, true));
229
229
  }
230
230
  // To actually have type safety, assign to the type this method should return before implicitly upcasting when returning.
231
231
  const out = this.namedMap(nameOrAllowedTypes, allowedTypes, true, true);
@@ -249,7 +249,7 @@ class SchemaFactory {
249
249
  if (allowedTypes === undefined) {
250
250
  const types = nameOrAllowedTypes;
251
251
  const fullName = structuralName("Array", types);
252
- return (0, index_js_2.getOrCreate)(this.structuralTypes, fullName, () => this.namedArray(fullName, nameOrAllowedTypes, false, true));
252
+ return (0, index_js_1.getOrCreate)(this.structuralTypes, fullName, () => this.namedArray(fullName, nameOrAllowedTypes, false, true));
253
253
  }
254
254
  const out = this.namedArray(nameOrAllowedTypes, allowedTypes, true, true);
255
255
  return out;
@@ -391,13 +391,13 @@ class SchemaFactory {
391
391
  exports.SchemaFactory = SchemaFactory;
392
392
  function structuralName(collectionName, allowedTypes) {
393
393
  let inner;
394
- if (!(0, index_js_2.isReadonlyArray)(allowedTypes)) {
394
+ if (!(0, index_js_1.isReadonlyArray)(allowedTypes)) {
395
395
  return structuralName(collectionName, [allowedTypes]);
396
396
  }
397
397
  else {
398
398
  const names = allowedTypes.map((t) => {
399
399
  // Ensure that lazy types (functions) don't slip through here.
400
- (0, internal_1.assert)(!(0, index_js_1.isLazy)(t), 0x83d /* invalid type provided */);
400
+ (0, internal_1.assert)(!(0, flexList_js_1.isLazy)(t), 0x83d /* invalid type provided */);
401
401
  markSchemaMostDerived(t);
402
402
  return t.identifier;
403
403
  });
@@ -422,7 +422,7 @@ function markSchemaMostDerived(schema) {
422
422
  if (schema instanceof leafNodeSchema_js_1.LeafNodeSchema) {
423
423
  return;
424
424
  }
425
- if (!(0, index_js_3.inPrototypeChain)(schema, treeNodeValid_js_1.TreeNodeValid)) {
425
+ if (!(0, index_js_2.inPrototypeChain)(schema, treeNodeValid_js_1.TreeNodeValid)) {
426
426
  // Use JSON.stringify to quote and escape identifier string.
427
427
  throw new internal_2.UsageError(`Schema for ${JSON.stringify(schema.identifier)} does not extend a SchemaFactory generated class. This is invalid.`);
428
428
  }