@fluidframework/tree 2.22.1 → 2.23.0-325054

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 (515) hide show
  1. package/.vscode/extensions.json +1 -0
  2. package/.vscode/settings.json +1 -0
  3. package/CHANGELOG.md +47 -0
  4. package/api-report/tree.alpha.api.md +169 -10
  5. package/api-report/tree.beta.api.md +101 -9
  6. package/api-report/tree.legacy.alpha.api.md +101 -9
  7. package/api-report/tree.legacy.public.api.md +101 -9
  8. package/api-report/tree.public.api.md +101 -9
  9. package/dist/alpha.d.ts +20 -0
  10. package/dist/beta.d.ts +15 -0
  11. package/dist/codec/codec.js +3 -3
  12. package/dist/codec/codec.js.map +1 -1
  13. package/dist/codec/discriminatedUnions.d.ts.map +1 -1
  14. package/dist/codec/discriminatedUnions.js +1 -1
  15. package/dist/codec/discriminatedUnions.js.map +1 -1
  16. package/dist/core/schema-stored/schema.d.ts.map +1 -1
  17. package/dist/core/schema-stored/schema.js +3 -3
  18. package/dist/core/schema-stored/schema.js.map +1 -1
  19. package/dist/core/tree/anchorSet.d.ts.map +1 -1
  20. package/dist/core/tree/anchorSet.js +18 -13
  21. package/dist/core/tree/anchorSet.js.map +1 -1
  22. package/dist/core/tree/treeTextFormat.js +1 -1
  23. package/dist/core/tree/treeTextFormat.js.map +1 -1
  24. package/dist/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
  25. package/dist/feature-libraries/chunked-forest/basicChunk.js +11 -8
  26. package/dist/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
  27. package/dist/feature-libraries/chunked-forest/chunkTree.js +2 -2
  28. package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  29. package/dist/feature-libraries/chunked-forest/chunkedForest.js +3 -3
  30. package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  31. package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js +2 -2
  32. package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
  33. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
  34. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +4 -3
  35. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  36. package/dist/feature-libraries/chunked-forest/codec/nodeShape.js +2 -2
  37. package/dist/feature-libraries/chunked-forest/codec/nodeShape.js.map +1 -1
  38. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncoding.d.ts.map +1 -1
  39. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncoding.js +3 -3
  40. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncoding.js.map +1 -1
  41. package/dist/feature-libraries/chunked-forest/emptyChunk.js +14 -14
  42. package/dist/feature-libraries/chunked-forest/emptyChunk.js.map +1 -1
  43. package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
  44. package/dist/feature-libraries/chunked-forest/uniformChunk.js +6 -4
  45. package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  46. package/dist/feature-libraries/default-schema/defaultFieldKinds.js +1 -1
  47. package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  48. package/dist/feature-libraries/default-schema/schemaChecker.js +1 -1
  49. package/dist/feature-libraries/default-schema/schemaChecker.js.map +1 -1
  50. package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  51. package/dist/feature-libraries/flex-tree/lazyField.js +4 -3
  52. package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
  53. package/dist/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  54. package/dist/feature-libraries/flex-tree/lazyNode.js +5 -4
  55. package/dist/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  56. package/dist/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -1
  57. package/dist/feature-libraries/indexing/anchorTreeIndex.js +1 -1
  58. package/dist/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
  59. package/dist/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
  60. package/dist/feature-libraries/modular-schema/comparison.js +6 -4
  61. package/dist/feature-libraries/modular-schema/comparison.js.map +1 -1
  62. package/dist/feature-libraries/modular-schema/isNeverTree.d.ts.map +1 -1
  63. package/dist/feature-libraries/modular-schema/isNeverTree.js +4 -4
  64. package/dist/feature-libraries/modular-schema/isNeverTree.js.map +1 -1
  65. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js +4 -4
  66. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  67. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  68. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +10 -11
  69. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  70. package/dist/feature-libraries/node-key/mockNodeKeyManager.js +1 -1
  71. package/dist/feature-libraries/node-key/mockNodeKeyManager.js.map +1 -1
  72. package/dist/feature-libraries/object-forest/objectForest.js +1 -1
  73. package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
  74. package/dist/feature-libraries/schema-index/codec.js +1 -1
  75. package/dist/feature-libraries/schema-index/codec.js.map +1 -1
  76. package/dist/feature-libraries/sequence-field/compose.js +1 -1
  77. package/dist/feature-libraries/sequence-field/compose.js.map +1 -1
  78. package/dist/feature-libraries/sequence-field/invert.js +1 -1
  79. package/dist/feature-libraries/sequence-field/invert.js.map +1 -1
  80. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js +1 -1
  81. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +1 -1
  82. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js +1 -1
  83. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
  84. package/dist/feature-libraries/sequence-field/utils.js +1 -1
  85. package/dist/feature-libraries/sequence-field/utils.js.map +1 -1
  86. package/dist/feature-libraries/treeCursorUtils.d.ts.map +1 -1
  87. package/dist/feature-libraries/treeCursorUtils.js +6 -4
  88. package/dist/feature-libraries/treeCursorUtils.js.map +1 -1
  89. package/dist/index.d.ts +4 -2
  90. package/dist/index.d.ts.map +1 -1
  91. package/dist/index.js +10 -1
  92. package/dist/index.js.map +1 -1
  93. package/dist/jsonDomainSchema.d.ts +113 -0
  94. package/dist/jsonDomainSchema.d.ts.map +1 -0
  95. package/dist/jsonDomainSchema.js +101 -0
  96. package/dist/jsonDomainSchema.js.map +1 -0
  97. package/dist/legacy.d.ts +15 -0
  98. package/dist/packageVersion.d.ts +1 -1
  99. package/dist/packageVersion.d.ts.map +1 -1
  100. package/dist/packageVersion.js +1 -1
  101. package/dist/packageVersion.js.map +1 -1
  102. package/dist/public.d.ts +15 -0
  103. package/dist/serializableDomainSchema.d.ts +108 -0
  104. package/dist/serializableDomainSchema.d.ts.map +1 -0
  105. package/dist/serializableDomainSchema.js +90 -0
  106. package/dist/serializableDomainSchema.js.map +1 -0
  107. package/dist/shared-tree/index.d.ts +1 -1
  108. package/dist/shared-tree/index.d.ts.map +1 -1
  109. package/dist/shared-tree/index.js.map +1 -1
  110. package/dist/shared-tree/schematizeTree.js +1 -1
  111. package/dist/shared-tree/schematizeTree.js.map +1 -1
  112. package/dist/shared-tree/sharedTree.d.ts +37 -20
  113. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  114. package/dist/shared-tree/sharedTree.js +17 -17
  115. package/dist/shared-tree/sharedTree.js.map +1 -1
  116. package/dist/shared-tree/sharedTreeChangeFamily.js +1 -1
  117. package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  118. package/dist/shared-tree/treeApiAlpha.d.ts.map +1 -1
  119. package/dist/shared-tree/treeApiAlpha.js +4 -4
  120. package/dist/shared-tree/treeApiAlpha.js.map +1 -1
  121. package/dist/shared-tree/treeCheckout.js +1 -1
  122. package/dist/shared-tree/treeCheckout.js.map +1 -1
  123. package/dist/shared-tree-core/editManager.d.ts +11 -2
  124. package/dist/shared-tree-core/editManager.d.ts.map +1 -1
  125. package/dist/shared-tree-core/editManager.js +70 -34
  126. package/dist/shared-tree-core/editManager.js.map +1 -1
  127. package/dist/shared-tree-core/resubmitMachine.d.ts +2 -0
  128. package/dist/shared-tree-core/resubmitMachine.d.ts.map +1 -1
  129. package/dist/shared-tree-core/resubmitMachine.js.map +1 -1
  130. package/dist/shared-tree-core/sharedTreeCore.d.ts +10 -3
  131. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  132. package/dist/shared-tree-core/sharedTreeCore.js +42 -7
  133. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  134. package/dist/simple-tree/api/component.d.ts +30 -0
  135. package/dist/simple-tree/api/component.d.ts.map +1 -0
  136. package/dist/simple-tree/api/component.js +26 -0
  137. package/dist/simple-tree/api/component.js.map +1 -0
  138. package/dist/simple-tree/api/customTree.js +3 -3
  139. package/dist/simple-tree/api/customTree.js.map +1 -1
  140. package/dist/simple-tree/api/index.d.ts +2 -1
  141. package/dist/simple-tree/api/index.d.ts.map +1 -1
  142. package/dist/simple-tree/api/index.js +3 -1
  143. package/dist/simple-tree/api/index.js.map +1 -1
  144. package/dist/simple-tree/api/schemaCreationUtilities.js +1 -1
  145. package/dist/simple-tree/api/schemaCreationUtilities.js.map +1 -1
  146. package/dist/simple-tree/api/schemaFactory.d.ts +0 -8
  147. package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
  148. package/dist/simple-tree/api/schemaFactory.js +4 -25
  149. package/dist/simple-tree/api/schemaFactory.js.map +1 -1
  150. package/dist/simple-tree/api/schemaFactoryRecursive.d.ts +1 -1
  151. package/dist/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
  152. package/dist/simple-tree/api/simpleTreeIndex.js +3 -3
  153. package/dist/simple-tree/api/simpleTreeIndex.js.map +1 -1
  154. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  155. package/dist/simple-tree/api/tree.js +2 -3
  156. package/dist/simple-tree/api/tree.js.map +1 -1
  157. package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  158. package/dist/simple-tree/api/treeNodeApi.js +7 -18
  159. package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
  160. package/dist/simple-tree/api/typesUnsafe.d.ts +127 -19
  161. package/dist/simple-tree/api/typesUnsafe.d.ts.map +1 -1
  162. package/dist/simple-tree/api/typesUnsafe.js +17 -0
  163. package/dist/simple-tree/api/typesUnsafe.js.map +1 -1
  164. package/dist/simple-tree/api/verboseTree.d.ts.map +1 -1
  165. package/dist/simple-tree/api/verboseTree.js +5 -4
  166. package/dist/simple-tree/api/verboseTree.js.map +1 -1
  167. package/dist/simple-tree/api/view.js +1 -1
  168. package/dist/simple-tree/api/view.js.map +1 -1
  169. package/dist/simple-tree/arrayNode.d.ts +1 -1
  170. package/dist/simple-tree/arrayNode.d.ts.map +1 -1
  171. package/dist/simple-tree/arrayNode.js +2 -2
  172. package/dist/simple-tree/arrayNode.js.map +1 -1
  173. package/dist/simple-tree/core/getOrCreateNode.d.ts.map +1 -1
  174. package/dist/simple-tree/core/getOrCreateNode.js +1 -1
  175. package/dist/simple-tree/core/getOrCreateNode.js.map +1 -1
  176. package/dist/simple-tree/core/schemaCaching.js +1 -1
  177. package/dist/simple-tree/core/schemaCaching.js.map +1 -1
  178. package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  179. package/dist/simple-tree/core/treeNodeKernel.js +6 -6
  180. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
  181. package/dist/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  182. package/dist/simple-tree/core/unhydratedFlexTree.js +5 -5
  183. package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  184. package/dist/simple-tree/flexList.d.ts +4 -5
  185. package/dist/simple-tree/flexList.d.ts.map +1 -1
  186. package/dist/simple-tree/flexList.js +1 -14
  187. package/dist/simple-tree/flexList.js.map +1 -1
  188. package/dist/simple-tree/index.d.ts +4 -4
  189. package/dist/simple-tree/index.d.ts.map +1 -1
  190. package/dist/simple-tree/index.js +6 -2
  191. package/dist/simple-tree/index.js.map +1 -1
  192. package/dist/simple-tree/objectNode.d.ts +25 -2
  193. package/dist/simple-tree/objectNode.d.ts.map +1 -1
  194. package/dist/simple-tree/objectNode.js +4 -2
  195. package/dist/simple-tree/objectNode.js.map +1 -1
  196. package/dist/simple-tree/proxies.js +1 -1
  197. package/dist/simple-tree/proxies.js.map +1 -1
  198. package/dist/simple-tree/schemaTypes.d.ts +211 -9
  199. package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
  200. package/dist/simple-tree/schemaTypes.js +83 -2
  201. package/dist/simple-tree/schemaTypes.js.map +1 -1
  202. package/dist/simple-tree/toMapTree.js +3 -3
  203. package/dist/simple-tree/toMapTree.js.map +1 -1
  204. package/dist/simple-tree/toStoredSchema.d.ts.map +1 -1
  205. package/dist/simple-tree/toStoredSchema.js +3 -6
  206. package/dist/simple-tree/toStoredSchema.js.map +1 -1
  207. package/dist/simple-tree/treeNodeValid.d.ts +7 -1
  208. package/dist/simple-tree/treeNodeValid.d.ts.map +1 -1
  209. package/dist/simple-tree/treeNodeValid.js +18 -7
  210. package/dist/simple-tree/treeNodeValid.js.map +1 -1
  211. package/dist/util/idAllocator.js +1 -1
  212. package/dist/util/idAllocator.js.map +1 -1
  213. package/dist/util/index.d.ts +2 -2
  214. package/dist/util/index.d.ts.map +1 -1
  215. package/dist/util/index.js +5 -4
  216. package/dist/util/index.js.map +1 -1
  217. package/dist/util/nestedMap.d.ts +2 -10
  218. package/dist/util/nestedMap.d.ts.map +1 -1
  219. package/dist/util/nestedMap.js +9 -28
  220. package/dist/util/nestedMap.js.map +1 -1
  221. package/dist/util/utils.d.ts +23 -6
  222. package/dist/util/utils.d.ts.map +1 -1
  223. package/dist/util/utils.js +46 -13
  224. package/dist/util/utils.js.map +1 -1
  225. package/lib/alpha.d.ts +20 -0
  226. package/lib/beta.d.ts +15 -0
  227. package/lib/codec/codec.js +3 -3
  228. package/lib/codec/codec.js.map +1 -1
  229. package/lib/codec/discriminatedUnions.d.ts.map +1 -1
  230. package/lib/codec/discriminatedUnions.js +1 -1
  231. package/lib/codec/discriminatedUnions.js.map +1 -1
  232. package/lib/core/schema-stored/schema.d.ts.map +1 -1
  233. package/lib/core/schema-stored/schema.js +3 -3
  234. package/lib/core/schema-stored/schema.js.map +1 -1
  235. package/lib/core/tree/anchorSet.d.ts.map +1 -1
  236. package/lib/core/tree/anchorSet.js +19 -14
  237. package/lib/core/tree/anchorSet.js.map +1 -1
  238. package/lib/core/tree/treeTextFormat.js +1 -1
  239. package/lib/core/tree/treeTextFormat.js.map +1 -1
  240. package/lib/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
  241. package/lib/feature-libraries/chunked-forest/basicChunk.js +11 -8
  242. package/lib/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
  243. package/lib/feature-libraries/chunked-forest/chunkTree.js +2 -2
  244. package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  245. package/lib/feature-libraries/chunked-forest/chunkedForest.js +3 -3
  246. package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  247. package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js +2 -2
  248. package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
  249. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
  250. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +4 -3
  251. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  252. package/lib/feature-libraries/chunked-forest/codec/nodeShape.js +2 -2
  253. package/lib/feature-libraries/chunked-forest/codec/nodeShape.js.map +1 -1
  254. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncoding.d.ts.map +1 -1
  255. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncoding.js +3 -3
  256. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncoding.js.map +1 -1
  257. package/lib/feature-libraries/chunked-forest/emptyChunk.js +14 -14
  258. package/lib/feature-libraries/chunked-forest/emptyChunk.js.map +1 -1
  259. package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
  260. package/lib/feature-libraries/chunked-forest/uniformChunk.js +6 -4
  261. package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  262. package/lib/feature-libraries/default-schema/defaultFieldKinds.js +1 -1
  263. package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  264. package/lib/feature-libraries/default-schema/schemaChecker.js +1 -1
  265. package/lib/feature-libraries/default-schema/schemaChecker.js.map +1 -1
  266. package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  267. package/lib/feature-libraries/flex-tree/lazyField.js +4 -3
  268. package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
  269. package/lib/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  270. package/lib/feature-libraries/flex-tree/lazyNode.js +5 -4
  271. package/lib/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  272. package/lib/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -1
  273. package/lib/feature-libraries/indexing/anchorTreeIndex.js +1 -1
  274. package/lib/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
  275. package/lib/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
  276. package/lib/feature-libraries/modular-schema/comparison.js +6 -4
  277. package/lib/feature-libraries/modular-schema/comparison.js.map +1 -1
  278. package/lib/feature-libraries/modular-schema/isNeverTree.d.ts.map +1 -1
  279. package/lib/feature-libraries/modular-schema/isNeverTree.js +4 -4
  280. package/lib/feature-libraries/modular-schema/isNeverTree.js.map +1 -1
  281. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js +4 -4
  282. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  283. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  284. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +11 -12
  285. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  286. package/lib/feature-libraries/node-key/mockNodeKeyManager.js +1 -1
  287. package/lib/feature-libraries/node-key/mockNodeKeyManager.js.map +1 -1
  288. package/lib/feature-libraries/object-forest/objectForest.js +1 -1
  289. package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
  290. package/lib/feature-libraries/schema-index/codec.js +1 -1
  291. package/lib/feature-libraries/schema-index/codec.js.map +1 -1
  292. package/lib/feature-libraries/sequence-field/compose.js +1 -1
  293. package/lib/feature-libraries/sequence-field/compose.js.map +1 -1
  294. package/lib/feature-libraries/sequence-field/invert.js +1 -1
  295. package/lib/feature-libraries/sequence-field/invert.js.map +1 -1
  296. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js +1 -1
  297. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +1 -1
  298. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js +1 -1
  299. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
  300. package/lib/feature-libraries/sequence-field/utils.js +1 -1
  301. package/lib/feature-libraries/sequence-field/utils.js.map +1 -1
  302. package/lib/feature-libraries/treeCursorUtils.d.ts.map +1 -1
  303. package/lib/feature-libraries/treeCursorUtils.js +6 -4
  304. package/lib/feature-libraries/treeCursorUtils.js.map +1 -1
  305. package/lib/index.d.ts +4 -2
  306. package/lib/index.d.ts.map +1 -1
  307. package/lib/index.js +3 -1
  308. package/lib/index.js.map +1 -1
  309. package/lib/jsonDomainSchema.d.ts +113 -0
  310. package/lib/jsonDomainSchema.d.ts.map +1 -0
  311. package/lib/jsonDomainSchema.js +98 -0
  312. package/lib/jsonDomainSchema.js.map +1 -0
  313. package/lib/legacy.d.ts +15 -0
  314. package/lib/packageVersion.d.ts +1 -1
  315. package/lib/packageVersion.d.ts.map +1 -1
  316. package/lib/packageVersion.js +1 -1
  317. package/lib/packageVersion.js.map +1 -1
  318. package/lib/public.d.ts +15 -0
  319. package/lib/serializableDomainSchema.d.ts +108 -0
  320. package/lib/serializableDomainSchema.d.ts.map +1 -0
  321. package/lib/serializableDomainSchema.js +87 -0
  322. package/lib/serializableDomainSchema.js.map +1 -0
  323. package/lib/shared-tree/index.d.ts +1 -1
  324. package/lib/shared-tree/index.d.ts.map +1 -1
  325. package/lib/shared-tree/index.js.map +1 -1
  326. package/lib/shared-tree/schematizeTree.js +1 -1
  327. package/lib/shared-tree/schematizeTree.js.map +1 -1
  328. package/lib/shared-tree/sharedTree.d.ts +37 -20
  329. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  330. package/lib/shared-tree/sharedTree.js +18 -18
  331. package/lib/shared-tree/sharedTree.js.map +1 -1
  332. package/lib/shared-tree/sharedTreeChangeFamily.js +1 -1
  333. package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  334. package/lib/shared-tree/treeApiAlpha.d.ts.map +1 -1
  335. package/lib/shared-tree/treeApiAlpha.js +4 -4
  336. package/lib/shared-tree/treeApiAlpha.js.map +1 -1
  337. package/lib/shared-tree/treeCheckout.js +1 -1
  338. package/lib/shared-tree/treeCheckout.js.map +1 -1
  339. package/lib/shared-tree-core/editManager.d.ts +11 -2
  340. package/lib/shared-tree-core/editManager.d.ts.map +1 -1
  341. package/lib/shared-tree-core/editManager.js +70 -34
  342. package/lib/shared-tree-core/editManager.js.map +1 -1
  343. package/lib/shared-tree-core/resubmitMachine.d.ts +2 -0
  344. package/lib/shared-tree-core/resubmitMachine.d.ts.map +1 -1
  345. package/lib/shared-tree-core/resubmitMachine.js.map +1 -1
  346. package/lib/shared-tree-core/sharedTreeCore.d.ts +10 -3
  347. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  348. package/lib/shared-tree-core/sharedTreeCore.js +42 -7
  349. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  350. package/lib/simple-tree/api/component.d.ts +30 -0
  351. package/lib/simple-tree/api/component.d.ts.map +1 -0
  352. package/lib/simple-tree/api/component.js +23 -0
  353. package/lib/simple-tree/api/component.js.map +1 -0
  354. package/lib/simple-tree/api/customTree.js +3 -3
  355. package/lib/simple-tree/api/customTree.js.map +1 -1
  356. package/lib/simple-tree/api/index.d.ts +2 -1
  357. package/lib/simple-tree/api/index.d.ts.map +1 -1
  358. package/lib/simple-tree/api/index.js +1 -0
  359. package/lib/simple-tree/api/index.js.map +1 -1
  360. package/lib/simple-tree/api/schemaCreationUtilities.js +1 -1
  361. package/lib/simple-tree/api/schemaCreationUtilities.js.map +1 -1
  362. package/lib/simple-tree/api/schemaFactory.d.ts +0 -8
  363. package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
  364. package/lib/simple-tree/api/schemaFactory.js +2 -22
  365. package/lib/simple-tree/api/schemaFactory.js.map +1 -1
  366. package/lib/simple-tree/api/schemaFactoryRecursive.d.ts +1 -1
  367. package/lib/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
  368. package/lib/simple-tree/api/simpleTreeIndex.js +3 -3
  369. package/lib/simple-tree/api/simpleTreeIndex.js.map +1 -1
  370. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  371. package/lib/simple-tree/api/tree.js +3 -4
  372. package/lib/simple-tree/api/tree.js.map +1 -1
  373. package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  374. package/lib/simple-tree/api/treeNodeApi.js +9 -20
  375. package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
  376. package/lib/simple-tree/api/typesUnsafe.d.ts +127 -19
  377. package/lib/simple-tree/api/typesUnsafe.d.ts.map +1 -1
  378. package/lib/simple-tree/api/typesUnsafe.js +15 -1
  379. package/lib/simple-tree/api/typesUnsafe.js.map +1 -1
  380. package/lib/simple-tree/api/verboseTree.d.ts.map +1 -1
  381. package/lib/simple-tree/api/verboseTree.js +5 -4
  382. package/lib/simple-tree/api/verboseTree.js.map +1 -1
  383. package/lib/simple-tree/api/view.js +1 -1
  384. package/lib/simple-tree/api/view.js.map +1 -1
  385. package/lib/simple-tree/arrayNode.d.ts +1 -1
  386. package/lib/simple-tree/arrayNode.d.ts.map +1 -1
  387. package/lib/simple-tree/arrayNode.js +2 -2
  388. package/lib/simple-tree/arrayNode.js.map +1 -1
  389. package/lib/simple-tree/core/getOrCreateNode.d.ts.map +1 -1
  390. package/lib/simple-tree/core/getOrCreateNode.js +1 -1
  391. package/lib/simple-tree/core/getOrCreateNode.js.map +1 -1
  392. package/lib/simple-tree/core/schemaCaching.js +1 -1
  393. package/lib/simple-tree/core/schemaCaching.js.map +1 -1
  394. package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  395. package/lib/simple-tree/core/treeNodeKernel.js +6 -6
  396. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
  397. package/lib/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  398. package/lib/simple-tree/core/unhydratedFlexTree.js +5 -5
  399. package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  400. package/lib/simple-tree/flexList.d.ts +4 -5
  401. package/lib/simple-tree/flexList.d.ts.map +1 -1
  402. package/lib/simple-tree/flexList.js +0 -12
  403. package/lib/simple-tree/flexList.js.map +1 -1
  404. package/lib/simple-tree/index.d.ts +4 -4
  405. package/lib/simple-tree/index.d.ts.map +1 -1
  406. package/lib/simple-tree/index.js +2 -2
  407. package/lib/simple-tree/index.js.map +1 -1
  408. package/lib/simple-tree/objectNode.d.ts +25 -2
  409. package/lib/simple-tree/objectNode.d.ts.map +1 -1
  410. package/lib/simple-tree/objectNode.js +4 -2
  411. package/lib/simple-tree/objectNode.js.map +1 -1
  412. package/lib/simple-tree/proxies.js +1 -1
  413. package/lib/simple-tree/proxies.js.map +1 -1
  414. package/lib/simple-tree/schemaTypes.d.ts +211 -9
  415. package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
  416. package/lib/simple-tree/schemaTypes.js +81 -3
  417. package/lib/simple-tree/schemaTypes.js.map +1 -1
  418. package/lib/simple-tree/toMapTree.js +3 -3
  419. package/lib/simple-tree/toMapTree.js.map +1 -1
  420. package/lib/simple-tree/toStoredSchema.d.ts.map +1 -1
  421. package/lib/simple-tree/toStoredSchema.js +5 -8
  422. package/lib/simple-tree/toStoredSchema.js.map +1 -1
  423. package/lib/simple-tree/treeNodeValid.d.ts +7 -1
  424. package/lib/simple-tree/treeNodeValid.d.ts.map +1 -1
  425. package/lib/simple-tree/treeNodeValid.js +18 -7
  426. package/lib/simple-tree/treeNodeValid.js.map +1 -1
  427. package/lib/util/idAllocator.js +1 -1
  428. package/lib/util/idAllocator.js.map +1 -1
  429. package/lib/util/index.d.ts +2 -2
  430. package/lib/util/index.d.ts.map +1 -1
  431. package/lib/util/index.js +2 -2
  432. package/lib/util/index.js.map +1 -1
  433. package/lib/util/nestedMap.d.ts +2 -10
  434. package/lib/util/nestedMap.d.ts.map +1 -1
  435. package/lib/util/nestedMap.js +5 -23
  436. package/lib/util/nestedMap.js.map +1 -1
  437. package/lib/util/utils.d.ts +23 -6
  438. package/lib/util/utils.d.ts.map +1 -1
  439. package/lib/util/utils.js +42 -11
  440. package/lib/util/utils.js.map +1 -1
  441. package/package.json +27 -23
  442. package/src/codec/codec.ts +3 -3
  443. package/src/codec/discriminatedUnions.ts +2 -1
  444. package/src/core/schema-stored/schema.ts +5 -3
  445. package/src/core/tree/anchorSet.ts +37 -26
  446. package/src/core/tree/treeTextFormat.ts +1 -1
  447. package/src/feature-libraries/chunked-forest/basicChunk.ts +11 -8
  448. package/src/feature-libraries/chunked-forest/chunkTree.ts +2 -2
  449. package/src/feature-libraries/chunked-forest/chunkedForest.ts +3 -3
  450. package/src/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.ts +2 -2
  451. package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +4 -3
  452. package/src/feature-libraries/chunked-forest/codec/nodeShape.ts +2 -2
  453. package/src/feature-libraries/chunked-forest/codec/schemaBasedEncoding.ts +4 -3
  454. package/src/feature-libraries/chunked-forest/emptyChunk.ts +14 -14
  455. package/src/feature-libraries/chunked-forest/uniformChunk.ts +6 -4
  456. package/src/feature-libraries/default-schema/defaultFieldKinds.ts +1 -1
  457. package/src/feature-libraries/default-schema/schemaChecker.ts +1 -1
  458. package/src/feature-libraries/flex-tree/lazyField.ts +6 -8
  459. package/src/feature-libraries/flex-tree/lazyNode.ts +6 -4
  460. package/src/feature-libraries/indexing/anchorTreeIndex.ts +2 -1
  461. package/src/feature-libraries/modular-schema/comparison.ts +7 -5
  462. package/src/feature-libraries/modular-schema/isNeverTree.ts +6 -4
  463. package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +4 -4
  464. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +16 -12
  465. package/src/feature-libraries/node-key/mockNodeKeyManager.ts +1 -1
  466. package/src/feature-libraries/object-forest/objectForest.ts +1 -1
  467. package/src/feature-libraries/schema-index/codec.ts +1 -1
  468. package/src/feature-libraries/sequence-field/compose.ts +1 -1
  469. package/src/feature-libraries/sequence-field/invert.ts +1 -1
  470. package/src/feature-libraries/sequence-field/sequenceFieldCodecV1.ts +1 -1
  471. package/src/feature-libraries/sequence-field/sequenceFieldCodecV2.ts +1 -1
  472. package/src/feature-libraries/sequence-field/utils.ts +1 -1
  473. package/src/feature-libraries/treeCursorUtils.ts +6 -4
  474. package/src/index.ts +22 -1
  475. package/src/jsonDomainSchema.ts +129 -0
  476. package/src/packageVersion.ts +1 -1
  477. package/src/serializableDomainSchema.ts +121 -0
  478. package/src/shared-tree/index.ts +0 -1
  479. package/src/shared-tree/schematizeTree.ts +1 -1
  480. package/src/shared-tree/sharedTree.ts +31 -41
  481. package/src/shared-tree/sharedTreeChangeFamily.ts +1 -1
  482. package/src/shared-tree/treeApiAlpha.ts +12 -4
  483. package/src/shared-tree/treeCheckout.ts +1 -1
  484. package/src/shared-tree-core/editManager.ts +85 -47
  485. package/src/shared-tree-core/resubmitMachine.ts +2 -0
  486. package/src/shared-tree-core/sharedTreeCore.ts +62 -14
  487. package/src/simple-tree/api/component.ts +42 -0
  488. package/src/simple-tree/api/customTree.ts +3 -3
  489. package/src/simple-tree/api/index.ts +7 -0
  490. package/src/simple-tree/api/schemaCreationUtilities.ts +1 -1
  491. package/src/simple-tree/api/schemaFactory.ts +1 -28
  492. package/src/simple-tree/api/schemaFactoryRecursive.ts +1 -1
  493. package/src/simple-tree/api/simpleTreeIndex.ts +3 -3
  494. package/src/simple-tree/api/tree.ts +3 -3
  495. package/src/simple-tree/api/treeNodeApi.ts +10 -18
  496. package/src/simple-tree/api/typesUnsafe.ts +193 -18
  497. package/src/simple-tree/api/verboseTree.ts +8 -4
  498. package/src/simple-tree/api/view.ts +1 -1
  499. package/src/simple-tree/arrayNode.ts +2 -2
  500. package/src/simple-tree/core/getOrCreateNode.ts +2 -1
  501. package/src/simple-tree/core/schemaCaching.ts +1 -1
  502. package/src/simple-tree/core/treeNodeKernel.ts +9 -6
  503. package/src/simple-tree/core/unhydratedFlexTree.ts +7 -5
  504. package/src/simple-tree/flexList.ts +4 -14
  505. package/src/simple-tree/index.ts +25 -1
  506. package/src/simple-tree/objectNode.ts +50 -5
  507. package/src/simple-tree/proxies.ts +1 -1
  508. package/src/simple-tree/schemaTypes.ts +322 -23
  509. package/src/simple-tree/toMapTree.ts +3 -3
  510. package/src/simple-tree/toStoredSchema.ts +5 -7
  511. package/src/simple-tree/treeNodeValid.ts +21 -7
  512. package/src/util/idAllocator.ts +1 -1
  513. package/src/util/index.ts +3 -2
  514. package/src/util/nestedMap.ts +9 -33
  515. package/src/util/utils.ts +52 -12
