@fluidframework/tree 2.1.1 → 2.2.1

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 (1457) 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 +119 -25
  6. package/api-report/tree.beta.api.md +51 -25
  7. package/api-report/tree.public.api.md +51 -25
  8. package/dist/beta.d.ts +3 -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 +0 -10
  57. package/dist/core/tree/anchorSet.d.ts.map +1 -1
  58. package/dist/core/tree/anchorSet.js +1 -4
  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 +0 -4
  126. package/dist/events/events.d.ts.map +1 -1
  127. package/dist/events/events.js +0 -1
  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 -49
  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 -168
  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 -282
  188. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  189. package/dist/feature-libraries/flex-tree/flexTreeTypes.js +0 -4
  190. package/dist/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  191. package/dist/feature-libraries/flex-tree/index.d.ts +1 -1
  192. package/dist/feature-libraries/flex-tree/index.d.ts.map +1 -1
  193. package/dist/feature-libraries/flex-tree/index.js.map +1 -1
  194. package/dist/feature-libraries/flex-tree/lazyField.d.ts +9 -26
  195. package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  196. package/dist/feature-libraries/flex-tree/lazyField.js +26 -99
  197. package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
  198. package/dist/feature-libraries/flex-tree/lazyNode.d.ts +2 -10
  199. package/dist/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  200. package/dist/feature-libraries/flex-tree/lazyNode.js +3 -42
  201. package/dist/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  202. package/dist/feature-libraries/flex-tree/treeEvents.d.ts +0 -2
  203. package/dist/feature-libraries/flex-tree/treeEvents.d.ts.map +1 -1
  204. package/dist/feature-libraries/flex-tree/treeEvents.js.map +1 -1
  205. package/dist/feature-libraries/flex-tree/utilities.d.ts +2 -1
  206. package/dist/feature-libraries/flex-tree/utilities.d.ts.map +1 -1
  207. package/dist/feature-libraries/flex-tree/utilities.js +4 -0
  208. package/dist/feature-libraries/flex-tree/utilities.js.map +1 -1
  209. package/dist/feature-libraries/forest-summary/codec.js +2 -2
  210. package/dist/feature-libraries/forest-summary/codec.js.map +1 -1
  211. package/dist/feature-libraries/index.d.ts +6 -8
  212. package/dist/feature-libraries/index.d.ts.map +1 -1
  213. package/dist/feature-libraries/index.js +7 -18
  214. package/dist/feature-libraries/index.js.map +1 -1
  215. package/dist/feature-libraries/mapTreeCursor.d.ts +6 -2
  216. package/dist/feature-libraries/mapTreeCursor.d.ts.map +1 -1
  217. package/dist/feature-libraries/mapTreeCursor.js +9 -1
  218. package/dist/feature-libraries/mapTreeCursor.js.map +1 -1
  219. package/dist/feature-libraries/memoizedIdRangeAllocator.d.ts +0 -4
  220. package/dist/feature-libraries/memoizedIdRangeAllocator.d.ts.map +1 -1
  221. package/dist/feature-libraries/memoizedIdRangeAllocator.js +0 -1
  222. package/dist/feature-libraries/memoizedIdRangeAllocator.js.map +1 -1
  223. package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts +0 -2
  224. package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
  225. package/dist/feature-libraries/modular-schema/crossFieldQueries.js +0 -1
  226. package/dist/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
  227. package/dist/feature-libraries/modular-schema/discrepancies.d.ts +18 -0
  228. package/dist/feature-libraries/modular-schema/discrepancies.d.ts.map +1 -1
  229. package/dist/feature-libraries/modular-schema/discrepancies.js +105 -2
  230. package/dist/feature-libraries/modular-schema/discrepancies.js.map +1 -1
  231. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts +0 -8
  232. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  233. package/dist/feature-libraries/modular-schema/fieldChangeHandler.js +0 -1
  234. package/dist/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  235. package/dist/feature-libraries/modular-schema/fieldKind.d.ts +1 -3
  236. package/dist/feature-libraries/modular-schema/fieldKind.d.ts.map +1 -1
  237. package/dist/feature-libraries/modular-schema/fieldKind.js +1 -2
  238. package/dist/feature-libraries/modular-schema/fieldKind.js.map +1 -1
  239. package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts +1 -2
  240. package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  241. package/dist/feature-libraries/modular-schema/genericFieldKind.js +57 -85
  242. package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  243. package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.d.ts +1 -1
  244. package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.d.ts.map +1 -1
  245. package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.js +5 -8
  246. package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.js.map +1 -1
  247. package/dist/feature-libraries/modular-schema/genericFieldKindTypes.d.ts +3 -14
  248. package/dist/feature-libraries/modular-schema/genericFieldKindTypes.d.ts.map +1 -1
  249. package/dist/feature-libraries/modular-schema/genericFieldKindTypes.js +6 -0
  250. package/dist/feature-libraries/modular-schema/genericFieldKindTypes.js.map +1 -1
  251. package/dist/feature-libraries/modular-schema/index.d.ts +2 -2
  252. package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
  253. package/dist/feature-libraries/modular-schema/index.js +2 -1
  254. package/dist/feature-libraries/modular-schema/index.js.map +1 -1
  255. package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  256. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js +39 -22
  257. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  258. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +9 -8
  259. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  260. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +192 -228
  261. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  262. package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts +8 -14
  263. package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
  264. package/dist/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
  265. package/dist/feature-libraries/node-key/nodeKey.d.ts +0 -4
  266. package/dist/feature-libraries/node-key/nodeKey.d.ts.map +1 -1
  267. package/dist/feature-libraries/node-key/nodeKey.js +0 -2
  268. package/dist/feature-libraries/node-key/nodeKey.js.map +1 -1
  269. package/dist/feature-libraries/node-key/nodeKeyManager.d.ts +0 -1
  270. package/dist/feature-libraries/node-key/nodeKeyManager.d.ts.map +1 -1
  271. package/dist/feature-libraries/node-key/nodeKeyManager.js.map +1 -1
  272. package/dist/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  273. package/dist/feature-libraries/object-forest/objectForest.js +1 -10
  274. package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
  275. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts +6 -6
  276. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts.map +1 -1
  277. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts +7 -7
  278. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts.map +1 -1
  279. package/dist/feature-libraries/schemaBuilderBase.d.ts +2 -28
  280. package/dist/feature-libraries/schemaBuilderBase.d.ts.map +1 -1
  281. package/dist/feature-libraries/schemaBuilderBase.js +1 -27
  282. package/dist/feature-libraries/schemaBuilderBase.js.map +1 -1
  283. package/dist/feature-libraries/sequence-field/compose.d.ts.map +1 -1
  284. package/dist/feature-libraries/sequence-field/compose.js +24 -21
  285. package/dist/feature-libraries/sequence-field/compose.js.map +1 -1
  286. package/dist/feature-libraries/sequence-field/formatV2.d.ts +3 -3
  287. package/dist/feature-libraries/sequence-field/formatV2.d.ts.map +1 -1
  288. package/dist/feature-libraries/sequence-field/formatV2.js +7 -6
  289. package/dist/feature-libraries/sequence-field/formatV2.js.map +1 -1
  290. package/dist/feature-libraries/sequence-field/formatV3.d.ts +195 -0
  291. package/dist/feature-libraries/sequence-field/formatV3.d.ts.map +1 -0
  292. package/dist/feature-libraries/sequence-field/formatV3.js +23 -0
  293. package/dist/feature-libraries/sequence-field/formatV3.js.map +1 -0
  294. package/dist/feature-libraries/sequence-field/helperTypes.d.ts +11 -0
  295. package/dist/feature-libraries/sequence-field/helperTypes.d.ts.map +1 -1
  296. package/dist/feature-libraries/sequence-field/helperTypes.js.map +1 -1
  297. package/dist/feature-libraries/sequence-field/index.d.ts +1 -1
  298. package/dist/feature-libraries/sequence-field/index.d.ts.map +1 -1
  299. package/dist/feature-libraries/sequence-field/index.js.map +1 -1
  300. package/dist/feature-libraries/sequence-field/invert.d.ts.map +1 -1
  301. package/dist/feature-libraries/sequence-field/invert.js +21 -13
  302. package/dist/feature-libraries/sequence-field/invert.js.map +1 -1
  303. package/dist/feature-libraries/sequence-field/markQueue.js +1 -1
  304. package/dist/feature-libraries/sequence-field/markQueue.js.map +1 -1
  305. package/dist/feature-libraries/sequence-field/moveEffectTable.d.ts +2 -2
  306. package/dist/feature-libraries/sequence-field/moveEffectTable.d.ts.map +1 -1
  307. package/dist/feature-libraries/sequence-field/moveEffectTable.js.map +1 -1
  308. package/dist/feature-libraries/sequence-field/rebase.d.ts.map +1 -1
  309. package/dist/feature-libraries/sequence-field/rebase.js +24 -6
  310. package/dist/feature-libraries/sequence-field/rebase.js.map +1 -1
  311. package/dist/feature-libraries/sequence-field/replaceRevisions.d.ts.map +1 -1
  312. package/dist/feature-libraries/sequence-field/replaceRevisions.js +16 -3
  313. package/dist/feature-libraries/sequence-field/replaceRevisions.js.map +1 -1
  314. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts.map +1 -1
  315. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js +38 -4
  316. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +1 -1
  317. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts +4 -1
  318. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
  319. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js +54 -9
  320. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
  321. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts +11 -0
  322. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts.map +1 -0
  323. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.js +85 -0
  324. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -0
  325. package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts.map +1 -1
  326. package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.js +2 -0
  327. package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.js.map +1 -1
  328. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts.map +1 -1
  329. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js +4 -1
  330. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
  331. package/dist/feature-libraries/sequence-field/types.d.ts +23 -4
  332. package/dist/feature-libraries/sequence-field/types.d.ts.map +1 -1
  333. package/dist/feature-libraries/sequence-field/types.js.map +1 -1
  334. package/dist/feature-libraries/sequence-field/utils.d.ts +5 -4
  335. package/dist/feature-libraries/sequence-field/utils.d.ts.map +1 -1
  336. package/dist/feature-libraries/sequence-field/utils.js +70 -42
  337. package/dist/feature-libraries/sequence-field/utils.js.map +1 -1
  338. package/dist/feature-libraries/storedToViewSchema.d.ts +0 -1
  339. package/dist/feature-libraries/storedToViewSchema.d.ts.map +1 -1
  340. package/dist/feature-libraries/storedToViewSchema.js +0 -1
  341. package/dist/feature-libraries/storedToViewSchema.js.map +1 -1
  342. package/dist/feature-libraries/treeCursorUtils.d.ts +0 -6
  343. package/dist/feature-libraries/treeCursorUtils.d.ts.map +1 -1
  344. package/dist/feature-libraries/treeCursorUtils.js +8 -6
  345. package/dist/feature-libraries/treeCursorUtils.js.map +1 -1
  346. package/dist/feature-libraries/treeTextCursor.d.ts +0 -2
  347. package/dist/feature-libraries/treeTextCursor.d.ts.map +1 -1
  348. package/dist/feature-libraries/treeTextCursor.js +0 -2
  349. package/dist/feature-libraries/treeTextCursor.js.map +1 -1
  350. package/dist/feature-libraries/typed-schema/flexList.d.ts +0 -3
  351. package/dist/feature-libraries/typed-schema/flexList.d.ts.map +1 -1
  352. package/dist/feature-libraries/typed-schema/flexList.js.map +1 -1
  353. package/dist/feature-libraries/typed-schema/index.d.ts +1 -1
  354. package/dist/feature-libraries/typed-schema/index.d.ts.map +1 -1
  355. package/dist/feature-libraries/typed-schema/index.js +1 -3
  356. package/dist/feature-libraries/typed-schema/index.js.map +1 -1
  357. package/dist/feature-libraries/typed-schema/schemaCollection.d.ts.map +1 -1
  358. package/dist/feature-libraries/typed-schema/schemaCollection.js +0 -4
  359. package/dist/feature-libraries/typed-schema/schemaCollection.js.map +1 -1
  360. package/dist/feature-libraries/typed-schema/typedTreeSchema.d.ts +2 -41
  361. package/dist/feature-libraries/typed-schema/typedTreeSchema.d.ts.map +1 -1
  362. package/dist/feature-libraries/typed-schema/typedTreeSchema.js +1 -40
  363. package/dist/feature-libraries/typed-schema/typedTreeSchema.js.map +1 -1
  364. package/dist/feature-libraries/typed-schema/view.d.ts +0 -1
  365. package/dist/feature-libraries/typed-schema/view.d.ts.map +1 -1
  366. package/dist/feature-libraries/typed-schema/view.js.map +1 -1
  367. package/dist/index.d.ts +8 -9
  368. package/dist/index.d.ts.map +1 -1
  369. package/dist/index.js +31 -90
  370. package/dist/index.js.map +1 -1
  371. package/dist/internalTypes.d.ts +1 -1
  372. package/dist/internalTypes.d.ts.map +1 -1
  373. package/dist/internalTypes.js.map +1 -1
  374. package/dist/packageVersion.d.ts +1 -1
  375. package/dist/packageVersion.js +1 -1
  376. package/dist/packageVersion.js.map +1 -1
  377. package/dist/public.d.ts +3 -1
  378. package/dist/shared-tree/schematizeTree.d.ts +2 -11
  379. package/dist/shared-tree/schematizeTree.d.ts.map +1 -1
  380. package/dist/shared-tree/schematizeTree.js +13 -2
  381. package/dist/shared-tree/schematizeTree.js.map +1 -1
  382. package/dist/shared-tree/schematizingTreeView.d.ts +4 -4
  383. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  384. package/dist/shared-tree/schematizingTreeView.js +2 -2
  385. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  386. package/dist/shared-tree/sharedTree.d.ts +4 -17
  387. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  388. package/dist/shared-tree/sharedTree.js +4 -8
  389. package/dist/shared-tree/sharedTree.js.map +1 -1
  390. package/dist/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  391. package/dist/shared-tree/sharedTreeChangeCodecs.js +4 -0
  392. package/dist/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  393. package/dist/shared-tree/sharedTreeChangeFamily.js +2 -2
  394. package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  395. package/dist/shared-tree/sharedTreeEditBuilder.d.ts +0 -2
  396. package/dist/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
  397. package/dist/shared-tree/sharedTreeEditBuilder.js.map +1 -1
  398. package/dist/shared-tree/treeApi.js +2 -2
  399. package/dist/shared-tree/treeApi.js.map +1 -1
  400. package/dist/shared-tree/treeCheckout.d.ts +0 -5
  401. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  402. package/dist/shared-tree/treeCheckout.js +5 -3
  403. package/dist/shared-tree/treeCheckout.js.map +1 -1
  404. package/dist/shared-tree/treeView.d.ts +3 -6
  405. package/dist/shared-tree/treeView.d.ts.map +1 -1
  406. package/dist/shared-tree/treeView.js.map +1 -1
  407. package/dist/shared-tree-core/branch.d.ts.map +1 -1
  408. package/dist/shared-tree-core/branch.js +11 -6
  409. package/dist/shared-tree-core/branch.js.map +1 -1
  410. package/dist/shared-tree-core/defaultResubmitMachine.js +3 -3
  411. package/dist/shared-tree-core/defaultResubmitMachine.js.map +1 -1
  412. package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  413. package/dist/shared-tree-core/editManagerCodecs.js +1 -0
  414. package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
  415. package/dist/shared-tree-core/editManagerFormat.d.ts +2 -2
  416. package/dist/shared-tree-core/editManagerFormat.d.ts.map +1 -1
  417. package/dist/shared-tree-core/editManagerFormat.js +6 -1
  418. package/dist/shared-tree-core/editManagerFormat.js.map +1 -1
  419. package/dist/shared-tree-core/messageCodecs.d.ts.map +1 -1
  420. package/dist/shared-tree-core/messageCodecs.js +1 -0
  421. package/dist/shared-tree-core/messageCodecs.js.map +1 -1
  422. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  423. package/dist/shared-tree-core/sharedTreeCore.js +3 -1
  424. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  425. package/dist/simple-tree/api/create.d.ts +54 -0
  426. package/dist/simple-tree/api/create.d.ts.map +1 -0
  427. package/dist/simple-tree/api/create.js +99 -0
  428. package/dist/simple-tree/api/create.js.map +1 -0
  429. package/dist/simple-tree/api/index.d.ts +12 -0
  430. package/dist/simple-tree/api/index.d.ts.map +1 -0
  431. package/dist/simple-tree/api/index.js +28 -0
  432. package/dist/simple-tree/api/index.js.map +1 -0
  433. package/{lib/simple-tree → dist/simple-tree/api}/schemaCreationUtilities.d.ts +7 -4
  434. package/dist/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -0
  435. package/dist/simple-tree/{schemaCreationUtilities.js → api/schemaCreationUtilities.js} +1 -1
  436. package/dist/simple-tree/api/schemaCreationUtilities.js.map +1 -0
  437. package/dist/simple-tree/{schemaFactory.d.ts → api/schemaFactory.d.ts} +15 -14
  438. package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -0
  439. package/dist/simple-tree/{schemaFactory.js → api/schemaFactory.js} +10 -9
  440. package/dist/simple-tree/api/schemaFactory.js.map +1 -0
  441. package/{lib/simple-tree → dist/simple-tree/api}/schemaFactoryRecursive.d.ts +40 -7
  442. package/dist/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -0
  443. package/dist/simple-tree/{schemaFactoryRecursive.js → api/schemaFactoryRecursive.js} +1 -1
  444. package/dist/simple-tree/api/schemaFactoryRecursive.js.map +1 -0
  445. package/dist/simple-tree/api/testRecursiveDomain.d.ts +62 -0
  446. package/dist/simple-tree/api/testRecursiveDomain.d.ts.map +1 -0
  447. package/dist/simple-tree/api/testRecursiveDomain.js.map +1 -0
  448. package/{lib/simple-tree → dist/simple-tree/api}/tree.d.ts +111 -20
  449. package/dist/simple-tree/api/tree.d.ts.map +1 -0
  450. package/dist/simple-tree/api/tree.js +173 -0
  451. package/dist/simple-tree/api/tree.js.map +1 -0
  452. package/dist/simple-tree/{treeNodeApi.d.ts → api/treeNodeApi.d.ts} +6 -5
  453. package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -0
  454. package/dist/simple-tree/{treeNodeApi.js → api/treeNodeApi.js} +28 -20
  455. package/dist/simple-tree/api/treeNodeApi.js.map +1 -0
  456. package/dist/simple-tree/api/verboseTree.d.ts +136 -0
  457. package/dist/simple-tree/api/verboseTree.d.ts.map +1 -0
  458. package/dist/simple-tree/api/verboseTree.js +220 -0
  459. package/dist/simple-tree/api/verboseTree.js.map +1 -0
  460. package/dist/simple-tree/arrayNode.d.ts +3 -3
  461. package/dist/simple-tree/arrayNode.d.ts.map +1 -1
  462. package/dist/simple-tree/arrayNode.js +70 -69
  463. package/dist/simple-tree/arrayNode.js.map +1 -1
  464. package/dist/simple-tree/core/index.d.ts +10 -0
  465. package/dist/simple-tree/core/index.d.ts.map +1 -0
  466. package/dist/simple-tree/core/index.js +27 -0
  467. package/dist/simple-tree/core/index.js.map +1 -0
  468. package/{lib/simple-tree → dist/simple-tree/core}/schemaCaching.d.ts +2 -9
  469. package/dist/simple-tree/core/schemaCaching.d.ts.map +1 -0
  470. package/dist/simple-tree/{schemaCaching.js → core/schemaCaching.js} +2 -23
  471. package/dist/simple-tree/core/schemaCaching.js.map +1 -0
  472. package/dist/simple-tree/core/treeNodeKernel.d.ts +57 -0
  473. package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -0
  474. package/dist/simple-tree/{treeNodeKernel.js → core/treeNodeKernel.js} +49 -4
  475. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -0
  476. package/dist/simple-tree/core/treeNodeSchema.d.ts +149 -0
  477. package/dist/simple-tree/core/treeNodeSchema.d.ts.map +1 -0
  478. package/dist/simple-tree/core/treeNodeSchema.js +35 -0
  479. package/dist/simple-tree/core/treeNodeSchema.js.map +1 -0
  480. package/dist/simple-tree/{types.d.ts → core/types.d.ts} +23 -70
  481. package/dist/simple-tree/core/types.d.ts.map +1 -0
  482. package/dist/simple-tree/core/types.js +117 -0
  483. package/dist/simple-tree/core/types.js.map +1 -0
  484. package/dist/simple-tree/core/withType.d.ts +82 -0
  485. package/dist/simple-tree/core/withType.d.ts.map +1 -0
  486. package/dist/simple-tree/core/withType.js +39 -0
  487. package/dist/simple-tree/core/withType.js.map +1 -0
  488. package/dist/simple-tree/getJsonSchema.d.ts +55 -0
  489. package/dist/simple-tree/getJsonSchema.d.ts.map +1 -0
  490. package/dist/simple-tree/getJsonSchema.js +69 -0
  491. package/dist/simple-tree/getJsonSchema.js.map +1 -0
  492. package/dist/simple-tree/getSimpleFieldSchema.d.ts +14 -0
  493. package/dist/simple-tree/getSimpleFieldSchema.d.ts.map +1 -0
  494. package/dist/simple-tree/getSimpleFieldSchema.js +29 -0
  495. package/dist/simple-tree/getSimpleFieldSchema.js.map +1 -0
  496. package/dist/simple-tree/getSimpleSchema.d.ts +58 -0
  497. package/dist/simple-tree/getSimpleSchema.d.ts.map +1 -0
  498. package/dist/simple-tree/getSimpleSchema.js +68 -0
  499. package/dist/simple-tree/getSimpleSchema.js.map +1 -0
  500. package/dist/simple-tree/index.d.ts +12 -13
  501. package/dist/simple-tree/index.d.ts.map +1 -1
  502. package/dist/simple-tree/index.js +26 -23
  503. package/dist/simple-tree/index.js.map +1 -1
  504. package/dist/simple-tree/jsonSchema.d.ts +206 -0
  505. package/dist/simple-tree/jsonSchema.d.ts.map +1 -0
  506. package/dist/{feature-libraries/schema-aware/index.js → simple-tree/jsonSchema.js} +1 -1
  507. package/dist/simple-tree/jsonSchema.js.map +1 -0
  508. package/dist/simple-tree/leafNodeSchema.d.ts +1 -1
  509. package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
  510. package/dist/simple-tree/leafNodeSchema.js +3 -4
  511. package/dist/simple-tree/leafNodeSchema.js.map +1 -1
  512. package/dist/simple-tree/mapNode.d.ts +9 -3
  513. package/dist/simple-tree/mapNode.d.ts.map +1 -1
  514. package/dist/simple-tree/mapNode.js +33 -35
  515. package/dist/simple-tree/mapNode.js.map +1 -1
  516. package/dist/simple-tree/objectNode.d.ts +18 -16
  517. package/dist/simple-tree/objectNode.d.ts.map +1 -1
  518. package/dist/simple-tree/objectNode.js +43 -44
  519. package/dist/simple-tree/objectNode.js.map +1 -1
  520. package/dist/simple-tree/objectNodeTypes.d.ts +38 -0
  521. package/dist/simple-tree/objectNodeTypes.d.ts.map +1 -0
  522. package/dist/simple-tree/objectNodeTypes.js +19 -0
  523. package/dist/simple-tree/objectNodeTypes.js.map +1 -0
  524. package/dist/simple-tree/proxies.d.ts +6 -25
  525. package/dist/simple-tree/proxies.d.ts.map +1 -1
  526. package/dist/simple-tree/proxies.js +50 -63
  527. package/dist/simple-tree/proxies.js.map +1 -1
  528. package/dist/simple-tree/proxyBinding.d.ts +45 -22
  529. package/dist/simple-tree/proxyBinding.d.ts.map +1 -1
  530. package/dist/simple-tree/proxyBinding.js +94 -59
  531. package/dist/simple-tree/proxyBinding.js.map +1 -1
  532. package/dist/simple-tree/schemaTypes.d.ts +10 -159
  533. package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
  534. package/dist/simple-tree/schemaTypes.js +11 -42
  535. package/dist/simple-tree/schemaTypes.js.map +1 -1
  536. package/dist/simple-tree/simpleSchema.d.ts +124 -0
  537. package/dist/simple-tree/simpleSchema.d.ts.map +1 -0
  538. package/dist/{feature-libraries/schema-aware/schemaAware.js → simple-tree/simpleSchema.js} +1 -1
  539. package/dist/simple-tree/simpleSchema.js.map +1 -0
  540. package/dist/simple-tree/simpleSchemaToJsonSchema.d.ts +12 -0
  541. package/dist/simple-tree/simpleSchemaToJsonSchema.d.ts.map +1 -0
  542. package/dist/simple-tree/simpleSchemaToJsonSchema.js +146 -0
  543. package/dist/simple-tree/simpleSchemaToJsonSchema.js.map +1 -0
  544. package/dist/simple-tree/toFlexSchema.d.ts +4 -12
  545. package/dist/simple-tree/toFlexSchema.d.ts.map +1 -1
  546. package/dist/simple-tree/toFlexSchema.js +42 -52
  547. package/dist/simple-tree/toFlexSchema.js.map +1 -1
  548. package/dist/simple-tree/toMapTree.d.ts +39 -39
  549. package/dist/simple-tree/toMapTree.d.ts.map +1 -1
  550. package/dist/simple-tree/toMapTree.js +227 -171
  551. package/dist/simple-tree/toMapTree.js.map +1 -1
  552. package/dist/simple-tree/treeNodeValid.d.ts +74 -0
  553. package/dist/simple-tree/treeNodeValid.d.ts.map +1 -0
  554. package/dist/simple-tree/{types.js → treeNodeValid.js} +18 -111
  555. package/dist/simple-tree/treeNodeValid.js.map +1 -0
  556. package/dist/simple-tree/typesUnsafe.d.ts +35 -4
  557. package/dist/simple-tree/typesUnsafe.d.ts.map +1 -1
  558. package/dist/simple-tree/typesUnsafe.js.map +1 -1
  559. package/dist/simple-tree/viewSchemaToSimpleSchema.d.ts +11 -0
  560. package/dist/simple-tree/viewSchemaToSimpleSchema.d.ts.map +1 -0
  561. package/dist/simple-tree/viewSchemaToSimpleSchema.js +171 -0
  562. package/dist/simple-tree/viewSchemaToSimpleSchema.js.map +1 -0
  563. package/dist/util/brand.d.ts +0 -3
  564. package/dist/util/brand.d.ts.map +1 -1
  565. package/dist/util/brand.js +1 -2
  566. package/dist/util/brand.js.map +1 -1
  567. package/dist/util/brandedMap.d.ts +0 -5
  568. package/dist/util/brandedMap.d.ts.map +1 -1
  569. package/dist/util/brandedMap.js +0 -1
  570. package/dist/util/brandedMap.js.map +1 -1
  571. package/dist/util/idAllocator.d.ts +0 -2
  572. package/dist/util/idAllocator.d.ts.map +1 -1
  573. package/dist/util/idAllocator.js +0 -1
  574. package/dist/util/idAllocator.js.map +1 -1
  575. package/dist/util/index.d.ts +2 -2
  576. package/dist/util/index.d.ts.map +1 -1
  577. package/dist/util/index.js +4 -2
  578. package/dist/util/index.js.map +1 -1
  579. package/dist/util/nestedMap.d.ts +5 -19
  580. package/dist/util/nestedMap.d.ts.map +1 -1
  581. package/dist/util/nestedMap.js +17 -17
  582. package/dist/util/nestedMap.js.map +1 -1
  583. package/dist/util/opaque.d.ts +0 -4
  584. package/dist/util/opaque.d.ts.map +1 -1
  585. package/dist/util/opaque.js +0 -2
  586. package/dist/util/opaque.js.map +1 -1
  587. package/dist/util/rangeMap.d.ts +0 -2
  588. package/dist/util/rangeMap.d.ts.map +1 -1
  589. package/dist/util/rangeMap.js +4 -3
  590. package/dist/util/rangeMap.js.map +1 -1
  591. package/dist/util/transactionResult.d.ts +0 -1
  592. package/dist/util/transactionResult.d.ts.map +1 -1
  593. package/dist/util/transactionResult.js +0 -1
  594. package/dist/util/transactionResult.js.map +1 -1
  595. package/dist/util/typeCheck.d.ts +2 -20
  596. package/dist/util/typeCheck.d.ts.map +1 -1
  597. package/dist/util/typeCheck.js.map +1 -1
  598. package/dist/util/typeCheckTests.d.ts +4 -4
  599. package/dist/util/typeCheckTests.d.ts.map +1 -1
  600. package/dist/util/typeCheckTests.js.map +1 -1
  601. package/dist/util/typeUtils.d.ts +0 -7
  602. package/dist/util/typeUtils.d.ts.map +1 -1
  603. package/dist/util/typeUtils.js.map +1 -1
  604. package/dist/util/utils.d.ts +6 -8
  605. package/dist/util/utils.d.ts.map +1 -1
  606. package/dist/util/utils.js +14 -5
  607. package/dist/util/utils.js.map +1 -1
  608. package/lib/beta.d.ts +3 -1
  609. package/lib/codec/discriminatedUnions.d.ts +11 -5
  610. package/lib/codec/discriminatedUnions.d.ts.map +1 -1
  611. package/lib/codec/discriminatedUnions.js.map +1 -1
  612. package/lib/codec/index.d.ts +1 -1
  613. package/lib/codec/index.d.ts.map +1 -1
  614. package/lib/codec/index.js +1 -1
  615. package/lib/codec/index.js.map +1 -1
  616. package/lib/core/forest/editableForest.d.ts +1 -5
  617. package/lib/core/forest/editableForest.d.ts.map +1 -1
  618. package/lib/core/forest/editableForest.js.map +1 -1
  619. package/lib/core/forest/forest.d.ts +0 -6
  620. package/lib/core/forest/forest.d.ts.map +1 -1
  621. package/lib/core/forest/forest.js +0 -2
  622. package/lib/core/forest/forest.js.map +1 -1
  623. package/lib/core/index.d.ts +2 -2
  624. package/lib/core/index.d.ts.map +1 -1
  625. package/lib/core/index.js +2 -2
  626. package/lib/core/index.js.map +1 -1
  627. package/lib/core/rebase/changeRebaser.d.ts +0 -4
  628. package/lib/core/rebase/changeRebaser.d.ts.map +1 -1
  629. package/lib/core/rebase/changeRebaser.js.map +1 -1
  630. package/lib/core/rebase/index.d.ts +1 -1
  631. package/lib/core/rebase/index.d.ts.map +1 -1
  632. package/lib/core/rebase/index.js +1 -1
  633. package/lib/core/rebase/index.js.map +1 -1
  634. package/lib/core/rebase/types.d.ts +1 -8
  635. package/lib/core/rebase/types.d.ts.map +1 -1
  636. package/lib/core/rebase/types.js +1 -7
  637. package/lib/core/rebase/types.js.map +1 -1
  638. package/lib/core/rebase/utils.d.ts +0 -1
  639. package/lib/core/rebase/utils.d.ts.map +1 -1
  640. package/lib/core/rebase/utils.js +13 -8
  641. package/lib/core/rebase/utils.js.map +1 -1
  642. package/lib/core/schema-stored/multiplicity.d.ts +0 -1
  643. package/lib/core/schema-stored/multiplicity.d.ts.map +1 -1
  644. package/lib/core/schema-stored/multiplicity.js +0 -1
  645. package/lib/core/schema-stored/multiplicity.js.map +1 -1
  646. package/lib/core/schema-stored/schema.d.ts +0 -7
  647. package/lib/core/schema-stored/schema.d.ts.map +1 -1
  648. package/lib/core/schema-stored/schema.js +0 -4
  649. package/lib/core/schema-stored/schema.js.map +1 -1
  650. package/lib/core/schema-stored/storedSchemaRepository.d.ts +0 -3
  651. package/lib/core/schema-stored/storedSchemaRepository.d.ts.map +1 -1
  652. package/lib/core/schema-stored/storedSchemaRepository.js.map +1 -1
  653. package/lib/core/schema-view/view.d.ts +0 -3
  654. package/lib/core/schema-view/view.d.ts.map +1 -1
  655. package/lib/core/schema-view/view.js +0 -1
  656. package/lib/core/schema-view/view.js.map +1 -1
  657. package/lib/core/tree/anchorSet.d.ts +0 -10
  658. package/lib/core/tree/anchorSet.d.ts.map +1 -1
  659. package/lib/core/tree/anchorSet.js +1 -4
  660. package/lib/core/tree/anchorSet.js.map +1 -1
  661. package/lib/core/tree/cursor.d.ts +1 -6
  662. package/lib/core/tree/cursor.d.ts.map +1 -1
  663. package/lib/core/tree/cursor.js +0 -2
  664. package/lib/core/tree/cursor.js.map +1 -1
  665. package/lib/core/tree/delta.d.ts +0 -11
  666. package/lib/core/tree/delta.d.ts.map +1 -1
  667. package/lib/core/tree/delta.js.map +1 -1
  668. package/lib/core/tree/detachedFieldIndexCodec.d.ts.map +1 -1
  669. package/lib/core/tree/detachedFieldIndexCodec.js +4 -3
  670. package/lib/core/tree/detachedFieldIndexCodec.js.map +1 -1
  671. package/lib/core/tree/detachedFieldIndexTypes.d.ts +0 -1
  672. package/lib/core/tree/detachedFieldIndexTypes.d.ts.map +1 -1
  673. package/lib/core/tree/detachedFieldIndexTypes.js.map +1 -1
  674. package/lib/core/tree/index.d.ts +1 -1
  675. package/lib/core/tree/index.d.ts.map +1 -1
  676. package/lib/core/tree/index.js +1 -0
  677. package/lib/core/tree/index.js.map +1 -1
  678. package/lib/core/tree/mapTree.d.ts +20 -4
  679. package/lib/core/tree/mapTree.d.ts.map +1 -1
  680. package/lib/core/tree/mapTree.js +27 -1
  681. package/lib/core/tree/mapTree.js.map +1 -1
  682. package/lib/core/tree/pathTree.d.ts +0 -11
  683. package/lib/core/tree/pathTree.d.ts.map +1 -1
  684. package/lib/core/tree/pathTree.js.map +1 -1
  685. package/lib/core/tree/treeTextFormat.d.ts.map +1 -1
  686. package/lib/core/tree/treeTextFormat.js +3 -2
  687. package/lib/core/tree/treeTextFormat.js.map +1 -1
  688. package/lib/core/tree/types.d.ts +0 -11
  689. package/lib/core/tree/types.d.ts.map +1 -1
  690. package/lib/core/tree/types.js +0 -4
  691. package/lib/core/tree/types.js.map +1 -1
  692. package/lib/core/tree/visitDelta.d.ts +0 -1
  693. package/lib/core/tree/visitDelta.d.ts.map +1 -1
  694. package/lib/core/tree/visitDelta.js +2 -2
  695. package/lib/core/tree/visitDelta.js.map +1 -1
  696. package/lib/core/tree/visitPath.d.ts +0 -2
  697. package/lib/core/tree/visitPath.d.ts.map +1 -1
  698. package/lib/core/tree/visitPath.js.map +1 -1
  699. package/lib/core/tree/visitorUtils.d.ts +0 -1
  700. package/lib/core/tree/visitorUtils.d.ts.map +1 -1
  701. package/lib/core/tree/visitorUtils.js.map +1 -1
  702. package/lib/domains/index.d.ts +1 -1
  703. package/lib/domains/index.d.ts.map +1 -1
  704. package/lib/domains/index.js +1 -1
  705. package/lib/domains/index.js.map +1 -1
  706. package/lib/domains/json/index.d.ts +1 -1
  707. package/lib/domains/json/index.d.ts.map +1 -1
  708. package/lib/domains/json/index.js +1 -1
  709. package/lib/domains/json/index.js.map +1 -1
  710. package/lib/domains/json/jsonCursor.d.ts +36 -2
  711. package/lib/domains/json/jsonCursor.d.ts.map +1 -1
  712. package/lib/domains/json/jsonCursor.js +76 -5
  713. package/lib/domains/json/jsonCursor.js.map +1 -1
  714. package/lib/domains/json/jsonDomainSchema.d.ts +13 -3
  715. package/lib/domains/json/jsonDomainSchema.d.ts.map +1 -1
  716. package/lib/domains/json/jsonDomainSchema.js +9 -1
  717. package/lib/domains/json/jsonDomainSchema.js.map +1 -1
  718. package/lib/domains/leafDomain.d.ts +0 -1
  719. package/lib/domains/leafDomain.d.ts.map +1 -1
  720. package/lib/domains/leafDomain.js +0 -1
  721. package/lib/domains/leafDomain.js.map +1 -1
  722. package/lib/domains/schemaBuilder.d.ts +1 -7
  723. package/lib/domains/schemaBuilder.d.ts.map +1 -1
  724. package/lib/domains/schemaBuilder.js +1 -11
  725. package/lib/domains/schemaBuilder.js.map +1 -1
  726. package/lib/events/events.d.ts +0 -4
  727. package/lib/events/events.d.ts.map +1 -1
  728. package/lib/events/events.js +0 -1
  729. package/lib/events/events.js.map +1 -1
  730. package/lib/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
  731. package/lib/feature-libraries/chunked-forest/basicChunk.js +9 -4
  732. package/lib/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
  733. package/lib/feature-libraries/chunked-forest/chunk.d.ts +1 -1
  734. package/lib/feature-libraries/chunked-forest/chunk.d.ts.map +1 -1
  735. package/lib/feature-libraries/chunked-forest/chunk.js.map +1 -1
  736. package/lib/feature-libraries/chunked-forest/chunkTree.js +4 -4
  737. package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  738. package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  739. package/lib/feature-libraries/chunked-forest/chunkedForest.js +8 -6
  740. package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  741. package/lib/feature-libraries/chunked-forest/codec/chunkCodecUtilities.js +2 -2
  742. package/lib/feature-libraries/chunked-forest/codec/chunkCodecUtilities.js.map +1 -1
  743. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  744. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js +9 -6
  745. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  746. package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
  747. package/lib/feature-libraries/chunked-forest/uniformChunk.js +6 -4
  748. package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  749. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts +12 -24
  750. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  751. package/lib/feature-libraries/default-schema/defaultEditBuilder.js +6 -16
  752. package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  753. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts +0 -6
  754. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  755. package/lib/feature-libraries/default-schema/defaultFieldKinds.js +11 -1
  756. package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  757. package/lib/feature-libraries/default-schema/defaultSchema.d.ts +0 -1
  758. package/lib/feature-libraries/default-schema/defaultSchema.d.ts.map +1 -1
  759. package/lib/feature-libraries/default-schema/defaultSchema.js +0 -1
  760. package/lib/feature-libraries/default-schema/defaultSchema.js.map +1 -1
  761. package/lib/feature-libraries/default-schema/index.d.ts +1 -1
  762. package/lib/feature-libraries/default-schema/index.d.ts.map +1 -1
  763. package/lib/feature-libraries/default-schema/index.js +1 -1
  764. package/lib/feature-libraries/default-schema/index.js.map +1 -1
  765. package/lib/feature-libraries/default-schema/schemaChecker.d.ts +6 -0
  766. package/lib/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
  767. package/lib/feature-libraries/default-schema/schemaChecker.js +6 -0
  768. package/lib/feature-libraries/default-schema/schemaChecker.js.map +1 -1
  769. package/lib/feature-libraries/editableTreeBinder.d.ts +0 -67
  770. package/lib/feature-libraries/editableTreeBinder.d.ts.map +1 -1
  771. package/lib/feature-libraries/editableTreeBinder.js +6 -25
  772. package/lib/feature-libraries/editableTreeBinder.js.map +1 -1
  773. package/lib/feature-libraries/fieldGenerator.d.ts +0 -3
  774. package/lib/feature-libraries/fieldGenerator.d.ts.map +1 -1
  775. package/lib/feature-libraries/fieldGenerator.js +0 -1
  776. package/lib/feature-libraries/fieldGenerator.js.map +1 -1
  777. package/lib/feature-libraries/flex-map-tree/index.d.ts +1 -1
  778. package/lib/feature-libraries/flex-map-tree/index.d.ts.map +1 -1
  779. package/lib/feature-libraries/flex-map-tree/index.js +1 -1
  780. package/lib/feature-libraries/flex-map-tree/index.js.map +1 -1
  781. package/lib/feature-libraries/flex-map-tree/mapTreeNode.d.ts +57 -49
  782. package/lib/feature-libraries/flex-map-tree/mapTreeNode.d.ts.map +1 -1
  783. package/lib/feature-libraries/flex-map-tree/mapTreeNode.js +172 -168
  784. package/lib/feature-libraries/flex-map-tree/mapTreeNode.js.map +1 -1
  785. package/lib/feature-libraries/flex-tree/context.d.ts +0 -1
  786. package/lib/feature-libraries/flex-tree/context.d.ts.map +1 -1
  787. package/lib/feature-libraries/flex-tree/context.js.map +1 -1
  788. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts +17 -282
  789. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  790. package/lib/feature-libraries/flex-tree/flexTreeTypes.js +0 -4
  791. package/lib/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  792. package/lib/feature-libraries/flex-tree/index.d.ts +1 -1
  793. package/lib/feature-libraries/flex-tree/index.d.ts.map +1 -1
  794. package/lib/feature-libraries/flex-tree/index.js.map +1 -1
  795. package/lib/feature-libraries/flex-tree/lazyField.d.ts +9 -26
  796. package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  797. package/lib/feature-libraries/flex-tree/lazyField.js +28 -101
  798. package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
  799. package/lib/feature-libraries/flex-tree/lazyNode.d.ts +2 -10
  800. package/lib/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  801. package/lib/feature-libraries/flex-tree/lazyNode.js +4 -42
  802. package/lib/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  803. package/lib/feature-libraries/flex-tree/treeEvents.d.ts +0 -2
  804. package/lib/feature-libraries/flex-tree/treeEvents.d.ts.map +1 -1
  805. package/lib/feature-libraries/flex-tree/treeEvents.js.map +1 -1
  806. package/lib/feature-libraries/flex-tree/utilities.d.ts +2 -1
  807. package/lib/feature-libraries/flex-tree/utilities.d.ts.map +1 -1
  808. package/lib/feature-libraries/flex-tree/utilities.js +4 -0
  809. package/lib/feature-libraries/flex-tree/utilities.js.map +1 -1
  810. package/lib/feature-libraries/forest-summary/codec.js +3 -3
  811. package/lib/feature-libraries/forest-summary/codec.js.map +1 -1
  812. package/lib/feature-libraries/index.d.ts +6 -8
  813. package/lib/feature-libraries/index.d.ts.map +1 -1
  814. package/lib/feature-libraries/index.js +5 -6
  815. package/lib/feature-libraries/index.js.map +1 -1
  816. package/lib/feature-libraries/mapTreeCursor.d.ts +6 -2
  817. package/lib/feature-libraries/mapTreeCursor.d.ts.map +1 -1
  818. package/lib/feature-libraries/mapTreeCursor.js +7 -0
  819. package/lib/feature-libraries/mapTreeCursor.js.map +1 -1
  820. package/lib/feature-libraries/memoizedIdRangeAllocator.d.ts +0 -4
  821. package/lib/feature-libraries/memoizedIdRangeAllocator.d.ts.map +1 -1
  822. package/lib/feature-libraries/memoizedIdRangeAllocator.js +0 -1
  823. package/lib/feature-libraries/memoizedIdRangeAllocator.js.map +1 -1
  824. package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts +0 -2
  825. package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
  826. package/lib/feature-libraries/modular-schema/crossFieldQueries.js +0 -1
  827. package/lib/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
  828. package/lib/feature-libraries/modular-schema/discrepancies.d.ts +18 -0
  829. package/lib/feature-libraries/modular-schema/discrepancies.d.ts.map +1 -1
  830. package/lib/feature-libraries/modular-schema/discrepancies.js +103 -1
  831. package/lib/feature-libraries/modular-schema/discrepancies.js.map +1 -1
  832. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts +0 -8
  833. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  834. package/lib/feature-libraries/modular-schema/fieldChangeHandler.js +0 -1
  835. package/lib/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  836. package/lib/feature-libraries/modular-schema/fieldKind.d.ts +1 -3
  837. package/lib/feature-libraries/modular-schema/fieldKind.d.ts.map +1 -1
  838. package/lib/feature-libraries/modular-schema/fieldKind.js +1 -2
  839. package/lib/feature-libraries/modular-schema/fieldKind.js.map +1 -1
  840. package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts +1 -2
  841. package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  842. package/lib/feature-libraries/modular-schema/genericFieldKind.js +56 -83
  843. package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  844. package/lib/feature-libraries/modular-schema/genericFieldKindCodecs.d.ts +1 -1
  845. package/lib/feature-libraries/modular-schema/genericFieldKindCodecs.d.ts.map +1 -1
  846. package/lib/feature-libraries/modular-schema/genericFieldKindCodecs.js +6 -9
  847. package/lib/feature-libraries/modular-schema/genericFieldKindCodecs.js.map +1 -1
  848. package/lib/feature-libraries/modular-schema/genericFieldKindTypes.d.ts +3 -14
  849. package/lib/feature-libraries/modular-schema/genericFieldKindTypes.d.ts.map +1 -1
  850. package/lib/feature-libraries/modular-schema/genericFieldKindTypes.js +4 -1
  851. package/lib/feature-libraries/modular-schema/genericFieldKindTypes.js.map +1 -1
  852. package/lib/feature-libraries/modular-schema/index.d.ts +2 -2
  853. package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
  854. package/lib/feature-libraries/modular-schema/index.js +1 -1
  855. package/lib/feature-libraries/modular-schema/index.js.map +1 -1
  856. package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  857. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js +42 -25
  858. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  859. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +9 -8
  860. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  861. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +169 -206
  862. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  863. package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts +8 -14
  864. package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
  865. package/lib/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
  866. package/lib/feature-libraries/node-key/nodeKey.d.ts +0 -4
  867. package/lib/feature-libraries/node-key/nodeKey.d.ts.map +1 -1
  868. package/lib/feature-libraries/node-key/nodeKey.js +0 -2
  869. package/lib/feature-libraries/node-key/nodeKey.js.map +1 -1
  870. package/lib/feature-libraries/node-key/nodeKeyManager.d.ts +0 -1
  871. package/lib/feature-libraries/node-key/nodeKeyManager.d.ts.map +1 -1
  872. package/lib/feature-libraries/node-key/nodeKeyManager.js.map +1 -1
  873. package/lib/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  874. package/lib/feature-libraries/object-forest/objectForest.js +2 -11
  875. package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
  876. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts +6 -6
  877. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts.map +1 -1
  878. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts +7 -7
  879. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts.map +1 -1
  880. package/lib/feature-libraries/schemaBuilderBase.d.ts +2 -28
  881. package/lib/feature-libraries/schemaBuilderBase.d.ts.map +1 -1
  882. package/lib/feature-libraries/schemaBuilderBase.js +2 -28
  883. package/lib/feature-libraries/schemaBuilderBase.js.map +1 -1
  884. package/lib/feature-libraries/sequence-field/compose.d.ts.map +1 -1
  885. package/lib/feature-libraries/sequence-field/compose.js +25 -22
  886. package/lib/feature-libraries/sequence-field/compose.js.map +1 -1
  887. package/lib/feature-libraries/sequence-field/formatV2.d.ts +3 -3
  888. package/lib/feature-libraries/sequence-field/formatV2.d.ts.map +1 -1
  889. package/lib/feature-libraries/sequence-field/formatV2.js +3 -3
  890. package/lib/feature-libraries/sequence-field/formatV2.js.map +1 -1
  891. package/lib/feature-libraries/sequence-field/formatV3.d.ts +195 -0
  892. package/lib/feature-libraries/sequence-field/formatV3.d.ts.map +1 -0
  893. package/lib/feature-libraries/sequence-field/formatV3.js +19 -0
  894. package/lib/feature-libraries/sequence-field/formatV3.js.map +1 -0
  895. package/lib/feature-libraries/sequence-field/helperTypes.d.ts +11 -0
  896. package/lib/feature-libraries/sequence-field/helperTypes.d.ts.map +1 -1
  897. package/lib/feature-libraries/sequence-field/helperTypes.js.map +1 -1
  898. package/lib/feature-libraries/sequence-field/index.d.ts +1 -1
  899. package/lib/feature-libraries/sequence-field/index.d.ts.map +1 -1
  900. package/lib/feature-libraries/sequence-field/index.js.map +1 -1
  901. package/lib/feature-libraries/sequence-field/invert.d.ts.map +1 -1
  902. package/lib/feature-libraries/sequence-field/invert.js +22 -14
  903. package/lib/feature-libraries/sequence-field/invert.js.map +1 -1
  904. package/lib/feature-libraries/sequence-field/markQueue.js +2 -2
  905. package/lib/feature-libraries/sequence-field/markQueue.js.map +1 -1
  906. package/lib/feature-libraries/sequence-field/moveEffectTable.d.ts +2 -2
  907. package/lib/feature-libraries/sequence-field/moveEffectTable.d.ts.map +1 -1
  908. package/lib/feature-libraries/sequence-field/moveEffectTable.js.map +1 -1
  909. package/lib/feature-libraries/sequence-field/rebase.d.ts.map +1 -1
  910. package/lib/feature-libraries/sequence-field/rebase.js +25 -7
  911. package/lib/feature-libraries/sequence-field/rebase.js.map +1 -1
  912. package/lib/feature-libraries/sequence-field/replaceRevisions.d.ts.map +1 -1
  913. package/lib/feature-libraries/sequence-field/replaceRevisions.js +16 -3
  914. package/lib/feature-libraries/sequence-field/replaceRevisions.js.map +1 -1
  915. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts.map +1 -1
  916. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js +40 -6
  917. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +1 -1
  918. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts +4 -1
  919. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
  920. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js +55 -11
  921. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
  922. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts +11 -0
  923. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts.map +1 -0
  924. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.js +81 -0
  925. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -0
  926. package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts.map +1 -1
  927. package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.js +2 -0
  928. package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.js.map +1 -1
  929. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts.map +1 -1
  930. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.js +5 -2
  931. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
  932. package/lib/feature-libraries/sequence-field/types.d.ts +23 -4
  933. package/lib/feature-libraries/sequence-field/types.d.ts.map +1 -1
  934. package/lib/feature-libraries/sequence-field/types.js.map +1 -1
  935. package/lib/feature-libraries/sequence-field/utils.d.ts +5 -4
  936. package/lib/feature-libraries/sequence-field/utils.d.ts.map +1 -1
  937. package/lib/feature-libraries/sequence-field/utils.js +67 -41
  938. package/lib/feature-libraries/sequence-field/utils.js.map +1 -1
  939. package/lib/feature-libraries/storedToViewSchema.d.ts +0 -1
  940. package/lib/feature-libraries/storedToViewSchema.d.ts.map +1 -1
  941. package/lib/feature-libraries/storedToViewSchema.js +0 -1
  942. package/lib/feature-libraries/storedToViewSchema.js.map +1 -1
  943. package/lib/feature-libraries/treeCursorUtils.d.ts +0 -6
  944. package/lib/feature-libraries/treeCursorUtils.d.ts.map +1 -1
  945. package/lib/feature-libraries/treeCursorUtils.js +9 -7
  946. package/lib/feature-libraries/treeCursorUtils.js.map +1 -1
  947. package/lib/feature-libraries/treeTextCursor.d.ts +0 -2
  948. package/lib/feature-libraries/treeTextCursor.d.ts.map +1 -1
  949. package/lib/feature-libraries/treeTextCursor.js +0 -2
  950. package/lib/feature-libraries/treeTextCursor.js.map +1 -1
  951. package/lib/feature-libraries/typed-schema/flexList.d.ts +0 -3
  952. package/lib/feature-libraries/typed-schema/flexList.d.ts.map +1 -1
  953. package/lib/feature-libraries/typed-schema/flexList.js.map +1 -1
  954. package/lib/feature-libraries/typed-schema/index.d.ts +1 -1
  955. package/lib/feature-libraries/typed-schema/index.d.ts.map +1 -1
  956. package/lib/feature-libraries/typed-schema/index.js +1 -1
  957. package/lib/feature-libraries/typed-schema/index.js.map +1 -1
  958. package/lib/feature-libraries/typed-schema/schemaCollection.d.ts.map +1 -1
  959. package/lib/feature-libraries/typed-schema/schemaCollection.js +1 -5
  960. package/lib/feature-libraries/typed-schema/schemaCollection.js.map +1 -1
  961. package/lib/feature-libraries/typed-schema/typedTreeSchema.d.ts +2 -41
  962. package/lib/feature-libraries/typed-schema/typedTreeSchema.d.ts.map +1 -1
  963. package/lib/feature-libraries/typed-schema/typedTreeSchema.js +1 -38
  964. package/lib/feature-libraries/typed-schema/typedTreeSchema.js.map +1 -1
  965. package/lib/feature-libraries/typed-schema/view.d.ts +0 -1
  966. package/lib/feature-libraries/typed-schema/view.d.ts.map +1 -1
  967. package/lib/feature-libraries/typed-schema/view.js.map +1 -1
  968. package/lib/index.d.ts +8 -9
  969. package/lib/index.d.ts.map +1 -1
  970. package/lib/index.js +4 -9
  971. package/lib/index.js.map +1 -1
  972. package/lib/internalTypes.d.ts +1 -1
  973. package/lib/internalTypes.d.ts.map +1 -1
  974. package/lib/internalTypes.js.map +1 -1
  975. package/lib/packageVersion.d.ts +1 -1
  976. package/lib/packageVersion.js +1 -1
  977. package/lib/packageVersion.js.map +1 -1
  978. package/lib/public.d.ts +3 -1
  979. package/lib/shared-tree/schematizeTree.d.ts +2 -11
  980. package/lib/shared-tree/schematizeTree.d.ts.map +1 -1
  981. package/lib/shared-tree/schematizeTree.js +15 -4
  982. package/lib/shared-tree/schematizeTree.js.map +1 -1
  983. package/lib/shared-tree/schematizingTreeView.d.ts +4 -4
  984. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  985. package/lib/shared-tree/schematizingTreeView.js +3 -3
  986. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  987. package/lib/shared-tree/sharedTree.d.ts +4 -17
  988. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  989. package/lib/shared-tree/sharedTree.js +6 -10
  990. package/lib/shared-tree/sharedTree.js.map +1 -1
  991. package/lib/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  992. package/lib/shared-tree/sharedTreeChangeCodecs.js +4 -0
  993. package/lib/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  994. package/lib/shared-tree/sharedTreeChangeFamily.js +3 -3
  995. package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  996. package/lib/shared-tree/sharedTreeEditBuilder.d.ts +0 -2
  997. package/lib/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
  998. package/lib/shared-tree/sharedTreeEditBuilder.js.map +1 -1
  999. package/lib/shared-tree/treeApi.js +3 -3
  1000. package/lib/shared-tree/treeApi.js.map +1 -1
  1001. package/lib/shared-tree/treeCheckout.d.ts +0 -5
  1002. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  1003. package/lib/shared-tree/treeCheckout.js +6 -4
  1004. package/lib/shared-tree/treeCheckout.js.map +1 -1
  1005. package/lib/shared-tree/treeView.d.ts +3 -6
  1006. package/lib/shared-tree/treeView.d.ts.map +1 -1
  1007. package/lib/shared-tree/treeView.js.map +1 -1
  1008. package/lib/shared-tree-core/branch.d.ts.map +1 -1
  1009. package/lib/shared-tree-core/branch.js +12 -7
  1010. package/lib/shared-tree-core/branch.js.map +1 -1
  1011. package/lib/shared-tree-core/defaultResubmitMachine.js +4 -4
  1012. package/lib/shared-tree-core/defaultResubmitMachine.js.map +1 -1
  1013. package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  1014. package/lib/shared-tree-core/editManagerCodecs.js +1 -0
  1015. package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
  1016. package/lib/shared-tree-core/editManagerFormat.d.ts +2 -2
  1017. package/lib/shared-tree-core/editManagerFormat.d.ts.map +1 -1
  1018. package/lib/shared-tree-core/editManagerFormat.js +6 -1
  1019. package/lib/shared-tree-core/editManagerFormat.js.map +1 -1
  1020. package/lib/shared-tree-core/messageCodecs.d.ts.map +1 -1
  1021. package/lib/shared-tree-core/messageCodecs.js +1 -0
  1022. package/lib/shared-tree-core/messageCodecs.js.map +1 -1
  1023. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  1024. package/lib/shared-tree-core/sharedTreeCore.js +4 -2
  1025. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  1026. package/lib/simple-tree/api/create.d.ts +54 -0
  1027. package/lib/simple-tree/api/create.d.ts.map +1 -0
  1028. package/lib/simple-tree/api/create.js +92 -0
  1029. package/lib/simple-tree/api/create.js.map +1 -0
  1030. package/lib/simple-tree/api/index.d.ts +12 -0
  1031. package/lib/simple-tree/api/index.d.ts.map +1 -0
  1032. package/lib/simple-tree/api/index.js +13 -0
  1033. package/lib/simple-tree/api/index.js.map +1 -0
  1034. package/{dist/simple-tree → lib/simple-tree/api}/schemaCreationUtilities.d.ts +7 -4
  1035. package/lib/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -0
  1036. package/lib/simple-tree/{schemaCreationUtilities.js → api/schemaCreationUtilities.js} +1 -1
  1037. package/lib/simple-tree/api/schemaCreationUtilities.js.map +1 -0
  1038. package/lib/simple-tree/{schemaFactory.d.ts → api/schemaFactory.d.ts} +15 -14
  1039. package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -0
  1040. package/lib/simple-tree/{schemaFactory.js → api/schemaFactory.js} +9 -8
  1041. package/lib/simple-tree/api/schemaFactory.js.map +1 -0
  1042. package/{dist/simple-tree → lib/simple-tree/api}/schemaFactoryRecursive.d.ts +40 -7
  1043. package/lib/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -0
  1044. package/lib/simple-tree/{schemaFactoryRecursive.js → api/schemaFactoryRecursive.js} +1 -1
  1045. package/lib/simple-tree/api/schemaFactoryRecursive.js.map +1 -0
  1046. package/lib/simple-tree/api/testRecursiveDomain.d.ts +62 -0
  1047. package/lib/simple-tree/api/testRecursiveDomain.d.ts.map +1 -0
  1048. package/lib/simple-tree/api/testRecursiveDomain.js.map +1 -0
  1049. package/{dist/simple-tree → lib/simple-tree/api}/tree.d.ts +111 -20
  1050. package/lib/simple-tree/api/tree.d.ts.map +1 -0
  1051. package/lib/simple-tree/api/tree.js +165 -0
  1052. package/lib/simple-tree/api/tree.js.map +1 -0
  1053. package/lib/simple-tree/{treeNodeApi.d.ts → api/treeNodeApi.d.ts} +6 -5
  1054. package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -0
  1055. package/lib/simple-tree/{treeNodeApi.js → api/treeNodeApi.js} +25 -17
  1056. package/lib/simple-tree/api/treeNodeApi.js.map +1 -0
  1057. package/lib/simple-tree/api/verboseTree.d.ts +136 -0
  1058. package/lib/simple-tree/api/verboseTree.d.ts.map +1 -0
  1059. package/lib/simple-tree/api/verboseTree.js +213 -0
  1060. package/lib/simple-tree/api/verboseTree.js.map +1 -0
  1061. package/lib/simple-tree/arrayNode.d.ts +3 -3
  1062. package/lib/simple-tree/arrayNode.d.ts.map +1 -1
  1063. package/lib/simple-tree/arrayNode.js +56 -53
  1064. package/lib/simple-tree/arrayNode.js.map +1 -1
  1065. package/lib/simple-tree/core/index.d.ts +10 -0
  1066. package/lib/simple-tree/core/index.d.ts.map +1 -0
  1067. package/lib/simple-tree/core/index.js +10 -0
  1068. package/lib/simple-tree/core/index.js.map +1 -0
  1069. package/{dist/simple-tree → lib/simple-tree/core}/schemaCaching.d.ts +2 -9
  1070. package/lib/simple-tree/core/schemaCaching.d.ts.map +1 -0
  1071. package/lib/simple-tree/{schemaCaching.js → core/schemaCaching.js} +1 -21
  1072. package/lib/simple-tree/core/schemaCaching.js.map +1 -0
  1073. package/lib/simple-tree/core/treeNodeKernel.d.ts +57 -0
  1074. package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -0
  1075. package/lib/simple-tree/{treeNodeKernel.js → core/treeNodeKernel.js} +45 -3
  1076. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -0
  1077. package/lib/simple-tree/core/treeNodeSchema.d.ts +149 -0
  1078. package/lib/simple-tree/core/treeNodeSchema.d.ts.map +1 -0
  1079. package/lib/simple-tree/core/treeNodeSchema.js +32 -0
  1080. package/lib/simple-tree/core/treeNodeSchema.js.map +1 -0
  1081. package/lib/simple-tree/{types.d.ts → core/types.d.ts} +23 -70
  1082. package/lib/simple-tree/core/types.d.ts.map +1 -0
  1083. package/lib/simple-tree/core/types.js +111 -0
  1084. package/lib/simple-tree/core/types.js.map +1 -0
  1085. package/lib/simple-tree/core/withType.d.ts +82 -0
  1086. package/lib/simple-tree/core/withType.d.ts.map +1 -0
  1087. package/lib/simple-tree/core/withType.js +36 -0
  1088. package/lib/simple-tree/core/withType.js.map +1 -0
  1089. package/lib/simple-tree/getJsonSchema.d.ts +55 -0
  1090. package/lib/simple-tree/getJsonSchema.d.ts.map +1 -0
  1091. package/lib/simple-tree/getJsonSchema.js +65 -0
  1092. package/lib/simple-tree/getJsonSchema.js.map +1 -0
  1093. package/lib/simple-tree/getSimpleFieldSchema.d.ts +14 -0
  1094. package/lib/simple-tree/getSimpleFieldSchema.d.ts.map +1 -0
  1095. package/lib/simple-tree/getSimpleFieldSchema.js +25 -0
  1096. package/lib/simple-tree/getSimpleFieldSchema.js.map +1 -0
  1097. package/lib/simple-tree/getSimpleSchema.d.ts +58 -0
  1098. package/lib/simple-tree/getSimpleSchema.d.ts.map +1 -0
  1099. package/lib/simple-tree/getSimpleSchema.js +64 -0
  1100. package/lib/simple-tree/getSimpleSchema.js.map +1 -0
  1101. package/lib/simple-tree/index.d.ts +12 -13
  1102. package/lib/simple-tree/index.d.ts.map +1 -1
  1103. package/lib/simple-tree/index.js +8 -11
  1104. package/lib/simple-tree/index.js.map +1 -1
  1105. package/lib/simple-tree/jsonSchema.d.ts +206 -0
  1106. package/lib/simple-tree/jsonSchema.d.ts.map +1 -0
  1107. package/lib/simple-tree/{nodeKeys.js → jsonSchema.js} +1 -1
  1108. package/lib/simple-tree/jsonSchema.js.map +1 -0
  1109. package/lib/simple-tree/leafNodeSchema.d.ts +1 -1
  1110. package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
  1111. package/lib/simple-tree/leafNodeSchema.js +1 -2
  1112. package/lib/simple-tree/leafNodeSchema.js.map +1 -1
  1113. package/lib/simple-tree/mapNode.d.ts +9 -3
  1114. package/lib/simple-tree/mapNode.d.ts.map +1 -1
  1115. package/lib/simple-tree/mapNode.js +36 -36
  1116. package/lib/simple-tree/mapNode.js.map +1 -1
  1117. package/lib/simple-tree/objectNode.d.ts +18 -16
  1118. package/lib/simple-tree/objectNode.d.ts.map +1 -1
  1119. package/lib/simple-tree/objectNode.js +36 -34
  1120. package/lib/simple-tree/objectNode.js.map +1 -1
  1121. package/lib/simple-tree/objectNodeTypes.d.ts +38 -0
  1122. package/lib/simple-tree/objectNodeTypes.d.ts.map +1 -0
  1123. package/lib/simple-tree/objectNodeTypes.js +15 -0
  1124. package/lib/simple-tree/objectNodeTypes.js.map +1 -0
  1125. package/lib/simple-tree/proxies.d.ts +6 -25
  1126. package/lib/simple-tree/proxies.d.ts.map +1 -1
  1127. package/lib/simple-tree/proxies.js +46 -57
  1128. package/lib/simple-tree/proxies.js.map +1 -1
  1129. package/lib/simple-tree/proxyBinding.d.ts +45 -22
  1130. package/lib/simple-tree/proxyBinding.d.ts.map +1 -1
  1131. package/lib/simple-tree/proxyBinding.js +89 -52
  1132. package/lib/simple-tree/proxyBinding.js.map +1 -1
  1133. package/lib/simple-tree/schemaTypes.d.ts +10 -159
  1134. package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
  1135. package/lib/simple-tree/schemaTypes.js +9 -41
  1136. package/lib/simple-tree/schemaTypes.js.map +1 -1
  1137. package/lib/simple-tree/simpleSchema.d.ts +124 -0
  1138. package/lib/simple-tree/simpleSchema.d.ts.map +1 -0
  1139. package/lib/{feature-libraries/schema-aware/schemaAware.js → simple-tree/simpleSchema.js} +1 -1
  1140. package/lib/simple-tree/simpleSchema.js.map +1 -0
  1141. package/lib/simple-tree/simpleSchemaToJsonSchema.d.ts +12 -0
  1142. package/lib/simple-tree/simpleSchemaToJsonSchema.d.ts.map +1 -0
  1143. package/lib/simple-tree/simpleSchemaToJsonSchema.js +142 -0
  1144. package/lib/simple-tree/simpleSchemaToJsonSchema.js.map +1 -0
  1145. package/lib/simple-tree/toFlexSchema.d.ts +4 -12
  1146. package/lib/simple-tree/toFlexSchema.d.ts.map +1 -1
  1147. package/lib/simple-tree/toFlexSchema.js +9 -18
  1148. package/lib/simple-tree/toFlexSchema.js.map +1 -1
  1149. package/lib/simple-tree/toMapTree.d.ts +39 -39
  1150. package/lib/simple-tree/toMapTree.d.ts.map +1 -1
  1151. package/lib/simple-tree/toMapTree.js +214 -158
  1152. package/lib/simple-tree/toMapTree.js.map +1 -1
  1153. package/lib/simple-tree/treeNodeValid.d.ts +74 -0
  1154. package/lib/simple-tree/treeNodeValid.d.ts.map +1 -0
  1155. package/lib/simple-tree/{types.js → treeNodeValid.js} +8 -98
  1156. package/lib/simple-tree/treeNodeValid.js.map +1 -0
  1157. package/lib/simple-tree/typesUnsafe.d.ts +35 -4
  1158. package/lib/simple-tree/typesUnsafe.d.ts.map +1 -1
  1159. package/lib/simple-tree/typesUnsafe.js.map +1 -1
  1160. package/lib/simple-tree/viewSchemaToSimpleSchema.d.ts +11 -0
  1161. package/lib/simple-tree/viewSchemaToSimpleSchema.d.ts.map +1 -0
  1162. package/lib/simple-tree/viewSchemaToSimpleSchema.js +167 -0
  1163. package/lib/simple-tree/viewSchemaToSimpleSchema.js.map +1 -0
  1164. package/lib/util/brand.d.ts +0 -3
  1165. package/lib/util/brand.d.ts.map +1 -1
  1166. package/lib/util/brand.js +1 -2
  1167. package/lib/util/brand.js.map +1 -1
  1168. package/lib/util/brandedMap.d.ts +0 -5
  1169. package/lib/util/brandedMap.d.ts.map +1 -1
  1170. package/lib/util/brandedMap.js +0 -1
  1171. package/lib/util/brandedMap.js.map +1 -1
  1172. package/lib/util/idAllocator.d.ts +0 -2
  1173. package/lib/util/idAllocator.d.ts.map +1 -1
  1174. package/lib/util/idAllocator.js +0 -1
  1175. package/lib/util/idAllocator.js.map +1 -1
  1176. package/lib/util/index.d.ts +2 -2
  1177. package/lib/util/index.d.ts.map +1 -1
  1178. package/lib/util/index.js +2 -2
  1179. package/lib/util/index.js.map +1 -1
  1180. package/lib/util/nestedMap.d.ts +5 -19
  1181. package/lib/util/nestedMap.d.ts.map +1 -1
  1182. package/lib/util/nestedMap.js +15 -16
  1183. package/lib/util/nestedMap.js.map +1 -1
  1184. package/lib/util/opaque.d.ts +0 -4
  1185. package/lib/util/opaque.d.ts.map +1 -1
  1186. package/lib/util/opaque.js +0 -2
  1187. package/lib/util/opaque.js.map +1 -1
  1188. package/lib/util/rangeMap.d.ts +0 -2
  1189. package/lib/util/rangeMap.d.ts.map +1 -1
  1190. package/lib/util/rangeMap.js +4 -3
  1191. package/lib/util/rangeMap.js.map +1 -1
  1192. package/lib/util/transactionResult.d.ts +0 -1
  1193. package/lib/util/transactionResult.d.ts.map +1 -1
  1194. package/lib/util/transactionResult.js +0 -1
  1195. package/lib/util/transactionResult.js.map +1 -1
  1196. package/lib/util/typeCheck.d.ts +2 -20
  1197. package/lib/util/typeCheck.d.ts.map +1 -1
  1198. package/lib/util/typeCheck.js.map +1 -1
  1199. package/lib/util/typeCheckTests.d.ts +4 -4
  1200. package/lib/util/typeCheckTests.d.ts.map +1 -1
  1201. package/lib/util/typeCheckTests.js.map +1 -1
  1202. package/lib/util/typeUtils.d.ts +0 -7
  1203. package/lib/util/typeUtils.d.ts.map +1 -1
  1204. package/lib/util/typeUtils.js.map +1 -1
  1205. package/lib/util/utils.d.ts +6 -8
  1206. package/lib/util/utils.d.ts.map +1 -1
  1207. package/lib/util/utils.js +12 -4
  1208. package/lib/util/utils.js.map +1 -1
  1209. package/package.json +25 -24
  1210. package/src/codec/discriminatedUnions.ts +20 -10
  1211. package/src/codec/index.ts +5 -1
  1212. package/src/core/forest/README.md +4 -2
  1213. package/src/core/forest/editableForest.ts +1 -6
  1214. package/src/core/forest/forest.ts +0 -6
  1215. package/src/core/index.ts +2 -2
  1216. package/src/core/rebase/changeRebaser.ts +0 -4
  1217. package/src/core/rebase/index.ts +0 -2
  1218. package/src/core/rebase/types.ts +1 -23
  1219. package/src/core/rebase/utils.ts +13 -11
  1220. package/src/core/schema-stored/multiplicity.ts +0 -1
  1221. package/src/core/schema-stored/schema.ts +0 -7
  1222. package/src/core/schema-stored/storedSchemaRepository.ts +0 -3
  1223. package/src/core/schema-view/view.ts +0 -3
  1224. package/src/core/tree/anchorSet.ts +7 -17
  1225. package/src/core/tree/cursor.ts +1 -6
  1226. package/src/core/tree/delta.ts +0 -11
  1227. package/src/core/tree/detachedFieldIndexCodec.ts +4 -3
  1228. package/src/core/tree/detachedFieldIndexTypes.ts +0 -1
  1229. package/src/core/tree/index.ts +1 -1
  1230. package/src/core/tree/mapTree.ts +45 -4
  1231. package/src/core/tree/pathTree.ts +0 -11
  1232. package/src/core/tree/treeTextFormat.ts +3 -2
  1233. package/src/core/tree/types.ts +0 -11
  1234. package/src/core/tree/visitDelta.ts +2 -3
  1235. package/src/core/tree/visitPath.ts +0 -2
  1236. package/src/core/tree/visitorUtils.ts +0 -1
  1237. package/src/domains/index.ts +3 -0
  1238. package/src/domains/json/index.ts +7 -1
  1239. package/src/domains/json/jsonCursor.ts +113 -6
  1240. package/src/domains/json/jsonDomainSchema.ts +4 -5
  1241. package/src/domains/leafDomain.ts +0 -1
  1242. package/src/domains/schemaBuilder.ts +0 -22
  1243. package/src/events/events.ts +0 -4
  1244. package/src/feature-libraries/chunked-forest/README.md +9 -1
  1245. package/src/feature-libraries/chunked-forest/basicChunk.ts +14 -9
  1246. package/src/feature-libraries/chunked-forest/chunk.ts +1 -1
  1247. package/src/feature-libraries/chunked-forest/chunkTree.ts +4 -4
  1248. package/src/feature-libraries/chunked-forest/chunkedForest.ts +8 -6
  1249. package/src/feature-libraries/chunked-forest/codec/chunkCodecUtilities.ts +2 -2
  1250. package/src/feature-libraries/chunked-forest/codec/chunkDecoding.ts +9 -6
  1251. package/src/feature-libraries/chunked-forest/uniformChunk.ts +6 -4
  1252. package/src/feature-libraries/default-schema/defaultEditBuilder.ts +18 -46
  1253. package/src/feature-libraries/default-schema/defaultFieldKinds.ts +11 -6
  1254. package/src/feature-libraries/default-schema/defaultSchema.ts +0 -1
  1255. package/src/feature-libraries/default-schema/index.ts +1 -1
  1256. package/src/feature-libraries/default-schema/schemaChecker.ts +6 -0
  1257. package/src/feature-libraries/editableTreeBinder.ts +6 -78
  1258. package/src/feature-libraries/fieldGenerator.ts +0 -3
  1259. package/src/feature-libraries/flex-map-tree/index.ts +2 -1
  1260. package/src/feature-libraries/flex-map-tree/mapTreeNode.ts +238 -267
  1261. package/src/feature-libraries/flex-tree/context.ts +0 -1
  1262. package/src/feature-libraries/flex-tree/flexTreeTypes.ts +27 -357
  1263. package/src/feature-libraries/flex-tree/index.ts +0 -1
  1264. package/src/feature-libraries/flex-tree/lazyField.ts +38 -208
  1265. package/src/feature-libraries/flex-tree/lazyNode.ts +5 -66
  1266. package/src/feature-libraries/flex-tree/treeEvents.ts +0 -2
  1267. package/src/feature-libraries/flex-tree/utilities.ts +6 -1
  1268. package/src/feature-libraries/forest-summary/codec.ts +3 -3
  1269. package/src/feature-libraries/index.ts +5 -35
  1270. package/src/feature-libraries/mapTreeCursor.ts +13 -4
  1271. package/src/feature-libraries/memoizedIdRangeAllocator.ts +0 -4
  1272. package/src/feature-libraries/modular-schema/crossFieldQueries.ts +0 -2
  1273. package/src/feature-libraries/modular-schema/discrepancies.ts +117 -1
  1274. package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +0 -8
  1275. package/src/feature-libraries/modular-schema/fieldKind.ts +1 -3
  1276. package/src/feature-libraries/modular-schema/genericFieldKind.ts +69 -92
  1277. package/src/feature-libraries/modular-schema/genericFieldKindCodecs.ts +7 -14
  1278. package/src/feature-libraries/modular-schema/genericFieldKindTypes.ts +6 -15
  1279. package/src/feature-libraries/modular-schema/index.ts +2 -2
  1280. package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +68 -34
  1281. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +330 -336
  1282. package/src/feature-libraries/modular-schema/modularChangeTypes.ts +7 -14
  1283. package/src/feature-libraries/node-key/nodeKey.ts +0 -4
  1284. package/src/feature-libraries/node-key/nodeKeyManager.ts +0 -1
  1285. package/src/feature-libraries/object-forest/objectForest.ts +1 -13
  1286. package/src/feature-libraries/schemaBuilderBase.ts +1 -49
  1287. package/src/feature-libraries/sequence-field/compose.ts +41 -20
  1288. package/src/feature-libraries/sequence-field/formatV2.ts +3 -3
  1289. package/src/feature-libraries/sequence-field/formatV3.ts +65 -0
  1290. package/src/feature-libraries/sequence-field/helperTypes.ts +33 -0
  1291. package/src/feature-libraries/sequence-field/index.ts +1 -0
  1292. package/src/feature-libraries/sequence-field/invert.ts +28 -18
  1293. package/src/feature-libraries/sequence-field/markQueue.ts +2 -2
  1294. package/src/feature-libraries/sequence-field/moveEffectTable.ts +2 -2
  1295. package/src/feature-libraries/sequence-field/rebase.ts +30 -13
  1296. package/src/feature-libraries/sequence-field/replaceRevisions.ts +27 -3
  1297. package/src/feature-libraries/sequence-field/sequenceFieldCodecV1.ts +52 -7
  1298. package/src/feature-libraries/sequence-field/sequenceFieldCodecV2.ts +92 -19
  1299. package/src/feature-libraries/sequence-field/sequenceFieldCodecV3.ts +134 -0
  1300. package/src/feature-libraries/sequence-field/sequenceFieldCodecs.ts +2 -0
  1301. package/src/feature-libraries/sequence-field/sequenceFieldToDelta.ts +8 -2
  1302. package/src/feature-libraries/sequence-field/types.ts +24 -4
  1303. package/src/feature-libraries/sequence-field/utils.ts +78 -50
  1304. package/src/feature-libraries/storedToViewSchema.ts +0 -1
  1305. package/src/feature-libraries/treeCursorUtils.ts +11 -11
  1306. package/src/feature-libraries/treeTextCursor.ts +0 -2
  1307. package/src/feature-libraries/typed-schema/flexList.ts +0 -3
  1308. package/src/feature-libraries/typed-schema/index.ts +0 -2
  1309. package/src/feature-libraries/typed-schema/schemaCollection.ts +0 -5
  1310. package/src/feature-libraries/typed-schema/typedTreeSchema.ts +2 -68
  1311. package/src/feature-libraries/typed-schema/view.ts +0 -1
  1312. package/src/index.ts +27 -245
  1313. package/src/internalTypes.ts +1 -0
  1314. package/src/packageVersion.ts +1 -1
  1315. package/src/shared-tree/schematizeTree.ts +25 -21
  1316. package/src/shared-tree/schematizingTreeView.ts +6 -6
  1317. package/src/shared-tree/sharedTree.ts +8 -39
  1318. package/src/shared-tree/sharedTreeChangeCodecs.ts +8 -0
  1319. package/src/shared-tree/sharedTreeChangeFamily.ts +3 -3
  1320. package/src/shared-tree/sharedTreeEditBuilder.ts +0 -2
  1321. package/src/shared-tree/treeApi.ts +3 -3
  1322. package/src/shared-tree/treeCheckout.ts +6 -8
  1323. package/src/shared-tree/treeView.ts +3 -6
  1324. package/src/shared-tree-core/branch.ts +20 -8
  1325. package/src/shared-tree-core/defaultResubmitMachine.ts +4 -4
  1326. package/src/shared-tree-core/editManagerCodecs.ts +1 -0
  1327. package/src/shared-tree-core/editManagerFormat.ts +7 -2
  1328. package/src/shared-tree-core/messageCodecs.ts +2 -1
  1329. package/src/shared-tree-core/sharedTreeCore.ts +5 -3
  1330. package/src/simple-tree/ProxyBinding.md +2 -0
  1331. package/src/simple-tree/api/README.md +7 -0
  1332. package/src/simple-tree/api/create.ts +179 -0
  1333. package/src/simple-tree/api/index.ts +36 -0
  1334. package/src/simple-tree/{schemaCreationUtilities.ts → api/schemaCreationUtilities.ts} +13 -5
  1335. package/src/simple-tree/{schemaFactory.ts → api/schemaFactory.ts} +36 -34
  1336. package/src/simple-tree/{schemaFactoryRecursive.ts → api/schemaFactoryRecursive.ts} +47 -10
  1337. package/src/simple-tree/{testRecursiveDomain.ts → api/testRecursiveDomain.ts} +3 -1
  1338. package/src/simple-tree/{tree.ts → api/tree.ts} +246 -34
  1339. package/src/simple-tree/{treeNodeApi.ts → api/treeNodeApi.ts} +47 -36
  1340. package/src/simple-tree/api/verboseTree.ts +415 -0
  1341. package/src/simple-tree/arrayNode.ts +100 -98
  1342. package/src/simple-tree/core/README.md +11 -0
  1343. package/src/simple-tree/core/index.ts +33 -0
  1344. package/src/simple-tree/{schemaCaching.ts → core/schemaCaching.ts} +3 -37
  1345. package/src/simple-tree/{treeNodeKernel.ts → core/treeNodeKernel.ts} +55 -5
  1346. package/src/simple-tree/core/treeNodeSchema.ts +184 -0
  1347. package/src/simple-tree/core/types.ts +255 -0
  1348. package/src/simple-tree/core/withType.ts +89 -0
  1349. package/src/simple-tree/getJsonSchema.ts +70 -0
  1350. package/src/simple-tree/getSimpleFieldSchema.ts +36 -0
  1351. package/src/simple-tree/getSimpleSchema.ts +69 -0
  1352. package/src/simple-tree/index.ts +58 -33
  1353. package/src/simple-tree/jsonSchema.ts +230 -0
  1354. package/src/simple-tree/leafNodeSchema.ts +6 -3
  1355. package/src/simple-tree/mapNode.ts +56 -55
  1356. package/src/simple-tree/objectNode.ts +66 -90
  1357. package/src/simple-tree/objectNodeTypes.ts +68 -0
  1358. package/src/simple-tree/proxies.ts +52 -68
  1359. package/src/simple-tree/proxyBinding.ts +127 -72
  1360. package/src/simple-tree/schemaTypes.ts +29 -194
  1361. package/src/simple-tree/simpleSchema.ts +138 -0
  1362. package/src/simple-tree/simpleSchemaToJsonSchema.ts +178 -0
  1363. package/src/simple-tree/toFlexSchema.ts +9 -42
  1364. package/src/simple-tree/toMapTree.ts +270 -296
  1365. package/src/simple-tree/{types.ts → treeNodeValid.ts} +16 -232
  1366. package/src/simple-tree/typesUnsafe.ts +51 -5
  1367. package/src/simple-tree/viewSchemaToSimpleSchema.ts +209 -0
  1368. package/src/util/brand.ts +1 -4
  1369. package/src/util/brandedMap.ts +0 -5
  1370. package/src/util/idAllocator.ts +0 -2
  1371. package/src/util/index.ts +2 -0
  1372. package/src/util/nestedMap.ts +23 -20
  1373. package/src/util/opaque.ts +0 -4
  1374. package/src/util/rangeMap.ts +5 -5
  1375. package/src/util/transactionResult.ts +0 -1
  1376. package/src/util/typeCheck.ts +2 -20
  1377. package/src/util/typeCheckTests.ts +4 -4
  1378. package/src/util/typeUtils.ts +0 -7
  1379. package/src/util/utils.ts +13 -8
  1380. package/tsconfig.json +0 -1
  1381. package/dist/feature-libraries/contextuallyTyped.d.ts +0 -209
  1382. package/dist/feature-libraries/contextuallyTyped.d.ts.map +0 -1
  1383. package/dist/feature-libraries/contextuallyTyped.js +0 -328
  1384. package/dist/feature-libraries/contextuallyTyped.js.map +0 -1
  1385. package/dist/feature-libraries/schema-aware/index.d.ts +0 -6
  1386. package/dist/feature-libraries/schema-aware/index.d.ts.map +0 -1
  1387. package/dist/feature-libraries/schema-aware/index.js.map +0 -1
  1388. package/dist/feature-libraries/schema-aware/schemaAware.d.ts +0 -76
  1389. package/dist/feature-libraries/schema-aware/schemaAware.d.ts.map +0 -1
  1390. package/dist/feature-libraries/schema-aware/schemaAware.js.map +0 -1
  1391. package/dist/simple-tree/nodeKeys.d.ts +0 -41
  1392. package/dist/simple-tree/nodeKeys.d.ts.map +0 -1
  1393. package/dist/simple-tree/nodeKeys.js +0 -7
  1394. package/dist/simple-tree/nodeKeys.js.map +0 -1
  1395. package/dist/simple-tree/schemaCaching.d.ts.map +0 -1
  1396. package/dist/simple-tree/schemaCaching.js.map +0 -1
  1397. package/dist/simple-tree/schemaCreationUtilities.d.ts.map +0 -1
  1398. package/dist/simple-tree/schemaCreationUtilities.js.map +0 -1
  1399. package/dist/simple-tree/schemaFactory.d.ts.map +0 -1
  1400. package/dist/simple-tree/schemaFactory.js.map +0 -1
  1401. package/dist/simple-tree/schemaFactoryRecursive.d.ts.map +0 -1
  1402. package/dist/simple-tree/schemaFactoryRecursive.js.map +0 -1
  1403. package/dist/simple-tree/testRecursiveDomain.d.ts +0 -61
  1404. package/dist/simple-tree/testRecursiveDomain.d.ts.map +0 -1
  1405. package/dist/simple-tree/testRecursiveDomain.js.map +0 -1
  1406. package/dist/simple-tree/tree.d.ts.map +0 -1
  1407. package/dist/simple-tree/tree.js +0 -73
  1408. package/dist/simple-tree/tree.js.map +0 -1
  1409. package/dist/simple-tree/treeNodeApi.d.ts.map +0 -1
  1410. package/dist/simple-tree/treeNodeApi.js.map +0 -1
  1411. package/dist/simple-tree/treeNodeKernel.d.ts +0 -26
  1412. package/dist/simple-tree/treeNodeKernel.d.ts.map +0 -1
  1413. package/dist/simple-tree/treeNodeKernel.js.map +0 -1
  1414. package/dist/simple-tree/types.d.ts.map +0 -1
  1415. package/dist/simple-tree/types.js.map +0 -1
  1416. package/lib/feature-libraries/contextuallyTyped.d.ts +0 -209
  1417. package/lib/feature-libraries/contextuallyTyped.d.ts.map +0 -1
  1418. package/lib/feature-libraries/contextuallyTyped.js +0 -311
  1419. package/lib/feature-libraries/contextuallyTyped.js.map +0 -1
  1420. package/lib/feature-libraries/schema-aware/index.d.ts +0 -6
  1421. package/lib/feature-libraries/schema-aware/index.d.ts.map +0 -1
  1422. package/lib/feature-libraries/schema-aware/index.js +0 -6
  1423. package/lib/feature-libraries/schema-aware/index.js.map +0 -1
  1424. package/lib/feature-libraries/schema-aware/schemaAware.d.ts +0 -76
  1425. package/lib/feature-libraries/schema-aware/schemaAware.d.ts.map +0 -1
  1426. package/lib/feature-libraries/schema-aware/schemaAware.js.map +0 -1
  1427. package/lib/simple-tree/nodeKeys.d.ts +0 -41
  1428. package/lib/simple-tree/nodeKeys.d.ts.map +0 -1
  1429. package/lib/simple-tree/nodeKeys.js.map +0 -1
  1430. package/lib/simple-tree/schemaCaching.d.ts.map +0 -1
  1431. package/lib/simple-tree/schemaCaching.js.map +0 -1
  1432. package/lib/simple-tree/schemaCreationUtilities.d.ts.map +0 -1
  1433. package/lib/simple-tree/schemaCreationUtilities.js.map +0 -1
  1434. package/lib/simple-tree/schemaFactory.d.ts.map +0 -1
  1435. package/lib/simple-tree/schemaFactory.js.map +0 -1
  1436. package/lib/simple-tree/schemaFactoryRecursive.d.ts.map +0 -1
  1437. package/lib/simple-tree/schemaFactoryRecursive.js.map +0 -1
  1438. package/lib/simple-tree/testRecursiveDomain.d.ts +0 -61
  1439. package/lib/simple-tree/testRecursiveDomain.d.ts.map +0 -1
  1440. package/lib/simple-tree/testRecursiveDomain.js.map +0 -1
  1441. package/lib/simple-tree/tree.d.ts.map +0 -1
  1442. package/lib/simple-tree/tree.js +0 -66
  1443. package/lib/simple-tree/tree.js.map +0 -1
  1444. package/lib/simple-tree/treeNodeApi.d.ts.map +0 -1
  1445. package/lib/simple-tree/treeNodeApi.js.map +0 -1
  1446. package/lib/simple-tree/treeNodeKernel.d.ts +0 -26
  1447. package/lib/simple-tree/treeNodeKernel.d.ts.map +0 -1
  1448. package/lib/simple-tree/treeNodeKernel.js.map +0 -1
  1449. package/lib/simple-tree/types.d.ts.map +0 -1
  1450. package/lib/simple-tree/types.js.map +0 -1
  1451. package/src/feature-libraries/contextuallyTyped.ts +0 -582
  1452. package/src/feature-libraries/schema-aware/README.md +0 -19
  1453. package/src/feature-libraries/schema-aware/index.ts +0 -16
  1454. package/src/feature-libraries/schema-aware/schemaAware.ts +0 -135
  1455. package/src/simple-tree/nodeKeys.ts +0 -42
  1456. /package/dist/simple-tree/{testRecursiveDomain.js → api/testRecursiveDomain.js} +0 -0
  1457. /package/lib/simple-tree/{testRecursiveDomain.js → api/testRecursiveDomain.js} +0 -0
