@fluidframework/tree 2.1.0 → 2.3.0-288113

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 (1464) hide show
  1. package/.mocharc.customBenchmarks.cjs +33 -0
  2. package/CHANGELOG.md +297 -0
  3. package/README.md +34 -4
  4. package/api-extractor.json +17 -0
  5. package/api-report/tree.alpha.api.md +158 -28
  6. package/api-report/tree.beta.api.md +59 -28
  7. package/api-report/tree.public.api.md +59 -28
  8. package/dist/beta.d.ts +4 -1
  9. package/dist/codec/discriminatedUnions.d.ts +11 -5
  10. package/dist/codec/discriminatedUnions.d.ts.map +1 -1
  11. package/dist/codec/discriminatedUnions.js.map +1 -1
  12. package/dist/codec/index.d.ts +1 -1
  13. package/dist/codec/index.d.ts.map +1 -1
  14. package/dist/codec/index.js.map +1 -1
  15. package/dist/core/forest/editableForest.d.ts +1 -5
  16. package/dist/core/forest/editableForest.d.ts.map +1 -1
  17. package/dist/core/forest/editableForest.js.map +1 -1
  18. package/dist/core/forest/forest.d.ts +0 -6
  19. package/dist/core/forest/forest.d.ts.map +1 -1
  20. package/dist/core/forest/forest.js +0 -2
  21. package/dist/core/forest/forest.js.map +1 -1
  22. package/dist/core/index.d.ts +2 -2
  23. package/dist/core/index.d.ts.map +1 -1
  24. package/dist/core/index.js +3 -4
  25. package/dist/core/index.js.map +1 -1
  26. package/dist/core/rebase/changeRebaser.d.ts +0 -4
  27. package/dist/core/rebase/changeRebaser.d.ts.map +1 -1
  28. package/dist/core/rebase/changeRebaser.js.map +1 -1
  29. package/dist/core/rebase/index.d.ts +1 -1
  30. package/dist/core/rebase/index.d.ts.map +1 -1
  31. package/dist/core/rebase/index.js +1 -3
  32. package/dist/core/rebase/index.js.map +1 -1
  33. package/dist/core/rebase/types.d.ts +1 -8
  34. package/dist/core/rebase/types.d.ts.map +1 -1
  35. package/dist/core/rebase/types.js +1 -9
  36. package/dist/core/rebase/types.js.map +1 -1
  37. package/dist/core/rebase/utils.d.ts +0 -1
  38. package/dist/core/rebase/utils.d.ts.map +1 -1
  39. package/dist/core/rebase/utils.js +12 -7
  40. package/dist/core/rebase/utils.js.map +1 -1
  41. package/dist/core/schema-stored/multiplicity.d.ts +0 -1
  42. package/dist/core/schema-stored/multiplicity.d.ts.map +1 -1
  43. package/dist/core/schema-stored/multiplicity.js +0 -1
  44. package/dist/core/schema-stored/multiplicity.js.map +1 -1
  45. package/dist/core/schema-stored/schema.d.ts +0 -7
  46. package/dist/core/schema-stored/schema.d.ts.map +1 -1
  47. package/dist/core/schema-stored/schema.js +0 -4
  48. package/dist/core/schema-stored/schema.js.map +1 -1
  49. package/dist/core/schema-stored/storedSchemaRepository.d.ts +0 -3
  50. package/dist/core/schema-stored/storedSchemaRepository.d.ts.map +1 -1
  51. package/dist/core/schema-stored/storedSchemaRepository.js.map +1 -1
  52. package/dist/core/schema-view/view.d.ts +0 -3
  53. package/dist/core/schema-view/view.d.ts.map +1 -1
  54. package/dist/core/schema-view/view.js +0 -1
  55. package/dist/core/schema-view/view.js.map +1 -1
  56. package/dist/core/tree/anchorSet.d.ts +4 -16
  57. package/dist/core/tree/anchorSet.d.ts.map +1 -1
  58. package/dist/core/tree/anchorSet.js +12 -5
  59. package/dist/core/tree/anchorSet.js.map +1 -1
  60. package/dist/core/tree/cursor.d.ts +1 -6
  61. package/dist/core/tree/cursor.d.ts.map +1 -1
  62. package/dist/core/tree/cursor.js +0 -2
  63. package/dist/core/tree/cursor.js.map +1 -1
  64. package/dist/core/tree/delta.d.ts +0 -11
  65. package/dist/core/tree/delta.d.ts.map +1 -1
  66. package/dist/core/tree/delta.js.map +1 -1
  67. package/dist/core/tree/detachedFieldIndexCodec.d.ts.map +1 -1
  68. package/dist/core/tree/detachedFieldIndexCodec.js +3 -2
  69. package/dist/core/tree/detachedFieldIndexCodec.js.map +1 -1
  70. package/dist/core/tree/detachedFieldIndexTypes.d.ts +0 -1
  71. package/dist/core/tree/detachedFieldIndexTypes.d.ts.map +1 -1
  72. package/dist/core/tree/detachedFieldIndexTypes.js.map +1 -1
  73. package/dist/core/tree/index.d.ts +1 -1
  74. package/dist/core/tree/index.d.ts.map +1 -1
  75. package/dist/core/tree/index.js +3 -1
  76. package/dist/core/tree/index.js.map +1 -1
  77. package/dist/core/tree/mapTree.d.ts +20 -4
  78. package/dist/core/tree/mapTree.d.ts.map +1 -1
  79. package/dist/core/tree/mapTree.js +29 -0
  80. package/dist/core/tree/mapTree.js.map +1 -1
  81. package/dist/core/tree/pathTree.d.ts +0 -11
  82. package/dist/core/tree/pathTree.d.ts.map +1 -1
  83. package/dist/core/tree/pathTree.js.map +1 -1
  84. package/dist/core/tree/treeTextFormat.d.ts.map +1 -1
  85. package/dist/core/tree/treeTextFormat.js +3 -2
  86. package/dist/core/tree/treeTextFormat.js.map +1 -1
  87. package/dist/core/tree/types.d.ts +0 -11
  88. package/dist/core/tree/types.d.ts.map +1 -1
  89. package/dist/core/tree/types.js +0 -4
  90. package/dist/core/tree/types.js.map +1 -1
  91. package/dist/core/tree/visitDelta.d.ts +0 -1
  92. package/dist/core/tree/visitDelta.d.ts.map +1 -1
  93. package/dist/core/tree/visitDelta.js +2 -2
  94. package/dist/core/tree/visitDelta.js.map +1 -1
  95. package/dist/core/tree/visitPath.d.ts +0 -2
  96. package/dist/core/tree/visitPath.d.ts.map +1 -1
  97. package/dist/core/tree/visitPath.js.map +1 -1
  98. package/dist/core/tree/visitorUtils.d.ts +0 -1
  99. package/dist/core/tree/visitorUtils.d.ts.map +1 -1
  100. package/dist/core/tree/visitorUtils.js.map +1 -1
  101. package/dist/domains/index.d.ts +1 -1
  102. package/dist/domains/index.d.ts.map +1 -1
  103. package/dist/domains/index.js +2 -1
  104. package/dist/domains/index.js.map +1 -1
  105. package/dist/domains/json/index.d.ts +1 -1
  106. package/dist/domains/json/index.d.ts.map +1 -1
  107. package/dist/domains/json/index.js +2 -1
  108. package/dist/domains/json/index.js.map +1 -1
  109. package/dist/domains/json/jsonCursor.d.ts +36 -2
  110. package/dist/domains/json/jsonCursor.d.ts.map +1 -1
  111. package/dist/domains/json/jsonCursor.js +76 -5
  112. package/dist/domains/json/jsonCursor.js.map +1 -1
  113. package/dist/domains/json/jsonDomainSchema.d.ts +13 -3
  114. package/dist/domains/json/jsonDomainSchema.d.ts.map +1 -1
  115. package/dist/domains/json/jsonDomainSchema.js +12 -4
  116. package/dist/domains/json/jsonDomainSchema.js.map +1 -1
  117. package/dist/domains/leafDomain.d.ts +0 -1
  118. package/dist/domains/leafDomain.d.ts.map +1 -1
  119. package/dist/domains/leafDomain.js +0 -1
  120. package/dist/domains/leafDomain.js.map +1 -1
  121. package/dist/domains/schemaBuilder.d.ts +1 -7
  122. package/dist/domains/schemaBuilder.d.ts.map +1 -1
  123. package/dist/domains/schemaBuilder.js +0 -10
  124. package/dist/domains/schemaBuilder.js.map +1 -1
  125. package/dist/events/events.d.ts +7 -5
  126. package/dist/events/events.d.ts.map +1 -1
  127. package/dist/events/events.js +5 -3
  128. package/dist/events/events.js.map +1 -1
  129. package/dist/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
  130. package/dist/feature-libraries/chunked-forest/basicChunk.js +8 -3
  131. package/dist/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
  132. package/dist/feature-libraries/chunked-forest/chunk.d.ts +1 -1
  133. package/dist/feature-libraries/chunked-forest/chunk.d.ts.map +1 -1
  134. package/dist/feature-libraries/chunked-forest/chunk.js.map +1 -1
  135. package/dist/feature-libraries/chunked-forest/chunkTree.js +3 -3
  136. package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  137. package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  138. package/dist/feature-libraries/chunked-forest/chunkedForest.js +7 -5
  139. package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  140. package/dist/feature-libraries/chunked-forest/codec/chunkCodecUtilities.js +1 -1
  141. package/dist/feature-libraries/chunked-forest/codec/chunkCodecUtilities.js.map +1 -1
  142. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  143. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js +8 -5
  144. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  145. package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
  146. package/dist/feature-libraries/chunked-forest/uniformChunk.js +5 -3
  147. package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  148. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts +12 -24
  149. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  150. package/dist/feature-libraries/default-schema/defaultEditBuilder.js +9 -19
  151. package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  152. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts +0 -6
  153. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  154. package/dist/feature-libraries/default-schema/defaultFieldKinds.js +11 -1
  155. package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  156. package/dist/feature-libraries/default-schema/defaultSchema.d.ts +0 -1
  157. package/dist/feature-libraries/default-schema/defaultSchema.d.ts.map +1 -1
  158. package/dist/feature-libraries/default-schema/defaultSchema.js +0 -1
  159. package/dist/feature-libraries/default-schema/defaultSchema.js.map +1 -1
  160. package/dist/feature-libraries/default-schema/index.d.ts +1 -1
  161. package/dist/feature-libraries/default-schema/index.d.ts.map +1 -1
  162. package/dist/feature-libraries/default-schema/index.js +2 -1
  163. package/dist/feature-libraries/default-schema/index.js.map +1 -1
  164. package/dist/feature-libraries/default-schema/schemaChecker.d.ts +6 -0
  165. package/dist/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
  166. package/dist/feature-libraries/default-schema/schemaChecker.js +6 -0
  167. package/dist/feature-libraries/default-schema/schemaChecker.js.map +1 -1
  168. package/dist/feature-libraries/editableTreeBinder.d.ts +0 -67
  169. package/dist/feature-libraries/editableTreeBinder.d.ts.map +1 -1
  170. package/dist/feature-libraries/editableTreeBinder.js +5 -24
  171. package/dist/feature-libraries/editableTreeBinder.js.map +1 -1
  172. package/dist/feature-libraries/fieldGenerator.d.ts +0 -3
  173. package/dist/feature-libraries/fieldGenerator.d.ts.map +1 -1
  174. package/dist/feature-libraries/fieldGenerator.js +0 -1
  175. package/dist/feature-libraries/fieldGenerator.js.map +1 -1
  176. package/dist/feature-libraries/flex-map-tree/index.d.ts +1 -1
  177. package/dist/feature-libraries/flex-map-tree/index.d.ts.map +1 -1
  178. package/dist/feature-libraries/flex-map-tree/index.js +2 -2
  179. package/dist/feature-libraries/flex-map-tree/index.js.map +1 -1
  180. package/dist/feature-libraries/flex-map-tree/mapTreeNode.d.ts +57 -51
  181. package/dist/feature-libraries/flex-map-tree/mapTreeNode.d.ts.map +1 -1
  182. package/dist/feature-libraries/flex-map-tree/mapTreeNode.js +171 -180
  183. package/dist/feature-libraries/flex-map-tree/mapTreeNode.js.map +1 -1
  184. package/dist/feature-libraries/flex-tree/context.d.ts +0 -1
  185. package/dist/feature-libraries/flex-tree/context.d.ts.map +1 -1
  186. package/dist/feature-libraries/flex-tree/context.js.map +1 -1
  187. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts +17 -373
  188. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  189. package/dist/feature-libraries/flex-tree/flexTreeTypes.js +1 -34
  190. package/dist/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  191. package/dist/feature-libraries/flex-tree/index.d.ts +2 -2
  192. package/dist/feature-libraries/flex-tree/index.d.ts.map +1 -1
  193. package/dist/feature-libraries/flex-tree/index.js +1 -3
  194. package/dist/feature-libraries/flex-tree/index.js.map +1 -1
  195. package/dist/feature-libraries/flex-tree/lazyField.d.ts +9 -27
  196. package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  197. package/dist/feature-libraries/flex-tree/lazyField.js +26 -102
  198. package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
  199. package/dist/feature-libraries/flex-tree/lazyNode.d.ts +3 -18
  200. package/dist/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  201. package/dist/feature-libraries/flex-tree/lazyNode.js +2 -126
  202. package/dist/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  203. package/dist/feature-libraries/flex-tree/treeEvents.d.ts +0 -2
  204. package/dist/feature-libraries/flex-tree/treeEvents.d.ts.map +1 -1
  205. package/dist/feature-libraries/flex-tree/treeEvents.js.map +1 -1
  206. package/dist/feature-libraries/flex-tree/utilities.d.ts +2 -1
  207. package/dist/feature-libraries/flex-tree/utilities.d.ts.map +1 -1
  208. package/dist/feature-libraries/flex-tree/utilities.js +4 -0
  209. package/dist/feature-libraries/flex-tree/utilities.js.map +1 -1
  210. package/dist/feature-libraries/forest-summary/codec.js +2 -2
  211. package/dist/feature-libraries/forest-summary/codec.js.map +1 -1
  212. package/dist/feature-libraries/index.d.ts +6 -8
  213. package/dist/feature-libraries/index.d.ts.map +1 -1
  214. package/dist/feature-libraries/index.js +7 -20
  215. package/dist/feature-libraries/index.js.map +1 -1
  216. package/dist/feature-libraries/mapTreeCursor.d.ts +6 -2
  217. package/dist/feature-libraries/mapTreeCursor.d.ts.map +1 -1
  218. package/dist/feature-libraries/mapTreeCursor.js +9 -1
  219. package/dist/feature-libraries/mapTreeCursor.js.map +1 -1
  220. package/dist/feature-libraries/memoizedIdRangeAllocator.d.ts +0 -4
  221. package/dist/feature-libraries/memoizedIdRangeAllocator.d.ts.map +1 -1
  222. package/dist/feature-libraries/memoizedIdRangeAllocator.js +0 -1
  223. package/dist/feature-libraries/memoizedIdRangeAllocator.js.map +1 -1
  224. package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts +0 -2
  225. package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
  226. package/dist/feature-libraries/modular-schema/crossFieldQueries.js +0 -1
  227. package/dist/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
  228. package/dist/feature-libraries/modular-schema/discrepancies.d.ts +18 -0
  229. package/dist/feature-libraries/modular-schema/discrepancies.d.ts.map +1 -1
  230. package/dist/feature-libraries/modular-schema/discrepancies.js +105 -2
  231. package/dist/feature-libraries/modular-schema/discrepancies.js.map +1 -1
  232. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts +0 -8
  233. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  234. package/dist/feature-libraries/modular-schema/fieldChangeHandler.js +0 -1
  235. package/dist/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  236. package/dist/feature-libraries/modular-schema/fieldKind.d.ts +1 -3
  237. package/dist/feature-libraries/modular-schema/fieldKind.d.ts.map +1 -1
  238. package/dist/feature-libraries/modular-schema/fieldKind.js +1 -2
  239. package/dist/feature-libraries/modular-schema/fieldKind.js.map +1 -1
  240. package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts +1 -2
  241. package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  242. package/dist/feature-libraries/modular-schema/genericFieldKind.js +57 -85
  243. package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  244. package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.d.ts +1 -1
  245. package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.d.ts.map +1 -1
  246. package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.js +5 -8
  247. package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.js.map +1 -1
  248. package/dist/feature-libraries/modular-schema/genericFieldKindTypes.d.ts +3 -14
  249. package/dist/feature-libraries/modular-schema/genericFieldKindTypes.d.ts.map +1 -1
  250. package/dist/feature-libraries/modular-schema/genericFieldKindTypes.js +6 -0
  251. package/dist/feature-libraries/modular-schema/genericFieldKindTypes.js.map +1 -1
  252. package/dist/feature-libraries/modular-schema/index.d.ts +2 -2
  253. package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
  254. package/dist/feature-libraries/modular-schema/index.js +2 -1
  255. package/dist/feature-libraries/modular-schema/index.js.map +1 -1
  256. package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  257. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js +39 -22
  258. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  259. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +9 -8
  260. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  261. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +192 -228
  262. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  263. package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts +8 -14
  264. package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
  265. package/dist/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
  266. package/dist/feature-libraries/node-key/nodeKey.d.ts +0 -4
  267. package/dist/feature-libraries/node-key/nodeKey.d.ts.map +1 -1
  268. package/dist/feature-libraries/node-key/nodeKey.js +0 -2
  269. package/dist/feature-libraries/node-key/nodeKey.js.map +1 -1
  270. package/dist/feature-libraries/node-key/nodeKeyManager.d.ts +0 -1
  271. package/dist/feature-libraries/node-key/nodeKeyManager.d.ts.map +1 -1
  272. package/dist/feature-libraries/node-key/nodeKeyManager.js.map +1 -1
  273. package/dist/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  274. package/dist/feature-libraries/object-forest/objectForest.js +1 -10
  275. package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
  276. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts +6 -6
  277. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts.map +1 -1
  278. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts +7 -7
  279. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts.map +1 -1
  280. package/dist/feature-libraries/schemaBuilderBase.d.ts +2 -28
  281. package/dist/feature-libraries/schemaBuilderBase.d.ts.map +1 -1
  282. package/dist/feature-libraries/schemaBuilderBase.js +1 -27
  283. package/dist/feature-libraries/schemaBuilderBase.js.map +1 -1
  284. package/dist/feature-libraries/sequence-field/compose.d.ts.map +1 -1
  285. package/dist/feature-libraries/sequence-field/compose.js +24 -21
  286. package/dist/feature-libraries/sequence-field/compose.js.map +1 -1
  287. package/dist/feature-libraries/sequence-field/formatV2.d.ts +3 -3
  288. package/dist/feature-libraries/sequence-field/formatV2.d.ts.map +1 -1
  289. package/dist/feature-libraries/sequence-field/formatV2.js +7 -6
  290. package/dist/feature-libraries/sequence-field/formatV2.js.map +1 -1
  291. package/dist/feature-libraries/sequence-field/formatV3.d.ts +195 -0
  292. package/dist/feature-libraries/sequence-field/formatV3.d.ts.map +1 -0
  293. package/dist/feature-libraries/sequence-field/formatV3.js +23 -0
  294. package/dist/feature-libraries/sequence-field/formatV3.js.map +1 -0
  295. package/dist/feature-libraries/sequence-field/helperTypes.d.ts +11 -0
  296. package/dist/feature-libraries/sequence-field/helperTypes.d.ts.map +1 -1
  297. package/dist/feature-libraries/sequence-field/helperTypes.js.map +1 -1
  298. package/dist/feature-libraries/sequence-field/index.d.ts +1 -1
  299. package/dist/feature-libraries/sequence-field/index.d.ts.map +1 -1
  300. package/dist/feature-libraries/sequence-field/index.js.map +1 -1
  301. package/dist/feature-libraries/sequence-field/invert.d.ts.map +1 -1
  302. package/dist/feature-libraries/sequence-field/invert.js +21 -13
  303. package/dist/feature-libraries/sequence-field/invert.js.map +1 -1
  304. package/dist/feature-libraries/sequence-field/markQueue.js +1 -1
  305. package/dist/feature-libraries/sequence-field/markQueue.js.map +1 -1
  306. package/dist/feature-libraries/sequence-field/moveEffectTable.d.ts +2 -2
  307. package/dist/feature-libraries/sequence-field/moveEffectTable.d.ts.map +1 -1
  308. package/dist/feature-libraries/sequence-field/moveEffectTable.js.map +1 -1
  309. package/dist/feature-libraries/sequence-field/rebase.d.ts.map +1 -1
  310. package/dist/feature-libraries/sequence-field/rebase.js +24 -6
  311. package/dist/feature-libraries/sequence-field/rebase.js.map +1 -1
  312. package/dist/feature-libraries/sequence-field/replaceRevisions.d.ts.map +1 -1
  313. package/dist/feature-libraries/sequence-field/replaceRevisions.js +16 -3
  314. package/dist/feature-libraries/sequence-field/replaceRevisions.js.map +1 -1
  315. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts.map +1 -1
  316. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js +38 -4
  317. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +1 -1
  318. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts +4 -1
  319. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
  320. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js +54 -9
  321. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
  322. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts +11 -0
  323. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts.map +1 -0
  324. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.js +85 -0
  325. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -0
  326. package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts.map +1 -1
  327. package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.js +2 -0
  328. package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.js.map +1 -1
  329. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts.map +1 -1
  330. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js +4 -1
  331. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
  332. package/dist/feature-libraries/sequence-field/types.d.ts +23 -4
  333. package/dist/feature-libraries/sequence-field/types.d.ts.map +1 -1
  334. package/dist/feature-libraries/sequence-field/types.js.map +1 -1
  335. package/dist/feature-libraries/sequence-field/utils.d.ts +5 -4
  336. package/dist/feature-libraries/sequence-field/utils.d.ts.map +1 -1
  337. package/dist/feature-libraries/sequence-field/utils.js +70 -42
  338. package/dist/feature-libraries/sequence-field/utils.js.map +1 -1
  339. package/dist/feature-libraries/storedToViewSchema.d.ts +0 -1
  340. package/dist/feature-libraries/storedToViewSchema.d.ts.map +1 -1
  341. package/dist/feature-libraries/storedToViewSchema.js +0 -1
  342. package/dist/feature-libraries/storedToViewSchema.js.map +1 -1
  343. package/dist/feature-libraries/treeCursorUtils.d.ts +0 -6
  344. package/dist/feature-libraries/treeCursorUtils.d.ts.map +1 -1
  345. package/dist/feature-libraries/treeCursorUtils.js +8 -6
  346. package/dist/feature-libraries/treeCursorUtils.js.map +1 -1
  347. package/dist/feature-libraries/treeTextCursor.d.ts +0 -2
  348. package/dist/feature-libraries/treeTextCursor.d.ts.map +1 -1
  349. package/dist/feature-libraries/treeTextCursor.js +0 -2
  350. package/dist/feature-libraries/treeTextCursor.js.map +1 -1
  351. package/dist/feature-libraries/typed-schema/flexList.d.ts +0 -3
  352. package/dist/feature-libraries/typed-schema/flexList.d.ts.map +1 -1
  353. package/dist/feature-libraries/typed-schema/flexList.js.map +1 -1
  354. package/dist/feature-libraries/typed-schema/index.d.ts +1 -1
  355. package/dist/feature-libraries/typed-schema/index.d.ts.map +1 -1
  356. package/dist/feature-libraries/typed-schema/index.js +1 -3
  357. package/dist/feature-libraries/typed-schema/index.js.map +1 -1
  358. package/dist/feature-libraries/typed-schema/schemaCollection.d.ts.map +1 -1
  359. package/dist/feature-libraries/typed-schema/schemaCollection.js +0 -4
  360. package/dist/feature-libraries/typed-schema/schemaCollection.js.map +1 -1
  361. package/dist/feature-libraries/typed-schema/typedTreeSchema.d.ts +2 -41
  362. package/dist/feature-libraries/typed-schema/typedTreeSchema.d.ts.map +1 -1
  363. package/dist/feature-libraries/typed-schema/typedTreeSchema.js +1 -40
  364. package/dist/feature-libraries/typed-schema/typedTreeSchema.js.map +1 -1
  365. package/dist/feature-libraries/typed-schema/view.d.ts +0 -1
  366. package/dist/feature-libraries/typed-schema/view.d.ts.map +1 -1
  367. package/dist/feature-libraries/typed-schema/view.js.map +1 -1
  368. package/dist/index.d.ts +8 -9
  369. package/dist/index.d.ts.map +1 -1
  370. package/dist/index.js +36 -90
  371. package/dist/index.js.map +1 -1
  372. package/dist/internalTypes.d.ts +1 -1
  373. package/dist/internalTypes.d.ts.map +1 -1
  374. package/dist/internalTypes.js.map +1 -1
  375. package/dist/packageVersion.d.ts +1 -1
  376. package/dist/packageVersion.d.ts.map +1 -1
  377. package/dist/packageVersion.js +1 -1
  378. package/dist/packageVersion.js.map +1 -1
  379. package/dist/public.d.ts +4 -1
  380. package/dist/shared-tree/schematizeTree.d.ts +2 -11
  381. package/dist/shared-tree/schematizeTree.d.ts.map +1 -1
  382. package/dist/shared-tree/schematizeTree.js +13 -2
  383. package/dist/shared-tree/schematizeTree.js.map +1 -1
  384. package/dist/shared-tree/schematizingTreeView.d.ts +4 -4
  385. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  386. package/dist/shared-tree/schematizingTreeView.js +2 -2
  387. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  388. package/dist/shared-tree/sharedTree.d.ts +4 -17
  389. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  390. package/dist/shared-tree/sharedTree.js +4 -8
  391. package/dist/shared-tree/sharedTree.js.map +1 -1
  392. package/dist/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  393. package/dist/shared-tree/sharedTreeChangeCodecs.js +4 -0
  394. package/dist/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  395. package/dist/shared-tree/sharedTreeChangeFamily.js +2 -2
  396. package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  397. package/dist/shared-tree/sharedTreeEditBuilder.d.ts +0 -2
  398. package/dist/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
  399. package/dist/shared-tree/sharedTreeEditBuilder.js.map +1 -1
  400. package/dist/shared-tree/treeApi.js +2 -2
  401. package/dist/shared-tree/treeApi.js.map +1 -1
  402. package/dist/shared-tree/treeCheckout.d.ts +0 -5
  403. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  404. package/dist/shared-tree/treeCheckout.js +5 -3
  405. package/dist/shared-tree/treeCheckout.js.map +1 -1
  406. package/dist/shared-tree/treeView.d.ts +3 -6
  407. package/dist/shared-tree/treeView.d.ts.map +1 -1
  408. package/dist/shared-tree/treeView.js.map +1 -1
  409. package/dist/shared-tree-core/branch.d.ts.map +1 -1
  410. package/dist/shared-tree-core/branch.js +11 -6
  411. package/dist/shared-tree-core/branch.js.map +1 -1
  412. package/dist/shared-tree-core/defaultResubmitMachine.js +3 -3
  413. package/dist/shared-tree-core/defaultResubmitMachine.js.map +1 -1
  414. package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  415. package/dist/shared-tree-core/editManagerCodecs.js +1 -0
  416. package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
  417. package/dist/shared-tree-core/editManagerFormat.d.ts +2 -2
  418. package/dist/shared-tree-core/editManagerFormat.d.ts.map +1 -1
  419. package/dist/shared-tree-core/editManagerFormat.js +6 -1
  420. package/dist/shared-tree-core/editManagerFormat.js.map +1 -1
  421. package/dist/shared-tree-core/messageCodecs.d.ts.map +1 -1
  422. package/dist/shared-tree-core/messageCodecs.js +1 -0
  423. package/dist/shared-tree-core/messageCodecs.js.map +1 -1
  424. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  425. package/dist/shared-tree-core/sharedTreeCore.js +3 -1
  426. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  427. package/dist/simple-tree/api/create.d.ts +54 -0
  428. package/dist/simple-tree/api/create.d.ts.map +1 -0
  429. package/dist/simple-tree/api/create.js +99 -0
  430. package/dist/simple-tree/api/create.js.map +1 -0
  431. package/dist/simple-tree/api/index.d.ts +12 -0
  432. package/dist/simple-tree/api/index.d.ts.map +1 -0
  433. package/dist/simple-tree/api/index.js +28 -0
  434. package/dist/simple-tree/api/index.js.map +1 -0
  435. package/{lib/simple-tree → dist/simple-tree/api}/schemaCreationUtilities.d.ts +7 -4
  436. package/dist/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -0
  437. package/dist/simple-tree/{schemaCreationUtilities.js → api/schemaCreationUtilities.js} +1 -1
  438. package/dist/simple-tree/api/schemaCreationUtilities.js.map +1 -0
  439. package/dist/simple-tree/{schemaFactory.d.ts → api/schemaFactory.d.ts} +15 -14
  440. package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -0
  441. package/dist/simple-tree/{schemaFactory.js → api/schemaFactory.js} +10 -9
  442. package/dist/simple-tree/api/schemaFactory.js.map +1 -0
  443. package/{lib/simple-tree → dist/simple-tree/api}/schemaFactoryRecursive.d.ts +40 -7
  444. package/dist/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -0
  445. package/dist/simple-tree/{schemaFactoryRecursive.js → api/schemaFactoryRecursive.js} +1 -1
  446. package/dist/simple-tree/api/schemaFactoryRecursive.js.map +1 -0
  447. package/dist/simple-tree/api/testRecursiveDomain.d.ts +62 -0
  448. package/dist/simple-tree/api/testRecursiveDomain.d.ts.map +1 -0
  449. package/dist/simple-tree/api/testRecursiveDomain.js.map +1 -0
  450. package/{lib/simple-tree → dist/simple-tree/api}/tree.d.ts +111 -20
  451. package/dist/simple-tree/api/tree.d.ts.map +1 -0
  452. package/dist/simple-tree/api/tree.js +173 -0
  453. package/dist/simple-tree/api/tree.js.map +1 -0
  454. package/dist/simple-tree/{treeNodeApi.d.ts → api/treeNodeApi.d.ts} +7 -6
  455. package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -0
  456. package/dist/simple-tree/{treeNodeApi.js → api/treeNodeApi.js} +57 -21
  457. package/dist/simple-tree/api/treeNodeApi.js.map +1 -0
  458. package/dist/simple-tree/api/verboseTree.d.ts +136 -0
  459. package/dist/simple-tree/api/verboseTree.d.ts.map +1 -0
  460. package/dist/simple-tree/api/verboseTree.js +220 -0
  461. package/dist/simple-tree/api/verboseTree.js.map +1 -0
  462. package/dist/simple-tree/arrayNode.d.ts +3 -3
  463. package/dist/simple-tree/arrayNode.d.ts.map +1 -1
  464. package/dist/simple-tree/arrayNode.js +72 -85
  465. package/dist/simple-tree/arrayNode.js.map +1 -1
  466. package/dist/simple-tree/core/index.d.ts +10 -0
  467. package/dist/simple-tree/core/index.d.ts.map +1 -0
  468. package/dist/simple-tree/core/index.js +27 -0
  469. package/dist/simple-tree/core/index.js.map +1 -0
  470. package/{lib/simple-tree → dist/simple-tree/core}/schemaCaching.d.ts +2 -9
  471. package/dist/simple-tree/core/schemaCaching.d.ts.map +1 -0
  472. package/dist/simple-tree/{schemaCaching.js → core/schemaCaching.js} +2 -23
  473. package/dist/simple-tree/core/schemaCaching.js.map +1 -0
  474. package/dist/simple-tree/core/treeNodeKernel.d.ts +70 -0
  475. package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -0
  476. package/dist/simple-tree/core/treeNodeKernel.js +164 -0
  477. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -0
  478. package/dist/simple-tree/core/treeNodeSchema.d.ts +149 -0
  479. package/dist/simple-tree/core/treeNodeSchema.d.ts.map +1 -0
  480. package/dist/simple-tree/core/treeNodeSchema.js +35 -0
  481. package/dist/simple-tree/core/treeNodeSchema.js.map +1 -0
  482. package/{lib/simple-tree → dist/simple-tree/core}/types.d.ts +50 -79
  483. package/dist/simple-tree/core/types.d.ts.map +1 -0
  484. package/dist/simple-tree/core/types.js +117 -0
  485. package/dist/simple-tree/core/types.js.map +1 -0
  486. package/dist/simple-tree/core/withType.d.ts +82 -0
  487. package/dist/simple-tree/core/withType.d.ts.map +1 -0
  488. package/dist/simple-tree/core/withType.js +39 -0
  489. package/dist/simple-tree/core/withType.js.map +1 -0
  490. package/dist/simple-tree/getJsonSchema.d.ts +55 -0
  491. package/dist/simple-tree/getJsonSchema.d.ts.map +1 -0
  492. package/dist/simple-tree/getJsonSchema.js +69 -0
  493. package/dist/simple-tree/getJsonSchema.js.map +1 -0
  494. package/dist/simple-tree/getSimpleFieldSchema.d.ts +14 -0
  495. package/dist/simple-tree/getSimpleFieldSchema.d.ts.map +1 -0
  496. package/dist/simple-tree/getSimpleFieldSchema.js +29 -0
  497. package/dist/simple-tree/getSimpleFieldSchema.js.map +1 -0
  498. package/dist/simple-tree/getSimpleSchema.d.ts +58 -0
  499. package/dist/simple-tree/getSimpleSchema.d.ts.map +1 -0
  500. package/dist/simple-tree/getSimpleSchema.js +68 -0
  501. package/dist/simple-tree/getSimpleSchema.js.map +1 -0
  502. package/dist/simple-tree/index.d.ts +12 -13
  503. package/dist/simple-tree/index.d.ts.map +1 -1
  504. package/dist/simple-tree/index.js +26 -23
  505. package/dist/simple-tree/index.js.map +1 -1
  506. package/dist/simple-tree/jsonSchema.d.ts +206 -0
  507. package/dist/simple-tree/jsonSchema.d.ts.map +1 -0
  508. package/dist/{feature-libraries/schema-aware/index.js → simple-tree/jsonSchema.js} +1 -1
  509. package/dist/simple-tree/jsonSchema.js.map +1 -0
  510. package/dist/simple-tree/leafNodeSchema.d.ts +1 -1
  511. package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
  512. package/dist/simple-tree/leafNodeSchema.js +3 -4
  513. package/dist/simple-tree/leafNodeSchema.js.map +1 -1
  514. package/dist/simple-tree/mapNode.d.ts +9 -3
  515. package/dist/simple-tree/mapNode.d.ts.map +1 -1
  516. package/dist/simple-tree/mapNode.js +33 -35
  517. package/dist/simple-tree/mapNode.js.map +1 -1
  518. package/dist/simple-tree/objectNode.d.ts +18 -16
  519. package/dist/simple-tree/objectNode.d.ts.map +1 -1
  520. package/dist/simple-tree/objectNode.js +43 -44
  521. package/dist/simple-tree/objectNode.js.map +1 -1
  522. package/dist/simple-tree/objectNodeTypes.d.ts +38 -0
  523. package/dist/simple-tree/objectNodeTypes.d.ts.map +1 -0
  524. package/dist/simple-tree/objectNodeTypes.js +19 -0
  525. package/dist/simple-tree/objectNodeTypes.js.map +1 -0
  526. package/dist/simple-tree/proxies.d.ts +6 -25
  527. package/dist/simple-tree/proxies.d.ts.map +1 -1
  528. package/dist/simple-tree/proxies.js +50 -63
  529. package/dist/simple-tree/proxies.js.map +1 -1
  530. package/dist/simple-tree/proxyBinding.d.ts +45 -22
  531. package/dist/simple-tree/proxyBinding.d.ts.map +1 -1
  532. package/dist/simple-tree/proxyBinding.js +94 -59
  533. package/dist/simple-tree/proxyBinding.js.map +1 -1
  534. package/dist/simple-tree/schemaTypes.d.ts +10 -159
  535. package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
  536. package/dist/simple-tree/schemaTypes.js +11 -42
  537. package/dist/simple-tree/schemaTypes.js.map +1 -1
  538. package/dist/simple-tree/simpleSchema.d.ts +124 -0
  539. package/dist/simple-tree/simpleSchema.d.ts.map +1 -0
  540. package/dist/{feature-libraries/schema-aware/schemaAware.js → simple-tree/simpleSchema.js} +1 -1
  541. package/dist/simple-tree/simpleSchema.js.map +1 -0
  542. package/dist/simple-tree/simpleSchemaToJsonSchema.d.ts +12 -0
  543. package/dist/simple-tree/simpleSchemaToJsonSchema.d.ts.map +1 -0
  544. package/dist/simple-tree/simpleSchemaToJsonSchema.js +146 -0
  545. package/dist/simple-tree/simpleSchemaToJsonSchema.js.map +1 -0
  546. package/dist/simple-tree/toFlexSchema.d.ts +4 -12
  547. package/dist/simple-tree/toFlexSchema.d.ts.map +1 -1
  548. package/dist/simple-tree/toFlexSchema.js +42 -52
  549. package/dist/simple-tree/toFlexSchema.js.map +1 -1
  550. package/dist/simple-tree/toMapTree.d.ts +39 -39
  551. package/dist/simple-tree/toMapTree.d.ts.map +1 -1
  552. package/dist/simple-tree/toMapTree.js +227 -171
  553. package/dist/simple-tree/toMapTree.js.map +1 -1
  554. package/dist/simple-tree/treeNodeValid.d.ts +74 -0
  555. package/dist/simple-tree/treeNodeValid.d.ts.map +1 -0
  556. package/dist/simple-tree/{types.js → treeNodeValid.js} +18 -111
  557. package/dist/simple-tree/treeNodeValid.js.map +1 -0
  558. package/dist/simple-tree/typesUnsafe.d.ts +35 -4
  559. package/dist/simple-tree/typesUnsafe.d.ts.map +1 -1
  560. package/dist/simple-tree/typesUnsafe.js.map +1 -1
  561. package/dist/simple-tree/viewSchemaToSimpleSchema.d.ts +11 -0
  562. package/dist/simple-tree/viewSchemaToSimpleSchema.d.ts.map +1 -0
  563. package/dist/simple-tree/viewSchemaToSimpleSchema.js +171 -0
  564. package/dist/simple-tree/viewSchemaToSimpleSchema.js.map +1 -0
  565. package/dist/util/brand.d.ts +0 -3
  566. package/dist/util/brand.d.ts.map +1 -1
  567. package/dist/util/brand.js +1 -2
  568. package/dist/util/brand.js.map +1 -1
  569. package/dist/util/brandedMap.d.ts +0 -5
  570. package/dist/util/brandedMap.d.ts.map +1 -1
  571. package/dist/util/brandedMap.js +0 -1
  572. package/dist/util/brandedMap.js.map +1 -1
  573. package/dist/util/idAllocator.d.ts +0 -2
  574. package/dist/util/idAllocator.d.ts.map +1 -1
  575. package/dist/util/idAllocator.js +0 -1
  576. package/dist/util/idAllocator.js.map +1 -1
  577. package/dist/util/index.d.ts +2 -2
  578. package/dist/util/index.d.ts.map +1 -1
  579. package/dist/util/index.js +4 -2
  580. package/dist/util/index.js.map +1 -1
  581. package/dist/util/nestedMap.d.ts +5 -19
  582. package/dist/util/nestedMap.d.ts.map +1 -1
  583. package/dist/util/nestedMap.js +17 -17
  584. package/dist/util/nestedMap.js.map +1 -1
  585. package/dist/util/opaque.d.ts +0 -4
  586. package/dist/util/opaque.d.ts.map +1 -1
  587. package/dist/util/opaque.js +0 -2
  588. package/dist/util/opaque.js.map +1 -1
  589. package/dist/util/rangeMap.d.ts +0 -2
  590. package/dist/util/rangeMap.d.ts.map +1 -1
  591. package/dist/util/rangeMap.js +4 -3
  592. package/dist/util/rangeMap.js.map +1 -1
  593. package/dist/util/transactionResult.d.ts +0 -1
  594. package/dist/util/transactionResult.d.ts.map +1 -1
  595. package/dist/util/transactionResult.js +0 -1
  596. package/dist/util/transactionResult.js.map +1 -1
  597. package/dist/util/typeCheck.d.ts +2 -20
  598. package/dist/util/typeCheck.d.ts.map +1 -1
  599. package/dist/util/typeCheck.js.map +1 -1
  600. package/dist/util/typeCheckTests.d.ts +4 -4
  601. package/dist/util/typeCheckTests.d.ts.map +1 -1
  602. package/dist/util/typeCheckTests.js.map +1 -1
  603. package/dist/util/typeUtils.d.ts +0 -7
  604. package/dist/util/typeUtils.d.ts.map +1 -1
  605. package/dist/util/typeUtils.js.map +1 -1
  606. package/dist/util/utils.d.ts +6 -8
  607. package/dist/util/utils.d.ts.map +1 -1
  608. package/dist/util/utils.js +14 -5
  609. package/dist/util/utils.js.map +1 -1
  610. package/lib/beta.d.ts +4 -1
  611. package/lib/codec/discriminatedUnions.d.ts +11 -5
  612. package/lib/codec/discriminatedUnions.d.ts.map +1 -1
  613. package/lib/codec/discriminatedUnions.js.map +1 -1
  614. package/lib/codec/index.d.ts +1 -1
  615. package/lib/codec/index.d.ts.map +1 -1
  616. package/lib/codec/index.js +1 -1
  617. package/lib/codec/index.js.map +1 -1
  618. package/lib/core/forest/editableForest.d.ts +1 -5
  619. package/lib/core/forest/editableForest.d.ts.map +1 -1
  620. package/lib/core/forest/editableForest.js.map +1 -1
  621. package/lib/core/forest/forest.d.ts +0 -6
  622. package/lib/core/forest/forest.d.ts.map +1 -1
  623. package/lib/core/forest/forest.js +0 -2
  624. package/lib/core/forest/forest.js.map +1 -1
  625. package/lib/core/index.d.ts +2 -2
  626. package/lib/core/index.d.ts.map +1 -1
  627. package/lib/core/index.js +2 -2
  628. package/lib/core/index.js.map +1 -1
  629. package/lib/core/rebase/changeRebaser.d.ts +0 -4
  630. package/lib/core/rebase/changeRebaser.d.ts.map +1 -1
  631. package/lib/core/rebase/changeRebaser.js.map +1 -1
  632. package/lib/core/rebase/index.d.ts +1 -1
  633. package/lib/core/rebase/index.d.ts.map +1 -1
  634. package/lib/core/rebase/index.js +1 -1
  635. package/lib/core/rebase/index.js.map +1 -1
  636. package/lib/core/rebase/types.d.ts +1 -8
  637. package/lib/core/rebase/types.d.ts.map +1 -1
  638. package/lib/core/rebase/types.js +1 -7
  639. package/lib/core/rebase/types.js.map +1 -1
  640. package/lib/core/rebase/utils.d.ts +0 -1
  641. package/lib/core/rebase/utils.d.ts.map +1 -1
  642. package/lib/core/rebase/utils.js +13 -8
  643. package/lib/core/rebase/utils.js.map +1 -1
  644. package/lib/core/schema-stored/multiplicity.d.ts +0 -1
  645. package/lib/core/schema-stored/multiplicity.d.ts.map +1 -1
  646. package/lib/core/schema-stored/multiplicity.js +0 -1
  647. package/lib/core/schema-stored/multiplicity.js.map +1 -1
  648. package/lib/core/schema-stored/schema.d.ts +0 -7
  649. package/lib/core/schema-stored/schema.d.ts.map +1 -1
  650. package/lib/core/schema-stored/schema.js +0 -4
  651. package/lib/core/schema-stored/schema.js.map +1 -1
  652. package/lib/core/schema-stored/storedSchemaRepository.d.ts +0 -3
  653. package/lib/core/schema-stored/storedSchemaRepository.d.ts.map +1 -1
  654. package/lib/core/schema-stored/storedSchemaRepository.js.map +1 -1
  655. package/lib/core/schema-view/view.d.ts +0 -3
  656. package/lib/core/schema-view/view.d.ts.map +1 -1
  657. package/lib/core/schema-view/view.js +0 -1
  658. package/lib/core/schema-view/view.js.map +1 -1
  659. package/lib/core/tree/anchorSet.d.ts +4 -16
  660. package/lib/core/tree/anchorSet.d.ts.map +1 -1
  661. package/lib/core/tree/anchorSet.js +12 -5
  662. package/lib/core/tree/anchorSet.js.map +1 -1
  663. package/lib/core/tree/cursor.d.ts +1 -6
  664. package/lib/core/tree/cursor.d.ts.map +1 -1
  665. package/lib/core/tree/cursor.js +0 -2
  666. package/lib/core/tree/cursor.js.map +1 -1
  667. package/lib/core/tree/delta.d.ts +0 -11
  668. package/lib/core/tree/delta.d.ts.map +1 -1
  669. package/lib/core/tree/delta.js.map +1 -1
  670. package/lib/core/tree/detachedFieldIndexCodec.d.ts.map +1 -1
  671. package/lib/core/tree/detachedFieldIndexCodec.js +4 -3
  672. package/lib/core/tree/detachedFieldIndexCodec.js.map +1 -1
  673. package/lib/core/tree/detachedFieldIndexTypes.d.ts +0 -1
  674. package/lib/core/tree/detachedFieldIndexTypes.d.ts.map +1 -1
  675. package/lib/core/tree/detachedFieldIndexTypes.js.map +1 -1
  676. package/lib/core/tree/index.d.ts +1 -1
  677. package/lib/core/tree/index.d.ts.map +1 -1
  678. package/lib/core/tree/index.js +1 -0
  679. package/lib/core/tree/index.js.map +1 -1
  680. package/lib/core/tree/mapTree.d.ts +20 -4
  681. package/lib/core/tree/mapTree.d.ts.map +1 -1
  682. package/lib/core/tree/mapTree.js +27 -1
  683. package/lib/core/tree/mapTree.js.map +1 -1
  684. package/lib/core/tree/pathTree.d.ts +0 -11
  685. package/lib/core/tree/pathTree.d.ts.map +1 -1
  686. package/lib/core/tree/pathTree.js.map +1 -1
  687. package/lib/core/tree/treeTextFormat.d.ts.map +1 -1
  688. package/lib/core/tree/treeTextFormat.js +3 -2
  689. package/lib/core/tree/treeTextFormat.js.map +1 -1
  690. package/lib/core/tree/types.d.ts +0 -11
  691. package/lib/core/tree/types.d.ts.map +1 -1
  692. package/lib/core/tree/types.js +0 -4
  693. package/lib/core/tree/types.js.map +1 -1
  694. package/lib/core/tree/visitDelta.d.ts +0 -1
  695. package/lib/core/tree/visitDelta.d.ts.map +1 -1
  696. package/lib/core/tree/visitDelta.js +2 -2
  697. package/lib/core/tree/visitDelta.js.map +1 -1
  698. package/lib/core/tree/visitPath.d.ts +0 -2
  699. package/lib/core/tree/visitPath.d.ts.map +1 -1
  700. package/lib/core/tree/visitPath.js.map +1 -1
  701. package/lib/core/tree/visitorUtils.d.ts +0 -1
  702. package/lib/core/tree/visitorUtils.d.ts.map +1 -1
  703. package/lib/core/tree/visitorUtils.js.map +1 -1
  704. package/lib/domains/index.d.ts +1 -1
  705. package/lib/domains/index.d.ts.map +1 -1
  706. package/lib/domains/index.js +1 -1
  707. package/lib/domains/index.js.map +1 -1
  708. package/lib/domains/json/index.d.ts +1 -1
  709. package/lib/domains/json/index.d.ts.map +1 -1
  710. package/lib/domains/json/index.js +1 -1
  711. package/lib/domains/json/index.js.map +1 -1
  712. package/lib/domains/json/jsonCursor.d.ts +36 -2
  713. package/lib/domains/json/jsonCursor.d.ts.map +1 -1
  714. package/lib/domains/json/jsonCursor.js +76 -5
  715. package/lib/domains/json/jsonCursor.js.map +1 -1
  716. package/lib/domains/json/jsonDomainSchema.d.ts +13 -3
  717. package/lib/domains/json/jsonDomainSchema.d.ts.map +1 -1
  718. package/lib/domains/json/jsonDomainSchema.js +9 -1
  719. package/lib/domains/json/jsonDomainSchema.js.map +1 -1
  720. package/lib/domains/leafDomain.d.ts +0 -1
  721. package/lib/domains/leafDomain.d.ts.map +1 -1
  722. package/lib/domains/leafDomain.js +0 -1
  723. package/lib/domains/leafDomain.js.map +1 -1
  724. package/lib/domains/schemaBuilder.d.ts +1 -7
  725. package/lib/domains/schemaBuilder.d.ts.map +1 -1
  726. package/lib/domains/schemaBuilder.js +1 -11
  727. package/lib/domains/schemaBuilder.js.map +1 -1
  728. package/lib/events/events.d.ts +7 -5
  729. package/lib/events/events.d.ts.map +1 -1
  730. package/lib/events/events.js +5 -3
  731. package/lib/events/events.js.map +1 -1
  732. package/lib/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
  733. package/lib/feature-libraries/chunked-forest/basicChunk.js +9 -4
  734. package/lib/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
  735. package/lib/feature-libraries/chunked-forest/chunk.d.ts +1 -1
  736. package/lib/feature-libraries/chunked-forest/chunk.d.ts.map +1 -1
  737. package/lib/feature-libraries/chunked-forest/chunk.js.map +1 -1
  738. package/lib/feature-libraries/chunked-forest/chunkTree.js +4 -4
  739. package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  740. package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  741. package/lib/feature-libraries/chunked-forest/chunkedForest.js +8 -6
  742. package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  743. package/lib/feature-libraries/chunked-forest/codec/chunkCodecUtilities.js +2 -2
  744. package/lib/feature-libraries/chunked-forest/codec/chunkCodecUtilities.js.map +1 -1
  745. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  746. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js +9 -6
  747. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  748. package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
  749. package/lib/feature-libraries/chunked-forest/uniformChunk.js +6 -4
  750. package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  751. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts +12 -24
  752. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  753. package/lib/feature-libraries/default-schema/defaultEditBuilder.js +6 -16
  754. package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  755. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts +0 -6
  756. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  757. package/lib/feature-libraries/default-schema/defaultFieldKinds.js +11 -1
  758. package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  759. package/lib/feature-libraries/default-schema/defaultSchema.d.ts +0 -1
  760. package/lib/feature-libraries/default-schema/defaultSchema.d.ts.map +1 -1
  761. package/lib/feature-libraries/default-schema/defaultSchema.js +0 -1
  762. package/lib/feature-libraries/default-schema/defaultSchema.js.map +1 -1
  763. package/lib/feature-libraries/default-schema/index.d.ts +1 -1
  764. package/lib/feature-libraries/default-schema/index.d.ts.map +1 -1
  765. package/lib/feature-libraries/default-schema/index.js +1 -1
  766. package/lib/feature-libraries/default-schema/index.js.map +1 -1
  767. package/lib/feature-libraries/default-schema/schemaChecker.d.ts +6 -0
  768. package/lib/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
  769. package/lib/feature-libraries/default-schema/schemaChecker.js +6 -0
  770. package/lib/feature-libraries/default-schema/schemaChecker.js.map +1 -1
  771. package/lib/feature-libraries/editableTreeBinder.d.ts +0 -67
  772. package/lib/feature-libraries/editableTreeBinder.d.ts.map +1 -1
  773. package/lib/feature-libraries/editableTreeBinder.js +6 -25
  774. package/lib/feature-libraries/editableTreeBinder.js.map +1 -1
  775. package/lib/feature-libraries/fieldGenerator.d.ts +0 -3
  776. package/lib/feature-libraries/fieldGenerator.d.ts.map +1 -1
  777. package/lib/feature-libraries/fieldGenerator.js +0 -1
  778. package/lib/feature-libraries/fieldGenerator.js.map +1 -1
  779. package/lib/feature-libraries/flex-map-tree/index.d.ts +1 -1
  780. package/lib/feature-libraries/flex-map-tree/index.d.ts.map +1 -1
  781. package/lib/feature-libraries/flex-map-tree/index.js +1 -1
  782. package/lib/feature-libraries/flex-map-tree/index.js.map +1 -1
  783. package/lib/feature-libraries/flex-map-tree/mapTreeNode.d.ts +57 -51
  784. package/lib/feature-libraries/flex-map-tree/mapTreeNode.d.ts.map +1 -1
  785. package/lib/feature-libraries/flex-map-tree/mapTreeNode.js +172 -180
  786. package/lib/feature-libraries/flex-map-tree/mapTreeNode.js.map +1 -1
  787. package/lib/feature-libraries/flex-tree/context.d.ts +0 -1
  788. package/lib/feature-libraries/flex-tree/context.d.ts.map +1 -1
  789. package/lib/feature-libraries/flex-tree/context.js.map +1 -1
  790. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts +17 -373
  791. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  792. package/lib/feature-libraries/flex-tree/flexTreeTypes.js +0 -33
  793. package/lib/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  794. package/lib/feature-libraries/flex-tree/index.d.ts +2 -2
  795. package/lib/feature-libraries/flex-tree/index.d.ts.map +1 -1
  796. package/lib/feature-libraries/flex-tree/index.js +1 -1
  797. package/lib/feature-libraries/flex-tree/index.js.map +1 -1
  798. package/lib/feature-libraries/flex-tree/lazyField.d.ts +9 -27
  799. package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  800. package/lib/feature-libraries/flex-tree/lazyField.js +28 -104
  801. package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
  802. package/lib/feature-libraries/flex-tree/lazyNode.d.ts +3 -18
  803. package/lib/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  804. package/lib/feature-libraries/flex-tree/lazyNode.js +5 -126
  805. package/lib/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  806. package/lib/feature-libraries/flex-tree/treeEvents.d.ts +0 -2
  807. package/lib/feature-libraries/flex-tree/treeEvents.d.ts.map +1 -1
  808. package/lib/feature-libraries/flex-tree/treeEvents.js.map +1 -1
  809. package/lib/feature-libraries/flex-tree/utilities.d.ts +2 -1
  810. package/lib/feature-libraries/flex-tree/utilities.d.ts.map +1 -1
  811. package/lib/feature-libraries/flex-tree/utilities.js +4 -0
  812. package/lib/feature-libraries/flex-tree/utilities.js.map +1 -1
  813. package/lib/feature-libraries/forest-summary/codec.js +3 -3
  814. package/lib/feature-libraries/forest-summary/codec.js.map +1 -1
  815. package/lib/feature-libraries/index.d.ts +6 -8
  816. package/lib/feature-libraries/index.d.ts.map +1 -1
  817. package/lib/feature-libraries/index.js +6 -7
  818. package/lib/feature-libraries/index.js.map +1 -1
  819. package/lib/feature-libraries/mapTreeCursor.d.ts +6 -2
  820. package/lib/feature-libraries/mapTreeCursor.d.ts.map +1 -1
  821. package/lib/feature-libraries/mapTreeCursor.js +7 -0
  822. package/lib/feature-libraries/mapTreeCursor.js.map +1 -1
  823. package/lib/feature-libraries/memoizedIdRangeAllocator.d.ts +0 -4
  824. package/lib/feature-libraries/memoizedIdRangeAllocator.d.ts.map +1 -1
  825. package/lib/feature-libraries/memoizedIdRangeAllocator.js +0 -1
  826. package/lib/feature-libraries/memoizedIdRangeAllocator.js.map +1 -1
  827. package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts +0 -2
  828. package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
  829. package/lib/feature-libraries/modular-schema/crossFieldQueries.js +0 -1
  830. package/lib/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
  831. package/lib/feature-libraries/modular-schema/discrepancies.d.ts +18 -0
  832. package/lib/feature-libraries/modular-schema/discrepancies.d.ts.map +1 -1
  833. package/lib/feature-libraries/modular-schema/discrepancies.js +103 -1
  834. package/lib/feature-libraries/modular-schema/discrepancies.js.map +1 -1
  835. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts +0 -8
  836. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  837. package/lib/feature-libraries/modular-schema/fieldChangeHandler.js +0 -1
  838. package/lib/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  839. package/lib/feature-libraries/modular-schema/fieldKind.d.ts +1 -3
  840. package/lib/feature-libraries/modular-schema/fieldKind.d.ts.map +1 -1
  841. package/lib/feature-libraries/modular-schema/fieldKind.js +1 -2
  842. package/lib/feature-libraries/modular-schema/fieldKind.js.map +1 -1
  843. package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts +1 -2
  844. package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  845. package/lib/feature-libraries/modular-schema/genericFieldKind.js +56 -83
  846. package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  847. package/lib/feature-libraries/modular-schema/genericFieldKindCodecs.d.ts +1 -1
  848. package/lib/feature-libraries/modular-schema/genericFieldKindCodecs.d.ts.map +1 -1
  849. package/lib/feature-libraries/modular-schema/genericFieldKindCodecs.js +6 -9
  850. package/lib/feature-libraries/modular-schema/genericFieldKindCodecs.js.map +1 -1
  851. package/lib/feature-libraries/modular-schema/genericFieldKindTypes.d.ts +3 -14
  852. package/lib/feature-libraries/modular-schema/genericFieldKindTypes.d.ts.map +1 -1
  853. package/lib/feature-libraries/modular-schema/genericFieldKindTypes.js +4 -1
  854. package/lib/feature-libraries/modular-schema/genericFieldKindTypes.js.map +1 -1
  855. package/lib/feature-libraries/modular-schema/index.d.ts +2 -2
  856. package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
  857. package/lib/feature-libraries/modular-schema/index.js +1 -1
  858. package/lib/feature-libraries/modular-schema/index.js.map +1 -1
  859. package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  860. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js +42 -25
  861. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  862. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +9 -8
  863. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  864. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +169 -206
  865. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  866. package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts +8 -14
  867. package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
  868. package/lib/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
  869. package/lib/feature-libraries/node-key/nodeKey.d.ts +0 -4
  870. package/lib/feature-libraries/node-key/nodeKey.d.ts.map +1 -1
  871. package/lib/feature-libraries/node-key/nodeKey.js +0 -2
  872. package/lib/feature-libraries/node-key/nodeKey.js.map +1 -1
  873. package/lib/feature-libraries/node-key/nodeKeyManager.d.ts +0 -1
  874. package/lib/feature-libraries/node-key/nodeKeyManager.d.ts.map +1 -1
  875. package/lib/feature-libraries/node-key/nodeKeyManager.js.map +1 -1
  876. package/lib/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  877. package/lib/feature-libraries/object-forest/objectForest.js +2 -11
  878. package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
  879. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts +6 -6
  880. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts.map +1 -1
  881. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts +7 -7
  882. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts.map +1 -1
  883. package/lib/feature-libraries/schemaBuilderBase.d.ts +2 -28
  884. package/lib/feature-libraries/schemaBuilderBase.d.ts.map +1 -1
  885. package/lib/feature-libraries/schemaBuilderBase.js +2 -28
  886. package/lib/feature-libraries/schemaBuilderBase.js.map +1 -1
  887. package/lib/feature-libraries/sequence-field/compose.d.ts.map +1 -1
  888. package/lib/feature-libraries/sequence-field/compose.js +25 -22
  889. package/lib/feature-libraries/sequence-field/compose.js.map +1 -1
  890. package/lib/feature-libraries/sequence-field/formatV2.d.ts +3 -3
  891. package/lib/feature-libraries/sequence-field/formatV2.d.ts.map +1 -1
  892. package/lib/feature-libraries/sequence-field/formatV2.js +3 -3
  893. package/lib/feature-libraries/sequence-field/formatV2.js.map +1 -1
  894. package/lib/feature-libraries/sequence-field/formatV3.d.ts +195 -0
  895. package/lib/feature-libraries/sequence-field/formatV3.d.ts.map +1 -0
  896. package/lib/feature-libraries/sequence-field/formatV3.js +19 -0
  897. package/lib/feature-libraries/sequence-field/formatV3.js.map +1 -0
  898. package/lib/feature-libraries/sequence-field/helperTypes.d.ts +11 -0
  899. package/lib/feature-libraries/sequence-field/helperTypes.d.ts.map +1 -1
  900. package/lib/feature-libraries/sequence-field/helperTypes.js.map +1 -1
  901. package/lib/feature-libraries/sequence-field/index.d.ts +1 -1
  902. package/lib/feature-libraries/sequence-field/index.d.ts.map +1 -1
  903. package/lib/feature-libraries/sequence-field/index.js.map +1 -1
  904. package/lib/feature-libraries/sequence-field/invert.d.ts.map +1 -1
  905. package/lib/feature-libraries/sequence-field/invert.js +22 -14
  906. package/lib/feature-libraries/sequence-field/invert.js.map +1 -1
  907. package/lib/feature-libraries/sequence-field/markQueue.js +2 -2
  908. package/lib/feature-libraries/sequence-field/markQueue.js.map +1 -1
  909. package/lib/feature-libraries/sequence-field/moveEffectTable.d.ts +2 -2
  910. package/lib/feature-libraries/sequence-field/moveEffectTable.d.ts.map +1 -1
  911. package/lib/feature-libraries/sequence-field/moveEffectTable.js.map +1 -1
  912. package/lib/feature-libraries/sequence-field/rebase.d.ts.map +1 -1
  913. package/lib/feature-libraries/sequence-field/rebase.js +25 -7
  914. package/lib/feature-libraries/sequence-field/rebase.js.map +1 -1
  915. package/lib/feature-libraries/sequence-field/replaceRevisions.d.ts.map +1 -1
  916. package/lib/feature-libraries/sequence-field/replaceRevisions.js +16 -3
  917. package/lib/feature-libraries/sequence-field/replaceRevisions.js.map +1 -1
  918. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts.map +1 -1
  919. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js +40 -6
  920. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +1 -1
  921. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts +4 -1
  922. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
  923. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js +55 -11
  924. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
  925. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts +11 -0
  926. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts.map +1 -0
  927. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.js +81 -0
  928. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -0
  929. package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts.map +1 -1
  930. package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.js +2 -0
  931. package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.js.map +1 -1
  932. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts.map +1 -1
  933. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.js +5 -2
  934. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
  935. package/lib/feature-libraries/sequence-field/types.d.ts +23 -4
  936. package/lib/feature-libraries/sequence-field/types.d.ts.map +1 -1
  937. package/lib/feature-libraries/sequence-field/types.js.map +1 -1
  938. package/lib/feature-libraries/sequence-field/utils.d.ts +5 -4
  939. package/lib/feature-libraries/sequence-field/utils.d.ts.map +1 -1
  940. package/lib/feature-libraries/sequence-field/utils.js +67 -41
  941. package/lib/feature-libraries/sequence-field/utils.js.map +1 -1
  942. package/lib/feature-libraries/storedToViewSchema.d.ts +0 -1
  943. package/lib/feature-libraries/storedToViewSchema.d.ts.map +1 -1
  944. package/lib/feature-libraries/storedToViewSchema.js +0 -1
  945. package/lib/feature-libraries/storedToViewSchema.js.map +1 -1
  946. package/lib/feature-libraries/treeCursorUtils.d.ts +0 -6
  947. package/lib/feature-libraries/treeCursorUtils.d.ts.map +1 -1
  948. package/lib/feature-libraries/treeCursorUtils.js +9 -7
  949. package/lib/feature-libraries/treeCursorUtils.js.map +1 -1
  950. package/lib/feature-libraries/treeTextCursor.d.ts +0 -2
  951. package/lib/feature-libraries/treeTextCursor.d.ts.map +1 -1
  952. package/lib/feature-libraries/treeTextCursor.js +0 -2
  953. package/lib/feature-libraries/treeTextCursor.js.map +1 -1
  954. package/lib/feature-libraries/typed-schema/flexList.d.ts +0 -3
  955. package/lib/feature-libraries/typed-schema/flexList.d.ts.map +1 -1
  956. package/lib/feature-libraries/typed-schema/flexList.js.map +1 -1
  957. package/lib/feature-libraries/typed-schema/index.d.ts +1 -1
  958. package/lib/feature-libraries/typed-schema/index.d.ts.map +1 -1
  959. package/lib/feature-libraries/typed-schema/index.js +1 -1
  960. package/lib/feature-libraries/typed-schema/index.js.map +1 -1
  961. package/lib/feature-libraries/typed-schema/schemaCollection.d.ts.map +1 -1
  962. package/lib/feature-libraries/typed-schema/schemaCollection.js +1 -5
  963. package/lib/feature-libraries/typed-schema/schemaCollection.js.map +1 -1
  964. package/lib/feature-libraries/typed-schema/typedTreeSchema.d.ts +2 -41
  965. package/lib/feature-libraries/typed-schema/typedTreeSchema.d.ts.map +1 -1
  966. package/lib/feature-libraries/typed-schema/typedTreeSchema.js +1 -38
  967. package/lib/feature-libraries/typed-schema/typedTreeSchema.js.map +1 -1
  968. package/lib/feature-libraries/typed-schema/view.d.ts +0 -1
  969. package/lib/feature-libraries/typed-schema/view.d.ts.map +1 -1
  970. package/lib/feature-libraries/typed-schema/view.js.map +1 -1
  971. package/lib/index.d.ts +8 -9
  972. package/lib/index.d.ts.map +1 -1
  973. package/lib/index.js +8 -9
  974. package/lib/index.js.map +1 -1
  975. package/lib/internalTypes.d.ts +1 -1
  976. package/lib/internalTypes.d.ts.map +1 -1
  977. package/lib/internalTypes.js.map +1 -1
  978. package/lib/packageVersion.d.ts +1 -1
  979. package/lib/packageVersion.d.ts.map +1 -1
  980. package/lib/packageVersion.js +1 -1
  981. package/lib/packageVersion.js.map +1 -1
  982. package/lib/public.d.ts +4 -1
  983. package/lib/shared-tree/schematizeTree.d.ts +2 -11
  984. package/lib/shared-tree/schematizeTree.d.ts.map +1 -1
  985. package/lib/shared-tree/schematizeTree.js +15 -4
  986. package/lib/shared-tree/schematizeTree.js.map +1 -1
  987. package/lib/shared-tree/schematizingTreeView.d.ts +4 -4
  988. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  989. package/lib/shared-tree/schematizingTreeView.js +3 -3
  990. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  991. package/lib/shared-tree/sharedTree.d.ts +4 -17
  992. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  993. package/lib/shared-tree/sharedTree.js +6 -10
  994. package/lib/shared-tree/sharedTree.js.map +1 -1
  995. package/lib/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  996. package/lib/shared-tree/sharedTreeChangeCodecs.js +4 -0
  997. package/lib/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  998. package/lib/shared-tree/sharedTreeChangeFamily.js +3 -3
  999. package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  1000. package/lib/shared-tree/sharedTreeEditBuilder.d.ts +0 -2
  1001. package/lib/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
  1002. package/lib/shared-tree/sharedTreeEditBuilder.js.map +1 -1
  1003. package/lib/shared-tree/treeApi.js +3 -3
  1004. package/lib/shared-tree/treeApi.js.map +1 -1
  1005. package/lib/shared-tree/treeCheckout.d.ts +0 -5
  1006. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  1007. package/lib/shared-tree/treeCheckout.js +6 -4
  1008. package/lib/shared-tree/treeCheckout.js.map +1 -1
  1009. package/lib/shared-tree/treeView.d.ts +3 -6
  1010. package/lib/shared-tree/treeView.d.ts.map +1 -1
  1011. package/lib/shared-tree/treeView.js.map +1 -1
  1012. package/lib/shared-tree-core/branch.d.ts.map +1 -1
  1013. package/lib/shared-tree-core/branch.js +12 -7
  1014. package/lib/shared-tree-core/branch.js.map +1 -1
  1015. package/lib/shared-tree-core/defaultResubmitMachine.js +4 -4
  1016. package/lib/shared-tree-core/defaultResubmitMachine.js.map +1 -1
  1017. package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  1018. package/lib/shared-tree-core/editManagerCodecs.js +1 -0
  1019. package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
  1020. package/lib/shared-tree-core/editManagerFormat.d.ts +2 -2
  1021. package/lib/shared-tree-core/editManagerFormat.d.ts.map +1 -1
  1022. package/lib/shared-tree-core/editManagerFormat.js +6 -1
  1023. package/lib/shared-tree-core/editManagerFormat.js.map +1 -1
  1024. package/lib/shared-tree-core/messageCodecs.d.ts.map +1 -1
  1025. package/lib/shared-tree-core/messageCodecs.js +1 -0
  1026. package/lib/shared-tree-core/messageCodecs.js.map +1 -1
  1027. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  1028. package/lib/shared-tree-core/sharedTreeCore.js +4 -2
  1029. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  1030. package/lib/simple-tree/api/create.d.ts +54 -0
  1031. package/lib/simple-tree/api/create.d.ts.map +1 -0
  1032. package/lib/simple-tree/api/create.js +92 -0
  1033. package/lib/simple-tree/api/create.js.map +1 -0
  1034. package/lib/simple-tree/api/index.d.ts +12 -0
  1035. package/lib/simple-tree/api/index.d.ts.map +1 -0
  1036. package/lib/simple-tree/api/index.js +13 -0
  1037. package/lib/simple-tree/api/index.js.map +1 -0
  1038. package/{dist/simple-tree → lib/simple-tree/api}/schemaCreationUtilities.d.ts +7 -4
  1039. package/lib/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -0
  1040. package/lib/simple-tree/{schemaCreationUtilities.js → api/schemaCreationUtilities.js} +1 -1
  1041. package/lib/simple-tree/api/schemaCreationUtilities.js.map +1 -0
  1042. package/lib/simple-tree/{schemaFactory.d.ts → api/schemaFactory.d.ts} +15 -14
  1043. package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -0
  1044. package/lib/simple-tree/{schemaFactory.js → api/schemaFactory.js} +9 -8
  1045. package/lib/simple-tree/api/schemaFactory.js.map +1 -0
  1046. package/{dist/simple-tree → lib/simple-tree/api}/schemaFactoryRecursive.d.ts +40 -7
  1047. package/lib/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -0
  1048. package/lib/simple-tree/{schemaFactoryRecursive.js → api/schemaFactoryRecursive.js} +1 -1
  1049. package/lib/simple-tree/api/schemaFactoryRecursive.js.map +1 -0
  1050. package/lib/simple-tree/api/testRecursiveDomain.d.ts +62 -0
  1051. package/lib/simple-tree/api/testRecursiveDomain.d.ts.map +1 -0
  1052. package/lib/simple-tree/api/testRecursiveDomain.js.map +1 -0
  1053. package/{dist/simple-tree → lib/simple-tree/api}/tree.d.ts +111 -20
  1054. package/lib/simple-tree/api/tree.d.ts.map +1 -0
  1055. package/lib/simple-tree/api/tree.js +165 -0
  1056. package/lib/simple-tree/api/tree.js.map +1 -0
  1057. package/lib/simple-tree/{treeNodeApi.d.ts → api/treeNodeApi.d.ts} +7 -6
  1058. package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -0
  1059. package/lib/simple-tree/{treeNodeApi.js → api/treeNodeApi.js} +55 -19
  1060. package/lib/simple-tree/api/treeNodeApi.js.map +1 -0
  1061. package/lib/simple-tree/api/verboseTree.d.ts +136 -0
  1062. package/lib/simple-tree/api/verboseTree.d.ts.map +1 -0
  1063. package/lib/simple-tree/api/verboseTree.js +213 -0
  1064. package/lib/simple-tree/api/verboseTree.js.map +1 -0
  1065. package/lib/simple-tree/arrayNode.d.ts +3 -3
  1066. package/lib/simple-tree/arrayNode.d.ts.map +1 -1
  1067. package/lib/simple-tree/arrayNode.js +59 -70
  1068. package/lib/simple-tree/arrayNode.js.map +1 -1
  1069. package/lib/simple-tree/core/index.d.ts +10 -0
  1070. package/lib/simple-tree/core/index.d.ts.map +1 -0
  1071. package/lib/simple-tree/core/index.js +10 -0
  1072. package/lib/simple-tree/core/index.js.map +1 -0
  1073. package/{dist/simple-tree → lib/simple-tree/core}/schemaCaching.d.ts +2 -9
  1074. package/lib/simple-tree/core/schemaCaching.d.ts.map +1 -0
  1075. package/lib/simple-tree/{schemaCaching.js → core/schemaCaching.js} +1 -21
  1076. package/lib/simple-tree/core/schemaCaching.js.map +1 -0
  1077. package/lib/simple-tree/core/treeNodeKernel.d.ts +70 -0
  1078. package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -0
  1079. package/lib/simple-tree/core/treeNodeKernel.js +157 -0
  1080. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -0
  1081. package/lib/simple-tree/core/treeNodeSchema.d.ts +149 -0
  1082. package/lib/simple-tree/core/treeNodeSchema.d.ts.map +1 -0
  1083. package/lib/simple-tree/core/treeNodeSchema.js +32 -0
  1084. package/lib/simple-tree/core/treeNodeSchema.js.map +1 -0
  1085. package/{dist/simple-tree → lib/simple-tree/core}/types.d.ts +50 -79
  1086. package/lib/simple-tree/core/types.d.ts.map +1 -0
  1087. package/lib/simple-tree/core/types.js +111 -0
  1088. package/lib/simple-tree/core/types.js.map +1 -0
  1089. package/lib/simple-tree/core/withType.d.ts +82 -0
  1090. package/lib/simple-tree/core/withType.d.ts.map +1 -0
  1091. package/lib/simple-tree/core/withType.js +36 -0
  1092. package/lib/simple-tree/core/withType.js.map +1 -0
  1093. package/lib/simple-tree/getJsonSchema.d.ts +55 -0
  1094. package/lib/simple-tree/getJsonSchema.d.ts.map +1 -0
  1095. package/lib/simple-tree/getJsonSchema.js +65 -0
  1096. package/lib/simple-tree/getJsonSchema.js.map +1 -0
  1097. package/lib/simple-tree/getSimpleFieldSchema.d.ts +14 -0
  1098. package/lib/simple-tree/getSimpleFieldSchema.d.ts.map +1 -0
  1099. package/lib/simple-tree/getSimpleFieldSchema.js +25 -0
  1100. package/lib/simple-tree/getSimpleFieldSchema.js.map +1 -0
  1101. package/lib/simple-tree/getSimpleSchema.d.ts +58 -0
  1102. package/lib/simple-tree/getSimpleSchema.d.ts.map +1 -0
  1103. package/lib/simple-tree/getSimpleSchema.js +64 -0
  1104. package/lib/simple-tree/getSimpleSchema.js.map +1 -0
  1105. package/lib/simple-tree/index.d.ts +12 -13
  1106. package/lib/simple-tree/index.d.ts.map +1 -1
  1107. package/lib/simple-tree/index.js +8 -11
  1108. package/lib/simple-tree/index.js.map +1 -1
  1109. package/lib/simple-tree/jsonSchema.d.ts +206 -0
  1110. package/lib/simple-tree/jsonSchema.d.ts.map +1 -0
  1111. package/lib/simple-tree/{nodeKeys.js → jsonSchema.js} +1 -1
  1112. package/lib/simple-tree/jsonSchema.js.map +1 -0
  1113. package/lib/simple-tree/leafNodeSchema.d.ts +1 -1
  1114. package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
  1115. package/lib/simple-tree/leafNodeSchema.js +1 -2
  1116. package/lib/simple-tree/leafNodeSchema.js.map +1 -1
  1117. package/lib/simple-tree/mapNode.d.ts +9 -3
  1118. package/lib/simple-tree/mapNode.d.ts.map +1 -1
  1119. package/lib/simple-tree/mapNode.js +36 -36
  1120. package/lib/simple-tree/mapNode.js.map +1 -1
  1121. package/lib/simple-tree/objectNode.d.ts +18 -16
  1122. package/lib/simple-tree/objectNode.d.ts.map +1 -1
  1123. package/lib/simple-tree/objectNode.js +36 -34
  1124. package/lib/simple-tree/objectNode.js.map +1 -1
  1125. package/lib/simple-tree/objectNodeTypes.d.ts +38 -0
  1126. package/lib/simple-tree/objectNodeTypes.d.ts.map +1 -0
  1127. package/lib/simple-tree/objectNodeTypes.js +15 -0
  1128. package/lib/simple-tree/objectNodeTypes.js.map +1 -0
  1129. package/lib/simple-tree/proxies.d.ts +6 -25
  1130. package/lib/simple-tree/proxies.d.ts.map +1 -1
  1131. package/lib/simple-tree/proxies.js +46 -57
  1132. package/lib/simple-tree/proxies.js.map +1 -1
  1133. package/lib/simple-tree/proxyBinding.d.ts +45 -22
  1134. package/lib/simple-tree/proxyBinding.d.ts.map +1 -1
  1135. package/lib/simple-tree/proxyBinding.js +89 -52
  1136. package/lib/simple-tree/proxyBinding.js.map +1 -1
  1137. package/lib/simple-tree/schemaTypes.d.ts +10 -159
  1138. package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
  1139. package/lib/simple-tree/schemaTypes.js +9 -41
  1140. package/lib/simple-tree/schemaTypes.js.map +1 -1
  1141. package/lib/simple-tree/simpleSchema.d.ts +124 -0
  1142. package/lib/simple-tree/simpleSchema.d.ts.map +1 -0
  1143. package/lib/{feature-libraries/schema-aware/schemaAware.js → simple-tree/simpleSchema.js} +1 -1
  1144. package/lib/simple-tree/simpleSchema.js.map +1 -0
  1145. package/lib/simple-tree/simpleSchemaToJsonSchema.d.ts +12 -0
  1146. package/lib/simple-tree/simpleSchemaToJsonSchema.d.ts.map +1 -0
  1147. package/lib/simple-tree/simpleSchemaToJsonSchema.js +142 -0
  1148. package/lib/simple-tree/simpleSchemaToJsonSchema.js.map +1 -0
  1149. package/lib/simple-tree/toFlexSchema.d.ts +4 -12
  1150. package/lib/simple-tree/toFlexSchema.d.ts.map +1 -1
  1151. package/lib/simple-tree/toFlexSchema.js +9 -18
  1152. package/lib/simple-tree/toFlexSchema.js.map +1 -1
  1153. package/lib/simple-tree/toMapTree.d.ts +39 -39
  1154. package/lib/simple-tree/toMapTree.d.ts.map +1 -1
  1155. package/lib/simple-tree/toMapTree.js +214 -158
  1156. package/lib/simple-tree/toMapTree.js.map +1 -1
  1157. package/lib/simple-tree/treeNodeValid.d.ts +74 -0
  1158. package/lib/simple-tree/treeNodeValid.d.ts.map +1 -0
  1159. package/lib/simple-tree/{types.js → treeNodeValid.js} +8 -98
  1160. package/lib/simple-tree/treeNodeValid.js.map +1 -0
  1161. package/lib/simple-tree/typesUnsafe.d.ts +35 -4
  1162. package/lib/simple-tree/typesUnsafe.d.ts.map +1 -1
  1163. package/lib/simple-tree/typesUnsafe.js.map +1 -1
  1164. package/lib/simple-tree/viewSchemaToSimpleSchema.d.ts +11 -0
  1165. package/lib/simple-tree/viewSchemaToSimpleSchema.d.ts.map +1 -0
  1166. package/lib/simple-tree/viewSchemaToSimpleSchema.js +167 -0
  1167. package/lib/simple-tree/viewSchemaToSimpleSchema.js.map +1 -0
  1168. package/lib/util/brand.d.ts +0 -3
  1169. package/lib/util/brand.d.ts.map +1 -1
  1170. package/lib/util/brand.js +1 -2
  1171. package/lib/util/brand.js.map +1 -1
  1172. package/lib/util/brandedMap.d.ts +0 -5
  1173. package/lib/util/brandedMap.d.ts.map +1 -1
  1174. package/lib/util/brandedMap.js +0 -1
  1175. package/lib/util/brandedMap.js.map +1 -1
  1176. package/lib/util/idAllocator.d.ts +0 -2
  1177. package/lib/util/idAllocator.d.ts.map +1 -1
  1178. package/lib/util/idAllocator.js +0 -1
  1179. package/lib/util/idAllocator.js.map +1 -1
  1180. package/lib/util/index.d.ts +2 -2
  1181. package/lib/util/index.d.ts.map +1 -1
  1182. package/lib/util/index.js +2 -2
  1183. package/lib/util/index.js.map +1 -1
  1184. package/lib/util/nestedMap.d.ts +5 -19
  1185. package/lib/util/nestedMap.d.ts.map +1 -1
  1186. package/lib/util/nestedMap.js +15 -16
  1187. package/lib/util/nestedMap.js.map +1 -1
  1188. package/lib/util/opaque.d.ts +0 -4
  1189. package/lib/util/opaque.d.ts.map +1 -1
  1190. package/lib/util/opaque.js +0 -2
  1191. package/lib/util/opaque.js.map +1 -1
  1192. package/lib/util/rangeMap.d.ts +0 -2
  1193. package/lib/util/rangeMap.d.ts.map +1 -1
  1194. package/lib/util/rangeMap.js +4 -3
  1195. package/lib/util/rangeMap.js.map +1 -1
  1196. package/lib/util/transactionResult.d.ts +0 -1
  1197. package/lib/util/transactionResult.d.ts.map +1 -1
  1198. package/lib/util/transactionResult.js +0 -1
  1199. package/lib/util/transactionResult.js.map +1 -1
  1200. package/lib/util/typeCheck.d.ts +2 -20
  1201. package/lib/util/typeCheck.d.ts.map +1 -1
  1202. package/lib/util/typeCheck.js.map +1 -1
  1203. package/lib/util/typeCheckTests.d.ts +4 -4
  1204. package/lib/util/typeCheckTests.d.ts.map +1 -1
  1205. package/lib/util/typeCheckTests.js.map +1 -1
  1206. package/lib/util/typeUtils.d.ts +0 -7
  1207. package/lib/util/typeUtils.d.ts.map +1 -1
  1208. package/lib/util/typeUtils.js.map +1 -1
  1209. package/lib/util/utils.d.ts +6 -8
  1210. package/lib/util/utils.d.ts.map +1 -1
  1211. package/lib/util/utils.js +12 -4
  1212. package/lib/util/utils.js.map +1 -1
  1213. package/package.json +25 -24
  1214. package/src/codec/discriminatedUnions.ts +20 -10
  1215. package/src/codec/index.ts +5 -1
  1216. package/src/core/forest/README.md +4 -2
  1217. package/src/core/forest/editableForest.ts +1 -6
  1218. package/src/core/forest/forest.ts +0 -6
  1219. package/src/core/index.ts +2 -2
  1220. package/src/core/rebase/changeRebaser.ts +0 -4
  1221. package/src/core/rebase/index.ts +0 -2
  1222. package/src/core/rebase/types.ts +1 -23
  1223. package/src/core/rebase/utils.ts +13 -11
  1224. package/src/core/schema-stored/multiplicity.ts +0 -1
  1225. package/src/core/schema-stored/schema.ts +0 -7
  1226. package/src/core/schema-stored/storedSchemaRepository.ts +0 -3
  1227. package/src/core/schema-view/view.ts +0 -3
  1228. package/src/core/tree/anchorSet.ts +27 -26
  1229. package/src/core/tree/cursor.ts +1 -6
  1230. package/src/core/tree/delta.ts +0 -11
  1231. package/src/core/tree/detachedFieldIndexCodec.ts +4 -3
  1232. package/src/core/tree/detachedFieldIndexTypes.ts +0 -1
  1233. package/src/core/tree/index.ts +1 -1
  1234. package/src/core/tree/mapTree.ts +45 -4
  1235. package/src/core/tree/pathTree.ts +0 -11
  1236. package/src/core/tree/treeTextFormat.ts +3 -2
  1237. package/src/core/tree/types.ts +0 -11
  1238. package/src/core/tree/visitDelta.ts +2 -3
  1239. package/src/core/tree/visitPath.ts +0 -2
  1240. package/src/core/tree/visitorUtils.ts +0 -1
  1241. package/src/domains/index.ts +3 -0
  1242. package/src/domains/json/index.ts +7 -1
  1243. package/src/domains/json/jsonCursor.ts +113 -6
  1244. package/src/domains/json/jsonDomainSchema.ts +4 -5
  1245. package/src/domains/leafDomain.ts +0 -1
  1246. package/src/domains/schemaBuilder.ts +0 -22
  1247. package/src/events/events.ts +10 -6
  1248. package/src/feature-libraries/chunked-forest/README.md +9 -1
  1249. package/src/feature-libraries/chunked-forest/basicChunk.ts +14 -9
  1250. package/src/feature-libraries/chunked-forest/chunk.ts +1 -1
  1251. package/src/feature-libraries/chunked-forest/chunkTree.ts +4 -4
  1252. package/src/feature-libraries/chunked-forest/chunkedForest.ts +8 -6
  1253. package/src/feature-libraries/chunked-forest/codec/chunkCodecUtilities.ts +2 -2
  1254. package/src/feature-libraries/chunked-forest/codec/chunkDecoding.ts +9 -6
  1255. package/src/feature-libraries/chunked-forest/uniformChunk.ts +6 -4
  1256. package/src/feature-libraries/default-schema/defaultEditBuilder.ts +18 -46
  1257. package/src/feature-libraries/default-schema/defaultFieldKinds.ts +11 -6
  1258. package/src/feature-libraries/default-schema/defaultSchema.ts +0 -1
  1259. package/src/feature-libraries/default-schema/index.ts +1 -1
  1260. package/src/feature-libraries/default-schema/schemaChecker.ts +6 -0
  1261. package/src/feature-libraries/editableTreeBinder.ts +6 -78
  1262. package/src/feature-libraries/fieldGenerator.ts +0 -3
  1263. package/src/feature-libraries/flex-map-tree/index.ts +2 -1
  1264. package/src/feature-libraries/flex-map-tree/mapTreeNode.ts +238 -288
  1265. package/src/feature-libraries/flex-tree/context.ts +0 -1
  1266. package/src/feature-libraries/flex-tree/flexTreeTypes.ts +27 -524
  1267. package/src/feature-libraries/flex-tree/index.ts +1 -18
  1268. package/src/feature-libraries/flex-tree/lazyField.ts +38 -214
  1269. package/src/feature-libraries/flex-tree/lazyNode.ts +3 -215
  1270. package/src/feature-libraries/flex-tree/treeEvents.ts +0 -2
  1271. package/src/feature-libraries/flex-tree/utilities.ts +6 -1
  1272. package/src/feature-libraries/forest-summary/codec.ts +3 -3
  1273. package/src/feature-libraries/index.ts +5 -49
  1274. package/src/feature-libraries/mapTreeCursor.ts +13 -4
  1275. package/src/feature-libraries/memoizedIdRangeAllocator.ts +0 -4
  1276. package/src/feature-libraries/modular-schema/crossFieldQueries.ts +0 -2
  1277. package/src/feature-libraries/modular-schema/discrepancies.ts +117 -1
  1278. package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +0 -8
  1279. package/src/feature-libraries/modular-schema/fieldKind.ts +1 -3
  1280. package/src/feature-libraries/modular-schema/genericFieldKind.ts +69 -92
  1281. package/src/feature-libraries/modular-schema/genericFieldKindCodecs.ts +7 -14
  1282. package/src/feature-libraries/modular-schema/genericFieldKindTypes.ts +6 -15
  1283. package/src/feature-libraries/modular-schema/index.ts +2 -2
  1284. package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +68 -34
  1285. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +330 -336
  1286. package/src/feature-libraries/modular-schema/modularChangeTypes.ts +7 -14
  1287. package/src/feature-libraries/node-key/nodeKey.ts +0 -4
  1288. package/src/feature-libraries/node-key/nodeKeyManager.ts +0 -1
  1289. package/src/feature-libraries/object-forest/objectForest.ts +1 -13
  1290. package/src/feature-libraries/schemaBuilderBase.ts +1 -49
  1291. package/src/feature-libraries/sequence-field/compose.ts +41 -20
  1292. package/src/feature-libraries/sequence-field/formatV2.ts +3 -3
  1293. package/src/feature-libraries/sequence-field/formatV3.ts +65 -0
  1294. package/src/feature-libraries/sequence-field/helperTypes.ts +33 -0
  1295. package/src/feature-libraries/sequence-field/index.ts +1 -0
  1296. package/src/feature-libraries/sequence-field/invert.ts +28 -18
  1297. package/src/feature-libraries/sequence-field/markQueue.ts +2 -2
  1298. package/src/feature-libraries/sequence-field/moveEffectTable.ts +2 -2
  1299. package/src/feature-libraries/sequence-field/rebase.ts +30 -13
  1300. package/src/feature-libraries/sequence-field/replaceRevisions.ts +27 -3
  1301. package/src/feature-libraries/sequence-field/sequenceFieldCodecV1.ts +52 -7
  1302. package/src/feature-libraries/sequence-field/sequenceFieldCodecV2.ts +92 -19
  1303. package/src/feature-libraries/sequence-field/sequenceFieldCodecV3.ts +134 -0
  1304. package/src/feature-libraries/sequence-field/sequenceFieldCodecs.ts +2 -0
  1305. package/src/feature-libraries/sequence-field/sequenceFieldToDelta.ts +8 -2
  1306. package/src/feature-libraries/sequence-field/types.ts +24 -4
  1307. package/src/feature-libraries/sequence-field/utils.ts +78 -50
  1308. package/src/feature-libraries/storedToViewSchema.ts +0 -1
  1309. package/src/feature-libraries/treeCursorUtils.ts +11 -11
  1310. package/src/feature-libraries/treeTextCursor.ts +0 -2
  1311. package/src/feature-libraries/typed-schema/flexList.ts +0 -3
  1312. package/src/feature-libraries/typed-schema/index.ts +0 -2
  1313. package/src/feature-libraries/typed-schema/schemaCollection.ts +0 -5
  1314. package/src/feature-libraries/typed-schema/typedTreeSchema.ts +2 -68
  1315. package/src/feature-libraries/typed-schema/view.ts +0 -1
  1316. package/src/index.ts +32 -242
  1317. package/src/internalTypes.ts +1 -0
  1318. package/src/packageVersion.ts +1 -1
  1319. package/src/shared-tree/schematizeTree.ts +25 -21
  1320. package/src/shared-tree/schematizingTreeView.ts +6 -6
  1321. package/src/shared-tree/sharedTree.ts +8 -39
  1322. package/src/shared-tree/sharedTreeChangeCodecs.ts +8 -0
  1323. package/src/shared-tree/sharedTreeChangeFamily.ts +3 -3
  1324. package/src/shared-tree/sharedTreeEditBuilder.ts +0 -2
  1325. package/src/shared-tree/treeApi.ts +3 -3
  1326. package/src/shared-tree/treeCheckout.ts +6 -8
  1327. package/src/shared-tree/treeView.ts +3 -6
  1328. package/src/shared-tree-core/branch.ts +20 -8
  1329. package/src/shared-tree-core/defaultResubmitMachine.ts +4 -4
  1330. package/src/shared-tree-core/editManagerCodecs.ts +1 -0
  1331. package/src/shared-tree-core/editManagerFormat.ts +7 -2
  1332. package/src/shared-tree-core/messageCodecs.ts +2 -1
  1333. package/src/shared-tree-core/sharedTreeCore.ts +5 -3
  1334. package/src/simple-tree/ProxyBinding.md +2 -0
  1335. package/src/simple-tree/api/README.md +7 -0
  1336. package/src/simple-tree/api/create.ts +179 -0
  1337. package/src/simple-tree/api/index.ts +36 -0
  1338. package/src/simple-tree/{schemaCreationUtilities.ts → api/schemaCreationUtilities.ts} +13 -5
  1339. package/src/simple-tree/{schemaFactory.ts → api/schemaFactory.ts} +36 -34
  1340. package/src/simple-tree/{schemaFactoryRecursive.ts → api/schemaFactoryRecursive.ts} +47 -10
  1341. package/src/simple-tree/{testRecursiveDomain.ts → api/testRecursiveDomain.ts} +3 -1
  1342. package/src/simple-tree/{tree.ts → api/tree.ts} +246 -34
  1343. package/src/simple-tree/{treeNodeApi.ts → api/treeNodeApi.ts} +84 -41
  1344. package/src/simple-tree/api/verboseTree.ts +415 -0
  1345. package/src/simple-tree/arrayNode.ts +103 -110
  1346. package/src/simple-tree/core/README.md +11 -0
  1347. package/src/simple-tree/core/index.ts +34 -0
  1348. package/src/simple-tree/{schemaCaching.ts → core/schemaCaching.ts} +3 -37
  1349. package/src/simple-tree/core/treeNodeKernel.ts +200 -0
  1350. package/src/simple-tree/core/treeNodeSchema.ts +184 -0
  1351. package/src/simple-tree/core/types.ts +281 -0
  1352. package/src/simple-tree/core/withType.ts +89 -0
  1353. package/src/simple-tree/getJsonSchema.ts +70 -0
  1354. package/src/simple-tree/getSimpleFieldSchema.ts +36 -0
  1355. package/src/simple-tree/getSimpleSchema.ts +69 -0
  1356. package/src/simple-tree/index.ts +59 -33
  1357. package/src/simple-tree/jsonSchema.ts +230 -0
  1358. package/src/simple-tree/leafNodeSchema.ts +6 -3
  1359. package/src/simple-tree/mapNode.ts +56 -55
  1360. package/src/simple-tree/objectNode.ts +66 -90
  1361. package/src/simple-tree/objectNodeTypes.ts +68 -0
  1362. package/src/simple-tree/proxies.ts +52 -68
  1363. package/src/simple-tree/proxyBinding.ts +127 -72
  1364. package/src/simple-tree/schemaTypes.ts +29 -194
  1365. package/src/simple-tree/simpleSchema.ts +138 -0
  1366. package/src/simple-tree/simpleSchemaToJsonSchema.ts +178 -0
  1367. package/src/simple-tree/toFlexSchema.ts +9 -42
  1368. package/src/simple-tree/toMapTree.ts +270 -296
  1369. package/src/simple-tree/{types.ts → treeNodeValid.ts} +16 -232
  1370. package/src/simple-tree/typesUnsafe.ts +51 -5
  1371. package/src/simple-tree/viewSchemaToSimpleSchema.ts +209 -0
  1372. package/src/util/brand.ts +1 -4
  1373. package/src/util/brandedMap.ts +0 -5
  1374. package/src/util/idAllocator.ts +0 -2
  1375. package/src/util/index.ts +2 -0
  1376. package/src/util/nestedMap.ts +23 -20
  1377. package/src/util/opaque.ts +0 -4
  1378. package/src/util/rangeMap.ts +5 -5
  1379. package/src/util/transactionResult.ts +0 -1
  1380. package/src/util/typeCheck.ts +2 -20
  1381. package/src/util/typeCheckTests.ts +4 -4
  1382. package/src/util/typeUtils.ts +0 -7
  1383. package/src/util/utils.ts +13 -8
  1384. package/tsconfig.json +0 -1
  1385. package/dist/feature-libraries/contextuallyTyped.d.ts +0 -209
  1386. package/dist/feature-libraries/contextuallyTyped.d.ts.map +0 -1
  1387. package/dist/feature-libraries/contextuallyTyped.js +0 -328
  1388. package/dist/feature-libraries/contextuallyTyped.js.map +0 -1
  1389. package/dist/feature-libraries/schema-aware/index.d.ts +0 -6
  1390. package/dist/feature-libraries/schema-aware/index.d.ts.map +0 -1
  1391. package/dist/feature-libraries/schema-aware/index.js.map +0 -1
  1392. package/dist/feature-libraries/schema-aware/schemaAware.d.ts +0 -76
  1393. package/dist/feature-libraries/schema-aware/schemaAware.d.ts.map +0 -1
  1394. package/dist/feature-libraries/schema-aware/schemaAware.js.map +0 -1
  1395. package/dist/simple-tree/nodeKeys.d.ts +0 -41
  1396. package/dist/simple-tree/nodeKeys.d.ts.map +0 -1
  1397. package/dist/simple-tree/nodeKeys.js +0 -7
  1398. package/dist/simple-tree/nodeKeys.js.map +0 -1
  1399. package/dist/simple-tree/schemaCaching.d.ts.map +0 -1
  1400. package/dist/simple-tree/schemaCaching.js.map +0 -1
  1401. package/dist/simple-tree/schemaCreationUtilities.d.ts.map +0 -1
  1402. package/dist/simple-tree/schemaCreationUtilities.js.map +0 -1
  1403. package/dist/simple-tree/schemaFactory.d.ts.map +0 -1
  1404. package/dist/simple-tree/schemaFactory.js.map +0 -1
  1405. package/dist/simple-tree/schemaFactoryRecursive.d.ts.map +0 -1
  1406. package/dist/simple-tree/schemaFactoryRecursive.js.map +0 -1
  1407. package/dist/simple-tree/testRecursiveDomain.d.ts +0 -61
  1408. package/dist/simple-tree/testRecursiveDomain.d.ts.map +0 -1
  1409. package/dist/simple-tree/testRecursiveDomain.js.map +0 -1
  1410. package/dist/simple-tree/tree.d.ts.map +0 -1
  1411. package/dist/simple-tree/tree.js +0 -73
  1412. package/dist/simple-tree/tree.js.map +0 -1
  1413. package/dist/simple-tree/treeNodeApi.d.ts.map +0 -1
  1414. package/dist/simple-tree/treeNodeApi.js.map +0 -1
  1415. package/dist/simple-tree/treeNodeKernel.d.ts +0 -26
  1416. package/dist/simple-tree/treeNodeKernel.d.ts.map +0 -1
  1417. package/dist/simple-tree/treeNodeKernel.js +0 -83
  1418. package/dist/simple-tree/treeNodeKernel.js.map +0 -1
  1419. package/dist/simple-tree/types.d.ts.map +0 -1
  1420. package/dist/simple-tree/types.js.map +0 -1
  1421. package/lib/feature-libraries/contextuallyTyped.d.ts +0 -209
  1422. package/lib/feature-libraries/contextuallyTyped.d.ts.map +0 -1
  1423. package/lib/feature-libraries/contextuallyTyped.js +0 -311
  1424. package/lib/feature-libraries/contextuallyTyped.js.map +0 -1
  1425. package/lib/feature-libraries/schema-aware/index.d.ts +0 -6
  1426. package/lib/feature-libraries/schema-aware/index.d.ts.map +0 -1
  1427. package/lib/feature-libraries/schema-aware/index.js +0 -6
  1428. package/lib/feature-libraries/schema-aware/index.js.map +0 -1
  1429. package/lib/feature-libraries/schema-aware/schemaAware.d.ts +0 -76
  1430. package/lib/feature-libraries/schema-aware/schemaAware.d.ts.map +0 -1
  1431. package/lib/feature-libraries/schema-aware/schemaAware.js.map +0 -1
  1432. package/lib/simple-tree/nodeKeys.d.ts +0 -41
  1433. package/lib/simple-tree/nodeKeys.d.ts.map +0 -1
  1434. package/lib/simple-tree/nodeKeys.js.map +0 -1
  1435. package/lib/simple-tree/schemaCaching.d.ts.map +0 -1
  1436. package/lib/simple-tree/schemaCaching.js.map +0 -1
  1437. package/lib/simple-tree/schemaCreationUtilities.d.ts.map +0 -1
  1438. package/lib/simple-tree/schemaCreationUtilities.js.map +0 -1
  1439. package/lib/simple-tree/schemaFactory.d.ts.map +0 -1
  1440. package/lib/simple-tree/schemaFactory.js.map +0 -1
  1441. package/lib/simple-tree/schemaFactoryRecursive.d.ts.map +0 -1
  1442. package/lib/simple-tree/schemaFactoryRecursive.js.map +0 -1
  1443. package/lib/simple-tree/testRecursiveDomain.d.ts +0 -61
  1444. package/lib/simple-tree/testRecursiveDomain.d.ts.map +0 -1
  1445. package/lib/simple-tree/testRecursiveDomain.js.map +0 -1
  1446. package/lib/simple-tree/tree.d.ts.map +0 -1
  1447. package/lib/simple-tree/tree.js +0 -66
  1448. package/lib/simple-tree/tree.js.map +0 -1
  1449. package/lib/simple-tree/treeNodeApi.d.ts.map +0 -1
  1450. package/lib/simple-tree/treeNodeApi.js.map +0 -1
  1451. package/lib/simple-tree/treeNodeKernel.d.ts +0 -26
  1452. package/lib/simple-tree/treeNodeKernel.d.ts.map +0 -1
  1453. package/lib/simple-tree/treeNodeKernel.js +0 -79
  1454. package/lib/simple-tree/treeNodeKernel.js.map +0 -1
  1455. package/lib/simple-tree/types.d.ts.map +0 -1
  1456. package/lib/simple-tree/types.js.map +0 -1
  1457. package/src/feature-libraries/contextuallyTyped.ts +0 -582
  1458. package/src/feature-libraries/schema-aware/README.md +0 -19
  1459. package/src/feature-libraries/schema-aware/index.ts +0 -16
  1460. package/src/feature-libraries/schema-aware/schemaAware.ts +0 -135
  1461. package/src/simple-tree/nodeKeys.ts +0 -42
  1462. package/src/simple-tree/treeNodeKernel.ts +0 -91
  1463. /package/dist/simple-tree/{testRecursiveDomain.js → api/testRecursiveDomain.js} +0 -0
  1464. /package/lib/simple-tree/{testRecursiveDomain.js → api/testRecursiveDomain.js} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"toMapTree.js","sourceRoot":"","sources":["../../src/simple-tree/toMapTree.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAC7D,uEAAsE;AAEtE,+CAO0B;AAC1B,4DASuC;AACvC,+CAAsE;AAEtE,2DAAiD;AAEjD,qDAa0B;AAC1B,4DAAuF;AACvF,uDAAmD;AAsCnD,SAAgB,kBAAkB,CACjC,IAAmC,EACnC,YAAkC,EAClC,OAAwB,EACxB,sBAAwC;IAExC,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACxB,OAAO,SAAS,CAAC;IAClB,CAAC;IACD,MAAM,aAAa,GAAG,iBAAiB,CACtC,IAAI,EACJ,IAAA,sCAAqB,EAAC,YAAY,CAAC,EACnC,sBAAsB,CACtB,CAAC;IACF,oBAAoB,CA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AC;YAC5E,MAAM;IACR,CAAC;AACF,CAAC;AAED,SAAS,cAAc,CACtB,aAA4B,EAC5B,OAAmC;IAEnC,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC3B,OAAO,aAAa,CAAC,OAAO,CAAC,CAAC;IAC/B,CAAC;SAAM,CAAC;QACP,IAAI,IAAA,2BAAU,EAAC,aAAa,CAAC,EAAE,CAAC;YAC/B,OAAO,aAAa,EAAE,CAAC;QACxB,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 { assert } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\tEmptyKey,\n\ttype FieldKey,\n\ttype MapTree,\n\ttype TreeValue,\n\ttype ValueSchema,\n\ttype SchemaAndPolicy,\n} from \"../core/index.js\";\nimport {\n\ttype CursorWithNode,\n\tcursorForMapTreeField,\n\tcursorForMapTreeNode,\n\tisTreeValue,\n\ttypeNameSymbol,\n\tvalueSchemaAllows,\n\ttype NodeKeyManager,\n\tisMapTreeNode,\n} from \"../feature-libraries/index.js\";\nimport { brand, fail, isReadonlyArray, find } from \"../util/index.js\";\n\nimport { nullSchema } from \"./leafNodeSchema.js\";\nimport type { InsertableContent } from \"./proxies.js\";\nimport {\n\tFieldKind,\n\tFieldSchema,\n\ttype ImplicitAllowedTypes,\n\ttype ImplicitFieldSchema,\n\tNodeKind,\n\ttype TreeNodeSchema,\n\tnormalizeAllowedTypes,\n\tnormalizeFieldSchema,\n\tgetStoredKey,\n\textractFieldProvider,\n\tisConstant,\n\ttype FieldProvider,\n} from \"./schemaTypes.js\";\nimport { SchemaValidationErrors, isNodeInSchema } from \"../feature-libraries/index.js\";\nimport { tryGetFlexNode } from \"./proxyBinding.js\";\n\n/**\n * Module notes:\n *\n * The flow of the below code is in terms of the structure of the input data. We then verify that the associated\n * schema is appropriate for that kind of data. This is fine while we have a 1:1 mapping of kind of input data to\n * the kind of schema we expect for it (e.g. an input that is an array always need to be associated with a sequence in\n * the schema). If/when we begin accepting kinds of input data that are ambiguous (e.g. accepting an input that is an\n * array of key/value tuples to instantiate a map) we may need to rethink the structure here to be based more on the\n * schema than on the input data.\n */\n\n/**\n * Transforms an input {@link TypedNode} tree to a {@link MapTree}, and wraps the tree in a {@link CursorWithNode}.\n * @param data - The input tree to be converted.\n * @param allowedTypes - The set of types allowed by the parent context. Used to validate the input tree.\n * @param context - An optional context which, if present, will allow defaults to be created by {@link ContextualFieldProvider}s.\n * If absent, only defaults from {@link ConstantFieldProvider}s will be created.\n * @param schemaValidationPolicy - The stored schema and policy to be used for validation, if the policy says schema\n * validation should happen. If it does, the input tree will be validated against this schema + policy, and an error will\n * be thrown if the tree does not conform to the schema. If undefined, no validation against the stored schema is done.\n *\n * @returns A cursor (in nodes mode) for the mapped tree if the input data was defined. Otherwise, returns `undefined`.\n * @remarks The resulting tree will be populated with any defaults from {@link FieldProvider}s in the schema.\n */\nexport function cursorFromNodeData(\n\tdata: InsertableContent,\n\tallowedTypes: ImplicitAllowedTypes,\n\tcontext?: NodeKeyManager,\n\tschemaValidationPolicy?: SchemaAndPolicy,\n): CursorWithNode<MapTree>;\nexport function cursorFromNodeData(\n\tdata: InsertableContent | undefined,\n\tallowedTypes: ImplicitAllowedTypes,\n\tcontext?: NodeKeyManager,\n\tschemaValidationPolicy?: SchemaAndPolicy,\n): CursorWithNode<MapTree> | undefined;\nexport function cursorFromNodeData(\n\tdata: InsertableContent | undefined,\n\tallowedTypes: ImplicitAllowedTypes,\n\tcontext?: NodeKeyManager,\n\tschemaValidationPolicy?: SchemaAndPolicy,\n): CursorWithNode<MapTree> | undefined {\n\tif (data === undefined) {\n\t\treturn undefined;\n\t}\n\tconst mappedContent = nodeDataToMapTree(\n\t\tdata,\n\t\tnormalizeAllowedTypes(allowedTypes),\n\t\tschemaValidationPolicy,\n\t);\n\taddDefaultsToMapTree(mappedContent, allowedTypes, context);\n\treturn cursorForMapTreeNode(mappedContent);\n}\n\n/**\n * Transforms an input {@link InsertableContent} tree to an array of {@link MapTree}s, and wraps the tree in a {@link CursorWithNode}.\n * @param data - The input tree to be converted.\n * @param schema - Schema of the field with which the input `data` is associated.\n * @param context - An optional context which, if present, will allow defaults to be created by {@link ContextualFieldProvider}s.\n * If absent, only defaults from {@link ConstantFieldProvider}s will be created.\n * @param schemaValidationPolicy - The stored schema and policy to be used for validation, if the policy says schema\n * validation should happen. If it does, the input tree will be validated against this schema + policy, and an error will\n * be thrown if the tree does not conform to the schema. If undefined, no validation against the stored schema is done.\n * @remarks The resulting tree will be populated with any defaults from {@link FieldProvider}s in the schema.\n */\nexport function cursorFromFieldData(\n\tdata: InsertableContent,\n\tschema: FieldSchema,\n\tcontext?: NodeKeyManager,\n\tschemaValidationPolicy?: SchemaAndPolicy,\n): CursorWithNode<MapTree>;\nexport function cursorFromFieldData(\n\tdata: InsertableContent | undefined,\n\tschema: FieldSchema,\n\tcontext?: NodeKeyManager,\n\tschemaValidationPolicy?: SchemaAndPolicy,\n): CursorWithNode<MapTree> | undefined;\nexport function cursorFromFieldData(\n\tdata: InsertableContent | undefined,\n\tschema: FieldSchema,\n\tcontext?: NodeKeyManager,\n\tschemaValidationPolicy?: SchemaAndPolicy,\n): CursorWithNode<MapTree> | undefined {\n\tif (data === undefined) {\n\t\treturn undefined;\n\t}\n\n\t// TODO: array node content should not go through here since sequence fields don't exist at this abstraction layer.\n\tconst mappedContent = Array.isArray(data)\n\t\t? arrayToMapTreeFields(data, schema.allowedTypeSet, schemaValidationPolicy)\n\t\t: [nodeDataToMapTree(data, schema.allowedTypeSet, schemaValidationPolicy)];\n\n\tfor (const content of mappedContent) {\n\t\taddDefaultsToMapTree(content, schema.allowedTypes, context);\n\t}\n\treturn cursorForMapTreeField(mappedContent);\n}\n\n/**\n * Transforms an input {@link TypedNode} tree to a {@link MapTree}.\n * @param data - The input tree to be converted.\n * If the data is an unsupported value (e.g. NaN), a fallback value will be used when supported,\n * otherwise an error will be thrown.\n *\n * Fallbacks:\n *\n * * `NaN` =\\> `null`\n *\n * * `+/-∞` =\\> `null`\n *\n * * `-0` =\\> `+0`\n *\n * @param allowedTypes - The set of types allowed by the parent context. Used to validate the input tree.\n * @param context - An optional context which, if present, will allow defaults to be created by {@link ContextualFieldProvider}s.\n * If absent, only defaults from {@link ConstantFieldProvider}s will be created.\n * @param schemaValidationPolicy - The stored schema and policy to be used for validation, if the policy says schema\n * validation should happen. If it does, the input tree will be validated against this schema + policy, and an error will\n * be thrown if the tree does not conform to the schema. If undefined, no validation against the stored schema is done.\n * @remarks The resulting tree will be populated with any defaults from {@link FieldProvider}s in the schema.\n */\nexport function mapTreeFromNodeData(\n\tdata: InsertableContent,\n\tallowedTypes: ImplicitAllowedTypes,\n\tcontext?: NodeKeyManager,\n\tschemaValidationPolicy?: SchemaAndPolicy,\n): MapTree;\nexport function mapTreeFromNodeData(\n\tdata: InsertableContent | undefined,\n\tallowedTypes: ImplicitAllowedTypes,\n\tcontext?: NodeKeyManager,\n\tschemaValidationPolicy?: SchemaAndPolicy,\n): MapTree | undefined;\nexport function mapTreeFromNodeData(\n\tdata: InsertableContent | undefined,\n\tallowedTypes: ImplicitAllowedTypes,\n\tcontext?: NodeKeyManager,\n\tschemaValidationPolicy?: SchemaAndPolicy,\n): MapTree | undefined {\n\tif (data === undefined) {\n\t\treturn undefined;\n\t}\n\n\tconst mapTree = nodeDataToMapTree(\n\t\tdata,\n\t\tnormalizeAllowedTypes(allowedTypes),\n\t\tschemaValidationPolicy,\n\t);\n\taddDefaultsToMapTree(mapTree, allowedTypes, context);\n\treturn mapTree;\n}\n\nfunction nodeDataToMapTree(\n\tdata: InsertableContent,\n\tallowedTypes: ReadonlySet<TreeNodeSchema>,\n\tschemaValidationPolicy: SchemaAndPolicy | undefined,\n): MapTree;\nfunction nodeDataToMapTree(\n\tdata: InsertableContent | undefined,\n\tallowedTypes: ReadonlySet<TreeNodeSchema>,\n\tschemaValidationPolicy: SchemaAndPolicy | undefined,\n): MapTree | undefined;\nfunction nodeDataToMapTree(\n\tdata: InsertableContent | undefined,\n\tallowedTypes: ReadonlySet<TreeNodeSchema>,\n\tschemaValidationPolicy: SchemaAndPolicy | undefined,\n): MapTree | undefined {\n\tif (data === undefined) {\n\t\treturn undefined;\n\t}\n\n\t// A special cache path for processing unhydrated nodes.\n\t// They already have the mapTree, so there is no need to recompute it.\n\tconst flexNode = tryGetFlexNode(data);\n\tif (flexNode !== undefined) {\n\t\tif (isMapTreeNode(flexNode)) {\n\t\t\treturn flexNode.mapTree;\n\t\t} else {\n\t\t\t// The node is already hydrated, meaning that it already got inserted into the tree previously\n\t\t\tthrow new UsageError(\"A node may not be inserted into the tree more than once\");\n\t\t}\n\t}\n\n\tconst schema = getType(data, allowedTypes);\n\n\tlet result: MapTree;\n\tswitch (schema.kind) {\n\t\tcase NodeKind.Leaf:\n\t\t\tresult = leafToMapTree(data, schema, allowedTypes);\n\t\t\tbreak;\n\t\tcase NodeKind.Array:\n\t\t\tresult = arrayToMapTree(data, schema);\n\t\t\tbreak;\n\t\tcase NodeKind.Map:\n\t\t\tresult = mapToMapTree(data, schema);\n\t\t\tbreak;\n\t\tcase NodeKind.Object:\n\t\t\tresult = objectToMapTree(data, schema);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tfail(`Unrecognized schema kind: ${schema.kind}.`);\n\t}\n\n\tif (schemaValidationPolicy?.policy.validateSchema === true) {\n\t\tconst maybeError = isNodeInSchema(result, schemaValidationPolicy);\n\t\tif (maybeError !== SchemaValidationErrors.NoError) {\n\t\t\tthrow new UsageError(\"Tree does not conform to schema.\");\n\t\t}\n\t}\n\n\treturn result;\n}\n\n/**\n * Transforms data under a Leaf schema.\n * @param data - The tree data to be transformed. Must be a {@link TreeValue}.\n * @param schema - The schema associated with the value.\n * @param allowedTypes - The allowed types specified by the parent.\n * Used to determine which fallback values may be appropriate.\n */\nfunction leafToMapTree(\n\tdata: InsertableContent,\n\tschema: TreeNodeSchema,\n\tallowedTypes: ReadonlySet<TreeNodeSchema>,\n): MapTree {\n\tassert(schema.kind === NodeKind.Leaf, 0x921 /* Expected a leaf schema. */);\n\tif (!isTreeValue(data)) {\n\t\t// This rule exists to protect against useless `toString` output like `[object Object]`.\n\t\t// In this case, that's actually reasonable behavior, since object input is not compatible with Leaf schemas.\n\t\t// eslint-disable-next-line @typescript-eslint/no-base-to-string\n\t\tthrow new UsageError(`Input data is incompatible with leaf schema: ${data}`);\n\t}\n\n\tconst mappedValue = mapValueWithFallbacks(data, allowedTypes);\n\tconst mappedSchema = getType(mappedValue, allowedTypes);\n\n\tassert(\n\t\tallowsValue(mappedSchema, mappedValue),\n\t\t0x84a /* Unsupported schema for provided primitive. */,\n\t);\n\n\treturn {\n\t\tvalue: mappedValue,\n\t\ttype: brand(mappedSchema.identifier),\n\t\tfields: new Map(),\n\t};\n}\n\n/**\n * Checks an incoming value to ensure it is compatible with our serialization format.\n * For unsupported values with a schema-compatible replacement, return the replacement value.\n * For unsupported values without a schema-compatible replacement, throw.\n * For supported values, return the input.\n */\nfunction mapValueWithFallbacks(\n\tvalue: TreeValue,\n\tallowedTypes: ReadonlySet<TreeNodeSchema>,\n): TreeValue {\n\tswitch (typeof value) {\n\t\tcase \"number\": {\n\t\t\tif (Object.is(value, -0)) {\n\t\t\t\t// Our serialized data format does not support -0.\n\t\t\t\t// Map such input to +0.\n\t\t\t\treturn 0;\n\t\t\t} else if (Number.isNaN(value) || !Number.isFinite(value)) {\n\t\t\t\t// Our serialized data format does not support NaN nor +/-∞.\n\t\t\t\t// If the schema supports `null`, fall back to that. Otherwise, throw.\n\t\t\t\t// This is intended to match JSON's behavior for such values.\n\t\t\t\tif (allowedTypes.has(nullSchema)) {\n\t\t\t\t\treturn null;\n\t\t\t\t} else {\n\t\t\t\t\tthrow new TypeError(`Received unsupported numeric value: ${value}.`);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn value;\n\t\t\t}\n\t\t}\n\t\tdefault:\n\t\t\treturn value;\n\t}\n}\n\n/**\n * Transforms data under an Array schema.\n * @param data - The tree data to be transformed.\n * @param allowedTypes - The set of types allowed by the parent context. Used to validate the input tree.\n * @param schemaValidationPolicy - The stored schema and policy to be used for validation, if the policy says schema\n * validation should happen. If it does, the input tree will be validated against this schema + policy, and an error will\n * be thrown if the tree does not conform to the schema. If undefined, no validation against the stored schema is done.\n */\nfunction arrayToMapTreeFields(\n\tdata: readonly InsertableContent[],\n\tallowedTypes: ReadonlySet<TreeNodeSchema>,\n\tschemaValidationPolicy: SchemaAndPolicy | undefined,\n): MapTree[] {\n\tconst mappedData: MapTree[] = [];\n\tfor (const child of data) {\n\t\t// We do not support undefined sequence entries.\n\t\t// If we encounter an undefined entry, use null instead if supported by the schema, otherwise throw.\n\t\tlet childWithFallback = child;\n\t\tif (child === undefined) {\n\t\t\tif (allowedTypes.has(nullSchema)) {\n\t\t\t\tchildWithFallback = null;\n\t\t\t} else {\n\t\t\t\tthrow new TypeError(`Received unsupported array entry value: ${child}.`);\n\t\t\t}\n\t\t}\n\t\tconst mappedChild = nodeDataToMapTree(\n\t\t\tchildWithFallback,\n\t\t\tallowedTypes,\n\t\t\tschemaValidationPolicy,\n\t\t);\n\t\tmappedData.push(mappedChild);\n\t}\n\n\treturn mappedData;\n}\n\n/**\n * Transforms data under an Array schema.\n * @param data - The tree data to be transformed. Must be an array.\n * @param schema - The schema associated with the value.\n * @param schemaValidationPolicy - The stored schema and policy to be used for validation, if the policy says schema\n * validation should happen. If it does, the input tree will be validated against this schema + policy, and an error will\n * be thrown if the tree does not conform to the schema. If undefined, no validation against the stored schema is done.\n */\nfunction arrayToMapTree(data: InsertableContent, schema: TreeNodeSchema): MapTree {\n\tassert(schema.kind === NodeKind.Array, 0x922 /* Expected an array schema. */);\n\tif (!isReadonlyArray(data)) {\n\t\tthrow new UsageError(`Input data is incompatible with Array schema: ${data}`);\n\t}\n\n\tconst allowedChildTypes = normalizeAllowedTypes(schema.info as ImplicitAllowedTypes);\n\n\tconst mappedData = arrayToMapTreeFields(data, allowedChildTypes, undefined);\n\n\t// Array node children are represented as a single field entry denoted with `EmptyKey`\n\tconst fieldsEntries: [FieldKey, MapTree[]][] =\n\t\tmappedData.length === 0 ? [] : [[EmptyKey, mappedData]];\n\tconst fields = new Map<FieldKey, MapTree[]>(fieldsEntries);\n\n\treturn {\n\t\ttype: brand(schema.identifier),\n\t\tfields,\n\t};\n}\n\n/**\n * Transforms data under a Map schema.\n * @param data - The tree data to be transformed. Must be a TypeScript Map.\n * @param schema - The schema associated with the value.\n * @param schemaValidationPolicy - The stored schema and policy to be used for validation, if the policy says schema\n * validation should happen. If it does, the input tree will be validated against this schema + policy, and an error will\n * be thrown if the tree does not conform to the schema. If undefined, no validation against the stored schema is done.\n */\nfunction mapToMapTree(data: InsertableContent, schema: TreeNodeSchema): MapTree {\n\tassert(schema.kind === NodeKind.Map, 0x923 /* Expected a Map schema. */);\n\tif (!(data instanceof Map)) {\n\t\tthrow new UsageError(`Input data is incompatible with Map schema: ${data}`);\n\t}\n\n\tconst allowedChildTypes = normalizeAllowedTypes(schema.info as ImplicitAllowedTypes);\n\n\tconst transformedFields = new Map<FieldKey, MapTree[]>();\n\tfor (const [key, value] of data) {\n\t\tassert(!transformedFields.has(brand(key)), 0x84c /* Keys should not be duplicated */);\n\n\t\t// Omit undefined values - an entry with an undefined value is equivalent to one that has been removed or omitted\n\t\tif (value !== undefined) {\n\t\t\tconst mappedField = nodeDataToMapTree(value, allowedChildTypes, undefined);\n\t\t\ttransformedFields.set(brand(key), [mappedField]);\n\t\t}\n\t}\n\n\treturn {\n\t\ttype: brand(schema.identifier),\n\t\tfields: transformedFields,\n\t};\n}\n\n/**\n * Transforms data under an Object schema.\n * @param data - The tree data to be transformed. Must be a Record-like object.\n * @param schema - The schema associated with the value.\n */\nfunction objectToMapTree(data: InsertableContent, schema: TreeNodeSchema): MapTree {\n\tassert(schema.kind === NodeKind.Object, 0x924 /* Expected an Object schema. */);\n\tif (typeof data !== \"object\" || data === null) {\n\t\tthrow new UsageError(`Input data is incompatible with Object schema: ${data}`);\n\t}\n\n\tconst fields = new Map<FieldKey, MapTree[]>();\n\n\t// Loop through field keys without data, and assign value from its default provider.\n\tfor (const key of Object.keys(schema.info as Record<string, ImplicitFieldSchema>)) {\n\t\tconst value = (data as Record<string, InsertableContent>)[key];\n\t\tif (value !== undefined && Object.hasOwnProperty.call(data, key)) {\n\t\t\tsetFieldValue(fields, value, getObjectFieldSchema(schema, key), key);\n\t\t}\n\t}\n\n\treturn {\n\t\ttype: brand(schema.identifier),\n\t\tfields,\n\t};\n}\n\nfunction setFieldValue(\n\tfields: Map<FieldKey, readonly MapTree[]>,\n\tfieldValue: InsertableContent | undefined,\n\tfieldSchema: FieldSchema,\n\tkey: string,\n): void {\n\tif (fieldValue !== undefined) {\n\t\tconst mappedChildTree = nodeDataToMapTree(\n\t\t\tfieldValue,\n\t\t\tfieldSchema.allowedTypeSet,\n\t\t\tundefined,\n\t\t);\n\t\tconst flexKey: FieldKey = brand(getStoredKey(key, fieldSchema));\n\n\t\tassert(!fields.has(flexKey), 0x956 /* Keys must not be duplicated */);\n\t\tfields.set(flexKey, [mappedChildTree]);\n\t}\n}\n\nfunction getObjectFieldSchema(schema: TreeNodeSchema, key: string): FieldSchema {\n\tassert(schema.kind === NodeKind.Object, 0x926 /* Expected an Object schema. */);\n\tconst fields = schema.info as Record<string, ImplicitFieldSchema>;\n\tif (fields[key] === undefined) {\n\t\tfail(`Field \"${key}\" not found in schema \"${schema.identifier}\".`);\n\t} else {\n\t\treturn normalizeFieldSchema(fields[key]);\n\t}\n}\n\nfunction getType(\n\tdata: InsertableContent,\n\tallowedTypes: ReadonlySet<TreeNodeSchema>,\n): TreeNodeSchema {\n\tconst possibleTypes = getPossibleTypes(allowedTypes, data as ContextuallyTypedNodeData);\n\tif (possibleTypes.length === 0) {\n\t\tthrow new UsageError(\n\t\t\t`The provided data is incompatible with all of the types allowed by the schema. The set of allowed types is: ${JSON.stringify(\n\t\t\t\t[...allowedTypes].map((schema) => schema.identifier),\n\t\t\t)}.`,\n\t\t);\n\t}\n\tassert(\n\t\tpossibleTypes.length !== 0,\n\t\t0x84e /* data is incompatible with all types allowed by the schema */,\n\t);\n\tcheckInput(\n\t\tpossibleTypes.length === 1,\n\t\t() =>\n\t\t\t`The provided data is compatible with more than one type allowed by the schema.\nThe set of possible types is ${JSON.stringify([\n\t\t\t\t...possibleTypes.map((schema) => schema.identifier),\n\t\t\t])}.\nExplicitly construct an unhydrated node of the desired type to disambiguate.\nFor class-based schema, this can be done by replacing an expression like \"{foo: 1}\" with \"new MySchema({foo: 1})\".`,\n\t);\n\treturn possibleTypes[0];\n}\n\n/**\n * An invalid tree has been provided, presumably by the user of this package.\n * Throw and an error that properly preserves the message (unlike asserts which will get hard to read short codes intended for package internal logic errors).\n */\nfunction invalidInput(message: string): never {\n\tthrow new UsageError(message);\n}\n\nfunction checkInput(condition: boolean, message: string | (() => string)): asserts condition {\n\tif (!condition) {\n\t\tinvalidInput(typeof message === \"string\" ? message : message());\n\t}\n}\n\n/**\n * @returns all types for which the data is schema-compatible.\n */\nexport function getPossibleTypes(\n\tallowedTypes: ReadonlySet<TreeNodeSchema>,\n\tdata: ContextuallyTypedNodeData,\n): TreeNodeSchema[] {\n\tconst possibleTypes: TreeNodeSchema[] = [];\n\tfor (const schema of allowedTypes) {\n\t\tif (shallowCompatibilityTest(schema, data)) {\n\t\t\tpossibleTypes.push(schema);\n\t\t}\n\t}\n\treturn possibleTypes;\n}\n\n/**\n * Checks if data might be schema-compatible.\n *\n * @returns false if `data` is incompatible with `type` based on a cheap/shallow check.\n *\n * Note that this may return true for cases where data is incompatible, but it must not return false in cases where the data is compatible.\n */\nfunction shallowCompatibilityTest(\n\tschema: TreeNodeSchema,\n\tdata: ContextuallyTypedNodeData,\n): boolean {\n\tassert(\n\t\tdata !== undefined,\n\t\t0x889 /* undefined cannot be used as contextually typed data. Use ContextuallyTypedFieldData. */,\n\t);\n\n\tif (isTreeValue(data)) {\n\t\treturn allowsValue(schema, data);\n\t}\n\tif (schema.kind === NodeKind.Leaf) {\n\t\treturn false;\n\t}\n\n\tif (typeNameSymbol in data) {\n\t\treturn data[typeNameSymbol] === schema.identifier;\n\t}\n\n\tif (isReadonlyArray(data)) {\n\t\treturn schema.kind === NodeKind.Array;\n\t}\n\tif (schema.kind === NodeKind.Array) {\n\t\treturn false;\n\t}\n\n\tif (data instanceof Map) {\n\t\treturn schema.kind === NodeKind.Map;\n\t}\n\tif (schema.kind === NodeKind.Map) {\n\t\treturn false;\n\t}\n\n\t// Assume record-like object\n\tif (schema.kind !== NodeKind.Object) {\n\t\treturn false;\n\t}\n\n\tconst fields = schema.info as Record<string, ImplicitFieldSchema>;\n\n\t// TODO: Improve type inference by making this logic more thorough. Handle at least:\n\t// * Types which are strict subsets of other types in the same polymorphic union\n\t// * Types which have the same keys but different types for those keys in the polymorphic union\n\t// * Types which have the same required fields but different optional fields and enough of those optional fields are populated to disambiguate\n\n\t// TODO#7441: Consider allowing data to be inserted which has keys that are extraneous/unknown to the schema (those keys are ignored)\n\n\t// If the schema has a required key which is not present in the input object, reject it.\n\tfor (const [fieldKey, fieldSchema] of Object.entries(fields)) {\n\t\tconst normalizedFieldSchema = normalizeFieldSchema(fieldSchema);\n\t\tif (data[fieldKey] === undefined && normalizedFieldSchema.kind === FieldKind.Required) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\treturn true;\n}\n\nfunction allowsValue(schema: TreeNodeSchema, value: TreeValue): boolean {\n\tif (schema.kind === NodeKind.Leaf) {\n\t\treturn valueSchemaAllows(schema.info as ValueSchema, value);\n\t}\n\treturn false;\n}\n\n/**\n * Content of a tree which needs external schema information to interpret.\n *\n * This format is intended for concise authoring of tree literals when the schema is statically known.\n *\n * Once schema aware APIs are implemented, they can be used to provide schema specific subsets of this type.\n */\nexport type ContextuallyTypedNodeData =\n\t| ContextuallyTypedNodeDataObject\n\t| number\n\t| string\n\t| boolean\n\t// eslint-disable-next-line @rushstack/no-new-null\n\t| null\n\t| readonly ContextuallyTypedNodeData[];\n\n/**\n * Content of a field which needs external schema information to interpret.\n *\n * This format is intended for concise authoring of tree literals when the schema is statically known.\n *\n * Once schema aware APIs are implemented, they can be used to provide schema specific subsets of this type.\n */\nexport type ContextuallyTypedFieldData = ContextuallyTypedNodeData | undefined;\n\n/**\n * Object case of {@link ContextuallyTypedNodeData}.\n */\nexport interface ContextuallyTypedNodeDataObject {\n\t/**\n\t * The type of the node.\n\t * If this node is well-formed, it must follow this schema.\n\t */\n\treadonly [typeNameSymbol]?: string;\n\n\t/**\n\t * Fields of this node, indexed by their field keys.\n\t *\n\t * Allow explicit undefined for compatibility with FlexTree, and type-safety on read.\n\t */\n\t// TODO: make sure explicit undefined is actually handled correctly.\n\t[key: FieldKey]: ContextuallyTypedFieldData;\n\n\t/**\n\t * Fields of this node, indexed by their field keys as strings.\n\t *\n\t * Allow unbranded field keys as a convenience for literals.\n\t */\n\t[key: string]: ContextuallyTypedFieldData;\n}\n\n/**\n * Walk the given {@link MapTree} and provide any field defaults for fields that are missing in the tree but present in the schema.\n * @param mapTree - The tree to populate with defaults\n * @param allowedTypes - Some {@link TreeNodeSchema}, at least one of which the input tree must conform to\n * @param context - An optional context for generating defaults.\n * If present, all applicable defaults will be provided.\n * If absent, only defaults produced by a {@link ConstantFieldProvider} will be provided, and defaults produced by a {@link ContextualFieldProvider} will be ignored.\n * @remarks This function mutates the input tree by adding new fields to the field maps where applicable.\n * @privateRemarks TODO: Create a more established type for mutable MapTrees, and use where appropriate.\n */\nfunction addDefaultsToMapTree(\n\tmapTree: MapTree,\n\tallowedTypes: ImplicitAllowedTypes,\n\tcontext: NodeKeyManager | undefined,\n): void {\n\tconst schema =\n\t\tfind(normalizeAllowedTypes(allowedTypes), (s) => s.identifier === mapTree.type) ??\n\t\tfail(\"MapTree is incompatible with schema\");\n\n\tswitch (schema.kind) {\n\t\tcase NodeKind.Array:\n\t\tcase NodeKind.Map:\n\t\t\t{\n\t\t\t\tfor (const field of mapTree.fields.values()) {\n\t\t\t\t\tfor (const child of field) {\n\t\t\t\t\t\taddDefaultsToMapTree(child, schema.info as ImplicitAllowedTypes, context);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\tcase NodeKind.Object:\n\t\t\t{\n\t\t\t\tfor (const [key, fieldSchema] of Object.entries(\n\t\t\t\t\tschema.info as Record<FieldKey, ImplicitFieldSchema>,\n\t\t\t\t) as [FieldKey, ImplicitFieldSchema][]) {\n\t\t\t\t\tconst field = mapTree.fields.get(key);\n\t\t\t\t\tif (field !== undefined) {\n\t\t\t\t\t\tfor (const child of field) {\n\t\t\t\t\t\t\taddDefaultsToMapTree(\n\t\t\t\t\t\t\t\tchild,\n\t\t\t\t\t\t\t\tgetObjectFieldSchema(schema, key).allowedTypes,\n\t\t\t\t\t\t\t\tcontext,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (fieldSchema instanceof FieldSchema) {\n\t\t\t\t\t\tconst defaultProvider = fieldSchema.props?.defaultProvider;\n\t\t\t\t\t\tif (defaultProvider !== undefined) {\n\t\t\t\t\t\t\tconst fieldProvider = extractFieldProvider(defaultProvider);\n\t\t\t\t\t\t\tconst data = provideDefault(fieldProvider, context);\n\t\t\t\t\t\t\tif (data !== undefined) {\n\t\t\t\t\t\t\t\tconst mutableMapTree = mapTree as typeof mapTree & {\n\t\t\t\t\t\t\t\t\tfields: Map<FieldKey, readonly MapTree[]>;\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\tsetFieldValue(mutableMapTree.fields, data, fieldSchema, key);\n\t\t\t\t\t\t\t\tfor (const child of mutableMapTree.fields.get(key) ??\n\t\t\t\t\t\t\t\t\tfail(\"Expected field to be populated\")) {\n\t\t\t\t\t\t\t\t\taddDefaultsToMapTree(child, fieldSchema.allowedTypes, context);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tassert(schema.kind === NodeKind.Leaf, 0x989 /* Unrecognized schema kind */);\n\t\t\tbreak;\n\t}\n}\n\nfunction provideDefault(\n\tfieldProvider: FieldProvider,\n\tcontext: NodeKeyManager | undefined,\n): InsertableContent | undefined {\n\tif (context !== undefined) {\n\t\treturn fieldProvider(context);\n\t} else {\n\t\tif (isConstant(fieldProvider)) {\n\t\t\treturn fieldProvider();\n\t\t}\n\t}\n}\n"]}
