@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
@@ -1 +1 @@
1
- {"version":3,"file":"treeNodeApi.js","sourceRoot":"","sources":["../../../src/simple-tree/api/treeNodeApi.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,qCAAqC,CAAC;AAElE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAmB,WAAW,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAC5F,OAAO,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I,MAAM,CAAC,IAAI,KAAK,QAAQ,CAAC,MAAM,EAAE,CAAC;QACrC,OAAO,SAAS,CAAC;IAClB,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,CAAC,IAA2C,CAAC;IAElE,cAAc;IACd,iEAAiE;IACjE,uGAAuG;IACvG,6IAA6I;IAC7I,iEAAiE;IACjE,KAAK,MAAM,CAAC,WAAW,EAAE,WAAW,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QACjE,IAAI,WAAW,YAAY,WAAW,IAAI,WAAW,CAAC,KAAK,EAAE,GAAG,KAAK,SAAS,EAAE,CAAC;YAChF,OAAO,WAAW,CAAC;QACpB,CAAC;IACF,CAAC;IAED,IAAI,MAAM,CAAC,SAAS,CAAC,KAAK,SAAS,EAAE,CAAC;QACrC,IAAI,CAAC,yDAAyD,CAAC,CAAC;IACjE,CAAC;IAED,OAAO,SAAS,CAAC;AAClB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, oob } from \"@fluidframework/core-utils/internal\";\n\nimport { EmptyKey, rootFieldKey } from \"../../core/index.js\";\nimport { type TreeStatus, isTreeValue, FieldKinds } from \"../../feature-libraries/index.js\";\nimport { fail, extractFromOpaque, isReadonlyArray } from \"../../util/index.js\";\nimport {\n\ttype TreeLeafValue,\n\ttype ImplicitFieldSchema,\n\tFieldSchema,\n\ttype ImplicitAllowedTypes,\n\ttype TreeNodeFromImplicitAllowedTypes,\n} from \"../schemaTypes.js\";\nimport {\n\tbooleanSchema,\n\thandleSchema,\n\tnullSchema,\n\tnumberSchema,\n\tstringSchema,\n} from \"../leafNodeSchema.js\";\nimport { isFluidHandle } from \"@fluidframework/runtime-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\nimport type { Off } from \"@fluidframework/core-interfaces\";\nimport {\n\tgetKernel,\n\tisTreeNode,\n\ttype TreeNodeSchema,\n\tNodeKind,\n\ttype TreeNode,\n\ttype TreeChangeEvents,\n\ttryGetTreeNodeSchema,\n\tgetOrCreateNodeFromInnerNode,\n\tUnhydratedFlexTreeNode,\n\ttypeSchemaSymbol,\n\tgetOrCreateInnerNode,\n} from \"../core/index.js\";\nimport { isObjectNodeSchema } from \"../objectNodeTypes.js\";\nimport { isLazy, type LazyItem } from \"../flexList.js\";\n\n/**\n * Provides various functions for analyzing {@link TreeNode}s.\n * * @remarks\n * This type should only be used via the public `Tree` export.\n * @privateRemarks\n * Due to limitations of API-Extractor link resolution, this type can't be moved into internalTypes but should be considered just an implementation detail of the `Tree` export.\n *\n * Inlining the typing of this interface onto the `Tree` object provides slightly different .d.ts generation,\n * which avoids typescript expanding the type of TreeNodeSchema and thus encountering\n * https://github.com/microsoft/rushstack/issues/1958.\n * @sealed @public\n */\nexport interface TreeNodeApi {\n\t/**\n\t * The schema information for this node.\n\t */\n\tschema(node: TreeNode | TreeLeafValue): TreeNodeSchema;\n\n\t/**\n\t * Narrow the type of the given value if it satisfies the given schema.\n\t * @example\n\t * ```ts\n\t * if (node.is(myNode, Point)) {\n\t * const y = myNode.y; // `myNode` is now known to satisfy the `Point` schema and therefore has a `y` coordinate.\n\t * }\n\t * ```\n\t */\n\tis<TSchema extends ImplicitAllowedTypes>(\n\t\tvalue: unknown,\n\t\tschema: TSchema,\n\t): value is TreeNodeFromImplicitAllowedTypes<TSchema>;\n\n\t/**\n\t * Return the node under which this node resides in the tree (or undefined if this is a root node of the tree).\n\t */\n\tparent(node: TreeNode): TreeNode | undefined;\n\n\t/**\n\t * The key of the given node under its parent.\n\t * @remarks\n\t * If `node` is an element in a {@link (TreeArrayNode:interface)}, this returns the index of `node` in the array node (a `number`).\n\t * Otherwise, this returns the key of the field that it is under (a `string`).\n\t */\n\tkey(node: TreeNode): string | number;\n\n\t/**\n\t * Register an event listener on the given node.\n\t * @param node - The node whose events should be subscribed to.\n\t * @param eventName - Which event to subscribe to.\n\t * @param listener - The callback to trigger for the event. The tree can be read during the callback, but it is invalid to modify the tree during this callback.\n\t * @returns A callback function which will deregister the event.\n\t * This callback should be called only once.\n\t */\n\ton<K extends keyof TreeChangeEvents>(\n\t\tnode: TreeNode,\n\t\teventName: K,\n\t\tlistener: TreeChangeEvents[K],\n\t): () => void;\n\n\t/**\n\t * Returns the {@link TreeStatus} of the given node.\n\t */\n\tstatus(node: TreeNode): TreeStatus;\n\n\t/**\n\t * Returns the {@link SchemaFactory.identifier | identifier} of the given node in the most compressed form possible.\n\t * @remarks\n\t * If the node's identifier is a valid UUID that was automatically generated by the SharedTree, then this will return a process-unique integer corresponding to that identifier.\n\t * Note that the node must already have been inserted into the tree in order to retrieve a generated UUID (or shortId will error).\n\t * This is useful for performance-sensitive scenarios involving many nodes with identifiers that need to be compactly retained in memory or used for efficient lookup.\n\t *\n\t * If the node's identifier is any other user-provided string, then this will return that string.\n\t *\n\t * If the node has no identifier (that is, it has no {@link SchemaFactory.identifier | identifier} field), then this returns `undefined`.\n\t *\n\t * If the node has more than one identifier, then this will throw an error.\n\t *\n\t * The returned integer must not be serialized or preserved outside of the current process.\n\t * Its lifetime is that of the current in-memory instance of the FF container for this client, and it is not guaranteed to be unique or stable outside of that context.\n\t * The same node's identifier may, for example, be different across multiple sessions for the same client and document, or different across two clients in the same session.\n\t */\n\tshortId(node: TreeNode): number | string | undefined;\n}\n\n/**\n * The `Tree` object holds various functions for analyzing {@link TreeNode}s.\n */\nexport const treeNodeApi: TreeNodeApi = {\n\tparent(node: TreeNode): TreeNode | undefined {\n\t\tconst editNode = getOrCreateInnerNode(node).parentField.parent.parent;\n\t\tif (editNode === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst output = getOrCreateNodeFromInnerNode(editNode);\n\t\tassert(\n\t\t\t!isTreeValue(output),\n\t\t\t0x87f /* Parent can't be a leaf, so it should be a node not a value */,\n\t\t);\n\t\treturn output;\n\t},\n\tkey(node: TreeNode): string | number {\n\t\t// If the parent is undefined, then this node is under the root field,\n\t\t// so we know its key is the special root one.\n\t\tconst parent = treeNodeApi.parent(node);\n\t\tif (parent === undefined) {\n\t\t\treturn rootFieldKey;\n\t\t}\n\n\t\t// The flex-domain strictly operates in terms of \"stored keys\".\n\t\t// To find the associated developer-facing \"property key\", we need to look up the field associated with\n\t\t// the stored key from the flex-domain, and get property key its simple-domain counterpart was created with.\n\t\tconst storedKey = getStoredKey(node);\n\t\tconst parentSchema = treeNodeApi.schema(parent);\n\t\tconst propertyKey = getPropertyKeyFromStoredKey(parentSchema, storedKey);\n\t\treturn propertyKey;\n\t},\n\ton<K extends keyof TreeChangeEvents>(\n\t\tnode: TreeNode,\n\t\teventName: K,\n\t\tlistener: TreeChangeEvents[K],\n\t): Off {\n\t\tconst kernel = getKernel(node);\n\t\tswitch (eventName) {\n\t\t\tcase \"nodeChanged\": {\n\t\t\t\tconst nodeSchema = kernel.schema;\n\t\t\t\tif (isObjectNodeSchema(nodeSchema)) {\n\t\t\t\t\treturn kernel.events.on(\"childrenChangedAfterBatch\", ({ changedFields }) => {\n\t\t\t\t\t\tconst changedProperties = new Set(\n\t\t\t\t\t\t\tArray.from(\n\t\t\t\t\t\t\t\tchangedFields,\n\t\t\t\t\t\t\t\t(field) =>\n\t\t\t\t\t\t\t\t\tnodeSchema.storedKeyToPropertyKey.get(field) ??\n\t\t\t\t\t\t\t\t\tfail(\"Could not find stored key in schema.\"),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tlistener({ changedProperties });\n\t\t\t\t\t});\n\t\t\t\t} else if (nodeSchema.kind === NodeKind.Array) {\n\t\t\t\t\treturn kernel.events.on(\"childrenChangedAfterBatch\", () => {\n\t\t\t\t\t\tlistener({ changedProperties: undefined });\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\treturn kernel.events.on(\"childrenChangedAfterBatch\", ({ changedFields }) => {\n\t\t\t\t\t\tlistener({ changedProperties: changedFields });\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t\tcase \"treeChanged\": {\n\t\t\t\treturn kernel.events.on(\"subtreeChangedAfterBatch\", () => listener({}));\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tthrow new UsageError(`No event named ${JSON.stringify(eventName)}.`);\n\t\t}\n\t},\n\tstatus(node: TreeNode): TreeStatus {\n\t\treturn getKernel(node).getStatus();\n\t},\n\tis<TSchema extends ImplicitAllowedTypes>(\n\t\tvalue: unknown,\n\t\tschema: TSchema,\n\t): value is TreeNodeFromImplicitAllowedTypes<TSchema> {\n\t\tconst actualSchema = tryGetSchema(value);\n\t\tif (actualSchema === undefined) {\n\t\t\treturn false;\n\t\t}\n\t\tif (isReadonlyArray<LazyItem<TreeNodeSchema>>(schema)) {\n\t\t\tfor (const singleSchema of schema) {\n\t\t\t\tconst testSchema = isLazy(singleSchema) ? singleSchema() : singleSchema;\n\t\t\t\tif (testSchema === actualSchema) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false;\n\t\t} else {\n\t\t\t// Linter is incorrect about this bering unnecessary: it does not compile without the type assertion.\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n\t\t\treturn (schema as TreeNodeSchema) === actualSchema;\n\t\t}\n\t},\n\tschema(node: TreeNode | TreeLeafValue): TreeNodeSchema {\n\t\treturn tryGetSchema(node) ?? fail(\"Not a tree node\");\n\t},\n\tshortId(node: TreeNode): number | string | undefined {\n\t\tconst schema = node[typeSchemaSymbol];\n\t\tif (!isObjectNodeSchema(schema)) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst flexNode = getOrCreateInnerNode(node);\n\t\tconst identifierFieldKeys = schema.identifierFieldKeys;\n\n\t\tswitch (identifierFieldKeys.length) {\n\t\t\tcase 0:\n\t\t\t\treturn undefined;\n\t\t\tcase 1: {\n\t\t\t\tconst identifier = flexNode.tryGetField(identifierFieldKeys[0] ?? oob())?.boxedAt(0);\n\t\t\t\tif (flexNode instanceof UnhydratedFlexTreeNode) {\n\t\t\t\t\tif (identifier === undefined) {\n\t\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t\t\"Tree.shortId cannot access default identifiers on unhydrated nodes\",\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\treturn identifier.value as string;\n\t\t\t\t}\n\t\t\t\tassert(\n\t\t\t\t\tidentifier?.context.isHydrated() === true,\n\t\t\t\t\t0xa27 /* Expected hydrated identifier */,\n\t\t\t\t);\n\t\t\t\tconst identifierValue = identifier.value as string;\n\n\t\t\t\tconst localNodeKey =\n\t\t\t\t\tidentifier.context.nodeKeyManager.tryLocalizeNodeKey(identifierValue);\n\t\t\t\treturn localNodeKey !== undefined ? extractFromOpaque(localNodeKey) : identifierValue;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\"shortId() may not be called on a node with more than one identifier. Consider converting extraneous identifier fields to string fields.\",\n\t\t\t\t);\n\t\t}\n\t},\n};\n\n/**\n * Returns a schema for a value if the value is a {@link TreeNode} or a {@link TreeLeafValue}.\n * Returns undefined for other values.\n */\nexport function tryGetSchema(value: unknown): undefined | TreeNodeSchema {\n\tswitch (typeof value) {\n\t\tcase \"string\":\n\t\t\treturn stringSchema;\n\t\tcase \"number\":\n\t\t\treturn numberSchema;\n\t\tcase \"boolean\":\n\t\t\treturn booleanSchema;\n\t\tcase \"object\": {\n\t\t\tif (isTreeNode(value)) {\n\t\t\t\t// TODO: This case could be optimized, for example by placing the simple schema in a symbol on tree nodes.\n\t\t\t\treturn tryGetTreeNodeSchema(value);\n\t\t\t}\n\t\t\tif (value === null) {\n\t\t\t\treturn nullSchema;\n\t\t\t}\n\t\t\tif (isFluidHandle(value)) {\n\t\t\t\treturn handleSchema;\n\t\t\t}\n\t\t}\n\t\tdefault:\n\t\t\treturn undefined;\n\t}\n}\n\n/**\n * Gets the stored key with which the provided node is associated in the parent.\n */\nfunction getStoredKey(node: TreeNode): string | number {\n\t// Note: the flex domain strictly works with \"stored keys\", and knows nothing about the developer-facing\n\t// \"property keys\".\n\tconst parentField = getOrCreateInnerNode(node).parentField;\n\tif (parentField.parent.schema === FieldKinds.sequence.identifier) {\n\t\t// The parent of `node` is an array node\n\t\tassert(\n\t\t\tparentField.parent.key === EmptyKey,\n\t\t\t0xa28 /* When using index as key, field should use EmptyKey */,\n\t\t);\n\t\treturn parentField.index;\n\t}\n\n\t// The parent of `node` is an object, a map, or undefined. If undefined, then `node` is a root/detached node.\n\tassert(parentField.index === 0, 0xa29 /* When using field key as key, index should be 0 */);\n\treturn parentField.parent.key;\n}\n\n/**\n * Given a node schema, gets the property key corresponding with the provided {@link FieldProps.key | stored key}.\n */\nfunction getPropertyKeyFromStoredKey(\n\tschema: TreeNodeSchema,\n\tstoredKey: string | number,\n): string | number {\n\t// Only object nodes have the concept of a \"stored key\", differentiated from the developer-facing \"property key\".\n\t// For any other kind of node, the stored key and the property key are the same.\n\tif (schema.kind !== NodeKind.Object) {\n\t\treturn storedKey;\n\t}\n\n\tconst fields = schema.info as Record<string, ImplicitFieldSchema>;\n\n\t// Invariants:\n\t// - The set of all property keys under an object must be unique.\n\t// - The set of all stored keys (including those implicitly created from property keys) must be unique.\n\t// To find the property key associated with the provided stored key, first check for any stored key matches (which are optionally populated).\n\t// If we don't find any, then search for a matching property key.\n\tfor (const [propertyKey, fieldSchema] of Object.entries(fields)) {\n\t\tif (fieldSchema instanceof FieldSchema && fieldSchema.props?.key === storedKey) {\n\t\t\treturn propertyKey;\n\t\t}\n\t}\n\n\tif (fields[storedKey] === undefined) {\n\t\tfail(\"Existing stored key should always map to a property key\");\n\t}\n\n\treturn storedKey;\n}\n"]}
1
+ {"version":3,"file":"treeNodeApi.js","sourceRoot":"","sources":["../../../src/simple-tree/api/treeNodeApi.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,qCAAqC,CAAC;AAElE,OAAO,EAAE,QAAQ,EAAE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AK,MAAM,CAAC,WAAW,EAAE,WAAW,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QACjE,IAAI,WAAW,YAAY,WAAW,IAAI,WAAW,CAAC,KAAK,EAAE,GAAG,KAAK,SAAS,EAAE,CAAC;YAChF,OAAO,WAAW,CAAC;QACpB,CAAC;IACF,CAAC;IAED,IAAI,MAAM,CAAC,SAAS,CAAC,KAAK,SAAS,EAAE,CAAC;QACrC,IAAI,CAAC,KAAK,CAAC,6DAA6D,CAAC,CAAC;IAC3E,CAAC;IAED,OAAO,SAAS,CAAC;AAClB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, oob } from \"@fluidframework/core-utils/internal\";\n\nimport { EmptyKey, rootFieldKey } from \"../../core/index.js\";\nimport { type TreeStatus, isTreeValue, FieldKinds } from \"../../feature-libraries/index.js\";\nimport { fail, extractFromOpaque } from \"../../util/index.js\";\nimport {\n\ttype TreeLeafValue,\n\ttype ImplicitFieldSchema,\n\tFieldSchema,\n\ttype ImplicitAllowedTypes,\n\ttype TreeNodeFromImplicitAllowedTypes,\n\tnormalizeAllowedTypes,\n} from \"../schemaTypes.js\";\nimport {\n\tbooleanSchema,\n\thandleSchema,\n\tnullSchema,\n\tnumberSchema,\n\tstringSchema,\n} from \"../leafNodeSchema.js\";\nimport { isFluidHandle } from \"@fluidframework/runtime-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\nimport type { Off } from \"@fluidframework/core-interfaces\";\nimport {\n\tgetKernel,\n\tisTreeNode,\n\ttype TreeNodeSchema,\n\tNodeKind,\n\ttype TreeNode,\n\ttype TreeChangeEvents,\n\ttryGetTreeNodeSchema,\n\tgetOrCreateNodeFromInnerNode,\n\tUnhydratedFlexTreeNode,\n\ttypeSchemaSymbol,\n\tgetOrCreateInnerNode,\n} from \"../core/index.js\";\nimport { isObjectNodeSchema } from \"../objectNodeTypes.js\";\n\n/**\n * Provides various functions for analyzing {@link TreeNode}s.\n * * @remarks\n * This type should only be used via the public `Tree` export.\n * @privateRemarks\n * Due to limitations of API-Extractor link resolution, this type can't be moved into internalTypes but should be considered just an implementation detail of the `Tree` export.\n *\n * Inlining the typing of this interface onto the `Tree` object provides slightly different .d.ts generation,\n * which avoids typescript expanding the type of TreeNodeSchema and thus encountering\n * https://github.com/microsoft/rushstack/issues/1958.\n * @sealed @public\n */\nexport interface TreeNodeApi {\n\t/**\n\t * The schema information for this node.\n\t */\n\tschema(node: TreeNode | TreeLeafValue): TreeNodeSchema;\n\n\t/**\n\t * Narrow the type of the given value if it satisfies the given schema.\n\t * @example\n\t * ```ts\n\t * if (node.is(myNode, Point)) {\n\t * const y = myNode.y; // `myNode` is now known to satisfy the `Point` schema and therefore has a `y` coordinate.\n\t * }\n\t * ```\n\t */\n\tis<TSchema extends ImplicitAllowedTypes>(\n\t\tvalue: unknown,\n\t\tschema: TSchema,\n\t): value is TreeNodeFromImplicitAllowedTypes<TSchema>;\n\n\t/**\n\t * Return the node under which this node resides in the tree (or undefined if this is a root node of the tree).\n\t */\n\tparent(node: TreeNode): TreeNode | undefined;\n\n\t/**\n\t * The key of the given node under its parent.\n\t * @remarks\n\t * If `node` is an element in a {@link (TreeArrayNode:interface)}, this returns the index of `node` in the array node (a `number`).\n\t * Otherwise, this returns the key of the field that it is under (a `string`).\n\t */\n\tkey(node: TreeNode): string | number;\n\n\t/**\n\t * Register an event listener on the given node.\n\t * @param node - The node whose events should be subscribed to.\n\t * @param eventName - Which event to subscribe to.\n\t * @param listener - The callback to trigger for the event. The tree can be read during the callback, but it is invalid to modify the tree during this callback.\n\t * @returns A callback function which will deregister the event.\n\t * This callback should be called only once.\n\t */\n\ton<K extends keyof TreeChangeEvents>(\n\t\tnode: TreeNode,\n\t\teventName: K,\n\t\tlistener: TreeChangeEvents[K],\n\t): () => void;\n\n\t/**\n\t * Returns the {@link TreeStatus} of the given node.\n\t */\n\tstatus(node: TreeNode): TreeStatus;\n\n\t/**\n\t * Returns the {@link SchemaFactory.identifier | identifier} of the given node in the most compressed form possible.\n\t * @remarks\n\t * If the node's identifier is a valid UUID that was automatically generated by the SharedTree, then this will return a process-unique integer corresponding to that identifier.\n\t * Note that the node must already have been inserted into the tree in order to retrieve a generated UUID (or shortId will error).\n\t * This is useful for performance-sensitive scenarios involving many nodes with identifiers that need to be compactly retained in memory or used for efficient lookup.\n\t *\n\t * If the node's identifier is any other user-provided string, then this will return that string.\n\t *\n\t * If the node has no identifier (that is, it has no {@link SchemaFactory.identifier | identifier} field), then this returns `undefined`.\n\t *\n\t * If the node has more than one identifier, then this will throw an error.\n\t *\n\t * The returned integer must not be serialized or preserved outside of the current process.\n\t * Its lifetime is that of the current in-memory instance of the FF container for this client, and it is not guaranteed to be unique or stable outside of that context.\n\t * The same node's identifier may, for example, be different across multiple sessions for the same client and document, or different across two clients in the same session.\n\t */\n\tshortId(node: TreeNode): number | string | undefined;\n}\n\n/**\n * The `Tree` object holds various functions for analyzing {@link TreeNode}s.\n */\nexport const treeNodeApi: TreeNodeApi = {\n\tparent(node: TreeNode): TreeNode | undefined {\n\t\tconst editNode = getOrCreateInnerNode(node).parentField.parent.parent;\n\t\tif (editNode === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst output = getOrCreateNodeFromInnerNode(editNode);\n\t\tassert(\n\t\t\t!isTreeValue(output),\n\t\t\t0x87f /* Parent can't be a leaf, so it should be a node not a value */,\n\t\t);\n\t\treturn output;\n\t},\n\tkey(node: TreeNode): string | number {\n\t\t// If the parent is undefined, then this node is under the root field,\n\t\t// so we know its key is the special root one.\n\t\tconst parent = treeNodeApi.parent(node);\n\t\tif (parent === undefined) {\n\t\t\treturn rootFieldKey;\n\t\t}\n\n\t\t// The flex-domain strictly operates in terms of \"stored keys\".\n\t\t// To find the associated developer-facing \"property key\", we need to look up the field associated with\n\t\t// the stored key from the flex-domain, and get property key its simple-domain counterpart was created with.\n\t\tconst storedKey = getStoredKey(node);\n\t\tconst parentSchema = treeNodeApi.schema(parent);\n\t\tconst propertyKey = getPropertyKeyFromStoredKey(parentSchema, storedKey);\n\t\treturn propertyKey;\n\t},\n\ton<K extends keyof TreeChangeEvents>(\n\t\tnode: TreeNode,\n\t\teventName: K,\n\t\tlistener: TreeChangeEvents[K],\n\t): Off {\n\t\tconst kernel = getKernel(node);\n\t\tswitch (eventName) {\n\t\t\tcase \"nodeChanged\": {\n\t\t\t\tconst nodeSchema = kernel.schema;\n\t\t\t\tif (isObjectNodeSchema(nodeSchema)) {\n\t\t\t\t\treturn kernel.events.on(\"childrenChangedAfterBatch\", ({ changedFields }) => {\n\t\t\t\t\t\tconst changedProperties = new Set(\n\t\t\t\t\t\t\tArray.from(\n\t\t\t\t\t\t\t\tchangedFields,\n\t\t\t\t\t\t\t\t(field) =>\n\t\t\t\t\t\t\t\t\tnodeSchema.storedKeyToPropertyKey.get(field) ??\n\t\t\t\t\t\t\t\t\tfail(0xb36 /* Could not find stored key in schema. */),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tlistener({ changedProperties });\n\t\t\t\t\t});\n\t\t\t\t} else if (nodeSchema.kind === NodeKind.Array) {\n\t\t\t\t\treturn kernel.events.on(\"childrenChangedAfterBatch\", () => {\n\t\t\t\t\t\tlistener({ changedProperties: undefined });\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\treturn kernel.events.on(\"childrenChangedAfterBatch\", ({ changedFields }) => {\n\t\t\t\t\t\tlistener({ changedProperties: changedFields });\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t\tcase \"treeChanged\": {\n\t\t\t\treturn kernel.events.on(\"subtreeChangedAfterBatch\", () => listener({}));\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tthrow new UsageError(`No event named ${JSON.stringify(eventName)}.`);\n\t\t}\n\t},\n\tstatus(node: TreeNode): TreeStatus {\n\t\treturn getKernel(node).getStatus();\n\t},\n\tis<TSchema extends ImplicitAllowedTypes>(\n\t\tvalue: unknown,\n\t\tschema: TSchema,\n\t): value is TreeNodeFromImplicitAllowedTypes<TSchema> {\n\t\t// This \"is\" utility would return false if the provided schema is a base type of the actual schema.\n\t\t// This could be confusing, and that case can only be hit when violating the rule that there is a single most derived schema that gets used (See documentation on TreeNodeSchemaClass).\n\t\t// Therefore this uses markSchemaMostDerived to ensure an informative usage error is thrown in the case where a base type is used.\n\n\t\tconst actualSchema = tryGetSchema(value);\n\t\tif (actualSchema === undefined) {\n\t\t\treturn false;\n\t\t}\n\t\treturn normalizeAllowedTypes(schema).has(actualSchema);\n\t},\n\tschema(node: TreeNode | TreeLeafValue): TreeNodeSchema {\n\t\treturn tryGetSchema(node) ?? fail(0xb37 /* Not a tree node */);\n\t},\n\tshortId(node: TreeNode): number | string | undefined {\n\t\tconst schema = node[typeSchemaSymbol];\n\t\tif (!isObjectNodeSchema(schema)) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst flexNode = getOrCreateInnerNode(node);\n\t\tconst identifierFieldKeys = schema.identifierFieldKeys;\n\n\t\tswitch (identifierFieldKeys.length) {\n\t\t\tcase 0:\n\t\t\t\treturn undefined;\n\t\t\tcase 1: {\n\t\t\t\tconst identifier = flexNode.tryGetField(identifierFieldKeys[0] ?? oob())?.boxedAt(0);\n\t\t\t\tif (flexNode instanceof UnhydratedFlexTreeNode) {\n\t\t\t\t\tif (identifier === undefined) {\n\t\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t\t\"Tree.shortId cannot access default identifiers on unhydrated nodes\",\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\treturn identifier.value as string;\n\t\t\t\t}\n\t\t\t\tassert(\n\t\t\t\t\tidentifier?.context.isHydrated() === true,\n\t\t\t\t\t0xa27 /* Expected hydrated identifier */,\n\t\t\t\t);\n\t\t\t\tconst identifierValue = identifier.value as string;\n\n\t\t\t\tconst localNodeKey =\n\t\t\t\t\tidentifier.context.nodeKeyManager.tryLocalizeNodeKey(identifierValue);\n\t\t\t\treturn localNodeKey !== undefined ? extractFromOpaque(localNodeKey) : identifierValue;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\"shortId() may not be called on a node with more than one identifier. Consider converting extraneous identifier fields to string fields.\",\n\t\t\t\t);\n\t\t}\n\t},\n};\n\n/**\n * Returns a schema for a value if the value is a {@link TreeNode} or a {@link TreeLeafValue}.\n * Returns undefined for other values.\n */\nexport function tryGetSchema(value: unknown): undefined | TreeNodeSchema {\n\tswitch (typeof value) {\n\t\tcase \"string\":\n\t\t\treturn stringSchema;\n\t\tcase \"number\":\n\t\t\treturn numberSchema;\n\t\tcase \"boolean\":\n\t\t\treturn booleanSchema;\n\t\tcase \"object\": {\n\t\t\tif (isTreeNode(value)) {\n\t\t\t\t// TODO: This case could be optimized, for example by placing the simple schema in a symbol on tree nodes.\n\t\t\t\treturn tryGetTreeNodeSchema(value);\n\t\t\t}\n\t\t\tif (value === null) {\n\t\t\t\treturn nullSchema;\n\t\t\t}\n\t\t\tif (isFluidHandle(value)) {\n\t\t\t\treturn handleSchema;\n\t\t\t}\n\t\t}\n\t\tdefault:\n\t\t\treturn undefined;\n\t}\n}\n\n/**\n * Gets the stored key with which the provided node is associated in the parent.\n */\nfunction getStoredKey(node: TreeNode): string | number {\n\t// Note: the flex domain strictly works with \"stored keys\", and knows nothing about the developer-facing\n\t// \"property keys\".\n\tconst parentField = getOrCreateInnerNode(node).parentField;\n\tif (parentField.parent.schema === FieldKinds.sequence.identifier) {\n\t\t// The parent of `node` is an array node\n\t\tassert(\n\t\t\tparentField.parent.key === EmptyKey,\n\t\t\t0xa28 /* When using index as key, field should use EmptyKey */,\n\t\t);\n\t\treturn parentField.index;\n\t}\n\n\t// The parent of `node` is an object, a map, or undefined. If undefined, then `node` is a root/detached node.\n\tassert(parentField.index === 0, 0xa29 /* When using field key as key, index should be 0 */);\n\treturn parentField.parent.key;\n}\n\n/**\n * Given a node schema, gets the property key corresponding with the provided {@link FieldProps.key | stored key}.\n */\nfunction getPropertyKeyFromStoredKey(\n\tschema: TreeNodeSchema,\n\tstoredKey: string | number,\n): string | number {\n\t// Only object nodes have the concept of a \"stored key\", differentiated from the developer-facing \"property key\".\n\t// For any other kind of node, the stored key and the property key are the same.\n\tif (schema.kind !== NodeKind.Object) {\n\t\treturn storedKey;\n\t}\n\n\tconst fields = schema.info as Record<string, ImplicitFieldSchema>;\n\n\t// Invariants:\n\t// - The set of all property keys under an object must be unique.\n\t// - The set of all stored keys (including those implicitly created from property keys) must be unique.\n\t// To find the property key associated with the provided stored key, first check for any stored key matches (which are optionally populated).\n\t// If we don't find any, then search for a matching property key.\n\tfor (const [propertyKey, fieldSchema] of Object.entries(fields)) {\n\t\tif (fieldSchema instanceof FieldSchema && fieldSchema.props?.key === storedKey) {\n\t\t\treturn propertyKey;\n\t\t}\n\t}\n\n\tif (fields[storedKey] === undefined) {\n\t\tfail(0xb38 /* Existing stored key should always map to a property key */);\n\t}\n\n\treturn storedKey;\n}\n"]}
@@ -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,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,oBAAoB,CAC/B,IAAI,SAAS,MAAM,GAAG,MAAM,EAC5B,IAAI,SAAS,QAAQ,GAAG,QAAQ,EAChC,KAAK,SAAS,UAAU,CAAC,QAAQ,GAAG,aAAa,CAAC,GAAG,OAAO,EAC5D,MAAM,GAAG,KAAK,EACd,uBAAuB,SAAS,OAAO,G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AO,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"}
@@ -2,6 +2,20 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- export {};
5
+ /**
6
+ * {@link Unenforced} version of {@link customizeSchemaTyping} for use with recursive schema types.
7
+ *
8
+ * @remarks
9
+ * When using this API to modify a schema derived type such that the type is no longer recursive,
10
+ * or uses an externally defined type (which can be recursive), {@link customizeSchemaTyping} should be used instead for an improved developer experience.
11
+ * Additionally, in this case, none of the "unsafe" type variants should be needed: the whole schema (with runtime but not schema derived type recursion)
12
+ * should use the normal (not unsafe/recursive) APIs.
13
+ * @alpha
14
+ */
15
+ export function customizeSchemaTypingUnsafe(schema) {
16
+ // This function just does type branding, and duplicating the typing here to avoid any would just make it harder to maintain not easier:
17
+ const f = () => schema;
18
+ return { simplified: f, simplifiedUnrestricted: f, custom: f };
19
+ }
6
20
  /* eslint-enable @typescript-eslint/no-explicit-any */