@@ -2,27 +2,27 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { assert } from "@fluidframework/core-utils/internal";
6
- import { Multiplicity, rootFieldKey } from "../core/index.js";
7
- import { isLazy, isTreeValue, FlexObjectNodeSchema, } from "../feature-libraries/index.js";
8
- import { fail, extractFromOpaque, isReadonlyArray } from "../util/index.js";
9
- import { getOrCreateNodeProxy, isTreeNode } from "./proxies.js";
10
- import { getFlexNode, getKernel } from "./proxyBinding.js";
11
- import { tryGetSimpleNodeSchema } from "./schemaCaching.js";
12
- import { NodeKind, FieldSchema, } from "./schemaTypes.js";
13
- import { booleanSchema, handleSchema, nullSchema, numberSchema, stringSchema, } from "./leafNodeSchema.js";
5
+ import { assert, oob } from "@fluidframework/core-utils/internal";
6
+ import { Multiplicity, rootFieldKey } from "../../core/index.js";
7
+ import { isLazy, isTreeValue, FlexObjectNodeSchema, isMapTreeNode, } from "../../feature-libraries/index.js";
8
+ import { fail, extractFromOpaque, isReadonlyArray } from "../../util/index.js";
9
+ import { getOrCreateNodeFromFlexTreeNode } from "../proxies.js";
10
+ import { getOrCreateInnerNode } from "../proxyBinding.js";
11
+ import { FieldSchema, } from "../schemaTypes.js";
12
+ import { booleanSchema, handleSchema, nullSchema, numberSchema, stringSchema, } from "../leafNodeSchema.js";
14
13
  import { isFluidHandle } from "@fluidframework/runtime-utils/internal";