1
+ {"version":3,"file":"toMapTree.js","sourceRoot":"","sources":["../../src/simple-tree/toMapTree.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAAkE;AAClE,uEAAsE;AACtE,qEAAuE;AAEvE,+CAQ0B;AAC1B,4DAKuC;AACvC,+CAAsE;AAEtE,2DAAiD;AAEjD,qDAW0B;AAC1B,8CAAwF;AACxF,4DAAuF;AACvF,uDAAoD;AACpD,6DAA0D;AAgE1D,SAAgB,mBAAmB,CAClC,IAAmC,EACnC,YAAiC,EACjC,OAAwB,EACxB,sBAAwC;IAExC,MAAM,qBAAqB,GAAG,IAAA,qCAAoB,EAAC,YAAY,CAAC,CAAC;IAEjE,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACxB,+CAA+C;QAC/C,IAAI,qBAAqB,CAAC,IAAI,KAAK,0BAAS,CAAC,QAAQ,EAAE,CAAC;YACvD,MAAM,IAAI,qBAAU,CAAC,uCAAuC,CAAC,CAAC;QAC/D,CAAC;QACD,OAAO,SAAS,CAAC;IAClB,CAAC;IAED,MAAM,OAAO,GAAG,iBAAiB,CAAC,IAAI,EAAE,qBAAqB,CAAC,cAAc,CAAC,CAAC;IAC9E,uGAAuG;IACvG,oBAAoB,CAAC,OAAO,EAAE,qBAAqB,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IAE3E,QAAQ;IACR,4IAA4I;IAC5I,IAAI,sBAAsB,E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E,CAAC;gBACF,CAAC;YACF,CAAC;YACD,MAAM;QACP;YACC,IAAA,iBAAM,EAAC,MAAM,CAAC,IAAI,KAAK,mBAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,8BAA8B,CAAC,CAAC;YAC5E,MAAM;IACR,CAAC;AACF,CAAC;AAlDD,oDAkDC;AAED;;;;;GAKG;AACH,SAAS,cAAc,CACtB,aAA4B,EAC5B,OAAmC;IAEnC,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC3B,OAAO,aAAa,CAAC,OAAO,CAAC,CAAC;IAC/B,CAAC;SAAM,CAAC;QACP,IAAI,IAAA,2BAAU,EAAC,aAAa,CAAC,EAAE,CAAC;YAC/B,OAAO,aAAa,EAAE,CAAC;QACxB,CAAC;aAAM,CAAC;YACP,4GAA4G;YAC5G,sHAAsH;QACvH,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 { assert, oob } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\nimport { isFluidHandle } from \"@fluidframework/runtime-utils/internal\";\n\nimport {\n\tEmptyKey,\n\ttype FieldKey,\n\ttype MapTree,\n\ttype TreeValue,\n\ttype ValueSchema,\n\ttype SchemaAndPolicy,\n\ttype ExclusiveMapTree,\n} from \"../core/index.js\";\nimport {\n\tisTreeValue,\n\tvalueSchemaAllows,\n\ttype NodeKeyManager,\n\tisMapTreeNode,\n} from \"../feature-libraries/index.js\";\nimport { brand, fail, isReadonlyArray, find } from \"../util/index.js\";\n\nimport { nullSchema } from \"./leafNodeSchema.js\";\nimport type { InsertableContent } from \"./proxies.js\";\nimport {\n\ttype FieldSchema,\n\ttype ImplicitAllowedTypes,\n\tnormalizeAllowedTypes,\n\textractFieldProvider,\n\tisConstant,\n\ttype FieldProvider,\n\ttype ImplicitFieldSchema,\n\tnormalizeFieldSchema,\n\tFieldKind,\n\ttype TreeLeafValue,\n} from \"./schemaTypes.js\";\nimport { NodeKind, tryGetSimpleNodeSchema, type TreeNodeSchema } from \"./core/index.js\";\nimport { SchemaValidationErrors, isNodeInSchema } from \"../feature-libraries/index.js\";\nimport { tryGetInnerNode } from \"./proxyBinding.js\";\nimport { isObjectNodeSchema } from \"./objectNodeTypes.js\";\n\n/**\n * Module notes:\n *\n * The flow of the below code is in terms of the structure of the input data. We then verify that the associated\n * schema is appropriate for that kind of data. This is fine while we have a 1:1 mapping of kind of input data to\n * the kind of schema we expect for it (e.g. an input that is an array always need to be associated with a sequence in\n * the schema). If/when we begin accepting kinds of input data that are ambiguous (e.g. accepting an input that is an\n * array of key/value tuples to instantiate a map) we may need to rethink the structure here to be based more on the\n * schema than on the input data.\n */\n\n/**\n * Transforms an input {@link TypedNode} tree to a {@link MapTree}.\n * @param data - The input tree to be converted.\n * If the data is an unsupported value (e.g. NaN), a fallback value will be used when supported,\n * otherwise an error will be thrown.\n *\n * Fallbacks:\n *\n * * `NaN` =\\> `null`\n *\n * * `+/-∞` =\\> `null`\n *\n * * `-0` =\\> `+0`\n *\n * For fields with a default value, the field may be omitted.\n * If `context` is not provided, defaults which require a context will be left empty which can be out of schema.\n *\n * @param allowedTypes - The set of types allowed by the parent context. Used to validate the input tree.\n * @param context - An optional context which, if present, will allow defaults to be created by {@link ContextualFieldProvider}s.\n * If absent, only defaults from {@link ConstantFieldProvider}s will be created.\n * @param schemaValidationPolicy - The stored schema and policy to be used for validation, if the policy says schema\n * validation should happen. If it does, the input tree will be validated against this schema + policy, and an error will\n * be thrown if the tree does not conform to the schema. If undefined, no validation against the stored schema is done.\n *\n * TODO:BUG: AB#9131\n * This schema validation is done before defaults are provided.\n * This can not easily be fixed by reordering things within this implementation since even at the end of this function defaults requiring a context may not have been filled.\n * This means schema validation reject required fields getting their value from a default like identifier fields.\n *\n * @remarks The resulting tree will be populated with any defaults from {@link FieldProvider}s in the schema.\n *\n * @privateRemarks\n * TODO: AB#9126 AB#9131\n * When an app wants schema validation, we should ensure data is validated. Doing the validation here is not robust (since many callers to this don't have a context and thus can't opt into validation).\n * Additionally the validation here does not correctly handle default values, and introduces a second schema representation which is a bit odd API wise as its typically derivable from the view schema.\n * It may make more sense to validate when hydrating the MapTreeNode when the context is known and the defaults are available.\n * Applying the \"parse don't validate\" idiom here could help ensuring we capture when the validation optionally happens in the type system to avoid missing or redundant validation,\n * as well as ensuring validation happens after defaulting (or can handle validating data missing defaults)\n */\nexport function mapTreeFromNodeData(\n\tdata: InsertableContent,\n\tallowedTypes: ImplicitAllowedTypes,\n\tcontext?: NodeKeyManager,\n\tschemaValidationPolicy?: SchemaAndPolicy,\n): ExclusiveMapTree;\nexport function mapTreeFromNodeData(\n\tdata: InsertableContent | undefined,\n\tallowedTypes: ImplicitFieldSchema,\n\tcontext?: NodeKeyManager,\n\tschemaValidationPolicy?: SchemaAndPolicy,\n): ExclusiveMapTree | undefined;\nexport function mapTreeFromNodeData(\n\tdata: InsertableContent | undefined,\n\tallowedTypes: ImplicitFieldSchema,\n\tcontext?: NodeKeyManager,\n\tschemaValidationPolicy?: SchemaAndPolicy,\n): ExclusiveMapTree | undefined {\n\tconst normalizedFieldSchema = normalizeFieldSchema(allowedTypes);\n\n\tif (data === undefined) {\n\t\t// TODO: this code-path should support defaults\n\t\tif (normalizedFieldSchema.kind !== FieldKind.Optional) {\n\t\t\tthrow new UsageError(\"Got undefined for non-optional field.\");\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tconst mapTree = nodeDataToMapTree(data, normalizedFieldSchema.allowedTypeSet);\n\t// Add what defaults can be provided. If no `context` is providing, some defaults may still be missing.\n\taddDefaultsToMapTree(mapTree, normalizedFieldSchema.allowedTypes, context);\n\n\t// TODO:\n\t// Since some defaults may still be missing, this can give false positives when context is undefined but schemaValidationPolicy is provided.\n\tif (schemaValidationPolicy?.policy.validateSchema === true) {\n\t\tconst maybeError = isNodeInSchema(mapTree, schemaValidationPolicy);\n\t\tinSchemaOrThrow(maybeError);\n\t}\n\n\treturn mapTree;\n}\n\n/**\n * Copy content from `data` into a MapTree.\n * Does NOT generate and default values for fields.\n * Often throws UsageErrors for invalid data, but may miss some cases.\n * @remarks\n * Output is likely out of schema even for valid input due to missing defaults.\n */\nfunction nodeDataToMapTree(\n\tdata: InsertableContent,\n\tallowedTypes: ReadonlySet<TreeNodeSchema>,\n): ExclusiveMapTree {\n\t// A special cache path for processing unhydrated nodes.\n\t// They already have the mapTree, so there is no need to recompute it.\n\tconst flexNode = tryGetInnerNode(data);\n\tif (flexNode !== undefined) {\n\t\tif (isMapTreeNode(flexNode)) {\n\t\t\tif (\n\t\t\t\t!allowedTypes.has(tryGetSimpleNodeSchema(flexNode.schema) ?? fail(\"missing schema\"))\n\t\t\t) {\n\t\t\t\tthrow new UsageError(\"Invalid schema for this context.\");\n\t\t\t}\n\t\t\t// TODO: mapTreeFromNodeData modifies the trees it gets to add defaults.\n\t\t\t// Using a cached value here can result in this tree having defaults applied to it more than once.\n\t\t\t// This is unnecessary and inefficient, but should be a no-op if all calls provide the same context (which they might not).\n\t\t\t// A cleaner design (avoiding this cast) might be to apply defaults eagerly if they don't need a context, and lazily (when hydrating) if they do.\n\t\t\t// This could avoid having to mutate the map tree to apply defaults, removing the need for this cast.\n\t\t\treturn flexNode.mapTree as ExclusiveMapTree;\n\t\t} else {\n\t\t\t// The node is already hydrated, meaning that it already got inserted into the tree previously\n\t\t\tthrow new UsageError(\"A node may not be inserted into the tree more than once\");\n\t\t}\n\t}\n\n\tconst schema = getType(data, allowedTypes);\n\n\tlet result: ExclusiveMapTree;\n\tswitch (schema.kind) {\n\t\tcase NodeKind.Leaf:\n\t\t\tresult = leafToMapTree(data, schema, allowedTypes);\n\t\t\tbreak;\n\t\tcase NodeKind.Array:\n\t\t\tresult = arrayToMapTree(data, schema);\n\t\t\tbreak;\n\t\tcase NodeKind.Map:\n\t\t\tresult = mapToMapTree(data, schema);\n\t\t\tbreak;\n\t\tcase NodeKind.Object:\n\t\t\tresult = objectToMapTree(data, schema);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tfail(`Unrecognized schema kind: ${schema.kind}.`);\n\t}\n\n\treturn result;\n}\n\n/**\n * Throws a UsageError if maybeError indicates a tree is out of schema.\n */\nexport function inSchemaOrThrow(maybeError: SchemaValidationErrors): void {\n\tif (maybeError !== SchemaValidationErrors.NoError) {\n\t\tthrow new UsageError(\"Tree does not conform to schema.\");\n\t}\n}\n\n/**\n * Transforms data under a Leaf schema.\n * @param data - The tree data to be transformed. Must be a {@link TreeValue}.\n * @param schema - The schema associated with the value.\n * @param allowedTypes - The allowed types specified by the parent.\n * Used to determine which fallback values may be appropriate.\n */\nfunction leafToMapTree(\n\tdata: InsertableContent,\n\tschema: TreeNodeSchema,\n\tallowedTypes: ReadonlySet<TreeNodeSchema>,\n): ExclusiveMapTree {\n\tassert(schema.kind === NodeKind.Leaf, 0x921 /* Expected a leaf schema. */);\n\tif (!isTreeValue(data)) {\n\t\t// This rule exists to protect against useless `toString` output like `[object Object]`.\n\t\t// In this case, that's actually reasonable behavior, since object input is not compatible with Leaf schemas.\n\t\t// eslint-disable-next-line @typescript-eslint/no-base-to-string\n\t\tthrow new UsageError(`Input data is incompatible with leaf schema: ${data}`);\n\t}\n\n\tconst mappedValue = mapValueWithFallbacks(data, allowedTypes);\n\tconst mappedSchema = getType(mappedValue, allowedTypes);\n\n\tassert(\n\t\tallowsValue(mappedSchema, mappedValue),\n\t\t0x84a /* Unsupported schema for provided primitive. */,\n\t);\n\n\treturn {\n\t\tvalue: mappedValue,\n\t\ttype: brand(mappedSchema.identifier),\n\t\tfields: new Map(),\n\t};\n}\n\n/**\n * Checks an incoming {@link TreeLeafValue} to ensure it is compatible with its requirements.\n * For unsupported values with a schema-compatible replacement, return the replacement value.\n * For unsupported values without a schema-compatible replacement, throw.\n * For supported values, return the input.\n */\nfunction mapValueWithFallbacks(\n\tvalue: TreeLeafValue,\n\tallowedTypes: ReadonlySet<TreeNodeSchema>,\n): TreeValue {\n\tswitch (typeof value) {\n\t\tcase \"number\": {\n\t\t\tif (Object.is(value, -0)) {\n\t\t\t\t// Our serialized data format does not support -0.\n\t\t\t\t// Map such input to +0.\n\t\t\t\treturn 0;\n\t\t\t} else if (Number.isNaN(value) || !Number.isFinite(value)) {\n\t\t\t\t// Our serialized data format does not support NaN nor +/-∞.\n\t\t\t\t// If the schema supports `null`, fall back to that. Otherwise, throw.\n\t\t\t\t// This is intended to match JSON's behavior for such values.\n\t\t\t\tif (allowedTypes.has(nullSchema)) {\n\t\t\t\t\treturn null;\n\t\t\t\t} else {\n\t\t\t\t\tthrow new TypeError(`Received unsupported numeric value: ${value}.`);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn value;\n\t\t\t}\n\t\t}\n\t\tcase \"string\":\n\t\t// TODO:\n\t\t// This should detect invalid strings. Something like @stdlib/regexp-utf16-unpaired-surrogate could be used to do this.\n\t\t// See SchemaFactory.string for details.\n\t\tcase \"boolean\":\n\t\t\treturn value;\n\t\tcase \"object\": {\n\t\t\tif (value === null || isFluidHandle(value)) {\n\t\t\t\treturn value;\n\t\t\t}\n\t\t}\n\t\tdefault:\n\t\t\tthrow new TypeError(`Received unsupported leaf value: ${value}.`);\n\t}\n}\n\n/**\n * Transforms data under an Array schema.\n * @param data - The tree data to be transformed.\n * @param allowedTypes - The set of types allowed by the parent context. Used to validate the input tree.\n */\nfunction arrayChildToMapTree(\n\tchild: InsertableContent,\n\tallowedTypes: ReadonlySet<TreeNodeSchema>,\n): ExclusiveMapTree {\n\t// We do not support undefined sequence entries.\n\t// If we encounter an undefined entry, use null instead if supported by the schema, otherwise throw.\n\tlet childWithFallback = child;\n\tif (child === undefined) {\n\t\tif (allowedTypes.has(nullSchema)) {\n\t\t\tchildWithFallback = null;\n\t\t} else {\n\t\t\tthrow new TypeError(`Received unsupported array entry value: ${child}.`);\n\t\t}\n\t}\n\treturn nodeDataToMapTree(childWithFallback, allowedTypes);\n}\n\n/**\n * Transforms data under an Array schema.\n * @param data - The tree data to be transformed. Must be an iterable.\n * @param schema - The schema associated with the value.\n * @param schemaValidationPolicy - The stored schema and policy to be used for validation, if the policy says schema\n * validation should happen. If it does, the input tree will be validated against this schema + policy, and an error will\n * be thrown if the tree does not conform to the schema. If undefined, no validation against the stored schema is done.\n */\nfunction arrayToMapTree(data: InsertableContent, schema: TreeNodeSchema): ExclusiveMapTree {\n\tassert(schema.kind === NodeKind.Array, 0x922 /* Expected an array schema. */);\n\tif (!(typeof data === \"object\" && data !== null && Symbol.iterator in data)) {\n\t\tthrow new UsageError(`Input data is incompatible with Array schema: ${data}`);\n\t}\n\n\tconst allowedChildTypes = normalizeAllowedTypes(schema.info as ImplicitAllowedTypes);\n\n\tconst mappedData = Array.from(data, (child) =>\n\t\tarrayChildToMapTree(child, allowedChildTypes),\n\t);\n\n\t// Array nodes have a single `EmptyKey` field:\n\tconst fieldsEntries = mappedData.length === 0 ? [] : ([[EmptyKey, mappedData]] as const);\n\n\treturn {\n\t\ttype: brand(schema.identifier),\n\t\tfields: new Map(fieldsEntries),\n\t};\n}\n\n/**\n * Transforms data under a Map schema.\n * @param data - The tree data to be transformed. Must be an iterable.\n * @param schema - The schema associated with the value.\n * @param schemaValidationPolicy - The stored schema and policy to be used for validation, if the policy says schema\n * validation should happen. If it does, the input tree will be validated against this schema + policy, and an error will\n * be thrown if the tree does not conform to the schema. If undefined, no validation against the stored schema is done.\n */\nfunction mapToMapTree(data: InsertableContent, schema: TreeNodeSchema): ExclusiveMapTree {\n\tassert(schema.kind === NodeKind.Map, 0x923 /* Expected a Map schema. */);\n\tif (!(typeof data === \"object\" && data !== null)) {\n\t\tthrow new UsageError(`Input data is incompatible with Map schema: ${data}`);\n\t}\n\n\tconst allowedChildTypes = normalizeAllowedTypes(schema.info as ImplicitAllowedTypes);\n\n\tconst fieldsIterator = (\n\t\tSymbol.iterator in data\n\t\t\t? // Support iterables of key value pairs (including Map objects)\n\t\t\t\tdata\n\t\t\t: // Support record objects for JSON style Map data\n\t\t\t\tObject.entries(data)\n\t) as Iterable<readonly [string, InsertableContent]>;\n\n\tconst transformedFields = new Map<FieldKey, ExclusiveMapTree[]>();\n\tfor (const item of fieldsIterator) {\n\t\tif (!isReadonlyArray(item) || item.length !== 2 || typeof item[0] !== \"string\") {\n\t\t\tthrow new UsageError(`Input data is incompatible with map entry: ${item}`);\n\t\t}\n\t\tconst [key, value] = item;\n\t\tassert(!transformedFields.has(brand(key)), 0x84c /* Keys should not be duplicated */);\n\n\t\t// Omit undefined values - an entry with an undefined value is equivalent to one that has been removed or omitted\n\t\tif (value !== undefined) {\n\t\t\tconst mappedField = nodeDataToMapTree(value, allowedChildTypes);\n\t\t\ttransformedFields.set(brand(key), [mappedField]);\n\t\t}\n\t}\n\n\treturn {\n\t\ttype: brand(schema.identifier),\n\t\tfields: transformedFields,\n\t};\n}\n\n/**\n * Transforms data under an Object schema.\n * @param data - The tree data to be transformed. Must be a Record-like object.\n * @param schema - The schema associated with the value.\n */\nfunction objectToMapTree(data: InsertableContent, schema: TreeNodeSchema): ExclusiveMapTree {\n\tassert(isObjectNodeSchema(schema), 0x924 /* Expected an Object schema. */);\n\tif (typeof data !== \"object\" || data === null) {\n\t\tthrow new UsageError(`Input data is incompatible with Object schema: ${data}`);\n\t}\n\n\tconst fields = new Map<FieldKey, ExclusiveMapTree[]>();\n\n\t// Loop through field keys without data.\n\t// This does NOT apply defaults.\n\tfor (const [key, fieldInfo] of schema.flexKeyMap) {\n\t\tif (Object.hasOwnProperty.call(data, key)) {\n\t\t\tconst value = (data as Record<string, InsertableContent>)[key as string];\n\t\t\tsetFieldValue(fields, value, fieldInfo.schema, fieldInfo.storedKey);\n\t\t}\n\t}\n\n\treturn {\n\t\ttype: brand(schema.identifier),\n\t\tfields,\n\t};\n}\n\nfunction setFieldValue(\n\tfields: Map<FieldKey, readonly MapTree[]>,\n\tfieldValue: InsertableContent | undefined,\n\tfieldSchema: FieldSchema,\n\tflexKey: FieldKey,\n): void {\n\tif (fieldValue !== undefined) {\n\t\tconst mappedChildTree = nodeDataToMapTree(fieldValue, fieldSchema.allowedTypeSet);\n\n\t\tassert(!fields.has(flexKey), 0x956 /* Keys must not be duplicated */);\n\t\tfields.set(flexKey, [mappedChildTree]);\n\t}\n}\n\nfunction getType(\n\tdata: InsertableContent,\n\tallowedTypes: ReadonlySet<TreeNodeSchema>,\n): TreeNodeSchema {\n\tconst possibleTypes = getPossibleTypes(allowedTypes, data as ContextuallyTypedNodeData);\n\tif (possibleTypes.length === 0) {\n\t\tthrow new UsageError(\n\t\t\t`The provided data is incompatible with all of the types allowed by the schema. The set of allowed types is: ${JSON.stringify(\n\t\t\t\t[...allowedTypes].map((schema) => schema.identifier),\n\t\t\t)}.`,\n\t\t);\n\t}\n\tassert(\n\t\tpossibleTypes.length !== 0,\n\t\t0x84e /* data is incompatible with all types allowed by the schema */,\n\t);\n\tif (possibleTypes.length !== 1) {\n\t\tthrow new UsageError(\n\t\t\t`The provided data is compatible with more than one type allowed by the schema.\nThe set of possible types is ${JSON.stringify([\n\t\t\t\t...possibleTypes.map((schema) => schema.identifier),\n\t\t\t])}.\nExplicitly construct an unhydrated node of the desired type to disambiguate.\nFor class-based schema, this can be done by replacing an expression like \"{foo: 1}\" with \"new MySchema({foo: 1})\".`,\n\t\t);\n\t}\n\treturn possibleTypes[0] ?? oob();\n}\n\n/**\n * @returns all types for which the data is schema-compatible.\n */\nexport function getPossibleTypes(\n\tallowedTypes: ReadonlySet<TreeNodeSchema>,\n\tdata: ContextuallyTypedNodeData,\n): TreeNodeSchema[] {\n\tlet best = CompatibilityLevel.None;\n\tconst possibleTypes: TreeNodeSchema[] = [];\n\tfor (const schema of allowedTypes) {\n\t\tconst level = shallowCompatibilityTest(schema, data);\n\t\tif (level > best) {\n\t\t\tpossibleTypes.length = 0;\n\t\t\tbest = level;\n\t\t}\n\t\tif (best === level) {\n\t\t\tpossibleTypes.push(schema);\n\t\t}\n\t}\n\treturn best === CompatibilityLevel.None ? [] : possibleTypes;\n}\n\n/**\n * Indicates a compatibility level for inferring a schema to apply to insertable data.\n * @remarks\n * Only the highest compatibility options are used.\n * This approach allows adding new possible matching at a new lower compatibility level as a non breaking change,\n * since that way they can't make a case that was compatible before ambiguous now.\n */\nenum CompatibilityLevel {\n\t/**\n\t * Not compatible. Constructor typing indicates incompatibility.\n\t */\n\tNone = 0,\n\t/**\n\t * Additional compatibility cases added in Fluid Framework 2.2.\n\t */\n\tLow = 1,\n\t/**\n\t * Compatible in Fluid Framework 2.0.\n\t */\n\tNormal = 2,\n}\n\n/**\n * Checks if data might be schema-compatible.\n *\n * @returns false if `data` is incompatible with `type` based on a cheap/shallow check.\n *\n * Note that this may return true for cases where data is incompatible, but it must not return false in cases where the data is compatible.\n */\nfunction shallowCompatibilityTest(\n\tschema: TreeNodeSchema,\n\tdata: ContextuallyTypedNodeData,\n): CompatibilityLevel {\n\tassert(\n\t\tdata !== undefined,\n\t\t0x889 /* undefined cannot be used as contextually typed data. Use ContextuallyTypedFieldData. */,\n\t);\n\n\tif (isTreeValue(data)) {\n\t\treturn allowsValue(schema, data) ? CompatibilityLevel.Normal : CompatibilityLevel.None;\n\t}\n\tif (schema.kind === NodeKind.Leaf) {\n\t\treturn CompatibilityLevel.None;\n\t}\n\n\t// Typing (of schema based constructors and thus implicit node construction)\n\t// allows iterables for constructing maps and arrays.\n\t// Some users of this API may have unions of maps and arrays,\n\t// and rely on Arrays ending up as array nodes and maps as Map nodes,\n\t// despite both being iterable and thus compatible with both.\n\t// This uses a priority based system where an array would be parsed as an array when unioned with a map,\n\t// but if in a map only context, could still be used as a map.\n\n\tif (data instanceof Map) {\n\t\tswitch (schema.kind) {\n\t\t\tcase NodeKind.Map:\n\t\t\t\treturn CompatibilityLevel.Normal;\n\t\t\tcase NodeKind.Array:\n\t\t\t\t// Maps are iterable, so type checking does allow constructing an ArrayNode from a map if the array's type is an array that includes the key and value types of the map.\n\t\t\t\treturn CompatibilityLevel.Low;\n\t\t\tdefault:\n\t\t\t\treturn CompatibilityLevel.None;\n\t\t}\n\t}\n\n\tif (isReadonlyArray(data)) {\n\t\tswitch (schema.kind) {\n\t\t\tcase NodeKind.Array:\n\t\t\t\treturn CompatibilityLevel.Normal;\n\t\t\tcase NodeKind.Map:\n\t\t\t\t// Arrays are iterable, so type checking does allow constructing an array from a MapNode from an if the array's type is key values pairs for the map.\n\t\t\t\treturn CompatibilityLevel.Low;\n\t\t\tdefault:\n\t\t\t\treturn CompatibilityLevel.None;\n\t\t}\n\t}\n\n\tconst mapOrArray = schema.kind === NodeKind.Array || schema.kind === NodeKind.Map;\n\n\tif (Symbol.iterator in data) {\n\t\treturn mapOrArray ? CompatibilityLevel.Normal : CompatibilityLevel.None;\n\t}\n\n\t// At this point, it is assumed data is a record-like object since all the other cases have been eliminated.\n\n\tif (schema.kind === NodeKind.Array) {\n\t\treturn CompatibilityLevel.None;\n\t}\n\n\tif (schema.kind === NodeKind.Map) {\n\t\t// When not unioned with an ObjectNode, allow objects to be used to create maps.\n\t\treturn CompatibilityLevel.Low;\n\t}\n\n\tassert(isObjectNodeSchema(schema), 0x9e6 /* unexpected schema kind */);\n\n\t// TODO: Improve type inference by making this logic more thorough. Handle at least:\n\t// * Types which are strict subsets of other types in the same polymorphic union\n\t// * Types which have the same keys but different types for those keys in the polymorphic union\n\t// * Types which have the same required fields but different optional fields and enough of those optional fields are populated to disambiguate\n\n\t// TODO#7441: Consider allowing data to be inserted which has keys that are extraneous/unknown to the schema (those keys are ignored)\n\n\t// If the schema has a required key which is not present in the input object, reject it.\n\tfor (const [fieldKey, fieldSchema] of schema.fields) {\n\t\tif (data[fieldKey] === undefined && fieldSchema.requiresValue) {\n\t\t\treturn CompatibilityLevel.None;\n\t\t}\n\t}\n\n\treturn CompatibilityLevel.Normal;\n}\n\nfunction allowsValue(schema: TreeNodeSchema, value: TreeValue): boolean {\n\tif (schema.kind === NodeKind.Leaf) {\n\t\treturn valueSchemaAllows(schema.info as ValueSchema, value);\n\t}\n\treturn false;\n}\n\n/**\n * Content of a tree which needs external schema information to interpret.\n *\n * This format is intended for concise authoring of tree literals when the schema is statically known.\n *\n * Once schema aware APIs are implemented, they can be used to provide schema specific subsets of this type.\n */\nexport type ContextuallyTypedNodeData =\n\t| ContextuallyTypedNodeDataObject\n\t| number\n\t| string\n\t| boolean\n\t// eslint-disable-next-line @rushstack/no-new-null\n\t| null\n\t| readonly ContextuallyTypedNodeData[]\n\t| ReadonlyMap<string, ContextuallyTypedNodeData>\n\t| Iterable<ContextuallyTypedNodeData>\n\t| Iterable<[string, ContextuallyTypedNodeData]>;\n\n/**\n * Content of a field which needs external schema information to interpret.\n *\n * This format is intended for concise authoring of tree literals when the schema is statically known.\n *\n * Once schema aware APIs are implemented, they can be used to provide schema specific subsets of this type.\n */\nexport type ContextuallyTypedFieldData = ContextuallyTypedNodeData | undefined;\n\n/**\n * Object case of {@link ContextuallyTypedNodeData}.\n */\nexport interface ContextuallyTypedNodeDataObject {\n\t/**\n\t * Fields of this node, indexed by their field keys.\n\t *\n\t * Allow explicit undefined for compatibility with FlexTree, and type-safety on read.\n\t */\n\t// TODO: make sure explicit undefined is actually handled correctly.\n\t[key: FieldKey]: ContextuallyTypedFieldData;\n\n\t/**\n\t * Fields of this node, indexed by their field keys as strings.\n\t *\n\t * Allow unbranded field keys as a convenience for literals.\n\t */\n\t[key: string]: ContextuallyTypedFieldData;\n}\n\n/**\n * Walk the given {@link ExclusiveMapTree} and deeply provide any field defaults for fields that are missing in the tree but present in the schema.\n * @param mapTree - The tree to populate with defaults. This is borrowed: no references to it are kept by this function.\n * @param allowedTypes - Some {@link TreeNodeSchema}, at least one of which the input tree must conform to\n * @param context - An optional context for generating defaults.\n * If present, all applicable defaults will be provided.\n * If absent, only defaults produced by a {@link ConstantFieldProvider} will be provided, and defaults produced by a {@link ContextualFieldProvider} will be ignored.\n * @remarks This function mutates the input tree by deeply adding new fields to the field maps where applicable.\n */\nexport function addDefaultsToMapTree(\n\tmapTree: ExclusiveMapTree,\n\tallowedTypes: ImplicitAllowedTypes,\n\tcontext: NodeKeyManager | undefined,\n): void {\n\tconst schema =\n\t\tfind(normalizeAllowedTypes(allowedTypes), (s) => s.identifier === mapTree.type) ??\n\t\tfail(\"MapTree is incompatible with schema\");\n\n\tif (isObjectNodeSchema(schema)) {\n\t\tfor (const [_key, fieldInfo] of schema.flexKeyMap) {\n\t\t\tconst field = mapTree.fields.get(fieldInfo.storedKey);\n\t\t\tif (field !== undefined) {\n\t\t\t\tfor (const child of field) {\n\t\t\t\t\taddDefaultsToMapTree(child, fieldInfo.schema.allowedTypes, context);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst defaultProvider = fieldInfo.schema.props?.defaultProvider;\n\t\t\t\tif (defaultProvider !== undefined) {\n\t\t\t\t\tconst fieldProvider = extractFieldProvider(defaultProvider);\n\t\t\t\t\tconst data = provideDefault(fieldProvider, context);\n\t\t\t\t\tif (data !== undefined) {\n\t\t\t\t\t\tsetFieldValue(mapTree.fields, data, fieldInfo.schema, fieldInfo.storedKey);\n\t\t\t\t\t\t// call addDefaultsToMapTree on newly inserted default values\n\t\t\t\t\t\tfor (const child of mapTree.fields.get(fieldInfo.storedKey) ??\n\t\t\t\t\t\t\tfail(\"Expected field to be populated\")) {\n\t\t\t\t\t\t\taddDefaultsToMapTree(child, fieldInfo.schema.allowedTypes, context);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn;\n\t}\n\n\tswitch (schema.kind) {\n\t\tcase NodeKind.Array:\n\t\tcase NodeKind.Map:\n\t\t\t{\n\t\t\t\tfor (const field of mapTree.fields.values()) {\n\t\t\t\t\tfor (const child of field) {\n\t\t\t\t\t\taddDefaultsToMapTree(child, schema.info as ImplicitAllowedTypes, context);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tassert(schema.kind === NodeKind.Leaf, 0x989 /* Unrecognized schema kind */);\n\t\t\tbreak;\n\t}\n}\n\n/**\n * Provides the default value (which can be undefined, for example with optional fields), or undefined if a context is required but not provided.\n * @privateRemarks\n * It is a bit concerning that there is no way for the caller to know when undefined is returned if that is the default value, or a context was required.\n * TODO: maybe better formalize the two stage defaulting (without then with context), or rework this design we only do one stage.\n */\nfunction provideDefault(\n\tfieldProvider: FieldProvider,\n\tcontext: NodeKeyManager | undefined,\n): InsertableContent | undefined {\n\tif (context !== undefined) {\n\t\treturn fieldProvider(context);\n\t} else {\n\t\tif (isConstant(fieldProvider)) {\n\t\t\treturn fieldProvider();\n\t\t} else {\n\t\t\t// Leaving field empty despite it needing a default value since a context was required and non was provided.\n\t\t\t// Caller better handle this case by providing the default at some other point in time when the context becomes known.\n\t\t}\n\t}\n}\n"]}
@@ -0,0 +1,74 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { type TreeNodeSchema, TreeNode, type InternalTreeNode } from "./core/index.js";
6
+ import { type FlexTreeNode, type MapTreeNode } from "../feature-libraries/index.js";
7
+ /**
8
+ * Class which all {@link TreeNode}s must extend.
9
+ * Since this is not exported, it allows robust detection of attempts to create TreeNodes which do not go through SchemaFactory which is the only place which exposes classes that extend this.
10
+ *
11
+ * This has static members which schema classes can override to provide schema specific functionality.
12
+ * These static members are only intended to be used / overridden by code within this package, and are used by the various node kinds.
13
+ * Access to these static members has to be done via `this.constructor.staticMember` to support the overrides, and thus can only be used in the constructor, after the base constructor has been invoked.
14
+ */
15
+ export declare abstract class TreeNodeValid<TInput> extends TreeNode {
16
+ /**
17
+ * Schema classes can override this to control what happens at the end of the constructor.
18
+ * The return value from this is returned from the constructor, allowing substituting a proxy if desired.
19
+ *
20
+ * This is not simply done in the derived constructor to enable:
21
+ * - this class to access the value which is being returned before it's returned from the constructor.
22
+ * - the derived class to be provided the input `FlexTreeNode` without relying on a field on the node to hold it.
23
+ */
24
+ protected static prepareInstance<T>(this: typeof TreeNodeValid<T>, instance: TreeNodeValid<T>, input: FlexTreeNode): TreeNodeValid<T>;
25
+ /**
26
+ * Schema classes must override to provide an implementation of RawTreeNode construction.
27
+ */
28
+ protected static buildRawNode<T>(this: typeof TreeNodeValid<T>, instance: TreeNodeValid<T>, input: T): MapTreeNode;
29
+ /**
30
+ * Schema classes can override to provide a callback that is called once when the first node is constructed.
31
+ * This is a good place to perform extra validation and cache schema derived data needed for the implementation of the node.
32
+ */
33
+ protected static oneTimeSetup<T>(this: typeof TreeNodeValid<T>): void;
34
+ /**
35
+ * The most derived constructor (the one invoked with the `new` operator, not a parent class constructor invoked with as `super`) used to construct an instance of this type.
36
+ * @remarks
37
+ * Captured when an instance is constructed.
38
+ *
39
+ * Used to ensure that some derived class (which must override this member, defaulting it to `undefined`) is only instantiated with a single "most derived" class (the constructor actually invoked the the user with `new`).
40
+ *
41
+ * Typically this is override in the class that statically implements {@link TreeNodeSchema} to enforce that all nodes using that schema use the same class and not different subclasses of it.
42
+ *
43
+ * Also used to detect if oneTimeSetup has run.
44
+ *
45
+ * @privateRemarks
46
+ * This defaults to "default", which is used to trigger an error if not overridden in the derived class.
47
+ *
48
+ * The value of this on TreeNodeValid must only be overridden by base classes and never modified.
49
+ * Ways to enforce this immutability prevent it from being overridden,
50
+ * so code modifying constructorCached should be extra careful to avoid accidentally modifying the base/inherited value.
51
+ */
52
+ protected static constructorCached: MostDerivedData | "default" | undefined;
53
+ /**
54
+ * Indicate that `this` is the most derived version of a schema, and thus the only one allowed to be used (other than by being subclassed a single time).
55
+ */
56
+ static markMostDerived(this: typeof TreeNodeValid & TreeNodeSchema): MostDerivedData;
57
+ constructor(input: TInput | InternalTreeNode);
58
+ }
59
+ /**
60
+ * Data cached about the most derived type in a schema's class hierarchy.
61
+ * @remarks
62
+ * The most derived type is the only one allowed to be referenced by other schema or constructed as a node.
63
+ * It has to be discovered lazily (when a node is constructed or when a {@link TreeViewConfiguration} is made),
64
+ * since JavaScript provides no way to find derived classes, or inject static class initialization time logic into base classes.
65
+ * Additionally since schema can reference other schema through lazy references which might be forward or recursive references,
66
+ * this can not be evaluated for one schema when referenced by another schema.
67
+ *
68
+ * See {@link TreeNodeValid.constructorCached} and {@link TreeNodeValid.markMostDerived}.
69
+ */
70
+ export interface MostDerivedData {
71
+ readonly constructor: typeof TreeNodeValid & TreeNodeSchema;
72
+ oneTimeInitialized: boolean;
73
+ }
74
+ //# sourceMappingURL=treeNodeValid.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"treeNodeValid.d.ts","sourceRoot":"","sources":["../../src/simple-tree/treeNodeValid.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EACN,KAAK,cAAc,EAOnB,QAAQ,EACR,KAAK,gBAAgB,EACrB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACN,KAAK,YAAY,EACjB,KAAK,WAAW,EAGhB,MAAM,+BAA+B,CAAC;AAOvC;;;;;;;GAOG;AACH,8BAAsB,aAAa,CAAC,MAAM,CAAE,SAAQ,QAAQ;IAC3D;;;;;;;OAOG;IACH,SAAS,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,EACjC,IAAI,EAAE,OAAO,aAAa,CAAC,CAAC,CAAC,EAC7B,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,EAC1B,KAAK,EAAE,YAAY,GACjB,aAAa,CAAC,CAAC,CAAC;IAInB;;OAEG;IACH,SAAS,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,EAC9B,IAAI,EAAE,OAAO,aAAa,CAAC,CAAC,CAAC,EAC7B,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,EAC1B,KAAK,EAAE,CAAC,GACN,WAAW;IAId;;;OAGG;IACH,SAAS,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,aAAa,CAAC,CAAC,CAAC,GAAG,IAAI;IAErE;;;;;;;;;;;;;;;;;OAiBG;IACH,SAAS,CAAC,MAAM,CAAC,iBAAiB,EAAE,eAAe,GAAG,SAAS,GAAG,SAAS,CAAa;IAExF;;OAEG;WACW,eAAe,CAAC,IAAI,EAAE,OAAO,aAAa,GAAG,cAAc,GAAG,eAAe;gBAoCxE,KAAK,EAAE,MAAM,GAAG,gBAAgB;CAkCnD;AAID;;;;;;;;;;GAUG;AACH,MAAM,WAAW,eAAe;IAC/B,QAAQ,CAAC,WAAW,EAAE,OAAO,aAAa,GAAG,cAAc,CAAC;IAC5D,kBAAkB,EAAE,OAAO,CAAC;CAC5B"}
@@ -4,103 +4,15 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  var _a;
7
- var _TreeNode_brand;
8
7
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.toFlexTreeNode = exports.TreeNodeValid = exports.inPrototypeChain = exports.TreeNode = void 0;
8
+ exports.TreeNodeValid = void 0;
10
9
  const internal_1 = require("@fluidframework/core-utils/internal");
