@fluidframework/tree 2.4.0-297027 → 2.4.0-299374

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 (559) hide show
  1. package/.dependency-cruiser-known-violations.json +0 -14
  2. package/.vscode/settings.json +9 -1
  3. package/api-report/tree.alpha.api.md +178 -21
  4. package/api-report/tree.beta.api.md +46 -21
  5. package/api-report/tree.legacy.alpha.api.md +46 -21
  6. package/api-report/tree.legacy.public.api.md +46 -21
  7. package/api-report/tree.public.api.md +46 -21
  8. package/dist/alpha.d.ts +29 -1
  9. package/dist/beta.d.ts +2 -0
  10. package/dist/codec/codec.d.ts +4 -4
  11. package/dist/codec/codec.js.map +1 -1
  12. package/dist/codec/noopValidator.d.ts +1 -1
  13. package/dist/codec/noopValidator.js +1 -1
  14. package/dist/codec/noopValidator.js.map +1 -1
  15. package/dist/core/change-family/changeFamily.d.ts +2 -2
  16. package/dist/core/change-family/changeFamily.d.ts.map +1 -1
  17. package/dist/core/change-family/changeFamily.js.map +1 -1
  18. package/dist/core/change-family/editBuilder.d.ts +3 -2
  19. package/dist/core/change-family/editBuilder.d.ts.map +1 -1
  20. package/dist/core/change-family/editBuilder.js.map +1 -1
  21. package/dist/core/rebase/changeRebaser.d.ts +2 -1
  22. package/dist/core/rebase/changeRebaser.d.ts.map +1 -1
  23. package/dist/core/rebase/changeRebaser.js.map +1 -1
  24. package/dist/core/rebase/utils.js +1 -1
  25. package/dist/core/rebase/utils.js.map +1 -1
  26. package/dist/core/tree/anchorSet.d.ts +159 -2
  27. package/dist/core/tree/anchorSet.d.ts.map +1 -1
  28. package/dist/core/tree/anchorSet.js +54 -12
  29. package/dist/core/tree/anchorSet.js.map +1 -1
  30. package/dist/external-utilities/typeboxValidator.d.ts +1 -1
  31. package/dist/external-utilities/typeboxValidator.js +1 -1
  32. package/dist/external-utilities/typeboxValidator.js.map +1 -1
  33. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts +4 -3
  34. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  35. package/dist/feature-libraries/default-schema/defaultEditBuilder.js +41 -30
  36. package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  37. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts +4 -6
  38. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  39. package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  40. package/dist/feature-libraries/flex-tree/lazyField.d.ts +4 -0
  41. package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  42. package/dist/feature-libraries/flex-tree/lazyField.js +38 -6
  43. package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
  44. package/dist/feature-libraries/index.d.ts +0 -1
  45. package/dist/feature-libraries/index.d.ts.map +1 -1
  46. package/dist/feature-libraries/index.js +46 -49
  47. package/dist/feature-libraries/index.js.map +1 -1
  48. package/dist/feature-libraries/mitigatedChangeFamily.d.ts.map +1 -1
  49. package/dist/feature-libraries/mitigatedChangeFamily.js +4 -4
  50. package/dist/feature-libraries/mitigatedChangeFamily.js.map +1 -1
  51. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts +1 -1
  52. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  53. package/dist/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  54. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +12 -8
  55. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  56. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +179 -60
  57. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  58. package/dist/feature-libraries/optional-field/optionalField.d.ts +10 -9
  59. package/dist/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
  60. package/dist/feature-libraries/optional-field/optionalField.js +9 -7
  61. package/dist/feature-libraries/optional-field/optionalField.js.map +1 -1
  62. package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts +3 -10
  63. package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
  64. package/dist/feature-libraries/schema-index/schemaSummarizer.js +1 -8
  65. package/dist/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
  66. package/dist/feature-libraries/sequence-field/compose.d.ts.map +1 -1
  67. package/dist/feature-libraries/sequence-field/compose.js +32 -20
  68. package/dist/feature-libraries/sequence-field/compose.js.map +1 -1
  69. package/dist/feature-libraries/sequence-field/invert.d.ts +6 -1
  70. package/dist/feature-libraries/sequence-field/invert.d.ts.map +1 -1
  71. package/dist/feature-libraries/sequence-field/invert.js +25 -9
  72. package/dist/feature-libraries/sequence-field/invert.js.map +1 -1
  73. package/dist/feature-libraries/sequence-field/sequenceFieldEditor.d.ts +17 -16
  74. package/dist/feature-libraries/sequence-field/sequenceFieldEditor.d.ts.map +1 -1
  75. package/dist/feature-libraries/sequence-field/sequenceFieldEditor.js +19 -11
  76. package/dist/feature-libraries/sequence-field/sequenceFieldEditor.js.map +1 -1
  77. package/dist/feature-libraries/treeCompressionUtils.d.ts +1 -1
  78. package/dist/feature-libraries/treeCompressionUtils.js +1 -1
  79. package/dist/feature-libraries/treeCompressionUtils.js.map +1 -1
  80. package/dist/index.d.ts +6 -5
  81. package/dist/index.d.ts.map +1 -1
  82. package/dist/index.js +4 -2
  83. package/dist/index.js.map +1 -1
  84. package/dist/internalTypes.d.ts +2 -2
  85. package/dist/internalTypes.d.ts.map +1 -1
  86. package/dist/internalTypes.js.map +1 -1
  87. package/dist/legacy.d.ts +2 -0
  88. package/dist/packageVersion.d.ts +1 -1
  89. package/dist/packageVersion.js +1 -1
  90. package/dist/packageVersion.js.map +1 -1
  91. package/dist/public.d.ts +2 -0
  92. package/dist/shared-tree/index.d.ts +2 -1
  93. package/dist/shared-tree/index.d.ts.map +1 -1
  94. package/dist/shared-tree/index.js +5 -1
  95. package/dist/shared-tree/index.js.map +1 -1
  96. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  97. package/dist/shared-tree/schematizingTreeView.js +1 -14
  98. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  99. package/dist/shared-tree/sharedTree.d.ts +24 -9
  100. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  101. package/dist/shared-tree/sharedTree.js +21 -9
  102. package/dist/shared-tree/sharedTree.js.map +1 -1
  103. package/dist/shared-tree/sharedTreeChangeFamily.d.ts +2 -2
  104. package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  105. package/dist/shared-tree/sharedTreeChangeFamily.js +4 -4
  106. package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  107. package/dist/shared-tree/sharedTreeEditBuilder.d.ts +2 -2
  108. package/dist/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
  109. package/dist/shared-tree/sharedTreeEditBuilder.js +15 -11
  110. package/dist/shared-tree/sharedTreeEditBuilder.js.map +1 -1
  111. package/dist/shared-tree/treeApi.d.ts +6 -6
  112. package/dist/shared-tree/treeApi.d.ts.map +1 -1
  113. package/dist/shared-tree/treeApi.js.map +1 -1
  114. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  115. package/dist/shared-tree/treeCheckout.js +4 -3
  116. package/dist/shared-tree/treeCheckout.js.map +1 -1
  117. package/dist/shared-tree-core/branch.d.ts +2 -3
  118. package/dist/shared-tree-core/branch.d.ts.map +1 -1
  119. package/dist/shared-tree-core/branch.js +10 -11
  120. package/dist/shared-tree-core/branch.js.map +1 -1
  121. package/dist/shared-tree-core/defaultResubmitMachine.d.ts +5 -5
  122. package/dist/shared-tree-core/defaultResubmitMachine.d.ts.map +1 -1
  123. package/dist/shared-tree-core/defaultResubmitMachine.js +4 -4
  124. package/dist/shared-tree-core/defaultResubmitMachine.js.map +1 -1
  125. package/dist/shared-tree-core/editManager.d.ts.map +1 -1
  126. package/dist/shared-tree-core/editManager.js +1 -1
  127. package/dist/shared-tree-core/editManager.js.map +1 -1
  128. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  129. package/dist/shared-tree-core/sharedTreeCore.js +2 -2
  130. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  131. package/dist/simple-tree/api/conciseTree.d.ts +29 -0
  132. package/dist/simple-tree/api/conciseTree.d.ts.map +1 -0
  133. package/dist/simple-tree/api/conciseTree.js +25 -0
  134. package/dist/simple-tree/api/conciseTree.js.map +1 -0
  135. package/dist/simple-tree/api/customTree.d.ts +44 -0
  136. package/dist/simple-tree/api/customTree.d.ts.map +1 -0
  137. package/dist/simple-tree/api/customTree.js +63 -0
  138. package/dist/simple-tree/api/customTree.js.map +1 -0
  139. package/dist/simple-tree/api/index.d.ts +7 -2
  140. package/dist/simple-tree/api/index.d.ts.map +1 -1
  141. package/dist/simple-tree/api/index.js +5 -1
  142. package/dist/simple-tree/api/index.js.map +1 -1
  143. package/dist/simple-tree/api/schemaCreationUtilities.d.ts +41 -26
  144. package/dist/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -1
  145. package/dist/simple-tree/api/schemaCreationUtilities.js +43 -15
  146. package/dist/simple-tree/api/schemaCreationUtilities.js.map +1 -1
  147. package/dist/simple-tree/api/schemaFactory.d.ts +1 -2
  148. package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
  149. package/dist/simple-tree/api/schemaFactory.js +8 -8
  150. package/dist/simple-tree/api/schemaFactory.js.map +1 -1
  151. package/dist/simple-tree/api/schemaFactoryRecursive.d.ts +1 -2
  152. package/dist/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
  153. package/dist/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
  154. package/dist/simple-tree/api/storedSchema.d.ts +78 -0
  155. package/dist/simple-tree/api/storedSchema.d.ts.map +1 -0
  156. package/dist/simple-tree/api/storedSchema.js +107 -0
  157. package/dist/simple-tree/api/storedSchema.js.map +1 -0
  158. package/dist/simple-tree/api/testRecursiveDomain.d.ts +10 -10
  159. package/dist/simple-tree/api/tree.d.ts +12 -3
  160. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  161. package/dist/simple-tree/api/tree.js.map +1 -1
  162. package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  163. package/dist/simple-tree/api/treeNodeApi.js +5 -5
  164. package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
  165. package/dist/simple-tree/{typesUnsafe.d.ts → api/typesUnsafe.d.ts} +58 -10
  166. package/dist/simple-tree/api/typesUnsafe.d.ts.map +1 -0
  167. package/dist/simple-tree/api/typesUnsafe.js.map +1 -0
  168. package/dist/simple-tree/api/verboseTree.d.ts +6 -20
  169. package/dist/simple-tree/api/verboseTree.d.ts.map +1 -1
  170. package/dist/simple-tree/api/verboseTree.js +10 -48
  171. package/dist/simple-tree/api/verboseTree.js.map +1 -1
  172. package/dist/simple-tree/arrayNode.d.ts +14 -3
  173. package/dist/simple-tree/arrayNode.d.ts.map +1 -1
  174. package/dist/simple-tree/arrayNode.js +1 -2
  175. package/dist/simple-tree/arrayNode.js.map +1 -1
  176. package/dist/simple-tree/core/index.d.ts +1 -1
  177. package/dist/simple-tree/core/index.d.ts.map +1 -1
  178. package/dist/simple-tree/core/index.js +2 -1
  179. package/dist/simple-tree/core/index.js.map +1 -1
  180. package/dist/simple-tree/core/treeNodeKernel.d.ts +9 -0
  181. package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  182. package/dist/simple-tree/core/treeNodeKernel.js +14 -1
  183. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
  184. package/dist/simple-tree/core/treeNodeSchema.d.ts +6 -5
  185. package/dist/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  186. package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
  187. package/dist/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  188. package/dist/simple-tree/core/unhydratedFlexTree.js +3 -1
  189. package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  190. package/dist/simple-tree/core/withType.d.ts +3 -1
  191. package/dist/simple-tree/core/withType.d.ts.map +1 -1
  192. package/dist/simple-tree/core/withType.js.map +1 -1
  193. package/dist/simple-tree/flexList.d.ts.map +1 -0
  194. package/dist/simple-tree/flexList.js.map +1 -0
  195. package/dist/simple-tree/index.d.ts +6 -7
  196. package/dist/simple-tree/index.d.ts.map +1 -1
  197. package/dist/simple-tree/index.js +5 -3
  198. package/dist/simple-tree/index.js.map +1 -1
  199. package/dist/simple-tree/mapNode.d.ts.map +1 -1
  200. package/dist/simple-tree/mapNode.js +2 -3
  201. package/dist/simple-tree/mapNode.js.map +1 -1
  202. package/dist/simple-tree/objectNode.d.ts.map +1 -1
  203. package/dist/simple-tree/objectNode.js +3 -4
  204. package/dist/simple-tree/objectNode.js.map +1 -1
  205. package/dist/simple-tree/schemaTypes.d.ts +60 -7
  206. package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
  207. package/dist/simple-tree/schemaTypes.js +11 -6
  208. package/dist/simple-tree/schemaTypes.js.map +1 -1
  209. package/dist/simple-tree/toFlexSchema.d.ts.map +1 -1
  210. package/dist/simple-tree/toFlexSchema.js +13 -15
  211. package/dist/simple-tree/toFlexSchema.js.map +1 -1
  212. package/dist/simple-tree/toMapTree.d.ts +4 -2
  213. package/dist/simple-tree/toMapTree.d.ts.map +1 -1
  214. package/dist/simple-tree/toMapTree.js +3 -3
  215. package/dist/simple-tree/toMapTree.js.map +1 -1
  216. package/dist/simple-tree/treeNodeValid.d.ts.map +1 -1
  217. package/dist/simple-tree/treeNodeValid.js +2 -1
  218. package/dist/simple-tree/treeNodeValid.js.map +1 -1
  219. package/dist/treeFactory.d.ts +1 -0
  220. package/dist/treeFactory.d.ts.map +1 -1
  221. package/dist/treeFactory.js +1 -0
  222. package/dist/treeFactory.js.map +1 -1
  223. package/dist/util/utils.d.ts +10 -8
  224. package/dist/util/utils.d.ts.map +1 -1
  225. package/dist/util/utils.js.map +1 -1
  226. package/docs/main/detached-trees.md +8 -8
  227. package/lib/alpha.d.ts +29 -1
  228. package/lib/beta.d.ts +2 -0
  229. package/lib/codec/codec.d.ts +4 -4
  230. package/lib/codec/codec.js.map +1 -1
  231. package/lib/codec/noopValidator.d.ts +1 -1
  232. package/lib/codec/noopValidator.js +1 -1
  233. package/lib/codec/noopValidator.js.map +1 -1
  234. package/lib/core/change-family/changeFamily.d.ts +2 -2
  235. package/lib/core/change-family/changeFamily.d.ts.map +1 -1
  236. package/lib/core/change-family/changeFamily.js.map +1 -1
  237. package/lib/core/change-family/editBuilder.d.ts +3 -2
  238. package/lib/core/change-family/editBuilder.d.ts.map +1 -1
  239. package/lib/core/change-family/editBuilder.js.map +1 -1
  240. package/lib/core/rebase/changeRebaser.d.ts +2 -1
  241. package/lib/core/rebase/changeRebaser.d.ts.map +1 -1
  242. package/lib/core/rebase/changeRebaser.js.map +1 -1
  243. package/lib/core/rebase/utils.js +1 -1
  244. package/lib/core/rebase/utils.js.map +1 -1
  245. package/lib/core/tree/anchorSet.d.ts +159 -2
  246. package/lib/core/tree/anchorSet.d.ts.map +1 -1
  247. package/lib/core/tree/anchorSet.js +54 -12
  248. package/lib/core/tree/anchorSet.js.map +1 -1
  249. package/lib/external-utilities/typeboxValidator.d.ts +1 -1
  250. package/lib/external-utilities/typeboxValidator.js +1 -1
  251. package/lib/external-utilities/typeboxValidator.js.map +1 -1
  252. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts +4 -3
  253. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  254. package/lib/feature-libraries/default-schema/defaultEditBuilder.js +41 -30
  255. package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  256. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts +4 -6
  257. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  258. package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  259. package/lib/feature-libraries/flex-tree/lazyField.d.ts +4 -0
  260. package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  261. package/lib/feature-libraries/flex-tree/lazyField.js +36 -5
  262. package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
  263. package/lib/feature-libraries/index.d.ts +0 -1
  264. package/lib/feature-libraries/index.d.ts.map +1 -1
  265. package/lib/feature-libraries/index.js +0 -1
  266. package/lib/feature-libraries/index.js.map +1 -1
  267. package/lib/feature-libraries/mitigatedChangeFamily.d.ts.map +1 -1
  268. package/lib/feature-libraries/mitigatedChangeFamily.js +4 -4
  269. package/lib/feature-libraries/mitigatedChangeFamily.js.map +1 -1
  270. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts +1 -1
  271. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  272. package/lib/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  273. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +12 -8
  274. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  275. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +180 -61
  276. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  277. package/lib/feature-libraries/optional-field/optionalField.d.ts +10 -9
  278. package/lib/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
  279. package/lib/feature-libraries/optional-field/optionalField.js +9 -7
  280. package/lib/feature-libraries/optional-field/optionalField.js.map +1 -1
  281. package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts +3 -10
  282. package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
  283. package/lib/feature-libraries/schema-index/schemaSummarizer.js +1 -8
  284. package/lib/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
  285. package/lib/feature-libraries/sequence-field/compose.d.ts.map +1 -1
  286. package/lib/feature-libraries/sequence-field/compose.js +32 -20
  287. package/lib/feature-libraries/sequence-field/compose.js.map +1 -1
  288. package/lib/feature-libraries/sequence-field/invert.d.ts +6 -1
  289. package/lib/feature-libraries/sequence-field/invert.d.ts.map +1 -1
  290. package/lib/feature-libraries/sequence-field/invert.js +25 -9
  291. package/lib/feature-libraries/sequence-field/invert.js.map +1 -1
  292. package/lib/feature-libraries/sequence-field/sequenceFieldEditor.d.ts +17 -16
  293. package/lib/feature-libraries/sequence-field/sequenceFieldEditor.d.ts.map +1 -1
  294. package/lib/feature-libraries/sequence-field/sequenceFieldEditor.js +19 -11
  295. package/lib/feature-libraries/sequence-field/sequenceFieldEditor.js.map +1 -1
  296. package/lib/feature-libraries/treeCompressionUtils.d.ts +1 -1
  297. package/lib/feature-libraries/treeCompressionUtils.js +1 -1
  298. package/lib/feature-libraries/treeCompressionUtils.js.map +1 -1
  299. package/lib/index.d.ts +6 -5
  300. package/lib/index.d.ts.map +1 -1
  301. package/lib/index.js +3 -3
  302. package/lib/index.js.map +1 -1
  303. package/lib/internalTypes.d.ts +2 -2
  304. package/lib/internalTypes.d.ts.map +1 -1
  305. package/lib/internalTypes.js.map +1 -1
  306. package/lib/legacy.d.ts +2 -0
  307. package/lib/packageVersion.d.ts +1 -1
  308. package/lib/packageVersion.js +1 -1
  309. package/lib/packageVersion.js.map +1 -1
  310. package/lib/public.d.ts +2 -0
  311. package/lib/shared-tree/index.d.ts +2 -1
  312. package/lib/shared-tree/index.d.ts.map +1 -1
  313. package/lib/shared-tree/index.js +2 -1
  314. package/lib/shared-tree/index.js.map +1 -1
  315. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  316. package/lib/shared-tree/schematizingTreeView.js +2 -15
  317. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  318. package/lib/shared-tree/sharedTree.d.ts +24 -9
  319. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  320. package/lib/shared-tree/sharedTree.js +20 -9
  321. package/lib/shared-tree/sharedTree.js.map +1 -1
  322. package/lib/shared-tree/sharedTreeChangeFamily.d.ts +2 -2
  323. package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  324. package/lib/shared-tree/sharedTreeChangeFamily.js +4 -4
  325. package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  326. package/lib/shared-tree/sharedTreeEditBuilder.d.ts +2 -2
  327. package/lib/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
  328. package/lib/shared-tree/sharedTreeEditBuilder.js +15 -11
  329. package/lib/shared-tree/sharedTreeEditBuilder.js.map +1 -1
  330. package/lib/shared-tree/treeApi.d.ts +6 -6
  331. package/lib/shared-tree/treeApi.d.ts.map +1 -1
  332. package/lib/shared-tree/treeApi.js.map +1 -1
  333. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  334. package/lib/shared-tree/treeCheckout.js +5 -4
  335. package/lib/shared-tree/treeCheckout.js.map +1 -1
  336. package/lib/shared-tree-core/branch.d.ts +2 -3
  337. package/lib/shared-tree-core/branch.d.ts.map +1 -1
  338. package/lib/shared-tree-core/branch.js +11 -12
  339. package/lib/shared-tree-core/branch.js.map +1 -1
  340. package/lib/shared-tree-core/defaultResubmitMachine.d.ts +5 -5
  341. package/lib/shared-tree-core/defaultResubmitMachine.d.ts.map +1 -1
  342. package/lib/shared-tree-core/defaultResubmitMachine.js +4 -4
  343. package/lib/shared-tree-core/defaultResubmitMachine.js.map +1 -1
  344. package/lib/shared-tree-core/editManager.d.ts.map +1 -1
  345. package/lib/shared-tree-core/editManager.js +2 -2
  346. package/lib/shared-tree-core/editManager.js.map +1 -1
  347. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  348. package/lib/shared-tree-core/sharedTreeCore.js +2 -2
  349. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  350. package/lib/simple-tree/api/conciseTree.d.ts +29 -0
  351. package/lib/simple-tree/api/conciseTree.d.ts.map +1 -0
  352. package/lib/simple-tree/api/conciseTree.js +21 -0
  353. package/lib/simple-tree/api/conciseTree.js.map +1 -0
  354. package/lib/simple-tree/api/customTree.d.ts +44 -0
  355. package/lib/simple-tree/api/customTree.d.ts.map +1 -0
  356. package/lib/simple-tree/api/customTree.js +59 -0
  357. package/lib/simple-tree/api/customTree.js.map +1 -0
  358. package/lib/simple-tree/api/index.d.ts +7 -2
  359. package/lib/simple-tree/api/index.d.ts.map +1 -1
  360. package/lib/simple-tree/api/index.js +1 -0
  361. package/lib/simple-tree/api/index.js.map +1 -1
  362. package/lib/simple-tree/api/schemaCreationUtilities.d.ts +41 -26
  363. package/lib/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -1
  364. package/lib/simple-tree/api/schemaCreationUtilities.js +43 -15
  365. package/lib/simple-tree/api/schemaCreationUtilities.js.map +1 -1
  366. package/lib/simple-tree/api/schemaFactory.d.ts +1 -2
  367. package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
  368. package/lib/simple-tree/api/schemaFactory.js +1 -1
  369. package/lib/simple-tree/api/schemaFactory.js.map +1 -1
  370. package/lib/simple-tree/api/schemaFactoryRecursive.d.ts +1 -2
  371. package/lib/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
  372. package/lib/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
  373. package/lib/simple-tree/api/storedSchema.d.ts +78 -0
  374. package/lib/simple-tree/api/storedSchema.d.ts.map +1 -0
  375. package/lib/simple-tree/api/storedSchema.js +101 -0
  376. package/lib/simple-tree/api/storedSchema.js.map +1 -0
  377. package/lib/simple-tree/api/testRecursiveDomain.d.ts +10 -10
  378. package/lib/simple-tree/api/tree.d.ts +12 -3
  379. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  380. package/lib/simple-tree/api/tree.js.map +1 -1
  381. package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  382. package/lib/simple-tree/api/treeNodeApi.js +3 -3
  383. package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
  384. package/lib/simple-tree/{typesUnsafe.d.ts → api/typesUnsafe.d.ts} +58 -10
  385. package/lib/simple-tree/api/typesUnsafe.d.ts.map +1 -0
  386. package/lib/simple-tree/api/typesUnsafe.js.map +1 -0
  387. package/lib/simple-tree/api/verboseTree.d.ts +6 -20
  388. package/lib/simple-tree/api/verboseTree.d.ts.map +1 -1
  389. package/lib/simple-tree/api/verboseTree.js +11 -49
  390. package/lib/simple-tree/api/verboseTree.js.map +1 -1
  391. package/lib/simple-tree/arrayNode.d.ts +14 -3
  392. package/lib/simple-tree/arrayNode.d.ts.map +1 -1
  393. package/lib/simple-tree/arrayNode.js +1 -2
  394. package/lib/simple-tree/arrayNode.js.map +1 -1
  395. package/lib/simple-tree/core/index.d.ts +1 -1
  396. package/lib/simple-tree/core/index.d.ts.map +1 -1
  397. package/lib/simple-tree/core/index.js +1 -1
  398. package/lib/simple-tree/core/index.js.map +1 -1
  399. package/lib/simple-tree/core/treeNodeKernel.d.ts +9 -0
  400. package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  401. package/lib/simple-tree/core/treeNodeKernel.js +12 -0
  402. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
  403. package/lib/simple-tree/core/treeNodeSchema.d.ts +6 -5
  404. package/lib/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  405. package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
  406. package/lib/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  407. package/lib/simple-tree/core/unhydratedFlexTree.js +3 -1
  408. package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  409. package/lib/simple-tree/core/withType.d.ts +3 -1
  410. package/lib/simple-tree/core/withType.d.ts.map +1 -1
  411. package/lib/simple-tree/core/withType.js.map +1 -1
  412. package/lib/simple-tree/flexList.d.ts.map +1 -0
  413. package/lib/simple-tree/flexList.js.map +1 -0
  414. package/lib/simple-tree/index.d.ts +6 -7
  415. package/lib/simple-tree/index.d.ts.map +1 -1
  416. package/lib/simple-tree/index.js +3 -4
  417. package/lib/simple-tree/index.js.map +1 -1
  418. package/lib/simple-tree/mapNode.d.ts.map +1 -1
  419. package/lib/simple-tree/mapNode.js +1 -2
  420. package/lib/simple-tree/mapNode.js.map +1 -1
  421. package/lib/simple-tree/objectNode.d.ts.map +1 -1
  422. package/lib/simple-tree/objectNode.js +1 -2
  423. package/lib/simple-tree/objectNode.js.map +1 -1
  424. package/lib/simple-tree/schemaTypes.d.ts +60 -7
  425. package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
  426. package/lib/simple-tree/schemaTypes.js +6 -1
  427. package/lib/simple-tree/schemaTypes.js.map +1 -1
  428. package/lib/simple-tree/toFlexSchema.d.ts.map +1 -1
  429. package/lib/simple-tree/toFlexSchema.js +1 -3
  430. package/lib/simple-tree/toFlexSchema.js.map +1 -1
  431. package/lib/simple-tree/toMapTree.d.ts +4 -2
  432. package/lib/simple-tree/toMapTree.d.ts.map +1 -1
  433. package/lib/simple-tree/toMapTree.js +3 -3
  434. package/lib/simple-tree/toMapTree.js.map +1 -1
  435. package/lib/simple-tree/treeNodeValid.d.ts.map +1 -1
  436. package/lib/simple-tree/treeNodeValid.js +2 -1
  437. package/lib/simple-tree/treeNodeValid.js.map +1 -1
  438. package/lib/treeFactory.d.ts +1 -0
  439. package/lib/treeFactory.d.ts.map +1 -1
  440. package/lib/treeFactory.js +1 -0
  441. package/lib/treeFactory.js.map +1 -1
  442. package/lib/util/utils.d.ts +10 -8
  443. package/lib/util/utils.d.ts.map +1 -1
  444. package/lib/util/utils.js.map +1 -1
  445. package/package.json +44 -27
  446. package/src/codec/codec.ts +4 -4
  447. package/src/codec/noopValidator.ts +1 -1
  448. package/src/core/change-family/changeFamily.ts +5 -2
  449. package/src/core/change-family/editBuilder.ts +3 -2
  450. package/src/core/rebase/changeRebaser.ts +6 -1
  451. package/src/core/rebase/utils.ts +1 -1
  452. package/src/core/tree/anchorSet.ts +63 -13
  453. package/src/external-utilities/typeboxValidator.ts +1 -1
  454. package/src/feature-libraries/default-schema/defaultEditBuilder.ts +92 -47
  455. package/src/feature-libraries/default-schema/defaultFieldKinds.ts +7 -7
  456. package/src/feature-libraries/flex-tree/lazyField.ts +44 -7
  457. package/src/feature-libraries/index.ts +0 -10
  458. package/src/feature-libraries/mitigatedChangeFamily.ts +11 -4
  459. package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +1 -0
  460. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +218 -175
  461. package/src/feature-libraries/optional-field/optionalField.ts +21 -17
  462. package/src/feature-libraries/schema-index/schemaSummarizer.ts +2 -10
  463. package/src/feature-libraries/sequence-field/compose.ts +67 -58
  464. package/src/feature-libraries/sequence-field/invert.ts +30 -6
  465. package/src/feature-libraries/sequence-field/sequenceFieldEditor.ts +65 -19
  466. package/src/feature-libraries/treeCompressionUtils.ts +1 -1
  467. package/src/index.ts +26 -6
  468. package/src/internalTypes.ts +4 -1
  469. package/src/packageVersion.ts +1 -1
  470. package/src/shared-tree/index.ts +5 -0
  471. package/src/shared-tree/schematizingTreeView.ts +7 -16
  472. package/src/shared-tree/sharedTree.ts +55 -23
  473. package/src/shared-tree/sharedTreeChangeFamily.ts +5 -1
  474. package/src/shared-tree/sharedTreeEditBuilder.ts +23 -12
  475. package/src/shared-tree/treeApi.ts +19 -9
  476. package/src/shared-tree/treeCheckout.ts +7 -6
  477. package/src/shared-tree-core/branch.ts +11 -14
  478. package/src/shared-tree-core/defaultResubmitMachine.ts +4 -4
  479. package/src/shared-tree-core/editManager.ts +2 -1
  480. package/src/shared-tree-core/sharedTreeCore.ts +4 -2
  481. package/src/simple-tree/api/conciseTree.ts +58 -0
  482. package/src/simple-tree/api/customTree.ts +119 -0
  483. package/src/simple-tree/api/index.ts +39 -1
  484. package/src/simple-tree/api/schemaCreationUtilities.ts +55 -36
  485. package/src/simple-tree/api/schemaFactory.ts +4 -6
  486. package/src/simple-tree/api/schemaFactoryRecursive.ts +1 -2
  487. package/src/simple-tree/api/storedSchema.ts +126 -0
  488. package/src/simple-tree/api/tree.ts +24 -2
  489. package/src/simple-tree/api/treeNodeApi.ts +3 -8
  490. package/src/simple-tree/{typesUnsafe.ts → api/typesUnsafe.ts} +95 -21
  491. package/src/simple-tree/api/verboseTree.ts +21 -76
  492. package/src/simple-tree/arrayNode.ts +35 -15
  493. package/src/simple-tree/core/index.ts +1 -0
  494. package/src/simple-tree/core/treeNodeKernel.ts +13 -0
  495. package/src/simple-tree/core/treeNodeSchema.ts +7 -5
  496. package/src/simple-tree/core/unhydratedFlexTree.ts +6 -1
  497. package/src/simple-tree/core/withType.ts +10 -1
  498. package/src/simple-tree/index.ts +41 -21
  499. package/src/simple-tree/mapNode.ts +1 -1
  500. package/src/simple-tree/objectNode.ts +1 -1
  501. package/src/simple-tree/schemaTypes.ts +70 -11
  502. package/src/simple-tree/toFlexSchema.ts +1 -3
  503. package/src/simple-tree/toMapTree.ts +7 -4
  504. package/src/simple-tree/treeNodeValid.ts +2 -1
  505. package/src/treeFactory.ts +1 -0
  506. package/src/util/utils.ts +10 -8
  507. package/dist/feature-libraries/flex-tree/unboxed.d.ts +0 -12
  508. package/dist/feature-libraries/flex-tree/unboxed.d.ts.map +0 -1
  509. package/dist/feature-libraries/flex-tree/unboxed.js +0 -20
  510. package/dist/feature-libraries/flex-tree/unboxed.js.map +0 -1
  511. package/dist/feature-libraries/typed-schema/flexList.d.ts.map +0 -1
  512. package/dist/feature-libraries/typed-schema/flexList.js.map +0 -1
  513. package/dist/feature-libraries/typed-schema/index.d.ts +0 -7
  514. package/dist/feature-libraries/typed-schema/index.d.ts.map +0 -1
  515. package/dist/feature-libraries/typed-schema/index.js +0 -12
  516. package/dist/feature-libraries/typed-schema/index.js.map +0 -1
  517. package/dist/feature-libraries/typed-schema/typedTreeSchema.d.ts +0 -14
  518. package/dist/feature-libraries/typed-schema/typedTreeSchema.d.ts.map +0 -1
  519. package/dist/feature-libraries/typed-schema/typedTreeSchema.js +0 -7
  520. package/dist/feature-libraries/typed-schema/typedTreeSchema.js.map +0 -1
  521. package/dist/simple-tree/proxyBinding.d.ts +0 -15
  522. package/dist/simple-tree/proxyBinding.d.ts.map +0 -1
  523. package/dist/simple-tree/proxyBinding.js +0 -22
  524. package/dist/simple-tree/proxyBinding.js.map +0 -1
  525. package/dist/simple-tree/typesUnsafe.d.ts.map +0 -1
  526. package/dist/simple-tree/typesUnsafe.js.map +0 -1
  527. package/lib/feature-libraries/flex-tree/unboxed.d.ts +0 -12
  528. package/lib/feature-libraries/flex-tree/unboxed.d.ts.map +0 -1
  529. package/lib/feature-libraries/flex-tree/unboxed.js +0 -16
  530. package/lib/feature-libraries/flex-tree/unboxed.js.map +0 -1
  531. package/lib/feature-libraries/typed-schema/flexList.d.ts.map +0 -1
  532. package/lib/feature-libraries/typed-schema/flexList.js.map +0 -1
  533. package/lib/feature-libraries/typed-schema/index.d.ts +0 -7
  534. package/lib/feature-libraries/typed-schema/index.d.ts.map +0 -1
  535. package/lib/feature-libraries/typed-schema/index.js +0 -6
  536. package/lib/feature-libraries/typed-schema/index.js.map +0 -1
  537. package/lib/feature-libraries/typed-schema/typedTreeSchema.d.ts +0 -14
  538. package/lib/feature-libraries/typed-schema/typedTreeSchema.d.ts.map +0 -1
  539. package/lib/feature-libraries/typed-schema/typedTreeSchema.js +0 -6
  540. package/lib/feature-libraries/typed-schema/typedTreeSchema.js.map +0 -1
  541. package/lib/simple-tree/proxyBinding.d.ts +0 -15
  542. package/lib/simple-tree/proxyBinding.d.ts.map +0 -1
  543. package/lib/simple-tree/proxyBinding.js +0 -18
  544. package/lib/simple-tree/proxyBinding.js.map +0 -1
  545. package/lib/simple-tree/typesUnsafe.d.ts.map +0 -1
  546. package/lib/simple-tree/typesUnsafe.js.map +0 -1
  547. package/src/feature-libraries/flex-tree/unboxed.ts +0 -24
  548. package/src/feature-libraries/typed-schema/README.md +0 -6
  549. package/src/feature-libraries/typed-schema/index.ts +0 -16
  550. package/src/feature-libraries/typed-schema/typedTreeSchema.ts +0 -14
  551. package/src/simple-tree/proxyBinding.ts +0 -20
  552. /package/dist/simple-tree/{typesUnsafe.js → api/typesUnsafe.js} +0 -0
  553. /package/dist/{feature-libraries/typed-schema → simple-tree}/flexList.d.ts +0 -0
  554. /package/dist/{feature-libraries/typed-schema → simple-tree}/flexList.js +0 -0
  555. /package/lib/simple-tree/{typesUnsafe.js → api/typesUnsafe.js} +0 -0
  556. /package/lib/{feature-libraries/typed-schema → simple-tree}/flexList.d.ts +0 -0
  557. /package/lib/{feature-libraries/typed-schema → simple-tree}/flexList.js +0 -0
  558. /package/src/simple-tree/{ProxyBinding.md → core/TreeNodeBinding.md} +0 -0
  559. /package/src/{feature-libraries/typed-schema → simple-tree}/flexList.ts +0 -0