@@ -3,10 +3,11 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import type { RestrictiveStringRecord, UnionToIntersection } from "../../util/index.js";
6
- import type { ApplyKind, ApplyKindInput, FieldKind, FieldSchema, ImplicitAllowedTypes, ImplicitFieldSchema, TreeLeafValue } from "../schemaTypes.js";
6
+ import type { ApplyKind, ApplyKindInput, CustomizedSchemaTyping, CustomTypes, FieldKind, FieldSchema, ImplicitAllowedTypes, ImplicitFieldSchema, TreeLeafValue } from "../schemaTypes.js";
7
7
  import type { NodeKind, WithType, TreeNode, Unhydrated, InternalTreeNode, TreeNodeSchema, TreeNodeSchemaCore } from "../core/index.js";
8
8
  import type { TreeArrayNode } from "../arrayNode.js";
9
9
  import type { FlexListToUnion, LazyItem } from "../flexList.js";
10
+ import type { ApplyKindAssignment } from "../objectNode.js";
10
11
  /**
11
12
  * A placeholder to use in {@link https://www.typescriptlang.org/docs/handbook/2/generics.html#generic-constraints | extends constraints} when using the real type breaks compilation of some recursive types due to {@link https://github.com/microsoft/TypeScript/issues/55758 | a design limitation of TypeScript}.
12
13
  *
@@ -16,15 +17,107 @@ import type { FlexListToUnion, LazyItem } from "../flexList.js";
16
17
  * @public
17
18
  */