11
- const schemaTypes_js_1 = require("./schemaTypes.js");
12
- const index_js_1 = require("../feature-libraries/index.js");
13
- const schemaCaching_js_1 = require("./schemaCaching.js");
14
- const proxies_js_1 = require("./proxies.js");
10
+ const index_js_1 = require("./core/index.js");
11
+ const index_js_2 = require("../feature-libraries/index.js");
15
12
  const internal_2 = require("@fluidframework/telemetry-utils/internal");
13
+ const index_js_3 = require("../util/index.js");
16
14
  const toFlexSchema_js_1 = require("./toFlexSchema.js");
17
- const index_js_2 = require("../util/index.js");
18
15
  const proxyBinding_js_1 = require("./proxyBinding.js");
19
- const treeNodeApi_js_1 = require("./treeNodeApi.js");
20
- /**
21
- * A non-{@link NodeKind.Leaf|leaf} SharedTree node. Includes objects, arrays, and maps.
22
- *
23
- * @remarks
24
- * Base type which all nodes implement.
25
- *
26
- * This can be used as a type to indicate/document values which should be tree nodes.
27
- * Runtime use of this class object (for example when used with `instanceof` or extending it), is not currently supported.
28
- *
29
- * Instances of tree nodes must be created by opening an existing document, inserting values into the document,
30
- * or by using the constructors and create functions of {@link TreeNodeSchema} produced by {@link SchemaFactory}.
31
- * @privateRemarks
32
- * This is a class not an interface to enable stricter type checking (see {@link TreeNode.#brand})
33
- * and some runtime enforcement of schema class policy (see the the validation in the constructor).
34
- * This class is however only `type` exported not value exported, preventing the class object from being used,
35
- * similar to how interfaces work.
36
- *
37
- * Not all node implementations include this in their prototype chain (some hide it with a proxy),
38
- * and thus cause the default/built in `instanceof` to return false despite our type checking and all other APIs treating them as TreeNodes.
39
- * This class provides a custom `Symbol.hasInstance` to fix `instanceof` for this class and all classes extending it.
40
- * For now the type-only export prevents use of `instanceof` on this class (but allows it in subclasses like schema classes).
41
- * @sealed @public
42
- */
43
- class TreeNode {
44
- static [(_TreeNode_brand = new WeakMap(), Symbol.hasInstance)](value) {
45
- const schema = (0, treeNodeApi_js_1.tryGetSchema)(value);
46
- if (schema === undefined || schema.kind === schemaTypes_js_1.NodeKind.Leaf) {
47
- return false;
48
- }
49
- (0, internal_1.assert)("prototype" in schema, 0x98a /* expected class based schema */);
50
- return inPrototypeChain(schema.prototype, this.prototype);
51
- }
52
- constructor() {
53
- /**
54
- * This is added to prevent TypeScript from implicitly allowing non-TreeNode types to be used as TreeNodes.
55
- * @remarks
56
- * This field forces TypeScript to use nominal instead of structural typing,
57
- * preventing compiler error messages and tools like "add missing properties"
58
- * from adding the [type] field as a solution when using a non-TreeNode object where a TreeNode is required.
59
- * Instead TreeNodes must be created through the appropriate APIs, see the documentation on {@link TreeNode} for details.
60
- *
61
- * @privateRemarks
62
- * This is a JavaScript private field, so is not accessible from outside this class.
63
- * This prevents it from having name collisions with object fields.
64
- * Since this is private, the type of this field is stripped in the d.ts file.
65
- * To get matching type checking within and from outside the package, the least informative type (`unknown`) is used.
66
- * To avoid this having any runtime impact, the field is uninitialized.
67
- *
68
- * Making this field optional results in different type checking within this project than outside of it, since the d.ts file drops the optional aspect of the field.
69
- * This is extra confusing since since the tests get in-project typing for intellisense and separate project checking at build time.
70
- * To avoid all this mess, this field is required, not optional.
71
- *
72
- * Another option would be to use a symbol (possibly as a private field).
73
- * That approach ran into some strange difficulties causing SchemaFactory to fail to compile, and was not investigated further.
74
- *
75
- * The [type] symbol provides a lot of the value this private brand does, but is not all of it:
76
- * someone could manually (or via Intellisense auto-implement completion, or in response to a type error)
77
- * make an object literal with the [type] field and pass it off as a node: this private brand prevents that.
78
- */
79
- _TreeNode_brand.set(this, void 0);
80
- if (!inPrototypeChain(Reflect.getPrototypeOf(this), TreeNodeValid.prototype)) {
81
- throw new internal_2.UsageError("TreeNodes must extend schema classes created by SchemaFactory");
82
- }
83
- }
84
- }
85
- exports.TreeNode = TreeNode;
86
- /**
87
- * Check if the prototype derived's prototype chain contains `base`.
88
- * @param derived - prototype to check
89
- * @param base - prototype to search for
90
- * @returns true iff `base` is in the prototype chain starting at `derived`.
91
- */
92
- // eslint-disable-next-line @rushstack/no-new-null
93
- function inPrototypeChain(derived, base) {
94
- let checking = derived;
95
- while (checking !== null) {
96
- if (base === checking) {
97
- return true;
98
- }
99
- checking = Reflect.getPrototypeOf(checking);
100
- }
101
- return false;
102
- }
103
- exports.inPrototypeChain = inPrototypeChain;
104
16
  /**
105
17
  * Class which all {@link TreeNode}s must extend.
106
18
  * Since this is not exported, it allows robust detection of attempts to create TreeNodes which do not go through SchemaFactory which is the only place which exposes classes that extend this.
@@ -109,7 +21,7 @@ exports.inPrototypeChain = inPrototypeChain;
109
21
  * These static members are only intended to be used / overridden by code within this package, and are used by the various node kinds.
110
22
  * Access to these static members has to be done via `this.constructor.staticMember` to support the overrides, and thus can only be used in the constructor, after the base constructor has been invoked.
111
23
  */