@@ -2,11 +2,20 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import type { FlexListToUnion, Unenforced } from "../feature-libraries/index.js";
6
- import type { RestrictiveStringRecord, _InlineTrick } from "../util/index.js";
7
- import type { AllowedTypes, ApplyKind, FieldKind, FieldSchema, ImplicitAllowedTypes, ImplicitFieldSchema, NodeFromSchema, TreeNodeFromImplicitAllowedTypes } from "./schemaTypes.js";
8
- import type { NodeKind, TreeNodeSchema, WithType, TreeNode, Unhydrated } from "./core/index.js";
9
- import type { TreeArrayNodeBase, TreeArrayNode } from "./arrayNode.js";
5
+ import type { RestrictiveStringRecord, _InlineTrick } from "../../util/index.js";
6
+ import type { ApplyKind, FieldKind, FieldSchema, ImplicitAllowedTypes, ImplicitFieldSchema, TreeLeafValue } from "../schemaTypes.js";
7
+ import type { NodeKind, WithType, TreeNode, Unhydrated, InternalTreeNode, TreeNodeSchema, TreeNodeSchemaCore } from "../core/index.js";
8
+ import type { TreeArrayNodeBase } from "../arrayNode.js";
9
+ import type { FlexListToUnion, LazyItem } from "../flexList.js";
10
+ /**
11
+ * 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
+ * These extends constraints only serve as documentation:
14
+ * to avoid breaking compilation, this type has to not actually enforce anything, and thus is just `unknown`.
15
+ * Therefore the type safety is the responsibility of the user of the API.
16
+ * @public
17
+ */
18
+ export type Unenforced<_DesiredExtendsConstraint> = unknown;
10
19
  /**
11
20
  * {@link Unenforced} version of `ObjectFromSchemaRecord`.
12
21
  * @remarks
@@ -16,6 +25,38 @@ import type { TreeArrayNodeBase, TreeArrayNode } from "./arrayNode.js";
16
25
  export type ObjectFromSchemaRecordUnsafe<T extends Unenforced<RestrictiveStringRecord<ImplicitFieldSchema>>> = {
17
26
  -readonly [Property in keyof T]: TreeFieldFromImplicitFieldUnsafe<T[Property]>;
18
27
  };
28
+ /**
29
+ * {@link Unenforced} version of {@link TreeNodeSchema}.
30
+ * @remarks
31
+ * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
32
+ * @system @public
33
+ */
34
+ export type TreeNodeSchemaUnsafe<Name extends string = string, Kind extends NodeKind = NodeKind, TNode extends Unenforced<TreeNode | TreeLeafValue> = unknown, TBuild = never, ImplicitlyConstructable extends boolean = boolean, Info = unknown> = TreeNodeSchemaClassUnsafe<Name, Kind, TNode, TBuild, ImplicitlyConstructable, Info> | TreeNodeSchemaNonClassUnsafe<Name, Kind, TNode, TBuild, ImplicitlyConstructable, Info>;
35
+ /**
36
+ * {@link Unenforced} version of {@link TreeNodeSchemaClass}.
37
+ * @remarks
38
+ * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
39
+ * @system @public
40
+ */
41
+ export interface TreeNodeSchemaClassUnsafe<out Name extends string, out Kind extends NodeKind, out TNode extends Unenforced<TreeNode | TreeLeafValue>, in TInsertable = never, out ImplicitlyConstructable extends boolean = boolean, out Info = unknown> extends TreeNodeSchemaCore<Name, Kind, ImplicitlyConstructable, Info> {
42
+ /**
43
+ * Constructs an {@link Unhydrated} node with this schema.
44
+ * @remarks
45
+ * This constructor is also used internally to construct hydrated nodes with a different parameter type.
46
+ * Therefore, overriding this constructor with different argument types is not type-safe and is not supported.
47
+ * @sealed
48
+ */
49
+ new (data: TInsertable | InternalTreeNode): Unhydrated<TNode>;
50
+ }
51
+ /**
52
+ * {@link Unenforced} version of {@link TreeNodeSchemaNonClass}.
53
+ * @remarks
54
+ * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
55
+ * @system @public
56
+ */
57
+ export interface TreeNodeSchemaNonClassUnsafe<out Name extends string, out Kind extends NodeKind, out TNode extends Unenforced<TreeNode | TreeLeafValue>, in TInsertable = never, out ImplicitlyConstructable extends boolean = boolean, out Info = unknown> extends TreeNodeSchemaCore<Name, Kind, ImplicitlyConstructable, Info> {
58
+ create(data: TInsertable): TNode;
59
+ }
19
60
  /**
20
61
  * {@link Unenforced} version of {@link TreeObjectNode}.
21
62
  * @remarks
@@ -30,20 +71,27 @@ export type TreeObjectNodeUnsafe<T extends Unenforced<RestrictiveStringRecord<Im
30
71
  * @system @public
31
72
  */