18
19
  export type Unenforced<_DesiredExtendsConstraint> = unknown;
20
+ /**
21
+ * {@link Unenforced} version of {@link customizeSchemaTyping} for use with recursive schema types.
22
+ *
23
+ * @remarks
24
+ * When using this API to modify a schema derived type such that the type is no longer recursive,
25
+ * or uses an externally defined type (which can be recursive), {@link customizeSchemaTyping} should be used instead for an improved developer experience.
26
+ * Additionally, in this case, none of the "unsafe" type variants should be needed: the whole schema (with runtime but not schema derived type recursion)
27
+ * should use the normal (not unsafe/recursive) APIs.
28
+ * @alpha
29
+ */
30
+ export declare function customizeSchemaTypingUnsafe<TSchema extends Unenforced<ImplicitAllowedTypes>>(schema: TSchema): CustomizerUnsafe<TSchema>;
31
+ /**
32
+ * {@link Unenforced} version of `Customizer`.
33
+ * @remarks
34
+ * This has fewer options than the safe version, but all options can still be expressed using the "custom" method.
35
+ * @sealed @public
36
+ */
37
+ export interface CustomizerUnsafe<TSchema extends Unenforced<ImplicitAllowedTypes>> {
38
+ /**
39
+ * Replace typing with a single substitute type which allowed types must implement.
40
+ * @remarks
41
+ * This is generally type safe for reading the tree, but allows instances of `T` other than those listed in the schema to be assigned,
42
+ * which can be out of schema and err at runtime in the same way {@link CustomizerUnsafe.relaxed} does.
43
+ * Until with {@link CustomizerUnsafe.relaxed}, implicit construction is disabled, meaning all nodes must be explicitly constructed (and thus implement `T`) before being inserted.
44
+ */
45
+ simplified<T extends (TreeNode | TreeLeafValue) & TreeNodeFromImplicitAllowedTypesUnsafe<TSchema>>(): CustomizedSchemaTyping<TSchema, {
46
+ input: T;
47
+ readWrite: T;
48
+ output: T;
49
+ }>;
50
+ /**
51
+ * The same as {@link CustomizerUnsafe} except that more T values are allowed, even ones not known to be implemented by `TSchema`.
52
+ */
53
+ simplifiedUnrestricted<T extends TreeNode | TreeLeafValue>(): CustomizedSchemaTyping<TSchema, {
54
+ input: T;
55
+ readWrite: T;
56
+ output: T;
57
+ }>;
58
+ /**
59
+ * Fully arbitrary customization.
60
+ * Provided types override existing types.
61
+ * @remarks
62
+ * This can express any of the customizations possible via other {@link CustomizerUnsafe} methods:
63
+ * this API is however more verbose and can more easily be used to unsafe typing.
64
+ */
65
+ custom<T extends Partial<CustomTypes>>(): CustomizedSchemaTyping<TSchema, Pick<CustomTypes, "readWrite" | "output"> & {
66
+ [Property in keyof CustomTypes]: Property extends keyof T ? T[Property] extends CustomTypes[Property] ? T[Property] : GetTypesUnsafe<TSchema>[Property] : GetTypesUnsafe<TSchema>[Property];
67
+ }>;
68
+ }
19
69
  /**
20
70
  * {@link Unenforced} version of `ObjectFromSchemaRecord`.
21
71
  * @remarks
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.
72
+ * Do not use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
23
73
  * @system @public
24
74
  */
25
75
  export type ObjectFromSchemaRecordUnsafe<T extends Unenforced<RestrictiveStringRecord<ImplicitFieldSchema>>> = {
26
- -readonly [Property in keyof T]: TreeFieldFromImplicitFieldUnsafe<T[Property]>;
76
+ -readonly [Property in keyof T as [T[Property]] extends [
77
+ CustomizedSchemaTyping<unknown, {
78
+ readonly readWrite: never;
79
+ readonly input: unknown;
80
+ readonly output: TreeNode | TreeLeafValue;
81
+ }>
82
+ ] ? never : Property]: AssignableTreeFieldFromImplicitFieldUnsafe<T[Property]>;
83
+ } & {
84
+ readonly [Property in keyof T as [T[Property]] extends [
85
+ CustomizedSchemaTyping<unknown, {
86
+ readonly readWrite: never;
87
+ readonly input: unknown;
88
+ readonly output: TreeNode | TreeLeafValue;
89
+ }>
90
+ ] ? Property : never]: TreeFieldFromImplicitFieldUnsafe<T[Property]>;
27
91
  };
92
+ /**
93
+ * {@link Unenforced} version of `AssignableTreeFieldFromImplicitField`.
94
+ * @remarks
95
+ * Do not use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
96
+ * @privateRemarks
97
+ * Recursive version doesn't remove setters when this is never, so this uses covariant not contravariant union handling.
98
+ * @system @public
99
+ */
100
+ export type AssignableTreeFieldFromImplicitFieldUnsafe<TSchema extends Unenforced<ImplicitFieldSchema>> = TSchema extends FieldSchemaUnsafe<infer Kind, infer Types> ? ApplyKindAssignment<GetTypesUnsafe<Types>["readWrite"], Kind> : GetTypesUnsafe<TSchema>["readWrite"];
101
+ /**
102
+ * {@link Unenforced} version of `TypesUnsafe`.
103
+ * @remarks
104
+ * Do not use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
105
+ * @system @public
106
+ */
107
+ export type GetTypesUnsafe<TSchema extends Unenforced<ImplicitAllowedTypes>> = [
108
+ TSchema
109
+ ] extends [CustomizedSchemaTyping<unknown, infer TCustom>] ? TCustom : StrictTypesUnsafe<TSchema>;
110
+ /**
111
+ * {@link Unenforced} version of `StrictTypes`.
112
+ * @remarks
113
+ * Do not use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
114
+ * @system @public
115
+ */
116
+ export interface StrictTypesUnsafe<TSchema extends Unenforced<ImplicitAllowedTypes>, TInput = DefaultInsertableTreeNodeFromImplicitAllowedTypesUnsafe<TSchema>, TOutput = DefaultTreeNodeFromImplicitAllowedTypesUnsafe<TSchema>> {
117
+ input: TInput;
118
+ readWrite: TOutput;
119
+ output: TOutput;
120
+ }
28
121
  /**
29
122
  * {@link Unenforced} version of {@link TreeNodeSchema}.
30
123
  * @remarks
@@ -60,14 +153,14 @@ export interface TreeNodeSchemaNonClassUnsafe<out Name extends string, out Kind
60
153
  /**
61
154
  * {@link Unenforced} version of {@link TreeObjectNode}.
62
155
  * @remarks
63
- * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
156
+ * Do not use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
64
157
  * @system @public
65
158
  */
66
159
  export type TreeObjectNodeUnsafe<T extends Unenforced<RestrictiveStringRecord<ImplicitFieldSchema>>, TypeName extends string = string> = TreeNode & ObjectFromSchemaRecordUnsafe<T> & WithType<TypeName, NodeKind.Object>;
67
160
  /**
68
161
  * {@link Unenforced} version of {@link TreeFieldFromImplicitField}.
69
162
  * @remarks
70
- * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
163
+ * Do not use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
71
164
  * @system @public
72
165
  */
73
166
  export type TreeFieldFromImplicitFieldUnsafe<TSchema extends Unenforced<ImplicitFieldSchema>> = TSchema extends FieldSchemaUnsafe<infer Kind, infer Types> ? ApplyKind<TreeNodeFromImplicitAllowedTypesUnsafe<Types>, Kind> : TSchema extends ImplicitAllowedTypes ? TreeNodeFromImplicitAllowedTypesUnsafe<TSchema> : unknown;
@@ -81,18 +174,33 @@ export type AllowedTypesUnsafe = readonly LazyItem<TreeNodeSchemaUnsafe>[];
81
174
  /**
82
175
  * {@link Unenforced} version of {@link TreeNodeFromImplicitAllowedTypes}.
83
176
  * @remarks
84
- * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
177
+ * Do not use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
178
+ * @system @public
179
+ */
180
+ export type TreeNodeFromImplicitAllowedTypesUnsafe<TSchema extends Unenforced<ImplicitAllowedTypes>> = GetTypesUnsafe<TSchema>["output"];
181
+ /**
182
+ * {@link Unenforced} version of {@link DefaultTreeNodeFromImplicitAllowedTypesUnsafe}.
183
+ * @remarks
184
+ * Do not use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
85
185
  * @system @public
86
186
  */
87
- export type TreeNodeFromImplicitAllowedTypesUnsafe<TSchema extends Unenforced<ImplicitAllowedTypes>> = TSchema extends TreeNodeSchemaUnsafe ? NodeFromSchemaUnsafe<TSchema> : TSchema extends AllowedTypesUnsafe ? NodeFromSchemaUnsafe<FlexListToUnion<TSchema>> : unknown;
187
+ export type DefaultTreeNodeFromImplicitAllowedTypesUnsafe<TSchema extends Unenforced<ImplicitAllowedTypes>> = TSchema extends TreeNodeSchemaUnsafe ? NodeFromSchemaUnsafe<TSchema> : TSchema extends AllowedTypesUnsafe ? NodeFromSchemaUnsafe<FlexListToUnion<TSchema>> : unknown;
88
188
  /**
89
189
  * {@link Unenforced} version of {@link InsertableTreeNodeFromImplicitAllowedTypes}.
90
190
  * @see {@link Input}
91
191
  * @remarks
92
- * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
192
+ * Do not use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
193
+ * @system @public
194
+ */
195
+ export type InsertableTreeNodeFromImplicitAllowedTypesUnsafe<TSchema extends Unenforced<ImplicitAllowedTypes>> = GetTypesUnsafe<TSchema>["input"];
196
+ /**
197
+ * {@link Unenforced} version of {@link DefaultInsertableTreeNodeFromImplicitAllowedTypes}.
198
+ * @see {@link Input}
199
+ * @remarks
200
+ * Do not use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
93
201
  * @system @public
94
202
  */