112
- class TreeNodeValid extends TreeNode {
24
+ class TreeNodeValid extends index_js_1.TreeNode {
113
25
  /**
114
26
  * Schema classes can override this to control what happens at the end of the constructor.
115
27
  * The return value from this is returned from the constructor, allowing substituting a proxy if desired.
@@ -125,7 +37,7 @@ class TreeNodeValid extends TreeNode {
125
37
  * Schema classes must override to provide an implementation of RawTreeNode construction.
126
38
  */
127
39
  static buildRawNode(instance, input) {
128
- return (0, index_js_2.fail)("Schema must override buildRawNode");
40
+ return (0, index_js_3.fail)("Schema must override buildRawNode");
129
41
  }
130
42
  /**
131
43
  * Schema classes can override to provide a callback that is called once when the first node is constructed.
@@ -160,26 +72,26 @@ class TreeNodeValid extends TreeNode {
160
72
  throw new internal_2.UsageError(`Two schema classes were used (${this.name} and ${this.constructorCached.constructor.name}) which derived from the same SchemaFactory generated class (${JSON.stringify(this.identifier)}). This is invalid.`);
161
73
  }
162
74
  constructor(input) {
163
- super();
75
+ super(index_js_1.privateToken);
164
76
  const schema = this.constructor;
165
77
  const cache = schema.markMostDerived();
166
78
  if (!cache.oneTimeInitialized) {
167
79
  const flexSchema = (0, toFlexSchema_js_1.getFlexSchema)(schema);
168
- (0, internal_1.assert)((0, schemaCaching_js_1.tryGetSimpleNodeSchema)(flexSchema) === schema, 0x961 /* Schema class not properly configured */);
80
+ (0, internal_1.assert)((0, index_js_1.tryGetSimpleNodeSchema)(flexSchema) === schema, 0x961 /* Schema class not properly configured */);
169
81
  schema.oneTimeSetup();
170
82
  cache.oneTimeInitialized = true;
171
83
  }