32
73
  export type TreeFieldFromImplicitFieldUnsafe<TSchema extends Unenforced<ImplicitFieldSchema>> = TSchema extends FieldSchemaUnsafe<infer Kind, infer Types> ? ApplyKind<TreeNodeFromImplicitAllowedTypesUnsafe<Types>, Kind, false> : TSchema extends ImplicitAllowedTypes ? TreeNodeFromImplicitAllowedTypesUnsafe<TSchema> : unknown;
74
+ /**
75
+ * {@link Unenforced} version of {@link AllowedTypes}.
76
+ * @remarks
77
+ * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
78
+ * @system @public
79
+ */
80
+ export type AllowedTypesUnsafe = readonly LazyItem<TreeNodeSchemaUnsafe>[];
33
81
  /**
34
82
  * {@link Unenforced} version of {@link TreeNodeFromImplicitAllowedTypes}.
35
83
  * @remarks
36
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.
37
85
  * @system @public
38
86
  */
39
- export type TreeNodeFromImplicitAllowedTypesUnsafe<TSchema extends Unenforced<ImplicitAllowedTypes>> = TSchema extends ImplicitAllowedTypes ? TreeNodeFromImplicitAllowedTypes<TSchema> : TSchema extends TreeNodeSchema ? NodeFromSchema<TSchema> : TSchema extends AllowedTypes ? NodeFromSchema<FlexListToUnion<TSchema>> : unknown;
87
+ export type TreeNodeFromImplicitAllowedTypesUnsafe<TSchema extends Unenforced<ImplicitAllowedTypes>> = TSchema extends TreeNodeSchemaUnsafe ? NodeFromSchemaUnsafe<TSchema> : TSchema extends AllowedTypesUnsafe ? NodeFromSchemaUnsafe<FlexListToUnion<TSchema>> : unknown;
40
88
  /**
41
89
  * {@link Unenforced} version of {@link InsertableTreeNodeFromImplicitAllowedTypes}.
42
90
  * @remarks
43
91
  * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
44
92
  * @system @public
45
93
  */