95
- export type InsertableTreeNodeFromImplicitAllowedTypesUnsafe<TSchema extends Unenforced<ImplicitAllowedTypes>> = [TSchema] extends [TreeNodeSchemaUnsafe] ? InsertableTypedNodeUnsafe<TSchema> : [TSchema] extends [AllowedTypesUnsafe] ? InsertableTreeNodeFromAllowedTypesUnsafe<TSchema> : never;
203
+ export type DefaultInsertableTreeNodeFromImplicitAllowedTypesUnsafe<TSchema extends Unenforced<ImplicitAllowedTypes>> = [TSchema] extends [TreeNodeSchemaUnsafe] ? InsertableTypedNodeUnsafe<TSchema> : [TSchema] extends [AllowedTypesUnsafe] ? InsertableTreeNodeFromAllowedTypesUnsafe<TSchema> : never;
96
204
  /**
97
205
  * {@link Unenforced} version of {@link InsertableTreeNodeFromAllowedTypes}.
98
206
  * @see {@link Input}
@@ -106,7 +214,7 @@ export type InsertableTreeNodeFromAllowedTypesUnsafe<TList extends Unenforced<Al
106
214
  * {@link Unenforced} version of {@link InsertableTypedNode}.
107
215
  * @see {@link Input}
108
216
  * @remarks
109
- * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
217
+ * Do not use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
110
218
  * @privateRemarks
111
219
  * TODO:
112
220
  * This is less strict than InsertableTypedNode when given non-exact schema to avoid compilation issues.
@@ -117,21 +225,21 @@ export type InsertableTypedNodeUnsafe<TSchema extends Unenforced<TreeNodeSchemaU
117
225
  /**
118
226
  * {@link Unenforced} version of {@link NodeFromSchema}.
119
227
  * @remarks
120
- * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
228
+ * Do not use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
121
229
  * @system @public
122
230
  */
123
231
  export type NodeFromSchemaUnsafe<T extends Unenforced<TreeNodeSchema>> = T extends TreeNodeSchemaUnsafe<string, NodeKind, infer TNode> ? TNode : never;
124
232
  /**
125
233
  * {@link Unenforced} version of {@link InsertableTreeNodeFromImplicitAllowedTypes}.
126
234
  * @remarks
127
- * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
235
+ * Do not use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
128
236
  * @system @public
129
237
  */
130
238
  export type NodeBuilderDataUnsafe<T extends Unenforced<TreeNodeSchema>> = T extends TreeNodeSchemaUnsafe<string, NodeKind, unknown, infer TBuild> ? TBuild : never;
131
239
  /**
132
240
  * {@link Unenforced} version of {@link (TreeArrayNode:interface)}.
133
241
  * @remarks
134
- * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
242
+ * Do not use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
135
243
  * @system @sealed @public
136
244
  */