15
14
  import { UsageError } from "@fluidframework/telemetry-utils/internal";
15
+ import { getKernel, isTreeNode, NodeKind, tryGetTreeNodeSchema, } from "../core/index.js";
16
16
  /**
17
17
  * The `Tree` object holds various functions for analyzing {@link TreeNode}s.
18
18
  */
19
19
  export const treeNodeApi = {
20
20
  parent(node) {
21
- const editNode = getFlexNode(node).parentField.parent.parent;
21
+ const editNode = getOrCreateInnerNode(node).parentField.parent.parent;
22
22
  if (editNode === undefined) {
23
23
  return undefined;
24
24
  }
25
- const output = getOrCreateNodeProxy(editNode);
25
+ const output = getOrCreateNodeFromFlexTreeNode(editNode);
26
26
  assert(!isTreeValue(output), 0x87f /* Parent can't be a leaf, so it should be a node not a value */);
27
27
  return output;
28
28
  },
@@ -62,6 +62,8 @@ export const treeNodeApi = {
62
62
  return false;
63
63
  }
64
64
  else {
65
+ // Linter is incorrect about this bering unnecessary: it does not compile without the type assertion.
66
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
65
67
  return schema === actualSchema;
66
68
  }
67
69
  },
@@ -69,15 +71,21 @@ export const treeNodeApi = {
69
71
  return tryGetSchema(node) ?? fail("Not a tree node");
70
72
  },