172
- if ((0, proxies_js_1.isTreeNode)(input)) {
84
+ if ((0, index_js_1.isTreeNode)(input)) {
173
85
  // TODO: update this once we have better support for deep-copying and move operations.
174
86
  throw new internal_2.UsageError("Existing nodes may not be used as the constructor parameter for a new node. The existing node may be used directly instead of creating a new one, used as a child of the new node (if it has not yet been inserted into the tree). If the desired result is copying the provided node, it must be deep copied (since any child node would be parented under both the new and old nodes). Currently no API is provided to make deep copies, but it can be done manually with object spreads - for example `new Foo({...oldFoo})` will work if all fields of `oldFoo` are leaf nodes.");
175
87
  }
176
- const node = (0, index_js_1.isFlexTreeNode)(input)
88
+ const node = (0, index_js_2.isFlexTreeNode)(input)
177
89
  ? input
178
90
  : schema.buildRawNode(this, input);
179
- (0, internal_1.assert)((0, schemaCaching_js_1.tryGetSimpleNodeSchema)(node.schema) === schema, 0x83b /* building node with wrong schema */);
91
+ (0, internal_1.assert)((0, index_js_1.tryGetSimpleNodeSchema)(node.schema) === schema, 0x83b /* building node with wrong schema */);
180
92
  const result = schema.prepareInstance(this, node);
181
- (0, proxyBinding_js_1.createKernel)(result);
182
- (0, proxyBinding_js_1.setFlexNode)(result, node);
93
+ new index_js_1.TreeNodeKernel(result, schema);
94
+ (0, proxyBinding_js_1.setInnerNode)(result, node);
183
95
  return result;
184
96
  }
