@fluidframework/tree 2.74.0-370705 → 2.80.0

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 (1421) hide show
  1. package/.eslintrc.cjs +1 -16
  2. package/.vscode/settings.json +2 -0
  3. package/CHANGELOG.md +29 -0
  4. package/api-report/tree.alpha.api.md +39 -17
  5. package/assertTagging.config.mjs +1 -1
  6. package/dist/alpha.d.ts +7 -0
  7. package/dist/codec/codec.d.ts +63 -20
  8. package/dist/codec/codec.d.ts.map +1 -1
  9. package/dist/codec/codec.js +50 -24
  10. package/dist/codec/codec.js.map +1 -1
  11. package/dist/codec/index.d.ts +2 -2
  12. package/dist/codec/index.d.ts.map +1 -1
  13. package/dist/codec/index.js +2 -2
  14. package/dist/codec/index.js.map +1 -1
  15. package/dist/codec/versioned/codec.d.ts +80 -22
  16. package/dist/codec/versioned/codec.d.ts.map +1 -1
  17. package/dist/codec/versioned/codec.js +137 -15
  18. package/dist/codec/versioned/codec.js.map +1 -1
  19. package/dist/codec/versioned/index.d.ts +1 -1
  20. package/dist/codec/versioned/index.d.ts.map +1 -1
  21. package/dist/codec/versioned/index.js +2 -2
  22. package/dist/codec/versioned/index.js.map +1 -1
  23. package/dist/core/change-family/changeFamily.d.ts +1 -4
  24. package/dist/core/change-family/changeFamily.d.ts.map +1 -1
  25. package/dist/core/change-family/changeFamily.js.map +1 -1
  26. package/dist/core/change-family/index.d.ts +1 -1
  27. package/dist/core/change-family/index.d.ts.map +1 -1
  28. package/dist/core/change-family/index.js.map +1 -1
  29. package/dist/core/index.d.ts +3 -3
  30. package/dist/core/index.d.ts.map +1 -1
  31. package/dist/core/index.js +5 -8
  32. package/dist/core/index.js.map +1 -1
  33. package/dist/core/rebase/changeRebaser.d.ts +37 -8
  34. package/dist/core/rebase/changeRebaser.d.ts.map +1 -1
  35. package/dist/core/rebase/changeRebaser.js.map +1 -1
  36. package/dist/core/rebase/index.d.ts +2 -2
  37. package/dist/core/rebase/index.d.ts.map +1 -1
  38. package/dist/core/rebase/index.js +1 -3
  39. package/dist/core/rebase/index.js.map +1 -1
  40. package/dist/core/rebase/types.d.ts +27 -5
  41. package/dist/core/rebase/types.d.ts.map +1 -1
  42. package/dist/core/rebase/types.js +1 -16
  43. package/dist/core/rebase/types.js.map +1 -1
  44. package/dist/core/rebase/utils.d.ts.map +1 -1
  45. package/dist/core/rebase/utils.js +10 -28
  46. package/dist/core/rebase/utils.js.map +1 -1
  47. package/dist/core/schema-stored/schema.d.ts +4 -7
  48. package/dist/core/schema-stored/schema.d.ts.map +1 -1
  49. package/dist/core/schema-stored/schema.js +5 -5
  50. package/dist/core/schema-stored/schema.js.map +1 -1
  51. package/dist/core/tree/anchorSet.d.ts.map +1 -1
  52. package/dist/core/tree/anchorSet.js +3 -4
  53. package/dist/core/tree/anchorSet.js.map +1 -1
  54. package/dist/core/tree/detachedFieldIndex.d.ts +1 -8
  55. package/dist/core/tree/detachedFieldIndex.d.ts.map +1 -1
  56. package/dist/core/tree/detachedFieldIndex.js +12 -65
  57. package/dist/core/tree/detachedFieldIndex.js.map +1 -1
  58. package/dist/core/tree/detachedFieldIndexCodecCommon.d.ts +18 -10
  59. package/dist/core/tree/detachedFieldIndexCodecCommon.d.ts.map +1 -1
  60. package/dist/core/tree/detachedFieldIndexCodecCommon.js +6 -6
  61. package/dist/core/tree/detachedFieldIndexCodecCommon.js.map +1 -1
  62. package/dist/core/tree/detachedFieldIndexCodecV1.d.ts +2 -3
  63. package/dist/core/tree/detachedFieldIndexCodecV1.d.ts.map +1 -1
  64. package/dist/core/tree/detachedFieldIndexCodecV1.js +4 -5
  65. package/dist/core/tree/detachedFieldIndexCodecV1.js.map +1 -1
  66. package/dist/core/tree/detachedFieldIndexCodecV2.d.ts +2 -3
  67. package/dist/core/tree/detachedFieldIndexCodecV2.d.ts.map +1 -1
  68. package/dist/core/tree/detachedFieldIndexCodecV2.js +4 -6
  69. package/dist/core/tree/detachedFieldIndexCodecV2.js.map +1 -1
  70. package/dist/core/tree/detachedFieldIndexCodecs.d.ts +5 -6
  71. package/dist/core/tree/detachedFieldIndexCodecs.d.ts.map +1 -1
  72. package/dist/core/tree/detachedFieldIndexCodecs.js +11 -41
  73. package/dist/core/tree/detachedFieldIndexCodecs.js.map +1 -1
  74. package/dist/core/tree/detachedFieldIndexFormatCommon.d.ts +4 -4
  75. package/dist/core/tree/detachedFieldIndexFormatCommon.d.ts.map +1 -1
  76. package/dist/core/tree/detachedFieldIndexFormatCommon.js +2 -2
  77. package/dist/core/tree/detachedFieldIndexFormatCommon.js.map +1 -1
  78. package/dist/core/tree/index.d.ts +2 -2
  79. package/dist/core/tree/index.d.ts.map +1 -1
  80. package/dist/core/tree/index.js +4 -5
  81. package/dist/core/tree/index.js.map +1 -1
  82. package/dist/core/tree/mapTree.js +1 -1
  83. package/dist/core/tree/mapTree.js.map +1 -1
  84. package/dist/core/tree/pathTree.d.ts +3 -11
  85. package/dist/core/tree/pathTree.d.ts.map +1 -1
  86. package/dist/core/tree/pathTree.js +2 -14
  87. package/dist/core/tree/pathTree.js.map +1 -1
  88. package/dist/core/tree/sparseTree.d.ts.map +1 -1
  89. package/dist/core/tree/sparseTree.js +1 -0
  90. package/dist/core/tree/sparseTree.js.map +1 -1
  91. package/dist/core/tree/treeTextFormat.d.ts.map +1 -1
  92. package/dist/core/tree/treeTextFormat.js +5 -9
  93. package/dist/core/tree/treeTextFormat.js.map +1 -1
  94. package/dist/feature-libraries/changeAtomIdBTree.d.ts +10 -0
  95. package/dist/feature-libraries/changeAtomIdBTree.d.ts.map +1 -0
  96. package/dist/feature-libraries/changeAtomIdBTree.js +16 -0
  97. package/dist/feature-libraries/changeAtomIdBTree.js.map +1 -0
  98. package/dist/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
  99. package/dist/feature-libraries/chunked-forest/basicChunk.js +1 -8
  100. package/dist/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
  101. package/dist/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  102. package/dist/feature-libraries/chunked-forest/chunkTree.js +1 -4
  103. package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  104. package/dist/feature-libraries/chunked-forest/chunkedForest.js +6 -6
  105. package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  106. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  107. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js +7 -4
  108. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  109. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  110. package/dist/feature-libraries/chunked-forest/codec/codecs.js +19 -11
  111. package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  112. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +3 -3
  113. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  114. package/dist/feature-libraries/chunked-forest/codec/format.d.ts +5 -5
  115. package/dist/feature-libraries/chunked-forest/codec/format.d.ts.map +1 -1
  116. package/dist/feature-libraries/chunked-forest/codec/format.js +4 -4
  117. package/dist/feature-libraries/chunked-forest/codec/format.js.map +1 -1
  118. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +9 -5
  119. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
  120. package/dist/feature-libraries/chunked-forest/uniformChunk.js +1 -1
  121. package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  122. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts +54 -93
  123. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  124. package/dist/feature-libraries/default-schema/defaultEditBuilder.js +81 -245
  125. package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  126. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts +1 -1
  127. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  128. package/dist/feature-libraries/default-schema/defaultFieldKinds.js +6 -5
  129. package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  130. package/dist/feature-libraries/default-schema/index.d.ts +1 -2
  131. package/dist/feature-libraries/default-schema/index.d.ts.map +1 -1
  132. package/dist/feature-libraries/default-schema/index.js +2 -5
  133. package/dist/feature-libraries/default-schema/index.js.map +1 -1
  134. package/dist/feature-libraries/default-schema/mappedEditBuilder.d.ts +8 -7
  135. package/dist/feature-libraries/default-schema/mappedEditBuilder.d.ts.map +1 -1
  136. package/dist/feature-libraries/default-schema/mappedEditBuilder.js +6 -15
  137. package/dist/feature-libraries/default-schema/mappedEditBuilder.js.map +1 -1
  138. package/dist/feature-libraries/deltaUtils.d.ts +0 -1
  139. package/dist/feature-libraries/deltaUtils.d.ts.map +1 -1
  140. package/dist/feature-libraries/deltaUtils.js +1 -6
  141. package/dist/feature-libraries/deltaUtils.js.map +1 -1
  142. package/dist/feature-libraries/flex-tree/context.d.ts +0 -9
  143. package/dist/feature-libraries/flex-tree/context.d.ts.map +1 -1
  144. package/dist/feature-libraries/flex-tree/context.js +0 -6
  145. package/dist/feature-libraries/flex-tree/context.js.map +1 -1
  146. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts +6 -6
  147. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  148. package/dist/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  149. package/dist/feature-libraries/flex-tree/lazyField.d.ts +7 -8
  150. package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  151. package/dist/feature-libraries/flex-tree/lazyField.js +16 -47
  152. package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
  153. package/dist/feature-libraries/forest-summary/codec.d.ts +8 -2
  154. package/dist/feature-libraries/forest-summary/codec.d.ts.map +1 -1
  155. package/dist/feature-libraries/forest-summary/codec.js +13 -11
  156. package/dist/feature-libraries/forest-summary/codec.js.map +1 -1
  157. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts +3 -2
  158. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  159. package/dist/feature-libraries/forest-summary/forestSummarizer.js +18 -9
  160. package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  161. package/dist/feature-libraries/forest-summary/formatCommon.d.ts +61 -0
  162. package/dist/feature-libraries/forest-summary/formatCommon.d.ts.map +1 -0
  163. package/dist/feature-libraries/forest-summary/{format.js → formatCommon.js} +9 -6
  164. package/dist/feature-libraries/forest-summary/formatCommon.js.map +1 -0
  165. package/dist/feature-libraries/forest-summary/{format.d.ts → formatV1.d.ts} +6 -14
  166. package/dist/feature-libraries/forest-summary/formatV1.d.ts.map +1 -0
  167. package/dist/feature-libraries/forest-summary/formatV1.js +11 -0
  168. package/dist/feature-libraries/forest-summary/formatV1.js.map +1 -0
  169. package/dist/feature-libraries/forest-summary/formatV2.d.ts +51 -0
  170. package/dist/feature-libraries/forest-summary/formatV2.d.ts.map +1 -0
  171. package/dist/feature-libraries/forest-summary/formatV2.js +11 -0
  172. package/dist/feature-libraries/forest-summary/formatV2.js.map +1 -0
  173. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts +7 -15
  174. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts.map +1 -1
  175. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js +11 -20
  176. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -1
  177. package/dist/feature-libraries/forest-summary/index.d.ts +1 -2
  178. package/dist/feature-libraries/forest-summary/index.d.ts.map +1 -1
  179. package/dist/feature-libraries/forest-summary/index.js +3 -5
  180. package/dist/feature-libraries/forest-summary/index.js.map +1 -1
  181. package/dist/feature-libraries/forest-summary/summaryFormatCommon.d.ts +35 -0
  182. package/dist/feature-libraries/forest-summary/summaryFormatCommon.d.ts.map +1 -0
  183. package/dist/feature-libraries/forest-summary/summaryFormatCommon.js +43 -0
  184. package/dist/feature-libraries/forest-summary/summaryFormatCommon.js.map +1 -0
  185. package/dist/feature-libraries/forest-summary/summaryFormatV1ToV2.d.ts +11 -0
  186. package/dist/feature-libraries/forest-summary/summaryFormatV1ToV2.d.ts.map +1 -0
  187. package/dist/feature-libraries/forest-summary/summaryFormatV1ToV2.js +14 -0
  188. package/dist/feature-libraries/forest-summary/summaryFormatV1ToV2.js.map +1 -0
  189. package/dist/feature-libraries/forest-summary/summaryFormatV3.d.ts +18 -0
  190. package/dist/feature-libraries/forest-summary/summaryFormatV3.d.ts.map +1 -0
  191. package/dist/feature-libraries/forest-summary/summaryFormatV3.js +21 -0
  192. package/dist/feature-libraries/forest-summary/summaryFormatV3.js.map +1 -0
  193. package/dist/feature-libraries/forest-summary/summaryTypes.d.ts +7 -37
  194. package/dist/feature-libraries/forest-summary/summaryTypes.d.ts.map +1 -1
  195. package/dist/feature-libraries/forest-summary/summaryTypes.js +23 -45
  196. package/dist/feature-libraries/forest-summary/summaryTypes.js.map +1 -1
  197. package/dist/feature-libraries/index.d.ts +5 -4
  198. package/dist/feature-libraries/index.d.ts.map +1 -1
  199. package/dist/feature-libraries/index.js +10 -12
  200. package/dist/feature-libraries/index.js.map +1 -1
  201. package/dist/feature-libraries/indexing/anchorTreeIndex.js +6 -6
  202. package/dist/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
  203. package/dist/feature-libraries/mapTreeCursor.d.ts.map +1 -1
  204. package/dist/feature-libraries/mapTreeCursor.js +0 -1
  205. package/dist/feature-libraries/mapTreeCursor.js.map +1 -1
  206. package/dist/feature-libraries/mitigatedChangeFamily.d.ts.map +1 -1
  207. package/dist/feature-libraries/mitigatedChangeFamily.js +12 -3
  208. package/dist/feature-libraries/mitigatedChangeFamily.js.map +1 -1
  209. package/dist/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
  210. package/dist/feature-libraries/modular-schema/comparison.js +13 -10
  211. package/dist/feature-libraries/modular-schema/comparison.js.map +1 -1
  212. package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts +21 -97
  213. package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
  214. package/dist/feature-libraries/modular-schema/crossFieldQueries.js +7 -4
  215. package/dist/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
  216. package/dist/feature-libraries/modular-schema/defaultRevisionReplacer.d.ts +25 -0
  217. package/dist/feature-libraries/modular-schema/defaultRevisionReplacer.d.ts.map +1 -0
  218. package/dist/feature-libraries/modular-schema/defaultRevisionReplacer.js +59 -0
  219. package/dist/feature-libraries/modular-schema/defaultRevisionReplacer.js.map +1 -0
  220. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts +52 -20
  221. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  222. package/dist/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  223. package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  224. package/dist/feature-libraries/modular-schema/genericFieldKind.js +13 -7
  225. package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  226. package/dist/feature-libraries/modular-schema/index.d.ts +7 -5
  227. package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
  228. package/dist/feature-libraries/modular-schema/index.js +7 -7
  229. package/dist/feature-libraries/modular-schema/index.js.map +1 -1
  230. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts +41 -9
  231. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -1
  232. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js +263 -336
  233. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
  234. package/dist/feature-libraries/modular-schema/modularChangeCodecV2.d.ts +7 -9
  235. package/dist/feature-libraries/modular-schema/modularChangeCodecV2.d.ts.map +1 -1
  236. package/dist/feature-libraries/modular-schema/modularChangeCodecV2.js +8 -390
  237. package/dist/feature-libraries/modular-schema/modularChangeCodecV2.js.map +1 -1
  238. package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  239. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js +24 -11
  240. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  241. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +27 -55
  242. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  243. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +622 -1433
  244. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  245. package/dist/feature-libraries/modular-schema/modularChangeFormatV1.d.ts +3 -4
  246. package/dist/feature-libraries/modular-schema/modularChangeFormatV1.d.ts.map +1 -1
  247. package/dist/feature-libraries/modular-schema/modularChangeFormatV1.js +4 -4
  248. package/dist/feature-libraries/modular-schema/modularChangeFormatV1.js.map +1 -1
  249. package/dist/feature-libraries/modular-schema/modularChangeFormatV2.d.ts +14 -48
  250. package/dist/feature-libraries/modular-schema/modularChangeFormatV2.d.ts.map +1 -1
  251. package/dist/feature-libraries/modular-schema/modularChangeFormatV2.js +10 -21
  252. package/dist/feature-libraries/modular-schema/modularChangeFormatV2.js.map +1 -1
  253. package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts +18 -48
  254. package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
  255. package/dist/feature-libraries/modular-schema/modularChangeTypes.js +3 -24
  256. package/dist/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
  257. package/dist/feature-libraries/node-identifier/mockNodeIdentifierManager.js +1 -1
  258. package/dist/feature-libraries/node-identifier/mockNodeIdentifierManager.js.map +1 -1
  259. package/dist/feature-libraries/object-forest/objectForest.js +4 -4
  260. package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
  261. package/dist/feature-libraries/optional-field/index.d.ts +2 -2
  262. package/dist/feature-libraries/optional-field/index.d.ts.map +1 -1
  263. package/dist/feature-libraries/optional-field/index.js +2 -1
  264. package/dist/feature-libraries/optional-field/index.js.map +1 -1
  265. package/dist/feature-libraries/optional-field/optionalField.d.ts +26 -5
  266. package/dist/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
  267. package/dist/feature-libraries/optional-field/optionalField.js +447 -218
  268. package/dist/feature-libraries/optional-field/optionalField.js.map +1 -1
  269. package/dist/feature-libraries/optional-field/optionalFieldChangeTypes.d.ts +33 -24
  270. package/dist/feature-libraries/optional-field/optionalFieldChangeTypes.d.ts.map +1 -1
  271. package/dist/feature-libraries/optional-field/optionalFieldChangeTypes.js.map +1 -1
  272. package/dist/feature-libraries/optional-field/optionalFieldCodecV2.d.ts +1 -1
  273. package/dist/feature-libraries/optional-field/optionalFieldCodecV2.d.ts.map +1 -1
  274. package/dist/feature-libraries/optional-field/optionalFieldCodecV2.js +28 -57
  275. package/dist/feature-libraries/optional-field/optionalFieldCodecV2.js.map +1 -1
  276. package/dist/feature-libraries/optional-field/optionalFieldCodecs.d.ts.map +1 -1
  277. package/dist/feature-libraries/optional-field/optionalFieldCodecs.js +1 -5
  278. package/dist/feature-libraries/optional-field/optionalFieldCodecs.js.map +1 -1
  279. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
  280. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js +15 -4
  281. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
  282. package/dist/feature-libraries/schema-index/codec.d.ts +7 -21
  283. package/dist/feature-libraries/schema-index/codec.d.ts.map +1 -1
  284. package/dist/feature-libraries/schema-index/codec.js +28 -70
  285. package/dist/feature-libraries/schema-index/codec.js.map +1 -1
  286. package/dist/feature-libraries/schema-index/formatV1.d.ts +1 -1
  287. package/dist/feature-libraries/schema-index/formatV2.d.ts +1 -1
  288. package/dist/feature-libraries/schema-index/index.d.ts +2 -2
  289. package/dist/feature-libraries/schema-index/index.d.ts.map +1 -1
  290. package/dist/feature-libraries/schema-index/index.js +2 -5
  291. package/dist/feature-libraries/schema-index/index.js.map +1 -1
  292. package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts +1 -9
  293. package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
  294. package/dist/feature-libraries/schema-index/schemaSummarizer.js +1 -12
  295. package/dist/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
  296. package/dist/feature-libraries/schemaChecker.d.ts.map +1 -1
  297. package/dist/feature-libraries/schemaChecker.js +11 -6
  298. package/dist/feature-libraries/schemaChecker.js.map +1 -1
  299. package/dist/feature-libraries/sequence-field/compose.d.ts +7 -6
  300. package/dist/feature-libraries/sequence-field/compose.d.ts.map +1 -1
  301. package/dist/feature-libraries/sequence-field/compose.js +264 -84
  302. package/dist/feature-libraries/sequence-field/compose.js.map +1 -1
  303. package/dist/feature-libraries/sequence-field/helperTypes.d.ts +10 -14
  304. package/dist/feature-libraries/sequence-field/helperTypes.d.ts.map +1 -1
  305. package/dist/feature-libraries/sequence-field/helperTypes.js.map +1 -1
  306. package/dist/feature-libraries/sequence-field/index.d.ts +3 -2
  307. package/dist/feature-libraries/sequence-field/index.d.ts.map +1 -1
  308. package/dist/feature-libraries/sequence-field/index.js +3 -1
  309. package/dist/feature-libraries/sequence-field/index.js.map +1 -1
  310. package/dist/feature-libraries/sequence-field/invert.d.ts +3 -3
  311. package/dist/feature-libraries/sequence-field/invert.d.ts.map +1 -1
  312. package/dist/feature-libraries/sequence-field/invert.js +169 -66
  313. package/dist/feature-libraries/sequence-field/invert.js.map +1 -1
  314. package/dist/feature-libraries/sequence-field/markQueue.d.ts +2 -2
  315. package/dist/feature-libraries/sequence-field/markQueue.d.ts.map +1 -1
  316. package/dist/feature-libraries/sequence-field/markQueue.js.map +1 -1
  317. package/dist/feature-libraries/sequence-field/moveEffectTable.d.ts +56 -4
  318. package/dist/feature-libraries/sequence-field/moveEffectTable.d.ts.map +1 -1
  319. package/dist/feature-libraries/sequence-field/moveEffectTable.js +93 -8
  320. package/dist/feature-libraries/sequence-field/moveEffectTable.js.map +1 -1
  321. package/dist/feature-libraries/sequence-field/rebase.d.ts +3 -3
  322. package/dist/feature-libraries/sequence-field/rebase.d.ts.map +1 -1
  323. package/dist/feature-libraries/sequence-field/rebase.js +127 -113
  324. package/dist/feature-libraries/sequence-field/rebase.js.map +1 -1
  325. package/dist/feature-libraries/sequence-field/relevantRemovedRoots.d.ts +9 -0
  326. package/dist/feature-libraries/sequence-field/relevantRemovedRoots.d.ts.map +1 -0
  327. package/dist/feature-libraries/sequence-field/relevantRemovedRoots.js +50 -0
  328. package/dist/feature-libraries/sequence-field/relevantRemovedRoots.js.map +1 -0
  329. package/dist/feature-libraries/sequence-field/replaceRevisions.d.ts +2 -2
  330. package/dist/feature-libraries/sequence-field/replaceRevisions.d.ts.map +1 -1
  331. package/dist/feature-libraries/sequence-field/replaceRevisions.js +49 -27
  332. package/dist/feature-libraries/sequence-field/replaceRevisions.js.map +1 -1
  333. package/dist/feature-libraries/sequence-field/sequenceFieldChangeHandler.d.ts.map +1 -1
  334. package/dist/feature-libraries/sequence-field/sequenceFieldChangeHandler.js +2 -0
  335. package/dist/feature-libraries/sequence-field/sequenceFieldChangeHandler.js.map +1 -1
  336. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts +4 -22
  337. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
  338. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js +187 -358
  339. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
  340. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts.map +1 -1
  341. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.js +62 -20
  342. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -1
  343. package/dist/feature-libraries/sequence-field/sequenceFieldEditor.d.ts +2 -2
  344. package/dist/feature-libraries/sequence-field/sequenceFieldEditor.d.ts.map +1 -1
  345. package/dist/feature-libraries/sequence-field/sequenceFieldEditor.js +10 -10
  346. package/dist/feature-libraries/sequence-field/sequenceFieldEditor.js.map +1 -1
  347. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts +2 -3
  348. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts.map +1 -1
  349. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js +115 -17
  350. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
  351. package/dist/feature-libraries/sequence-field/types.d.ts +59 -30
  352. package/dist/feature-libraries/sequence-field/types.d.ts.map +1 -1
  353. package/dist/feature-libraries/sequence-field/types.js.map +1 -1
  354. package/dist/feature-libraries/sequence-field/utils.d.ts +24 -15
  355. package/dist/feature-libraries/sequence-field/utils.d.ts.map +1 -1
  356. package/dist/feature-libraries/sequence-field/utils.js +334 -127
  357. package/dist/feature-libraries/sequence-field/utils.js.map +1 -1
  358. package/dist/feature-libraries/treeCursorUtils.js +7 -7
  359. package/dist/feature-libraries/treeCursorUtils.js.map +1 -1
  360. package/dist/feature-libraries/treeTextCursor.js +2 -2
  361. package/dist/feature-libraries/treeTextCursor.js.map +1 -1
  362. package/dist/feature-libraries/valueUtilities.d.ts.map +1 -1
  363. package/dist/feature-libraries/valueUtilities.js +16 -8
  364. package/dist/feature-libraries/valueUtilities.js.map +1 -1
  365. package/dist/index.d.ts +3 -3
  366. package/dist/index.d.ts.map +1 -1
  367. package/dist/index.js +3 -1
  368. package/dist/index.js.map +1 -1
  369. package/dist/packageVersion.d.ts +1 -1
  370. package/dist/packageVersion.d.ts.map +1 -1
  371. package/dist/packageVersion.js +1 -1
  372. package/dist/packageVersion.js.map +1 -1
  373. package/dist/shared-tree/independentView.d.ts.map +1 -1
  374. package/dist/shared-tree/independentView.js +1 -1
  375. package/dist/shared-tree/independentView.js.map +1 -1
  376. package/dist/shared-tree/index.d.ts +1 -1
  377. package/dist/shared-tree/index.d.ts.map +1 -1
  378. package/dist/shared-tree/index.js.map +1 -1
  379. package/dist/shared-tree/schematizeTree.d.ts +4 -4
  380. package/dist/shared-tree/schematizeTree.d.ts.map +1 -1
  381. package/dist/shared-tree/schematizeTree.js +1 -2
  382. package/dist/shared-tree/schematizeTree.js.map +1 -1
  383. package/dist/shared-tree/schematizingTreeView.d.ts +9 -5
  384. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  385. package/dist/shared-tree/schematizingTreeView.js +56 -41
  386. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  387. package/dist/shared-tree/sharedTree.d.ts +3 -9
  388. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  389. package/dist/shared-tree/sharedTree.js +57 -50
  390. package/dist/shared-tree/sharedTree.js.map +1 -1
  391. package/dist/shared-tree/sharedTreeChangeCodecs.d.ts +1 -1
  392. package/dist/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  393. package/dist/shared-tree/sharedTreeChangeCodecs.js +11 -11
  394. package/dist/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  395. package/dist/shared-tree/sharedTreeChangeEnricher.d.ts.map +1 -1
  396. package/dist/shared-tree/sharedTreeChangeEnricher.js +5 -3
  397. package/dist/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
  398. package/dist/shared-tree/sharedTreeChangeFamily.d.ts +7 -6
  399. package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  400. package/dist/shared-tree/sharedTreeChangeFamily.js +23 -24
  401. package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  402. package/dist/shared-tree/sharedTreeEditBuilder.d.ts +6 -16
  403. package/dist/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
  404. package/dist/shared-tree/sharedTreeEditBuilder.js +7 -14
  405. package/dist/shared-tree/sharedTreeEditBuilder.js.map +1 -1
  406. package/dist/shared-tree/treeAlpha.d.ts +35 -29
  407. package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
  408. package/dist/shared-tree/treeAlpha.js +21 -23
  409. package/dist/shared-tree/treeAlpha.js.map +1 -1
  410. package/dist/shared-tree/treeCheckout.d.ts +17 -12
  411. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  412. package/dist/shared-tree/treeCheckout.js +85 -66
  413. package/dist/shared-tree/treeCheckout.js.map +1 -1
  414. package/dist/shared-tree-core/branch.d.ts +5 -4
  415. package/dist/shared-tree-core/branch.d.ts.map +1 -1
  416. package/dist/shared-tree-core/branch.js +7 -6
  417. package/dist/shared-tree-core/branch.js.map +1 -1
  418. package/dist/shared-tree-core/branchCommitEnricher.d.ts.map +1 -1
  419. package/dist/shared-tree-core/branchCommitEnricher.js +1 -1
  420. package/dist/shared-tree-core/branchCommitEnricher.js.map +1 -1
  421. package/dist/shared-tree-core/editManager.d.ts +2 -2
  422. package/dist/shared-tree-core/editManager.d.ts.map +1 -1
  423. package/dist/shared-tree-core/editManager.js +10 -10
  424. package/dist/shared-tree-core/editManager.js.map +1 -1
  425. package/dist/shared-tree-core/editManagerCodecs.d.ts +0 -4
  426. package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  427. package/dist/shared-tree-core/editManagerCodecs.js +13 -16
  428. package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
  429. package/dist/shared-tree-core/editManagerCodecsVSharedBranches.js +1 -1
  430. package/dist/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
  431. package/dist/shared-tree-core/editManagerFormatCommons.d.ts +9 -44
  432. package/dist/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
  433. package/dist/shared-tree-core/editManagerFormatCommons.js +8 -8
  434. package/dist/shared-tree-core/editManagerFormatCommons.js.map +1 -1
  435. package/dist/shared-tree-core/editManagerFormatV1toV4.d.ts +2 -2
  436. package/dist/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -1
  437. package/dist/shared-tree-core/editManagerFormatV1toV4.js +1 -1
  438. package/dist/shared-tree-core/editManagerFormatV1toV4.js.map +1 -1
  439. package/dist/shared-tree-core/editManagerFormatVSharedBranches.d.ts +1 -1
  440. package/dist/shared-tree-core/editManagerSummarizer.js +3 -3
  441. package/dist/shared-tree-core/editManagerSummarizer.js.map +1 -1
  442. package/dist/shared-tree-core/index.d.ts +3 -2
  443. package/dist/shared-tree-core/index.d.ts.map +1 -1
  444. package/dist/shared-tree-core/index.js +2 -3
  445. package/dist/shared-tree-core/index.js.map +1 -1
  446. package/dist/shared-tree-core/messageCodecV1ToV4.d.ts +1 -1
  447. package/dist/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
  448. package/dist/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
  449. package/dist/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -1
  450. package/dist/shared-tree-core/messageCodecVSharedBranches.js +2 -1
  451. package/dist/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
  452. package/dist/shared-tree-core/messageCodecs.d.ts +0 -4
  453. package/dist/shared-tree-core/messageCodecs.d.ts.map +1 -1
  454. package/dist/shared-tree-core/messageCodecs.js +15 -19
  455. package/dist/shared-tree-core/messageCodecs.js.map +1 -1
  456. package/dist/shared-tree-core/messageFormat.d.ts +10 -50
  457. package/dist/shared-tree-core/messageFormat.d.ts.map +1 -1
  458. package/dist/shared-tree-core/messageFormat.js +9 -8
  459. package/dist/shared-tree-core/messageFormat.js.map +1 -1
  460. package/dist/shared-tree-core/messageFormatV1ToV4.d.ts +2 -2
  461. package/dist/shared-tree-core/messageFormatV1ToV4.d.ts.map +1 -1
  462. package/dist/shared-tree-core/messageFormatV1ToV4.js +1 -1
  463. package/dist/shared-tree-core/messageFormatV1ToV4.js.map +1 -1
  464. package/dist/shared-tree-core/messageFormatVSharedBranches.d.ts +1 -1
  465. package/dist/shared-tree-core/sequenceIdUtils.d.ts.map +1 -1
  466. package/dist/shared-tree-core/sequenceIdUtils.js +4 -4
  467. package/dist/shared-tree-core/sequenceIdUtils.js.map +1 -1
  468. package/dist/shared-tree-core/sharedTreeCore.d.ts +0 -1
  469. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  470. package/dist/shared-tree-core/sharedTreeCore.js +13 -9
  471. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  472. package/dist/shared-tree-core/transaction.d.ts +25 -8
  473. package/dist/shared-tree-core/transaction.d.ts.map +1 -1
  474. package/dist/shared-tree-core/transaction.js +65 -30
  475. package/dist/shared-tree-core/transaction.js.map +1 -1
  476. package/dist/shared-tree-core/transactionEnricher.d.ts +2 -2
  477. package/dist/shared-tree-core/transactionEnricher.d.ts.map +1 -1
  478. package/dist/shared-tree-core/transactionEnricher.js +3 -3
  479. package/dist/shared-tree-core/transactionEnricher.js.map +1 -1
  480. package/dist/shared-tree-core/versionedSummarizer.d.ts +6 -1
  481. package/dist/shared-tree-core/versionedSummarizer.d.ts.map +1 -1
  482. package/dist/shared-tree-core/versionedSummarizer.js +4 -3
  483. package/dist/shared-tree-core/versionedSummarizer.js.map +1 -1
  484. package/dist/simple-tree/api/configuration.js +1 -1
  485. package/dist/simple-tree/api/configuration.js.map +1 -1
  486. package/dist/simple-tree/api/customTree.d.ts.map +1 -1
  487. package/dist/simple-tree/api/customTree.js +13 -9
  488. package/dist/simple-tree/api/customTree.js.map +1 -1
  489. package/dist/simple-tree/api/discrepancies.d.ts.map +1 -1
  490. package/dist/simple-tree/api/discrepancies.js +21 -17
  491. package/dist/simple-tree/api/discrepancies.js.map +1 -1
  492. package/dist/simple-tree/api/eraseSchemaDetails.d.ts +89 -0
  493. package/dist/simple-tree/api/eraseSchemaDetails.d.ts.map +1 -0
  494. package/dist/simple-tree/api/eraseSchemaDetails.js +97 -0
  495. package/dist/simple-tree/api/eraseSchemaDetails.js.map +1 -0
  496. package/dist/simple-tree/api/index.d.ts +2 -1
  497. package/dist/simple-tree/api/index.d.ts.map +1 -1
  498. package/dist/simple-tree/api/index.js +5 -1
  499. package/dist/simple-tree/api/index.js.map +1 -1
  500. package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
  501. package/dist/simple-tree/api/schemaFactory.js +12 -8
  502. package/dist/simple-tree/api/schemaFactory.js.map +1 -1
  503. package/dist/simple-tree/api/schemaFromSimple.js +18 -9
  504. package/dist/simple-tree/api/schemaFromSimple.js.map +1 -1
  505. package/dist/simple-tree/api/simpleSchemaCodec.js +10 -5
  506. package/dist/simple-tree/api/simpleSchemaCodec.js.map +1 -1
  507. package/dist/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -1
  508. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js +15 -11
  509. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  510. package/dist/simple-tree/api/simpleTreeIndex.js +10 -10
  511. package/dist/simple-tree/api/simpleTreeIndex.js.map +1 -1
  512. package/dist/simple-tree/api/storedSchema.d.ts +1 -1
  513. package/dist/simple-tree/api/storedSchema.d.ts.map +1 -1
  514. package/dist/simple-tree/api/storedSchema.js +3 -5
  515. package/dist/simple-tree/api/storedSchema.js.map +1 -1
  516. package/dist/simple-tree/api/transactionTypes.d.ts +17 -4
  517. package/dist/simple-tree/api/transactionTypes.d.ts.map +1 -1
  518. package/dist/simple-tree/api/transactionTypes.js.map +1 -1
  519. package/dist/simple-tree/api/tree.d.ts +15 -2
  520. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  521. package/dist/simple-tree/api/tree.js.map +1 -1
  522. package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  523. package/dist/simple-tree/api/treeNodeApi.js +21 -13
  524. package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
  525. package/dist/simple-tree/api/verboseTree.d.ts.map +1 -1
  526. package/dist/simple-tree/api/verboseTree.js +14 -9
  527. package/dist/simple-tree/api/verboseTree.js.map +1 -1
  528. package/dist/simple-tree/core/treeNode.d.ts.map +1 -1
  529. package/dist/simple-tree/core/treeNode.js +1 -0
  530. package/dist/simple-tree/core/treeNode.js.map +1 -1
  531. package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  532. package/dist/simple-tree/core/treeNodeKernel.js +6 -3
  533. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
  534. package/dist/simple-tree/core/unhydratedFlexTree.d.ts +15 -15
  535. package/dist/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  536. package/dist/simple-tree/core/unhydratedFlexTree.js +28 -74
  537. package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  538. package/dist/simple-tree/createContext.d.ts.map +1 -1
  539. package/dist/simple-tree/createContext.js +1 -1
  540. package/dist/simple-tree/createContext.js.map +1 -1
  541. package/dist/simple-tree/fieldSchema.d.ts +4 -4
  542. package/dist/simple-tree/fieldSchema.d.ts.map +1 -1
  543. package/dist/simple-tree/fieldSchema.js.map +1 -1
  544. package/dist/simple-tree/getTreeNodeForField.d.ts.map +1 -1
  545. package/dist/simple-tree/getTreeNodeForField.js +2 -1
  546. package/dist/simple-tree/getTreeNodeForField.js.map +1 -1
  547. package/dist/simple-tree/index.d.ts +3 -3
  548. package/dist/simple-tree/index.d.ts.map +1 -1
  549. package/dist/simple-tree/index.js +5 -3
  550. package/dist/simple-tree/index.js.map +1 -1
  551. package/dist/simple-tree/leafNodeSchema.js +9 -6
  552. package/dist/simple-tree/leafNodeSchema.js.map +1 -1
  553. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  554. package/dist/simple-tree/node-kinds/array/arrayNode.js +18 -20
  555. package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  556. package/dist/simple-tree/node-kinds/common.d.ts.map +1 -1
  557. package/dist/simple-tree/node-kinds/common.js +1 -1
  558. package/dist/simple-tree/node-kinds/common.js.map +1 -1
  559. package/dist/simple-tree/node-kinds/map/mapNode.js +2 -2
  560. package/dist/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  561. package/dist/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  562. package/dist/simple-tree/node-kinds/object/objectNode.js +21 -22
  563. package/dist/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  564. package/dist/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
  565. package/dist/simple-tree/node-kinds/record/recordNode.js +4 -7
  566. package/dist/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  567. package/dist/simple-tree/prepareForInsertion.d.ts +47 -54
  568. package/dist/simple-tree/prepareForInsertion.d.ts.map +1 -1
  569. package/dist/simple-tree/prepareForInsertion.js +125 -183
  570. package/dist/simple-tree/prepareForInsertion.js.map +1 -1
  571. package/dist/simple-tree/toStoredSchema.d.ts.map +1 -1
  572. package/dist/simple-tree/toStoredSchema.js +12 -8
  573. package/dist/simple-tree/toStoredSchema.js.map +1 -1
  574. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.d.ts +4 -13
  575. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
  576. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js +11 -29
  577. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
  578. package/dist/tableSchema.d.ts +3 -14
  579. package/dist/tableSchema.d.ts.map +1 -1
  580. package/dist/tableSchema.js +2 -2
  581. package/dist/tableSchema.js.map +1 -1
  582. package/dist/treeFactory.d.ts.map +1 -1
  583. package/dist/treeFactory.js +2 -12
  584. package/dist/treeFactory.js.map +1 -1
  585. package/dist/util/bTreeUtils.js +1 -1
  586. package/dist/util/bTreeUtils.js.map +1 -1
  587. package/dist/util/brand.d.ts +49 -0
  588. package/dist/util/brand.d.ts.map +1 -1
  589. package/dist/util/brand.js +47 -1
  590. package/dist/util/brand.js.map +1 -1
  591. package/dist/util/breakable.js +7 -9
  592. package/dist/util/breakable.js.map +1 -1
  593. package/dist/util/idAllocator.d.ts.map +1 -1
  594. package/dist/util/idAllocator.js +1 -2
  595. package/dist/util/idAllocator.js.map +1 -1
  596. package/dist/util/index.d.ts +2 -2
  597. package/dist/util/index.d.ts.map +1 -1
  598. package/dist/util/index.js +4 -3
  599. package/dist/util/index.js.map +1 -1
  600. package/dist/util/nestedMap.d.ts.map +1 -1
  601. package/dist/util/nestedMap.js +1 -1
  602. package/dist/util/nestedMap.js.map +1 -1
  603. package/dist/util/rangeMap.d.ts +12 -24
  604. package/dist/util/rangeMap.d.ts.map +1 -1
  605. package/dist/util/rangeMap.js +6 -46
  606. package/dist/util/rangeMap.js.map +1 -1
  607. package/dist/util/utils.d.ts.map +1 -1
  608. package/dist/util/utils.js +16 -15
  609. package/dist/util/utils.js.map +1 -1
  610. package/docs/main/sequence-field/move-composition.md +46 -0
  611. package/eslint.config.mts +83 -0
  612. package/lib/alpha.d.ts +7 -0
  613. package/lib/codec/codec.d.ts +63 -20
  614. package/lib/codec/codec.d.ts.map +1 -1
  615. package/lib/codec/codec.js +44 -18
  616. package/lib/codec/codec.js.map +1 -1
  617. package/lib/codec/index.d.ts +2 -2
  618. package/lib/codec/index.d.ts.map +1 -1
  619. package/lib/codec/index.js +1 -1
  620. package/lib/codec/index.js.map +1 -1
  621. package/lib/codec/versioned/codec.d.ts +80 -22
  622. package/lib/codec/versioned/codec.d.ts.map +1 -1
  623. package/lib/codec/versioned/codec.js +138 -15
  624. package/lib/codec/versioned/codec.js.map +1 -1
  625. package/lib/codec/versioned/index.d.ts +1 -1
  626. package/lib/codec/versioned/index.d.ts.map +1 -1
  627. package/lib/codec/versioned/index.js +1 -1
  628. package/lib/codec/versioned/index.js.map +1 -1
  629. package/lib/core/change-family/changeFamily.d.ts +1 -4
  630. package/lib/core/change-family/changeFamily.d.ts.map +1 -1
  631. package/lib/core/change-family/changeFamily.js.map +1 -1
  632. package/lib/core/change-family/index.d.ts +1 -1
  633. package/lib/core/change-family/index.d.ts.map +1 -1
  634. package/lib/core/change-family/index.js.map +1 -1
  635. package/lib/core/index.d.ts +3 -3
  636. package/lib/core/index.d.ts.map +1 -1
  637. package/lib/core/index.js +2 -2
  638. package/lib/core/index.js.map +1 -1
  639. package/lib/core/rebase/changeRebaser.d.ts +37 -8
  640. package/lib/core/rebase/changeRebaser.d.ts.map +1 -1
  641. package/lib/core/rebase/changeRebaser.js.map +1 -1
  642. package/lib/core/rebase/index.d.ts +2 -2
  643. package/lib/core/rebase/index.d.ts.map +1 -1
  644. package/lib/core/rebase/index.js +1 -1
  645. package/lib/core/rebase/index.js.map +1 -1
  646. package/lib/core/rebase/types.d.ts +27 -5
  647. package/lib/core/rebase/types.d.ts.map +1 -1
  648. package/lib/core/rebase/types.js +0 -13
  649. package/lib/core/rebase/types.js.map +1 -1
  650. package/lib/core/rebase/utils.d.ts.map +1 -1
  651. package/lib/core/rebase/utils.js +10 -28
  652. package/lib/core/rebase/utils.js.map +1 -1
  653. package/lib/core/schema-stored/schema.d.ts +4 -7
  654. package/lib/core/schema-stored/schema.d.ts.map +1 -1
  655. package/lib/core/schema-stored/schema.js +6 -6
  656. package/lib/core/schema-stored/schema.js.map +1 -1
  657. package/lib/core/tree/anchorSet.d.ts.map +1 -1
  658. package/lib/core/tree/anchorSet.js +3 -4
  659. package/lib/core/tree/anchorSet.js.map +1 -1
  660. package/lib/core/tree/detachedFieldIndex.d.ts +1 -8
  661. package/lib/core/tree/detachedFieldIndex.d.ts.map +1 -1
  662. package/lib/core/tree/detachedFieldIndex.js +14 -67
  663. package/lib/core/tree/detachedFieldIndex.js.map +1 -1
  664. package/lib/core/tree/detachedFieldIndexCodecCommon.d.ts +18 -10
  665. package/lib/core/tree/detachedFieldIndexCodecCommon.d.ts.map +1 -1
  666. package/lib/core/tree/detachedFieldIndexCodecCommon.js +4 -4
  667. package/lib/core/tree/detachedFieldIndexCodecCommon.js.map +1 -1
  668. package/lib/core/tree/detachedFieldIndexCodecV1.d.ts +2 -3
  669. package/lib/core/tree/detachedFieldIndexCodecV1.d.ts.map +1 -1
  670. package/lib/core/tree/detachedFieldIndexCodecV1.js +4 -5
  671. package/lib/core/tree/detachedFieldIndexCodecV1.js.map +1 -1
  672. package/lib/core/tree/detachedFieldIndexCodecV2.d.ts +2 -3
  673. package/lib/core/tree/detachedFieldIndexCodecV2.d.ts.map +1 -1
  674. package/lib/core/tree/detachedFieldIndexCodecV2.js +4 -6
  675. package/lib/core/tree/detachedFieldIndexCodecV2.js.map +1 -1
  676. package/lib/core/tree/detachedFieldIndexCodecs.d.ts +5 -6
  677. package/lib/core/tree/detachedFieldIndexCodecs.d.ts.map +1 -1
  678. package/lib/core/tree/detachedFieldIndexCodecs.js +12 -39
  679. package/lib/core/tree/detachedFieldIndexCodecs.js.map +1 -1
  680. package/lib/core/tree/detachedFieldIndexFormatCommon.d.ts +4 -4
  681. package/lib/core/tree/detachedFieldIndexFormatCommon.d.ts.map +1 -1
  682. package/lib/core/tree/detachedFieldIndexFormatCommon.js +3 -3
  683. package/lib/core/tree/detachedFieldIndexFormatCommon.js.map +1 -1
  684. package/lib/core/tree/index.d.ts +2 -2
  685. package/lib/core/tree/index.d.ts.map +1 -1
  686. package/lib/core/tree/index.js +2 -2
  687. package/lib/core/tree/index.js.map +1 -1
  688. package/lib/core/tree/mapTree.js +1 -1
  689. package/lib/core/tree/mapTree.js.map +1 -1
  690. package/lib/core/tree/pathTree.d.ts +3 -11
  691. package/lib/core/tree/pathTree.d.ts.map +1 -1
  692. package/lib/core/tree/pathTree.js +1 -12
  693. package/lib/core/tree/pathTree.js.map +1 -1
  694. package/lib/core/tree/sparseTree.d.ts.map +1 -1
  695. package/lib/core/tree/sparseTree.js +1 -0
  696. package/lib/core/tree/sparseTree.js.map +1 -1
  697. package/lib/core/tree/treeTextFormat.d.ts.map +1 -1
  698. package/lib/core/tree/treeTextFormat.js +5 -9
  699. package/lib/core/tree/treeTextFormat.js.map +1 -1
  700. package/lib/feature-libraries/changeAtomIdBTree.d.ts +10 -0
  701. package/lib/feature-libraries/changeAtomIdBTree.d.ts.map +1 -0
  702. package/lib/feature-libraries/changeAtomIdBTree.js +11 -0
  703. package/lib/feature-libraries/changeAtomIdBTree.js.map +1 -0
  704. package/lib/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
  705. package/lib/feature-libraries/chunked-forest/basicChunk.js +2 -9
  706. package/lib/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
  707. package/lib/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  708. package/lib/feature-libraries/chunked-forest/chunkTree.js +1 -4
  709. package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  710. package/lib/feature-libraries/chunked-forest/chunkedForest.js +6 -6
  711. package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  712. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  713. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js +7 -4
  714. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  715. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  716. package/lib/feature-libraries/chunked-forest/codec/codecs.js +20 -12
  717. package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  718. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +3 -3
  719. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  720. package/lib/feature-libraries/chunked-forest/codec/format.d.ts +5 -5
  721. package/lib/feature-libraries/chunked-forest/codec/format.d.ts.map +1 -1
  722. package/lib/feature-libraries/chunked-forest/codec/format.js +5 -5
  723. package/lib/feature-libraries/chunked-forest/codec/format.js.map +1 -1
  724. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +9 -5
  725. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
  726. package/lib/feature-libraries/chunked-forest/uniformChunk.js +1 -1
  727. package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  728. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts +54 -93
  729. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  730. package/lib/feature-libraries/default-schema/defaultEditBuilder.js +82 -243
  731. package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  732. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts +1 -1
  733. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  734. package/lib/feature-libraries/default-schema/defaultFieldKinds.js +6 -5
  735. package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  736. package/lib/feature-libraries/default-schema/index.d.ts +1 -2
  737. package/lib/feature-libraries/default-schema/index.d.ts.map +1 -1
  738. package/lib/feature-libraries/default-schema/index.js +1 -2
  739. package/lib/feature-libraries/default-schema/index.js.map +1 -1
  740. package/lib/feature-libraries/default-schema/mappedEditBuilder.d.ts +8 -7
  741. package/lib/feature-libraries/default-schema/mappedEditBuilder.d.ts.map +1 -1
  742. package/lib/feature-libraries/default-schema/mappedEditBuilder.js +6 -15
  743. package/lib/feature-libraries/default-schema/mappedEditBuilder.js.map +1 -1
  744. package/lib/feature-libraries/deltaUtils.d.ts +0 -1
  745. package/lib/feature-libraries/deltaUtils.d.ts.map +1 -1
  746. package/lib/feature-libraries/deltaUtils.js +1 -5
  747. package/lib/feature-libraries/deltaUtils.js.map +1 -1
  748. package/lib/feature-libraries/flex-tree/context.d.ts +0 -9
  749. package/lib/feature-libraries/flex-tree/context.d.ts.map +1 -1
  750. package/lib/feature-libraries/flex-tree/context.js +0 -6
  751. package/lib/feature-libraries/flex-tree/context.js.map +1 -1
  752. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts +6 -6
  753. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  754. package/lib/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  755. package/lib/feature-libraries/flex-tree/lazyField.d.ts +7 -8
  756. package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  757. package/lib/feature-libraries/flex-tree/lazyField.js +17 -48
  758. package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
  759. package/lib/feature-libraries/forest-summary/codec.d.ts +8 -2
  760. package/lib/feature-libraries/forest-summary/codec.d.ts.map +1 -1
  761. package/lib/feature-libraries/forest-summary/codec.js +12 -11
  762. package/lib/feature-libraries/forest-summary/codec.js.map +1 -1
  763. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts +3 -2
  764. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  765. package/lib/feature-libraries/forest-summary/forestSummarizer.js +19 -10
  766. package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  767. package/lib/feature-libraries/forest-summary/formatCommon.d.ts +61 -0
  768. package/lib/feature-libraries/forest-summary/formatCommon.d.ts.map +1 -0
  769. package/lib/feature-libraries/forest-summary/{format.js → formatCommon.js} +8 -6
  770. package/lib/feature-libraries/forest-summary/formatCommon.js.map +1 -0
  771. package/lib/feature-libraries/forest-summary/{format.d.ts → formatV1.d.ts} +6 -14
  772. package/lib/feature-libraries/forest-summary/formatV1.d.ts.map +1 -0
  773. package/lib/feature-libraries/forest-summary/formatV1.js +8 -0
  774. package/lib/feature-libraries/forest-summary/formatV1.js.map +1 -0
  775. package/lib/feature-libraries/forest-summary/formatV2.d.ts +51 -0
  776. package/lib/feature-libraries/forest-summary/formatV2.d.ts.map +1 -0
  777. package/lib/feature-libraries/forest-summary/formatV2.js +8 -0
  778. package/lib/feature-libraries/forest-summary/formatV2.js.map +1 -0
  779. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts +7 -15
  780. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts.map +1 -1
  781. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js +11 -20
  782. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -1
  783. package/lib/feature-libraries/forest-summary/index.d.ts +1 -2
  784. package/lib/feature-libraries/forest-summary/index.d.ts.map +1 -1
  785. package/lib/feature-libraries/forest-summary/index.js +1 -2
  786. package/lib/feature-libraries/forest-summary/index.js.map +1 -1
  787. package/lib/feature-libraries/forest-summary/summaryFormatCommon.d.ts +35 -0
  788. package/lib/feature-libraries/forest-summary/summaryFormatCommon.d.ts.map +1 -0
  789. package/lib/feature-libraries/forest-summary/summaryFormatCommon.js +40 -0
  790. package/lib/feature-libraries/forest-summary/summaryFormatCommon.js.map +1 -0
  791. package/lib/feature-libraries/forest-summary/summaryFormatV1ToV2.d.ts +11 -0
  792. package/lib/feature-libraries/forest-summary/summaryFormatV1ToV2.d.ts.map +1 -0
  793. package/lib/feature-libraries/forest-summary/summaryFormatV1ToV2.js +11 -0
  794. package/lib/feature-libraries/forest-summary/summaryFormatV1ToV2.js.map +1 -0
  795. package/lib/feature-libraries/forest-summary/summaryFormatV3.d.ts +18 -0
  796. package/lib/feature-libraries/forest-summary/summaryFormatV3.d.ts.map +1 -0
  797. package/lib/feature-libraries/forest-summary/summaryFormatV3.js +18 -0
  798. package/lib/feature-libraries/forest-summary/summaryFormatV3.js.map +1 -0
  799. package/lib/feature-libraries/forest-summary/summaryTypes.d.ts +7 -37
  800. package/lib/feature-libraries/forest-summary/summaryTypes.d.ts.map +1 -1
  801. package/lib/feature-libraries/forest-summary/summaryTypes.js +20 -43
  802. package/lib/feature-libraries/forest-summary/summaryTypes.js.map +1 -1
  803. package/lib/feature-libraries/index.d.ts +5 -4
  804. package/lib/feature-libraries/index.d.ts.map +1 -1
  805. package/lib/feature-libraries/index.js +5 -4
  806. package/lib/feature-libraries/index.js.map +1 -1
  807. package/lib/feature-libraries/indexing/anchorTreeIndex.js +6 -6
  808. package/lib/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
  809. package/lib/feature-libraries/mapTreeCursor.d.ts.map +1 -1
  810. package/lib/feature-libraries/mapTreeCursor.js +1 -2
  811. package/lib/feature-libraries/mapTreeCursor.js.map +1 -1
  812. package/lib/feature-libraries/mitigatedChangeFamily.d.ts.map +1 -1
  813. package/lib/feature-libraries/mitigatedChangeFamily.js +12 -3
  814. package/lib/feature-libraries/mitigatedChangeFamily.js.map +1 -1
  815. package/lib/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
  816. package/lib/feature-libraries/modular-schema/comparison.js +13 -10
  817. package/lib/feature-libraries/modular-schema/comparison.js.map +1 -1
  818. package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts +21 -97
  819. package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
  820. package/lib/feature-libraries/modular-schema/crossFieldQueries.js +5 -3
  821. package/lib/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
  822. package/lib/feature-libraries/modular-schema/defaultRevisionReplacer.d.ts +25 -0
  823. package/lib/feature-libraries/modular-schema/defaultRevisionReplacer.d.ts.map +1 -0
  824. package/lib/feature-libraries/modular-schema/defaultRevisionReplacer.js +55 -0
  825. package/lib/feature-libraries/modular-schema/defaultRevisionReplacer.js.map +1 -0
  826. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts +52 -20
  827. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  828. package/lib/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  829. package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  830. package/lib/feature-libraries/modular-schema/genericFieldKind.js +14 -8
  831. package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  832. package/lib/feature-libraries/modular-schema/index.d.ts +7 -5
  833. package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
  834. package/lib/feature-libraries/modular-schema/index.js +5 -4
  835. package/lib/feature-libraries/modular-schema/index.js.map +1 -1
  836. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts +41 -9
  837. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -1
  838. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js +248 -334
  839. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
  840. package/lib/feature-libraries/modular-schema/modularChangeCodecV2.d.ts +7 -9
  841. package/lib/feature-libraries/modular-schema/modularChangeCodecV2.d.ts.map +1 -1
  842. package/lib/feature-libraries/modular-schema/modularChangeCodecV2.js +10 -392
  843. package/lib/feature-libraries/modular-schema/modularChangeCodecV2.js.map +1 -1
  844. package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  845. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js +24 -11
  846. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  847. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +27 -55
  848. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  849. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +549 -1352
  850. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  851. package/lib/feature-libraries/modular-schema/modularChangeFormatV1.d.ts +3 -4
  852. package/lib/feature-libraries/modular-schema/modularChangeFormatV1.d.ts.map +1 -1
  853. package/lib/feature-libraries/modular-schema/modularChangeFormatV1.js +2 -2
  854. package/lib/feature-libraries/modular-schema/modularChangeFormatV1.js.map +1 -1
  855. package/lib/feature-libraries/modular-schema/modularChangeFormatV2.d.ts +14 -48
  856. package/lib/feature-libraries/modular-schema/modularChangeFormatV2.d.ts.map +1 -1
  857. package/lib/feature-libraries/modular-schema/modularChangeFormatV2.js +10 -21
  858. package/lib/feature-libraries/modular-schema/modularChangeFormatV2.js.map +1 -1
  859. package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts +18 -48
  860. package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
  861. package/lib/feature-libraries/modular-schema/modularChangeTypes.js +2 -20
  862. package/lib/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
  863. package/lib/feature-libraries/node-identifier/mockNodeIdentifierManager.js +1 -1
  864. package/lib/feature-libraries/node-identifier/mockNodeIdentifierManager.js.map +1 -1
  865. package/lib/feature-libraries/object-forest/objectForest.js +4 -4
  866. package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
  867. package/lib/feature-libraries/optional-field/index.d.ts +2 -2
  868. package/lib/feature-libraries/optional-field/index.d.ts.map +1 -1
  869. package/lib/feature-libraries/optional-field/index.js +1 -1
  870. package/lib/feature-libraries/optional-field/index.js.map +1 -1
  871. package/lib/feature-libraries/optional-field/optionalField.d.ts +26 -5
  872. package/lib/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
  873. package/lib/feature-libraries/optional-field/optionalField.js +445 -218
  874. package/lib/feature-libraries/optional-field/optionalField.js.map +1 -1
  875. package/lib/feature-libraries/optional-field/optionalFieldChangeTypes.d.ts +33 -24
  876. package/lib/feature-libraries/optional-field/optionalFieldChangeTypes.d.ts.map +1 -1
  877. package/lib/feature-libraries/optional-field/optionalFieldChangeTypes.js.map +1 -1
  878. package/lib/feature-libraries/optional-field/optionalFieldCodecV2.d.ts +1 -1
  879. package/lib/feature-libraries/optional-field/optionalFieldCodecV2.d.ts.map +1 -1
  880. package/lib/feature-libraries/optional-field/optionalFieldCodecV2.js +26 -55
  881. package/lib/feature-libraries/optional-field/optionalFieldCodecV2.js.map +1 -1
  882. package/lib/feature-libraries/optional-field/optionalFieldCodecs.d.ts.map +1 -1
  883. package/lib/feature-libraries/optional-field/optionalFieldCodecs.js +1 -5
  884. package/lib/feature-libraries/optional-field/optionalFieldCodecs.js.map +1 -1
  885. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
  886. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js +16 -5
  887. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
  888. package/lib/feature-libraries/schema-index/codec.d.ts +7 -21
  889. package/lib/feature-libraries/schema-index/codec.d.ts.map +1 -1
  890. package/lib/feature-libraries/schema-index/codec.js +29 -67
  891. package/lib/feature-libraries/schema-index/codec.js.map +1 -1
  892. package/lib/feature-libraries/schema-index/formatV1.d.ts +1 -1
  893. package/lib/feature-libraries/schema-index/formatV2.d.ts +1 -1
  894. package/lib/feature-libraries/schema-index/index.d.ts +2 -2
  895. package/lib/feature-libraries/schema-index/index.d.ts.map +1 -1
  896. package/lib/feature-libraries/schema-index/index.js +2 -2
  897. package/lib/feature-libraries/schema-index/index.js.map +1 -1
  898. package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts +1 -9
  899. package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
  900. package/lib/feature-libraries/schema-index/schemaSummarizer.js +0 -10
  901. package/lib/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
  902. package/lib/feature-libraries/schemaChecker.d.ts.map +1 -1
  903. package/lib/feature-libraries/schemaChecker.js +11 -6
  904. package/lib/feature-libraries/schemaChecker.js.map +1 -1
  905. package/lib/feature-libraries/sequence-field/compose.d.ts +7 -6
  906. package/lib/feature-libraries/sequence-field/compose.d.ts.map +1 -1
  907. package/lib/feature-libraries/sequence-field/compose.js +266 -86
  908. package/lib/feature-libraries/sequence-field/compose.js.map +1 -1
  909. package/lib/feature-libraries/sequence-field/helperTypes.d.ts +10 -14
  910. package/lib/feature-libraries/sequence-field/helperTypes.d.ts.map +1 -1
  911. package/lib/feature-libraries/sequence-field/helperTypes.js.map +1 -1
  912. package/lib/feature-libraries/sequence-field/index.d.ts +3 -2
  913. package/lib/feature-libraries/sequence-field/index.d.ts.map +1 -1
  914. package/lib/feature-libraries/sequence-field/index.js +1 -0
  915. package/lib/feature-libraries/sequence-field/index.js.map +1 -1
  916. package/lib/feature-libraries/sequence-field/invert.d.ts +3 -3
  917. package/lib/feature-libraries/sequence-field/invert.d.ts.map +1 -1
  918. package/lib/feature-libraries/sequence-field/invert.js +171 -68
  919. package/lib/feature-libraries/sequence-field/invert.js.map +1 -1
  920. package/lib/feature-libraries/sequence-field/markQueue.d.ts +2 -2
  921. package/lib/feature-libraries/sequence-field/markQueue.d.ts.map +1 -1
  922. package/lib/feature-libraries/sequence-field/markQueue.js.map +1 -1
  923. package/lib/feature-libraries/sequence-field/moveEffectTable.d.ts +56 -4
  924. package/lib/feature-libraries/sequence-field/moveEffectTable.d.ts.map +1 -1
  925. package/lib/feature-libraries/sequence-field/moveEffectTable.js +87 -7
  926. package/lib/feature-libraries/sequence-field/moveEffectTable.js.map +1 -1
  927. package/lib/feature-libraries/sequence-field/rebase.d.ts +3 -3
  928. package/lib/feature-libraries/sequence-field/rebase.d.ts.map +1 -1
  929. package/lib/feature-libraries/sequence-field/rebase.js +129 -115
  930. package/lib/feature-libraries/sequence-field/rebase.js.map +1 -1
  931. package/lib/feature-libraries/sequence-field/relevantRemovedRoots.d.ts +9 -0
  932. package/lib/feature-libraries/sequence-field/relevantRemovedRoots.d.ts.map +1 -0
  933. package/lib/feature-libraries/sequence-field/relevantRemovedRoots.js +46 -0
  934. package/lib/feature-libraries/sequence-field/relevantRemovedRoots.js.map +1 -0
  935. package/lib/feature-libraries/sequence-field/replaceRevisions.d.ts +2 -2
  936. package/lib/feature-libraries/sequence-field/replaceRevisions.d.ts.map +1 -1
  937. package/lib/feature-libraries/sequence-field/replaceRevisions.js +50 -28
  938. package/lib/feature-libraries/sequence-field/replaceRevisions.js.map +1 -1
  939. package/lib/feature-libraries/sequence-field/sequenceFieldChangeHandler.d.ts.map +1 -1
  940. package/lib/feature-libraries/sequence-field/sequenceFieldChangeHandler.js +2 -0
  941. package/lib/feature-libraries/sequence-field/sequenceFieldChangeHandler.js.map +1 -1
  942. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts +4 -22
  943. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
  944. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js +183 -350
  945. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
  946. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts.map +1 -1
  947. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.js +63 -21
  948. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -1
  949. package/lib/feature-libraries/sequence-field/sequenceFieldEditor.d.ts +2 -2
  950. package/lib/feature-libraries/sequence-field/sequenceFieldEditor.d.ts.map +1 -1
  951. package/lib/feature-libraries/sequence-field/sequenceFieldEditor.js +10 -10
  952. package/lib/feature-libraries/sequence-field/sequenceFieldEditor.js.map +1 -1
  953. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts +2 -3
  954. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts.map +1 -1
  955. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.js +115 -17
  956. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
  957. package/lib/feature-libraries/sequence-field/types.d.ts +59 -30
  958. package/lib/feature-libraries/sequence-field/types.d.ts.map +1 -1
  959. package/lib/feature-libraries/sequence-field/types.js.map +1 -1
  960. package/lib/feature-libraries/sequence-field/utils.d.ts +24 -15
  961. package/lib/feature-libraries/sequence-field/utils.d.ts.map +1 -1
  962. package/lib/feature-libraries/sequence-field/utils.js +327 -123
  963. package/lib/feature-libraries/sequence-field/utils.js.map +1 -1
  964. package/lib/feature-libraries/treeCursorUtils.js +7 -7
  965. package/lib/feature-libraries/treeCursorUtils.js.map +1 -1
  966. package/lib/feature-libraries/treeTextCursor.js +2 -2
  967. package/lib/feature-libraries/treeTextCursor.js.map +1 -1
  968. package/lib/feature-libraries/valueUtilities.d.ts.map +1 -1
  969. package/lib/feature-libraries/valueUtilities.js +16 -8
  970. package/lib/feature-libraries/valueUtilities.js.map +1 -1
  971. package/lib/index.d.ts +3 -3
  972. package/lib/index.d.ts.map +1 -1
  973. package/lib/index.js +1 -1
  974. package/lib/index.js.map +1 -1
  975. package/lib/packageVersion.d.ts +1 -1
  976. package/lib/packageVersion.d.ts.map +1 -1
  977. package/lib/packageVersion.js +1 -1
  978. package/lib/packageVersion.js.map +1 -1
  979. package/lib/shared-tree/independentView.d.ts.map +1 -1
  980. package/lib/shared-tree/independentView.js +2 -2
  981. package/lib/shared-tree/independentView.js.map +1 -1
  982. package/lib/shared-tree/index.d.ts +1 -1
  983. package/lib/shared-tree/index.d.ts.map +1 -1
  984. package/lib/shared-tree/index.js.map +1 -1
  985. package/lib/shared-tree/schematizeTree.d.ts +4 -4
  986. package/lib/shared-tree/schematizeTree.d.ts.map +1 -1
  987. package/lib/shared-tree/schematizeTree.js +2 -3
  988. package/lib/shared-tree/schematizeTree.js.map +1 -1
  989. package/lib/shared-tree/schematizingTreeView.d.ts +9 -5
  990. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  991. package/lib/shared-tree/schematizingTreeView.js +59 -44
  992. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  993. package/lib/shared-tree/sharedTree.d.ts +3 -9
  994. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  995. package/lib/shared-tree/sharedTree.js +26 -19
  996. package/lib/shared-tree/sharedTree.js.map +1 -1
  997. package/lib/shared-tree/sharedTreeChangeCodecs.d.ts +1 -1
  998. package/lib/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  999. package/lib/shared-tree/sharedTreeChangeCodecs.js +11 -11
  1000. package/lib/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  1001. package/lib/shared-tree/sharedTreeChangeEnricher.d.ts.map +1 -1
  1002. package/lib/shared-tree/sharedTreeChangeEnricher.js +6 -4
  1003. package/lib/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
  1004. package/lib/shared-tree/sharedTreeChangeFamily.d.ts +7 -6
  1005. package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  1006. package/lib/shared-tree/sharedTreeChangeFamily.js +24 -25
  1007. package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  1008. package/lib/shared-tree/sharedTreeEditBuilder.d.ts +6 -16
  1009. package/lib/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
  1010. package/lib/shared-tree/sharedTreeEditBuilder.js +6 -12
  1011. package/lib/shared-tree/sharedTreeEditBuilder.js.map +1 -1
  1012. package/lib/shared-tree/treeAlpha.d.ts +35 -29
  1013. package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
  1014. package/lib/shared-tree/treeAlpha.js +21 -23
  1015. package/lib/shared-tree/treeAlpha.js.map +1 -1
  1016. package/lib/shared-tree/treeCheckout.d.ts +17 -12
  1017. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  1018. package/lib/shared-tree/treeCheckout.js +89 -70
  1019. package/lib/shared-tree/treeCheckout.js.map +1 -1
  1020. package/lib/shared-tree-core/branch.d.ts +5 -4
  1021. package/lib/shared-tree-core/branch.d.ts.map +1 -1
  1022. package/lib/shared-tree-core/branch.js +7 -6
  1023. package/lib/shared-tree-core/branch.js.map +1 -1
  1024. package/lib/shared-tree-core/branchCommitEnricher.d.ts.map +1 -1
  1025. package/lib/shared-tree-core/branchCommitEnricher.js +2 -2
  1026. package/lib/shared-tree-core/branchCommitEnricher.js.map +1 -1
  1027. package/lib/shared-tree-core/editManager.d.ts +2 -2
  1028. package/lib/shared-tree-core/editManager.d.ts.map +1 -1
  1029. package/lib/shared-tree-core/editManager.js +10 -10
  1030. package/lib/shared-tree-core/editManager.js.map +1 -1
  1031. package/lib/shared-tree-core/editManagerCodecs.d.ts +0 -4
  1032. package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  1033. package/lib/shared-tree-core/editManagerCodecs.js +13 -15
  1034. package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
  1035. package/lib/shared-tree-core/editManagerCodecsVSharedBranches.js +1 -1
  1036. package/lib/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
  1037. package/lib/shared-tree-core/editManagerFormatCommons.d.ts +9 -44
  1038. package/lib/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
  1039. package/lib/shared-tree-core/editManagerFormatCommons.js +9 -9
  1040. package/lib/shared-tree-core/editManagerFormatCommons.js.map +1 -1
  1041. package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts +2 -2
  1042. package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -1
  1043. package/lib/shared-tree-core/editManagerFormatV1toV4.js +1 -1
  1044. package/lib/shared-tree-core/editManagerFormatV1toV4.js.map +1 -1
  1045. package/lib/shared-tree-core/editManagerFormatVSharedBranches.d.ts +1 -1
  1046. package/lib/shared-tree-core/editManagerSummarizer.js +3 -3
  1047. package/lib/shared-tree-core/editManagerSummarizer.js.map +1 -1
  1048. package/lib/shared-tree-core/index.d.ts +3 -2
  1049. package/lib/shared-tree-core/index.d.ts.map +1 -1
  1050. package/lib/shared-tree-core/index.js +2 -2
  1051. package/lib/shared-tree-core/index.js.map +1 -1
  1052. package/lib/shared-tree-core/messageCodecV1ToV4.d.ts +1 -1
  1053. package/lib/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
  1054. package/lib/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
  1055. package/lib/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -1
  1056. package/lib/shared-tree-core/messageCodecVSharedBranches.js +2 -1
  1057. package/lib/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
  1058. package/lib/shared-tree-core/messageCodecs.d.ts +0 -4
  1059. package/lib/shared-tree-core/messageCodecs.d.ts.map +1 -1
  1060. package/lib/shared-tree-core/messageCodecs.js +15 -18
  1061. package/lib/shared-tree-core/messageCodecs.js.map +1 -1
  1062. package/lib/shared-tree-core/messageFormat.d.ts +10 -50
  1063. package/lib/shared-tree-core/messageFormat.d.ts.map +1 -1
  1064. package/lib/shared-tree-core/messageFormat.js +9 -8
  1065. package/lib/shared-tree-core/messageFormat.js.map +1 -1
  1066. package/lib/shared-tree-core/messageFormatV1ToV4.d.ts +2 -2
  1067. package/lib/shared-tree-core/messageFormatV1ToV4.d.ts.map +1 -1
  1068. package/lib/shared-tree-core/messageFormatV1ToV4.js +1 -1
  1069. package/lib/shared-tree-core/messageFormatV1ToV4.js.map +1 -1
  1070. package/lib/shared-tree-core/messageFormatVSharedBranches.d.ts +1 -1
  1071. package/lib/shared-tree-core/sequenceIdUtils.d.ts.map +1 -1
  1072. package/lib/shared-tree-core/sequenceIdUtils.js +4 -4
  1073. package/lib/shared-tree-core/sequenceIdUtils.js.map +1 -1
  1074. package/lib/shared-tree-core/sharedTreeCore.d.ts +0 -1
  1075. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  1076. package/lib/shared-tree-core/sharedTreeCore.js +13 -9
  1077. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  1078. package/lib/shared-tree-core/transaction.d.ts +25 -8
  1079. package/lib/shared-tree-core/transaction.d.ts.map +1 -1
  1080. package/lib/shared-tree-core/transaction.js +67 -32
  1081. package/lib/shared-tree-core/transaction.js.map +1 -1
  1082. package/lib/shared-tree-core/transactionEnricher.d.ts +2 -2
  1083. package/lib/shared-tree-core/transactionEnricher.d.ts.map +1 -1
  1084. package/lib/shared-tree-core/transactionEnricher.js +3 -3
  1085. package/lib/shared-tree-core/transactionEnricher.js.map +1 -1
  1086. package/lib/shared-tree-core/versionedSummarizer.d.ts +6 -1
  1087. package/lib/shared-tree-core/versionedSummarizer.d.ts.map +1 -1
  1088. package/lib/shared-tree-core/versionedSummarizer.js +4 -3
  1089. package/lib/shared-tree-core/versionedSummarizer.js.map +1 -1
  1090. package/lib/simple-tree/api/configuration.js +1 -1
  1091. package/lib/simple-tree/api/configuration.js.map +1 -1
  1092. package/lib/simple-tree/api/customTree.d.ts.map +1 -1
  1093. package/lib/simple-tree/api/customTree.js +13 -9
  1094. package/lib/simple-tree/api/customTree.js.map +1 -1
  1095. package/lib/simple-tree/api/discrepancies.d.ts.map +1 -1
  1096. package/lib/simple-tree/api/discrepancies.js +21 -17
  1097. package/lib/simple-tree/api/discrepancies.js.map +1 -1
  1098. package/lib/simple-tree/api/eraseSchemaDetails.d.ts +89 -0
  1099. package/lib/simple-tree/api/eraseSchemaDetails.d.ts.map +1 -0
  1100. package/lib/simple-tree/api/eraseSchemaDetails.js +92 -0
  1101. package/lib/simple-tree/api/eraseSchemaDetails.js.map +1 -0
  1102. package/lib/simple-tree/api/index.d.ts +2 -1
  1103. package/lib/simple-tree/api/index.d.ts.map +1 -1
  1104. package/lib/simple-tree/api/index.js +1 -0
  1105. package/lib/simple-tree/api/index.js.map +1 -1
  1106. package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
  1107. package/lib/simple-tree/api/schemaFactory.js +12 -8
  1108. package/lib/simple-tree/api/schemaFactory.js.map +1 -1
  1109. package/lib/simple-tree/api/schemaFromSimple.js +18 -9
  1110. package/lib/simple-tree/api/schemaFromSimple.js.map +1 -1
  1111. package/lib/simple-tree/api/simpleSchemaCodec.js +10 -5
  1112. package/lib/simple-tree/api/simpleSchemaCodec.js.map +1 -1
  1113. package/lib/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -1
  1114. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js +15 -11
  1115. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  1116. package/lib/simple-tree/api/simpleTreeIndex.js +10 -10
  1117. package/lib/simple-tree/api/simpleTreeIndex.js.map +1 -1
  1118. package/lib/simple-tree/api/storedSchema.d.ts +1 -1
  1119. package/lib/simple-tree/api/storedSchema.d.ts.map +1 -1
  1120. package/lib/simple-tree/api/storedSchema.js +5 -9
  1121. package/lib/simple-tree/api/storedSchema.js.map +1 -1
  1122. package/lib/simple-tree/api/transactionTypes.d.ts +17 -4
  1123. package/lib/simple-tree/api/transactionTypes.d.ts.map +1 -1
  1124. package/lib/simple-tree/api/transactionTypes.js.map +1 -1
  1125. package/lib/simple-tree/api/tree.d.ts +15 -2
  1126. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  1127. package/lib/simple-tree/api/tree.js.map +1 -1
  1128. package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  1129. package/lib/simple-tree/api/treeNodeApi.js +21 -13
  1130. package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
  1131. package/lib/simple-tree/api/verboseTree.d.ts.map +1 -1
  1132. package/lib/simple-tree/api/verboseTree.js +14 -9
  1133. package/lib/simple-tree/api/verboseTree.js.map +1 -1
  1134. package/lib/simple-tree/core/treeNode.d.ts.map +1 -1
  1135. package/lib/simple-tree/core/treeNode.js +1 -0
  1136. package/lib/simple-tree/core/treeNode.js.map +1 -1
  1137. package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  1138. package/lib/simple-tree/core/treeNodeKernel.js +6 -3
  1139. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
  1140. package/lib/simple-tree/core/unhydratedFlexTree.d.ts +15 -15
  1141. package/lib/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  1142. package/lib/simple-tree/core/unhydratedFlexTree.js +28 -73
  1143. package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  1144. package/lib/simple-tree/createContext.d.ts.map +1 -1
  1145. package/lib/simple-tree/createContext.js +1 -1
  1146. package/lib/simple-tree/createContext.js.map +1 -1
  1147. package/lib/simple-tree/fieldSchema.d.ts +4 -4
  1148. package/lib/simple-tree/fieldSchema.d.ts.map +1 -1
  1149. package/lib/simple-tree/fieldSchema.js.map +1 -1
  1150. package/lib/simple-tree/getTreeNodeForField.d.ts.map +1 -1
  1151. package/lib/simple-tree/getTreeNodeForField.js +2 -1
  1152. package/lib/simple-tree/getTreeNodeForField.js.map +1 -1
  1153. package/lib/simple-tree/index.d.ts +3 -3
  1154. package/lib/simple-tree/index.d.ts.map +1 -1
  1155. package/lib/simple-tree/index.js +2 -2
  1156. package/lib/simple-tree/index.js.map +1 -1
  1157. package/lib/simple-tree/leafNodeSchema.js +9 -6
  1158. package/lib/simple-tree/leafNodeSchema.js.map +1 -1
  1159. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  1160. package/lib/simple-tree/node-kinds/array/arrayNode.js +19 -21
  1161. package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  1162. package/lib/simple-tree/node-kinds/common.d.ts.map +1 -1
  1163. package/lib/simple-tree/node-kinds/common.js +2 -2
  1164. package/lib/simple-tree/node-kinds/common.js.map +1 -1
  1165. package/lib/simple-tree/node-kinds/map/mapNode.js +2 -2
  1166. package/lib/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  1167. package/lib/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  1168. package/lib/simple-tree/node-kinds/object/objectNode.js +22 -23
  1169. package/lib/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  1170. package/lib/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
  1171. package/lib/simple-tree/node-kinds/record/recordNode.js +4 -7
  1172. package/lib/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  1173. package/lib/simple-tree/prepareForInsertion.d.ts +47 -54
  1174. package/lib/simple-tree/prepareForInsertion.d.ts.map +1 -1
  1175. package/lib/simple-tree/prepareForInsertion.js +124 -183
  1176. package/lib/simple-tree/prepareForInsertion.js.map +1 -1
  1177. package/lib/simple-tree/toStoredSchema.d.ts.map +1 -1
  1178. package/lib/simple-tree/toStoredSchema.js +12 -8
  1179. package/lib/simple-tree/toStoredSchema.js.map +1 -1
  1180. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.d.ts +4 -13
  1181. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
  1182. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js +9 -26
  1183. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
  1184. package/lib/tableSchema.d.ts +3 -14
  1185. package/lib/tableSchema.d.ts.map +1 -1
  1186. package/lib/tableSchema.js +3 -3
  1187. package/lib/tableSchema.js.map +1 -1
  1188. package/lib/treeFactory.d.ts.map +1 -1
  1189. package/lib/treeFactory.js +3 -13
  1190. package/lib/treeFactory.js.map +1 -1
  1191. package/lib/util/bTreeUtils.js +1 -1
  1192. package/lib/util/bTreeUtils.js.map +1 -1
  1193. package/lib/util/brand.d.ts +49 -0
  1194. package/lib/util/brand.d.ts.map +1 -1
  1195. package/lib/util/brand.js +44 -0
  1196. package/lib/util/brand.js.map +1 -1
  1197. package/lib/util/breakable.js +7 -9
  1198. package/lib/util/breakable.js.map +1 -1
  1199. package/lib/util/idAllocator.d.ts.map +1 -1
  1200. package/lib/util/idAllocator.js +1 -2
  1201. package/lib/util/idAllocator.js.map +1 -1
  1202. package/lib/util/index.d.ts +2 -2
  1203. package/lib/util/index.d.ts.map +1 -1
  1204. package/lib/util/index.js +2 -2
  1205. package/lib/util/index.js.map +1 -1
  1206. package/lib/util/nestedMap.d.ts.map +1 -1
  1207. package/lib/util/nestedMap.js +1 -1
  1208. package/lib/util/nestedMap.js.map +1 -1
  1209. package/lib/util/rangeMap.d.ts +12 -24
  1210. package/lib/util/rangeMap.d.ts.map +1 -1
  1211. package/lib/util/rangeMap.js +5 -44
  1212. package/lib/util/rangeMap.js.map +1 -1
  1213. package/lib/util/utils.d.ts.map +1 -1
  1214. package/lib/util/utils.js +16 -15
  1215. package/lib/util/utils.js.map +1 -1
  1216. package/package.json +33 -32
  1217. package/src/codec/codec.ts +82 -26
  1218. package/src/codec/index.ts +4 -1
  1219. package/src/codec/versioned/codec.ts +340 -22
  1220. package/src/codec/versioned/index.ts +3 -1
  1221. package/src/core/change-family/changeFamily.ts +0 -5
  1222. package/src/core/change-family/index.ts +0 -1
  1223. package/src/core/index.ts +4 -6
  1224. package/src/core/rebase/changeRebaser.ts +41 -12
  1225. package/src/core/rebase/index.ts +2 -2
  1226. package/src/core/rebase/types.ts +32 -26
  1227. package/src/core/rebase/utils.ts +10 -34
  1228. package/src/core/schema-stored/schema.ts +8 -10
  1229. package/src/core/tree/anchorSet.ts +3 -4
  1230. package/src/core/tree/detachedFieldIndex.ts +14 -91
  1231. package/src/core/tree/detachedFieldIndexCodecCommon.ts +4 -8
  1232. package/src/core/tree/detachedFieldIndexCodecV1.ts +3 -7
  1233. package/src/core/tree/detachedFieldIndexCodecV2.ts +5 -9
  1234. package/src/core/tree/detachedFieldIndexCodecs.ts +21 -64
  1235. package/src/core/tree/detachedFieldIndexFormatCommon.ts +4 -7
  1236. package/src/core/tree/index.ts +2 -3
  1237. package/src/core/tree/mapTree.ts +1 -1
  1238. package/src/core/tree/pathTree.ts +4 -16
  1239. package/src/core/tree/sparseTree.ts +1 -0
  1240. package/src/core/tree/treeTextFormat.ts +5 -9
  1241. package/src/feature-libraries/changeAtomIdBTree.ts +24 -0
  1242. package/src/feature-libraries/chunked-forest/basicChunk.ts +2 -8
  1243. package/src/feature-libraries/chunked-forest/chunkTree.ts +1 -6
  1244. package/src/feature-libraries/chunked-forest/chunkedForest.ts +5 -5
  1245. package/src/feature-libraries/chunked-forest/codec/chunkDecoding.ts +7 -4
  1246. package/src/feature-libraries/chunked-forest/codec/codecs.ts +20 -11
  1247. package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +3 -3
  1248. package/src/feature-libraries/chunked-forest/codec/format.ts +6 -9
  1249. package/src/feature-libraries/chunked-forest/codec/schemaBasedEncode.ts +9 -5
  1250. package/src/feature-libraries/chunked-forest/uniformChunk.ts +1 -1
  1251. package/src/feature-libraries/default-schema/defaultEditBuilder.ts +163 -403
  1252. package/src/feature-libraries/default-schema/defaultFieldKinds.ts +9 -7
  1253. package/src/feature-libraries/default-schema/index.ts +5 -17
  1254. package/src/feature-libraries/default-schema/mappedEditBuilder.ts +15 -35
  1255. package/src/feature-libraries/deltaUtils.ts +1 -6
  1256. package/src/feature-libraries/flex-tree/context.ts +0 -17
  1257. package/src/feature-libraries/flex-tree/flexTreeTypes.ts +8 -7
  1258. package/src/feature-libraries/flex-tree/lazyField.ts +31 -74
  1259. package/src/feature-libraries/forest-summary/codec.ts +25 -13
  1260. package/src/feature-libraries/forest-summary/forestSummarizer.ts +37 -12
  1261. package/src/feature-libraries/forest-summary/{format.ts → formatCommon.ts} +10 -11
  1262. package/src/feature-libraries/forest-summary/formatV1.ts +12 -0
  1263. package/src/feature-libraries/forest-summary/formatV2.ts +12 -0
  1264. package/src/feature-libraries/forest-summary/incrementalSummaryBuilder.ts +18 -21
  1265. package/src/feature-libraries/forest-summary/index.ts +1 -2
  1266. package/src/feature-libraries/forest-summary/summaryFormatCommon.ts +41 -0
  1267. package/src/feature-libraries/forest-summary/summaryFormatV1ToV2.ts +11 -0
  1268. package/src/feature-libraries/forest-summary/summaryFormatV3.ts +18 -0
  1269. package/src/feature-libraries/forest-summary/summaryTypes.ts +26 -46
  1270. package/src/feature-libraries/index.ts +18 -27
  1271. package/src/feature-libraries/indexing/anchorTreeIndex.ts +5 -5
  1272. package/src/feature-libraries/mapTreeCursor.ts +1 -2
  1273. package/src/feature-libraries/mitigatedChangeFamily.ts +12 -9
  1274. package/src/feature-libraries/modular-schema/comparison.ts +14 -10
  1275. package/src/feature-libraries/modular-schema/crossFieldQueries.ts +44 -142
  1276. package/src/feature-libraries/modular-schema/defaultRevisionReplacer.ts +70 -0
  1277. package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +58 -40
  1278. package/src/feature-libraries/modular-schema/genericFieldKind.ts +23 -13
  1279. package/src/feature-libraries/modular-schema/index.ts +18 -21
  1280. package/src/feature-libraries/modular-schema/modularChangeCodecV1.ts +543 -572
  1281. package/src/feature-libraries/modular-schema/modularChangeCodecV2.ts +44 -745
  1282. package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +37 -51
  1283. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +862 -2636
  1284. package/src/feature-libraries/modular-schema/modularChangeFormatV1.ts +3 -4
  1285. package/src/feature-libraries/modular-schema/modularChangeFormatV2.ts +17 -45
  1286. package/src/feature-libraries/modular-schema/modularChangeTypes.ts +18 -97
  1287. package/src/feature-libraries/node-identifier/mockNodeIdentifierManager.ts +1 -1
  1288. package/src/feature-libraries/object-forest/objectForest.ts +4 -4
  1289. package/src/feature-libraries/optional-field/index.ts +3 -1
  1290. package/src/feature-libraries/optional-field/optionalField.ts +566 -321
  1291. package/src/feature-libraries/optional-field/optionalFieldChangeTypes.ts +38 -24
  1292. package/src/feature-libraries/optional-field/optionalFieldCodecV2.ts +35 -89
  1293. package/src/feature-libraries/optional-field/optionalFieldCodecs.ts +1 -5
  1294. package/src/feature-libraries/schema-edits/schemaChangeCodecs.ts +19 -5
  1295. package/src/feature-libraries/schema-index/codec.ts +30 -92
  1296. package/src/feature-libraries/schema-index/index.ts +2 -4
  1297. package/src/feature-libraries/schema-index/schemaSummarizer.ts +0 -17
  1298. package/src/feature-libraries/schemaChecker.ts +11 -6
  1299. package/src/feature-libraries/sequence-field/compose.ts +527 -138
  1300. package/src/feature-libraries/sequence-field/helperTypes.ts +19 -34
  1301. package/src/feature-libraries/sequence-field/index.ts +9 -0
  1302. package/src/feature-libraries/sequence-field/invert.ts +229 -103
  1303. package/src/feature-libraries/sequence-field/markQueue.ts +2 -2
  1304. package/src/feature-libraries/sequence-field/moveEffectTable.ts +198 -9
  1305. package/src/feature-libraries/sequence-field/rebase.ts +218 -175
  1306. package/src/feature-libraries/sequence-field/relevantRemovedRoots.ts +57 -0
  1307. package/src/feature-libraries/sequence-field/replaceRevisions.ts +76 -59
  1308. package/src/feature-libraries/sequence-field/sequenceFieldChangeHandler.ts +2 -0
  1309. package/src/feature-libraries/sequence-field/sequenceFieldCodecV2.ts +228 -643
  1310. package/src/feature-libraries/sequence-field/sequenceFieldCodecV3.ts +70 -56
  1311. package/src/feature-libraries/sequence-field/sequenceFieldEditor.ts +27 -25
  1312. package/src/feature-libraries/sequence-field/sequenceFieldToDelta.ts +135 -22
  1313. package/src/feature-libraries/sequence-field/types.ts +64 -34
  1314. package/src/feature-libraries/sequence-field/utils.ts +382 -150
  1315. package/src/feature-libraries/treeCursorUtils.ts +7 -7
  1316. package/src/feature-libraries/treeTextCursor.ts +2 -2
  1317. package/src/feature-libraries/valueUtilities.ts +16 -8
  1318. package/src/index.ts +7 -0
  1319. package/src/packageVersion.ts +1 -1
  1320. package/src/shared-tree/independentView.ts +1 -2
  1321. package/src/shared-tree/index.ts +2 -3
  1322. package/src/shared-tree/schematizeTree.ts +8 -21
  1323. package/src/shared-tree/schematizingTreeView.ts +96 -63
  1324. package/src/shared-tree/sharedTree.ts +29 -29
  1325. package/src/shared-tree/sharedTreeChangeCodecs.ts +12 -15
  1326. package/src/shared-tree/sharedTreeChangeEnricher.ts +4 -4
  1327. package/src/shared-tree/sharedTreeChangeFamily.ts +34 -34
  1328. package/src/shared-tree/sharedTreeEditBuilder.ts +9 -39
  1329. package/src/shared-tree/treeAlpha.ts +60 -51
  1330. package/src/shared-tree/treeCheckout.ts +158 -132
  1331. package/src/shared-tree-core/branch.ts +10 -11
  1332. package/src/shared-tree-core/branchCommitEnricher.ts +3 -8
  1333. package/src/shared-tree-core/editManager.ts +3 -17
  1334. package/src/shared-tree-core/editManagerCodecs.ts +13 -18
  1335. package/src/shared-tree-core/editManagerCodecsVSharedBranches.ts +1 -1
  1336. package/src/shared-tree-core/editManagerFormatCommons.ts +12 -15
  1337. package/src/shared-tree-core/editManagerFormatV1toV4.ts +2 -2
  1338. package/src/shared-tree-core/editManagerSummarizer.ts +3 -3
  1339. package/src/shared-tree-core/index.ts +3 -2
  1340. package/src/shared-tree-core/messageCodecV1ToV4.ts +1 -1
  1341. package/src/shared-tree-core/messageCodecVSharedBranches.ts +2 -1
  1342. package/src/shared-tree-core/messageCodecs.ts +15 -21
  1343. package/src/shared-tree-core/messageFormat.ts +12 -15
  1344. package/src/shared-tree-core/messageFormatV1ToV4.ts +2 -2
  1345. package/src/shared-tree-core/sequenceIdUtils.ts +4 -4
  1346. package/src/shared-tree-core/sharedTreeCore.ts +12 -11
  1347. package/src/shared-tree-core/transaction.ts +115 -56
  1348. package/src/shared-tree-core/transactionEnricher.ts +5 -6
  1349. package/src/shared-tree-core/versionedSummarizer.ts +10 -3
  1350. package/src/simple-tree/api/configuration.ts +1 -1
  1351. package/src/simple-tree/api/customTree.ts +14 -10
  1352. package/src/simple-tree/api/discrepancies.ts +23 -17
  1353. package/src/simple-tree/api/eraseSchemaDetails.ts +123 -0
  1354. package/src/simple-tree/api/index.ts +6 -0
  1355. package/src/simple-tree/api/schemaFactory.ts +11 -7
  1356. package/src/simple-tree/api/schemaFromSimple.ts +18 -9
  1357. package/src/simple-tree/api/simpleSchemaCodec.ts +10 -5
  1358. package/src/simple-tree/api/simpleSchemaToJsonSchema.ts +17 -13
  1359. package/src/simple-tree/api/simpleTreeIndex.ts +8 -8
  1360. package/src/simple-tree/api/storedSchema.ts +12 -9
  1361. package/src/simple-tree/api/transactionTypes.ts +19 -4
  1362. package/src/simple-tree/api/tree.ts +16 -1
  1363. package/src/simple-tree/api/treeNodeApi.ts +21 -13
  1364. package/src/simple-tree/api/verboseTree.ts +14 -9
  1365. package/src/simple-tree/core/treeNode.ts +1 -0
  1366. package/src/simple-tree/core/treeNodeKernel.ts +6 -3
  1367. package/src/simple-tree/core/unhydratedFlexTree.ts +58 -104
  1368. package/src/simple-tree/createContext.ts +4 -1
  1369. package/src/simple-tree/fieldSchema.ts +4 -6
  1370. package/src/simple-tree/getTreeNodeForField.ts +2 -1
  1371. package/src/simple-tree/index.ts +5 -2
  1372. package/src/simple-tree/leafNodeSchema.ts +8 -5
  1373. package/src/simple-tree/node-kinds/array/arrayNode.ts +28 -30
  1374. package/src/simple-tree/node-kinds/common.ts +5 -2
  1375. package/src/simple-tree/node-kinds/map/mapNode.ts +4 -4
  1376. package/src/simple-tree/node-kinds/object/objectNode.ts +28 -29
  1377. package/src/simple-tree/node-kinds/record/recordNode.ts +11 -13
  1378. package/src/simple-tree/prepareForInsertion.ts +200 -343
  1379. package/src/simple-tree/toStoredSchema.ts +12 -8
  1380. package/src/simple-tree/unhydratedFlexTreeFromInsertable.ts +14 -42
  1381. package/src/tableSchema.ts +13 -18
  1382. package/src/treeFactory.ts +5 -14
  1383. package/src/util/bTreeUtils.ts +1 -1
  1384. package/src/util/brand.ts +61 -0
  1385. package/src/util/breakable.ts +9 -9
  1386. package/src/util/idAllocator.ts +1 -2
  1387. package/src/util/index.ts +3 -3
  1388. package/src/util/nestedMap.ts +1 -3
  1389. package/src/util/rangeMap.ts +18 -72
  1390. package/src/util/utils.ts +14 -13
  1391. package/dist/feature-libraries/default-schema/locationBasedEditBuilder.d.ts +0 -36
  1392. package/dist/feature-libraries/default-schema/locationBasedEditBuilder.d.ts.map +0 -1
  1393. package/dist/feature-libraries/default-schema/locationBasedEditBuilder.js +0 -126
  1394. package/dist/feature-libraries/default-schema/locationBasedEditBuilder.js.map +0 -1
  1395. package/dist/feature-libraries/forest-summary/format.d.ts.map +0 -1
  1396. package/dist/feature-libraries/forest-summary/format.js.map +0 -1
  1397. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV3.d.ts +0 -23
  1398. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV3.d.ts.map +0 -1
  1399. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV3.js +0 -31
  1400. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV3.js.map +0 -1
  1401. package/dist/feature-libraries/optional-field/optionalFieldCodecV3.d.ts +0 -12
  1402. package/dist/feature-libraries/optional-field/optionalFieldCodecV3.d.ts.map +0 -1
  1403. package/dist/feature-libraries/optional-field/optionalFieldCodecV3.js +0 -57
  1404. package/dist/feature-libraries/optional-field/optionalFieldCodecV3.js.map +0 -1
  1405. package/lib/feature-libraries/default-schema/locationBasedEditBuilder.d.ts +0 -36
  1406. package/lib/feature-libraries/default-schema/locationBasedEditBuilder.d.ts.map +0 -1
  1407. package/lib/feature-libraries/default-schema/locationBasedEditBuilder.js +0 -122
  1408. package/lib/feature-libraries/default-schema/locationBasedEditBuilder.js.map +0 -1
  1409. package/lib/feature-libraries/forest-summary/format.d.ts.map +0 -1
  1410. package/lib/feature-libraries/forest-summary/format.js.map +0 -1
  1411. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV3.d.ts +0 -23
  1412. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV3.d.ts.map +0 -1
  1413. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV3.js +0 -27
  1414. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV3.js.map +0 -1
  1415. package/lib/feature-libraries/optional-field/optionalFieldCodecV3.d.ts +0 -12
  1416. package/lib/feature-libraries/optional-field/optionalFieldCodecV3.d.ts.map +0 -1
  1417. package/lib/feature-libraries/optional-field/optionalFieldCodecV3.js +0 -53
  1418. package/lib/feature-libraries/optional-field/optionalFieldCodecV3.js.map +0 -1
  1419. package/src/feature-libraries/default-schema/locationBasedEditBuilder.ts +0 -180
  1420. package/src/feature-libraries/optional-field/optionalFieldChangeFormatV3.ts +0 -45
  1421. package/src/feature-libraries/optional-field/optionalFieldCodecV3.ts +0 -94