46
- export type InsertableTreeNodeFromImplicitAllowedTypesUnsafe<TSchema extends Unenforced<ImplicitAllowedTypes>> = TSchema extends AllowedTypes ? InsertableTypedNodeUnsafe<FlexListToUnion<TSchema>> : InsertableTypedNodeUnsafe<TSchema>;
94
+ export type InsertableTreeNodeFromImplicitAllowedTypesUnsafe<TSchema extends Unenforced<ImplicitAllowedTypes>> = TSchema extends AllowedTypesUnsafe ? InsertableTypedNodeUnsafe<FlexListToUnion<TSchema>> : InsertableTypedNodeUnsafe<TSchema>;
47
95
  /**
48
96
  * {@link Unenforced} version of {@link InsertableTypedNode}.
49
97
  * @remarks
@@ -61,21 +109,21 @@ export type InsertableTypedNodeUnsafe<T extends Unenforced<TreeNodeSchema>> = [
61
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.
62
110
  * @system @public
63
111
  */
64
- export type NodeFromSchemaUnsafe<T extends Unenforced<TreeNodeSchema>> = T extends TreeNodeSchema<string, NodeKind, infer TNode> ? TNode : never;
112
+ export type NodeFromSchemaUnsafe<T extends Unenforced<TreeNodeSchema>> = T extends TreeNodeSchemaUnsafe<string, NodeKind, infer TNode> ? TNode : never;
65
113
  /**
66
114
  * {@link Unenforced} version of {@link InsertableTreeNodeFromImplicitAllowedTypes}.
67
115
  * @remarks
68
116
  * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
69
117
  * @system @public
70
118
  */
71
- export type NodeBuilderDataUnsafe<T extends Unenforced<TreeNodeSchema>> = T extends TreeNodeSchema<string, NodeKind, unknown, infer TBuild> ? TBuild : never;
119
+ export type NodeBuilderDataUnsafe<T extends Unenforced<TreeNodeSchema>> = T extends TreeNodeSchemaUnsafe<string, NodeKind, unknown, infer TBuild> ? TBuild : never;
72
120
  /**
73
121
  * {@link Unenforced} version of {@link (TreeArrayNode:interface)}.
74
122
  * @remarks
75
123
  * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
76
124
  * @system @sealed @public
77
125
  */