185
97
  }
@@ -204,12 +116,7 @@ exports.TreeNodeValid = TreeNodeValid;
204
116
  */
205
117
  TreeNodeValid.constructorCached = "default";
206
118
  // Class objects are functions (callable), so we need a strong way to distinguish between `schema` and `() => schema` when used as a `LazyItem`.
207
- (0, index_js_1.markEager)(TreeNodeValid);
208
- function toFlexTreeNode(node) {
209
- (0, internal_1.assert)((0, index_js_1.isFlexTreeNode)(node), 0x963 /* Invalid InternalTreeNode */);
210
- return node;
211
- }
212
- exports.toFlexTreeNode = toFlexTreeNode;
119
+ (0, index_js_2.markEager)(TreeNodeValid);
213
120
  // #region NodeJS custom inspect for TreeNodes.
214
121
  /**
215
122
  * Used to customize "inspect" behavior in NodeJS.
@@ -225,8 +132,8 @@ const customInspectSymbol = Symbol.for("nodejs.util.inspect.custom");
225
132
  function inspectNodeFunction(depth, options, inspect) {
226
133
  // TODO: replicated from tryGetSchema to avoid cycle.
227
134
  // This case could be optimized, for example by placing the simple schema in a symbol on tree nodes.
228
- const schema = (0, schemaCaching_js_1.tryGetSimpleNodeSchema)((0, proxyBinding_js_1.getFlexNode)(this).schema);
229
- const title = `${schema.name}: ${schemaTypes_js_1.NodeKind[schema.kind]} Node (${schema.identifier})`;
135
+ const schema = (0, index_js_1.tryGetSimpleNodeSchema)((0, proxyBinding_js_1.getOrCreateInnerNode)(this).schema);
136
+ const title = `${schema.name}: ${index_js_1.NodeKind[schema.kind]} Node (${schema.identifier})`;
230
137
  if (depth < 2) {
231
138
  const short = shortContent(this);
232
139
  if (short !== undefined) {
@@ -265,7 +172,7 @@ const globals = typeof window === "undefined" ? globalThis : window;
265
172
  const formatters = ((_a = globals).devtoolsFormatters ?? (_a.devtoolsFormatters = []));
266
173
  const nodeFormatter = {
267
174
  header(object, config) {
268
- if ((0, proxies_js_1.isTreeNode)(object)) {
175
+ if ((0, index_js_1.isTreeNode)(object)) {
269
176
  return ["span", `${inspectNodeFunction.call(object, 1)}`];
270
177
  }
271
178
  return null;
@@ -296,4 +203,4 @@ function formattedReference(object, config) {
296
203
  return ["object", { object, config }];
297
204
  }
298
205
  formatters.push(nodeFormatter);
299
- //# sourceMappingURL=types.js.map
206
+ //# sourceMappingURL=treeNodeValid.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"treeNodeValid.js","sourceRoot":"","sources":["../../src/simple-tree/treeNodeValid.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;AAEH,kEAA6D;AAE7D,8CAUyB;AACzB,4DAKuC;AACvC,uEAAsE;AACtE,+CAAwC;AAExC,uDAAkD;AAClD,uDAAuE;AAEvE;;;;;;;GAOG;AACH,MAAsB,aAAsB,SAAQ,mBAAQ;IAC3D;;;;;;;OAOG;IACO,MAAM,CAAC,eAAe,CAE/B,QAA0B,EAC1B,KAAmB;QAEnB,OAAO,QAAQ,CAAC;IACjB,CAAC;IAED;;OAEG;IACO,MAAM,CAAC,YAAY,CAE5B,QAA0B,EAC1B,KAAQ;QAER,OAAO,IAAA,eAAI,EAAC,mCAAmC,CAAC,CAAC;IAClD,CAAC;IAED;;;OAGG;IACO,MAAM,CAAC,YAAY,KAA0C,CAAC;IAsBxE;;OAEG;IACI,MAAM,CAAC,eAAe;QAC5B,IAAA,iBAAM,EAAC,IAAI,CAAC,iBAAiB,KAAK,SAAS,EAAE,KAAK,CAAC,0BAA0B,CAAC,CAAC;QAE/E,IAAI,IAAI,CAAC,iBAAiB,KAAK,SAAS,EAAE,CAAC;YAC1C,kFAAkF;YAClF,4EAA4E;YAC5E,mDAAmD;YACnD,iIAAiI;YACjI,0HAA0H;YAE1H,0IAA0I;YAC1I,4DAA4D;YAC5D,IAAI,UAAU,GAAyB,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AAC,MAAM,EAAE,GAAG,mBAAmB,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;QAC3D,CAAC;QACD,OAAO,IAAI,CAAC;IACb,CAAC;IACD,IAAI,CAAC,MAAM,EAAE,MAAM;QAClB,MAAM,QAAQ,GAA6B,EAAE,CAAC;QAC9C,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAkB,CAAC,EAAE,CAAC;YAC/D,QAAQ,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,GAAG,GAAG,IAAI,CAAC,EAAE,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACxE,CAAC;QAED,QAAQ;QACR,+HAA+H;QAC/H,qDAAqD;QACrD,qCAAqC;QACrC,2DAA2D;QAE3D,OAAO,CAAC,IAAI,EAAE,GAAG,QAAQ,CAAC,CAAC;IAC5B,CAAC;IACD,OAAO,CAAC,MAAM,EAAE,MAAM;QACrB,OAAO,YAAY,CAAC,MAAkC,CAAC,KAAK,SAAS,CAAC;IACvE,CAAC;CACD,CAAC;AAEF,SAAS,kBAAkB,CAC1B,MAAe,EACf,MAAuC;IAEvC,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;QACnC,OAAO,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAC9B,CAAC;SAAM,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;QAC9B,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzB,CAAC;IAED,OAAO,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;AACvC,CAAC;AAED,UAAU,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\ttype TreeNodeSchema,\n\ttype TreeNodeSchemaClass,\n\tNodeKind,\n\ttryGetSimpleNodeSchema,\n\tisTreeNode,\n\tTreeNodeKernel,\n\tprivateToken,\n\tTreeNode,\n\ttype InternalTreeNode,\n} from \"./core/index.js\";\nimport {\n\ttype FlexTreeNode,\n\ttype MapTreeNode,\n\tisFlexTreeNode,\n\tmarkEager,\n} from \"../feature-libraries/index.js\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\nimport { fail } from \"../util/index.js\";\n\nimport { getFlexSchema } from \"./toFlexSchema.js\";\nimport { getOrCreateInnerNode, setInnerNode } from \"./proxyBinding.js\";\n\n/**\n * Class which all {@link TreeNode}s must extend.\n * Since this is not exported, it allows robust detection of attempts to create TreeNodes which do not go through SchemaFactory which is the only place which exposes classes that extend this.\n *\n * This has static members which schema classes can override to provide schema specific functionality.\n * These static members are only intended to be used / overridden by code within this package, and are used by the various node kinds.\n * Access to these static members has to be done via `this.constructor.staticMember` to support the overrides, and thus can only be used in the constructor, after the base constructor has been invoked.\n */\nexport abstract class TreeNodeValid<TInput> extends TreeNode {\n\t/**\n\t * Schema classes can override this to control what happens at the end of the constructor.\n\t * The return value from this is returned from the constructor, allowing substituting a proxy if desired.\n\t *\n\t * This is not simply done in the derived constructor to enable:\n\t * - this class to access the value which is being returned before it's returned from the constructor.\n\t * - the derived class to be provided the input `FlexTreeNode` without relying on a field on the node to hold it.\n\t */\n\tprotected static prepareInstance<T>(\n\t\tthis: typeof TreeNodeValid<T>,\n\t\tinstance: TreeNodeValid<T>,\n\t\tinput: FlexTreeNode,\n\t): TreeNodeValid<T> {\n\t\treturn instance;\n\t}\n\n\t/**\n\t * Schema classes must override to provide an implementation of RawTreeNode construction.\n\t */\n\tprotected static buildRawNode<T>(\n\t\tthis: typeof TreeNodeValid<T>,\n\t\tinstance: TreeNodeValid<T>,\n\t\tinput: T,\n\t): MapTreeNode {\n\t\treturn fail(\"Schema must override buildRawNode\");\n\t}\n\n\t/**\n\t * Schema classes can override to provide a callback that is called once when the first node is constructed.\n\t * This is a good place to perform extra validation and cache schema derived data needed for the implementation of the node.\n\t */\n\tprotected static oneTimeSetup<T>(this: typeof TreeNodeValid<T>): void {}\n\n\t/**\n\t * The most derived constructor (the one invoked with the `new` operator, not a parent class constructor invoked with as `super`) used to construct an instance of this type.\n\t * @remarks\n\t * Captured when an instance is constructed.\n\t *\n\t * Used to ensure that some derived class (which must override this member, defaulting it to `undefined`) is only instantiated with a single \"most derived\" class (the constructor actually invoked the the user with `new`).\n\t *\n\t * Typically this is override in the class that statically implements {@link TreeNodeSchema} to enforce that all nodes using that schema use the same class and not different subclasses of it.\n\t *\n\t * Also used to detect if oneTimeSetup has run.\n\t *\n\t * @privateRemarks\n\t * This defaults to \"default\", which is used to trigger an error if not overridden in the derived class.\n\t *\n\t * The value of this on TreeNodeValid must only be overridden by base classes and never modified.\n\t * Ways to enforce this immutability prevent it from being overridden,\n\t * so code modifying constructorCached should be extra careful to avoid accidentally modifying the base/inherited value.\n\t */\n\tprotected static constructorCached: MostDerivedData | \"default\" | undefined = \"default\";\n\n\t/**\n\t * Indicate that `this` is the most derived version of a schema, and thus the only one allowed to be used (other than by being subclassed a single time).\n\t */\n\tpublic static markMostDerived(this: typeof TreeNodeValid & TreeNodeSchema): MostDerivedData {\n\t\tassert(this.constructorCached !== \"default\", 0x95f /* invalid schema class */);\n\n\t\tif (this.constructorCached === undefined) {\n\t\t\t// Set the constructorCached on the layer of the prototype chain that declared it.\n\t\t\t// This is necessary to ensure there is only one subclass of that type used:\n\t\t\t// if constructorCached was simply set on `schema`,\n\t\t\t// then a base classes between `schema` (exclusive) and where `constructorCached` is set (inclusive) and other subclasses of them\n\t\t\t// would not see the stored `constructorCached`, and the validation above against multiple derived classes would not work.\n\n\t\t\t// This is not just an alias of `this`, but a reference to the item in the prototype chain being walked, which happens to start at `this`.\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-this-alias\n\t\t\tlet schemaBase: typeof TreeNodeValid = this;\n\t\t\twhile (!Object.prototype.hasOwnProperty.call(schemaBase, \"constructorCached\")) {\n\t\t\t\tschemaBase = Reflect.getPrototypeOf(schemaBase) as typeof TreeNodeValid;\n\t\t\t}\n\t\t\tassert(schemaBase.constructorCached === undefined, 0x962 /* overwriting wrong cache */);\n\t\t\tschemaBase.constructorCached = { constructor: this, oneTimeInitialized: false };\n\t\t\tassert(\n\t\t\t\tthis.constructorCached === schemaBase.constructorCached,\n\t\t\t\t0x9b5 /* Inheritance should work */,\n\t\t\t);\n\t\t\treturn this.constructorCached;\n\t\t} else if (this.constructorCached.constructor === this) {\n\t\t\treturn this.constructorCached;\n\t\t}\n\n\t\tthrow new UsageError(\n\t\t\t`Two schema classes were used (${this.name} and ${\n\t\t\t\tthis.constructorCached.constructor.name\n\t\t\t}) which derived from the same SchemaFactory generated class (${JSON.stringify(\n\t\t\t\tthis.identifier,\n\t\t\t)}). This is invalid.`,\n\t\t);\n\t}\n\n\tpublic constructor(input: TInput | InternalTreeNode) {\n\t\tsuper(privateToken);\n\t\tconst schema = this.constructor as typeof TreeNodeValid & TreeNodeSchema;\n\t\tconst cache = schema.markMostDerived();\n\t\tif (!cache.oneTimeInitialized) {\n\t\t\tconst flexSchema = getFlexSchema(schema);\n\t\t\tassert(\n\t\t\t\ttryGetSimpleNodeSchema(flexSchema) === schema,\n\t\t\t\t0x961 /* Schema class not properly configured */,\n\t\t\t);\n\t\t\tschema.oneTimeSetup();\n\t\t\tcache.oneTimeInitialized = true;\n\t\t}\n\n\t\tif (isTreeNode(input)) {\n\t\t\t// TODO: update this once we have better support for deep-copying and move operations.\n\t\t\tthrow new UsageError(\n\t\t\t\t\"Existing nodes may not be used as the constructor parameter for a new node. The existing node may be used directly instead of creating a new one, used as a child of the new node (if it has not yet been inserted into the tree). If the desired result is copying the provided node, it must be deep copied (since any child node would be parented under both the new and old nodes). Currently no API is provided to make deep copies, but it can be done manually with object spreads - for example `new Foo({...oldFoo})` will work if all fields of `oldFoo` are leaf nodes.\",\n\t\t\t);\n\t\t}\n\n\t\tconst node: FlexTreeNode = isFlexTreeNode(input)\n\t\t\t? input\n\t\t\t: schema.buildRawNode(this, input);\n\t\tassert(\n\t\t\ttryGetSimpleNodeSchema(node.schema) === schema,\n\t\t\t0x83b /* building node with wrong schema */,\n\t\t);\n\n\t\tconst result = schema.prepareInstance(this, node);\n\t\tnew TreeNodeKernel(result, schema);\n\t\tsetInnerNode(result, node);\n\t\treturn result;\n\t}\n}\n// Class objects are functions (callable), so we need a strong way to distinguish between `schema` and `() => schema` when used as a `LazyItem`.\nmarkEager(TreeNodeValid);\n\n/**\n * Data cached about the most derived type in a schema's class hierarchy.\n * @remarks\n * The most derived type is the only one allowed to be referenced by other schema or constructed as a node.\n * It has to be discovered lazily (when a node is constructed or when a {@link TreeViewConfiguration} is made),\n * since JavaScript provides no way to find derived classes, or inject static class initialization time logic into base classes.\n * Additionally since schema can reference other schema through lazy references which might be forward or recursive references,\n * this can not be evaluated for one schema when referenced by another schema.\n *\n * See {@link TreeNodeValid.constructorCached} and {@link TreeNodeValid.markMostDerived}.\n */\nexport interface MostDerivedData {\n\treadonly constructor: typeof TreeNodeValid & TreeNodeSchema;\n\toneTimeInitialized: boolean;\n}\n\n// #region NodeJS custom inspect for TreeNodes.\n\n/**\n * Used to customize \"inspect\" behavior in NodeJS.\n * See https://nodejs.org/api/util.html#utilinspectcustom for details.\n *\n * VS-Code's debugger also uses this to inspect objects,\n * see https://github.com/microsoft/vscode-js-debug/blob/64df2686c92bac402909dee5c3c389bbb7a81f6d/src/adapter/templates/getStringyProps.ts#L11 for details.\n */\nconst customInspectSymbol = Symbol.for(\"nodejs.util.inspect.custom\");\n\n/**\n * Node inspecting function for use with {@link customInspectSymbol}.\n */\nfunction inspectNodeFunction(\n\tthis: TreeNodeValid<unknown>,\n\tdepth: number,\n\toptions?: unknown,\n\tinspect?: unknown,\n): unknown {\n\t// TODO: replicated from tryGetSchema to avoid cycle.\n\t// This case could be optimized, for example by placing the simple schema in a symbol on tree nodes.\n\tconst schema = tryGetSimpleNodeSchema(\n\t\tgetOrCreateInnerNode(this).schema,\n\t) as TreeNodeSchemaClass;\n\tconst title = `${schema.name}: ${NodeKind[schema.kind]} Node (${schema.identifier})`;\n\n\tif (depth < 2) {\n\t\tconst short = shortContent(this);\n\t\tif (short !== undefined) {\n\t\t\treturn `${title} ${short}`;\n\t\t}\n\t\treturn title;\n\t}\n\tconst content = `${title} ${JSON.stringify(this)}`;\n\treturn content;\n}\n\n/**\n * If the node has no items, a short JSON string for it.\n */\nfunction shortContent(node: TreeNodeValid<unknown>): string | undefined {\n\tif (Object.values(node).length === 0) {\n\t\treturn JSON.stringify(node);\n\t}\n\treturn undefined;\n}\n\n/**\n * Add inherited non-enumerable symbol for NodeJS inspection to all nodes.\n *\n * See {@link customInspectSymbol}.\n */\nObject.defineProperty(TreeNodeValid.prototype, customInspectSymbol, {\n\tvalue: inspectNodeFunction,\n\tenumerable: false,\n});\n\n// #endregion\n\n// #region Browser custom debug format for TreeNodes\n\n// This section has side-effects, so including it in this file ensures its loaded whenever TreeNodes could exist.\n// Supported in at least Chrome and FireFox, more details at https://firefox-source-docs.mozilla.org/devtools-user/custom_formatters/index.html\n// For this to work the browser's dev tools generally have to \"Enable custom formatters\".\n\n// This formatter is inspired by https://github.com/andrewdavey/immutable-devtools/blob/master/src/createFormatters.js which provides a similar formatter for the immutable.js library.\n\nconst globals = typeof window === \"undefined\" ? globalThis : window;\nconst formatters = ((\n\tglobals as { devtoolsFormatters?: DevtoolsFormatter.DevtoolsFormatter[] }\n).devtoolsFormatters ??= []);\n\nconst nodeFormatter: DevtoolsFormatter.DevtoolsFormatter = {\n\theader(object, config) {\n\t\tif (isTreeNode(object)) {\n\t\t\treturn [\"span\", `${inspectNodeFunction.call(object, 1)}`];\n\t\t}\n\t\treturn null;\n\t},\n\tbody(object, config): DevtoolsFormatter.Item {\n\t\tconst children: DevtoolsFormatter.Item[] = [];\n\t\tfor (const [key, value] of Object.entries(object as TreeNode)) {\n\t\t\tchildren.push([\"li\", [\"span\", `${key}: `], formattedReference(value)]);\n\t\t}\n\n\t\t// TODO:\n\t\t// for array nodes, this isn't great since (at least in FireFox) the list items show up with a prefixed number starting from 1.\n\t\t// This looks messy when followed by the array index.\n\t\t// Find a way to hide the list index.\n\t\t// { style: 'list-style-type: none` } did not seem to work.\n\n\t\treturn [\"ol\", ...children];\n\t},\n\thasBody(object, config) {\n\t\treturn shortContent(object as TreeNodeValid<undefined>) === undefined;\n\t},\n};\n\nfunction formattedReference(\n\tobject: unknown,\n\tconfig?: DevtoolsFormatter.ObjectConfig,\n): DevtoolsFormatter.Item {\n\tif (typeof object === \"undefined\") {\n\t\treturn [\"span\", \"undefined\"];\n\t} else if (object === \"null\") {\n\t\treturn [\"span\", \"null\"];\n\t}\n\n\treturn [\"object\", { object, config }];\n}\n\nformatters.push(nodeFormatter);\n\n// #endregion\n\n// These types are based on https://github.com/BenjaminAster/Better-TypeScript/blob/main/types/devtools-formatters.d.ts\n// however the original package causes multiple compile errors due to some of its other types it used, so the relevant part has been extracted and adjusted to better match our conventions.\ndeclare namespace DevtoolsFormatter {\n\ttype ObjectConfig = Record<string | symbol, unknown>;\n\n\ttype ElementTagName = \"div\" | \"span\" | \"ol\" | \"li\" | \"table\" | \"tr\" | \"td\";\n\n\ttype ElementTemplate = StyledElementTemplate | UnstyledElementTemplate;\n\n\ttype StyledElementTemplate = readonly [\n\t\tElementTagName,\n\t\t{\n\t\t\tstyle?: string;\n\t\t},\n\t\t...Item[],\n\t];\n\n\ttype UnstyledElementTemplate = readonly [ElementTagName, ...Item[]];\n\n\ttype ObjectReference = readonly [\n\t\t\"object\",\n\t\t{\n\t\t\tobject: unknown;\n\t\t\tconfig?: ObjectConfig;\n\t\t},\n\t];\n\n\ttype Item = string | ElementTemplate | ObjectReference;\n\n\tinterface DevtoolsFormatter {\n\t\theader(\n\t\t\tobject?: unknown,\n\t\t\tconfig?: ObjectConfig,\n\t\t\t// eslint-disable-next-line @rushstack/no-new-null\n\t\t): Item | null;\n\t\thasBody(object?: unknown, config?: ObjectConfig): boolean;\n\t\tbody(object?: unknown, config?: ObjectConfig): Item;\n\t}\n}\n"]}
@@ -4,9 +4,9 @@
4
4
  */
5
5
  import type { FlexListToUnion, Unenforced } from "../feature-libraries/index.js";
6
6
  import type { RestrictiveReadonlyRecord, _InlineTrick } from "../util/index.js";
7
- import type { AllowedTypes, ApplyKind, FieldKind, FieldSchema, ImplicitAllowedTypes, ImplicitFieldSchema, NodeFromSchema, NodeKind, TreeNodeFromImplicitAllowedTypes, TreeNodeSchema, WithType } from "./schemaTypes.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";
8
9
  import type { TreeArrayNodeBase, TreeArrayNode } from "./arrayNode.js";
9
- import type { TreeNode, Unhydrated } from "./types.js";
10
10
  /**
11
11
  * {@link Unenforced} version of `ObjectFromSchemaRecord`.
12
12
  * @remarks
@@ -22,7 +22,7 @@ export type ObjectFromSchemaRecordUnsafe<T extends Unenforced<RestrictiveReadonl
22
22
  * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
23
23
  * @public
24
24
  */
25
- export type TreeObjectNodeUnsafe<T extends Unenforced<RestrictiveReadonlyRecord<string, ImplicitFieldSchema>>, TypeName extends string = string> = TreeNode & ObjectFromSchemaRecordUnsafe<T> & WithType<TypeName>;
25
+ export type TreeObjectNodeUnsafe<T extends Unenforced<RestrictiveReadonlyRecord<string, ImplicitFieldSchema>>, TypeName extends string = string> = TreeNode & ObjectFromSchemaRecordUnsafe<T> & WithType<TypeName, NodeKind.Object>;
26
26
  /**
27
27
  * {@link Unenforced} version of {@link TreeFieldFromImplicitField}.
28
28
  * @remarks
@@ -83,7 +83,7 @@ export interface TreeArrayNodeUnsafe<TAllowedTypes extends Unenforced<ImplicitAl
83
83
  * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
84
84
  * @sealed @public
85
85
  */
86
- export interface TreeMapNodeUnsafe<T extends Unenforced<ImplicitAllowedTypes>> extends ReadonlyMap<string, TreeNodeFromImplicitAllowedTypesUnsafe<T>>, TreeNode {
86
+ export interface TreeMapNodeUnsafe<T extends Unenforced<ImplicitAllowedTypes>> extends ReadonlyMapInlined<string, T>, TreeNode {
87
87
  /**
88
88
  * {@inheritdoc TreeMapNode.set}
89
89
  */
@@ -93,6 +93,37 @@ export interface TreeMapNodeUnsafe<T extends Unenforced<ImplicitAllowedTypes>> e
93
93
  */
94
94
  delete(key: string): void;
95
95
  }
96
+ /**
97
+ * Copy of TypeScript's ReadonlyMap, but with `TreeNodeFromImplicitAllowedTypesUnsafe<T>` inlined into it.
98
+ * 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.
99
+ * @remarks
100
+ * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.
101
+ * @privateRemarks
102
+ * This is the same as `ReadonlyMap<K, TreeNodeFromImplicitAllowedTypesUnsafe<T>>` (Checked in test),
103
+ * except that it avoids the above mentioned compile error.
104
+ * Authored by manually inlining ReadonlyMap from from the TypeScript lib which can be found by navigating to the definition of `ReadonlyMap`.
105
+ * @system @sealed @public
106
+ */
107
+ export interface ReadonlyMapInlined<K, T extends Unenforced<ImplicitAllowedTypes>> {
108
+ /** Returns an iterable of entries in the map. */
109
+ [Symbol.iterator](): IterableIterator<[K, TreeNodeFromImplicitAllowedTypesUnsafe<T>]>;
110
+ /**
111
+ * Returns an iterable of key, value pairs for every entry in the map.
112
+ */
113
+ entries(): IterableIterator<[K, TreeNodeFromImplicitAllowedTypesUnsafe<T>]>;
114
+ /**
115
+ * Returns an iterable of keys in the map
116
+ */
117
+ keys(): IterableIterator<K>;
118
+ /**
119
+ * Returns an iterable of values in the map
120
+ */
121
+ values(): IterableIterator<TreeNodeFromImplicitAllowedTypesUnsafe<T>>;
122
+ forEach(callbackfn: (value: TreeNodeFromImplicitAllowedTypesUnsafe<T>, key: K, map: ReadonlyMap<K, TreeNodeFromImplicitAllowedTypesUnsafe<T>>) => void, thisArg?: any): void;
123
+ get(key: K): TreeNodeFromImplicitAllowedTypesUnsafe<T> | undefined;
124
+ has(key: K): boolean;
125
+ readonly size: number;
126
+ }
96
127
  /**
97
128
  * {@link Unenforced} version of `FieldHasDefault`.
98
129
  * @remarks
@@ -1 +1 @@
1
- {"version":3,"file":"typesUnsafe.d.ts","sourceRoot":"","sources":["../../src/simple-tree/typesUnsafe.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AACjF,OAAO,KAAK,EAAE,yBAAyB,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhF,OAAO,KAAK,EACX,YAAY,EACZ,SAAS,EACT,SAAS,EACT,WAAW,EACX,oBAAoB,EACpB,mBAAmB,EACnB,cAAc,EACd,QAAQ,EACR,gCAAgC,EAChC,cAAc,EACd,QAAQ,EACR,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACvE,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAcvD;;;;;GAKG;AACH,MAAM,MAAM,4BAA4B,CACvC,CAAC,SAAS,UAAU,CAAC,yBAAyB,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC,IACzE;IACH,CAAC,UAAU,QAAQ,IAAI,MAAM,CAAC,GAAG,gCAAgC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;CAC9E,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,oBAAoB,CAC/B,CAAC,SAAS,UAAU,CAAC,yBA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