7
21
  //# 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,MAAM,UAAU,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;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;AAEX;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,WAAW,eAAe,CAAC,OAAO,GAAG,YAAY;IACtD;;;;;;OAMG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;;;;;OAMG;IACH,MAAM,EACH,WAAW,CAAC,OAAO,CAAC,EAAE,GACtB;QACA,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC;KACnC,CAAC;CACL;AAED;;;GAGG;AACH,MAAM,WAAW,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GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;IACrF;;OAEG;IACH,YAAY,CAAC,EAAE;QACd,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,QAAQ,CAAC;QAChD,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,GAAG,MAAM,CAAC;KAC5C,CAAC;CACF;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,OAAO,EACjD,MAAM,EAAE,mBAAmB,EAC3B,OAAO,EAAE,YAAY,CAAC,OAAO,CAAC,GAC5B,sBAAsB,CAAC,OAAO,CAAC,CAiDjC;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EACxC,IAAI,EAAE,WAAW,CAAC,OAAO,CAAC,EAC1B,OAAO,EAAE,sBAAsB,CAAC,OAAO,CAAC,GACtC,sBAAsB,CAExB;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAC7C,IAAI,EAAE,WAAW,CAAC,OAAO,CAAC,EAAE,EAC5B,OAAO,EAAE,sBAAsB,CAAC,OAAO,CAAC,GACtC,sBAAsB,CAMxB;AA0FD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EACxC,MAAM,EAAE,WAAW,EACnB,UAAU,EAAE,oBAAoB,EAChC,OAAO,EAAE,aAAa,CAAC,OAAO,CAAC,GAC7B,WAAW,CAAC,OAAO,CAAC,CAStB"}