71
73
  shortId(node) {
72
- const flexNode = getFlexNode(node);
74
+ const flexNode = getOrCreateInnerNode(node);
73
75
  const flexSchema = flexNode.schema;
74
76
  const identifierFieldKeys = flexSchema instanceof FlexObjectNodeSchema ? flexSchema.identifierFieldKeys : [];
75
77
  switch (identifierFieldKeys.length) {
76
78
  case 0:
77
79
  return undefined;
78
80
  case 1: {
79
- const identifier = flexNode.tryGetField(identifierFieldKeys[0])?.boxedAt(0);
80
- assert(identifier !== undefined, 0x927 /* The identifier must exist */);
81
+ const identifier = flexNode.tryGetField(identifierFieldKeys[0] ?? oob())?.boxedAt(0);
82
+ if (isMapTreeNode(flexNode)) {
83
+ if (identifier === undefined) {
84
+ throw new UsageError("Tree.shortId cannot access default identifiers on unhydrated nodes");
85
+ }
86
+ return identifier.value;
87
+ }
88
+ assert(identifier?.context !== undefined, 0xa12 /* Expected LazyIdentifierField */);
81
89
  const identifierValue = identifier.value;
82
90
  const localNodeKey = identifier.context.nodeKeyManager.tryLocalizeNodeKey(identifierValue);
83
91
  return localNodeKey !== undefined ? extractFromOpaque(localNodeKey) : identifierValue;
@@ -102,7 +110,7 @@ export function tryGetSchema(value) {
102
110
  case "object": {
103
111
  if (isTreeNode(value)) {
104
112
  // This case could be optimized, for example by placing the simple schema in a symbol on tree nodes.
105
- return tryGetSimpleNodeSchema(getFlexNode(value).schema);
113
+ return tryGetTreeNodeSchema(value);
106
114
  }
107
115
  if (value === null) {
108
116
  return nullSchema;
@@ -121,12 +129,12 @@ export function tryGetSchema(value) {
121
129
  function getStoredKey(node) {
122
130
  // Note: the flex domain strictly works with "stored keys", and knows nothing about the developer-facing
123
131
  // "view keys".
124
- const parentField = getFlexNode(node).parentField;
132
+ const parentField = getOrCreateInnerNode(node).parentField;
125
133
  if (parentField.parent.schema.kind.multiplicity === Multiplicity.Sequence) {
126
134
  // The parent of `node` is an array node
127
135
  return parentField.index;
128
136
  }
129
- // The parent of `node` is an object, a map, or undefined (and therefore `node` is a root/detached node).
137
+ // The parent of `node` is an object, a map, or undefined. If undefined, then `node` is a root/detached node.
130
138
  return parentField.parent.key;
131
139
  }
132
140
  /**
@@ -0,0 +1 @@
1
+ {"version":3,"file":"treeNodeApi.js","sourceRoot":"","sources":["../../../src/simple-tree/api/treeNodeApi.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,qCAAqC,CAAC;AAElE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAGN,MAAM,EACN,WAAW,EACX,oB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,MAAM,CAAC,EAAE,CAAC;QAC7D,IAAI,WAAW,YAAY,WAAW,IAAI,WAAW,CAAC,KAAK,EAAE,GAAG,KAAK,SAAS,EAAE,CAAC;YAChF,OAAO,OAAO,CAAC;QAChB,CAAC;IACF,CAAC;IAED,IAAI,MAAM,CAAC,SAAS,CAAC,KAAK,SAAS,EAAE,CAAC;QACrC,IAAI,CAAC,qDAAqD,CAAC,CAAC;IAC7D,CAAC;IAED,OAAO,SAAS,CAAC;AAClB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, oob } from \"@fluidframework/core-utils/internal\";\n\nimport { Multiplicity, rootFieldKey } from \"../../core/index.js\";\nimport {\n\ttype LazyItem,\n\ttype TreeStatus,\n\tisLazy,\n\tisTreeValue,\n\tFlexObjectNodeSchema,\n\tisMapTreeNode,\n} from \"../../feature-libraries/index.js\";\nimport { fail, extractFromOpaque, isReadonlyArray } from \"../../util/index.js\";\n\nimport { getOrCreateNodeFromFlexTreeNode } from \"../proxies.js\";\nimport { getOrCreateInnerNode } from \"../proxyBinding.js\";\nimport {\n\ttype TreeLeafValue,\n\ttype ImplicitFieldSchema,\n\tFieldSchema,\n\ttype ImplicitAllowedTypes,\n\ttype TreeNodeFromImplicitAllowedTypes,\n} from \"../schemaTypes.js\";\nimport {\n\tbooleanSchema,\n\thandleSchema,\n\tnullSchema,\n\tnumberSchema,\n\tstringSchema,\n} from \"../leafNodeSchema.js\";\nimport { isFluidHandle } from \"@fluidframework/runtime-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\nimport type { Off } from \"../../events/index.js\";\nimport {\n\tgetKernel,\n\tisTreeNode,\n\ttype TreeNodeSchema,\n\tNodeKind,\n\ttype TreeNode,\n\ttype TreeChangeEvents,\n\ttryGetTreeNodeSchema,\n} from \"../core/index.js\";\n\n/**\n * Provides various functions for analyzing {@link TreeNode}s.\n * * @remarks\n * This type should only be used via the public `Tree` export.\n * @privateRemarks\n * Due to limitations of API-Extractor link resolution, this type can't be moved into internalTypes but should be considered just an implementation detail of the `Tree` export.\n *\n * Inlining the typing of this interface onto the `Tree` object provides slightly different .d.ts generation,\n * which avoids typescript expanding the type of TreeNodeSchema and thus encountering\n * https://github.com/microsoft/rushstack/issues/1958.\n * @sealed @public\n */\nexport interface TreeNodeApi {\n\t/**\n\t * The schema information for this node.\n\t */\n\tschema(node: TreeNode | TreeLeafValue): TreeNodeSchema;\n\n\t/**\n\t * Narrow the type of the given value if it satisfies the given schema.\n\t * @example\n\t * ```ts\n\t * if (node.is(myNode, Point)) {\n\t * const y = myNode.y; // `myNode` is now known to satisfy the `Point` schema and therefore has a `y` coordinate.\n\t * }\n\t * ```\n\t */\n\tis<TSchema extends ImplicitAllowedTypes>(\n\t\tvalue: unknown,\n\t\tschema: TSchema,\n\t): value is TreeNodeFromImplicitAllowedTypes<TSchema>;\n\n\t/**\n\t * Return the node under which this node resides in the tree (or undefined if this is a root node of the tree).\n\t */\n\tparent(node: TreeNode): TreeNode | undefined;\n\n\t/**\n\t * The key of the given node under its parent.\n\t * @remarks\n\t * If `node` is an element in a {@link (TreeArrayNode:interface)}, this returns the index of `node` in the array node (a `number`).\n\t * Otherwise, this returns the key of the field that it is under (a `string`).\n\t */\n\tkey(node: TreeNode): string | number;\n\n\t/**\n\t * Register an event listener on the given node.\n\t * @param node - The node whose events should be subscribed to.\n\t * @param eventName - Which event to subscribe to.\n\t * @param listener - The callback to trigger for the event. The tree can be read during the callback, but it is invalid to modify the tree during this callback.\n\t * @returns A callback function which will deregister the event.\n\t * This callback should be called only once.\n\t */\n\ton<K extends keyof TreeChangeEvents>(\n\t\tnode: TreeNode,\n\t\teventName: K,\n\t\tlistener: TreeChangeEvents[K],\n\t): () => void;\n\n\t/**\n\t * Returns the {@link TreeStatus} of the given node.\n\t */\n\tstatus(node: TreeNode): TreeStatus;\n\n\t/**\n\t * Returns the {@link SchemaFactory.identifier | identifier} of the given node in the most compressed form possible.\n\t * @remarks\n\t * If the node's identifier is a valid UUID that was automatically generated by the SharedTree, then this will return a process-unique integer corresponding to that identifier.\n\t * Note that the node must already have been inserted into the tree in order to retrieve a generated UUID (or shortId will error).\n\t * This is useful for performance-sensitive scenarios involving many nodes with identifiers that need to be compactly retained in memory or used for efficient lookup.\n\t *\n\t * If the node's identifier is any other user-provided string, then this will return that string.\n\t *\n\t * If the node has no identifier (that is, it has no {@link SchemaFactory.identifier | identifier} field), then this returns `undefined`.\n\t *\n\t * If the node has more than one identifier, then this will throw an error.\n\t *\n\t * The returned integer must not be serialized or preserved outside of the current process.\n\t * Its lifetime is that of the current in-memory instance of the FF container for this client, and it is not guaranteed to be unique or stable outside of that context.\n\t * The same node's identifier may, for example, be different across multiple sessions for the same client and document, or different across two clients in the same session.\n\t */\n\tshortId(node: TreeNode): number | string | undefined;\n}\n\n/**\n * The `Tree` object holds various functions for analyzing {@link TreeNode}s.\n */\nexport const treeNodeApi: TreeNodeApi = {\n\tparent(node: TreeNode): TreeNode | undefined {\n\t\tconst editNode = getOrCreateInnerNode(node).parentField.parent.parent;\n\t\tif (editNode === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst output = getOrCreateNodeFromFlexTreeNode(editNode);\n\t\tassert(\n\t\t\t!isTreeValue(output),\n\t\t\t0x87f /* Parent can't be a leaf, so it should be a node not a value */,\n\t\t);\n\t\treturn output;\n\t},\n\tkey(node: TreeNode): string | number {\n\t\t// If the parent is undefined, then this node is under the root field,\n\t\t// so we know its key is the special root one.\n\t\tconst parent = treeNodeApi.parent(node);\n\t\tif (parent === undefined) {\n\t\t\treturn rootFieldKey;\n\t\t}\n\n\t\t// The flex-domain strictly operates in terms of \"stored keys\".\n\t\t// To find the associated developer-facing \"view key\", we need to look up the field associated with\n\t\t// the stored key from the flex-domain, and get view key its simple-domain counterpart was created with.\n\t\tconst storedKey = getStoredKey(node);\n\t\tconst parentSchema = treeNodeApi.schema(parent);\n\t\tconst viewKey = getViewKeyFromStoredKey(parentSchema, storedKey);\n\t\treturn viewKey;\n\t},\n\ton<K extends keyof TreeChangeEvents>(\n\t\tnode: TreeNode,\n\t\teventName: K,\n\t\tlistener: TreeChangeEvents[K],\n\t): Off {\n\t\treturn getKernel(node).on(eventName, listener);\n\t},\n\tstatus(node: TreeNode): TreeStatus {\n\t\treturn getKernel(node).getStatus();\n\t},\n\tis<TSchema extends ImplicitAllowedTypes>(\n\t\tvalue: unknown,\n\t\tschema: TSchema,\n\t): value is TreeNodeFromImplicitAllowedTypes<TSchema> {\n\t\tconst actualSchema = tryGetSchema(value);\n\t\tif (actualSchema === undefined) {\n\t\t\treturn false;\n\t\t}\n\t\tif (isReadonlyArray<LazyItem<TreeNodeSchema>>(schema)) {\n\t\t\tfor (const singleSchema of schema) {\n\t\t\t\tconst testSchema = isLazy(singleSchema) ? singleSchema() : singleSchema;\n\t\t\t\tif (testSchema === actualSchema) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false;\n\t\t} else {\n\t\t\t// Linter is incorrect about this bering unnecessary: it does not compile without the type assertion.\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n\t\t\treturn (schema as TreeNodeSchema) === actualSchema;\n\t\t}\n\t},\n\tschema(node: TreeNode | TreeLeafValue): TreeNodeSchema {\n\t\treturn tryGetSchema(node) ?? fail(\"Not a tree node\");\n\t},\n\tshortId(node: TreeNode): number | string | undefined {\n\t\tconst flexNode = getOrCreateInnerNode(node);\n\t\tconst flexSchema = flexNode.schema;\n\t\tconst identifierFieldKeys =\n\t\t\tflexSchema instanceof FlexObjectNodeSchema ? flexSchema.identifierFieldKeys : [];\n\n\t\tswitch (identifierFieldKeys.length) {\n\t\t\tcase 0:\n\t\t\t\treturn undefined;\n\t\t\tcase 1: {\n\t\t\t\tconst identifier = flexNode.tryGetField(identifierFieldKeys[0] ?? oob())?.boxedAt(0);\n\t\t\t\tif (isMapTreeNode(flexNode)) {\n\t\t\t\t\tif (identifier === undefined) {\n\t\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t\t\"Tree.shortId cannot access default identifiers on unhydrated nodes\",\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\treturn identifier.value as string;\n\t\t\t\t}\n\t\t\t\tassert(identifier?.context !== undefined, 0xa12 /* Expected LazyIdentifierField */);\n\t\t\t\tconst identifierValue = identifier.value as string;\n\n\t\t\t\tconst localNodeKey =\n\t\t\t\t\tidentifier.context.nodeKeyManager.tryLocalizeNodeKey(identifierValue);\n\t\t\t\treturn localNodeKey !== undefined ? extractFromOpaque(localNodeKey) : identifierValue;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\"shortId() may not be called on a node with more than one identifier. Consider converting extraneous identifier fields to string fields.\",\n\t\t\t\t);\n\t\t}\n\t},\n};\n\n/**\n * Returns a schema for a value if the value is a {@link TreeNode} or a {@link TreeLeafValue}.\n * Returns undefined for other values.\n */\nexport function tryGetSchema(value: unknown): undefined | TreeNodeSchema {\n\tswitch (typeof value) {\n\t\tcase \"string\":\n\t\t\treturn stringSchema;\n\t\tcase \"number\":\n\t\t\treturn numberSchema;\n\t\tcase \"boolean\":\n\t\t\treturn booleanSchema;\n\t\tcase \"object\": {\n\t\t\tif (isTreeNode(value)) {\n\t\t\t\t// This case could be optimized, for example by placing the simple schema in a symbol on tree nodes.\n\t\t\t\treturn tryGetTreeNodeSchema(value);\n\t\t\t}\n\t\t\tif (value === null) {\n\t\t\t\treturn nullSchema;\n\t\t\t}\n\t\t\tif (isFluidHandle(value)) {\n\t\t\t\treturn handleSchema;\n\t\t\t}\n\t\t}\n\t\tdefault:\n\t\t\treturn undefined;\n\t}\n}\n\n/**\n * Gets the stored key with which the provided node is associated in the parent.\n */\nfunction getStoredKey(node: TreeNode): string | number {\n\t// Note: the flex domain strictly works with \"stored keys\", and knows nothing about the developer-facing\n\t// \"view keys\".\n\tconst parentField = getOrCreateInnerNode(node).parentField;\n\tif (parentField.parent.schema.kind.multiplicity === Multiplicity.Sequence) {\n\t\t// The parent of `node` is an array node\n\t\treturn parentField.index;\n\t}\n\n\t// The parent of `node` is an object, a map, or undefined. If undefined, then `node` is a root/detached node.\n\treturn parentField.parent.key;\n}\n\n/**\n * Given a node schema, gets the view key corresponding with the provided {@link FieldProps.key | stored key}.\n */\nfunction getViewKeyFromStoredKey(\n\tschema: TreeNodeSchema,\n\tstoredKey: string | number,\n): string | number {\n\t// Only object nodes have the concept of a \"stored key\", differentiated from the developer-facing \"view key\".\n\t// For any other kind of node, the stored key and the view key are the same.\n\tif (schema.kind !== NodeKind.Object) {\n\t\treturn storedKey;\n\t}\n\n\tconst fields = schema.info as Record<string, ImplicitFieldSchema>;\n\n\t// Invariants:\n\t// - The set of all view keys under an object must be unique.\n\t// - The set of all stored keys (including those implicitly created from view keys) must be unique.\n\t// To find the view key associated with the provided stored key, first check for any stored key matches (which are optionally populated).\n\t// If we don't find any, then search for a matching view key.\n\tfor (const [viewKey, fieldSchema] of Object.entries(fields)) {\n\t\tif (fieldSchema instanceof FieldSchema && fieldSchema.props?.key === storedKey) {\n\t\t\treturn viewKey;\n\t\t}\n\t}\n\n\tif (fields[storedKey] === undefined) {\n\t\tfail(\"Existing stored key should always map to a view key\");\n\t}\n\n\treturn storedKey;\n}\n"]}
@@ -0,0 +1,136 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import type { IFluidHandle } from "@fluidframework/core-interfaces";
6
+ import { type FieldKey, type ITreeCursor, type ITreeCursorSynchronous } from "../../core/index.js";
7
+ import type { TreeLeafValue, ImplicitFieldSchema, ImplicitAllowedTypes } from "../schemaTypes.js";
8
+ /**
9
+ * Verbose encoding of a {@link TreeNode} or {@link TreeValue}.
10
+ * @remarks
11
+ * This is verbose meaning that every {@link TreeNode} is a {@link VerboseTreeNode}.
12
+ * Any IFluidHandle values have been replaced by `THandle`.
13
+ * @privateRemarks
14
+ * This can store all possible simple trees, but it can not store all possible trees representable by our internal representations like FlexTree and JsonableTree.
15
+ */
16
+ export type VerboseTree<THandle = IFluidHandle> = VerboseTreeNode<THandle> | Exclude<TreeLeafValue, IFluidHandle> | THandle;
17
+ /**
18
+ * Verbose encoding of a {@link TreeNode}.
19
+ * @remarks
20
+ * This is verbose meaning that every {@link TreeNode} has an explicit `type` property, and `fields`.
21
+ * This allowed VerboseTreeNode to be unambiguous regarding which type each node is without relying on symbols or hidden state.
22
+ *
23
+ * Any IFluidHandle values have been replaced by `THandle`. If the `THandle` is JSON compatible, then this type is JSON compatible as well.
24
+ *
25
+ * @privateRemarks
26
+ * This type is only used for data which is copied into and out of the tree.
27
+ * When being copied out, its fine to have the data be mutable since its a copy.
28
+ *
29
+ * When being copied in, we don't need to mutate, so we could use a readonly variant of this type.
30
+ * however the copy in case (createFromVerbose) probably isn't harmed much by just reusing this type as is,
31
+ * since if the caller has immutable data, TypeScript doesn't prevent assigning immutable data to a mutable type anyway.
32
+ * Also relaxing the input methods to take readonly data would be a non-breaking change so it can be done later if desired.
33
+ *
34
+ * This format is simple-tree specialized alternative to {@link JsonableTree}.
35
+ * This format allows for all simple-tree compatible trees to be represented.
36
+ *
37
+ * Unlike `JsonableTree`, leaf nodes are not boxed into node objects, and instead have their schema inferred from the value.
38
+ * Additionally, sequence fields can only occur on a node that has a single sequence field (with the empty key) replicating the behavior of simple-tree ArrayNodes.
39
+ */
40
+ export interface VerboseTreeNode<THandle = IFluidHandle> {
41
+ /**
42
+ * The meaning of this node.
43
+ * Provides contexts/semantics for this node and its content.
44
+ * @remarks
45
+ * Typically used to associate a node with metadata (including a schema) and source code (types, behaviors, etc).
46
+ * When used with this package's schema system, it will be the {@link TreeNodeSchemaCore.identifier}.
47
+ */
48
+ type: string;
49
+ /**
50
+ * Content of this node.
51
+ * For array nodes, an array of children.
52
+ * For map and object nodes, an object which children under keys.
53
+ * @remarks
54
+ * For object nodes, the keys could be either the stored keys, or the property keys depending on usage.
55
+ */
56
+ fields: VerboseTree<THandle>[] | {
57
+ [key: string]: VerboseTree<THandle>;
58
+ };
59
+ }
60
+ /**
61
+ * Options for how to interpret a `VerboseTree<TCustom>` when schema information is available.
62
+ */
63
+ export interface ParseOptions<TCustom> {
64
+ /**
65
+ * Fixup custom input formats.
66
+ * @remarks
67
+ * Main usage is to handle IFluidHandles.
68
+ * When targeting JSON compatibility,
69
+ * this may be by throwing an error or including a placeholder.
70
+ * Since IFluidHandles are special references to FLuid data which is garbage collected when not referenced by the container for long enough,
71
+ * any scheme for encoding handles for storage outside the container (or in formats the container does not understand) is unreliable.
72
+ */
73
+ valueConverter(data: VerboseTree<TCustom>): TreeLeafValue | VerboseTreeNode<TCustom>;
74
+ /**
75
+ * If true, interpret the input keys of object nodes as stored keys.
76
+ * If false, interpret them as property keys.
77
+ * @defaultValue false.
78
+ */
79
+ readonly useStoredKeys?: boolean;
80
+ }
81
+ /**
82
+ * Options for how to interpret a `VerboseTree<TCustom>` without relying on schema.
83
+ */
84
+ export interface SchemalessParseOptions<TCustom> {
85
+ /**
86
+ * Fixup custom input formats.
87
+ * @remarks
88
+ * See note on {@link ParseOptions.valueConverter}.
89
+ */
90
+ valueConverter(data: VerboseTree<TCustom>): TreeLeafValue | VerboseTreeNode<TCustom>;
91
+ /**
92
+ * Converts stored keys into whatever key the tree is using in its encoding.
93
+ */
94
+ keyConverter?: {
95
+ parse(type: string, inputKey: string): FieldKey;
96
+ encode(type: string, key: FieldKey): string;
97
+ };
98
+ }
99
+ /**
100
+ * Options for how to interpret a `VerboseTree<TCustom>` without relying on schema.
101
+ */
102
+ export interface EncodeOptions<TCustom> {
103
+ /**
104
+ * Fixup custom input formats.
105
+ * @remarks
106
+ * See note on {@link ParseOptions.valueConverter}.
107
+ */
108
+ valueConverter(data: IFluidHandle): TCustom;
109
+ /**
110
+ * If true, interpret the input keys of object nodes as stored keys.
111
+ * If false, interpret them as property keys.
112
+ * @defaultValue false.
113
+ */
114
+ readonly useStoredKeys?: boolean;
115
+ }
116
+ /**
117
+ * Use info from `schema` to convert `options` to {@link SchemalessParseOptions}.
118
+ */
119
+ export declare function applySchemaToParserOptions<TCustom>(schema: ImplicitFieldSchema, options: ParseOptions<TCustom>): SchemalessParseOptions<TCustom>;
120
+ /**
121
+ * Used to read a VerboseTree as a node cursor.
122
+ *
123
+ * @returns an {@link ITreeCursorSynchronous} for a single node in nodes mode.
124
+ */
125
+ export declare function cursorFromVerbose<TCustom>(data: VerboseTree<TCustom>, options: SchemalessParseOptions<TCustom>): ITreeCursorSynchronous;
126
+ /**
127
+ * Used to read a VerboseTree[] as a field cursor.
128
+ *
129
+ * @returns an {@link ITreeCursorSynchronous} for a single field in fields mode.
130
+ */
131
+ export declare function fieldCursorFromVerbose<TCustom>(data: VerboseTree<TCustom>[], options: SchemalessParseOptions<TCustom>): ITreeCursorSynchronous;
132
+ /**
133
+ * Used to read a node cursor as a VerboseTree.
134
+ */
135
+ export declare function verboseFromCursor<TCustom>(reader: ITreeCursor, rootSchema: ImplicitAllowedTypes, options: EncodeOptions<TCustom>): VerboseTree<TCustom>;
136
+ //# sourceMappingURL=verboseTree.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verboseTree.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/verboseTree.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAIpE,OAAO,EAON,KAAK,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,sBAAsB,EAE3B,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EACX,aAAa,EACb,mBAAmB,EACnB,oBAAoB,EACpB,MAAM,mBAAmB,CAAC;AAmB3B;;;;;;;GAOG;AACH,MAAM,MAAM,WAAW,CAAC,OAAO,GAAG,YAAY,IAC3C,eAAe,CAAC,OAAO,CAAC,GACxB,OAAO,CAAC,aAAa,EAAE,YAAY,C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B,sBAAsB,CAAC,OAAO,CAAC,CAoDjC;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EACxC,IAAI,EAAE,WAAW,CAAC,OAAO,CAAC,EAC1B,OAAO,EAAE,sBAAsB,CAAC,OAAO,CAAC,GACtC,sBAAsB,CAExB;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAC7C,IAAI,EAAE,WAAW,CAAC,OAAO,CAAC,EAAE,EAC5B,OAAO,EAAE,sBAAsB,CAAC,OAAO,CAAC,GACtC,sBAAsB,CAMxB;AA0FD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EACxC,MAAM,EAAE,WAAW,EACnB,UAAU,EAAE,oBAAoB,EAChC,OAAO,EAAE,aAAa,CAAC,OAAO,CAAC,GAC7B,WAAW,CAAC,OAAO,CAAC,CActB"}
@@ -0,0 +1,213 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { isFluidHandle } from "@fluidframework/runtime-utils/internal";
6
+ import { assert } from "@fluidframework/core-utils/internal";
7
+ import { aboveRootPlaceholder, EmptyKey, forEachField, inCursorField, keyAsDetachedField, mapCursorField, } from "../../core/index.js";
8
+ import { brand, fail } from "../../util/index.js";
9
+ import { getSimpleNodeSchema, NodeKind } from "../core/index.js";
10
+ import { isTreeValue, stackTreeFieldCursor, stackTreeNodeCursor, } from "../../feature-libraries/index.js";
11
+ import { booleanSchema, handleSchema, nullSchema, numberSchema, stringSchema, } from "../leafNodeSchema.js";
12
+ import { toFlexSchema } from "../toFlexSchema.js";
13
+ import { isObjectNodeSchema } from "../objectNodeTypes.js";
14
+ import { walkFieldSchema } from "./tree.js";
15
+ /**
16
+ * Use info from `schema` to convert `options` to {@link SchemalessParseOptions}.
17
+ */
18
+ export function applySchemaToParserOptions(schema, options) {
19
+ const config = {
20
+ useStoredKeys: false,
21
+ ...options,
22
+ };
23
+ // TODO: should provide a way to look up schema by name efficiently without converting to flex tree schema and back.
24
+ // Maybe cache identifier->schema map on simple tree schema lazily.
25
+ const flexSchema = toFlexSchema(schema);
26
+ return {
27
+ valueConverter: config.valueConverter,
28
+ keyConverter: config.useStoredKeys
29
+ ? undefined
30
+ : {
31
+ encode: (type, key) => {
32
+ // translate stored key into property key.
33
+ const flexNodeSchema = flexSchema.nodeSchema.get(brand(type)) ?? fail("missing schema");
34
+ const simpleNodeSchema = getSimpleNodeSchema(flexNodeSchema);
35
+ if (isObjectNodeSchema(simpleNodeSchema)) {
36
+ const propertyKey = simpleNodeSchema.storedKeyToPropertyKey.get(key);
37
+ if (propertyKey !== undefined) {
38
+ return propertyKey;
39
+ }
40
+ // Looking up an out of schema key.
41
+ // This must point to a non-existent field.
42
+ // It's possible that the key, if we returned it unmodified, could point to some data
43
+ // (for example if looking up a key which is a stored key already when using property keys).
44
+ // Thus return an arbitrary key that was selected randomly, so should not exist on non-adversarial data:
45
+ const arbitrary = "arbitrary unused key: fe71614a-bf3e-43b3-b7b0-4cef39538e90";
46
+ assert(!simpleNodeSchema.storedKeyToPropertyKey.has(brand(arbitrary)), 0xa13 /* arbitrarily selected unused key was actually used */);
47
+ return arbitrary;
48
+ }
49
+ return key;
50
+ },
51
+ parse: (type, inputKey) => {
52
+ const flexNodeSchema = flexSchema.nodeSchema.get(brand(type)) ?? fail("missing schema");
53
+ const simpleNodeSchema = getSimpleNodeSchema(flexNodeSchema);
54
+ if (isObjectNodeSchema(simpleNodeSchema)) {
55
+ const info = simpleNodeSchema.flexKeyMap.get(inputKey) ?? fail("missing field info");
56
+ return info.storedKey;
57
+ }
58
+ return brand(inputKey);
59
+ },
60
+ },
61
+ };
62
+ }
63
+ /**
64
+ * Used to read a VerboseTree as a node cursor.
65
+ *
66
+ * @returns an {@link ITreeCursorSynchronous} for a single node in nodes mode.
67
+ */
68
+ export function cursorFromVerbose(data, options) {
69
+ return stackTreeNodeCursor(verboseTreeAdapter(options), data);
70
+ }
71
+ /**
72
+ * Used to read a VerboseTree[] as a field cursor.
73
+ *
74
+ * @returns an {@link ITreeCursorSynchronous} for a single field in fields mode.
75
+ */
76
+ export function fieldCursorFromVerbose(data, options) {
77
+ return stackTreeFieldCursor(verboseTreeAdapter(options), { type: aboveRootPlaceholder, fields: data }, keyAsDetachedField(EmptyKey));
78
+ }
79
+ function verboseTreeAdapter(options) {
80
+ return {
81
+ value: (input) => {
82
+ const node = options.valueConverter(input);
83
+ return isTreeValue(node) ? node : undefined;
84
+ },
85
+ type: (input) => {
86
+ const node = options.valueConverter(input);
87
+ switch (typeof node) {
88
+ case "number":
89
+ return numberSchema.identifier;
90
+ case "string":
91
+ return stringSchema.identifier;
92
+ case "boolean":
93
+ return booleanSchema.identifier;
94
+ default:
95
+ if (node === null) {
96
+ return nullSchema.identifier;
97
+ }
98
+ if (isFluidHandle(node)) {
99
+ return handleSchema.identifier;
100
+ }
101
+ return node.type;
102
+ }
103
+ },
104
+ keysFromNode: (input) => {
105
+ const node = options.valueConverter(input);
106
+ switch (typeof node) {
107
+ case "object": {
108
+ if (node === null) {
109
+ return [];
110
+ }
111
+ if (isFluidHandle(node)) {
112
+ return [];
113
+ }
114
+ if (Array.isArray(node.fields)) {
115
+ return node.fields.length === 0 ? [] : [EmptyKey];
116
+ }
117
+ const inputKeys = Object.keys(node.fields);
118
+ const converter = options.keyConverter;
119
+ if (converter === undefined) {
120
+ return inputKeys;
121
+ }
122
+ return inputKeys.map((k) => converter.parse(node.type, k));
123
+ }
124
+ default:
125
+ return [];
126
+ }
127
+ },
128
+ getFieldFromNode: (input, key) => {
129
+ const node = options.valueConverter(input);
130
+ // Object.prototype.hasOwnProperty can return true for strings (ex: with key "0"), so we have to filter them out.
131
+ // Rather than just special casing strings, we can handle them with an early return for all primitives.
132
+ if (typeof node !== "object") {
133
+ return [];
134
+ }
135
+ if (node === null) {
136
+ return [];
137
+ }
138
+ if (isFluidHandle(node)) {
139
+ return [];
140
+ }
141
+ if (Array.isArray(node.fields)) {
142
+ return key === EmptyKey ? node.fields : [];
143
+ }
144
+ const convertedKey = options.keyConverter === undefined ? key : options.keyConverter.encode(node.type, key);
145
+ if (Object.prototype.hasOwnProperty.call(node.fields, convertedKey)) {
146
+ const field = node.fields[convertedKey];
147
+ return field === undefined ? [] : [field];
148
+ }
149
+ return [];
150
+ },
151
+ };
152
+ }
153
+ /**
154
+ * Used to read a node cursor as a VerboseTree.
155
+ */
156
+ export function verboseFromCursor(reader, rootSchema, options) {
157
+ const config = {
158
+ useStoredKeys: false,
159
+ ...options,
160
+ };
161
+ const schemaMap = new Map();
162
+ walkFieldSchema(rootSchema, {
163
+ node(schema) {
164
+ schemaMap.set(schema.identifier, schema);
165
+ },
166
+ });
167
+ return verboseFromCursorInner(reader, config, schemaMap);
168
+ }
169
+ function verboseFromCursorInner(reader, options, schema) {
170
+ const type = reader.type;
171
+ const nodeSchema = schema.get(type) ?? fail("missing schema for type in cursor");
172
+ switch (type) {
173
+ case numberSchema.identifier:
174
+ case booleanSchema.identifier:
175
+ case nullSchema.identifier:
176
+ case stringSchema.identifier:
177
+ assert(reader.value !== undefined, 0xa14 /* out of schema: missing value */);
178
+ assert(!isFluidHandle(reader.value), 0xa15 /* out of schema: unexpected FluidHandle */);
179
+ return reader.value;
180
+ case handleSchema.identifier:
181
+ assert(reader.value !== undefined, 0xa16 /* out of schema: missing value */);
182
+ assert(isFluidHandle(reader.value), 0xa17 /* out of schema: unexpected FluidHandle */);
183
+ return options.valueConverter(reader.value);
184
+ default: {
185
+ assert(reader.value === undefined, 0xa18 /* out of schema: unexpected value */);
186
+ if (nodeSchema.kind === NodeKind.Array) {
187
+ const fields = inCursorField(reader, EmptyKey, () => mapCursorField(reader, () => verboseFromCursorInner(reader, options, schema)));
188
+ return { type, fields };
189
+ }
190
+ else {
191
+ const fields = {};
192
+ forEachField(reader, () => {
193
+ const children = mapCursorField(reader, () => verboseFromCursorInner(reader, options, schema));
194
+ if (children.length === 1) {
195
+ const storedKey = reader.getFieldKey();
196
+ const key = isObjectNodeSchema(nodeSchema) && !options.useStoredKeys
197
+ ? nodeSchema.storedKeyToPropertyKey.get(storedKey) ??
198
+ fail("missing property key")
199
+ : storedKey;
200
+ // Length is checked above.
201
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
202
+ fields[key] = children[0];
203
+ }
204
+ else {
205
+ assert(children.length === 0, 0xa19 /* invalid children number */);
206
+ }
207
+ });
208
+ return { type, fields };
209
+ }
210
+ }
211
+ }
212
+ }
213
+ //# sourceMappingURL=verboseTree.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verboseTree.js","sourceRoot":"","sources":["../../../src/simple-tree/api/verboseTree.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AACvE,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAE7D,OAAO,EACN,oBAAoB,EACpB,QAAQ,EACR,YAAY,EACZ,aAAa,EACb,kBAAkB,EAClB,cAAc,GAKd,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAMlD,OAAO,EAAE,mBAAmB,EAAE,QAAQ,EAAuB,MAAM,kBAAkB,CAAC;AACtF,OAAO,EACN,WAAW,EACX,oBAAoB,EACpB,mBAAmB,GAEnB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACN,aAAa,EACb,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,YAAY,GACZ,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAyH5C;;GAEG;AACH,MAAM,UAAU,0BAA0B,CACzC,MAA2B,EAC3B,OAA8B;IAE9B,MAAM,MAAM,GAAoC;QAC/C,aAAa,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,MAAM,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,KAAK,CAAC,6BAA6B,CAAC,CAAC;oBACpE,CAAC;gBACF,CAAC,CAAC,CAAC;gBACH,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;YACzB,CAAC;QACF,CAAC;IACF,CAAC;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport { isFluidHandle } from \"@fluidframework/runtime-utils/internal\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\taboveRootPlaceholder,\n\tEmptyKey,\n\tforEachField,\n\tinCursorField,\n\tkeyAsDetachedField,\n\tmapCursorField,\n\ttype FieldKey,\n\ttype ITreeCursor,\n\ttype ITreeCursorSynchronous,\n\ttype TreeNodeSchemaIdentifier,\n} from \"../../core/index.js\";\nimport { brand, fail } from \"../../util/index.js\";\nimport type {\n\tTreeLeafValue,\n\tImplicitFieldSchema,\n\tImplicitAllowedTypes,\n} from \"../schemaTypes.js\";\nimport { getSimpleNodeSchema, NodeKind, type TreeNodeSchema } from \"../core/index.js\";\nimport {\n\tisTreeValue,\n\tstackTreeFieldCursor,\n\tstackTreeNodeCursor,\n\ttype CursorAdapter,\n} from \"../../feature-libraries/index.js\";\nimport {\n\tbooleanSchema,\n\thandleSchema,\n\tnullSchema,\n\tnumberSchema,\n\tstringSchema,\n} from \"../leafNodeSchema.js\";\nimport { toFlexSchema } from \"../toFlexSchema.js\";\nimport { isObjectNodeSchema } from \"../objectNodeTypes.js\";\nimport { walkFieldSchema } from \"./tree.js\";\n\n/**\n * Verbose encoding of a {@link TreeNode} or {@link TreeValue}.\n * @remarks\n * This is verbose meaning that every {@link TreeNode} is a {@link VerboseTreeNode}.\n * Any IFluidHandle values have been replaced by `THandle`.\n * @privateRemarks\n * This can store all possible simple trees, but it can not store all possible trees representable by our internal representations like FlexTree and JsonableTree.\n */\nexport type VerboseTree<THandle = IFluidHandle> =\n\t| VerboseTreeNode<THandle>\n\t| Exclude<TreeLeafValue, IFluidHandle>\n\t| THandle;\n\n/**\n * Verbose encoding of a {@link TreeNode}.\n * @remarks\n * This is verbose meaning that every {@link TreeNode} has an explicit `type` property, and `fields`.\n * This allowed VerboseTreeNode to be unambiguous regarding which type each node is without relying on symbols or hidden state.\n *\n * Any IFluidHandle values have been replaced by `THandle`. If the `THandle` is JSON compatible, then this type is JSON compatible as well.\n *\n * @privateRemarks\n * This type is only used for data which is copied into and out of the tree.\n * When being copied out, its fine to have the data be mutable since its a copy.\n *\n * When being copied in, we don't need to mutate, so we could use a readonly variant of this type.\n * however the copy in case (createFromVerbose) probably isn't harmed much by just reusing this type as is,\n * since if the caller has immutable data, TypeScript doesn't prevent assigning immutable data to a mutable type anyway.\n * Also relaxing the input methods to take readonly data would be a non-breaking change so it can be done later if desired.\n *\n * This format is simple-tree specialized alternative to {@link JsonableTree}.\n * This format allows for all simple-tree compatible trees to be represented.\n *\n * Unlike `JsonableTree`, leaf nodes are not boxed into node objects, and instead have their schema inferred from the value.\n * Additionally, sequence fields can only occur on a node that has a single sequence field (with the empty key) replicating the behavior of simple-tree ArrayNodes.\n */\nexport interface VerboseTreeNode<THandle = IFluidHandle> {\n\t/**\n\t * The meaning of this node.\n\t * Provides contexts/semantics for this node and its content.\n\t * @remarks\n\t * Typically used to associate a node with metadata (including a schema) and source code (types, behaviors, etc).\n\t * When used with this package's schema system, it will be the {@link TreeNodeSchemaCore.identifier}.\n\t */\n\ttype: string;\n\n\t/**\n\t * Content of this node.\n\t * For array nodes, an array of children.\n\t * For map and object nodes, an object which children under keys.\n\t * @remarks\n\t * For object nodes, the keys could be either the stored keys, or the property keys depending on usage.\n\t */\n\tfields:\n\t\t| VerboseTree<THandle>[]\n\t\t| {\n\t\t\t\t[key: string]: VerboseTree<THandle>;\n\t\t };\n}\n\n/**\n * Options for how to interpret a `VerboseTree<TCustom>` when schema information is available.\n */\nexport interface ParseOptions<TCustom> {\n\t/**\n\t * Fixup custom input formats.\n\t * @remarks\n\t * Main usage is to handle IFluidHandles.\n\t * When targeting JSON compatibility,\n\t * this may be by throwing an error or including a placeholder.\n\t * Since IFluidHandles are special references to FLuid data which is garbage collected when not referenced by the container for long enough,\n\t * any scheme for encoding handles for storage outside the container (or in formats the container does not understand) is unreliable.\n\t */\n\tvalueConverter(data: VerboseTree<TCustom>): TreeLeafValue | VerboseTreeNode<TCustom>;\n\t/**\n\t * If true, interpret the input keys of object nodes as stored keys.\n\t * If false, interpret them as property keys.\n\t * @defaultValue false.\n\t */\n\treadonly useStoredKeys?: boolean;\n}\n\n/**\n * Options for how to interpret a `VerboseTree<TCustom>` without relying on schema.\n */\nexport interface SchemalessParseOptions<TCustom> {\n\t/**\n\t * Fixup custom input formats.\n\t * @remarks\n\t * See note on {@link ParseOptions.valueConverter}.\n\t */\n\tvalueConverter(data: VerboseTree<TCustom>): TreeLeafValue | VerboseTreeNode<TCustom>;\n\t/**\n\t * Converts stored keys into whatever key the tree is using in its encoding.\n\t */\n\tkeyConverter?: {\n\t\tparse(type: string, inputKey: string): FieldKey;\n\t\tencode(type: string, key: FieldKey): string;\n\t};\n}\n\n/**\n * Options for how to interpret a `VerboseTree<TCustom>` without relying on schema.\n */\nexport interface EncodeOptions<TCustom> {\n\t/**\n\t * Fixup custom input formats.\n\t * @remarks\n\t * See note on {@link ParseOptions.valueConverter}.\n\t */\n\tvalueConverter(data: IFluidHandle): TCustom;\n\t/**\n\t * If true, interpret the input keys of object nodes as stored keys.\n\t * If false, interpret them as property keys.\n\t * @defaultValue false.\n\t */\n\treadonly useStoredKeys?: boolean;\n}\n\n/**\n * Use info from `schema` to convert `options` to {@link SchemalessParseOptions}.\n */\nexport function applySchemaToParserOptions<TCustom>(\n\tschema: ImplicitFieldSchema,\n\toptions: ParseOptions<TCustom>,\n): SchemalessParseOptions<TCustom> {\n\tconst config: Required<ParseOptions<TCustom>> = {\n\t\tuseStoredKeys: false,\n\t\t...options,\n\t};\n\n\t// TODO: should provide a way to look up schema by name efficiently without converting to flex tree schema and back.\n\t// Maybe cache identifier->schema map on simple tree schema lazily.\n\tconst flexSchema = toFlexSchema(schema);\n\n\treturn {\n\t\tvalueConverter: config.valueConverter,\n\t\tkeyConverter: config.useStoredKeys\n\t\t\t? undefined\n\t\t\t: {\n\t\t\t\t\tencode: (type, key: FieldKey): string => {\n\t\t\t\t\t\t// translate stored key into property key.\n\t\t\t\t\t\tconst flexNodeSchema =\n\t\t\t\t\t\t\tflexSchema.nodeSchema.get(brand(type)) ?? fail(\"missing schema\");\n\t\t\t\t\t\tconst simpleNodeSchema = getSimpleNodeSchema(flexNodeSchema);\n\t\t\t\t\t\tif (isObjectNodeSchema(simpleNodeSchema)) {\n\t\t\t\t\t\t\tconst propertyKey = simpleNodeSchema.storedKeyToPropertyKey.get(key);\n\t\t\t\t\t\t\tif (propertyKey !== undefined) {\n\t\t\t\t\t\t\t\treturn propertyKey;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// Looking up an out of schema key.\n\t\t\t\t\t\t\t// This must point to a non-existent field.\n\t\t\t\t\t\t\t// It's possible that the key, if we returned it unmodified, could point to some data\n\t\t\t\t\t\t\t// (for example if looking up a key which is a stored key already when using property keys).\n\t\t\t\t\t\t\t// Thus return an arbitrary key that was selected randomly, so should not exist on non-adversarial data:\n\t\t\t\t\t\t\tconst arbitrary = \"arbitrary unused key: fe71614a-bf3e-43b3-b7b0-4cef39538e90\";\n\t\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\t\t!simpleNodeSchema.storedKeyToPropertyKey.has(brand(arbitrary)),\n\t\t\t\t\t\t\t\t0xa13 /* arbitrarily selected unused key was actually used */,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\treturn arbitrary;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn key;\n\t\t\t\t\t},\n\t\t\t\t\tparse: (type, inputKey): FieldKey => {\n\t\t\t\t\t\tconst flexNodeSchema =\n\t\t\t\t\t\t\tflexSchema.nodeSchema.get(brand(type)) ?? fail(\"missing schema\");\n\t\t\t\t\t\tconst simpleNodeSchema = getSimpleNodeSchema(flexNodeSchema);\n\t\t\t\t\t\tif (isObjectNodeSchema(simpleNodeSchema)) {\n\t\t\t\t\t\t\tconst info =\n\t\t\t\t\t\t\t\tsimpleNodeSchema.flexKeyMap.get(inputKey) ?? fail(\"missing field info\");\n\t\t\t\t\t\t\treturn info.storedKey;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn brand(inputKey);\n\t\t\t\t\t},\n\t\t\t\t},\n\t};\n}\n\n/**\n * Used to read a VerboseTree as a node cursor.\n *\n * @returns an {@link ITreeCursorSynchronous} for a single node in nodes mode.\n */\nexport function cursorFromVerbose<TCustom>(\n\tdata: VerboseTree<TCustom>,\n\toptions: SchemalessParseOptions<TCustom>,\n): ITreeCursorSynchronous {\n\treturn stackTreeNodeCursor(verboseTreeAdapter(options), data);\n}\n\n/**\n * Used to read a VerboseTree[] as a field cursor.\n *\n * @returns an {@link ITreeCursorSynchronous} for a single field in fields mode.\n */\nexport function fieldCursorFromVerbose<TCustom>(\n\tdata: VerboseTree<TCustom>[],\n\toptions: SchemalessParseOptions<TCustom>,\n): ITreeCursorSynchronous {\n\treturn stackTreeFieldCursor(\n\t\tverboseTreeAdapter(options),\n\t\t{ type: aboveRootPlaceholder, fields: data },\n\t\tkeyAsDetachedField(EmptyKey),\n\t);\n}\n\nfunction verboseTreeAdapter<TCustom>(\n\toptions: SchemalessParseOptions<TCustom>,\n): CursorAdapter<VerboseTree<TCustom>> {\n\treturn {\n\t\tvalue: (input: VerboseTree<TCustom>) => {\n\t\t\tconst node = options.valueConverter(input);\n\t\t\treturn isTreeValue(node) ? node : undefined;\n\t\t},\n\t\ttype: (input: VerboseTree<TCustom>) => {\n\t\t\tconst node = options.valueConverter(input);\n\t\t\tswitch (typeof node) {\n\t\t\t\tcase \"number\":\n\t\t\t\t\treturn numberSchema.identifier as TreeNodeSchemaIdentifier;\n\t\t\t\tcase \"string\":\n\t\t\t\t\treturn stringSchema.identifier as TreeNodeSchemaIdentifier;\n\t\t\t\tcase \"boolean\":\n\t\t\t\t\treturn booleanSchema.identifier as TreeNodeSchemaIdentifier;\n\t\t\t\tdefault:\n\t\t\t\t\tif (node === null) {\n\t\t\t\t\t\treturn nullSchema.identifier as TreeNodeSchemaIdentifier;\n\t\t\t\t\t}\n\t\t\t\t\tif (isFluidHandle(node)) {\n\t\t\t\t\t\treturn handleSchema.identifier as TreeNodeSchemaIdentifier;\n\t\t\t\t\t}\n\t\t\t\t\treturn node.type as TreeNodeSchemaIdentifier;\n\t\t\t}\n\t\t},\n\t\tkeysFromNode: (input: VerboseTree<TCustom>): readonly FieldKey[] => {\n\t\t\tconst node = options.valueConverter(input);\n\t\t\tswitch (typeof node) {\n\t\t\t\tcase \"object\": {\n\t\t\t\t\tif (node === null) {\n\t\t\t\t\t\treturn [];\n\t\t\t\t\t}\n\t\t\t\t\tif (isFluidHandle(node)) {\n\t\t\t\t\t\treturn [];\n\t\t\t\t\t}\n\t\t\t\t\tif (Array.isArray(node.fields)) {\n\t\t\t\t\t\treturn node.fields.length === 0 ? [] : [EmptyKey];\n\t\t\t\t\t}\n\n\t\t\t\t\tconst inputKeys = Object.keys(node.fields);\n\t\t\t\t\tconst converter = options.keyConverter;\n\t\t\t\t\tif (converter === undefined) {\n\t\t\t\t\t\treturn inputKeys as FieldKey[];\n\t\t\t\t\t}\n\t\t\t\t\treturn inputKeys.map((k) => converter.parse(node.type, k));\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\treturn [];\n\t\t\t}\n\t\t},\n\t\tgetFieldFromNode: (\n\t\t\tinput: VerboseTree<TCustom>,\n\t\t\tkey: FieldKey,\n\t\t): readonly VerboseTree<TCustom>[] => {\n\t\t\tconst node = options.valueConverter(input);\n\t\t\t// Object.prototype.hasOwnProperty can return true for strings (ex: with key \"0\"), so we have to filter them out.\n\t\t\t// Rather than just special casing strings, we can handle them with an early return for all primitives.\n\t\t\tif (typeof node !== \"object\") {\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\tif (node === null) {\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\tif (isFluidHandle(node)) {\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\tif (Array.isArray(node.fields)) {\n\t\t\t\treturn key === EmptyKey ? node.fields : [];\n\t\t\t}\n\n\t\t\tconst convertedKey =\n\t\t\t\toptions.keyConverter === undefined ? key : options.keyConverter.encode(node.type, key);\n\n\t\t\tif (Object.prototype.hasOwnProperty.call(node.fields, convertedKey)) {\n\t\t\t\tconst field = node.fields[convertedKey];\n\t\t\t\treturn field === undefined ? [] : [field];\n\t\t\t}\n\n\t\t\treturn [];\n\t\t},\n\t};\n}\n\n/**\n * Used to read a node cursor as a VerboseTree.\n */\nexport function verboseFromCursor<TCustom>(\n\treader: ITreeCursor,\n\trootSchema: ImplicitAllowedTypes,\n\toptions: EncodeOptions<TCustom>,\n): VerboseTree<TCustom> {\n\tconst config: Required<EncodeOptions<TCustom>> = {\n\t\tuseStoredKeys: false,\n\t\t...options,\n\t};\n\n\tconst schemaMap = new Map<string, TreeNodeSchema>();\n\twalkFieldSchema(rootSchema, {\n\t\tnode(schema) {\n\t\t\tschemaMap.set(schema.identifier, schema);\n\t\t},\n\t});\n\n\treturn verboseFromCursorInner(reader, config, schemaMap);\n}\n\nfunction verboseFromCursorInner<TCustom>(\n\treader: ITreeCursor,\n\toptions: Required<EncodeOptions<TCustom>>,\n\tschema: ReadonlyMap<string, TreeNodeSchema>,\n): VerboseTree<TCustom> {\n\tconst type = reader.type;\n\tconst nodeSchema = schema.get(type) ?? fail(\"missing schema for type in cursor\");\n\n\tswitch (type) {\n\t\tcase numberSchema.identifier:\n\t\tcase booleanSchema.identifier:\n\t\tcase nullSchema.identifier:\n\t\tcase stringSchema.identifier:\n\t\t\tassert(reader.value !== undefined, 0xa14 /* out of schema: missing value */);\n\t\t\tassert(!isFluidHandle(reader.value), 0xa15 /* out of schema: unexpected FluidHandle */);\n\t\t\treturn reader.value;\n\t\tcase handleSchema.identifier:\n\t\t\tassert(reader.value !== undefined, 0xa16 /* out of schema: missing value */);\n\t\t\tassert(isFluidHandle(reader.value), 0xa17 /* out of schema: unexpected FluidHandle */);\n\t\t\treturn options.valueConverter(reader.value);\n\t\tdefault: {\n\t\t\tassert(reader.value === undefined, 0xa18 /* out of schema: unexpected value */);\n\t\t\tif (nodeSchema.kind === NodeKind.Array) {\n\t\t\t\tconst fields = inCursorField(reader, EmptyKey, () =>\n\t\t\t\t\tmapCursorField(reader, () => verboseFromCursorInner(reader, options, schema)),\n\t\t\t\t);\n\t\t\t\treturn { type, fields };\n\t\t\t} else {\n\t\t\t\tconst fields: Record<string, VerboseTree<TCustom>> = {};\n\t\t\t\tforEachField(reader, () => {\n\t\t\t\t\tconst children = mapCursorField(reader, () =>\n\t\t\t\t\t\tverboseFromCursorInner(reader, options, schema),\n\t\t\t\t\t);\n\t\t\t\t\tif (children.length === 1) {\n\t\t\t\t\t\tconst storedKey = reader.getFieldKey();\n\t\t\t\t\t\tconst key =\n\t\t\t\t\t\t\tisObjectNodeSchema(nodeSchema) && !options.useStoredKeys\n\t\t\t\t\t\t\t\t? nodeSchema.storedKeyToPropertyKey.get(storedKey) ??\n\t\t\t\t\t\t\t\t\tfail(\"missing property key\")\n\t\t\t\t\t\t\t\t: storedKey;\n\t\t\t\t\t\t// Length is checked above.\n\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\t\t\tfields[key] = children[0]!;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tassert(children.length === 0, 0xa19 /* invalid children number */);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\treturn { type, fields };\n\t\t\t}\n\t\t}\n\t}\n}\n"]}
@@ -2,8 +2,8 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { NodeKind, type ImplicitAllowedTypes, type InsertableTreeNodeFromImplicitAllowedTypes, type TreeNodeFromImplicitAllowedTypes, type TreeNodeSchemaClass, type WithType } from "./schemaTypes.js";
6
- import { type TreeNode } from "./types.js";
5
+ import type { ImplicitAllowedTypes, InsertableTreeNodeFromImplicitAllowedTypes, TreeNodeFromImplicitAllowedTypes } from "./schemaTypes.js";
6
+ import { type WithType, NodeKind, type TreeNode, type TreeNodeSchemaClass } from "./core/index.js";
7
7
  /**
8
8
  * A generic array type, used to defined types like {@link (TreeArrayNode:interface)}.
9
9
  *
@@ -208,5 +208,5 @@ export declare function asIndex(key: string | symbol, exclusiveMax: number): num
208
208
  *
209
209
  * @param name - Unique identifier for this schema including the factory's scope.
210
210
  */
211
- export declare function arraySchema<TName extends string, const T extends ImplicitAllowedTypes, const ImplicitlyConstructable extends boolean>(identifier: TName, info: T, implicitlyConstructable: ImplicitlyConstructable, customizable: boolean): TreeNodeSchemaClass<TName, NodeKind.Array, TreeArrayNode<T> & WithType<TName>, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>, ImplicitlyConstructable, T>;
211
+ export declare function arraySchema<TName extends string, const T extends ImplicitAllowedTypes, const ImplicitlyConstructable extends boolean>(identifier: TName, info: T, implicitlyConstructable: ImplicitlyConstructable, customizable: boolean): TreeNodeSchemaClass<TName, NodeKind.Array, TreeArrayNode<T> & WithType<TName, NodeKind.Array>, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>, ImplicitlyConstructable, T>;
212
212
  //# sourceMappingURL=arrayNode.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"arrayNode.d.ts","sourceRoot":"","sources":["../../src/simple-tree/arrayNode.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA2BH,OAAO,EACN,QAAQ,EACR,KAAK,oBAAoB,EACzB,KAAK,0CAA0C,EAC/C,KAAK,gCAAgC,EACrC,KAAK,mBAAmB,EACxB,KAAK,QAAQ,EAIb,MAAM,kB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