78
- export interface TreeArrayNodeUnsafe<TAllowedTypes extends Unenforced<ImplicitAllowedTypes>> extends TreeArrayNodeBase<TreeNodeFromImplicitAllowedTypesUnsafe<TAllowedTypes>, InsertableTreeNodeFromImplicitAllowedTypesUnsafe<TAllowedTypes>, TreeArrayNode> {
126
+ export interface TreeArrayNodeUnsafe<TAllowedTypes extends Unenforced<ImplicitAllowedTypes>> extends TreeArrayNodeBase<TreeNodeFromImplicitAllowedTypesUnsafe<TAllowedTypes>, InsertableTreeNodeFromImplicitAllowedTypesUnsafe<TAllowedTypes>> {
79
127
  }
80
128
  /**
81
129
  * {@link Unenforced} version of {@link TreeMapNode}.
@@ -0,0 +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,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEjF,OAAO,KAAK,EACX,SAAS,EACT,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,cAA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AM,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"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typesUnsafe.js","sourceRoot":"","sources":["../../../src/simple-tree/api/typesUnsafe.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAiWH,sDAAsD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { RestrictiveStringRecord, _InlineTrick } from \"../../util/index.js\";\n\nimport type {\n\tApplyKind,\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 { TreeArrayNodeBase } 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 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 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 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 interface TreeNodeSchemaClassUnsafe<\n\tout Name extends string,\n\tout Kind extends NodeKind,\n\t// TODO: maybe this can be more specific (exclude leaves)\n\tout TNode extends Unenforced<TreeNode | TreeLeafValue>,\n\tin TInsertable = never,\n\tout ImplicitlyConstructable extends boolean = boolean,\n\tout Info = unknown,\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 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 interface TreeNodeSchemaNonClassUnsafe<\n\tout Name extends string,\n\tout Kind extends NodeKind,\n\tout TNode extends Unenforced<TreeNode | TreeLeafValue>,\n\tin TInsertable = never,\n\tout ImplicitlyConstructable extends boolean = 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, false>\n\t\t: TSchema extends ImplicitAllowedTypes\n\t\t\t? TreeNodeFromImplicitAllowedTypesUnsafe<TSchema>\n\t\t\t: unknown;\n\n/**\n * {@link Unenforced} version of {@link AllowedTypes}.\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 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 * @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 AllowedTypesUnsafe\n\t? InsertableTypedNodeUnsafe<FlexListToUnion<TSchema>>\n\t: InsertableTypedNodeUnsafe<TSchema>;\n\n/**\n * {@link Unenforced} version of {@link InsertableTypedNode}.\n * @remarks\n * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.\n * @system @public\n */\nexport type InsertableTypedNodeUnsafe<T extends Unenforced<TreeNodeSchema>> = [\n\t| Unhydrated<NodeFromSchemaUnsafe<T>>\n\t| (T extends { implicitlyConstructable: true } ? NodeBuilderDataUnsafe<T> : never),\n][_InlineTrick];\n\n/**\n * {@link Unenforced} version of {@link NodeFromSchema}.\n * @remarks\n * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.\n * @system @public\n */\nexport type NodeFromSchemaUnsafe<T extends Unenforced<TreeNodeSchema>> =\n\tT extends 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 TreeArrayNodeBase<\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 * @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 * @remarks\n * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.\n * @system @public\n */\nexport type InsertableTreeFieldFromImplicitFieldUnsafe<\n\tTSchema extends Unenforced<ImplicitFieldSchema>,\n> = TSchema extends FieldSchemaUnsafe<infer Kind, infer Types>\n\t? ApplyKind<InsertableTreeNodeFromImplicitAllowedTypesUnsafe<Types>, Kind, true>\n\t: InsertableTreeNodeFromImplicitAllowedTypesUnsafe<TSchema>;\n\n/**\n * {@link Unenforced} version of {@link FieldSchema}.\n * @remarks\n * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.\n * @public\n */\nexport interface FieldSchemaUnsafe<\n\tout Kind extends FieldKind,\n\tout Types extends Unenforced<ImplicitAllowedTypes>,\n> extends FieldSchema<Kind, any> {\n\t/**\n\t * {@inheritDoc FieldSchema.kind}\n\t */\n\treadonly kind: Kind;\n\t/**\n\t * {@inheritDoc FieldSchema.allowedTypes}\n\t */\n\treadonly allowedTypes: Types;\n\t/**\n\t * {@inheritDoc FieldSchema.allowedTypeSet}\n\t */\n\treadonly allowedTypeSet: ReadonlySet<TreeNodeSchema>;\n}\n\n/* eslint-enable @typescript-eslint/no-explicit-any */\n"]}
@@ -5,13 +5,15 @@
5
5
  import type { IFluidHandle } from "@fluidframework/core-interfaces";
6
6
  import { type FieldKey, type ITreeCursor, type ITreeCursorSynchronous } from "../../core/index.js";
7
7
  import type { TreeLeafValue, ImplicitFieldSchema, ImplicitAllowedTypes } from "../schemaTypes.js";
8
+ import { type EncodeOptions } from "./customTree.js";
8
9
  /**
9
- * Verbose encoding of a {@link TreeNode} or {@link TreeValue}.
10
+ * Verbose encoding of a {@link TreeNode} or {@link TreeLeafValue}.
10
11
  * @remarks
11
12
  * This is verbose meaning that every {@link TreeNode} is a {@link VerboseTreeNode}.
12
13
  * Any IFluidHandle values have been replaced by `THandle`.
13
14
  * @privateRemarks
14
- * This can store all possible simple trees, but it can not store all possible trees representable by our internal representations like FlexTree and JsonableTree.
15
+ * This can store all possible simple trees,
16
+ * but it can not store all possible trees representable by our internal representations like FlexTree and JsonableTree.
15
17
  */
16
18
  export type VerboseTree<THandle = IFluidHandle> = VerboseTreeNode<THandle> | Exclude<TreeLeafValue, IFluidHandle> | THandle;
17
19
  /**
@@ -35,7 +37,8 @@ export type VerboseTree<THandle = IFluidHandle> = VerboseTreeNode<THandle> | Exc
35
37
  * This format allows for all simple-tree compatible trees to be represented.
36
38
  *
37
39
  * Unlike `JsonableTree`, leaf nodes are not boxed into node objects, and instead have their schema inferred from the value.
38
- * Additionally, sequence fields can only occur on a node that has a single sequence field (with the empty key) replicating the behavior of simple-tree ArrayNodes.
40
+ * Additionally, sequence fields can only occur on a node that has a single sequence field (with the empty key)
41
+ * replicating the behavior of simple-tree ArrayNodes.
39
42
  */
40
43
  export interface VerboseTreeNode<THandle = IFluidHandle> {
41
44
  /**
@@ -96,23 +99,6 @@ export interface SchemalessParseOptions<TCustom> {
96
99
  encode(type: string, key: FieldKey): string;
97
100
  };
98
101
  }
99
- /**
100
- * Options for how to interpret a `VerboseTree<TCustom>` without relying on schema.
101
- */
102
- export interface EncodeOptions<TCustom> {
103
- /**
104
- * Fixup custom input formats.
105
- * @remarks
106
- * See note on {@link ParseOptions.valueConverter}.
107
- */
108
- valueConverter(data: IFluidHandle): TCustom;
109
- /**
110
- * If true, interpret the input keys of object nodes as stored keys.
111
- * If false, interpret them as property keys.
112
- * @defaultValue false.
113
- */
114
- readonly useStoredKeys?: boolean;
115
- }
116
102
  /**
117
103
  * Use info from `schema` to convert `options` to {@link SchemalessParseOptions}.
118
104
  */
@@ -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,EAON,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;AAmB3B;;;;;;;GAOG;AACH,MAAM,MAAM,WAAW,CAAC,OAAO,GAAG,YAAY,IAC3C,eAAe,CAAC,OAAO,CAAC,GACxB,OAAO,CAAC,aAAa,EAAE,YAAY,CAAC,GACpC,OAAO,CAAC;AAEX;;;;;;;;;;;;;;;;;;;;;;GAsBG;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;;GAEG;AACH,MAAM,WAAW,YAAY,CAAC,OAAO;IACpC;;;;;;;;OAQG;IACH,cAAc,CAAC,IAAI,EAAE,WAAW,CAAC,OAAO,CAAC,GAAG,aA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;IAC9C;;;;OAIG;IACH,cAAc,CAAC,IAAI,EAAE,WAAW,CAAC,OAAO,CAAC,GAAG,aAAa,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,CA8CjC;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"}
@@ -4,13 +4,13 @@
4
4
  */
5
5
  import { isFluidHandle } from "@fluidframework/runtime-utils/internal";
6
6
  import { assert } from "@fluidframework/core-utils/internal";
7
- import { aboveRootPlaceholder, EmptyKey, forEachField, inCursorField, keyAsDetachedField, mapCursorField, } from "../../core/index.js";
7
+ import { aboveRootPlaceholder, EmptyKey, keyAsDetachedField, } from "../../core/index.js";
8
8
  import { brand, fail } from "../../util/index.js";
9
9
  import { NodeKind } from "../core/index.js";
10
10
  import { isTreeValue, stackTreeFieldCursor, stackTreeNodeCursor, } from "../../feature-libraries/index.js";
11
11
  import { booleanSchema, handleSchema, nullSchema, numberSchema, stringSchema, } from "../leafNodeSchema.js";
12
12
  import { isObjectNodeSchema } from "../objectNodeTypes.js";
13
- import { walkFieldSchema } from "../walkFieldSchema.js";
13
+ import { customFromCursorInner, } from "./customTree.js";
14
14
  import { getUnhydratedContext } from "../createContext.js";
15
15
  /**
16
16
  * Use info from `schema` to convert `options` to {@link SchemalessParseOptions}.
@@ -154,56 +154,18 @@ export function verboseFromCursor(reader, rootSchema, options) {
154
154
  useStoredKeys: false,
155
155
  ...options,
156
156
  };
157
- const schemaMap = new Map();
158
- walkFieldSchema(rootSchema, {
159
- node(schema) {
160
- schemaMap.set(schema.identifier, schema);
161
- },
162
- });
157
+ const schemaMap = getUnhydratedContext(rootSchema).schema;
163
158
  return verboseFromCursorInner(reader, config, schemaMap);
164
159
  }
165
160
  function verboseFromCursorInner(reader, options, schema) {
166
- const type = reader.type;
167
- const nodeSchema = schema.get(type) ?? fail("missing schema for type in cursor");
168
- switch (type) {
169
- case numberSchema.identifier:
170
- case booleanSchema.identifier:
171
- case nullSchema.identifier:
172
- case stringSchema.identifier:
173
- assert(reader.value !== undefined, 0xa14 /* out of schema: missing value */);
174
- assert(!isFluidHandle(reader.value), 0xa15 /* out of schema: unexpected FluidHandle */);
175
- return reader.value;
176
- case handleSchema.identifier:
177
- assert(reader.value !== undefined, 0xa16 /* out of schema: missing value */);
178
- assert(isFluidHandle(reader.value), 0xa17 /* out of schema: unexpected FluidHandle */);
179
- return options.valueConverter(reader.value);
180
- default: {
181
- assert(reader.value === undefined, 0xa18 /* out of schema: unexpected value */);
182
- if (nodeSchema.kind === NodeKind.Array) {
183
- const fields = inCursorField(reader, EmptyKey, () => mapCursorField(reader, () => verboseFromCursorInner(reader, options, schema)));
184
- return { type, fields };
185
- }
186
- else {
187
- const fields = {};
188
- forEachField(reader, () => {
189
- const children = mapCursorField(reader, () => verboseFromCursorInner(reader, options, schema));
190
- if (children.length === 1) {
191
- const storedKey = reader.getFieldKey();
192
- const key = isObjectNodeSchema(nodeSchema) && !options.useStoredKeys
193
- ? nodeSchema.storedKeyToPropertyKey.get(storedKey) ??
194
- fail("missing property key")
195
- : storedKey;
196
- // Length is checked above.
197
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
198
- fields[key] = children[0];
199
- }
200
- else {
201
- assert(children.length === 0, 0xa19 /* invalid children number */);
202
- }
203
- });
204
- return { type, fields };
205
- }
206
- }
161
+ const fields = customFromCursorInner(reader, options, schema, verboseFromCursorInner);
162
+ const nodeSchema = schema.get(reader.type) ?? fail("missing schema for type in cursor");
163
+ if (nodeSchema.kind === NodeKind.Leaf) {
164
+ return fields;
207
165
  }
166
+ return {
167
+ type: reader.type,
168
+ fields: fields,
169
+ };
208
170
  }