@@ -15,29 +15,29 @@ import { walkFieldSchema } from "../walkFieldSchema.js";
15
15
  */
16
16
  export function createSimpleTreeIndex(view, indexer, getValue, isKeyValid, indexableSchema) {
17
17
  const indexableSchemaMap = new Map();
18
- if (indexableSchema !== undefined) {
19
- for (const schemus of indexableSchema) {
20
- indexableSchemaMap.set(schemus.identifier, schemus);
21
- }
22
- }
23
- else {
18
+ if (indexableSchema === undefined) {
24
19
  walkFieldSchema(view.schema, {
25
20
  node: (schemus) => indexableSchemaMap.set(schemus.identifier, schemus),
26
21
  });
27
22
  }
23
+ else {
24
+ for (const schemus of indexableSchema) {
25
+ indexableSchemaMap.set(schemus.identifier, schemus);
26
+ }
27
+ }
28
28
  const schemaIndexer = indexableSchema === undefined
29
29
  ? (schemaIdentifier) => {
30
30
  // if indexable schema isn't provided, we check if the node is in schema
31
31
  const schemus = indexableSchemaMap.get(schemaIdentifier);
32
- if (schemus !== undefined) {
32
+ if (schemus === undefined) {
33
+ fail(0xb32 /* node is out of schema */);
34
+ }
35
+ else {
33
36
  const keyLocation = typeof indexer === "function" ? indexer(schemus) : indexer.get(schemus);
34
37
  if (keyLocation !== undefined) {
35
38
  return makeGenericKeyFinder(brand(keyLocation), isKeyValid);
36
39
  }
37
40
  }
38
- else {
39
- fail(0xb32 /* node is out of schema */);
40
- }
41
41
  }
42
42
  : (schemaIdentifier) => {
43
43
  const schemus = indexableSchemaMap.get(schemaIdentifier);
@@ -1 +1 @@
1
- {"version":3,"file":"simpleTreeIndex.js","sourceRoot":"","sources":["../../../src/simple-tree/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C,CAAC;QAClC,CAAC;IACF,CAAC,EACD,CAAC,UAAsB,EAAE,EAAE;QAC1B,MAAM,UAAU,GAAG,kBAAkB,CAAC,UAAU,CAAC,CAAC;QAClD,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,EAAE,CAAC;YAC9B,OAAO,WAAW,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QACvC,CAAC;IACF,CAAC;IACD,+FAA+F;IAC/F,IAAI,CACJ,CAAC;IAEF,sFAAsF;IACtF,2CAA2C;IAC3C,OAAO,KAAsC,CAAC;AAC/C,CAAC;AAED,SAAS,oBAAoB,CAC5B,QAAkB,EAClB,UAA8C;IAE9C,OAAO,CAAC,MAA+B,EAAE,EAAE;QAC1C,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QAC5B,MAAM,CAAC,SAAS,EAAE,CAAC;QACnB,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;QAC3B,MAAM,CAAC,QAAQ,EAAE,CAAC;QAClB,MAAM,CAAC,SAAS,EAAE,CAAC;QAEnB,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACzB,IAAI,CAAC,KAAK,CAAC,wCAAwC,CAAC,CAAC;QACtD,CAAC;QAED,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;YACxB,IAAI,CAAC,KAAK,CAAC,mCAAmC,CAAC,CAAC;QACjD,CAAC;QAED,OAAO,KAAK,CAAC;IACd,CAAC,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { fail } from \"@fluidframework/core-utils/internal\";\nimport type {\n\tAnchorNode,\n\tFieldKey,\n\tITreeSubscriptionCursor,\n\tTreeNodeSchemaIdentifier,\n} from \"../../core/index.js\";\nimport {\n\tAnchorTreeIndex,\n\tisTreeValue,\n\ttype TreeIndexNodes,\n\thasElement,\n\ttype TreeIndex,\n\ttype TreeIndexKey,\n\ttype KeyFinder,\n} from \"../../feature-libraries/index.js\";\nimport { brand } from \"../../util/index.js\";\nimport type { ImplicitFieldSchema } from \"../fieldSchema.js\";\nimport {\n\ttreeNodeFromAnchor,\n\ttype TreeNode,\n\ttype TreeNodeSchema,\n\ttype NodeFromSchema,\n} from \"../core/index.js\";\nimport { treeNodeApi } from \"./treeNodeApi.js\";\nimport type { TreeView } from \"./tree.js\";\nimport { walkFieldSchema } from \"../walkFieldSchema.js\";\nimport type { SchematizingSimpleTreeView } from \"../../shared-tree/index.js\";\n\n/**\n * A {@link TreeIndex} that returns tree nodes given their associated keys.\n *\n * @alpha\n */\nexport type SimpleTreeIndex<TKey extends TreeIndexKey, TValue> = TreeIndex<TKey, TValue>;\n\n/**\n * Creates a {@link SimpleTreeIndex} with a specified indexer.\n *\n * @param view - the view for the tree being indexed\n * @param indexer - a function that takes in a {@link TreeNodeSchema} and returns the field name that all nodes of the given schema\n * should be keyed on, must be pure and functional\n * @param getValue - given at least one {@link TreeNode}, returns an associated value\n * @param isKeyValid - function for verifying the validity of the key retrieved based on the information given by the indexer\n *\n * @alpha\n */\nexport function createSimpleTreeIndex<\n\tTFieldSchema extends ImplicitFieldSchema,\n\tTKey extends TreeIndexKey,\n\tTValue,\n>(\n\tview: TreeView<TFieldSchema>,\n\tindexer: (schema: TreeNodeSchema) => string | undefined,\n\tgetValue: (nodes: TreeIndexNodes<TreeNode>) => TValue,\n\tisKeyValid: (key: TreeIndexKey) => key is TKey,\n): SimpleTreeIndex<TKey, TValue>;\n/**\n * Creates a {@link SimpleTreeIndex} with a specified indexer.\n *\n * @param view - the view for the tree being indexed\n * @param indexer - a function that takes in a {@link TreeNodeSchema} and returns the field name that all nodes of the given schema\n * should be keyed on, must be pure and functional\n * @param getValue - given at least one {@link TreeNode}, returns an associated value\n * @param isKeyValid - function for verifying the validity of the key retrieved based on the information given by the indexer\n * @param indexableSchema - a list of all the schema types that can be indexed\n *\n * @alpha\n */\nexport function createSimpleTreeIndex<\n\tTFieldSchema extends ImplicitFieldSchema,\n\tTKey extends TreeIndexKey,\n\tTValue,\n\tTSchema extends TreeNodeSchema,\n>(\n\tview: TreeView<TFieldSchema>,\n\tindexer: (schema: TSchema) => string | undefined,\n\tgetValue: (nodes: TreeIndexNodes<NodeFromSchema<TSchema>>) => TValue,\n\tisKeyValid: (key: TreeIndexKey) => key is TKey,\n\tindexableSchema: readonly TSchema[],\n): SimpleTreeIndex<TKey, TValue>;\n/**\n * Creates a {@link SimpleTreeIndex} with a specified indexer.\n *\n * @param view - the view for the tree being indexed\n * @param indexer - a map from {@link TreeNodeSchema} to the field name that all nodes of the given schema\n * should be keyed on\n * @param getValue - given at least one {@link TreeNode}, returns an associated value\n * @param isKeyValid - function for verifying the validity of the key retrieved based on the information given by the indexer\n *\n * @alpha\n */\nexport function createSimpleTreeIndex<\n\tTFieldSchema extends ImplicitFieldSchema,\n\tTKey extends TreeIndexKey,\n\tTValue,\n>(\n\tview: TreeView<TFieldSchema>,\n\tindexer: Map<TreeNodeSchema, string>,\n\tgetValue: (nodes: TreeIndexNodes<TreeNode>) => TValue,\n\tisKeyValid: (key: TreeIndexKey) => key is TKey,\n): SimpleTreeIndex<TKey, TValue>;\n/**\n * Creates a {@link SimpleTreeIndex} with a specified indexer.\n *\n * @param view - the view for the tree being indexed\n * @param indexer - a map from {@link TreeNodeSchema} to the field name that all nodes of the given schema\n * should be keyed on\n * @param getValue - given at least one {@link TreeNode}, returns an associated value\n * @param isKeyValid - function for verifying the validity of the key retrieved based on the information given by the indexer\n * @param indexableSchema - a list of all the schema types that can be indexed\n *\n * @alpha\n */\nexport function createSimpleTreeIndex<\n\tTFieldSchema extends ImplicitFieldSchema,\n\tTKey extends TreeIndexKey,\n\tTValue,\n\tTSchema extends TreeNodeSchema,\n>(\n\tview: TreeView<TFieldSchema>,\n\tindexer: Map<TreeNodeSchema, string>,\n\tgetValue: (nodes: TreeIndexNodes<NodeFromSchema<TSchema>>) => TValue,\n\tisKeyValid: (key: TreeIndexKey) => key is TKey,\n\tindexableSchema: readonly TSchema[],\n): SimpleTreeIndex<TKey, TValue>;\n/**\n * Creates a {@link SimpleTreeIndex} with a specified indexer.\n *\n * @alpha\n */\nexport function createSimpleTreeIndex<\n\tTFieldSchema extends ImplicitFieldSchema,\n\tTKey extends TreeIndexKey,\n\tTValue,\n>(\n\tview: TreeView<TFieldSchema>,\n\tindexer: ((schema: TreeNodeSchema) => string | undefined) | Map<TreeNodeSchema, string>,\n\tgetValue:\n\t\t| ((nodes: TreeIndexNodes<TreeNode>) => TValue)\n\t\t| ((nodes: TreeIndexNodes<NodeFromSchema<TreeNodeSchema>>) => TValue),\n\tisKeyValid: (key: TreeIndexKey) => key is TKey,\n\tindexableSchema?: readonly TreeNodeSchema[],\n): SimpleTreeIndex<TKey, TValue> {\n\tconst indexableSchemaMap = new Map();\n\tif (indexableSchema !== undefined) {\n\t\tfor (const schemus of indexableSchema) {\n\t\t\tindexableSchemaMap.set(schemus.identifier, schemus);\n\t\t}\n\t} else {\n\t\twalkFieldSchema(view.schema, {\n\t\t\tnode: (schemus) => indexableSchemaMap.set(schemus.identifier, schemus),\n\t\t});\n\t}\n\n\tconst schemaIndexer =\n\t\tindexableSchema === undefined\n\t\t\t? (schemaIdentifier: TreeNodeSchemaIdentifier) => {\n\t\t\t\t\t// if indexable schema isn't provided, we check if the node is in schema\n\t\t\t\t\tconst schemus = indexableSchemaMap.get(schemaIdentifier);\n\t\t\t\t\tif (schemus !== undefined) {\n\t\t\t\t\t\tconst keyLocation =\n\t\t\t\t\t\t\ttypeof indexer === \"function\" ? indexer(schemus) : indexer.get(schemus);\n\t\t\t\t\t\tif (keyLocation !== undefined) {\n\t\t\t\t\t\t\treturn makeGenericKeyFinder<TKey>(brand(keyLocation), isKeyValid);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tfail(0xb32 /* node is out of schema */);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t: (schemaIdentifier: TreeNodeSchemaIdentifier) => {\n\t\t\t\t\tconst schemus = indexableSchemaMap.get(schemaIdentifier);\n\t\t\t\t\tif (schemus !== undefined) {\n\t\t\t\t\t\tconst keyLocation =\n\t\t\t\t\t\t\ttypeof indexer === \"function\" ? indexer(schemus) : indexer.get(schemus);\n\t\t\t\t\t\tif (keyLocation !== undefined) {\n\t\t\t\t\t\t\treturn makeGenericKeyFinder<TKey>(brand(keyLocation), isKeyValid);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t};\n\n\tconst index = new AnchorTreeIndex<TKey, TValue>(\n\t\t(view as SchematizingSimpleTreeView<TFieldSchema>).checkout.forest,\n\t\tschemaIndexer,\n\t\t(anchorNodes) => {\n\t\t\tconst simpleTreeNodes: TreeNode[] = [];\n\t\t\tfor (const anchorNode of anchorNodes) {\n\t\t\t\tconst simpleTree = treeNodeFromAnchor(anchorNode);\n\t\t\t\tif (!isTreeValue(simpleTree)) {\n\t\t\t\t\tsimpleTreeNodes.push(simpleTree);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (hasElement(simpleTreeNodes)) {\n\t\t\t\treturn getValue(simpleTreeNodes);\n\t\t\t}\n\t\t},\n\t\t(anchorNode: AnchorNode) => {\n\t\t\tconst simpleTree = treeNodeFromAnchor(anchorNode);\n\t\t\tif (!isTreeValue(simpleTree)) {\n\t\t\t\treturn treeNodeApi.status(simpleTree);\n\t\t\t}\n\t\t},\n\t\t// simple tree indexes are shallow indexes, indicating so allows for a performance optimization\n\t\ttrue,\n\t);\n\n\t// all the type checking guarantees that we put nodes of the correct type in the index\n\t// but it's not captured in the type system\n\treturn index as SimpleTreeIndex<TKey, TValue>;\n}\n\nfunction makeGenericKeyFinder<TKey extends TreeIndexKey>(\n\tkeyField: FieldKey,\n\tisKeyValid: (key: TreeIndexKey) => key is TKey,\n): KeyFinder<TKey> {\n\treturn (cursor: ITreeSubscriptionCursor) => {\n\t\tcursor.enterField(keyField);\n\t\tcursor.firstNode();\n\t\tconst value = cursor.value;\n\t\tcursor.exitNode();\n\t\tcursor.exitField();\n\n\t\tif (value === undefined) {\n\t\t\tfail(0xb33 /* a value for the key does not exist */);\n\t\t}\n\n\t\tif (!isKeyValid(value)) {\n\t\t\tfail(0xb34 /* the key is an unexpected type */);\n\t\t}\n\n\t\treturn value;\n\t};\n}\n"]}
1
+ {"version":3,"file":"simpleTreeIndex.js","sourceRoot":"","sources":["../../../src/simple-tree/api/simpleTreeIndex.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,qCAAqC,CAAC;AAO3D,OAAO,EACN,eAAe,EACf,WAAW,EAEX,UAAU,GAIV,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,OAAO,EACN,kBAAkB,GAIlB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAoGxD;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CAKpC,IAA4B,EAC5B,OAAuF,EACvF,QAEsE,EACtE,UAA8C,EAC9C,eAA2C;IAE3C,MAAM,kBAAkB,GAAG,IAAI,GAAG,EAAE,CAAC;IACrC,IAAI,eAAe,KAAK,SAAS,EAAE,CAAC;QACnC,eAAe,CAAC,IAAI,CAAC,MAAM,EAAE;YAC5B,IAAI,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,kBAAkB,CAAC,GAAG,CAAC,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC;SACtE,CAAC,CAAC;IACJ,CAAC;SAAM,CAAC;QACP,KAAK,MAAM,OAAO,IAAI,eAAe,EAAE,CAAC;YACvC,kBAAkB,CAAC,GAAG,CAAC,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;QACrD,CAAC;IACF,CAAC;IAED,MAAM,aAAa,GAClB,eAAe,KAAK,SAAS;QAC5B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ved.\n * Licensed under the MIT License.\n */\n\nimport { fail } from \"@fluidframework/core-utils/internal\";\nimport type {\n\tAnchorNode,\n\tFieldKey,\n\tITreeSubscriptionCursor,\n\tTreeNodeSchemaIdentifier,\n} from \"../../core/index.js\";\nimport {\n\tAnchorTreeIndex,\n\tisTreeValue,\n\ttype TreeIndexNodes,\n\thasElement,\n\ttype TreeIndex,\n\ttype TreeIndexKey,\n\ttype KeyFinder,\n} from \"../../feature-libraries/index.js\";\nimport { brand } from \"../../util/index.js\";\nimport type { ImplicitFieldSchema } from \"../fieldSchema.js\";\nimport {\n\ttreeNodeFromAnchor,\n\ttype TreeNode,\n\ttype TreeNodeSchema,\n\ttype NodeFromSchema,\n} from \"../core/index.js\";\nimport { treeNodeApi } from \"./treeNodeApi.js\";\nimport type { TreeView } from \"./tree.js\";\nimport { walkFieldSchema } from \"../walkFieldSchema.js\";\nimport type { SchematizingSimpleTreeView } from \"../../shared-tree/index.js\";\n\n/**\n * A {@link TreeIndex} that returns tree nodes given their associated keys.\n *\n * @alpha\n */\nexport type SimpleTreeIndex<TKey extends TreeIndexKey, TValue> = TreeIndex<TKey, TValue>;\n\n/**\n * Creates a {@link SimpleTreeIndex} with a specified indexer.\n *\n * @param view - the view for the tree being indexed\n * @param indexer - a function that takes in a {@link TreeNodeSchema} and returns the field name that all nodes of the given schema\n * should be keyed on, must be pure and functional\n * @param getValue - given at least one {@link TreeNode}, returns an associated value\n * @param isKeyValid - function for verifying the validity of the key retrieved based on the information given by the indexer\n *\n * @alpha\n */\nexport function createSimpleTreeIndex<\n\tTFieldSchema extends ImplicitFieldSchema,\n\tTKey extends TreeIndexKey,\n\tTValue,\n>(\n\tview: TreeView<TFieldSchema>,\n\tindexer: (schema: TreeNodeSchema) => string | undefined,\n\tgetValue: (nodes: TreeIndexNodes<TreeNode>) => TValue,\n\tisKeyValid: (key: TreeIndexKey) => key is TKey,\n): SimpleTreeIndex<TKey, TValue>;\n/**\n * Creates a {@link SimpleTreeIndex} with a specified indexer.\n *\n * @param view - the view for the tree being indexed\n * @param indexer - a function that takes in a {@link TreeNodeSchema} and returns the field name that all nodes of the given schema\n * should be keyed on, must be pure and functional\n * @param getValue - given at least one {@link TreeNode}, returns an associated value\n * @param isKeyValid - function for verifying the validity of the key retrieved based on the information given by the indexer\n * @param indexableSchema - a list of all the schema types that can be indexed\n *\n * @alpha\n */\nexport function createSimpleTreeIndex<\n\tTFieldSchema extends ImplicitFieldSchema,\n\tTKey extends TreeIndexKey,\n\tTValue,\n\tTSchema extends TreeNodeSchema,\n>(\n\tview: TreeView<TFieldSchema>,\n\tindexer: (schema: TSchema) => string | undefined,\n\tgetValue: (nodes: TreeIndexNodes<NodeFromSchema<TSchema>>) => TValue,\n\tisKeyValid: (key: TreeIndexKey) => key is TKey,\n\tindexableSchema: readonly TSchema[],\n): SimpleTreeIndex<TKey, TValue>;\n/**\n * Creates a {@link SimpleTreeIndex} with a specified indexer.\n *\n * @param view - the view for the tree being indexed\n * @param indexer - a map from {@link TreeNodeSchema} to the field name that all nodes of the given schema\n * should be keyed on\n * @param getValue - given at least one {@link TreeNode}, returns an associated value\n * @param isKeyValid - function for verifying the validity of the key retrieved based on the information given by the indexer\n *\n * @alpha\n */\nexport function createSimpleTreeIndex<\n\tTFieldSchema extends ImplicitFieldSchema,\n\tTKey extends TreeIndexKey,\n\tTValue,\n>(\n\tview: TreeView<TFieldSchema>,\n\tindexer: Map<TreeNodeSchema, string>,\n\tgetValue: (nodes: TreeIndexNodes<TreeNode>) => TValue,\n\tisKeyValid: (key: TreeIndexKey) => key is TKey,\n): SimpleTreeIndex<TKey, TValue>;\n/**\n * Creates a {@link SimpleTreeIndex} with a specified indexer.\n *\n * @param view - the view for the tree being indexed\n * @param indexer - a map from {@link TreeNodeSchema} to the field name that all nodes of the given schema\n * should be keyed on\n * @param getValue - given at least one {@link TreeNode}, returns an associated value\n * @param isKeyValid - function for verifying the validity of the key retrieved based on the information given by the indexer\n * @param indexableSchema - a list of all the schema types that can be indexed\n *\n * @alpha\n */\nexport function createSimpleTreeIndex<\n\tTFieldSchema extends ImplicitFieldSchema,\n\tTKey extends TreeIndexKey,\n\tTValue,\n\tTSchema extends TreeNodeSchema,\n>(\n\tview: TreeView<TFieldSchema>,\n\tindexer: Map<TreeNodeSchema, string>,\n\tgetValue: (nodes: TreeIndexNodes<NodeFromSchema<TSchema>>) => TValue,\n\tisKeyValid: (key: TreeIndexKey) => key is TKey,\n\tindexableSchema: readonly TSchema[],\n): SimpleTreeIndex<TKey, TValue>;\n/**\n * Creates a {@link SimpleTreeIndex} with a specified indexer.\n *\n * @alpha\n */\nexport function createSimpleTreeIndex<\n\tTFieldSchema extends ImplicitFieldSchema,\n\tTKey extends TreeIndexKey,\n\tTValue,\n>(\n\tview: TreeView<TFieldSchema>,\n\tindexer: ((schema: TreeNodeSchema) => string | undefined) | Map<TreeNodeSchema, string>,\n\tgetValue:\n\t\t| ((nodes: TreeIndexNodes<TreeNode>) => TValue)\n\t\t| ((nodes: TreeIndexNodes<NodeFromSchema<TreeNodeSchema>>) => TValue),\n\tisKeyValid: (key: TreeIndexKey) => key is TKey,\n\tindexableSchema?: readonly TreeNodeSchema[],\n): SimpleTreeIndex<TKey, TValue> {\n\tconst indexableSchemaMap = new Map();\n\tif (indexableSchema === undefined) {\n\t\twalkFieldSchema(view.schema, {\n\t\t\tnode: (schemus) => indexableSchemaMap.set(schemus.identifier, schemus),\n\t\t});\n\t} else {\n\t\tfor (const schemus of indexableSchema) {\n\t\t\tindexableSchemaMap.set(schemus.identifier, schemus);\n\t\t}\n\t}\n\n\tconst schemaIndexer =\n\t\tindexableSchema === undefined\n\t\t\t? (schemaIdentifier: TreeNodeSchemaIdentifier) => {\n\t\t\t\t\t// if indexable schema isn't provided, we check if the node is in schema\n\t\t\t\t\tconst schemus = indexableSchemaMap.get(schemaIdentifier);\n\t\t\t\t\tif (schemus === undefined) {\n\t\t\t\t\t\tfail(0xb32 /* node is out of schema */);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst keyLocation =\n\t\t\t\t\t\t\ttypeof indexer === \"function\" ? indexer(schemus) : indexer.get(schemus);\n\t\t\t\t\t\tif (keyLocation !== undefined) {\n\t\t\t\t\t\t\treturn makeGenericKeyFinder<TKey>(brand(keyLocation), isKeyValid);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t: (schemaIdentifier: TreeNodeSchemaIdentifier) => {\n\t\t\t\t\tconst schemus = indexableSchemaMap.get(schemaIdentifier);\n\t\t\t\t\tif (schemus !== undefined) {\n\t\t\t\t\t\tconst keyLocation =\n\t\t\t\t\t\t\ttypeof indexer === \"function\" ? indexer(schemus) : indexer.get(schemus);\n\t\t\t\t\t\tif (keyLocation !== undefined) {\n\t\t\t\t\t\t\treturn makeGenericKeyFinder<TKey>(brand(keyLocation), isKeyValid);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t};\n\n\tconst index = new AnchorTreeIndex<TKey, TValue>(\n\t\t(view as SchematizingSimpleTreeView<TFieldSchema>).checkout.forest,\n\t\tschemaIndexer,\n\t\t(anchorNodes) => {\n\t\t\tconst simpleTreeNodes: TreeNode[] = [];\n\t\t\tfor (const anchorNode of anchorNodes) {\n\t\t\t\tconst simpleTree = treeNodeFromAnchor(anchorNode);\n\t\t\t\tif (!isTreeValue(simpleTree)) {\n\t\t\t\t\tsimpleTreeNodes.push(simpleTree);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (hasElement(simpleTreeNodes)) {\n\t\t\t\treturn getValue(simpleTreeNodes);\n\t\t\t}\n\t\t},\n\t\t(anchorNode: AnchorNode) => {\n\t\t\tconst simpleTree = treeNodeFromAnchor(anchorNode);\n\t\t\tif (!isTreeValue(simpleTree)) {\n\t\t\t\treturn treeNodeApi.status(simpleTree);\n\t\t\t}\n\t\t},\n\t\t// simple tree indexes are shallow indexes, indicating so allows for a performance optimization\n\t\ttrue,\n\t);\n\n\t// all the type checking guarantees that we put nodes of the correct type in the index\n\t// but it's not captured in the type system\n\treturn index as SimpleTreeIndex<TKey, TValue>;\n}\n\nfunction makeGenericKeyFinder<TKey extends TreeIndexKey>(\n\tkeyField: FieldKey,\n\tisKeyValid: (key: TreeIndexKey) => key is TKey,\n): KeyFinder<TKey> {\n\treturn (cursor: ITreeSubscriptionCursor) => {\n\t\tcursor.enterField(keyField);\n\t\tcursor.firstNode();\n\t\tconst value = cursor.value;\n\t\tcursor.exitNode();\n\t\tcursor.exitField();\n\n\t\tif (value === undefined) {\n\t\t\tfail(0xb33 /* a value for the key does not exist */);\n\t\t}\n\n\t\tif (!isKeyValid(value)) {\n\t\t\tfail(0xb34 /* the key is an unexpected type */);\n\t\t}\n\n\t\treturn value;\n\t};\n}\n"]}
@@ -4,7 +4,7 @@
4
4
  */
5
5
  import type { MinimumVersionForCollab } from "@fluidframework/runtime-definitions/internal";
6
6
  import { type ICodecOptions } from "../../codec/index.js";
7
- import { type JsonCompatible } from "../../util/index.js";
7
+ import type { JsonCompatible } from "../../util/index.js";
8
8
  import type { SchemaUpgrade } from "../core/index.js";
9
9
  import { type ImplicitFieldSchema } from "../fieldSchema.js";
10
10
  import type { SchemaCompatibilityStatus } from "./tree.js";
@@ -1 +1 @@
1
- {"version":3,"file":"storedSchema.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/storedSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AAC5F,OAAO,EAAsB,KAAK,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAQ9E,OAAO,EAAS,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAwB,KAAK,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAKnF,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AAE3D;;;;;;;;;;;;;;;;;;;;;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@@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { FluidClientVersion } from "../../codec/index.js";
5
+ import { FluidClientVersion, FormatValidatorNoOp, } from "../../codec/index.js";
6
6
  import { SchemaFormatVersion } from "../../core/index.js";
7
- import { encodeTreeSchema, makeSchemaCodec } from "../../feature-libraries/index.js";
8
- import { clientVersionToSchemaVersion,
9
- // eslint-disable-next-line import-x/no-internal-modules
10
- } from "../../feature-libraries/schema-index/index.js";
11
- import { brand } from "../../util/index.js";
7
+ import { makeSchemaCodec } from "../../feature-libraries/index.js";
12
8
  import { normalizeFieldSchema } from "../fieldSchema.js";
13
9
  import { toStoredSchema } from "../toStoredSchema.js";
14
10
  import { TreeViewConfigurationAlpha } from "./configuration.js";
@@ -47,8 +43,8 @@ import { SchemaCompatibilityTester } from "./schemaCompatibilityTester.js";
47
43
  */
48
44
  export function extractPersistedSchema(schema, minVersionForCollab, includeStaged) {
49
45
  const stored = toStoredSchema(schema, { includeStaged });
50
- const schemaWriteVersion = clientVersionToSchemaVersion(minVersionForCollab);
51
- return encodeTreeSchema(stored, schemaWriteVersion);
46
+ const codec = makeSchemaCodec({ minVersionForCollab, jsonValidator: FormatValidatorNoOp });
47
+ return codec.encode(stored);
52
48
  }
53
49
  /**
54
50
  * Compares two schema extracted using {@link extractPersistedSchema}.
@@ -83,7 +79,7 @@ export function extractPersistedSchema(schema, minVersionForCollab, includeStage
83
79
  export function comparePersistedSchema(persisted, view, options) {
84
80
  // Any version can be passed down to makeSchemaCodec here.
85
81
  // We only use the decode part, which always dispatches to the correct codec based on the version in the data, not the version passed to `makeSchemaCodec`.
86
- const schemaCodec = makeSchemaCodec({ ...options, minVersionForCollab: FluidClientVersion.v2_0 }, brand(SchemaFormatVersion.v1));
82
+ const schemaCodec = makeSchemaCodec({ ...options, minVersionForCollab: FluidClientVersion.v2_0 }, SchemaFormatVersion.v1);
87
83
  const stored = schemaCodec.decode(persisted);
88
84
  const config = new TreeViewConfigurationAlpha({
89
85
  schema: normalizeFieldSchema(view),
@@ -1 +1 @@
1
- {"version":3,"file":"storedSchema.js","sourceRoot":"","sources":["../../../src/simple-tree/api/storedSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,kBAAkB,EAAsB,MAAM,sBAAsB,CAAC;AAC9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACrF,OAAO,EACN,4BAA4B;AAE5B,wDAAwD;EACxD,MAAM,+CAA+C,CAAC;AACvD,OAAO,EAAE,KAAK,EAAuB,MAAM,qBAAqB,CAAC;AAEjE,OAAO,EAAE,oBAAoB,EAA4B,MAAM,mBAAmB,CAAC;AACnF,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAEhE,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAG3E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,UAAU,sBAAsB,CACrC,MAA2B,EAC3B,mBAA4C,EAC5C,aAAkD;IAElD,MAAM,MAAM,GAAG,cAAc,CAAC,MAAM,EAAE,EAAE,aAAa,EAAE,CAAC,CAAC;IACzD,MAAM,kBAAkB,GAAG,4BAA4B,CAAC,mBAAmB,CAAC,CAAC;IAC7E,OAAO,gBAAgB,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;AACrD,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,UAAU,sBAAsB,CACrC,SAAyB,EACzB,IAAyB,EACzB,OAAsB;IAEtB,0DAA0D;IAC1D,2JAA2J;IAC3J,MAAM,WAAW,GAAG,eAAe,CAClC,EAAE,GAAG,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,CAAC,IAAI,EAAE,EAC5D,KAAK,CAAC,mBAAmB,CAAC,EAAE,CAAC,CAC7B,CAAC;IACF,MAAM,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,SAAqB,CAAC,CAAC;IACzD,MAAM,MAAM,GAAG,IAAI,0BAA0B,CAAC;QAC7C,MAAM,EAAE,oBAAoB,CAAC,IAAI,CAAC;KAClC,CAAC,CAAC;IACH,MAAM,UAAU,GAAG,IAAI,yBAAyB,CAAC,MAAM,CAAC,CAAC;IACzD,OAAO,UAAU,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC;AAC9C,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { MinimumVersionForCollab } from \"@fluidframework/runtime-definitions/internal\";\nimport { FluidClientVersion, type ICodecOptions } from \"../../codec/index.js\";\nimport { SchemaFormatVersion } from \"../../core/index.js\";\nimport { encodeTreeSchema, makeSchemaCodec } from \"../../feature-libraries/index.js\";\nimport {\n\tclientVersionToSchemaVersion,\n\ttype FormatV1,\n\t// eslint-disable-next-line import-x/no-internal-modules\n} from \"../../feature-libraries/schema-index/index.js\";\nimport { brand, type JsonCompatible } from \"../../util/index.js\";\nimport type { SchemaUpgrade } from \"../core/index.js\";\nimport { normalizeFieldSchema, type ImplicitFieldSchema } from \"../fieldSchema.js\";\nimport { toStoredSchema } from \"../toStoredSchema.js\";\nimport { TreeViewConfigurationAlpha } from \"./configuration.js\";\n\nimport { SchemaCompatibilityTester } from \"./schemaCompatibilityTester.js\";\nimport type { SchemaCompatibilityStatus } from \"./tree.js\";\n\n/**\n * Dumps the \"persisted\" schema subset of the provided `schema` into a deterministic JSON-compatible, semi-human-readable format.\n *\n * @param schema - The schema to dump.\n * @param minVersionForCollab - The oldest client version which can read the schema: impacts the format used.\n * @param includeStaged - filter for selecting which staged allowed types to include in the output.\n *\n * @remarks\n * This can be used to help inspect schema for debugging, and to save a snapshot of schema to help detect and review changes to an applications schema.\n * This format is also compatible with {@link ViewContent.schema}, {@link comparePersistedSchema} and {@link persistedToSimpleSchema}.\n *\n * This only includes the \"persisted\" subset of schema information, which means the portion which gets included in documents.\n * It thus uses \"persisted\" keys, see {@link FieldProps.key}.\n *\n * If two schema have identical \"persisted\" schema, then they are considered {@link SchemaCompatibilityStatus.isEquivalent|equivalent}.\n *\n * See also {@link comparePersistedSchema}.\n *\n * @example\n * An application could use this API to generate a `schema.json` file when it first releases,\n * then test that the schema is sill compatible with documents from that version with a test like :\n * ```typescript\n * assert.deepEqual(extractPersistedSchema(MySchema, FluidClientVersion.v2_0), require(\"./schema.json\"));\n * ```\n *\n * @privateRemarks\n * This currently uses the schema summary format, but that could be changed to something more human readable (particularly if the encoded format becomes less human readable).\n * This intentionally does not leak the format types in the API.\n *\n * Public API surface uses \"persisted\" terminology while internally we use \"stored\".\n * @alpha\n */\nexport function extractPersistedSchema(\n\tschema: ImplicitFieldSchema,\n\tminVersionForCollab: MinimumVersionForCollab,\n\tincludeStaged: (upgrade: SchemaUpgrade) => boolean,\n): JsonCompatible {\n\tconst stored = toStoredSchema(schema, { includeStaged });\n\tconst schemaWriteVersion = clientVersionToSchemaVersion(minVersionForCollab);\n\treturn encodeTreeSchema(stored, schemaWriteVersion);\n}\n\n/**\n * Compares two schema extracted using {@link extractPersistedSchema}.\n * Reports the same compatibility that {@link TreeView.compatibility} would report if\n * opening a document that used the `persisted` schema and provided `view` to {@link ViewableTree.viewWith}.\n *\n * @param persisted - Schema persisted for a document. Typically persisted alongside the data and assumed to describe that data.\n * @param view - Schema which would be used to view persisted content.\n * @param options - {@link ICodecOptions} used when parsing the provided schema.\n * @param canInitialize - Passed through to the return value unchanged and otherwise unused.\n * @returns The {@link SchemaCompatibilityStatus} a {@link TreeView} would report for this combination of schema.\n *\n * @remarks\n * This uses the persisted formats for schema, meaning it only includes data which impacts compatibility.\n * It also uses the persisted format so that this API can be used in tests to compare against saved schema from previous versions of the application.\n *\n * @example\n * An application could use {@link extractPersistedSchema} to generate a `schema.json` file for various versions of the app,\n * then test that documents using those schema can be upgraded to work with the current schema using a test like:\n * ```typescript\n * assert(\n * \tcomparePersistedSchema(\n * \t\trequire(\"./schema.json\"),\n * \t\tMySchema,\n * \t\t{ jsonValidator: typeboxValidator },\n * \t\tfalse,\n * \t).canUpgrade,\n * );\n * ```\n * @alpha\n */\nexport function comparePersistedSchema(\n\tpersisted: JsonCompatible,\n\tview: ImplicitFieldSchema,\n\toptions: ICodecOptions,\n): Omit<SchemaCompatibilityStatus, \"canInitialize\"> {\n\t// Any version can be passed down to makeSchemaCodec here.\n\t// We only use the decode part, which always dispatches to the correct codec based on the version in the data, not the version passed to `makeSchemaCodec`.\n\tconst schemaCodec = makeSchemaCodec(\n\t\t{ ...options, minVersionForCollab: FluidClientVersion.v2_0 },\n\t\tbrand(SchemaFormatVersion.v1),\n\t);\n\tconst stored = schemaCodec.decode(persisted as FormatV1);\n\tconst config = new TreeViewConfigurationAlpha({\n\t\tschema: normalizeFieldSchema(view),\n\t});\n\tconst viewSchema = new SchemaCompatibilityTester(config);\n\treturn viewSchema.checkCompatibility(stored);\n}\n"]}
1
+ {"version":3,"file":"storedSchema.js","sourceRoot":"","sources":["../../../src/simple-tree/api/storedSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACN,kBAAkB,EAClB,mBAAmB,GAEnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAOnE,OAAO,EAAE,oBAAoB,EAA4B,MAAM,mBAAmB,CAAC;AACnF,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAEhE,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAG3E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,UAAU,sBAAsB,CACrC,MAA2B,EAC3B,mBAA4C,EAC5C,aAAkD;IAElD,MAAM,MAAM,GAAG,cAAc,CAAC,MAAM,EAAE,EAAE,aAAa,EAAE,CAAC,CAAC;IACzD,MAAM,KAAK,GAAG,eAAe,CAAC,EAAE,mBAAmB,EAAE,aAAa,EAAE,mBAAmB,EAAE,CAAC,CAAC;IAC3F,OAAO,KAAK,CAAC,MAAM,CAAC,MAAM,CAAmB,CAAC;AAC/C,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,UAAU,sBAAsB,CACrC,SAAyB,EACzB,IAAyB,EACzB,OAAsB;IAEtB,0DAA0D;IAC1D,2JAA2J;IAC3J,MAAM,WAAW,GAAG,eAAe,CAClC,EAAE,GAAG,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,CAAC,IAAI,EAAE,EAC5D,mBAAmB,CAAC,EAAE,CACtB,CAAC;IACF,MAAM,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,SAAqB,CAAC,CAAC;IACzD,MAAM,MAAM,GAAG,IAAI,0BAA0B,CAAC;QAC7C,MAAM,EAAE,oBAAoB,CAAC,IAAI,CAAC;KAClC,CAAC,CAAC;IACH,MAAM,UAAU,GAAG,IAAI,yBAAyB,CAAC,MAAM,CAAC,CAAC;IACzD,OAAO,UAAU,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC;AAC9C,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { MinimumVersionForCollab } from \"@fluidframework/runtime-definitions/internal\";\nimport {\n\tFluidClientVersion,\n\tFormatValidatorNoOp,\n\ttype ICodecOptions,\n} from \"../../codec/index.js\";\nimport { SchemaFormatVersion } from \"../../core/index.js\";\nimport { makeSchemaCodec } from \"../../feature-libraries/index.js\";\nimport type {\n\tFormatV1,\n\t// eslint-disable-next-line import-x/no-internal-modules\n} from \"../../feature-libraries/schema-index/index.js\";\nimport type { JsonCompatible } from \"../../util/index.js\";\nimport type { SchemaUpgrade } from \"../core/index.js\";\nimport { normalizeFieldSchema, type ImplicitFieldSchema } from \"../fieldSchema.js\";\nimport { toStoredSchema } from \"../toStoredSchema.js\";\nimport { TreeViewConfigurationAlpha } from \"./configuration.js\";\n\nimport { SchemaCompatibilityTester } from \"./schemaCompatibilityTester.js\";\nimport type { SchemaCompatibilityStatus } from \"./tree.js\";\n\n/**\n * Dumps the \"persisted\" schema subset of the provided `schema` into a deterministic JSON-compatible, semi-human-readable format.\n *\n * @param schema - The schema to dump.\n * @param minVersionForCollab - The oldest client version which can read the schema: impacts the format used.\n * @param includeStaged - filter for selecting which staged allowed types to include in the output.\n *\n * @remarks\n * This can be used to help inspect schema for debugging, and to save a snapshot of schema to help detect and review changes to an applications schema.\n * This format is also compatible with {@link ViewContent.schema}, {@link comparePersistedSchema} and {@link persistedToSimpleSchema}.\n *\n * This only includes the \"persisted\" subset of schema information, which means the portion which gets included in documents.\n * It thus uses \"persisted\" keys, see {@link FieldProps.key}.\n *\n * If two schema have identical \"persisted\" schema, then they are considered {@link SchemaCompatibilityStatus.isEquivalent|equivalent}.\n *\n * See also {@link comparePersistedSchema}.\n *\n * @example\n * An application could use this API to generate a `schema.json` file when it first releases,\n * then test that the schema is sill compatible with documents from that version with a test like :\n * ```typescript\n * assert.deepEqual(extractPersistedSchema(MySchema, FluidClientVersion.v2_0), require(\"./schema.json\"));\n * ```\n *\n * @privateRemarks\n * This currently uses the schema summary format, but that could be changed to something more human readable (particularly if the encoded format becomes less human readable).\n * This intentionally does not leak the format types in the API.\n *\n * Public API surface uses \"persisted\" terminology while internally we use \"stored\".\n * @alpha\n */\nexport function extractPersistedSchema(\n\tschema: ImplicitFieldSchema,\n\tminVersionForCollab: MinimumVersionForCollab,\n\tincludeStaged: (upgrade: SchemaUpgrade) => boolean,\n): JsonCompatible {\n\tconst stored = toStoredSchema(schema, { includeStaged });\n\tconst codec = makeSchemaCodec({ minVersionForCollab, jsonValidator: FormatValidatorNoOp });\n\treturn codec.encode(stored) as JsonCompatible;\n}\n\n/**\n * Compares two schema extracted using {@link extractPersistedSchema}.\n * Reports the same compatibility that {@link TreeView.compatibility} would report if\n * opening a document that used the `persisted` schema and provided `view` to {@link ViewableTree.viewWith}.\n *\n * @param persisted - Schema persisted for a document. Typically persisted alongside the data and assumed to describe that data.\n * @param view - Schema which would be used to view persisted content.\n * @param options - {@link ICodecOptions} used when parsing the provided schema.\n * @param canInitialize - Passed through to the return value unchanged and otherwise unused.\n * @returns The {@link SchemaCompatibilityStatus} a {@link TreeView} would report for this combination of schema.\n *\n * @remarks\n * This uses the persisted formats for schema, meaning it only includes data which impacts compatibility.\n * It also uses the persisted format so that this API can be used in tests to compare against saved schema from previous versions of the application.\n *\n * @example\n * An application could use {@link extractPersistedSchema} to generate a `schema.json` file for various versions of the app,\n * then test that documents using those schema can be upgraded to work with the current schema using a test like:\n * ```typescript\n * assert(\n * \tcomparePersistedSchema(\n * \t\trequire(\"./schema.json\"),\n * \t\tMySchema,\n * \t\t{ jsonValidator: typeboxValidator },\n * \t\tfalse,\n * \t).canUpgrade,\n * );\n * ```\n * @alpha\n */\nexport function comparePersistedSchema(\n\tpersisted: JsonCompatible,\n\tview: ImplicitFieldSchema,\n\toptions: ICodecOptions,\n): Omit<SchemaCompatibilityStatus, \"canInitialize\"> {\n\t// Any version can be passed down to makeSchemaCodec here.\n\t// We only use the decode part, which always dispatches to the correct codec based on the version in the data, not the version passed to `makeSchemaCodec`.\n\tconst schemaCodec = makeSchemaCodec(\n\t\t{ ...options, minVersionForCollab: FluidClientVersion.v2_0 },\n\t\tSchemaFormatVersion.v1,\n\t);\n\tconst stored = schemaCodec.decode(persisted as FormatV1);\n\tconst config = new TreeViewConfigurationAlpha({\n\t\tschema: normalizeFieldSchema(view),\n\t});\n\tconst viewSchema = new SchemaCompatibilityTester(config);\n\treturn viewSchema.checkCompatibility(stored);\n}\n"]}
@@ -19,6 +19,11 @@ export declare const rollback: unique symbol;
19
19
  * @public
20
20
  */
21
21
  export type TransactionConstraint = NodeInDocumentConstraint;
22
+ /**
23
+ * Type for alpha version {@link TransactionConstraint | constraint}s
24
+ * @sealed @alpha
25
+ */
26
+ export type TransactionConstraintAlpha = TransactionConstraint | NoChangeConstraint;
22
27
  /**
23
28
  * A transaction {@link TransactionConstraint | constraint} which requires that the given node exists in the tree.
24
29
  * @remarks The node must be in the document (its {@link TreeStatus | status} must be {@link TreeStatus.InDocument | InDocument}) to qualify as "existing".
@@ -28,6 +33,14 @@ export interface NodeInDocumentConstraint {
28
33
  readonly type: "nodeInDocument";
29
34
  readonly node: TreeNode;
30
35
  }
36
+ /**
37
+ * A {@link TransactionConstraintAlpha | constraint} which requires that, for this transaction to apply, the document must be in the same state immediately before the transaction is applied as it was before the transaction was authored.
38
+ * When used as a revert precondition it requires that, for the revert to apply, the document must be in the same state immediately before the revert is applied as it was after the transaction was applied.
39
+ * @alpha
40
+ */
41
+ export interface NoChangeConstraint {
42
+ readonly type: "noChange";
43
+ }
31
44
  /**
32
45
  * The status of the transaction callback in the {@link RunTransaction | RunTransaction} API.
33
46
  * @alpha
@@ -44,13 +57,13 @@ export type TransactionCallbackStatus<TSuccessValue, TFailureValue> = ({
44
57
  value: TFailureValue;
45
58
  }) & {
46
59
  /**
47
- * An optional list of {@link TransactionConstraint | constraints} that will be checked when the commit corresponding
60
+ * An optional list of {@link TransactionConstraintAlpha | constraints} that will be checked when the commit corresponding
48
61
  * to this transaction is reverted. If any of these constraints are not met when the revert is being applied either
49
62
  * locally or on remote clients, the revert will be ignored.
50
63
  * These constraints must also be met at the time they are first introduced. If they are not met after the transaction
51
64
  * callback returns, then `runTransaction` (which invokes the transaction callback) will throw a `UsageError`.
52
65
  */
53
- preconditionsOnRevert?: readonly TransactionConstraint[];
66
+ preconditionsOnRevert?: readonly TransactionConstraintAlpha[];
54
67
  };
55
68
  /**
56
69
  * The status of a the transaction callback in the {@link RunTransaction | RunTransaction} API where the transaction doesn't
@@ -96,11 +109,11 @@ export type TransactionResult = Omit<TransactionResultSuccess<unknown>, "value">
96
109
  */
97
110
  export interface RunTransactionParams {
98
111
  /**
99
- * An optional list of {@link TransactionConstraint | constraints} that are checked just before the transaction begins.
112
+ * An optional list of {@link TransactionConstraintAlpha | constraints} that are checked just before the transaction begins.
100
113
  * If any of the constraints are not met when `runTransaction` is called, an error will be thrown.
101
114
  * If any of the constraints are not met after the transaction has been ordered by the service, it will be rolled back on
102
115
  * this client and ignored by all other clients.
103
116
  */
104
- readonly preconditions?: readonly TransactionConstraint[];
117
+ readonly preconditions?: readonly TransactionConstraintAlpha[];
105
118
  }
106
119
  //# sourceMappingURL=transactionTypes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"transactionTypes.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/transactionTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEjD;;;GAGG;AACH,eAAO,MAAM,QAAQ,eAA4C,CAAC;AAElE;;;;;;;;;GASG;AACH,MAAM,MAAM,qBAAqB,GAAG,wBAAwB,CAAC;AAE7D;;;;GAIG;AACH,MAAM,WAAW,wBAAwB;IACxC,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC;IAChC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;CACxB;AAED;;;GAGG;AACH,MAAM,MAAM,yBAAyB,CAAC,aAAa,EAAE,aAAa,IAAI,CACnE;IACA,gEAAgE;IAChE,QAAQ,CAAC,EAAE,KAAK,CAAC;IACjB,oEAAoE;IACpE,KAAK,EAAE,aAAa,CAAC;CACpB,GACD;IACA,gGAAgG;IAChG,QAAQ,EAAE,IAAI,CAAC;IACf,0DAA0D;IAC1D,KAAK,EAAE,aAAa,CAAC;CACpB,CACH,GAAG;IACH;;;;;;OAMG;IACH,qBAAqB,CAAC,EAAE,SAAS,qBAA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AO,CAAC,EAAE,OAAO,CAAC,GAChD,IAAI,CAAC,uBAAuB,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC;AAEnD;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACpC;;;;;OAKG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS,0BAA0B,EAAE,CAAC;CAC/D"}
@@ -1 +1 @@
1
- {"version":3,"file":"transactionTypes.js","sourceRoot":"","sources":["../../../src/simple-tree/api/transactionTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;GAGG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,MAAM,CAAC,iCAAiC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { TreeNode } from \"../core/index.js\";\n\n/**\n * A special object that signifies when a SharedTree {@link RunTransaction | transaction} should \"roll back\".\n * @public\n */\nexport const rollback = Symbol(\"SharedTree Transaction Rollback\");\n\n/**\n * A requirement for a SharedTree transaction to succeed.\n * @remarks Transaction constraints are useful for validating that the state of the tree meets some requirement when a transaction runs.\n * In general, when running a transaction a client can validate their tree state in whatever way they wish and decide to either proceed with the transaction or not.\n * However, they cannot know what the tree state will be when the transaction is _sequenced_.\n * There may have been any number of edits from other clients that get sequenced before the transaction is eventually sequenced.\n * Constraints provide a way to validate the tree state after the transaction has been sequenced and abort the transaction if the constraints are not met.\n * All clients will validate the constraints of a transaction when it is sequenced, so all clients will agree on whether the transaction succeeds or not.\n * @public\n */\nexport type TransactionConstraint = NodeInDocumentConstraint; // TODO: Add more constraint types here\n\n/**\n * A transaction {@link TransactionConstraint | constraint} which requires that the given node exists in the tree.\n * @remarks The node must be in the document (its {@link TreeStatus | status} must be {@link TreeStatus.InDocument | InDocument}) to qualify as \"existing\".\n * @public\n */\nexport interface NodeInDocumentConstraint {\n\treadonly type: \"nodeInDocument\";\n\treadonly node: TreeNode;\n}\n\n/**\n * The status of the transaction callback in the {@link RunTransaction | RunTransaction} API.\n * @alpha\n */\nexport type TransactionCallbackStatus<TSuccessValue, TFailureValue> = (\n\t| {\n\t\t\t/** Indicates that the transaction callback ran successfully. */\n\t\t\trollback?: false;\n\t\t\t/** The user defined value when the transaction ran successfully. */\n\t\t\tvalue: TSuccessValue;\n\t }\n\t| {\n\t\t\t/** Indicates that the transaction callback failed and the transaction should be rolled back. */\n\t\t\trollback: true;\n\t\t\t/** The user defined value when the transaction failed. */\n\t\t\tvalue: TFailureValue;\n\t }\n) & {\n\t/**\n\t * An optional list of {@link TransactionConstraint | constraints} that will be checked when the commit corresponding\n\t * to this transaction is reverted. If any of these constraints are not met when the revert is being applied either\n\t * locally or on remote clients, the revert will be ignored.\n\t * These constraints must also be met at the time they are first introduced. If they are not met after the transaction\n\t * callback returns, then `runTransaction` (which invokes the transaction callback) will throw a `UsageError`.\n\t */\n\tpreconditionsOnRevert?: readonly TransactionConstraint[];\n};\n\n/**\n * The status of a the transaction callback in the {@link RunTransaction | RunTransaction} API where the transaction doesn't\n * need to return a value. This is the same as {@link TransactionCallbackStatus} but with the `value` field omitted. This\n * @alpha\n */\nexport type VoidTransactionCallbackStatus = Omit<\n\tTransactionCallbackStatus<unknown, unknown>,\n\t\"value\"\n>;\n\n/**\n * The result of the {@link RunTransaction | RunTransaction} API when it was successful.\n * @alpha\n */\nexport interface TransactionResultSuccess<TSuccessValue> {\n\t/** Indicates that the transaction was successful. */\n\tsuccess: true;\n\t/** The user defined value when the transaction was successful. */\n\tvalue: TSuccessValue;\n}\n\n/**\n * The result of the {@link RunTransaction | RunTransaction} API when it failed.\n * @alpha\n */\nexport interface TransactionResultFailed<TFailureValue> {\n\t/** Indicates that the transaction failed. */\n\tsuccess: false;\n\t/** The user defined value when the transaction failed. */\n\tvalue: TFailureValue;\n}\n\n/**\n * The result of the {@link RunTransaction | RunTransaction} API.\n * @alpha\n */\nexport type TransactionResultExt<TSuccessValue, TFailureValue> =\n\t| TransactionResultSuccess<TSuccessValue>\n\t| TransactionResultFailed<TFailureValue>;\n\n/**\n * The result of the {@link RunTransaction | RunTransaction} API. This is the same as {@link TransactionResultExt}\n * but with the `value` field omitted. This is useful when the transaction callback doesn't need to return a value.\n * @alpha\n */\nexport type TransactionResult =\n\t| Omit<TransactionResultSuccess<unknown>, \"value\">\n\t| Omit<TransactionResultFailed<unknown>, \"value\">;\n\n/**\n * The parameters for the {@link RunTransaction | RunTransaction} API.\n * @alpha\n * @input\n */\nexport interface RunTransactionParams {\n\t/**\n\t * An optional list of {@link TransactionConstraint | constraints} that are checked just before the transaction begins.\n\t * If any of the constraints are not met when `runTransaction` is called, an error will be thrown.\n\t * If any of the constraints are not met after the transaction has been ordered by the service, it will be rolled back on\n\t * this client and ignored by all other clients.\n\t */\n\treadonly preconditions?: readonly TransactionConstraint[];\n}\n"]}
1
+ {"version":3,"file":"transactionTypes.js","sourceRoot":"","sources":["../../../src/simple-tree/api/transactionTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;GAGG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,MAAM,CAAC,iCAAiC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { TreeNode } from \"../core/index.js\";\n\n/**\n * A special object that signifies when a SharedTree {@link RunTransaction | transaction} should \"roll back\".\n * @public\n */\nexport const rollback = Symbol(\"SharedTree Transaction Rollback\");\n\n/**\n * A requirement for a SharedTree transaction to succeed.\n * @remarks Transaction constraints are useful for validating that the state of the tree meets some requirement when a transaction runs.\n * In general, when running a transaction a client can validate their tree state in whatever way they wish and decide to either proceed with the transaction or not.\n * However, they cannot know what the tree state will be when the transaction is _sequenced_.\n * There may have been any number of edits from other clients that get sequenced before the transaction is eventually sequenced.\n * Constraints provide a way to validate the tree state after the transaction has been sequenced and abort the transaction if the constraints are not met.\n * All clients will validate the constraints of a transaction when it is sequenced, so all clients will agree on whether the transaction succeeds or not.\n * @public\n */\nexport type TransactionConstraint = NodeInDocumentConstraint; // TODO: Add more constraint types here\n\n/**\n * Type for alpha version {@link TransactionConstraint | constraint}s\n * @sealed @alpha\n */\nexport type TransactionConstraintAlpha = TransactionConstraint | NoChangeConstraint; // TODO: Add more constraint types here\n\n/**\n * A transaction {@link TransactionConstraint | constraint} which requires that the given node exists in the tree.\n * @remarks The node must be in the document (its {@link TreeStatus | status} must be {@link TreeStatus.InDocument | InDocument}) to qualify as \"existing\".\n * @public\n */\nexport interface NodeInDocumentConstraint {\n\treadonly type: \"nodeInDocument\";\n\treadonly node: TreeNode;\n}\n\n/**\n * A {@link TransactionConstraintAlpha | constraint} which requires that, for this transaction to apply, the document must be in the same state immediately before the transaction is applied as it was before the transaction was authored.\n * When used as a revert precondition it requires that, for the revert to apply, the document must be in the same state immediately before the revert is applied as it was after the transaction was applied.\n * @alpha\n */\nexport interface NoChangeConstraint {\n\treadonly type: \"noChange\";\n}\n\n/**\n * The status of the transaction callback in the {@link RunTransaction | RunTransaction} API.\n * @alpha\n */\nexport type TransactionCallbackStatus<TSuccessValue, TFailureValue> = (\n\t| {\n\t\t\t/** Indicates that the transaction callback ran successfully. */\n\t\t\trollback?: false;\n\t\t\t/** The user defined value when the transaction ran successfully. */\n\t\t\tvalue: TSuccessValue;\n\t }\n\t| {\n\t\t\t/** Indicates that the transaction callback failed and the transaction should be rolled back. */\n\t\t\trollback: true;\n\t\t\t/** The user defined value when the transaction failed. */\n\t\t\tvalue: TFailureValue;\n\t }\n) & {\n\t/**\n\t * An optional list of {@link TransactionConstraintAlpha | constraints} that will be checked when the commit corresponding\n\t * to this transaction is reverted. If any of these constraints are not met when the revert is being applied either\n\t * locally or on remote clients, the revert will be ignored.\n\t * These constraints must also be met at the time they are first introduced. If they are not met after the transaction\n\t * callback returns, then `runTransaction` (which invokes the transaction callback) will throw a `UsageError`.\n\t */\n\tpreconditionsOnRevert?: readonly TransactionConstraintAlpha[];\n};\n\n/**\n * The status of a the transaction callback in the {@link RunTransaction | RunTransaction} API where the transaction doesn't\n * need to return a value. This is the same as {@link TransactionCallbackStatus} but with the `value` field omitted. This\n * @alpha\n */\nexport type VoidTransactionCallbackStatus = Omit<\n\tTransactionCallbackStatus<unknown, unknown>,\n\t\"value\"\n>;\n\n/**\n * The result of the {@link RunTransaction | RunTransaction} API when it was successful.\n * @alpha\n */\nexport interface TransactionResultSuccess<TSuccessValue> {\n\t/** Indicates that the transaction was successful. */\n\tsuccess: true;\n\t/** The user defined value when the transaction was successful. */\n\tvalue: TSuccessValue;\n}\n\n/**\n * The result of the {@link RunTransaction | RunTransaction} API when it failed.\n * @alpha\n */\nexport interface TransactionResultFailed<TFailureValue> {\n\t/** Indicates that the transaction failed. */\n\tsuccess: false;\n\t/** The user defined value when the transaction failed. */\n\tvalue: TFailureValue;\n}\n\n/**\n * The result of the {@link RunTransaction | RunTransaction} API.\n * @alpha\n */\nexport type TransactionResultExt<TSuccessValue, TFailureValue> =\n\t| TransactionResultSuccess<TSuccessValue>\n\t| TransactionResultFailed<TFailureValue>;\n\n/**\n * The result of the {@link RunTransaction | RunTransaction} API. This is the same as {@link TransactionResultExt}\n * but with the `value` field omitted. This is useful when the transaction callback doesn't need to return a value.\n * @alpha\n */\nexport type TransactionResult =\n\t| Omit<TransactionResultSuccess<unknown>, \"value\">\n\t| Omit<TransactionResultFailed<unknown>, \"value\">;\n\n/**\n * The parameters for the {@link RunTransaction | RunTransaction} API.\n * @alpha\n * @input\n */\nexport interface RunTransactionParams {\n\t/**\n\t * An optional list of {@link TransactionConstraintAlpha | constraints} that are checked just before the transaction begins.\n\t * If any of the constraints are not met when `runTransaction` is called, an error will be thrown.\n\t * If any of the constraints are not met after the transaction has been ordered by the service, it will be rolled back on\n\t * this client and ignored by all other clients.\n\t */\n\treadonly preconditions?: readonly TransactionConstraintAlpha[];\n}\n"]}
@@ -3,13 +3,14 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import type { IFluidLoadable, IDisposable, Listenable } from "@fluidframework/core-interfaces";
6
- import type { CommitMetadata, RevertibleAlphaFactory, RevertibleFactory } from "../../core/index.js";
6
+ import type { CommitMetadata, ChangeMetadata, RevertibleAlphaFactory, RevertibleFactory } from "../../core/index.js";
7
7
  import type { ImplicitFieldSchema, InsertableField, InsertableTreeFieldFromImplicitField, ReadableField, ReadSchema, TreeFieldFromImplicitField } from "../fieldSchema.js";
8
8
  import type { UnsafeUnknownSchema } from "../unsafeUnknownSchema.js";
9
9
  import type { SimpleTreeSchema } from "../simpleSchema.js";
10
10
  import type { TreeViewConfiguration } from "./configuration.js";
11
11
  import type { RunTransactionParams, TransactionCallbackStatus, TransactionResult, TransactionResultExt, VoidTransactionCallbackStatus } from "./transactionTypes.js";
12
12
  import type { VerboseTree } from "./verboseTree.js";
13
+ import type { JsonCompatibleReadOnly } from "../../util/index.js";
13
14
  /**
14
15
  * A tree from which a {@link TreeView} can be created.
15
16
  *
@@ -229,6 +230,18 @@ export interface TreeBranchAlpha extends TreeBranch {
229
230
  * - Undo will undo the outermost transaction and all inner transactions.
230
231
  */
231
232
  runTransaction(transaction: () => VoidTransactionCallbackStatus | void, params?: RunTransactionParams): TransactionResult;
233
+ /**
234
+ * Apply a serialized change to this branch.
235
+ * @param change - the change to apply.
236
+ * Changes are acquired via `getChange` in a branch's {@link TreeBranchEvents.changed | "changed"} event.
237
+ * @remarks Changes may only be applied to a SharedTree with the same IdCompressor instance and branch state from which they were generated.
238
+ * They may be created by one branch and applied to another, but only if both branches share the same history at the time of creation and application.
239
+ *
240
+ * @privateRemarks
241
+ * TODO: This method will support applying changes from different IdCompressor instances as long as they have the same local session ID.
242
+ * Update the tests and docs to match when that is done.
243
+ */
244
+ applyChange(change: JsonCompatibleReadOnly): void;
232
245
  }
233
246
  /**
234
247
  * An editable view of a (version control style) branch of a shared tree based on some schema.
@@ -426,7 +439,7 @@ export interface TreeBranchEvents extends Omit<TreeViewEvents, "commitApplied">
426
439
  * @param getRevertible - a function that allows users to get a revertible for the change. If not provided,
427
440
  * this change is not revertible.
428
441
  */
429
- changed(data: CommitMetadata, getRevertible?: RevertibleAlphaFactory): void;
442
+ changed(data: ChangeMetadata, getRevertible?: RevertibleAlphaFactory): void;
430
443
  /**
431
444
  * Fired when:
432
445
  *
@@ -1 +1 @@
1
- {"version":3,"file":"tree.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/tree.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAE/F,OAAO,KAAK,EACX,cAAc,EACd,sBAAsB,EACtB,iBAAiB,EACjB,MAAM,qBAAqB,CAAC;AAM7B,OAAO,KAAK,EACX,mBAAmB,EACnB,eAAe,EACf,oCAAoC,EACpC,aAAa,EACb,UAAU,EACV,0BAA0B,EAC1B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE3D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,KAAK,EACX,oBAAoB,EACpB,yBAAyB,EACzB,iBAAiB,EACjB,oBAAoB,EACpB,6BAA6B,EAC7B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,YAAY;IAC5B;;;;;;;;;;;;;;;;;;OAkBG;IACH,QAAQ,CAAC,KAAK,SAAS,mBAAmB,EACzC,MAAM,EAAE,qBAAqB,CAAC,KAAK,CAAC,GAClC,QAAQ,CAAC,KAAK,CAAC,CAAC;CACnB;AAED;;;;;GAKG;AACH,MAAM,WAAW,KAAM,SAAQ,YAAY,EAAE,cAAc;CAAG;AAE9D;;;GAGG;AACH,MAAM,WAAW,UAAW,SAAQ,KA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GAAG,IAAI,CAAC;IAE5E;;;;;;;;;;;;;;;;OAgBG;IACH,aAAa,CAAC,IAAI,EAAE,cAAc,EAAE,aAAa,CAAC,EAAE,sBAAsB,GAAG,IAAI,CAAC;CAClF;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC9B;;;;;;OAMG;IACH,WAAW,IAAI,IAAI,CAAC;IAEpB;;;;;;;OAOG;IACH,aAAa,IAAI,IAAI,CAAC;IAEtB;;;;;;;;;;;;;;;;OAgBG;IACH,aAAa,CAAC,IAAI,EAAE,cAAc,EAAE,aAAa,CAAC,EAAE,iBAAiB,GAAG,IAAI,CAAC;CAC7E;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,OAAO,SAAS,mBAAmB,EAClE,IAAI,EAAE,QAAQ,CAAC,OAAO,CAAC,GACrB,aAAa,CAAC,OAAO,CAAC,CAExB"}
@@ -1 +1 @@
1
- {"version":3,"file":"tree.js","sourceRoot":"","sources":["../../../src/simple-tree/api/tree.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA6jBH;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAC9B,IAAuB;IAEvB,OAAO,IAA8B,CAAC;AACvC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IFluidLoadable, IDisposable, Listenable } from \"@fluidframework/core-interfaces\";\n\nimport type {\n\tCommitMetadata,\n\tRevertibleAlphaFactory,\n\tRevertibleFactory,\n} from \"../../core/index.js\";\nimport type {\n\t// This is referenced by doc comments.\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars, unused-imports/no-unused-imports\n\tTreeAlpha,\n} from \"../../shared-tree/index.js\";\nimport type {\n\tImplicitFieldSchema,\n\tInsertableField,\n\tInsertableTreeFieldFromImplicitField,\n\tReadableField,\n\tReadSchema,\n\tTreeFieldFromImplicitField,\n} from \"../fieldSchema.js\";\nimport type { UnsafeUnknownSchema } from \"../unsafeUnknownSchema.js\";\nimport type { SimpleTreeSchema } from \"../simpleSchema.js\";\n\nimport type { TreeViewConfiguration } from \"./configuration.js\";\nimport type {\n\tRunTransactionParams,\n\tTransactionCallbackStatus,\n\tTransactionResult,\n\tTransactionResultExt,\n\tVoidTransactionCallbackStatus,\n} from \"./transactionTypes.js\";\nimport type { VerboseTree } from \"./verboseTree.js\";\n\n/**\n * A tree from which a {@link TreeView} can be created.\n *\n * @privateRemarks\n * TODO:\n * Add stored key versions of {@link (TreeAlpha:interface).(exportVerbose:2)}, {@link (TreeAlpha:interface).(exportConcise:2)} and {@link (TreeAlpha:interface).exportCompressed} here so tree content can be accessed without a view schema.\n * Add exportSimpleSchema and exportJsonSchema methods (which should exactly match the concise format, and match the free functions for exporting view schema).\n * Maybe rename \"exportJsonSchema\" to align on \"concise\" terminology.\n * Ensure schema exporting APIs here align and reference APIs for exporting view schema to the same formats (which should include stored vs property key choice).\n * Make sure users of independentView can use these export APIs (maybe provide a reference back to the ViewableTree from the TreeView to accomplish that).\n * @system @sealed @public\n */\nexport interface ViewableTree {\n\t/**\n\t * Returns a {@link TreeView} using the provided schema.\n\t * If the stored schema is compatible with the view schema specified by `config`,\n\t * the returned {@link TreeView} will expose the root with a schema-aware API based on the provided view schema.\n\t * If the provided schema is incompatible with the stored schema, the view will instead expose a status indicating the incompatibility.\n\t *\n\t * @remarks\n\t * If the tree is uninitialized (has no schema and no content), use {@link TreeView.initialize} on the returned view to set the schema and content together.\n\t * Using `viewWith` followed by {@link TreeView.upgradeSchema} to initialize only the schema for a document is technically valid when the schema\n\t * permits trees with no content.\n\t *\n\t * Note that other clients can modify the document at any time, causing the view to change its compatibility status: see {@link TreeView.events} for how to handle invalidation in these cases.\n\t *\n\t * Only one schematized view may exist for a given ITree at a time.\n\t * If creating a second, the first must be disposed before calling `viewWith` again.\n\t *\n\t * @privateRemarks\n\t * TODO: Support adapters for handling out-of-schema data.\n\t */\n\tviewWith<TRoot extends ImplicitFieldSchema>(\n\t\tconfig: TreeViewConfiguration<TRoot>,\n\t): TreeView<TRoot>;\n}\n\n/**\n * Channel for a Fluid Tree DDS.\n * @remarks\n * Allows storing and collaboratively editing schema-aware hierarchial data.\n * @sealed @public\n */\nexport interface ITree extends ViewableTree, IFluidLoadable {}\n\n/**\n * {@link ITree} extended with some alpha APIs.\n * @sealed @alpha\n */\nexport interface ITreeAlpha extends ITree {\n\t/**\n\t * Exports root in the same format as {@link (TreeAlpha:interface).(exportVerbose:1)} using stored keys.\n\t * @remarks\n\t * This is `undefined` if and only if the root field is empty (this can only happen if the root field is optional).\n\t */\n\texportVerbose(): VerboseTree | undefined;\n\n\t/**\n\t * Exports the SimpleTreeSchema that is stored in the tree, using stored keys for object fields.\n\t * @remarks\n\t * To get the schema using property keys, use {@link getSimpleSchema} on the view schema.\n\t */\n\texportSimpleSchema(): SimpleTreeSchema;\n\n\t/**\n\t * Creates a fork of the current state of the main branch.\n\t * This new branch will be shared with and editable by all clients.\n\t */\n\tcreateSharedBranch(): string;\n\n\t/**\n\t * Returns a list of all shared branches that currently exist on this tree.\n\t * Any one of them can be checked out using {@link ITreeAlpha.viewSharedBranchWith}.\n\t */\n\tgetSharedBranchIds(): string[];\n\n\t/**\n\t * Returns a view of the tree on the specified shared branch, using the provided schema.\n\t * See {@link ViewableTree.viewWith}.\n\t */\n\tviewSharedBranchWith<TRoot extends ImplicitFieldSchema>(\n\t\tbranchId: string,\n\t\tconfig: TreeViewConfiguration<TRoot>,\n\t): TreeView<TRoot>;\n}\n\n/**\n * A collection of functionality associated with a (version-control-style) branch of a SharedTree.\n * @remarks A `TreeBranch` allows for the {@link TreeBranch.fork | creation of branches} and for those branches to later be {@link TreeBranch.merge | merged}.\n *\n * The branch associated directly with the {@link ITree | SharedTree} is the \"main\" branch, and all other branches fork (directly or transitively) from that main branch.\n * @sealed @beta\n */\nexport interface TreeBranch extends IDisposable {\n\t/**\n\t * Fork a new branch off of this branch which is based off of this branch's current state.\n\t * @remarks Any changes to the tree on the new branch will not apply to this branch until the new branch is e.g. {@link TreeBranch.merge | merged} back into this branch.\n\t * The branch should be disposed when no longer needed, either {@link TreeBranch.dispose | explicitly} or {@link TreeBranch.merge | implicitly when merging} into another branch.\n\t */\n\tfork(): TreeBranch;\n\n\t/**\n\t * Apply all the new changes on the given branch to this branch.\n\t * @param branch - a branch which was created by a call to `branch()`.\n\t * @param disposeMerged - whether or not to dispose `branch` after the merge completes.\n\t * Defaults to true.\n\t * The {@link TreeBranch | main branch} cannot be disposed - attempting to do so will have no effect.\n\t * @remarks All ongoing transactions (if any) in `branch` will be committed before the merge.\n\t */\n\tmerge(branch: TreeBranch, disposeMerged?: boolean): void;\n\n\t/**\n\t * Advance this branch forward such that all new changes on the target branch become part of this branch.\n\t * @param branch - The branch to rebase onto.\n\t * @remarks After rebasing, this branch will be \"ahead\" of the target branch, that is, its unique changes will have been recreated as if they happened after all changes on the target branch.\n\t * This method may only be called on branches produced via {@link TreeBranch.fork | branch} - attempting to rebase the main branch will throw.\n\t *\n\t * Rebasing long-lived branches is important to avoid consuming memory unnecessarily.\n\t * In particular, the SharedTree retains all sequenced changes made to the tree since the \"most-behind\" branch was created or last rebased.\n\t *\n\t * The {@link TreeBranch | main branch} cannot be rebased onto another branch - attempting to do so will throw an error.\n\t */\n\trebaseOnto(branch: TreeBranch): void;\n\n\t/**\n\t * Dispose of this branch, cleaning up any resources associated with it.\n\t * @param error - Optional error indicating the reason for the disposal, if the object was disposed as the result of an error.\n\t * @remarks Branches can also be automatically disposed when {@link TreeBranch.merge | they are merged} into another branch.\n\t *\n\t * Disposing branches is important to avoid consuming memory unnecessarily.\n\t * In particular, the SharedTree retains all sequenced changes made to the tree since the \"most-behind\" branch was created or last {@link TreeBranch.rebaseOnto | rebased}.\n\t *\n\t * The {@link TreeBranch | main branch} cannot be disposed - attempting to do so will have no effect.\n\t */\n\tdispose(error?: Error): void;\n}\n\n/**\n * {@link TreeBranch} with alpha-level APIs.\n * @remarks\n * The `TreeBranch` for a specific {@link TreeNode} may be acquired by calling `TreeAlpha.branch`.\n *\n * A branch does not necessarily know the schema of its SharedTree - to convert a branch to a {@link TreeViewAlpha | view with a schema}, use {@link TreeBranchAlpha.hasRootSchema | hasRootSchema()}.\n * @sealed @alpha\n */\nexport interface TreeBranchAlpha extends TreeBranch {\n\t/**\n\t * Events for the branch\n\t */\n\treadonly events: Listenable<TreeBranchEvents>;\n\n\t/**\n\t * Returns true if this branch has the given schema as its root schema.\n\t * @remarks This is a type guard which allows this branch to become strongly typed as a {@link TreeViewAlpha | view} of the given schema.\n\t *\n\t * To succeed, the given schema must be invariant to the schema of the view - it must include exactly the same allowed types.\n\t * For example, a schema of `Foo | Bar` will not match a view schema of `Foo`, and likewise a schema of `Foo` will not match a view schema of `Foo | Bar`.\n\t * @example\n\t * ```typescript\n\t * if (branch.hasRootSchema(MySchema)) {\n\t * const { root } = branch; // `branch` is now a TreeViewAlpha<MySchema>\n\t * // ...\n\t * }\n\t * ```\n\t */\n\thasRootSchema<TSchema extends ImplicitFieldSchema>(\n\t\tschema: TSchema,\n\t): this is TreeViewAlpha<TSchema>;\n\n\t// Override the base fork method to return the alpha variant.\n\tfork(): TreeBranchAlpha;\n\n\t/**\n\t * Run a transaction which applies one or more edits to the tree as a single atomic unit.\n\t * @param transaction - The function to run as the body of the transaction.\n\t * It should return a status object of {@link TransactionCallbackStatus | TransactionCallbackStatus } type.\n\t * It includes a \"rollback\" property which may be returned as true at any point during the transaction. This will\n\t * abort the transaction and discard any changes it made so far.\n\t * \"rollback\" can be set to false or left undefined to indicate that the body of the transaction has successfully run.\n\t * @param params - The optional parameters for the transaction. It includes the constraints that will be checked before the transaction begins.\n\t * @returns A result object of {@link TransactionResultExt | TransactionResultExt} type. It includes the following:\n\t *\n\t * - A \"success\" flag indicating whether the transaction was successful or not.\n\t * - The success or failure value as returned by the transaction function.\n\t *\n\t * @remarks\n\t * This API will throw an error if the constraints are not met or something unexpected happens.\n\t * All of the changes in the transaction are applied synchronously and therefore no other changes (either from this client or from a remote client) can be interleaved with those changes.\n\t * Note that this is guaranteed by Fluid for any sequence of changes that are submitted synchronously, whether in a transaction or not.\n\t * However, using a transaction has the following additional consequences:\n\t *\n\t * - If reverted (e.g. via an \"undo\" operation), all the changes in the transaction are reverted together.\n\t * - The internal data representation of a transaction with many changes is generally smaller and more efficient than that of the changes when separate.\n\t *\n\t * Local change events will be emitted for each change as the transaction is being applied.\n\t * If the transaction is rolled back, a corresponding change event will also be emitted for the rollback.\n\t *\n\t * Nested transactions:\n\t * This API can be called from within the transaction callback of another runTransaction call. That will have slightly different behavior:\n\t *\n\t * - If the inner transaction fails, only the inner transaction will be rolled back and the outer transaction will continue.\n\t * - Constraints will apply to the outermost transaction. Constraints are applied per commit and there will be one commit generated\n\t * for the outermost transaction which includes all inner transactions.\n\t * - Undo will undo the outermost transaction and all inner transactions.\n\t */\n\trunTransaction<TSuccessValue, TFailureValue>(\n\t\ttransaction: () => TransactionCallbackStatus<TSuccessValue, TFailureValue>,\n\t\tparams?: RunTransactionParams,\n\t): TransactionResultExt<TSuccessValue, TFailureValue>;\n\t/**\n\t * Run a transaction which applies one or more edits to the tree as a single atomic unit.\n\t * @param transaction - The function to run as the body of the transaction. It may return the following:\n\t *\n\t * - Nothing to indicate that the body of the transaction has successfully run.\n\t * - A status object of {@link VoidTransactionCallbackStatus | VoidTransactionCallbackStatus } type. It includes a \"rollback\" property which\n\t * may be returned as true at any point during the transaction. This will abort the transaction and discard any changes it made so\n\t * far. \"rollback\" can be set to false or left undefined to indicate that the body of the transaction has successfully run.\n\t *\n\t * @param params - The optional parameters for the transaction. It includes the constraints that will be checked before the transaction begins.\n\t * @returns A result object of {@link TransactionResult | TransactionResult} type. It includes a \"success\" flag indicating whether the\n\t * transaction was successful or not.\n\t *\n\t * @remarks\n\t * This API will throw an error if the constraints are not met or something unexpected happens.\n\t * All of the changes in the transaction are applied synchronously and therefore no other changes (either from this client or from a remote client) can be interleaved with those changes.\n\t * Note that this is guaranteed by Fluid for any sequence of changes that are submitted synchronously, whether in a transaction or not.\n\t * However, using a transaction has the following additional consequences:\n\t *\n\t * - If reverted (e.g. via an \"undo\" operation), all the changes in the transaction are reverted together.\n\t * - The internal data representation of a transaction with many changes is generally smaller and more efficient than that of the changes when separate.\n\t *\n\t * Local change events will be emitted for each change as the transaction is being applied.\n\t * If the transaction is rolled back, a corresponding change event will also be emitted for the rollback.\n\t *\n\t * Nested transactions:\n\t * This API can be called from within the transaction callback of another runTransaction call. That will have slightly different behavior:\n\t *\n\t * - If the inner transaction fails, only the inner transaction will be rolled back and the outer transaction will continue.\n\t * - Constraints will apply to the outermost transaction. Constraints are applied per commit and there will be one commit generated\n\t * for the outermost transaction which includes all inner transactions.\n\t * - Undo will undo the outermost transaction and all inner transactions.\n\t */\n\trunTransaction(\n\t\ttransaction: () => VoidTransactionCallbackStatus | void,\n\t\tparams?: RunTransactionParams,\n\t): TransactionResult;\n}\n\n/**\n * An editable view of a (version control style) branch of a shared tree based on some schema.\n *\n * @remarks\n * This schema (known as the view schema) may or may not align with the stored schema of the document.\n * Information about discrepancies between the two schemas is available via {@link TreeView.compatibility | compatibility}.\n *\n * Application authors are encouraged to read {@link https://github.com/microsoft/FluidFramework/blob/main/packages/dds/tree/docs/user-facing/schema-evolution.md | schema-evolution.md}\n * and choose a schema compatibility policy that aligns with their application's needs.\n *\n * @privateRemarks\n * From an API design perspective, `upgradeSchema` could be merged into `viewWith` and/or `viewWith` could return errors explicitly on incompatible documents.\n * Such approaches would make it discoverable that out of schema handling may need to be done.\n * Doing that would however complicate trivial \"hello world\" style example slightly, as well as be a breaking API change.\n * It also seems more complex to handle invalidation with that pattern.\n * Thus this design was chosen at the risk of apps blindly accessing `root` then breaking unexpectedly when the document is incompatible.\n *\n * @see {@link TreeViewAlpha}\n * @see {@link asTreeViewAlpha}\n *\n * @sealed @public\n */\nexport interface TreeView<in out TSchema extends ImplicitFieldSchema> extends IDisposable {\n\t/**\n\t * The current root of the tree.\n\t *\n\t * If the view schema not sufficiently compatible with the stored schema, accessing this will throw.\n\t * To handle this case, check {@link TreeView.compatibility | compatibility}'s {@link SchemaCompatibilityStatus.canView | canView} before using.\n\t *\n\t * To get notified about changes to this field,\n\t * use {@link TreeViewEvents.rootChanged} via `view.events.on(\"rootChanged\", callback)`.\n\t *\n\t * To get notified about changes to stored schema (which may affect compatibility between this view's schema and\n\t * the stored schema), use {@link TreeViewEvents.schemaChanged} via `view.events.on(\"schemaChanged\", callback)`.\n\t */\n\tget root(): TreeFieldFromImplicitField<TSchema>;\n\n\tset root(newRoot: InsertableTreeFieldFromImplicitField<TSchema>);\n\n\t/**\n\t * Description of the current compatibility status between the view schema and stored schema.\n\t *\n\t * {@link TreeViewEvents.schemaChanged} is fired when the compatibility status changes.\n\t */\n\treadonly compatibility: SchemaCompatibilityStatus;\n\n\t/**\n\t * When {@link SchemaCompatibilityStatus.canUpgrade} is true,\n\t * this can be used to modify the stored schema to make it match the view schema.\n\t * @remarks\n\t * This will update the {@link TreeView.compatibility}, allowing access to `root`.\n\t * Beware that this may impact other clients' ability to view the document: see {@link SchemaCompatibilityStatus.canView} for more information.\n\t *\n\t * It is an error to call this when {@link SchemaCompatibilityStatus.canUpgrade} is false.\n\t * {@link SchemaCompatibilityStatus.canUpgrade} being true does not mean that an upgrade is required, nor that an upgrade will have any effect.\n\t * @privateRemarks\n\t * In the future, more upgrade options could be provided here.\n\t * Some options that could be added:\n\t * - check the actual document contents (not just the schema) and attempt an atomic document update if the data is compatible.\n\t * - apply converters and upgrade the document.\n\t * - apply converters to lazily to adapt the document to the requested view schema (with optional lazy schema updates or transparent conversions on write).\n\t * - update only a specific change (add an optional field, or apply a staged upgrade)\n\t * - update persistedMetadata or not\n\t *\n\t * As persisted metadata becomes more supported, how it interacts with isEquivalent and upgradeSchema should be clarified:\n\t * for now the docs are being left somewhat vague to allow flexibility in this area.\n\t */\n\tupgradeSchema(): void;\n\n\t/**\n\t * Initialize the tree, setting the stored schema to match this view's schema and setting the tree content.\n\t *\n\t * Only valid to call when this view's {@link SchemaCompatibilityStatus.canInitialize} is true.\n\t *\n\t * Applications should typically call this function before attaching a `SharedTree`.\n\t * @param content - The content to initialize the tree with.\n\t */\n\tinitialize(content: InsertableTreeFieldFromImplicitField<TSchema>): void;\n\n\t/**\n\t * Events for the tree.\n\t */\n\treadonly events: Listenable<TreeViewEvents>;\n\n\t/**\n\t * The view schema used by this TreeView.\n\t */\n\treadonly schema: TSchema;\n}\n\n/**\n * {@link TreeView} with proposed changes to the schema aware typing to allow use with `UnsafeUnknownSchema`.\n * @sealed @alpha\n */\nexport interface TreeViewAlpha<\n\tin out TSchema extends ImplicitFieldSchema | UnsafeUnknownSchema,\n> extends Omit<TreeViewBeta<ReadSchema<TSchema>>, \"root\" | \"initialize\" | \"fork\">,\n\t\tTreeBranchAlpha {\n\tget root(): ReadableField<TSchema>;\n\n\tset root(newRoot: InsertableField<TSchema>);\n\n\tinitialize(content: InsertableField<TSchema>): void;\n\n\treadonly events: Listenable<TreeViewEvents & TreeBranchEvents>;\n\n\t// Override the base fork method to return a TreeViewAlpha.\n\tfork(): ReturnType<TreeBranch[\"fork\"]> & TreeViewAlpha<TSchema>;\n}\n\n/**\n * {@link TreeView} with additional beta APIs.\n * @sealed @beta\n */\nexport interface TreeViewBeta<in out TSchema extends ImplicitFieldSchema>\n\textends TreeView<TSchema>,\n\t\tTreeBranch {\n\t// Override the base branch method to return a typed view rather than merely a branch.\n\tfork(): ReturnType<TreeBranch[\"fork\"]> & TreeViewBeta<TSchema>;\n}\n\n/**\n * Information about a view schema's compatibility with the document's stored schema.\n *\n * See SharedTree's README for more information about choosing a compatibility policy.\n * @privateRemarks\n * See {@link SchemaCompatibilityTester} for the implementation of this compatibility checking.\n * @sealed @public\n */\nexport interface SchemaCompatibilityStatus {\n\t/**\n\t * Whether the view schema allows exactly the same set of documents as the stored schema.\n\t *\n\t * @remarks\n\t * Equivalence here is defined in terms of allowed documents because there are some degenerate cases where schemas are not\n\t * exact matches in a strict (schema-based) sense but still allow the same documents, and the document notion is more useful to applications.\n\t *\n\t * Examples which are expressible where this may occur include:\n\t *\n\t * - schema repository `A` has extra schema which schema `B` doesn't have, but they are unused (i.e. not reachable from the root schema)\n\t *\n\t * - field in schema `A` has allowed field members which the corresponding field in schema `B` does not have, but those types are not constructible (for example: an object node type containing a required field with no allowed types)\n\t *\n\t * These cases are typically not interesting to applications.\n\t *\n\t * Note that other content in the stored schema that does not impact document compatibility, like {@link NodeSchemaOptionsAlpha.persistedMetadata}, does not affect this field.\n\t *\n\t * For the computation of this equivalence, {@link SchemaStaticsBeta.staged | staged} schemas are not included.\n\t * If there are any unknown optional fields, even if allowed by {@link ObjectSchemaOptions.allowUnknownOptionalFields}, `isEquivalent` will be false.\n\t */\n\treadonly isEquivalent: boolean;\n\n\t/**\n\t * Whether the current view schema is sufficiently compatible with the stored schema to allow viewing tree data.\n\t * If false, {@link TreeView.root} will throw upon access.\n\t * @remarks\n\t * If the view schema does not opt into supporting any additional cases, then `canView` is only true when `isEquivalent` is also true.\n\t * The view schema can however opt into supporting additional cases, and thus can also view documents with stored schema which would be equivalent, except for the following discrepancies:\n\t *\n\t * - An object node with {@link ObjectSchemaOptions.allowUnknownOptionalFields} to set to true that has additional optional fields in the stored schema beyond those mentioned in its view schema.\n\t *\n\t * - An additional type allowed at a location in the stored schema where it is {@link SchemaStaticsBeta.staged | staged} in the view schema.\n\t *\n\t * In these cases `canUpgrade` and `isEquivalent` will be false.\n\t *\n\t * When the set of documents allowed by the view schema is a strict superset of those allowed by the stored schema,\n\t * `canView` is false because writes to the document using the view schema could make the document violate its stored schema.\n\t * In this case, the stored schema could be updated to match the provided view schema, allowing read-write access to the tree.\n\t * See {@link SchemaCompatibilityStatus.canUpgrade}.\n\t *\n\t * Future versions of SharedTree may provide readonly access to the document in this case because that would be safe,\n\t * but this is not currently supported.\n\t *\n\t * @privateRemarks\n\t * A necessary condition for this to be true is that the documents allowed by the view schema are a subset of those allowed by the stored schema.\n\t * This is not sufficient: the simple-tree layer's read APIs only tolerate very specific cases beyond their schema (unknown optional fields).\n\t * For example, if the view schema for a node has a required `Point` field but the stored schema has an optional `Point` field,\n\t * read APIs on the view schema do not work correctly when the document has a node with a missing `Point` field.\n\t * Similar issues happen when the view schema has a field with less allowed types than the stored schema and the document actually leverages those types.\n\t */\n\treadonly canView: boolean;\n\n\t/**\n\t * True when {@link TreeView.upgradeSchema} can add support for all content required to be supported by the view schema.\n\t * @remarks\n\t * When true, it is valid to call {@link TreeView.upgradeSchema} (though if the stored schema is already an exact match, this is a no-op).\n\t *\n\t * When adding optional fields to schema which previously were marked with {@link ObjectSchemaOptions.allowUnknownOptionalFields}\n\t * the schema upgrade (assuming no other changes are included) will allow the previous version to view.\n\t * Even this case must still must be done with caution however as only clients with the newly added field will be able to do future upgrades.\n\t * Thus if a version of an application is shipped that adds an unknown optional field, all future versions should include it, even if its no longer used,\n\t * to ensure that documents containing it can still be upgraded.\n\t */\n\treadonly canUpgrade: boolean;\n\n\t/**\n\t * True iff the document is uninitialized (i.e. it has no schema and no content).\n\t *\n\t * To initialize the document, call {@link TreeView.initialize}.\n\t *\n\t * @remarks\n\t * It's not necessary to check this field before calling {@link TreeView.initialize} in most scenarios; application authors typically know from\n\t * branch that they're in a flow which creates a new `SharedTree` and would like to initialize it.\n\t */\n\treadonly canInitialize: boolean;\n\n\t// TODO: Consider extending this status to include:\n\t// - application-defined metadata about the stored schema\n\t// - details about the differences between the stored and view schema sufficient for implementing \"safe mismatch\" policies\n}\n\n/**\n * Events for {@link TreeBranch}.\n * @sealed @alpha\n */\nexport interface TreeBranchEvents extends Omit<TreeViewEvents, \"commitApplied\"> {\n\t/**\n\t * Fired when a change is made to the branch. Includes data about the change that is made which listeners\n\t * can use to filter on changes they care about (e.g. local vs. remote changes).\n\t *\n\t * @param data - information about the change\n\t * @param getRevertible - a function that allows users to get a revertible for the change. If not provided,\n\t * this change is not revertible.\n\t */\n\tchanged(data: CommitMetadata, getRevertible?: RevertibleAlphaFactory): void;\n\n\t/**\n\t * Fired when:\n\t *\n\t * - a local commit is applied outside of a transaction\n\t *\n\t * - a local transaction is committed\n\t *\n\t * The event is not fired when:\n\t *\n\t * - a local commit is applied within a transaction\n\t *\n\t * - a remote commit is applied\n\t *\n\t * @param data - information about the commit that was applied\n\t * @param getRevertible - a function provided that allows users to get a revertible for the commit that was applied. If not provided,\n\t * this commit is not revertible.\n\t */\n\tcommitApplied(data: CommitMetadata, getRevertible?: RevertibleAlphaFactory): void;\n}\n\n/**\n * Events for {@link TreeView}.\n * @sealed @public\n */\nexport interface TreeViewEvents {\n\t/**\n\t * Raised whenever {@link TreeView.root} is invalidated.\n\t *\n\t * This includes changes to the document schema.\n\t * It also includes changes to the field containing the root such as setting or clearing an optional root or changing which node is the root.\n\t * This does NOT include changes to the content (fields/children) of the root node: for that case subscribe to events on the root node.\n\t */\n\trootChanged(): void;\n\n\t/**\n\t * The stored schema for the document has changed.\n\t * This may affect the compatibility between the view schema and the stored schema, and thus the ability to use the view.\n\t *\n\t * @remarks\n\t * This event implies that the old {@link TreeView.root} is no longer valid, but applications need not handle that separately:\n\t * {@link TreeViewEvents.rootChanged} will be fired after this event.\n\t */\n\tschemaChanged(): void;\n\n\t/**\n\t * Fired when:\n\t *\n\t * - a local commit is applied outside of a transaction\n\t *\n\t * - a local transaction is committed\n\t *\n\t * The event is not fired when:\n\t *\n\t * - a local commit is applied within a transaction\n\t *\n\t * - a remote commit is applied\n\t *\n\t * @param data - information about the commit that was applied\n\t * @param getRevertible - a function provided that allows users to get a revertible for the commit that was applied. If not provided,\n\t * this commit is not revertible.\n\t */\n\tcommitApplied(data: CommitMetadata, getRevertible?: RevertibleFactory): void;\n}\n\n/**\n * Retrieve the {@link TreeViewAlpha | alpha API} for a {@link TreeView}.\n * @alpha\n * @deprecated Use {@link (asAlpha:1)} instead.\n * @privateRemarks Despite being deprecated, this function should be used within the tree package (outside of tests) rather than `asAlpha` in order to avoid circular import dependencies.\n */\nexport function asTreeViewAlpha<TSchema extends ImplicitFieldSchema>(\n\tview: TreeView<TSchema>,\n): TreeViewAlpha<TSchema> {\n\treturn view as TreeViewAlpha<TSchema>;\n}\n"]}
1
+ {"version":3,"file":"tree.js","sourceRoot":"","sources":["../../../src/simple-tree/api/tree.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA4kBH;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAC9B,IAAuB;IAEvB,OAAO,IAA8B,CAAC;AACvC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IFluidLoadable, IDisposable, Listenable } from \"@fluidframework/core-interfaces\";\n\nimport type {\n\tCommitMetadata,\n\tChangeMetadata,\n\tRevertibleAlphaFactory,\n\tRevertibleFactory,\n} from \"../../core/index.js\";\nimport type {\n\t// This is referenced by doc comments.\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars, unused-imports/no-unused-imports\n\tTreeAlpha,\n} from \"../../shared-tree/index.js\";\nimport type {\n\tImplicitFieldSchema,\n\tInsertableField,\n\tInsertableTreeFieldFromImplicitField,\n\tReadableField,\n\tReadSchema,\n\tTreeFieldFromImplicitField,\n} from \"../fieldSchema.js\";\nimport type { UnsafeUnknownSchema } from \"../unsafeUnknownSchema.js\";\nimport type { SimpleTreeSchema } from \"../simpleSchema.js\";\n\nimport type { TreeViewConfiguration } from \"./configuration.js\";\nimport type {\n\tRunTransactionParams,\n\tTransactionCallbackStatus,\n\tTransactionResult,\n\tTransactionResultExt,\n\tVoidTransactionCallbackStatus,\n} from \"./transactionTypes.js\";\nimport type { VerboseTree } from \"./verboseTree.js\";\nimport type { JsonCompatibleReadOnly } from \"../../util/index.js\";\n\n/**\n * A tree from which a {@link TreeView} can be created.\n *\n * @privateRemarks\n * TODO:\n * Add stored key versions of {@link (TreeAlpha:interface).(exportVerbose:2)}, {@link (TreeAlpha:interface).(exportConcise:2)} and {@link (TreeAlpha:interface).exportCompressed} here so tree content can be accessed without a view schema.\n * Add exportSimpleSchema and exportJsonSchema methods (which should exactly match the concise format, and match the free functions for exporting view schema).\n * Maybe rename \"exportJsonSchema\" to align on \"concise\" terminology.\n * Ensure schema exporting APIs here align and reference APIs for exporting view schema to the same formats (which should include stored vs property key choice).\n * Make sure users of independentView can use these export APIs (maybe provide a reference back to the ViewableTree from the TreeView to accomplish that).\n * @system @sealed @public\n */\nexport interface ViewableTree {\n\t/**\n\t * Returns a {@link TreeView} using the provided schema.\n\t * If the stored schema is compatible with the view schema specified by `config`,\n\t * the returned {@link TreeView} will expose the root with a schema-aware API based on the provided view schema.\n\t * If the provided schema is incompatible with the stored schema, the view will instead expose a status indicating the incompatibility.\n\t *\n\t * @remarks\n\t * If the tree is uninitialized (has no schema and no content), use {@link TreeView.initialize} on the returned view to set the schema and content together.\n\t * Using `viewWith` followed by {@link TreeView.upgradeSchema} to initialize only the schema for a document is technically valid when the schema\n\t * permits trees with no content.\n\t *\n\t * Note that other clients can modify the document at any time, causing the view to change its compatibility status: see {@link TreeView.events} for how to handle invalidation in these cases.\n\t *\n\t * Only one schematized view may exist for a given ITree at a time.\n\t * If creating a second, the first must be disposed before calling `viewWith` again.\n\t *\n\t * @privateRemarks\n\t * TODO: Support adapters for handling out-of-schema data.\n\t */\n\tviewWith<TRoot extends ImplicitFieldSchema>(\n\t\tconfig: TreeViewConfiguration<TRoot>,\n\t): TreeView<TRoot>;\n}\n\n/**\n * Channel for a Fluid Tree DDS.\n * @remarks\n * Allows storing and collaboratively editing schema-aware hierarchial data.\n * @sealed @public\n */\nexport interface ITree extends ViewableTree, IFluidLoadable {}\n\n/**\n * {@link ITree} extended with some alpha APIs.\n * @sealed @alpha\n */\nexport interface ITreeAlpha extends ITree {\n\t/**\n\t * Exports root in the same format as {@link (TreeAlpha:interface).(exportVerbose:1)} using stored keys.\n\t * @remarks\n\t * This is `undefined` if and only if the root field is empty (this can only happen if the root field is optional).\n\t */\n\texportVerbose(): VerboseTree | undefined;\n\n\t/**\n\t * Exports the SimpleTreeSchema that is stored in the tree, using stored keys for object fields.\n\t * @remarks\n\t * To get the schema using property keys, use {@link getSimpleSchema} on the view schema.\n\t */\n\texportSimpleSchema(): SimpleTreeSchema;\n\n\t/**\n\t * Creates a fork of the current state of the main branch.\n\t * This new branch will be shared with and editable by all clients.\n\t */\n\tcreateSharedBranch(): string;\n\n\t/**\n\t * Returns a list of all shared branches that currently exist on this tree.\n\t * Any one of them can be checked out using {@link ITreeAlpha.viewSharedBranchWith}.\n\t */\n\tgetSharedBranchIds(): string[];\n\n\t/**\n\t * Returns a view of the tree on the specified shared branch, using the provided schema.\n\t * See {@link ViewableTree.viewWith}.\n\t */\n\tviewSharedBranchWith<TRoot extends ImplicitFieldSchema>(\n\t\tbranchId: string,\n\t\tconfig: TreeViewConfiguration<TRoot>,\n\t): TreeView<TRoot>;\n}\n\n/**\n * A collection of functionality associated with a (version-control-style) branch of a SharedTree.\n * @remarks A `TreeBranch` allows for the {@link TreeBranch.fork | creation of branches} and for those branches to later be {@link TreeBranch.merge | merged}.\n *\n * The branch associated directly with the {@link ITree | SharedTree} is the \"main\" branch, and all other branches fork (directly or transitively) from that main branch.\n * @sealed @beta\n */\nexport interface TreeBranch extends IDisposable {\n\t/**\n\t * Fork a new branch off of this branch which is based off of this branch's current state.\n\t * @remarks Any changes to the tree on the new branch will not apply to this branch until the new branch is e.g. {@link TreeBranch.merge | merged} back into this branch.\n\t * The branch should be disposed when no longer needed, either {@link TreeBranch.dispose | explicitly} or {@link TreeBranch.merge | implicitly when merging} into another branch.\n\t */\n\tfork(): TreeBranch;\n\n\t/**\n\t * Apply all the new changes on the given branch to this branch.\n\t * @param branch - a branch which was created by a call to `branch()`.\n\t * @param disposeMerged - whether or not to dispose `branch` after the merge completes.\n\t * Defaults to true.\n\t * The {@link TreeBranch | main branch} cannot be disposed - attempting to do so will have no effect.\n\t * @remarks All ongoing transactions (if any) in `branch` will be committed before the merge.\n\t */\n\tmerge(branch: TreeBranch, disposeMerged?: boolean): void;\n\n\t/**\n\t * Advance this branch forward such that all new changes on the target branch become part of this branch.\n\t * @param branch - The branch to rebase onto.\n\t * @remarks After rebasing, this branch will be \"ahead\" of the target branch, that is, its unique changes will have been recreated as if they happened after all changes on the target branch.\n\t * This method may only be called on branches produced via {@link TreeBranch.fork | branch} - attempting to rebase the main branch will throw.\n\t *\n\t * Rebasing long-lived branches is important to avoid consuming memory unnecessarily.\n\t * In particular, the SharedTree retains all sequenced changes made to the tree since the \"most-behind\" branch was created or last rebased.\n\t *\n\t * The {@link TreeBranch | main branch} cannot be rebased onto another branch - attempting to do so will throw an error.\n\t */\n\trebaseOnto(branch: TreeBranch): void;\n\n\t/**\n\t * Dispose of this branch, cleaning up any resources associated with it.\n\t * @param error - Optional error indicating the reason for the disposal, if the object was disposed as the result of an error.\n\t * @remarks Branches can also be automatically disposed when {@link TreeBranch.merge | they are merged} into another branch.\n\t *\n\t * Disposing branches is important to avoid consuming memory unnecessarily.\n\t * In particular, the SharedTree retains all sequenced changes made to the tree since the \"most-behind\" branch was created or last {@link TreeBranch.rebaseOnto | rebased}.\n\t *\n\t * The {@link TreeBranch | main branch} cannot be disposed - attempting to do so will have no effect.\n\t */\n\tdispose(error?: Error): void;\n}\n\n/**\n * {@link TreeBranch} with alpha-level APIs.\n * @remarks\n * The `TreeBranch` for a specific {@link TreeNode} may be acquired by calling `TreeAlpha.branch`.\n *\n * A branch does not necessarily know the schema of its SharedTree - to convert a branch to a {@link TreeViewAlpha | view with a schema}, use {@link TreeBranchAlpha.hasRootSchema | hasRootSchema()}.\n * @sealed @alpha\n */\nexport interface TreeBranchAlpha extends TreeBranch {\n\t/**\n\t * Events for the branch\n\t */\n\treadonly events: Listenable<TreeBranchEvents>;\n\n\t/**\n\t * Returns true if this branch has the given schema as its root schema.\n\t * @remarks This is a type guard which allows this branch to become strongly typed as a {@link TreeViewAlpha | view} of the given schema.\n\t *\n\t * To succeed, the given schema must be invariant to the schema of the view - it must include exactly the same allowed types.\n\t * For example, a schema of `Foo | Bar` will not match a view schema of `Foo`, and likewise a schema of `Foo` will not match a view schema of `Foo | Bar`.\n\t * @example\n\t * ```typescript\n\t * if (branch.hasRootSchema(MySchema)) {\n\t * const { root } = branch; // `branch` is now a TreeViewAlpha<MySchema>\n\t * // ...\n\t * }\n\t * ```\n\t */\n\thasRootSchema<TSchema extends ImplicitFieldSchema>(\n\t\tschema: TSchema,\n\t): this is TreeViewAlpha<TSchema>;\n\n\t// Override the base fork method to return the alpha variant.\n\tfork(): TreeBranchAlpha;\n\n\t/**\n\t * Run a transaction which applies one or more edits to the tree as a single atomic unit.\n\t * @param transaction - The function to run as the body of the transaction.\n\t * It should return a status object of {@link TransactionCallbackStatus | TransactionCallbackStatus } type.\n\t * It includes a \"rollback\" property which may be returned as true at any point during the transaction. This will\n\t * abort the transaction and discard any changes it made so far.\n\t * \"rollback\" can be set to false or left undefined to indicate that the body of the transaction has successfully run.\n\t * @param params - The optional parameters for the transaction. It includes the constraints that will be checked before the transaction begins.\n\t * @returns A result object of {@link TransactionResultExt | TransactionResultExt} type. It includes the following:\n\t *\n\t * - A \"success\" flag indicating whether the transaction was successful or not.\n\t * - The success or failure value as returned by the transaction function.\n\t *\n\t * @remarks\n\t * This API will throw an error if the constraints are not met or something unexpected happens.\n\t * All of the changes in the transaction are applied synchronously and therefore no other changes (either from this client or from a remote client) can be interleaved with those changes.\n\t * Note that this is guaranteed by Fluid for any sequence of changes that are submitted synchronously, whether in a transaction or not.\n\t * However, using a transaction has the following additional consequences:\n\t *\n\t * - If reverted (e.g. via an \"undo\" operation), all the changes in the transaction are reverted together.\n\t * - The internal data representation of a transaction with many changes is generally smaller and more efficient than that of the changes when separate.\n\t *\n\t * Local change events will be emitted for each change as the transaction is being applied.\n\t * If the transaction is rolled back, a corresponding change event will also be emitted for the rollback.\n\t *\n\t * Nested transactions:\n\t * This API can be called from within the transaction callback of another runTransaction call. That will have slightly different behavior:\n\t *\n\t * - If the inner transaction fails, only the inner transaction will be rolled back and the outer transaction will continue.\n\t * - Constraints will apply to the outermost transaction. Constraints are applied per commit and there will be one commit generated\n\t * for the outermost transaction which includes all inner transactions.\n\t * - Undo will undo the outermost transaction and all inner transactions.\n\t */\n\trunTransaction<TSuccessValue, TFailureValue>(\n\t\ttransaction: () => TransactionCallbackStatus<TSuccessValue, TFailureValue>,\n\t\tparams?: RunTransactionParams,\n\t): TransactionResultExt<TSuccessValue, TFailureValue>;\n\t/**\n\t * Run a transaction which applies one or more edits to the tree as a single atomic unit.\n\t * @param transaction - The function to run as the body of the transaction. It may return the following:\n\t *\n\t * - Nothing to indicate that the body of the transaction has successfully run.\n\t * - A status object of {@link VoidTransactionCallbackStatus | VoidTransactionCallbackStatus } type. It includes a \"rollback\" property which\n\t * may be returned as true at any point during the transaction. This will abort the transaction and discard any changes it made so\n\t * far. \"rollback\" can be set to false or left undefined to indicate that the body of the transaction has successfully run.\n\t *\n\t * @param params - The optional parameters for the transaction. It includes the constraints that will be checked before the transaction begins.\n\t * @returns A result object of {@link TransactionResult | TransactionResult} type. It includes a \"success\" flag indicating whether the\n\t * transaction was successful or not.\n\t *\n\t * @remarks\n\t * This API will throw an error if the constraints are not met or something unexpected happens.\n\t * All of the changes in the transaction are applied synchronously and therefore no other changes (either from this client or from a remote client) can be interleaved with those changes.\n\t * Note that this is guaranteed by Fluid for any sequence of changes that are submitted synchronously, whether in a transaction or not.\n\t * However, using a transaction has the following additional consequences:\n\t *\n\t * - If reverted (e.g. via an \"undo\" operation), all the changes in the transaction are reverted together.\n\t * - The internal data representation of a transaction with many changes is generally smaller and more efficient than that of the changes when separate.\n\t *\n\t * Local change events will be emitted for each change as the transaction is being applied.\n\t * If the transaction is rolled back, a corresponding change event will also be emitted for the rollback.\n\t *\n\t * Nested transactions:\n\t * This API can be called from within the transaction callback of another runTransaction call. That will have slightly different behavior:\n\t *\n\t * - If the inner transaction fails, only the inner transaction will be rolled back and the outer transaction will continue.\n\t * - Constraints will apply to the outermost transaction. Constraints are applied per commit and there will be one commit generated\n\t * for the outermost transaction which includes all inner transactions.\n\t * - Undo will undo the outermost transaction and all inner transactions.\n\t */\n\trunTransaction(\n\t\ttransaction: () => VoidTransactionCallbackStatus | void,\n\t\tparams?: RunTransactionParams,\n\t): TransactionResult;\n\n\t/**\n\t * Apply a serialized change to this branch.\n\t * @param change - the change to apply.\n\t * Changes are acquired via `getChange` in a branch's {@link TreeBranchEvents.changed | \"changed\"} event.\n\t * @remarks Changes may only be applied to a SharedTree with the same IdCompressor instance and branch state from which they were generated.\n\t * They may be created by one branch and applied to another, but only if both branches share the same history at the time of creation and application.\n\t *\n\t * @privateRemarks\n\t * TODO: This method will support applying changes from different IdCompressor instances as long as they have the same local session ID.\n\t * Update the tests and docs to match when that is done.\n\t */\n\tapplyChange(change: JsonCompatibleReadOnly): void;\n}\n\n/**\n * An editable view of a (version control style) branch of a shared tree based on some schema.\n *\n * @remarks\n * This schema (known as the view schema) may or may not align with the stored schema of the document.\n * Information about discrepancies between the two schemas is available via {@link TreeView.compatibility | compatibility}.\n *\n * Application authors are encouraged to read {@link https://github.com/microsoft/FluidFramework/blob/main/packages/dds/tree/docs/user-facing/schema-evolution.md | schema-evolution.md}\n * and choose a schema compatibility policy that aligns with their application's needs.\n *\n * @privateRemarks\n * From an API design perspective, `upgradeSchema` could be merged into `viewWith` and/or `viewWith` could return errors explicitly on incompatible documents.\n * Such approaches would make it discoverable that out of schema handling may need to be done.\n * Doing that would however complicate trivial \"hello world\" style example slightly, as well as be a breaking API change.\n * It also seems more complex to handle invalidation with that pattern.\n * Thus this design was chosen at the risk of apps blindly accessing `root` then breaking unexpectedly when the document is incompatible.\n *\n * @see {@link TreeViewAlpha}\n * @see {@link asTreeViewAlpha}\n *\n * @sealed @public\n */\nexport interface TreeView<in out TSchema extends ImplicitFieldSchema> extends IDisposable {\n\t/**\n\t * The current root of the tree.\n\t *\n\t * If the view schema not sufficiently compatible with the stored schema, accessing this will throw.\n\t * To handle this case, check {@link TreeView.compatibility | compatibility}'s {@link SchemaCompatibilityStatus.canView | canView} before using.\n\t *\n\t * To get notified about changes to this field,\n\t * use {@link TreeViewEvents.rootChanged} via `view.events.on(\"rootChanged\", callback)`.\n\t *\n\t * To get notified about changes to stored schema (which may affect compatibility between this view's schema and\n\t * the stored schema), use {@link TreeViewEvents.schemaChanged} via `view.events.on(\"schemaChanged\", callback)`.\n\t */\n\tget root(): TreeFieldFromImplicitField<TSchema>;\n\n\tset root(newRoot: InsertableTreeFieldFromImplicitField<TSchema>);\n\n\t/**\n\t * Description of the current compatibility status between the view schema and stored schema.\n\t *\n\t * {@link TreeViewEvents.schemaChanged} is fired when the compatibility status changes.\n\t */\n\treadonly compatibility: SchemaCompatibilityStatus;\n\n\t/**\n\t * When {@link SchemaCompatibilityStatus.canUpgrade} is true,\n\t * this can be used to modify the stored schema to make it match the view schema.\n\t * @remarks\n\t * This will update the {@link TreeView.compatibility}, allowing access to `root`.\n\t * Beware that this may impact other clients' ability to view the document: see {@link SchemaCompatibilityStatus.canView} for more information.\n\t *\n\t * It is an error to call this when {@link SchemaCompatibilityStatus.canUpgrade} is false.\n\t * {@link SchemaCompatibilityStatus.canUpgrade} being true does not mean that an upgrade is required, nor that an upgrade will have any effect.\n\t * @privateRemarks\n\t * In the future, more upgrade options could be provided here.\n\t * Some options that could be added:\n\t * - check the actual document contents (not just the schema) and attempt an atomic document update if the data is compatible.\n\t * - apply converters and upgrade the document.\n\t * - apply converters to lazily to adapt the document to the requested view schema (with optional lazy schema updates or transparent conversions on write).\n\t * - update only a specific change (add an optional field, or apply a staged upgrade)\n\t * - update persistedMetadata or not\n\t *\n\t * As persisted metadata becomes more supported, how it interacts with isEquivalent and upgradeSchema should be clarified:\n\t * for now the docs are being left somewhat vague to allow flexibility in this area.\n\t */\n\tupgradeSchema(): void;\n\n\t/**\n\t * Initialize the tree, setting the stored schema to match this view's schema and setting the tree content.\n\t *\n\t * Only valid to call when this view's {@link SchemaCompatibilityStatus.canInitialize} is true.\n\t *\n\t * Applications should typically call this function before attaching a `SharedTree`.\n\t * @param content - The content to initialize the tree with.\n\t */\n\tinitialize(content: InsertableTreeFieldFromImplicitField<TSchema>): void;\n\n\t/**\n\t * Events for the tree.\n\t */\n\treadonly events: Listenable<TreeViewEvents>;\n\n\t/**\n\t * The view schema used by this TreeView.\n\t */\n\treadonly schema: TSchema;\n}\n\n/**\n * {@link TreeView} with proposed changes to the schema aware typing to allow use with `UnsafeUnknownSchema`.\n * @sealed @alpha\n */\nexport interface TreeViewAlpha<\n\tin out TSchema extends ImplicitFieldSchema | UnsafeUnknownSchema,\n> extends Omit<TreeViewBeta<ReadSchema<TSchema>>, \"root\" | \"initialize\" | \"fork\">,\n\t\tTreeBranchAlpha {\n\tget root(): ReadableField<TSchema>;\n\n\tset root(newRoot: InsertableField<TSchema>);\n\n\tinitialize(content: InsertableField<TSchema>): void;\n\n\treadonly events: Listenable<TreeViewEvents & TreeBranchEvents>;\n\n\t// Override the base fork method to return a TreeViewAlpha.\n\tfork(): ReturnType<TreeBranch[\"fork\"]> & TreeViewAlpha<TSchema>;\n}\n\n/**\n * {@link TreeView} with additional beta APIs.\n * @sealed @beta\n */\nexport interface TreeViewBeta<in out TSchema extends ImplicitFieldSchema>\n\textends TreeView<TSchema>,\n\t\tTreeBranch {\n\t// Override the base branch method to return a typed view rather than merely a branch.\n\tfork(): ReturnType<TreeBranch[\"fork\"]> & TreeViewBeta<TSchema>;\n}\n\n/**\n * Information about a view schema's compatibility with the document's stored schema.\n *\n * See SharedTree's README for more information about choosing a compatibility policy.\n * @privateRemarks\n * See {@link SchemaCompatibilityTester} for the implementation of this compatibility checking.\n * @sealed @public\n */\nexport interface SchemaCompatibilityStatus {\n\t/**\n\t * Whether the view schema allows exactly the same set of documents as the stored schema.\n\t *\n\t * @remarks\n\t * Equivalence here is defined in terms of allowed documents because there are some degenerate cases where schemas are not\n\t * exact matches in a strict (schema-based) sense but still allow the same documents, and the document notion is more useful to applications.\n\t *\n\t * Examples which are expressible where this may occur include:\n\t *\n\t * - schema repository `A` has extra schema which schema `B` doesn't have, but they are unused (i.e. not reachable from the root schema)\n\t *\n\t * - field in schema `A` has allowed field members which the corresponding field in schema `B` does not have, but those types are not constructible (for example: an object node type containing a required field with no allowed types)\n\t *\n\t * These cases are typically not interesting to applications.\n\t *\n\t * Note that other content in the stored schema that does not impact document compatibility, like {@link NodeSchemaOptionsAlpha.persistedMetadata}, does not affect this field.\n\t *\n\t * For the computation of this equivalence, {@link SchemaStaticsBeta.staged | staged} schemas are not included.\n\t * If there are any unknown optional fields, even if allowed by {@link ObjectSchemaOptions.allowUnknownOptionalFields}, `isEquivalent` will be false.\n\t */\n\treadonly isEquivalent: boolean;\n\n\t/**\n\t * Whether the current view schema is sufficiently compatible with the stored schema to allow viewing tree data.\n\t * If false, {@link TreeView.root} will throw upon access.\n\t * @remarks\n\t * If the view schema does not opt into supporting any additional cases, then `canView` is only true when `isEquivalent` is also true.\n\t * The view schema can however opt into supporting additional cases, and thus can also view documents with stored schema which would be equivalent, except for the following discrepancies:\n\t *\n\t * - An object node with {@link ObjectSchemaOptions.allowUnknownOptionalFields} to set to true that has additional optional fields in the stored schema beyond those mentioned in its view schema.\n\t *\n\t * - An additional type allowed at a location in the stored schema where it is {@link SchemaStaticsBeta.staged | staged} in the view schema.\n\t *\n\t * In these cases `canUpgrade` and `isEquivalent` will be false.\n\t *\n\t * When the set of documents allowed by the view schema is a strict superset of those allowed by the stored schema,\n\t * `canView` is false because writes to the document using the view schema could make the document violate its stored schema.\n\t * In this case, the stored schema could be updated to match the provided view schema, allowing read-write access to the tree.\n\t * See {@link SchemaCompatibilityStatus.canUpgrade}.\n\t *\n\t * Future versions of SharedTree may provide readonly access to the document in this case because that would be safe,\n\t * but this is not currently supported.\n\t *\n\t * @privateRemarks\n\t * A necessary condition for this to be true is that the documents allowed by the view schema are a subset of those allowed by the stored schema.\n\t * This is not sufficient: the simple-tree layer's read APIs only tolerate very specific cases beyond their schema (unknown optional fields).\n\t * For example, if the view schema for a node has a required `Point` field but the stored schema has an optional `Point` field,\n\t * read APIs on the view schema do not work correctly when the document has a node with a missing `Point` field.\n\t * Similar issues happen when the view schema has a field with less allowed types than the stored schema and the document actually leverages those types.\n\t */\n\treadonly canView: boolean;\n\n\t/**\n\t * True when {@link TreeView.upgradeSchema} can add support for all content required to be supported by the view schema.\n\t * @remarks\n\t * When true, it is valid to call {@link TreeView.upgradeSchema} (though if the stored schema is already an exact match, this is a no-op).\n\t *\n\t * When adding optional fields to schema which previously were marked with {@link ObjectSchemaOptions.allowUnknownOptionalFields}\n\t * the schema upgrade (assuming no other changes are included) will allow the previous version to view.\n\t * Even this case must still must be done with caution however as only clients with the newly added field will be able to do future upgrades.\n\t * Thus if a version of an application is shipped that adds an unknown optional field, all future versions should include it, even if its no longer used,\n\t * to ensure that documents containing it can still be upgraded.\n\t */\n\treadonly canUpgrade: boolean;\n\n\t/**\n\t * True iff the document is uninitialized (i.e. it has no schema and no content).\n\t *\n\t * To initialize the document, call {@link TreeView.initialize}.\n\t *\n\t * @remarks\n\t * It's not necessary to check this field before calling {@link TreeView.initialize} in most scenarios; application authors typically know from\n\t * branch that they're in a flow which creates a new `SharedTree` and would like to initialize it.\n\t */\n\treadonly canInitialize: boolean;\n\n\t// TODO: Consider extending this status to include:\n\t// - application-defined metadata about the stored schema\n\t// - details about the differences between the stored and view schema sufficient for implementing \"safe mismatch\" policies\n}\n\n/**\n * Events for {@link TreeBranch}.\n * @sealed @alpha\n */\nexport interface TreeBranchEvents extends Omit<TreeViewEvents, \"commitApplied\"> {\n\t/**\n\t * Fired when a change is made to the branch. Includes data about the change that is made which listeners\n\t * can use to filter on changes they care about (e.g. local vs. remote changes).\n\t *\n\t * @param data - information about the change\n\t * @param getRevertible - a function that allows users to get a revertible for the change. If not provided,\n\t * this change is not revertible.\n\t */\n\tchanged(data: ChangeMetadata, getRevertible?: RevertibleAlphaFactory): void;\n\n\t/**\n\t * Fired when:\n\t *\n\t * - a local commit is applied outside of a transaction\n\t *\n\t * - a local transaction is committed\n\t *\n\t * The event is not fired when:\n\t *\n\t * - a local commit is applied within a transaction\n\t *\n\t * - a remote commit is applied\n\t *\n\t * @param data - information about the commit that was applied\n\t * @param getRevertible - a function provided that allows users to get a revertible for the commit that was applied. If not provided,\n\t * this commit is not revertible.\n\t */\n\tcommitApplied(data: CommitMetadata, getRevertible?: RevertibleAlphaFactory): void;\n}\n\n/**\n * Events for {@link TreeView}.\n * @sealed @public\n */\nexport interface TreeViewEvents {\n\t/**\n\t * Raised whenever {@link TreeView.root} is invalidated.\n\t *\n\t * This includes changes to the document schema.\n\t * It also includes changes to the field containing the root such as setting or clearing an optional root or changing which node is the root.\n\t * This does NOT include changes to the content (fields/children) of the root node: for that case subscribe to events on the root node.\n\t */\n\trootChanged(): void;\n\n\t/**\n\t * The stored schema for the document has changed.\n\t * This may affect the compatibility between the view schema and the stored schema, and thus the ability to use the view.\n\t *\n\t * @remarks\n\t * This event implies that the old {@link TreeView.root} is no longer valid, but applications need not handle that separately:\n\t * {@link TreeViewEvents.rootChanged} will be fired after this event.\n\t */\n\tschemaChanged(): void;\n\n\t/**\n\t * Fired when:\n\t *\n\t * - a local commit is applied outside of a transaction\n\t *\n\t * - a local transaction is committed\n\t *\n\t * The event is not fired when:\n\t *\n\t * - a local commit is applied within a transaction\n\t *\n\t * - a remote commit is applied\n\t *\n\t * @param data - information about the commit that was applied\n\t * @param getRevertible - a function provided that allows users to get a revertible for the commit that was applied. If not provided,\n\t * this commit is not revertible.\n\t */\n\tcommitApplied(data: CommitMetadata, getRevertible?: RevertibleFactory): void;\n}\n\n/**\n * Retrieve the {@link TreeViewAlpha | alpha API} for a {@link TreeView}.\n * @alpha\n * @deprecated Use {@link (asAlpha:1)} instead.\n * @privateRemarks Despite being deprecated, this function should be used within the tree package (outside of tests) rather than `asAlpha` in order to avoid circular import dependencies.\n */\nexport function asTreeViewAlpha<TSchema extends ImplicitFieldSchema>(\n\tview: TreeView<TSchema>,\n): TreeViewAlpha<TSchema> {\n\treturn view as TreeViewAlpha<TSchema>;\n}\n"]}
@@ -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