137
245
  export interface TreeArrayNodeUnsafe<TAllowedTypes extends Unenforced<ImplicitAllowedTypes>> extends TreeArrayNode<TAllowedTypes, TreeNodeFromImplicitAllowedTypesUnsafe<TAllowedTypes>, InsertableTreeNodeFromImplicitAllowedTypesUnsafe<TAllowedTypes>> {
@@ -139,7 +247,7 @@ export interface TreeArrayNodeUnsafe<TAllowedTypes extends Unenforced<ImplicitAl
139
247
  /**
140
248
  * {@link Unenforced} version of {@link TreeMapNode}.
141
249
  * @remarks
142
- * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
250
+ * Do not use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
143
251
  * @system @sealed @public
144
252
  */
145
253
  export interface TreeMapNodeUnsafe<T extends Unenforced<ImplicitAllowedTypes>> extends ReadonlyMapInlined<string, T>, TreeNode {
@@ -156,7 +264,7 @@ export interface TreeMapNodeUnsafe<T extends Unenforced<ImplicitAllowedTypes>> e
156
264
  * Copy of TypeScript's ReadonlyMap, but with `TreeNodeFromImplicitAllowedTypesUnsafe<T>` inlined into it.
157
265
  * 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.
158
266
  * @remarks
159
- * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
267
+ * Do not use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
160
268
  * @privateRemarks
161
269
  * This is the same as `ReadonlyMap<K, TreeNodeFromImplicitAllowedTypesUnsafe<T>>` (Checked in test),
162
270
  * except that it avoids the above mentioned compile error.
@@ -186,7 +294,7 @@ export interface ReadonlyMapInlined<K, T extends Unenforced<ImplicitAllowedTypes
186
294
  /**
187
295
  * {@link Unenforced} version of `FieldHasDefault`.
188
296
  * @remarks
189
- * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
297
+ * Do not use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
190
298
  * @system @sealed @public
191
299
  */
192
300
  export type FieldHasDefaultUnsafe<T extends Unenforced<ImplicitFieldSchema>> = T extends FieldSchemaUnsafe<FieldKind.Optional | FieldKind.Identifier, Unenforced<ImplicitAllowedTypes>> ? true : false;
@@ -194,7 +302,7 @@ export type FieldHasDefaultUnsafe<T extends Unenforced<ImplicitFieldSchema>> = T
194
302
  * {@link Unenforced} version of `InsertableObjectFromSchemaRecord`.
195
303
  * @see {@link Input}
196
304
  * @remarks
197
- * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
305
+ * Do not use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
198
306
  * @system @public
199
307
  */
200
308
  export type InsertableObjectFromSchemaRecordUnsafe<T extends Unenforced<RestrictiveStringRecord<ImplicitFieldSchema>>> = {
@@ -206,14 +314,14 @@ export type InsertableObjectFromSchemaRecordUnsafe<T extends Unenforced<Restrict
206
314
  * {@link Unenforced} version of {@link InsertableTreeFieldFromImplicitField}.
207
315
  * @see {@link Input}
208
316
  * @remarks
209
- * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
317
+ * Do not use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
210
318
  * @system @public
211
319
  */
212
320
  export type InsertableTreeFieldFromImplicitFieldUnsafe<TSchemaInput extends Unenforced<ImplicitFieldSchema>, TSchema = UnionToIntersection<TSchemaInput>> = [TSchema] extends [FieldSchemaUnsafe<infer Kind, infer Types>] ? ApplyKindInput<InsertableTreeNodeFromImplicitAllowedTypesUnsafe<Types>, Kind, true> : [TSchema] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypesUnsafe<TSchema> : never;
213
321
  /**
214
322
  * {@link Unenforced} version of {@link FieldSchema}.
215
323
  * @remarks
216
- * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
324
+ * Do not use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
217
325
  * @public
218
326
  */
219
327
  export interface FieldSchemaUnsafe<out Kind extends FieldKind, out Types extends Unenforced<ImplicitAllowedTypes>> extends FieldSchema<Kind, any> {
@@ -1 +1 @@
1
- {"version":3,"file":"typesUnsafe.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/typesUnsafe.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAExF,OAAO,KAAK,EACX,SAAS,EACT,cAAc,EACd,SAAS,EACT,WAAW,EACX,oBAAoB,EACpB,mBAAmB,EACnB,aAAa,EACb,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EACX,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,gBAAgB,EAChB,cAAc,EACd,kBAAkB,EAClB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAchE;;;;;;;GAOG;AACH,MAAM,MAAM,UAAU,CAAC,yBAAyB,IAAI,OAAO,CAAC;AAE5D;;;;;GAKG;AACH,MAAM,MAAM,4BAA4B,CACvC,CAAC,SAAS,UAAU,CAAC,uBAAuB,CAAC,mBAAmB,CAAC,CAAC,IAC/D;IACH,CAAC,UAAU,QAAQ,IAAI,MAAM,CAAC,GAAG,gCAAgC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;CAC9E,CA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,QAAQ,GACR,KAAK,CAAC,CAAC,EAAE,0CAA0C,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;CACnE,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,0CAA0C,CACrD,YAAY,SAAS,UAAU,CAAC,mBAAmB,CAAC,EACpD,OAAO,GAAG,mBAAmB,CAAC,YAAY,CAAC,IACxC,CAAC,OAAO,CAAC,SAAS,CAAC,iBAAiB,CAAC,MAAM,IAAI,EAAE,MAAM,KAAK,CAAC,CAAC,GAC/D,cAAc,CAAC,gDAAgD,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,GACnF,CAAC,OAAO,CAAC,SAAS,CAAC,oBAAoB,CAAC,GACvC,gDAAgD,CAAC,OAAO,CAAC,GACzD,KAAK,CAAC;AAEV;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB,CACjC,GAAG,CAAC,IAAI,SAAS,SAAS,EAC1B,GAAG,CAAC,KAAK,SAAS,UAAU,CAAC,oBAAoB,CAAC,CACjD,SAAQ,WAAW,CAAC,IAAI,EAAE,GAAG,CAAC;IAC/B;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB;;OAEG;IACH,QAAQ,CAAC,YAAY,EAAE,KAAK,CAAC;IAC7B;;OAEG;IACH,QAAQ,CAAC,cAAc,EAAE,WAAW,CAAC,cAAc,CAAC,CAAC;CACrD"}
@@ -4,5 +4,22 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.customizeSchemaTypingUnsafe = void 0;
8
+ /**
9
+ * {@link Unenforced} version of {@link customizeSchemaTyping} for use with recursive schema types.
10
+ *
11
+ * @remarks
12
+ * When using this API to modify a schema derived type such that the type is no longer recursive,
13
+ * or uses an externally defined type (which can be recursive), {@link customizeSchemaTyping} should be used instead for an improved developer experience.
14
+ * Additionally, in this case, none of the "unsafe" type variants should be needed: the whole schema (with runtime but not schema derived type recursion)
15
+ * should use the normal (not unsafe/recursive) APIs.
16
+ * @alpha
17
+ */
18
+ function customizeSchemaTypingUnsafe(schema) {
19
+ // This function just does type branding, and duplicating the typing here to avoid any would just make it harder to maintain not easier:
20
+ const f = () => schema;
21
+ return { simplified: f, simplifiedUnrestricted: f, custom: f };
22
+ }
23
+ exports.customizeSchemaTypingUnsafe = customizeSchemaTypingUnsafe;
7
24
  /* eslint-enable @typescript-eslint/no-explicit-any */
8
25
  //# sourceMappingURL=typesUnsafe.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"typesUnsafe.js","sourceRoot":"","sources":["../../../src/simple-tree/api/typesUnsafe.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAiYH,sDAAsD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { RestrictiveStringRecord, UnionToIntersection } from \"../../util/index.js\";\n\nimport type {\n\tApplyKind,\n\tApplyKindInput,\n\tFieldKind,\n\tFieldSchema,\n\tImplicitAllowedTypes,\n\tImplicitFieldSchema,\n\tTreeLeafValue,\n} from \"../schemaTypes.js\";\nimport type {\n\tNodeKind,\n\tWithType,\n\tTreeNode,\n\tUnhydrated,\n\tInternalTreeNode,\n\tTreeNodeSchema,\n\tTreeNodeSchemaCore,\n} from \"../core/index.js\";\nimport type { TreeArrayNode } from \"../arrayNode.js\";\nimport type { FlexListToUnion, LazyItem } from \"../flexList.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 * A placeholder to use in {@link https://www.typescriptlang.org/docs/handbook/2/generics.html#generic-constraints | extends constraints} when using the real type breaks compilation of some recursive types due to {@link https://github.com/microsoft/TypeScript/issues/55758 | a design limitation of TypeScript}.\n *\n * These extends constraints only serve as documentation:\n * to avoid breaking compilation, this type has to not actually enforce anything, and thus is just `unknown`.\n * Therefore the type safety is the responsibility of the user of the API.\n * @public\n */\nexport type Unenforced<_DesiredExtendsConstraint> = unknown;\n\n/**\n * {@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<RestrictiveStringRecord<ImplicitFieldSchema>>,\n> = {\n\t-readonly [Property in keyof T]: TreeFieldFromImplicitFieldUnsafe<T[Property]>;\n};\n\n/**\n * {@link Unenforced} version of {@link TreeNodeSchema}.\n * @remarks\n * Do not use this type directly: it is only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.\n * @system @public\n */\nexport type TreeNodeSchemaUnsafe<\n\tName extends string = string,\n\tKind extends NodeKind = NodeKind,\n\tTNode extends Unenforced<TreeNode | TreeLeafValue> = unknown,\n\tTBuild = never,\n\tImplicitlyConstructable extends boolean = boolean,\n\tInfo = unknown,\n> =\n\t| TreeNodeSchemaClassUnsafe<Name, Kind, TNode, TBuild, ImplicitlyConstructable, Info>\n\t| TreeNodeSchemaNonClassUnsafe<Name, Kind, TNode, TBuild, ImplicitlyConstructable, Info>;\n\n/**\n * {@link Unenforced} version of {@link TreeNodeSchemaClass}.\n * @remarks\n * Do not use this type directly: it is only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.\n * @system @public\n */\nexport interface TreeNodeSchemaClassUnsafe<\n\tout Name extends string,\n\tout Kind extends NodeKind,\n\tout TNode extends Unenforced<TreeNode>,\n\tin TInsertable,\n\tout ImplicitlyConstructable extends boolean,\n\tout Info,\n> extends TreeNodeSchemaCore<Name, Kind, ImplicitlyConstructable, Info> {\n\t/**\n\t * Constructs an {@link Unhydrated} node with this schema.\n\t * @remarks\n\t * This constructor is also used internally to construct hydrated nodes with a different parameter type.\n\t * Therefore, overriding this constructor with different argument types is not type-safe and is not supported.\n\t * @sealed\n\t */\n\tnew (data: TInsertable | InternalTreeNode): Unhydrated<TNode>;\n}\n\n/**\n * {@link Unenforced} version of {@link TreeNodeSchemaNonClass}.\n * @remarks\n * Do not use this type directly: it is only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.\n * @system @public\n */\nexport interface TreeNodeSchemaNonClassUnsafe<\n\tout Name extends string,\n\tout Kind extends NodeKind,\n\tout TNode extends Unenforced<TreeNode | TreeLeafValue>,\n\tin TInsertable,\n\tout ImplicitlyConstructable extends boolean,\n\tout Info = unknown,\n> extends TreeNodeSchemaCore<Name, Kind, ImplicitlyConstructable, Info> {\n\tcreate(data: TInsertable): TNode;\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<RestrictiveStringRecord<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>\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 AllowedTypes}.\n * @remarks\n * Do not use this type directly: it is only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.\n * @system @public\n */\nexport type AllowedTypesUnsafe = readonly LazyItem<TreeNodeSchemaUnsafe>[];\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 TreeNodeSchemaUnsafe\n\t? NodeFromSchemaUnsafe<TSchema>\n\t: TSchema extends AllowedTypesUnsafe\n\t\t? NodeFromSchemaUnsafe<FlexListToUnion<TSchema>>\n\t\t: unknown;\n\n/**\n * {@link Unenforced} version of {@link InsertableTreeNodeFromImplicitAllowedTypes}.\n * @see {@link Input}\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 [TreeNodeSchemaUnsafe]\n\t? InsertableTypedNodeUnsafe<TSchema>\n\t: [TSchema] extends [AllowedTypesUnsafe]\n\t\t? InsertableTreeNodeFromAllowedTypesUnsafe<TSchema>\n\t\t: never;\n\n/**\n * {@link Unenforced} version of {@link InsertableTreeNodeFromAllowedTypes}.\n * @see {@link Input}\n * @system @public\n */\nexport type InsertableTreeNodeFromAllowedTypesUnsafe<\n\tTList extends Unenforced<AllowedTypesUnsafe>,\n> = TList extends readonly [\n\tLazyItem<infer TSchema extends TreeNodeSchemaUnsafe>,\n\t...infer Rest extends AllowedTypesUnsafe,\n]\n\t? InsertableTypedNodeUnsafe<TSchema> | InsertableTreeNodeFromAllowedTypesUnsafe<Rest>\n\t: never;\n\n/**\n * {@link Unenforced} version of {@link InsertableTypedNode}.\n * @see {@link Input}\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 * TODO:\n * This is less strict than InsertableTypedNode when given non-exact schema to avoid compilation issues.\n * This should probably be fixed or documented somehow.\n * @system @public\n */\nexport type InsertableTypedNodeUnsafe<\n\tTSchema extends Unenforced<TreeNodeSchemaUnsafe>,\n\tT = UnionToIntersection<TSchema>,\n> =\n\t| (T extends TreeNodeSchemaUnsafe<string, NodeKind, TreeNode | TreeLeafValue, never, true>\n\t\t\t? NodeBuilderDataUnsafe<T>\n\t\t\t: never)\n\t| (T extends TreeNodeSchemaUnsafe ? NodeFromSchemaUnsafe<T> : never);\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 TreeNodeSchemaUnsafe<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 TreeNodeSchemaUnsafe<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 TreeArrayNode<\n\t\tTAllowedTypes,\n\t\tTreeNodeFromImplicitAllowedTypesUnsafe<TAllowedTypes>,\n\t\tInsertableTreeNodeFromImplicitAllowedTypesUnsafe<TAllowedTypes>\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 * @see {@link Input}\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<RestrictiveStringRecord<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 * @see {@link Input}\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\tTSchemaInput extends Unenforced<ImplicitFieldSchema>,\n\tTSchema = UnionToIntersection<TSchemaInput>,\n> = [TSchema] extends [FieldSchemaUnsafe<infer Kind, infer Types>]\n\t? ApplyKindInput<InsertableTreeNodeFromImplicitAllowedTypesUnsafe<Types>, Kind, true>\n\t: [TSchema] extends [ImplicitAllowedTypes]\n\t\t? InsertableTreeNodeFromImplicitAllowedTypesUnsafe<TSchema>\n\t\t: never;\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/api/typesUnsafe.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAkDH;;;;;;;;;GASG;AACH,SAAgB,2BAA2B,CAC1C,MAAe;IAEf,wIAAwI;IACxI,MAAM,CAAC,GAAG,GAAQ,EAAE,CAAC,MAAM,CAAC;IAC5B,OAAO,EAAE,UAAU,EAAE,CAAC,EAAE,sBAAsB,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;AAChE,CAAC;AAND,kEAMC;AA8eD,sDAAsD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { RestrictiveStringRecord, UnionToIntersection } from \"../../util/index.js\";\n\nimport type {\n\tApplyKind,\n\tApplyKindInput,\n\tCustomizedSchemaTyping,\n\tCustomTypes,\n\tFieldKind,\n\tFieldSchema,\n\tImplicitAllowedTypes,\n\tImplicitFieldSchema,\n\tTreeLeafValue,\n} from \"../schemaTypes.js\";\nimport type {\n\tNodeKind,\n\tWithType,\n\tTreeNode,\n\tUnhydrated,\n\tInternalTreeNode,\n\tTreeNodeSchema,\n\tTreeNodeSchemaCore,\n} from \"../core/index.js\";\nimport type { TreeArrayNode } from \"../arrayNode.js\";\nimport type { FlexListToUnion, LazyItem } from \"../flexList.js\";\nimport type { ApplyKindAssignment } from \"../objectNode.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 * A placeholder to use in {@link https://www.typescriptlang.org/docs/handbook/2/generics.html#generic-constraints | extends constraints} when using the real type breaks compilation of some recursive types due to {@link https://github.com/microsoft/TypeScript/issues/55758 | a design limitation of TypeScript}.\n *\n * These extends constraints only serve as documentation:\n * to avoid breaking compilation, this type has to not actually enforce anything, and thus is just `unknown`.\n * Therefore the type safety is the responsibility of the user of the API.\n * @public\n */\nexport type Unenforced<_DesiredExtendsConstraint> = unknown;\n\n/**\n * {@link Unenforced} version of {@link customizeSchemaTyping} for use with recursive schema types.\n *\n * @remarks\n * When using this API to modify a schema derived type such that the type is no longer recursive,\n * or uses an externally defined type (which can be recursive), {@link customizeSchemaTyping} should be used instead for an improved developer experience.\n * Additionally, in this case, none of the \"unsafe\" type variants should be needed: the whole schema (with runtime but not schema derived type recursion)\n * should use the normal (not unsafe/recursive) APIs.\n * @alpha\n */\nexport function customizeSchemaTypingUnsafe<TSchema extends Unenforced<ImplicitAllowedTypes>>(\n\tschema: TSchema,\n): CustomizerUnsafe<TSchema> {\n\t// This function just does type branding, and duplicating the typing here to avoid any would just make it harder to maintain not easier:\n\tconst f = (): any => schema;\n\treturn { simplified: f, simplifiedUnrestricted: f, custom: f };\n}\n\n/**\n * {@link Unenforced} version of `Customizer`.\n * @remarks\n * This has fewer options than the safe version, but all options can still be expressed using the \"custom\" method.\n * @sealed @public\n */\nexport interface CustomizerUnsafe<TSchema extends Unenforced<ImplicitAllowedTypes>> {\n\t/**\n\t * Replace typing with a single substitute type which allowed types must implement.\n\t * @remarks\n\t * This is generally type safe for reading the tree, but allows instances of `T` other than those listed in the schema to be assigned,\n\t * which can be out of schema and err at runtime in the same way {@link CustomizerUnsafe.relaxed} does.\n\t * Until with {@link CustomizerUnsafe.relaxed}, implicit construction is disabled, meaning all nodes must be explicitly constructed (and thus implement `T`) before being inserted.\n\t */\n\tsimplified<\n\t\tT extends (TreeNode | TreeLeafValue) & TreeNodeFromImplicitAllowedTypesUnsafe<TSchema>,\n\t>(): CustomizedSchemaTyping<\n\t\tTSchema,\n\t\t{\n\t\t\tinput: T;\n\t\t\treadWrite: T;\n\t\t\toutput: T;\n\t\t}\n\t>;\n\n\t/**\n\t * The same as {@link CustomizerUnsafe} except that more T values are allowed, even ones not known to be implemented by `TSchema`.\n\t */\n\tsimplifiedUnrestricted<T extends TreeNode | TreeLeafValue>(): CustomizedSchemaTyping<\n\t\tTSchema,\n\t\t{\n\t\t\tinput: T;\n\t\t\treadWrite: T;\n\t\t\toutput: T;\n\t\t}\n\t>;\n\n\t/**\n\t * Fully arbitrary customization.\n\t * Provided types override existing types.\n\t * @remarks\n\t * This can express any of the customizations possible via other {@link CustomizerUnsafe} methods:\n\t * this API is however more verbose and can more easily be used to unsafe typing.\n\t */\n\tcustom<T extends Partial<CustomTypes>>(): CustomizedSchemaTyping<\n\t\tTSchema,\n\t\tPick<CustomTypes, \"readWrite\" | \"output\"> & {\n\t\t\t// Check if property is provided. This check is needed to early out missing values so if undefined is allowed,\n\t\t\t// not providing the field doesn't overwrite the corresponding type with undefined.\n\t\t\t// TODO: test this case\n\t\t\t[Property in keyof CustomTypes]: Property extends keyof T\n\t\t\t\t? T[Property] extends CustomTypes[Property]\n\t\t\t\t\t? T[Property]\n\t\t\t\t\t: GetTypesUnsafe<TSchema>[Property]\n\t\t\t\t: GetTypesUnsafe<TSchema>[Property];\n\t\t}\n\t>;\n}\n\n/**\n * {@link Unenforced} version of `ObjectFromSchemaRecord`.\n * @remarks\n * Do not 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<RestrictiveStringRecord<ImplicitFieldSchema>>,\n> =\n\t// Due to https://github.com/microsoft/TypeScript/issues/43826 we can not set the desired setter type.\n\t// Attempts to implement this in the cleaner way ObjectFromSchemaRecord uses cause recursive types to fail to compile.\n\t// Supporting explicit field schema wrapping CustomizedSchemaTyping here breaks compilation of recursive cases as well.\n\t{\n\t\t-readonly [Property in keyof T as [T[Property]] extends [\n\t\t\tCustomizedSchemaTyping<\n\t\t\t\tunknown,\n\t\t\t\t{\n\t\t\t\t\treadonly readWrite: never;\n\t\t\t\t\treadonly input: unknown;\n\t\t\t\t\treadonly output: TreeNode | TreeLeafValue;\n\t\t\t\t}\n\t\t\t>,\n\t\t]\n\t\t\t? never // Remove readWrite version for cases using CustomizedSchemaTyping to set readWrite to never.\n\t\t\t: Property]: AssignableTreeFieldFromImplicitFieldUnsafe<T[Property]>;\n\t} & {\n\t\treadonly [Property in keyof T as [T[Property]] extends [\n\t\t\tCustomizedSchemaTyping<\n\t\t\t\tunknown,\n\t\t\t\t{\n\t\t\t\t\treadonly readWrite: never;\n\t\t\t\t\treadonly input: unknown;\n\t\t\t\t\treadonly output: TreeNode | TreeLeafValue;\n\t\t\t\t}\n\t\t\t>,\n\t\t]\n\t\t\t? // Inverse of the conditional above: only include readonly fields when not including the readWrite one. This is required to make recursive types compile.\n\t\t\t\tProperty\n\t\t\t: never]: TreeFieldFromImplicitFieldUnsafe<T[Property]>;\n\t};\n\n/**\n * {@link Unenforced} version of `AssignableTreeFieldFromImplicitField`.\n * @remarks\n * Do not 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 * Recursive version doesn't remove setters when this is never, so this uses covariant not contravariant union handling.\n * @system @public\n */\nexport type AssignableTreeFieldFromImplicitFieldUnsafe<\n\tTSchema extends Unenforced<ImplicitFieldSchema>,\n> = TSchema extends FieldSchemaUnsafe<infer Kind, infer Types>\n\t? ApplyKindAssignment<GetTypesUnsafe<Types>[\"readWrite\"], Kind>\n\t: GetTypesUnsafe<TSchema>[\"readWrite\"];\n\n/**\n * {@link Unenforced} version of `TypesUnsafe`.\n * @remarks\n * Do not 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 GetTypesUnsafe<TSchema extends Unenforced<ImplicitAllowedTypes>> = [\n\tTSchema,\n] extends [CustomizedSchemaTyping<unknown, infer TCustom>]\n\t? TCustom\n\t: StrictTypesUnsafe<TSchema>;\n\n/**\n * {@link Unenforced} version of `StrictTypes`.\n * @remarks\n * Do not 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 interface StrictTypesUnsafe<\n\tTSchema extends Unenforced<ImplicitAllowedTypes>,\n\tTInput = DefaultInsertableTreeNodeFromImplicitAllowedTypesUnsafe<TSchema>,\n\tTOutput = DefaultTreeNodeFromImplicitAllowedTypesUnsafe<TSchema>,\n> {\n\tinput: TInput;\n\t// Partial mitigation setter limitations (removal of setters when TInput is never by setting this to never) breaks compilation if used here,\n\t// so recursive objects end up allowing some unsafe assignments which will error at runtime.\n\t// This unsafety occurs when schema types are not exact, so output types are generalized which results in setters being generalized (wince they get the same type) which is unsafe.\n\treadWrite: TOutput; // TInput extends never ? never : TOutput;\n\toutput: TOutput;\n}\n\n/**\n * {@link Unenforced} version of {@link TreeNodeSchema}.\n * @remarks\n * Do not use this type directly: it is only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.\n * @system @public\n */\nexport type TreeNodeSchemaUnsafe<\n\tName extends string = string,\n\tKind extends NodeKind = NodeKind,\n\tTNode extends Unenforced<TreeNode | TreeLeafValue> = unknown,\n\tTBuild = never,\n\tImplicitlyConstructable extends boolean = boolean,\n\tInfo = unknown,\n> =\n\t| TreeNodeSchemaClassUnsafe<Name, Kind, TNode, TBuild, ImplicitlyConstructable, Info>\n\t| TreeNodeSchemaNonClassUnsafe<Name, Kind, TNode, TBuild, ImplicitlyConstructable, Info>;\n\n/**\n * {@link Unenforced} version of {@link TreeNodeSchemaClass}.\n * @remarks\n * Do not use this type directly: it is only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.\n * @system @public\n */\nexport interface TreeNodeSchemaClassUnsafe<\n\tout Name extends string,\n\tout Kind extends NodeKind,\n\tout TNode extends Unenforced<TreeNode>,\n\tin TInsertable,\n\tout ImplicitlyConstructable extends boolean,\n\tout Info,\n> extends TreeNodeSchemaCore<Name, Kind, ImplicitlyConstructable, Info> {\n\t/**\n\t * Constructs an {@link Unhydrated} node with this schema.\n\t * @remarks\n\t * This constructor is also used internally to construct hydrated nodes with a different parameter type.\n\t * Therefore, overriding this constructor with different argument types is not type-safe and is not supported.\n\t * @sealed\n\t */\n\tnew (data: TInsertable | InternalTreeNode): Unhydrated<TNode>;\n}\n\n/**\n * {@link Unenforced} version of {@link TreeNodeSchemaNonClass}.\n * @remarks\n * Do not use this type directly: it is only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.\n * @system @public\n */\nexport interface TreeNodeSchemaNonClassUnsafe<\n\tout Name extends string,\n\tout Kind extends NodeKind,\n\tout TNode extends Unenforced<TreeNode | TreeLeafValue>,\n\tin TInsertable,\n\tout ImplicitlyConstructable extends boolean,\n\tout Info = unknown,\n> extends TreeNodeSchemaCore<Name, Kind, ImplicitlyConstructable, Info> {\n\tcreate(data: TInsertable): TNode;\n}\n\n/**\n * {@link Unenforced} version of {@link TreeObjectNode}.\n * @remarks\n * Do not 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<RestrictiveStringRecord<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 not 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>\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 AllowedTypes}.\n * @remarks\n * Do not use this type directly: it is only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.\n * @system @public\n */\nexport type AllowedTypesUnsafe = readonly LazyItem<TreeNodeSchemaUnsafe>[];\n\n/**\n * {@link Unenforced} version of {@link TreeNodeFromImplicitAllowedTypes}.\n * @remarks\n * Do not 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> = GetTypesUnsafe<TSchema>[\"output\"];\n\n/**\n * {@link Unenforced} version of {@link DefaultTreeNodeFromImplicitAllowedTypesUnsafe}.\n * @remarks\n * Do not 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 DefaultTreeNodeFromImplicitAllowedTypesUnsafe<\n\tTSchema extends Unenforced<ImplicitAllowedTypes>,\n> = TSchema extends TreeNodeSchemaUnsafe\n\t? NodeFromSchemaUnsafe<TSchema>\n\t: TSchema extends AllowedTypesUnsafe\n\t\t? NodeFromSchemaUnsafe<FlexListToUnion<TSchema>>\n\t\t: unknown;\n\n/**\n * {@link Unenforced} version of {@link InsertableTreeNodeFromImplicitAllowedTypes}.\n * @see {@link Input}\n * @remarks\n * Do not 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> = GetTypesUnsafe<TSchema>[\"input\"];\n\n/**\n * {@link Unenforced} version of {@link DefaultInsertableTreeNodeFromImplicitAllowedTypes}.\n * @see {@link Input}\n * @remarks\n * Do not 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 DefaultInsertableTreeNodeFromImplicitAllowedTypesUnsafe<\n\tTSchema extends Unenforced<ImplicitAllowedTypes>,\n> = [TSchema] extends [TreeNodeSchemaUnsafe]\n\t? InsertableTypedNodeUnsafe<TSchema>\n\t: [TSchema] extends [AllowedTypesUnsafe]\n\t\t? InsertableTreeNodeFromAllowedTypesUnsafe<TSchema>\n\t\t: never;\n\n/**\n * {@link Unenforced} version of {@link InsertableTreeNodeFromAllowedTypes}.\n * @see {@link Input}\n * @system @public\n */\nexport type InsertableTreeNodeFromAllowedTypesUnsafe<\n\tTList extends Unenforced<AllowedTypesUnsafe>,\n> = TList extends readonly [\n\tLazyItem<infer TSchema extends TreeNodeSchemaUnsafe>,\n\t...infer Rest extends AllowedTypesUnsafe,\n]\n\t? InsertableTypedNodeUnsafe<TSchema> | InsertableTreeNodeFromAllowedTypesUnsafe<Rest>\n\t: never;\n\n/**\n * {@link Unenforced} version of {@link InsertableTypedNode}.\n * @see {@link Input}\n * @remarks\n * Do not 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 * TODO:\n * This is less strict than InsertableTypedNode when given non-exact schema to avoid compilation issues.\n * This should probably be fixed or documented somehow.\n * @system @public\n */\nexport type InsertableTypedNodeUnsafe<\n\tTSchema extends Unenforced<TreeNodeSchemaUnsafe>,\n\tT = UnionToIntersection<TSchema>,\n> =\n\t| (T extends TreeNodeSchemaUnsafe<string, NodeKind, TreeNode | TreeLeafValue, never, true>\n\t\t\t? NodeBuilderDataUnsafe<T>\n\t\t\t: never)\n\t| (T extends TreeNodeSchemaUnsafe ? NodeFromSchemaUnsafe<T> : never);\n\n/**\n * {@link Unenforced} version of {@link NodeFromSchema}.\n * @remarks\n * Do not 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 TreeNodeSchemaUnsafe<string, NodeKind, infer TNode> ? TNode : never;\n\n/**\n * {@link Unenforced} version of {@link InsertableTreeNodeFromImplicitAllowedTypes}.\n * @remarks\n * Do not 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 TreeNodeSchemaUnsafe<string, NodeKind, unknown, infer TBuild> ? TBuild : never;\n\n/**\n * {@link Unenforced} version of {@link (TreeArrayNode:interface)}.\n * @remarks\n * Do not 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 TreeArrayNode<\n\t\tTAllowedTypes,\n\t\tTreeNodeFromImplicitAllowedTypesUnsafe<TAllowedTypes>,\n\t\tInsertableTreeNodeFromImplicitAllowedTypesUnsafe<TAllowedTypes>\n\t> {}\n\n/**\n * {@link Unenforced} version of {@link TreeMapNode}.\n * @remarks\n * Do not 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 not 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 not 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 * @see {@link Input}\n * @remarks\n * Do not 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<RestrictiveStringRecord<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 * @see {@link Input}\n * @remarks\n * Do not 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\tTSchemaInput extends Unenforced<ImplicitFieldSchema>,\n\tTSchema = UnionToIntersection<TSchemaInput>,\n> = [TSchema] extends [FieldSchemaUnsafe<infer Kind, infer Types>]\n\t? ApplyKindInput<InsertableTreeNodeFromImplicitAllowedTypesUnsafe<Types>, Kind, true>\n\t: [TSchema] extends [ImplicitAllowedTypes]\n\t\t? InsertableTreeNodeFromImplicitAllowedTypesUnsafe<TSchema>\n\t\t: never;\n\n/**\n * {@link Unenforced} version of {@link FieldSchema}.\n * @remarks\n * Do not 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 +1 @@
1
- {"version":3,"file":"verboseTree.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/verboseTree.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAIpE,OAAO,EAIN,KAAK,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,sBAAsB,EAE3B,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EACX,aAAa,EACb,mBAAmB,EACnB,oBAAoB,EACpB,MAAM,mBAAmB,CAAC;AAgB3B,OAAO,EAIN,KAAK,aAAa,EAClB,MAAM,iBAAiB,CAAC;AAGzB;;;;;;;;;GASG;AACH,MAAM,MAAM,WAAW,CAAC,OAAO,GAAG,YAAY,IAC3C,eAAe,CAAC,OAAO,CAAC,GACxB,OAAO,CAAC,aAAa,EAAE,YAAY,CAAC,GACpC,OAAO,CAAC;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7 +31,7 @@ function applySchemaToParserOptions(schema, options) {
31
31
  : {
32
32
  encode: (type, key) => {
33
33
  // translate stored key into property key.
34
- const simpleNodeSchema = context.schema.get((0, index_js_2.brand)(type)) ?? (0, index_js_2.fail)("missing schema");
34
+ const simpleNodeSchema = context.schema.get((0, index_js_2.brand)(type)) ?? (0, index_js_2.fail)(0xb39 /* missing schema */);
35
35
  if ((0, objectNodeTypes_js_1.isObjectNodeSchema)(simpleNodeSchema)) {
36
36
  const propertyKey = simpleNodeSchema.storedKeyToPropertyKey.get(key);
37
37
  if (propertyKey !== undefined) {
@@ -49,9 +49,10 @@ function applySchemaToParserOptions(schema, options) {
49
49
  return key;
50
50
  },
51
51
  parse: (type, inputKey) => {
52
- const simpleNodeSchema = context.schema.get((0, index_js_2.brand)(type)) ?? (0, index_js_2.fail)("missing schema");
52
+ const simpleNodeSchema = context.schema.get((0, index_js_2.brand)(type)) ?? (0, index_js_2.fail)(0xb3a /* missing schema */);
53
53
  if ((0, objectNodeTypes_js_1.isObjectNodeSchema)(simpleNodeSchema)) {
54
- const info = simpleNodeSchema.flexKeyMap.get(inputKey) ?? (0, index_js_2.fail)("missing field info");
54
+ const info = simpleNodeSchema.flexKeyMap.get(inputKey) ??
55
+ (0, index_js_2.fail)(0xb3b /* missing field info */);
55
56
  return info.storedKey;
56
57
  }
57
58
  return (0, index_js_2.brand)(inputKey);
@@ -166,7 +167,7 @@ function verboseFromCursor(reader, rootSchema, options) {
166
167
  exports.verboseFromCursor = verboseFromCursor;
167
168
  function verboseFromCursorInner(reader, options, schema) {
168
169
  const fields = (0, customTree_js_1.customFromCursor)(reader, options, schema, verboseFromCursorInner);
169
- const nodeSchema = schema.get(reader.type) ?? (0, index_js_2.fail)("missing schema for type in cursor");
170
+ const nodeSchema = schema.get(reader.type) ?? (0, index_js_2.fail)(0xb3c /* missing schema for type in cursor */);
170
171
  if (nodeSchema.kind === index_js_3.NodeKind.Leaf) {
171
172
  return fields;
172
173
  }
@@ -1 +1 @@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served.\n * Licensed under the MIT License.\n */\n\nimport type { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport { isFluidHandle } from \"@fluidframework/runtime-utils/internal\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\taboveRootPlaceholder,\n\tEmptyKey,\n\tkeyAsDetachedField,\n\ttype FieldKey,\n\ttype ITreeCursor,\n\ttype ITreeCursorSynchronous,\n\ttype TreeNodeSchemaIdentifier,\n} from \"../../core/index.js\";\nimport { brand, fail } from \"../../util/index.js\";\nimport type {\n\tTreeLeafValue,\n\tImplicitFieldSchema,\n\tImplicitAllowedTypes,\n} from \"../schemaTypes.js\";\nimport { NodeKind, type TreeNodeSchema } from \"../core/index.js\";\nimport {\n\tisTreeValue,\n\tstackTreeFieldCursor,\n\tstackTreeNodeCursor,\n\ttype CursorAdapter,\n} from \"../../feature-libraries/index.js\";\nimport {\n\tbooleanSchema,\n\thandleSchema,\n\tnullSchema,\n\tnumberSchema,\n\tstringSchema,\n} from \"../leafNodeSchema.js\";\nimport { isObjectNodeSchema } from \"../objectNodeTypes.js\";\nimport {\n\tcustomFromCursor,\n\ttype CustomTreeNode,\n\ttype CustomTreeValue,\n\ttype EncodeOptions,\n} from \"./customTree.js\";\nimport { getUnhydratedContext } from \"../createContext.js\";\n\n/**\n * Verbose encoding of a {@link TreeNode} or {@link TreeLeafValue}.\n * @remarks\n * This is verbose meaning that every {@link TreeNode} is a {@link VerboseTreeNode}.\n * Any IFluidHandle values have been replaced by `THandle`.\n * @privateRemarks\n * This can store all possible simple trees,\n * but it can not store all possible trees representable by our internal representations like FlexTree and JsonableTree.\n * @alpha\n */\nexport type VerboseTree<THandle = IFluidHandle> =\n\t| VerboseTreeNode<THandle>\n\t| Exclude<TreeLeafValue, IFluidHandle>\n\t| THandle;\n\n/**\n * Verbose encoding of a {@link TreeNode}.\n * @remarks\n * This is verbose meaning that every {@link TreeNode} has an explicit `type` property, and `fields`.\n * This allowed VerboseTreeNode to be unambiguous regarding which type each node is without relying on symbols or hidden state.\n *\n * Any IFluidHandle values have been replaced by `THandle`. If the `THandle` is JSON compatible, then this type is JSON compatible as well.\n *\n * @privateRemarks\n * This type is only used for data which is copied into and out of the tree.\n * When being copied out, its fine to have the data be mutable since its a copy.\n *\n * When being copied in, we don't need to mutate, so we could use a readonly variant of this type.\n * however the copy in case (createFromVerbose) probably isn't harmed much by just reusing this type as is,\n * since if the caller has immutable data, TypeScript doesn't prevent assigning immutable data to a mutable type anyway.\n * Also relaxing the input methods to take readonly data would be a non-breaking change so it can be done later if desired.\n *\n * This format is simple-tree specialized alternative to {@link JsonableTree}.\n * This format allows for all simple-tree compatible trees to be represented.\n *\n * Unlike `JsonableTree`, leaf nodes are not boxed into node objects, and instead have their schema inferred from the value.\n * Additionally, sequence fields can only occur on a node that has a single sequence field (with the empty key)\n * replicating the behavior of simple-tree ArrayNodes.\n * @alpha\n */\nexport interface VerboseTreeNode<THandle = IFluidHandle> {\n\t/**\n\t * The meaning of this node.\n\t * Provides contexts/semantics for this node and its content.\n\t * @remarks\n\t * Typically used to associate a node with metadata (including a schema) and source code (types, behaviors, etc).\n\t * When used with this package's schema system, it will be the {@link TreeNodeSchemaCore.identifier}.\n\t */\n\ttype: string;\n\n\t/**\n\t * Content of this node.\n\t * For array nodes, an array of children.\n\t * For map and object nodes, an object which children under keys.\n\t * @remarks\n\t * For object nodes, the keys could be either the stored keys, or the property keys depending on usage.\n\t */\n\tfields:\n\t\t| VerboseTree<THandle>[]\n\t\t| {\n\t\t\t\t[key: string]: VerboseTree<THandle>;\n\t\t };\n}\n\n/**\n * Options for how to interpret a `VerboseTree<TCustom>` when schema information is available.\n * @alpha\n */\nexport interface ParseOptions<TCustom> {\n\t/**\n\t * Fixup custom input formats.\n\t * @remarks\n\t * Main usage is to handle IFluidHandles.\n\t * When targeting JSON compatibility,\n\t * this may be by throwing an error or including a placeholder.\n\t * Since IFluidHandles are special references to FLuid data which is garbage collected when not referenced by the container for long enough,\n\t * any scheme for encoding handles for storage outside the container (or in formats the container does not understand) is unreliable.\n\t */\n\tvalueConverter(data: VerboseTree<TCustom>): TreeLeafValue | VerboseTreeNode<TCustom>;\n\t/**\n\t * If true, interpret the input keys of object nodes as stored keys.\n\t * If false, interpret them as property keys.\n\t * @defaultValue false.\n\t */\n\treadonly useStoredKeys?: boolean;\n}\n\n/**\n * Options for how to interpret a `VerboseTree<TCustom>` without relying on schema.\n */\nexport interface SchemalessParseOptions<TCustom> {\n\t/**\n\t * Fixup custom input formats.\n\t * @remarks\n\t * See note on {@link ParseOptions.valueConverter}.\n\t */\n\tvalueConverter(data: VerboseTree<TCustom>): TreeLeafValue | VerboseTreeNode<TCustom>;\n\t/**\n\t * Converts stored keys into whatever key the tree is using in its encoding.\n\t */\n\tkeyConverter?: {\n\t\tparse(type: string, inputKey: string): FieldKey;\n\t\tencode(type: string, key: FieldKey): string;\n\t};\n}\n\n/**\n * Use info from `schema` to convert `options` to {@link SchemalessParseOptions}.\n */\nexport function applySchemaToParserOptions<TCustom>(\n\tschema: ImplicitFieldSchema,\n\toptions: ParseOptions<TCustom>,\n): SchemalessParseOptions<TCustom> {\n\tconst config: Required<ParseOptions<TCustom>> = {\n\t\tuseStoredKeys: false,\n\t\t...options,\n\t};\n\n\tconst context = getUnhydratedContext(schema);\n\n\treturn {\n\t\tvalueConverter: config.valueConverter,\n\t\tkeyConverter: config.useStoredKeys\n\t\t\t? undefined\n\t\t\t: {\n\t\t\t\t\tencode: (type, key: FieldKey): string => {\n\t\t\t\t\t\t// translate stored key into property key.\n\t\t\t\t\t\tconst simpleNodeSchema = context.schema.get(brand(type)) ?? fail(\"missing schema\");\n\t\t\t\t\t\tif (isObjectNodeSchema(simpleNodeSchema)) {\n\t\t\t\t\t\t\tconst propertyKey = simpleNodeSchema.storedKeyToPropertyKey.get(key);\n\t\t\t\t\t\t\tif (propertyKey !== undefined) {\n\t\t\t\t\t\t\t\treturn propertyKey;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// Looking up an out of schema key.\n\t\t\t\t\t\t\t// This must point to a non-existent field.\n\t\t\t\t\t\t\t// It's possible that the key, if we returned it unmodified, could point to some data\n\t\t\t\t\t\t\t// (for example if looking up a key which is a stored key already when using property keys).\n\t\t\t\t\t\t\t// Thus return an arbitrary key that was selected randomly, so should not exist on non-adversarial data:\n\t\t\t\t\t\t\tconst arbitrary = \"arbitrary unused key: fe71614a-bf3e-43b3-b7b0-4cef39538e90\";\n\t\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\t\t!simpleNodeSchema.storedKeyToPropertyKey.has(brand(arbitrary)),\n\t\t\t\t\t\t\t\t0xa13 /* arbitrarily selected unused key was actually used */,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\treturn arbitrary;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn key;\n\t\t\t\t\t},\n\t\t\t\t\tparse: (type, inputKey): FieldKey => {\n\t\t\t\t\t\tconst simpleNodeSchema = context.schema.get(brand(type)) ?? fail(\"missing schema\");\n\t\t\t\t\t\tif (isObjectNodeSchema(simpleNodeSchema)) {\n\t\t\t\t\t\t\tconst info =\n\t\t\t\t\t\t\t\tsimpleNodeSchema.flexKeyMap.get(inputKey) ?? fail(\"missing field info\");\n\t\t\t\t\t\t\treturn info.storedKey;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn brand(inputKey);\n\t\t\t\t\t},\n\t\t\t\t},\n\t};\n}\n\n/**\n * Used to read a VerboseTree as a node cursor.\n *\n * @returns an {@link ITreeCursorSynchronous} for a single node in nodes mode.\n */\nexport function cursorFromVerbose<TCustom>(\n\tdata: VerboseTree<TCustom>,\n\toptions: SchemalessParseOptions<TCustom>,\n): ITreeCursorSynchronous {\n\treturn stackTreeNodeCursor(verboseTreeAdapter(options), data);\n}\n\n/**\n * Used to read a VerboseTree[] as a field cursor.\n *\n * @returns an {@link ITreeCursorSynchronous} for a single field in fields mode.\n */\nexport function fieldCursorFromVerbose<TCustom>(\n\tdata: VerboseTree<TCustom>[],\n\toptions: SchemalessParseOptions<TCustom>,\n): ITreeCursorSynchronous {\n\treturn stackTreeFieldCursor(\n\t\tverboseTreeAdapter(options),\n\t\t{ type: aboveRootPlaceholder, fields: data },\n\t\tkeyAsDetachedField(EmptyKey),\n\t);\n}\n\nfunction verboseTreeAdapter<TCustom>(\n\toptions: SchemalessParseOptions<TCustom>,\n): CursorAdapter<VerboseTree<TCustom>> {\n\treturn {\n\t\tvalue: (input: VerboseTree<TCustom>) => {\n\t\t\tconst node = options.valueConverter(input);\n\t\t\treturn isTreeValue(node) ? node : undefined;\n\t\t},\n\t\ttype: (input: VerboseTree<TCustom>) => {\n\t\t\tconst node = options.valueConverter(input);\n\t\t\tswitch (typeof node) {\n\t\t\t\tcase \"number\":\n\t\t\t\t\treturn numberSchema.identifier as TreeNodeSchemaIdentifier;\n\t\t\t\tcase \"string\":\n\t\t\t\t\treturn stringSchema.identifier as TreeNodeSchemaIdentifier;\n\t\t\t\tcase \"boolean\":\n\t\t\t\t\treturn booleanSchema.identifier as TreeNodeSchemaIdentifier;\n\t\t\t\tdefault:\n\t\t\t\t\tif (node === null) {\n\t\t\t\t\t\treturn nullSchema.identifier as TreeNodeSchemaIdentifier;\n\t\t\t\t\t}\n\t\t\t\t\tif (isFluidHandle(node)) {\n\t\t\t\t\t\treturn handleSchema.identifier as TreeNodeSchemaIdentifier;\n\t\t\t\t\t}\n\t\t\t\t\treturn node.type as TreeNodeSchemaIdentifier;\n\t\t\t}\n\t\t},\n\t\tkeysFromNode: (input: VerboseTree<TCustom>): readonly FieldKey[] => {\n\t\t\tconst node = options.valueConverter(input);\n\t\t\tswitch (typeof node) {\n\t\t\t\tcase \"object\": {\n\t\t\t\t\tif (node === null) {\n\t\t\t\t\t\treturn [];\n\t\t\t\t\t}\n\t\t\t\t\tif (isFluidHandle(node)) {\n\t\t\t\t\t\treturn [];\n\t\t\t\t\t}\n\t\t\t\t\tif (Array.isArray(node.fields)) {\n\t\t\t\t\t\treturn node.fields.length === 0 ? [] : [EmptyKey];\n\t\t\t\t\t}\n\n\t\t\t\t\tconst inputKeys = Object.keys(node.fields);\n\t\t\t\t\tconst converter = options.keyConverter;\n\t\t\t\t\tif (converter === undefined) {\n\t\t\t\t\t\treturn inputKeys as FieldKey[];\n\t\t\t\t\t}\n\t\t\t\t\treturn inputKeys.map((k) => converter.parse(node.type, k));\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\treturn [];\n\t\t\t}\n\t\t},\n\t\tgetFieldFromNode: (\n\t\t\tinput: VerboseTree<TCustom>,\n\t\t\tkey: FieldKey,\n\t\t): readonly VerboseTree<TCustom>[] => {\n\t\t\tconst node = options.valueConverter(input);\n\t\t\t// Object.prototype.hasOwnProperty can return true for strings (ex: with key \"0\"), so we have to filter them out.\n\t\t\t// Rather than just special casing strings, we can handle them with an early return for all primitives.\n\t\t\tif (typeof node !== \"object\") {\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\tif (node === null) {\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\tif (isFluidHandle(node)) {\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\tif (Array.isArray(node.fields)) {\n\t\t\t\treturn key === EmptyKey ? node.fields : [];\n\t\t\t}\n\n\t\t\tconst convertedKey =\n\t\t\t\toptions.keyConverter === undefined ? key : options.keyConverter.encode(node.type, key);\n\n\t\t\tif (Object.prototype.hasOwnProperty.call(node.fields, convertedKey)) {\n\t\t\t\tconst field = node.fields[convertedKey];\n\t\t\t\treturn field === undefined ? [] : [field];\n\t\t\t}\n\n\t\t\treturn [];\n\t\t},\n\t};\n}\n\n/**\n * Used to read a node cursor as a VerboseTree.\n */\nexport function verboseFromCursor<TCustom>(\n\treader: ITreeCursor,\n\trootSchema: ImplicitAllowedTypes,\n\toptions: EncodeOptions<TCustom>,\n): VerboseTree<TCustom> {\n\tconst config: Required<EncodeOptions<TCustom>> = {\n\t\tuseStoredKeys: false,\n\t\t...options,\n\t};\n\n\tconst schemaMap = getUnhydratedContext(rootSchema).schema;\n\n\treturn verboseFromCursorInner(reader, config, schemaMap);\n}\n\nfunction verboseFromCursorInner<TCustom>(\n\treader: ITreeCursor,\n\toptions: Required<EncodeOptions<TCustom>>,\n\tschema: ReadonlyMap<string, TreeNodeSchema>,\n): VerboseTree<TCustom> {\n\tconst fields = customFromCursor(reader, options, schema, verboseFromCursorInner);\n\tconst nodeSchema = schema.get(reader.type) ?? fail(\"missing schema for type in cursor\");\n\tif (nodeSchema.kind === NodeKind.Leaf) {\n\t\treturn fields as CustomTreeValue<TCustom>;\n\t}\n\n\treturn {\n\t\ttype: reader.type,\n\t\tfields: fields as CustomTreeNode<TCustom>,\n\t};\n}\n"]}
1
+ {"version":3,"file":"verboseTree.js","sourceRoot":"","sources":["../../../src/simple-tree/api/verboseTree.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,qEAAuE;AACvE,kEAA6D;AAE7D,kDAQ6B;AAC7B,kDAAkD;AAMlD,+CAAiE;AACjE,+DAK0C;AAC1C,4DAM8B;AAC9B,8DAA2D;AAC3D,mDAKyB;AACzB,0DAA2D;AA4G3D;;GAEG;AACH,SAAgB,0BAA0B,CACzC,MAA2B,EAC3B,OAA8B;IAE9B,MAAM,MAAM,GAAoC;QAC/C,aAAa,EAAE,KAAK;QACpB,GAAG,OAAO;KACV,CAAC;IAEF,MAAM,OAAO,GAAG,IAAA,uCAAoB,EAAC,MAAM,CAAC,CAAC;IAE7C,OAAO;QACN,cAAc,EAAE,MAAM,CAAC,cAAc;QACrC,YAAY,EAAE,MAAM,CAAC,aAAa;YACjC,CAAC,CAAC,SAAS;YACX,CAAC,CAAC;gBACA,MAAM,EAAE,CAAC,IAAI,EAAE,GAAa,EAAU,EAAE;oBACvC,0CAA0C;oBAC1C,MAAM,gBAAgB,GACrB,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,IAAA,gBAAK,EAAC,IAAI,CAAC,CAAC,IAAI,IAAA,eAAI,EAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;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,MAAM,GAAG,IAAA,gCAAgB,EAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,sBAAsB,CAAC,CAAC;IACjF,MAAM,UAAU,GACf,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,IAAA,eAAI,EAAC,KAAK,CAAC,uCAAuC,CAAC,CAAC;IAChF,IAAI,UAAU,CAAC,IAAI,KAAK,mBAAQ,CAAC,IAAI,EAAE,CAAC;QACvC,OAAO,MAAkC,CAAC;IAC3C,CAAC;IAED,OAAO;QACN,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,MAAM,EAAE,MAAiC;KACzC,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport { isFluidHandle } from \"@fluidframework/runtime-utils/internal\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\taboveRootPlaceholder,\n\tEmptyKey,\n\tkeyAsDetachedField,\n\ttype FieldKey,\n\ttype ITreeCursor,\n\ttype ITreeCursorSynchronous,\n\ttype TreeNodeSchemaIdentifier,\n} from \"../../core/index.js\";\nimport { brand, fail } from \"../../util/index.js\";\nimport type {\n\tTreeLeafValue,\n\tImplicitFieldSchema,\n\tImplicitAllowedTypes,\n} from \"../schemaTypes.js\";\nimport { NodeKind, type TreeNodeSchema } from \"../core/index.js\";\nimport {\n\tisTreeValue,\n\tstackTreeFieldCursor,\n\tstackTreeNodeCursor,\n\ttype CursorAdapter,\n} from \"../../feature-libraries/index.js\";\nimport {\n\tbooleanSchema,\n\thandleSchema,\n\tnullSchema,\n\tnumberSchema,\n\tstringSchema,\n} from \"../leafNodeSchema.js\";\nimport { isObjectNodeSchema } from \"../objectNodeTypes.js\";\nimport {\n\tcustomFromCursor,\n\ttype CustomTreeNode,\n\ttype CustomTreeValue,\n\ttype EncodeOptions,\n} from \"./customTree.js\";\nimport { getUnhydratedContext } from \"../createContext.js\";\n\n/**\n * Verbose encoding of a {@link TreeNode} or {@link TreeLeafValue}.\n * @remarks\n * This is verbose meaning that every {@link TreeNode} is a {@link VerboseTreeNode}.\n * Any IFluidHandle values have been replaced by `THandle`.\n * @privateRemarks\n * This can store all possible simple trees,\n * but it can not store all possible trees representable by our internal representations like FlexTree and JsonableTree.\n * @alpha\n */\nexport type VerboseTree<THandle = IFluidHandle> =\n\t| VerboseTreeNode<THandle>\n\t| Exclude<TreeLeafValue, IFluidHandle>\n\t| THandle;\n\n/**\n * Verbose encoding of a {@link TreeNode}.\n * @remarks\n * This is verbose meaning that every {@link TreeNode} has an explicit `type` property, and `fields`.\n * This allowed VerboseTreeNode to be unambiguous regarding which type each node is without relying on symbols or hidden state.\n *\n * Any IFluidHandle values have been replaced by `THandle`. If the `THandle` is JSON compatible, then this type is JSON compatible as well.\n *\n * @privateRemarks\n * This type is only used for data which is copied into and out of the tree.\n * When being copied out, its fine to have the data be mutable since its a copy.\n *\n * When being copied in, we don't need to mutate, so we could use a readonly variant of this type.\n * however the copy in case (createFromVerbose) probably isn't harmed much by just reusing this type as is,\n * since if the caller has immutable data, TypeScript doesn't prevent assigning immutable data to a mutable type anyway.\n * Also relaxing the input methods to take readonly data would be a non-breaking change so it can be done later if desired.\n *\n * This format is simple-tree specialized alternative to {@link JsonableTree}.\n * This format allows for all simple-tree compatible trees to be represented.\n *\n * Unlike `JsonableTree`, leaf nodes are not boxed into node objects, and instead have their schema inferred from the value.\n * Additionally, sequence fields can only occur on a node that has a single sequence field (with the empty key)\n * replicating the behavior of simple-tree ArrayNodes.\n * @alpha\n */\nexport interface VerboseTreeNode<THandle = IFluidHandle> {\n\t/**\n\t * The meaning of this node.\n\t * Provides contexts/semantics for this node and its content.\n\t * @remarks\n\t * Typically used to associate a node with metadata (including a schema) and source code (types, behaviors, etc).\n\t * When used with this package's schema system, it will be the {@link TreeNodeSchemaCore.identifier}.\n\t */\n\ttype: string;\n\n\t/**\n\t * Content of this node.\n\t * For array nodes, an array of children.\n\t * For map and object nodes, an object which children under keys.\n\t * @remarks\n\t * For object nodes, the keys could be either the stored keys, or the property keys depending on usage.\n\t */\n\tfields:\n\t\t| VerboseTree<THandle>[]\n\t\t| {\n\t\t\t\t[key: string]: VerboseTree<THandle>;\n\t\t };\n}\n\n/**\n * Options for how to interpret a `VerboseTree<TCustom>` when schema information is available.\n * @alpha\n */\nexport interface ParseOptions<TCustom> {\n\t/**\n\t * Fixup custom input formats.\n\t * @remarks\n\t * Main usage is to handle IFluidHandles.\n\t * When targeting JSON compatibility,\n\t * this may be by throwing an error or including a placeholder.\n\t * Since IFluidHandles are special references to FLuid data which is garbage collected when not referenced by the container for long enough,\n\t * any scheme for encoding handles for storage outside the container (or in formats the container does not understand) is unreliable.\n\t */\n\tvalueConverter(data: VerboseTree<TCustom>): TreeLeafValue | VerboseTreeNode<TCustom>;\n\t/**\n\t * If true, interpret the input keys of object nodes as stored keys.\n\t * If false, interpret them as property keys.\n\t * @defaultValue false.\n\t */\n\treadonly useStoredKeys?: boolean;\n}\n\n/**\n * Options for how to interpret a `VerboseTree<TCustom>` without relying on schema.\n */\nexport interface SchemalessParseOptions<TCustom> {\n\t/**\n\t * Fixup custom input formats.\n\t * @remarks\n\t * See note on {@link ParseOptions.valueConverter}.\n\t */\n\tvalueConverter(data: VerboseTree<TCustom>): TreeLeafValue | VerboseTreeNode<TCustom>;\n\t/**\n\t * Converts stored keys into whatever key the tree is using in its encoding.\n\t */\n\tkeyConverter?: {\n\t\tparse(type: string, inputKey: string): FieldKey;\n\t\tencode(type: string, key: FieldKey): string;\n\t};\n}\n\n/**\n * Use info from `schema` to convert `options` to {@link SchemalessParseOptions}.\n */\nexport function applySchemaToParserOptions<TCustom>(\n\tschema: ImplicitFieldSchema,\n\toptions: ParseOptions<TCustom>,\n): SchemalessParseOptions<TCustom> {\n\tconst config: Required<ParseOptions<TCustom>> = {\n\t\tuseStoredKeys: false,\n\t\t...options,\n\t};\n\n\tconst context = getUnhydratedContext(schema);\n\n\treturn {\n\t\tvalueConverter: config.valueConverter,\n\t\tkeyConverter: config.useStoredKeys\n\t\t\t? undefined\n\t\t\t: {\n\t\t\t\t\tencode: (type, key: FieldKey): string => {\n\t\t\t\t\t\t// translate stored key into property key.\n\t\t\t\t\t\tconst simpleNodeSchema =\n\t\t\t\t\t\t\tcontext.schema.get(brand(type)) ?? fail(0xb39 /* missing schema */);\n\t\t\t\t\t\tif (isObjectNodeSchema(simpleNodeSchema)) {\n\t\t\t\t\t\t\tconst propertyKey = simpleNodeSchema.storedKeyToPropertyKey.get(key);\n\t\t\t\t\t\t\tif (propertyKey !== undefined) {\n\t\t\t\t\t\t\t\treturn propertyKey;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// Looking up an out of schema key.\n\t\t\t\t\t\t\t// This must point to a non-existent field.\n\t\t\t\t\t\t\t// It's possible that the key, if we returned it unmodified, could point to some data\n\t\t\t\t\t\t\t// (for example if looking up a key which is a stored key already when using property keys).\n\t\t\t\t\t\t\t// Thus return an arbitrary key that was selected randomly, so should not exist on non-adversarial data:\n\t\t\t\t\t\t\tconst arbitrary = \"arbitrary unused key: fe71614a-bf3e-43b3-b7b0-4cef39538e90\";\n\t\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\t\t!simpleNodeSchema.storedKeyToPropertyKey.has(brand(arbitrary)),\n\t\t\t\t\t\t\t\t0xa13 /* arbitrarily selected unused key was actually used */,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\treturn arbitrary;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn key;\n\t\t\t\t\t},\n\t\t\t\t\tparse: (type, inputKey): FieldKey => {\n\t\t\t\t\t\tconst simpleNodeSchema =\n\t\t\t\t\t\t\tcontext.schema.get(brand(type)) ?? fail(0xb3a /* missing schema */);\n\t\t\t\t\t\tif (isObjectNodeSchema(simpleNodeSchema)) {\n\t\t\t\t\t\t\tconst info =\n\t\t\t\t\t\t\t\tsimpleNodeSchema.flexKeyMap.get(inputKey) ??\n\t\t\t\t\t\t\t\tfail(0xb3b /* missing field info */);\n\t\t\t\t\t\t\treturn info.storedKey;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn brand(inputKey);\n\t\t\t\t\t},\n\t\t\t\t},\n\t};\n}\n\n/**\n * Used to read a VerboseTree as a node cursor.\n *\n * @returns an {@link ITreeCursorSynchronous} for a single node in nodes mode.\n */\nexport function cursorFromVerbose<TCustom>(\n\tdata: VerboseTree<TCustom>,\n\toptions: SchemalessParseOptions<TCustom>,\n): ITreeCursorSynchronous {\n\treturn stackTreeNodeCursor(verboseTreeAdapter(options), data);\n}\n\n/**\n * Used to read a VerboseTree[] as a field cursor.\n *\n * @returns an {@link ITreeCursorSynchronous} for a single field in fields mode.\n */\nexport function fieldCursorFromVerbose<TCustom>(\n\tdata: VerboseTree<TCustom>[],\n\toptions: SchemalessParseOptions<TCustom>,\n): ITreeCursorSynchronous {\n\treturn stackTreeFieldCursor(\n\t\tverboseTreeAdapter(options),\n\t\t{ type: aboveRootPlaceholder, fields: data },\n\t\tkeyAsDetachedField(EmptyKey),\n\t);\n}\n\nfunction verboseTreeAdapter<TCustom>(\n\toptions: SchemalessParseOptions<TCustom>,\n): CursorAdapter<VerboseTree<TCustom>> {\n\treturn {\n\t\tvalue: (input: VerboseTree<TCustom>) => {\n\t\t\tconst node = options.valueConverter(input);\n\t\t\treturn isTreeValue(node) ? node : undefined;\n\t\t},\n\t\ttype: (input: VerboseTree<TCustom>) => {\n\t\t\tconst node = options.valueConverter(input);\n\t\t\tswitch (typeof node) {\n\t\t\t\tcase \"number\":\n\t\t\t\t\treturn numberSchema.identifier as TreeNodeSchemaIdentifier;\n\t\t\t\tcase \"string\":\n\t\t\t\t\treturn stringSchema.identifier as TreeNodeSchemaIdentifier;\n\t\t\t\tcase \"boolean\":\n\t\t\t\t\treturn booleanSchema.identifier as TreeNodeSchemaIdentifier;\n\t\t\t\tdefault:\n\t\t\t\t\tif (node === null) {\n\t\t\t\t\t\treturn nullSchema.identifier as TreeNodeSchemaIdentifier;\n\t\t\t\t\t}\n\t\t\t\t\tif (isFluidHandle(node)) {\n\t\t\t\t\t\treturn handleSchema.identifier as TreeNodeSchemaIdentifier;\n\t\t\t\t\t}\n\t\t\t\t\treturn node.type as TreeNodeSchemaIdentifier;\n\t\t\t}\n\t\t},\n\t\tkeysFromNode: (input: VerboseTree<TCustom>): readonly FieldKey[] => {\n\t\t\tconst node = options.valueConverter(input);\n\t\t\tswitch (typeof node) {\n\t\t\t\tcase \"object\": {\n\t\t\t\t\tif (node === null) {\n\t\t\t\t\t\treturn [];\n\t\t\t\t\t}\n\t\t\t\t\tif (isFluidHandle(node)) {\n\t\t\t\t\t\treturn [];\n\t\t\t\t\t}\n\t\t\t\t\tif (Array.isArray(node.fields)) {\n\t\t\t\t\t\treturn node.fields.length === 0 ? [] : [EmptyKey];\n\t\t\t\t\t}\n\n\t\t\t\t\tconst inputKeys = Object.keys(node.fields);\n\t\t\t\t\tconst converter = options.keyConverter;\n\t\t\t\t\tif (converter === undefined) {\n\t\t\t\t\t\treturn inputKeys as FieldKey[];\n\t\t\t\t\t}\n\t\t\t\t\treturn inputKeys.map((k) => converter.parse(node.type, k));\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\treturn [];\n\t\t\t}\n\t\t},\n\t\tgetFieldFromNode: (\n\t\t\tinput: VerboseTree<TCustom>,\n\t\t\tkey: FieldKey,\n\t\t): readonly VerboseTree<TCustom>[] => {\n\t\t\tconst node = options.valueConverter(input);\n\t\t\t// Object.prototype.hasOwnProperty can return true for strings (ex: with key \"0\"), so we have to filter them out.\n\t\t\t// Rather than just special casing strings, we can handle them with an early return for all primitives.\n\t\t\tif (typeof node !== \"object\") {\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\tif (node === null) {\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\tif (isFluidHandle(node)) {\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\tif (Array.isArray(node.fields)) {\n\t\t\t\treturn key === EmptyKey ? node.fields : [];\n\t\t\t}\n\n\t\t\tconst convertedKey =\n\t\t\t\toptions.keyConverter === undefined ? key : options.keyConverter.encode(node.type, key);\n\n\t\t\tif (Object.prototype.hasOwnProperty.call(node.fields, convertedKey)) {\n\t\t\t\tconst field = node.fields[convertedKey];\n\t\t\t\treturn field === undefined ? [] : [field];\n\t\t\t}\n\n\t\t\treturn [];\n\t\t},\n\t};\n}\n\n/**\n * Used to read a node cursor as a VerboseTree.\n */\nexport function verboseFromCursor<TCustom>(\n\treader: ITreeCursor,\n\trootSchema: ImplicitAllowedTypes,\n\toptions: EncodeOptions<TCustom>,\n): VerboseTree<TCustom> {\n\tconst config: Required<EncodeOptions<TCustom>> = {\n\t\tuseStoredKeys: false,\n\t\t...options,\n\t};\n\n\tconst schemaMap = getUnhydratedContext(rootSchema).schema;\n\n\treturn verboseFromCursorInner(reader, config, schemaMap);\n}\n\nfunction verboseFromCursorInner<TCustom>(\n\treader: ITreeCursor,\n\toptions: Required<EncodeOptions<TCustom>>,\n\tschema: ReadonlyMap<string, TreeNodeSchema>,\n): VerboseTree<TCustom> {\n\tconst fields = customFromCursor(reader, options, schema, verboseFromCursorInner);\n\tconst nodeSchema =\n\t\tschema.get(reader.type) ?? fail(0xb3c /* missing schema for type in cursor */);\n\tif (nodeSchema.kind === NodeKind.Leaf) {\n\t\treturn fields as CustomTreeValue<TCustom>;\n\t}\n\n\treturn {\n\t\ttype: reader.type,\n\t\tfields: fields as CustomTreeNode<TCustom>,\n\t};\n}\n"]}
@@ -172,7 +172,7 @@ class ViewSchema {
172
172
  // (unless its input is also never).
173
173
  for (const adapter of this.adapters?.tree ?? []) {
174
174
  if ((0, index_js_3.isNeverTree)(this.policy, this.viewSchemaAsStored, this.viewSchemaAsStored.nodeSchema.get(adapter.output))) {
175
- (0, index_js_2.fail)("tree adapter for stored adapter.output should not be never");
175
+ (0, index_js_2.fail)(0xb3d /* tree adapter for stored adapter.output should not be never */);
176
176
  }
177
177
  }
178
178
  const adapted = {