209
171
  //# sourceMappingURL=verboseTree.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"verboseTree.js","sourceRoot":"","sources":["../../../src/simple-tree/api/verboseTree.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AACvE,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAE7D,OAAO,EACN,oBAAoB,EACpB,QAAQ,EACR,YAAY,EACZ,aAAa,EACb,kBAAkB,EAClB,cAAc,GAKd,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAMlD,OAAO,EAAE,QAAQ,EAAuB,MAAM,kBAAkB,CAAC;AACjE,OAAO,EACN,WAAW,EACX,oBAAoB,EACpB,mBAAmB,GAEnB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACN,aAAa,EACb,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,YAAY,GACZ,MAAM,sBAAsB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BACd,2BAA2B;wBAC3B,oEAAoE;wBACpE,MAAM,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAE,CAAC;oBAC5B,CAAC;yBAAM,CAAC;wBACP,MAAM,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,KAAK,CAAC,6BAA6B,CAAC,CAAC;oBACpE,CAAC;gBACF,CAAC,CAAC,CAAC;gBACH,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;YACzB,CAAC;QACF,CAAC;IACF,CAAC;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport { isFluidHandle } from \"@fluidframework/runtime-utils/internal\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\taboveRootPlaceholder,\n\tEmptyKey,\n\tforEachField,\n\tinCursorField,\n\tkeyAsDetachedField,\n\tmapCursorField,\n\ttype FieldKey,\n\ttype ITreeCursor,\n\ttype ITreeCursorSynchronous,\n\ttype TreeNodeSchemaIdentifier,\n} from \"../../core/index.js\";\nimport { brand, fail } from \"../../util/index.js\";\nimport type {\n\tTreeLeafValue,\n\tImplicitFieldSchema,\n\tImplicitAllowedTypes,\n} from \"../schemaTypes.js\";\nimport { NodeKind, type TreeNodeSchema } from \"../core/index.js\";\nimport {\n\tisTreeValue,\n\tstackTreeFieldCursor,\n\tstackTreeNodeCursor,\n\ttype CursorAdapter,\n} from \"../../feature-libraries/index.js\";\nimport {\n\tbooleanSchema,\n\thandleSchema,\n\tnullSchema,\n\tnumberSchema,\n\tstringSchema,\n} from \"../leafNodeSchema.js\";\nimport { isObjectNodeSchema } from \"../objectNodeTypes.js\";\nimport { walkFieldSchema } from \"../walkFieldSchema.js\";\nimport { getUnhydratedContext } from \"../createContext.js\";\n\n/**\n * Verbose encoding of a {@link TreeNode} or {@link TreeValue}.\n * @remarks\n * This is verbose meaning that every {@link TreeNode} is a {@link VerboseTreeNode}.\n * Any IFluidHandle values have been replaced by `THandle`.\n * @privateRemarks\n * This can store all possible simple trees, but it can not store all possible trees representable by our internal representations like FlexTree and JsonableTree.\n */\nexport type VerboseTree<THandle = IFluidHandle> =\n\t| VerboseTreeNode<THandle>\n\t| Exclude<TreeLeafValue, IFluidHandle>\n\t| THandle;\n\n/**\n * Verbose encoding of a {@link TreeNode}.\n * @remarks\n * This is verbose meaning that every {@link TreeNode} has an explicit `type` property, and `fields`.\n * This allowed VerboseTreeNode to be unambiguous regarding which type each node is without relying on symbols or hidden state.\n *\n * Any IFluidHandle values have been replaced by `THandle`. If the `THandle` is JSON compatible, then this type is JSON compatible as well.\n *\n * @privateRemarks\n * This type is only used for data which is copied into and out of the tree.\n * When being copied out, its fine to have the data be mutable since its a copy.\n *\n * When being copied in, we don't need to mutate, so we could use a readonly variant of this type.\n * however the copy in case (createFromVerbose) probably isn't harmed much by just reusing this type as is,\n * since if the caller has immutable data, TypeScript doesn't prevent assigning immutable data to a mutable type anyway.\n * Also relaxing the input methods to take readonly data would be a non-breaking change so it can be done later if desired.\n *\n * This format is simple-tree specialized alternative to {@link JsonableTree}.\n * This format allows for all simple-tree compatible trees to be represented.\n *\n * Unlike `JsonableTree`, leaf nodes are not boxed into node objects, and instead have their schema inferred from the value.\n * Additionally, sequence fields can only occur on a node that has a single sequence field (with the empty key) replicating the behavior of simple-tree ArrayNodes.\n */\nexport interface VerboseTreeNode<THandle = IFluidHandle> {\n\t/**\n\t * The meaning of this node.\n\t * Provides contexts/semantics for this node and its content.\n\t * @remarks\n\t * Typically used to associate a node with metadata (including a schema) and source code (types, behaviors, etc).\n\t * When used with this package's schema system, it will be the {@link TreeNodeSchemaCore.identifier}.\n\t */\n\ttype: string;\n\n\t/**\n\t * Content of this node.\n\t * For array nodes, an array of children.\n\t * For map and object nodes, an object which children under keys.\n\t * @remarks\n\t * For object nodes, the keys could be either the stored keys, or the property keys depending on usage.\n\t */\n\tfields:\n\t\t| VerboseTree<THandle>[]\n\t\t| {\n\t\t\t\t[key: string]: VerboseTree<THandle>;\n\t\t };\n}\n\n/**\n * Options for how to interpret a `VerboseTree<TCustom>` when schema information is available.\n */\nexport interface ParseOptions<TCustom> {\n\t/**\n\t * Fixup custom input formats.\n\t * @remarks\n\t * Main usage is to handle IFluidHandles.\n\t * When targeting JSON compatibility,\n\t * this may be by throwing an error or including a placeholder.\n\t * Since IFluidHandles are special references to FLuid data which is garbage collected when not referenced by the container for long enough,\n\t * any scheme for encoding handles for storage outside the container (or in formats the container does not understand) is unreliable.\n\t */\n\tvalueConverter(data: VerboseTree<TCustom>): TreeLeafValue | VerboseTreeNode<TCustom>;\n\t/**\n\t * If true, interpret the input keys of object nodes as stored keys.\n\t * If false, interpret them as property keys.\n\t * @defaultValue false.\n\t */\n\treadonly useStoredKeys?: boolean;\n}\n\n/**\n * Options for how to interpret a `VerboseTree<TCustom>` without relying on schema.\n */\nexport interface SchemalessParseOptions<TCustom> {\n\t/**\n\t * Fixup custom input formats.\n\t * @remarks\n\t * See note on {@link ParseOptions.valueConverter}.\n\t */\n\tvalueConverter(data: VerboseTree<TCustom>): TreeLeafValue | VerboseTreeNode<TCustom>;\n\t/**\n\t * Converts stored keys into whatever key the tree is using in its encoding.\n\t */\n\tkeyConverter?: {\n\t\tparse(type: string, inputKey: string): FieldKey;\n\t\tencode(type: string, key: FieldKey): string;\n\t};\n}\n\n/**\n * Options for how to interpret a `VerboseTree<TCustom>` without relying on schema.\n */\nexport interface EncodeOptions<TCustom> {\n\t/**\n\t * Fixup custom input formats.\n\t * @remarks\n\t * See note on {@link ParseOptions.valueConverter}.\n\t */\n\tvalueConverter(data: IFluidHandle): TCustom;\n\t/**\n\t * If true, interpret the input keys of object nodes as stored keys.\n\t * If false, interpret them as property keys.\n\t * @defaultValue false.\n\t */\n\treadonly useStoredKeys?: boolean;\n}\n\n/**\n * Use info from `schema` to convert `options` to {@link SchemalessParseOptions}.\n */\nexport function applySchemaToParserOptions<TCustom>(\n\tschema: ImplicitFieldSchema,\n\toptions: ParseOptions<TCustom>,\n): SchemalessParseOptions<TCustom> {\n\tconst config: Required<ParseOptions<TCustom>> = {\n\t\tuseStoredKeys: false,\n\t\t...options,\n\t};\n\n\tconst context = getUnhydratedContext(schema);\n\n\treturn {\n\t\tvalueConverter: config.valueConverter,\n\t\tkeyConverter: config.useStoredKeys\n\t\t\t? undefined\n\t\t\t: {\n\t\t\t\t\tencode: (type, key: FieldKey): string => {\n\t\t\t\t\t\t// translate stored key into property key.\n\t\t\t\t\t\tconst simpleNodeSchema = context.schema.get(brand(type)) ?? fail(\"missing schema\");\n\t\t\t\t\t\tif (isObjectNodeSchema(simpleNodeSchema)) {\n\t\t\t\t\t\t\tconst propertyKey = simpleNodeSchema.storedKeyToPropertyKey.get(key);\n\t\t\t\t\t\t\tif (propertyKey !== undefined) {\n\t\t\t\t\t\t\t\treturn propertyKey;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// Looking up an out of schema key.\n\t\t\t\t\t\t\t// This must point to a non-existent field.\n\t\t\t\t\t\t\t// It's possible that the key, if we returned it unmodified, could point to some data\n\t\t\t\t\t\t\t// (for example if looking up a key which is a stored key already when using property keys).\n\t\t\t\t\t\t\t// Thus return an arbitrary key that was selected randomly, so should not exist on non-adversarial data:\n\t\t\t\t\t\t\tconst arbitrary = \"arbitrary unused key: fe71614a-bf3e-43b3-b7b0-4cef39538e90\";\n\t\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\t\t!simpleNodeSchema.storedKeyToPropertyKey.has(brand(arbitrary)),\n\t\t\t\t\t\t\t\t0xa13 /* arbitrarily selected unused key was actually used */,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\treturn arbitrary;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn key;\n\t\t\t\t\t},\n\t\t\t\t\tparse: (type, inputKey): FieldKey => {\n\t\t\t\t\t\tconst simpleNodeSchema = context.schema.get(brand(type)) ?? fail(\"missing schema\");\n\t\t\t\t\t\tif (isObjectNodeSchema(simpleNodeSchema)) {\n\t\t\t\t\t\t\tconst info =\n\t\t\t\t\t\t\t\tsimpleNodeSchema.flexKeyMap.get(inputKey) ?? fail(\"missing field info\");\n\t\t\t\t\t\t\treturn info.storedKey;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn brand(inputKey);\n\t\t\t\t\t},\n\t\t\t\t},\n\t};\n}\n\n/**\n * Used to read a VerboseTree as a node cursor.\n *\n * @returns an {@link ITreeCursorSynchronous} for a single node in nodes mode.\n */\nexport function cursorFromVerbose<TCustom>(\n\tdata: VerboseTree<TCustom>,\n\toptions: SchemalessParseOptions<TCustom>,\n): ITreeCursorSynchronous {\n\treturn stackTreeNodeCursor(verboseTreeAdapter(options), data);\n}\n\n/**\n * Used to read a VerboseTree[] as a field cursor.\n *\n * @returns an {@link ITreeCursorSynchronous} for a single field in fields mode.\n */\nexport function fieldCursorFromVerbose<TCustom>(\n\tdata: VerboseTree<TCustom>[],\n\toptions: SchemalessParseOptions<TCustom>,\n): ITreeCursorSynchronous {\n\treturn stackTreeFieldCursor(\n\t\tverboseTreeAdapter(options),\n\t\t{ type: aboveRootPlaceholder, fields: data },\n\t\tkeyAsDetachedField(EmptyKey),\n\t);\n}\n\nfunction verboseTreeAdapter<TCustom>(\n\toptions: SchemalessParseOptions<TCustom>,\n): CursorAdapter<VerboseTree<TCustom>> {\n\treturn {\n\t\tvalue: (input: VerboseTree<TCustom>) => {\n\t\t\tconst node = options.valueConverter(input);\n\t\t\treturn isTreeValue(node) ? node : undefined;\n\t\t},\n\t\ttype: (input: VerboseTree<TCustom>) => {\n\t\t\tconst node = options.valueConverter(input);\n\t\t\tswitch (typeof node) {\n\t\t\t\tcase \"number\":\n\t\t\t\t\treturn numberSchema.identifier as TreeNodeSchemaIdentifier;\n\t\t\t\tcase \"string\":\n\t\t\t\t\treturn stringSchema.identifier as TreeNodeSchemaIdentifier;\n\t\t\t\tcase \"boolean\":\n\t\t\t\t\treturn booleanSchema.identifier as TreeNodeSchemaIdentifier;\n\t\t\t\tdefault:\n\t\t\t\t\tif (node === null) {\n\t\t\t\t\t\treturn nullSchema.identifier as TreeNodeSchemaIdentifier;\n\t\t\t\t\t}\n\t\t\t\t\tif (isFluidHandle(node)) {\n\t\t\t\t\t\treturn handleSchema.identifier as TreeNodeSchemaIdentifier;\n\t\t\t\t\t}\n\t\t\t\t\treturn node.type as TreeNodeSchemaIdentifier;\n\t\t\t}\n\t\t},\n\t\tkeysFromNode: (input: VerboseTree<TCustom>): readonly FieldKey[] => {\n\t\t\tconst node = options.valueConverter(input);\n\t\t\tswitch (typeof node) {\n\t\t\t\tcase \"object\": {\n\t\t\t\t\tif (node === null) {\n\t\t\t\t\t\treturn [];\n\t\t\t\t\t}\n\t\t\t\t\tif (isFluidHandle(node)) {\n\t\t\t\t\t\treturn [];\n\t\t\t\t\t}\n\t\t\t\t\tif (Array.isArray(node.fields)) {\n\t\t\t\t\t\treturn node.fields.length === 0 ? [] : [EmptyKey];\n\t\t\t\t\t}\n\n\t\t\t\t\tconst inputKeys = Object.keys(node.fields);\n\t\t\t\t\tconst converter = options.keyConverter;\n\t\t\t\t\tif (converter === undefined) {\n\t\t\t\t\t\treturn inputKeys as FieldKey[];\n\t\t\t\t\t}\n\t\t\t\t\treturn inputKeys.map((k) => converter.parse(node.type, k));\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\treturn [];\n\t\t\t}\n\t\t},\n\t\tgetFieldFromNode: (\n\t\t\tinput: VerboseTree<TCustom>,\n\t\t\tkey: FieldKey,\n\t\t): readonly VerboseTree<TCustom>[] => {\n\t\t\tconst node = options.valueConverter(input);\n\t\t\t// Object.prototype.hasOwnProperty can return true for strings (ex: with key \"0\"), so we have to filter them out.\n\t\t\t// Rather than just special casing strings, we can handle them with an early return for all primitives.\n\t\t\tif (typeof node !== \"object\") {\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\tif (node === null) {\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\tif (isFluidHandle(node)) {\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\tif (Array.isArray(node.fields)) {\n\t\t\t\treturn key === EmptyKey ? node.fields : [];\n\t\t\t}\n\n\t\t\tconst convertedKey =\n\t\t\t\toptions.keyConverter === undefined ? key : options.keyConverter.encode(node.type, key);\n\n\t\t\tif (Object.prototype.hasOwnProperty.call(node.fields, convertedKey)) {\n\t\t\t\tconst field = node.fields[convertedKey];\n\t\t\t\treturn field === undefined ? [] : [field];\n\t\t\t}\n\n\t\t\treturn [];\n\t\t},\n\t};\n}\n\n/**\n * Used to read a node cursor as a VerboseTree.\n */\nexport function verboseFromCursor<TCustom>(\n\treader: ITreeCursor,\n\trootSchema: ImplicitAllowedTypes,\n\toptions: EncodeOptions<TCustom>,\n): VerboseTree<TCustom> {\n\tconst config: Required<EncodeOptions<TCustom>> = {\n\t\tuseStoredKeys: false,\n\t\t...options,\n\t};\n\n\tconst schemaMap = new Map<string, TreeNodeSchema>();\n\twalkFieldSchema(rootSchema, {\n\t\tnode(schema) {\n\t\t\tschemaMap.set(schema.identifier, schema);\n\t\t},\n\t});\n\n\treturn verboseFromCursorInner(reader, config, schemaMap);\n}\n\nfunction verboseFromCursorInner<TCustom>(\n\treader: ITreeCursor,\n\toptions: Required<EncodeOptions<TCustom>>,\n\tschema: ReadonlyMap<string, TreeNodeSchema>,\n): VerboseTree<TCustom> {\n\tconst type = reader.type;\n\tconst nodeSchema = schema.get(type) ?? fail(\"missing schema for type in cursor\");\n\n\tswitch (type) {\n\t\tcase numberSchema.identifier:\n\t\tcase booleanSchema.identifier:\n\t\tcase nullSchema.identifier:\n\t\tcase stringSchema.identifier:\n\t\t\tassert(reader.value !== undefined, 0xa14 /* out of schema: missing value */);\n\t\t\tassert(!isFluidHandle(reader.value), 0xa15 /* out of schema: unexpected FluidHandle */);\n\t\t\treturn reader.value;\n\t\tcase handleSchema.identifier:\n\t\t\tassert(reader.value !== undefined, 0xa16 /* out of schema: missing value */);\n\t\t\tassert(isFluidHandle(reader.value), 0xa17 /* out of schema: unexpected FluidHandle */);\n\t\t\treturn options.valueConverter(reader.value);\n\t\tdefault: {\n\t\t\tassert(reader.value === undefined, 0xa18 /* out of schema: unexpected value */);\n\t\t\tif (nodeSchema.kind === NodeKind.Array) {\n\t\t\t\tconst fields = inCursorField(reader, EmptyKey, () =>\n\t\t\t\t\tmapCursorField(reader, () => verboseFromCursorInner(reader, options, schema)),\n\t\t\t\t);\n\t\t\t\treturn { type, fields };\n\t\t\t} else {\n\t\t\t\tconst fields: Record<string, VerboseTree<TCustom>> = {};\n\t\t\t\tforEachField(reader, () => {\n\t\t\t\t\tconst children = mapCursorField(reader, () =>\n\t\t\t\t\t\tverboseFromCursorInner(reader, options, schema),\n\t\t\t\t\t);\n\t\t\t\t\tif (children.length === 1) {\n\t\t\t\t\t\tconst storedKey = reader.getFieldKey();\n\t\t\t\t\t\tconst key =\n\t\t\t\t\t\t\tisObjectNodeSchema(nodeSchema) && !options.useStoredKeys\n\t\t\t\t\t\t\t\t? nodeSchema.storedKeyToPropertyKey.get(storedKey) ??\n\t\t\t\t\t\t\t\t\tfail(\"missing property key\")\n\t\t\t\t\t\t\t\t: storedKey;\n\t\t\t\t\t\t// Length is checked above.\n\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\t\t\tfields[key] = children[0]!;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tassert(children.length === 0, 0xa19 /* invalid children number */);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\treturn { type, fields };\n\t\t\t}\n\t\t}\n\t}\n}\n"]}