@@ -28,7 +28,7 @@ export function applySchemaToParserOptions(schema, options) {
28
28
  : {
29
29
  encode: (type, key) => {
30
30
  // translate stored key into property key.
31
- const simpleNodeSchema = context.schema.get(brand(type)) ?? fail("missing schema");
31
+ const simpleNodeSchema = context.schema.get(brand(type)) ?? fail(0xb39 /* missing schema */);
32
32
  if (isObjectNodeSchema(simpleNodeSchema)) {
33
33
  const propertyKey = simpleNodeSchema.storedKeyToPropertyKey.get(key);
34
34
  if (propertyKey !== undefined) {
@@ -46,9 +46,10 @@ export function applySchemaToParserOptions(schema, options) {
46
46
  return key;
47
47
  },
48
48
  parse: (type, inputKey) => {
49
- const simpleNodeSchema = context.schema.get(brand(type)) ?? fail("missing schema");
49
+ const simpleNodeSchema = context.schema.get(brand(type)) ?? fail(0xb3a /* missing schema */);
50
50
  if (isObjectNodeSchema(simpleNodeSchema)) {
51
- const info = simpleNodeSchema.flexKeyMap.get(inputKey) ?? fail("missing field info");
51
+ const info = simpleNodeSchema.flexKeyMap.get(inputKey) ??
52
+ fail(0xb3b /* missing field info */);
52
53
  return info.storedKey;
53
54
  }
54
55
  return brand(inputKey);
@@ -159,7 +160,7 @@ export function verboseFromCursor(reader, rootSchema, options) {
159
160
  }
160
161
  function verboseFromCursorInner(reader, options, schema) {
161
162
  const fields = customFromCursor(reader, options, schema, verboseFromCursorInner);
162
- const nodeSchema = schema.get(reader.type) ?? fail("missing schema for type in cursor");
163
+ const nodeSchema = schema.get(reader.type) ?? fail(0xb3c /* missing schema for type in cursor */);
163
164
  if (nodeSchema.kind === NodeKind.Leaf) {
164
165
  return fields;
165
166
  }