1
+ {"version":3,"file":"verboseTree.js","sourceRoot":"","sources":["../../../src/simple-tree/api/verboseTree.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AACvE,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAE7D,OAAO,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AAM,EAAE,MAAiC;KACzC,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport { isFluidHandle } from \"@fluidframework/runtime-utils/internal\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\taboveRootPlaceholder,\n\tEmptyKey,\n\tkeyAsDetachedField,\n\ttype FieldKey,\n\ttype ITreeCursor,\n\ttype ITreeCursorSynchronous,\n\ttype TreeNodeSchemaIdentifier,\n} from \"../../core/index.js\";\nimport { brand, fail } from \"../../util/index.js\";\nimport type {\n\tTreeLeafValue,\n\tImplicitFieldSchema,\n\tImplicitAllowedTypes,\n} from \"../schemaTypes.js\";\nimport { NodeKind, type TreeNodeSchema } from \"../core/index.js\";\nimport {\n\tisTreeValue,\n\tstackTreeFieldCursor,\n\tstackTreeNodeCursor,\n\ttype CursorAdapter,\n} from \"../../feature-libraries/index.js\";\nimport {\n\tbooleanSchema,\n\thandleSchema,\n\tnullSchema,\n\tnumberSchema,\n\tstringSchema,\n} from \"../leafNodeSchema.js\";\nimport { isObjectNodeSchema } from \"../objectNodeTypes.js\";\nimport {\n\tcustomFromCursorInner,\n\ttype CustomTreeNode,\n\ttype CustomTreeValue,\n\ttype EncodeOptions,\n} from \"./customTree.js\";\nimport { getUnhydratedContext } from \"../createContext.js\";\n\n/**\n * Verbose encoding of a {@link TreeNode} or {@link TreeLeafValue}.\n * @remarks\n * This is verbose meaning that every {@link TreeNode} is a {@link VerboseTreeNode}.\n * Any IFluidHandle values have been replaced by `THandle`.\n * @privateRemarks\n * This can store all possible simple trees,\n * but it can not store all possible trees representable by our internal representations like FlexTree and JsonableTree.\n */\nexport type VerboseTree<THandle = IFluidHandle> =\n\t| VerboseTreeNode<THandle>\n\t| Exclude<TreeLeafValue, IFluidHandle>\n\t| THandle;\n\n/**\n * Verbose encoding of a {@link TreeNode}.\n * @remarks\n * This is verbose meaning that every {@link TreeNode} has an explicit `type` property, and `fields`.\n * This allowed VerboseTreeNode to be unambiguous regarding which type each node is without relying on symbols or hidden state.\n *\n * Any IFluidHandle values have been replaced by `THandle`. If the `THandle` is JSON compatible, then this type is JSON compatible as well.\n *\n * @privateRemarks\n * This type is only used for data which is copied into and out of the tree.\n * When being copied out, its fine to have the data be mutable since its a copy.\n *\n * When being copied in, we don't need to mutate, so we could use a readonly variant of this type.\n * however the copy in case (createFromVerbose) probably isn't harmed much by just reusing this type as is,\n * since if the caller has immutable data, TypeScript doesn't prevent assigning immutable data to a mutable type anyway.\n * Also relaxing the input methods to take readonly data would be a non-breaking change so it can be done later if desired.\n *\n * This format is simple-tree specialized alternative to {@link JsonableTree}.\n * This format allows for all simple-tree compatible trees to be represented.\n *\n * Unlike `JsonableTree`, leaf nodes are not boxed into node objects, and instead have their schema inferred from the value.\n * Additionally, sequence fields can only occur on a node that has a single sequence field (with the empty key)\n * replicating the behavior of simple-tree ArrayNodes.\n */\nexport interface VerboseTreeNode<THandle = IFluidHandle> {\n\t/**\n\t * The meaning of this node.\n\t * Provides contexts/semantics for this node and its content.\n\t * @remarks\n\t * Typically used to associate a node with metadata (including a schema) and source code (types, behaviors, etc).\n\t * When used with this package's schema system, it will be the {@link TreeNodeSchemaCore.identifier}.\n\t */\n\ttype: string;\n\n\t/**\n\t * Content of this node.\n\t * For array nodes, an array of children.\n\t * For map and object nodes, an object which children under keys.\n\t * @remarks\n\t * For object nodes, the keys could be either the stored keys, or the property keys depending on usage.\n\t */\n\tfields:\n\t\t| VerboseTree<THandle>[]\n\t\t| {\n\t\t\t\t[key: string]: VerboseTree<THandle>;\n\t\t };\n}\n\n/**\n * Options for how to interpret a `VerboseTree<TCustom>` when schema information is available.\n */\nexport interface ParseOptions<TCustom> {\n\t/**\n\t * Fixup custom input formats.\n\t * @remarks\n\t * Main usage is to handle IFluidHandles.\n\t * When targeting JSON compatibility,\n\t * this may be by throwing an error or including a placeholder.\n\t * Since IFluidHandles are special references to FLuid data which is garbage collected when not referenced by the container for long enough,\n\t * any scheme for encoding handles for storage outside the container (or in formats the container does not understand) is unreliable.\n\t */\n\tvalueConverter(data: VerboseTree<TCustom>): TreeLeafValue | VerboseTreeNode<TCustom>;\n\t/**\n\t * If true, interpret the input keys of object nodes as stored keys.\n\t * If false, interpret them as property keys.\n\t * @defaultValue false.\n\t */\n\treadonly useStoredKeys?: boolean;\n}\n\n/**\n * Options for how to interpret a `VerboseTree<TCustom>` without relying on schema.\n */\nexport interface SchemalessParseOptions<TCustom> {\n\t/**\n\t * Fixup custom input formats.\n\t * @remarks\n\t * See note on {@link ParseOptions.valueConverter}.\n\t */\n\tvalueConverter(data: VerboseTree<TCustom>): TreeLeafValue | VerboseTreeNode<TCustom>;\n\t/**\n\t * Converts stored keys into whatever key the tree is using in its encoding.\n\t */\n\tkeyConverter?: {\n\t\tparse(type: string, inputKey: string): FieldKey;\n\t\tencode(type: string, key: FieldKey): string;\n\t};\n}\n\n/**\n * Use info from `schema` to convert `options` to {@link SchemalessParseOptions}.\n */\nexport function applySchemaToParserOptions<TCustom>(\n\tschema: ImplicitFieldSchema,\n\toptions: ParseOptions<TCustom>,\n): SchemalessParseOptions<TCustom> {\n\tconst config: Required<ParseOptions<TCustom>> = {\n\t\tuseStoredKeys: false,\n\t\t...options,\n\t};\n\n\tconst context = getUnhydratedContext(schema);\n\n\treturn {\n\t\tvalueConverter: config.valueConverter,\n\t\tkeyConverter: config.useStoredKeys\n\t\t\t? undefined\n\t\t\t: {\n\t\t\t\t\tencode: (type, key: FieldKey): string => {\n\t\t\t\t\t\t// translate stored key into property key.\n\t\t\t\t\t\tconst simpleNodeSchema = context.schema.get(brand(type)) ?? fail(\"missing schema\");\n\t\t\t\t\t\tif (isObjectNodeSchema(simpleNodeSchema)) {\n\t\t\t\t\t\t\tconst propertyKey = simpleNodeSchema.storedKeyToPropertyKey.get(key);\n\t\t\t\t\t\t\tif (propertyKey !== undefined) {\n\t\t\t\t\t\t\t\treturn propertyKey;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// Looking up an out of schema key.\n\t\t\t\t\t\t\t// This must point to a non-existent field.\n\t\t\t\t\t\t\t// It's possible that the key, if we returned it unmodified, could point to some data\n\t\t\t\t\t\t\t// (for example if looking up a key which is a stored key already when using property keys).\n\t\t\t\t\t\t\t// Thus return an arbitrary key that was selected randomly, so should not exist on non-adversarial data:\n\t\t\t\t\t\t\tconst arbitrary = \"arbitrary unused key: fe71614a-bf3e-43b3-b7b0-4cef39538e90\";\n\t\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\t\t!simpleNodeSchema.storedKeyToPropertyKey.has(brand(arbitrary)),\n\t\t\t\t\t\t\t\t0xa13 /* arbitrarily selected unused key was actually used */,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\treturn arbitrary;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn key;\n\t\t\t\t\t},\n\t\t\t\t\tparse: (type, inputKey): FieldKey => {\n\t\t\t\t\t\tconst simpleNodeSchema = context.schema.get(brand(type)) ?? fail(\"missing schema\");\n\t\t\t\t\t\tif (isObjectNodeSchema(simpleNodeSchema)) {\n\t\t\t\t\t\t\tconst info =\n\t\t\t\t\t\t\t\tsimpleNodeSchema.flexKeyMap.get(inputKey) ?? fail(\"missing field info\");\n\t\t\t\t\t\t\treturn info.storedKey;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn brand(inputKey);\n\t\t\t\t\t},\n\t\t\t\t},\n\t};\n}\n\n/**\n * Used to read a VerboseTree as a node cursor.\n *\n * @returns an {@link ITreeCursorSynchronous} for a single node in nodes mode.\n */\nexport function cursorFromVerbose<TCustom>(\n\tdata: VerboseTree<TCustom>,\n\toptions: SchemalessParseOptions<TCustom>,\n): ITreeCursorSynchronous {\n\treturn stackTreeNodeCursor(verboseTreeAdapter(options), data);\n}\n\n/**\n * Used to read a VerboseTree[] as a field cursor.\n *\n * @returns an {@link ITreeCursorSynchronous} for a single field in fields mode.\n */\nexport function fieldCursorFromVerbose<TCustom>(\n\tdata: VerboseTree<TCustom>[],\n\toptions: SchemalessParseOptions<TCustom>,\n): ITreeCursorSynchronous {\n\treturn stackTreeFieldCursor(\n\t\tverboseTreeAdapter(options),\n\t\t{ type: aboveRootPlaceholder, fields: data },\n\t\tkeyAsDetachedField(EmptyKey),\n\t);\n}\n\nfunction verboseTreeAdapter<TCustom>(\n\toptions: SchemalessParseOptions<TCustom>,\n): CursorAdapter<VerboseTree<TCustom>> {\n\treturn {\n\t\tvalue: (input: VerboseTree<TCustom>) => {\n\t\t\tconst node = options.valueConverter(input);\n\t\t\treturn isTreeValue(node) ? node : undefined;\n\t\t},\n\t\ttype: (input: VerboseTree<TCustom>) => {\n\t\t\tconst node = options.valueConverter(input);\n\t\t\tswitch (typeof node) {\n\t\t\t\tcase \"number\":\n\t\t\t\t\treturn numberSchema.identifier as TreeNodeSchemaIdentifier;\n\t\t\t\tcase \"string\":\n\t\t\t\t\treturn stringSchema.identifier as TreeNodeSchemaIdentifier;\n\t\t\t\tcase \"boolean\":\n\t\t\t\t\treturn booleanSchema.identifier as TreeNodeSchemaIdentifier;\n\t\t\t\tdefault:\n\t\t\t\t\tif (node === null) {\n\t\t\t\t\t\treturn nullSchema.identifier as TreeNodeSchemaIdentifier;\n\t\t\t\t\t}\n\t\t\t\t\tif (isFluidHandle(node)) {\n\t\t\t\t\t\treturn handleSchema.identifier as TreeNodeSchemaIdentifier;\n\t\t\t\t\t}\n\t\t\t\t\treturn node.type as TreeNodeSchemaIdentifier;\n\t\t\t}\n\t\t},\n\t\tkeysFromNode: (input: VerboseTree<TCustom>): readonly FieldKey[] => {\n\t\t\tconst node = options.valueConverter(input);\n\t\t\tswitch (typeof node) {\n\t\t\t\tcase \"object\": {\n\t\t\t\t\tif (node === null) {\n\t\t\t\t\t\treturn [];\n\t\t\t\t\t}\n\t\t\t\t\tif (isFluidHandle(node)) {\n\t\t\t\t\t\treturn [];\n\t\t\t\t\t}\n\t\t\t\t\tif (Array.isArray(node.fields)) {\n\t\t\t\t\t\treturn node.fields.length === 0 ? [] : [EmptyKey];\n\t\t\t\t\t}\n\n\t\t\t\t\tconst inputKeys = Object.keys(node.fields);\n\t\t\t\t\tconst converter = options.keyConverter;\n\t\t\t\t\tif (converter === undefined) {\n\t\t\t\t\t\treturn inputKeys as FieldKey[];\n\t\t\t\t\t}\n\t\t\t\t\treturn inputKeys.map((k) => converter.parse(node.type, k));\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\treturn [];\n\t\t\t}\n\t\t},\n\t\tgetFieldFromNode: (\n\t\t\tinput: VerboseTree<TCustom>,\n\t\t\tkey: FieldKey,\n\t\t): readonly VerboseTree<TCustom>[] => {\n\t\t\tconst node = options.valueConverter(input);\n\t\t\t// Object.prototype.hasOwnProperty can return true for strings (ex: with key \"0\"), so we have to filter them out.\n\t\t\t// Rather than just special casing strings, we can handle them with an early return for all primitives.\n\t\t\tif (typeof node !== \"object\") {\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\tif (node === null) {\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\tif (isFluidHandle(node)) {\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\tif (Array.isArray(node.fields)) {\n\t\t\t\treturn key === EmptyKey ? node.fields : [];\n\t\t\t}\n\n\t\t\tconst convertedKey =\n\t\t\t\toptions.keyConverter === undefined ? key : options.keyConverter.encode(node.type, key);\n\n\t\t\tif (Object.prototype.hasOwnProperty.call(node.fields, convertedKey)) {\n\t\t\t\tconst field = node.fields[convertedKey];\n\t\t\t\treturn field === undefined ? [] : [field];\n\t\t\t}\n\n\t\t\treturn [];\n\t\t},\n\t};\n}\n\n/**\n * Used to read a node cursor as a VerboseTree.\n */\nexport function verboseFromCursor<TCustom>(\n\treader: ITreeCursor,\n\trootSchema: ImplicitAllowedTypes,\n\toptions: EncodeOptions<TCustom>,\n): VerboseTree<TCustom> {\n\tconst config: Required<EncodeOptions<TCustom>> = {\n\t\tuseStoredKeys: false,\n\t\t...options,\n\t};\n\n\tconst schemaMap = getUnhydratedContext(rootSchema).schema;\n\n\treturn verboseFromCursorInner(reader, config, schemaMap);\n}\n\nfunction verboseFromCursorInner<TCustom>(\n\treader: ITreeCursor,\n\toptions: Required<EncodeOptions<TCustom>>,\n\tschema: ReadonlyMap<string, TreeNodeSchema>,\n): VerboseTree<TCustom> {\n\tconst fields = customFromCursorInner(reader, options, schema, verboseFromCursorInner);\n\tconst nodeSchema = schema.get(reader.type) ?? fail(\"missing schema for type in cursor\");\n\tif (nodeSchema.kind === NodeKind.Leaf) {\n\t\treturn fields as CustomTreeValue<TCustom>;\n\t}\n\n\treturn {\n\t\ttype: reader.type,\n\t\tfields: fields as CustomTreeNode<TCustom>,\n\t};\n}\n"]}
@@ -2,8 +2,19 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { type ImplicitAllowedTypes, type InsertableTreeNodeFromImplicitAllowedTypes, type TreeNodeFromImplicitAllowedTypes } from "./schemaTypes.js";
5
+ import { type ImplicitAllowedTypes, type InsertableTreeNodeFromImplicitAllowedTypes, type TreeLeafValue, type TreeNodeFromImplicitAllowedTypes } from "./schemaTypes.js";
6
6
  import { type WithType, NodeKind, type TreeNode, type TreeNodeSchemaBoth } from "./core/index.js";
7
+ /**
8
+ * A covariant base type for {@link (TreeArrayNode:interface)}.
9
+ *
10
+ * This provides the readonly subset of TreeArrayNode functionality, and is used as the source interface for moves since that needs to be covariant.
11
+ * @privateRemarks
12
+ * Ideally this would just include `TreeNode, WithType<string, NodeKind.Array>` in the extends list but https://github.com/microsoft/TypeScript/issues/16936 prevents that from compiling.
13
+ * As a workaround around for this TypeScript limitation, the conflicting type intersection is wrapped in `Awaited` (which has no effect on the type in this case) which allows it to compile.
14
+ * @system @sealed @public
15
+ */
16
+ export interface ReadonlyArrayNode<out T = TreeNode | TreeLeafValue> extends ReadonlyArray<T>, Awaited<TreeNode & WithType<string, NodeKind.Array>> {
17
+ }
7
18
  /**
8
19
  * A generic array type, used to defined types like {@link (TreeArrayNode:interface)}.
9
20
  *
@@ -12,7 +23,7 @@ import { type WithType, NodeKind, type TreeNode, type TreeNodeSchemaBoth } from
12
23
  *
13
24
  * @system @sealed @public
14
25
  */
15
- export interface TreeArrayNodeBase<out T, in TNew, in TMoveFrom> extends ReadonlyArray<T>, TreeNode {
26
+ export interface TreeArrayNodeBase<out T, in TNew, in TMoveFrom = ReadonlyArrayNode> extends ReadonlyArrayNode<T> {
16
27
  /**
17
28
  * Inserts new item(s) at a specified location.
18
29
  * @param index - The index at which to insert `value`.
@@ -296,7 +307,7 @@ export interface TreeArrayNodeBase<out T, in TNew, in TMoveFrom> extends Readonl
296
307
  *
297
308
  * @sealed @public
298
309
  */
299
- export interface TreeArrayNode<TAllowedTypes extends ImplicitAllowedTypes = ImplicitAllowedTypes> extends TreeArrayNodeBase<TreeNodeFromImplicitAllowedTypes<TAllowedTypes>, InsertableTreeNodeFromImplicitAllowedTypes<TAllowedTypes>, TreeArrayNode> {
310
+ export interface TreeArrayNode<TAllowedTypes extends ImplicitAllowedTypes = ImplicitAllowedTypes> extends TreeArrayNodeBase<TreeNodeFromImplicitAllowedTypes<TAllowedTypes>, InsertableTreeNodeFromImplicitAllowedTypes<TAllowedTypes>> {
300
311
  }
301
312
  /**
302
313
  * A {@link TreeNode} which implements 'readonly T[]' and the array mutation APIs.
@@ -1 +1 @@
1
- {"version":3,"file":"arrayNode.d.ts","sourceRoot":"","sources":["../../src/simple-tree/arrayNode.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAcH,OAAO,EAEN,KAAK,oBAAoB,EACzB,KAAK,0CAA0C,EAC/C,KAAK,gCAAgC,EACrC,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACN,KAAK,QAAQ,EAGb,QAAQ,EACR,KAAK,QAAQ,EAMb,KAAK,kBAAkB,EAEvB,MAAM,iBAAiB,CAAC;AAWzB;;;;;;;GAO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GAGG;AACH,eAAO,MAAM,aAAa;IACzB;;;;;;;;;OASG;kCACkB,SAAS,CAAC,CAAC;CACvB,CAAC;AAQX;;;;GAIG;AACH,qBAAa,wBAAwB,CAAC,CAAC,CAAE,YAAW,QAAQ,CAAC,CAAC,CAAC;IAK1C,OAAO,CAAC,QAAQ,CAAC,OAAO;IAA5C,OAAO;IAEP;;OAEG;IACI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC;CAGvC;AAsND;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAqBtF;AAoYD;;;;GAIG;AAEH,wBAAgB,WAAW,CAC1B,KAAK,SAAS,MAAM,EACpB,KAAK,CAAC,CAAC,SAAS,oBAAoB,EACpC,KAAK,CAAC,uBAAuB,SAAS,OAAO,EAE7C,UAAU,EAAE,KAAK,EACjB,IAAI,EAAE,CAAC,EACP,uBAAuB,EAAE,uBAAuB,EAChD,YAAY,EAAE,OAAO,+LA6GrB"}
@@ -13,11 +13,10 @@ import { UsageError } from "@fluidframework/telemetry-utils/internal";
13
13
  import { EmptyKey } from "../core/index.js";
14
14
  import { getSchemaAndPolicy, isFlexTreeNode, } from "../feature-libraries/index.js";
15
15
  import { prepareContentForHydration } from "./proxies.js";
16
- import { getOrCreateInnerNode } from "./proxyBinding.js";
17
16
  import { normalizeAllowedTypes, } from "./schemaTypes.js";
18
17
  import {
19
18
  // eslint-disable-next-line import/no-deprecated
20
- typeNameSymbol, NodeKind, typeSchemaSymbol, getOrCreateNodeFromInnerNode, getSimpleNodeSchemaFromInnerNode, } from "./core/index.js";
19
+ typeNameSymbol, NodeKind, typeSchemaSymbol, getOrCreateNodeFromInnerNode, getSimpleNodeSchemaFromInnerNode, getOrCreateInnerNode, } from "./core/index.js";
21
20
  import { mapTreeFromNodeData } from "./toMapTree.js";
22
21
  import { fail } from "../util/index.js";
23
22
  import { getKernel, UnhydratedFlexTreeNode, UnhydratedTreeSequenceField, } from "./core/index.js";