@fluidframework/tree 2.41.0-338186 → 2.41.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 (1205) hide show
  1. package/CHANGELOG.md +341 -0
  2. package/api-report/tree.alpha.api.md +174 -4
  3. package/dist/alpha.d.ts +3 -0
  4. package/dist/codec/codec.d.ts +52 -7
  5. package/dist/codec/codec.d.ts.map +1 -1
  6. package/dist/codec/codec.js +60 -8
  7. package/dist/codec/codec.js.map +1 -1
  8. package/dist/core/change-family/editBuilder.d.ts.map +1 -1
  9. package/dist/core/change-family/editBuilder.js.map +1 -1
  10. package/dist/core/forest/forest.d.ts.map +1 -1
  11. package/dist/core/forest/forest.js.map +1 -1
  12. package/dist/core/index.d.ts +1 -1
  13. package/dist/core/index.d.ts.map +1 -1
  14. package/dist/core/index.js +2 -1
  15. package/dist/core/index.js.map +1 -1
  16. package/dist/core/rebase/types.d.ts +2 -2
  17. package/dist/core/rebase/types.js +2 -2
  18. package/dist/core/rebase/types.js.map +1 -1
  19. package/dist/core/rebase/utils.d.ts +0 -2
  20. package/dist/core/rebase/utils.d.ts.map +1 -1
  21. package/dist/core/rebase/utils.js +6 -10
  22. package/dist/core/rebase/utils.js.map +1 -1
  23. package/dist/core/schema-stored/formatV1.d.ts +0 -1
  24. package/dist/core/schema-stored/formatV1.d.ts.map +1 -1
  25. package/dist/core/schema-stored/formatV1.js +1 -2
  26. package/dist/core/schema-stored/formatV1.js.map +1 -1
  27. package/dist/core/schema-stored/index.d.ts +1 -1
  28. package/dist/core/schema-stored/index.d.ts.map +1 -1
  29. package/dist/core/schema-stored/index.js +2 -1
  30. package/dist/core/schema-stored/index.js.map +1 -1
  31. package/dist/core/schema-stored/schema.d.ts +6 -0
  32. package/dist/core/schema-stored/schema.d.ts.map +1 -1
  33. package/dist/core/schema-stored/schema.js +8 -1
  34. package/dist/core/schema-stored/schema.js.map +1 -1
  35. package/dist/core/schema-stored/storedSchemaRepository.d.ts +1 -1
  36. package/dist/core/schema-stored/storedSchemaRepository.d.ts.map +1 -1
  37. package/dist/core/schema-stored/storedSchemaRepository.js +1 -1
  38. package/dist/core/schema-stored/storedSchemaRepository.js.map +1 -1
  39. package/dist/core/tree/anchorSet.d.ts +2 -1
  40. package/dist/core/tree/anchorSet.d.ts.map +1 -1
  41. package/dist/core/tree/anchorSet.js +4 -3
  42. package/dist/core/tree/anchorSet.js.map +1 -1
  43. package/dist/core/tree/chunk.d.ts.map +1 -1
  44. package/dist/core/tree/chunk.js.map +1 -1
  45. package/dist/core/tree/delta.d.ts.map +1 -1
  46. package/dist/core/tree/delta.js.map +1 -1
  47. package/dist/core/tree/deltaUtil.d.ts.map +1 -1
  48. package/dist/core/tree/deltaUtil.js.map +1 -1
  49. package/dist/core/tree/detachedFieldIndex.d.ts +1 -1
  50. package/dist/core/tree/detachedFieldIndex.d.ts.map +1 -1
  51. package/dist/core/tree/detachedFieldIndex.js.map +1 -1
  52. package/dist/core/tree/detachedFieldIndexCodec.d.ts +1 -1
  53. package/dist/core/tree/detachedFieldIndexCodec.d.ts.map +1 -1
  54. package/dist/core/tree/detachedFieldIndexCodec.js +1 -1
  55. package/dist/core/tree/detachedFieldIndexCodec.js.map +1 -1
  56. package/dist/core/tree/pathTree.d.ts +12 -11
  57. package/dist/core/tree/pathTree.d.ts.map +1 -1
  58. package/dist/core/tree/pathTree.js +8 -7
  59. package/dist/core/tree/pathTree.js.map +1 -1
  60. package/dist/core/tree/treeTextFormat.d.ts +1 -1
  61. package/dist/core/tree/treeTextFormat.d.ts.map +1 -1
  62. package/dist/core/tree/treeTextFormat.js +1 -1
  63. package/dist/core/tree/treeTextFormat.js.map +1 -1
  64. package/dist/core/tree/visitDelta.d.ts +1 -1
  65. package/dist/core/tree/visitDelta.d.ts.map +1 -1
  66. package/dist/core/tree/visitDelta.js.map +1 -1
  67. package/dist/core/tree/visitorUtils.d.ts +2 -2
  68. package/dist/core/tree/visitorUtils.d.ts.map +1 -1
  69. package/dist/core/tree/visitorUtils.js.map +1 -1
  70. package/dist/feature-libraries/chunked-forest/chunkTree.d.ts +1 -1
  71. package/dist/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  72. package/dist/feature-libraries/chunked-forest/chunkTree.js +1 -1
  73. package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  74. package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts +2 -2
  75. package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  76. package/dist/feature-libraries/chunked-forest/chunkedForest.js +2 -2
  77. package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  78. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +1 -1
  79. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  80. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  81. package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts +2 -2
  82. package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts.map +1 -1
  83. package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
  84. package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts.map +1 -1
  85. package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
  86. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts +8 -2
  87. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  88. package/dist/feature-libraries/chunked-forest/codec/codecs.js +12 -1
  89. package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  90. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +1 -1
  91. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
  92. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  93. package/dist/feature-libraries/chunked-forest/codec/index.d.ts +1 -1
  94. package/dist/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
  95. package/dist/feature-libraries/chunked-forest/codec/index.js +2 -1
  96. package/dist/feature-libraries/chunked-forest/codec/index.js.map +1 -1
  97. package/dist/feature-libraries/chunked-forest/codec/nodeShape.d.ts.map +1 -1
  98. package/dist/feature-libraries/chunked-forest/codec/nodeShape.js +1 -1
  99. package/dist/feature-libraries/chunked-forest/codec/nodeShape.js.map +1 -1
  100. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts +1 -1
  101. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -1
  102. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
  103. package/dist/feature-libraries/chunked-forest/emptyChunk.d.ts.map +1 -1
  104. package/dist/feature-libraries/chunked-forest/emptyChunk.js.map +1 -1
  105. package/dist/feature-libraries/chunked-forest/index.d.ts +1 -1
  106. package/dist/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  107. package/dist/feature-libraries/chunked-forest/index.js +2 -1
  108. package/dist/feature-libraries/chunked-forest/index.js.map +1 -1
  109. package/dist/feature-libraries/chunked-forest/sequenceChunk.d.ts +1 -1
  110. package/dist/feature-libraries/chunked-forest/sequenceChunk.d.ts.map +1 -1
  111. package/dist/feature-libraries/chunked-forest/sequenceChunk.js +4 -4
  112. package/dist/feature-libraries/chunked-forest/sequenceChunk.js.map +1 -1
  113. package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts +1 -1
  114. package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
  115. package/dist/feature-libraries/chunked-forest/uniformChunk.js +1 -1
  116. package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  117. package/dist/feature-libraries/default-schema/defaultEditBuilder.js +1 -1
  118. package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  119. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  120. package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  121. package/dist/feature-libraries/default-schema/index.d.ts +1 -1
  122. package/dist/feature-libraries/default-schema/index.d.ts.map +1 -1
  123. package/dist/feature-libraries/default-schema/index.js +3 -2
  124. package/dist/feature-libraries/default-schema/index.js.map +1 -1
  125. package/dist/feature-libraries/default-schema/mappedEditBuilder.d.ts.map +1 -1
  126. package/dist/feature-libraries/default-schema/mappedEditBuilder.js.map +1 -1
  127. package/dist/feature-libraries/default-schema/schemaChecker.d.ts +18 -14
  128. package/dist/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
  129. package/dist/feature-libraries/default-schema/schemaChecker.js +78 -54
  130. package/dist/feature-libraries/default-schema/schemaChecker.js.map +1 -1
  131. package/dist/feature-libraries/flex-tree/context.d.ts +18 -2
  132. package/dist/feature-libraries/flex-tree/context.d.ts.map +1 -1
  133. package/dist/feature-libraries/flex-tree/context.js +22 -6
  134. package/dist/feature-libraries/flex-tree/context.js.map +1 -1
  135. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts +3 -2
  136. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  137. package/dist/feature-libraries/flex-tree/flexTreeTypes.js +3 -2
  138. package/dist/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  139. package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  140. package/dist/feature-libraries/flex-tree/lazyField.js +1 -1
  141. package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
  142. package/dist/feature-libraries/flex-tree/utilities.d.ts.map +1 -1
  143. package/dist/feature-libraries/flex-tree/utilities.js.map +1 -1
  144. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts +1 -1
  145. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  146. package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  147. package/dist/feature-libraries/index.d.ts +3 -3
  148. package/dist/feature-libraries/index.d.ts.map +1 -1
  149. package/dist/feature-libraries/index.js +5 -4
  150. package/dist/feature-libraries/index.js.map +1 -1
  151. package/dist/feature-libraries/indexing/anchorTreeIndex.d.ts +2 -2
  152. package/dist/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -1
  153. package/dist/feature-libraries/indexing/anchorTreeIndex.js +15 -15
  154. package/dist/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
  155. package/dist/feature-libraries/initializeForest.d.ts.map +1 -1
  156. package/dist/feature-libraries/initializeForest.js.map +1 -1
  157. package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
  158. package/dist/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
  159. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts +1 -1
  160. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  161. package/dist/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  162. package/dist/feature-libraries/modular-schema/fieldKindWithEditor.d.ts +1 -1
  163. package/dist/feature-libraries/modular-schema/fieldKindWithEditor.js +1 -1
  164. package/dist/feature-libraries/modular-schema/fieldKindWithEditor.js.map +1 -1
  165. package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  166. package/dist/feature-libraries/modular-schema/genericFieldKind.js +2 -2
  167. package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  168. package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.d.ts.map +1 -1
  169. package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.js.map +1 -1
  170. package/dist/feature-libraries/modular-schema/genericFieldKindTypes.d.ts.map +1 -1
  171. package/dist/feature-libraries/modular-schema/genericFieldKindTypes.js.map +1 -1
  172. package/dist/feature-libraries/modular-schema/isNeverTree.d.ts +0 -2
  173. package/dist/feature-libraries/modular-schema/isNeverTree.d.ts.map +1 -1
  174. package/dist/feature-libraries/modular-schema/isNeverTree.js +0 -2
  175. package/dist/feature-libraries/modular-schema/isNeverTree.js.map +1 -1
  176. package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  177. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  178. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +2 -0
  179. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  180. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +2 -0
  181. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  182. package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
  183. package/dist/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
  184. package/dist/feature-libraries/node-identifier/mockNodeIdentifierManager.d.ts.map +1 -1
  185. package/dist/feature-libraries/node-identifier/mockNodeIdentifierManager.js +8 -3
  186. package/dist/feature-libraries/node-identifier/mockNodeIdentifierManager.js.map +1 -1
  187. package/dist/feature-libraries/object-forest/objectForest.d.ts +22 -5
  188. package/dist/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  189. package/dist/feature-libraries/object-forest/objectForest.js +296 -207
  190. package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
  191. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.d.ts +2 -2
  192. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
  193. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js +3 -2
  194. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
  195. package/dist/feature-libraries/schema-edits/schemaChangeFormat.d.ts +2 -2
  196. package/dist/feature-libraries/schema-index/codec.d.ts +6 -12
  197. package/dist/feature-libraries/schema-index/codec.d.ts.map +1 -1
  198. package/dist/feature-libraries/schema-index/codec.js +8 -15
  199. package/dist/feature-libraries/schema-index/codec.js.map +1 -1
  200. package/dist/feature-libraries/schema-index/formatV1.d.ts +2 -2
  201. package/dist/feature-libraries/schema-index/formatV1.d.ts.map +1 -1
  202. package/dist/feature-libraries/schema-index/formatV1.js +1 -1
  203. package/dist/feature-libraries/schema-index/formatV1.js.map +1 -1
  204. package/dist/feature-libraries/schema-index/index.d.ts +1 -1
  205. package/dist/feature-libraries/schema-index/index.d.ts.map +1 -1
  206. package/dist/feature-libraries/schema-index/index.js +1 -2
  207. package/dist/feature-libraries/schema-index/index.js.map +1 -1
  208. package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts +1 -1
  209. package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
  210. package/dist/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
  211. package/dist/feature-libraries/sequence-field/formatV3.d.ts.map +1 -1
  212. package/dist/feature-libraries/sequence-field/formatV3.js.map +1 -1
  213. package/dist/feature-libraries/sequence-field/markQueue.d.ts.map +1 -1
  214. package/dist/feature-libraries/sequence-field/markQueue.js.map +1 -1
  215. package/dist/feature-libraries/sequence-field/prune.d.ts.map +1 -1
  216. package/dist/feature-libraries/sequence-field/prune.js.map +1 -1
  217. package/dist/feature-libraries/sequence-field/rebase.js +1 -1
  218. package/dist/feature-libraries/sequence-field/rebase.js.map +1 -1
  219. package/dist/feature-libraries/sequence-field/relevantRemovedRoots.d.ts +1 -1
  220. package/dist/feature-libraries/sequence-field/relevantRemovedRoots.d.ts.map +1 -1
  221. package/dist/feature-libraries/sequence-field/relevantRemovedRoots.js.map +1 -1
  222. package/dist/feature-libraries/sequence-field/replaceRevisions.d.ts.map +1 -1
  223. package/dist/feature-libraries/sequence-field/replaceRevisions.js.map +1 -1
  224. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts +1 -1
  225. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts.map +1 -1
  226. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js +1 -1
  227. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +1 -1
  228. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts +2 -2
  229. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
  230. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js +1 -1
  231. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
  232. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts +1 -1
  233. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts.map +1 -1
  234. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.js +2 -2
  235. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -1
  236. package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts +1 -1
  237. package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts.map +1 -1
  238. package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.js.map +1 -1
  239. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts +1 -1
  240. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts.map +1 -1
  241. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
  242. package/dist/feature-libraries/sequence-field/utils.d.ts +7 -5
  243. package/dist/feature-libraries/sequence-field/utils.d.ts.map +1 -1
  244. package/dist/feature-libraries/sequence-field/utils.js +7 -5
  245. package/dist/feature-libraries/sequence-field/utils.js.map +1 -1
  246. package/dist/feature-libraries/treeCursorUtils.d.ts.map +1 -1
  247. package/dist/feature-libraries/treeCursorUtils.js +3 -3
  248. package/dist/feature-libraries/treeCursorUtils.js.map +1 -1
  249. package/dist/feature-libraries/treeTextCursor.d.ts +1 -1
  250. package/dist/feature-libraries/treeTextCursor.js +1 -1
  251. package/dist/feature-libraries/treeTextCursor.js.map +1 -1
  252. package/dist/feature-libraries/valueUtilities.d.ts.map +1 -1
  253. package/dist/feature-libraries/valueUtilities.js +6 -6
  254. package/dist/feature-libraries/valueUtilities.js.map +1 -1
  255. package/dist/index.d.ts +2 -2
  256. package/dist/index.d.ts.map +1 -1
  257. package/dist/index.js +2 -6
  258. package/dist/index.js.map +1 -1
  259. package/dist/jsonDomainSchema.d.ts.map +1 -1
  260. package/dist/jsonDomainSchema.js.map +1 -1
  261. package/dist/packageVersion.d.ts +1 -1
  262. package/dist/packageVersion.d.ts.map +1 -1
  263. package/dist/packageVersion.js +1 -1
  264. package/dist/packageVersion.js.map +1 -1
  265. package/dist/serializableDomainSchema.d.ts.map +1 -1
  266. package/dist/serializableDomainSchema.js.map +1 -1
  267. package/dist/shared-tree/checkoutFlexTreeView.d.ts.map +1 -1
  268. package/dist/shared-tree/checkoutFlexTreeView.js.map +1 -1
  269. package/dist/shared-tree/independentView.d.ts +1 -1
  270. package/dist/shared-tree/independentView.d.ts.map +1 -1
  271. package/dist/shared-tree/independentView.js +8 -3
  272. package/dist/shared-tree/independentView.js.map +1 -1
  273. package/dist/shared-tree/index.d.ts +1 -1
  274. package/dist/shared-tree/index.d.ts.map +1 -1
  275. package/dist/shared-tree/index.js.map +1 -1
  276. package/dist/shared-tree/schematizeTree.d.ts +1 -1
  277. package/dist/shared-tree/schematizeTree.d.ts.map +1 -1
  278. package/dist/shared-tree/schematizeTree.js.map +1 -1
  279. package/dist/shared-tree/schematizingTreeView.d.ts +1 -1
  280. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  281. package/dist/shared-tree/schematizingTreeView.js +1 -1
  282. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  283. package/dist/shared-tree/sharedTree.d.ts +3 -3
  284. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  285. package/dist/shared-tree/sharedTree.js +8 -8
  286. package/dist/shared-tree/sharedTree.js.map +1 -1
  287. package/dist/shared-tree/sharedTreeChangeFamily.d.ts +1 -1
  288. package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  289. package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  290. package/dist/shared-tree/tree.js +1 -1
  291. package/dist/shared-tree/tree.js.map +1 -1
  292. package/dist/shared-tree/treeAlpha.d.ts +84 -2
  293. package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
  294. package/dist/shared-tree/treeAlpha.js +75 -22
  295. package/dist/shared-tree/treeAlpha.js.map +1 -1
  296. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  297. package/dist/shared-tree/treeCheckout.js +3 -2
  298. package/dist/shared-tree/treeCheckout.js.map +1 -1
  299. package/dist/shared-tree-core/branch.d.ts +2 -2
  300. package/dist/shared-tree-core/branch.d.ts.map +1 -1
  301. package/dist/shared-tree-core/branch.js +2 -2
  302. package/dist/shared-tree-core/branch.js.map +1 -1
  303. package/dist/shared-tree-core/branchCommitEnricher.d.ts +1 -1
  304. package/dist/shared-tree-core/branchCommitEnricher.d.ts.map +1 -1
  305. package/dist/shared-tree-core/branchCommitEnricher.js.map +1 -1
  306. package/dist/shared-tree-core/defaultResubmitMachine.d.ts.map +1 -1
  307. package/dist/shared-tree-core/defaultResubmitMachine.js.map +1 -1
  308. package/dist/shared-tree-core/editManager.d.ts +3 -1
  309. package/dist/shared-tree-core/editManager.d.ts.map +1 -1
  310. package/dist/shared-tree-core/editManager.js +4 -2
  311. package/dist/shared-tree-core/editManager.js.map +1 -1
  312. package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  313. package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
  314. package/dist/shared-tree-core/editManagerSummarizer.d.ts +1 -1
  315. package/dist/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
  316. package/dist/shared-tree-core/editManagerSummarizer.js.map +1 -1
  317. package/dist/shared-tree-core/messageCodecs.d.ts +1 -1
  318. package/dist/shared-tree-core/messageCodecs.js +1 -1
  319. package/dist/shared-tree-core/messageCodecs.js.map +1 -1
  320. package/dist/shared-tree-core/sequenceIdUtils.d.ts.map +1 -1
  321. package/dist/shared-tree-core/sequenceIdUtils.js.map +1 -1
  322. package/dist/shared-tree-core/sharedTreeCore.d.ts +2 -2
  323. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  324. package/dist/shared-tree-core/sharedTreeCore.js +4 -4
  325. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  326. package/dist/shared-tree-core/transaction.d.ts.map +1 -1
  327. package/dist/shared-tree-core/transaction.js +1 -1
  328. package/dist/shared-tree-core/transaction.js.map +1 -1
  329. package/dist/shared-tree-core/transactionEnricher.d.ts.map +1 -1
  330. package/dist/shared-tree-core/transactionEnricher.js.map +1 -1
  331. package/dist/sharedTreeAttributes.d.ts.map +1 -1
  332. package/dist/sharedTreeAttributes.js.map +1 -1
  333. package/dist/simple-tree/api/conciseTree.d.ts.map +1 -1
  334. package/dist/simple-tree/api/conciseTree.js +1 -1
  335. package/dist/simple-tree/api/conciseTree.js.map +1 -1
  336. package/dist/simple-tree/api/configuration.js +4 -4
  337. package/dist/simple-tree/api/configuration.js.map +1 -1
  338. package/dist/simple-tree/api/create.d.ts +2 -26
  339. package/dist/simple-tree/api/create.d.ts.map +1 -1
  340. package/dist/simple-tree/api/create.js +5 -42
  341. package/dist/simple-tree/api/create.js.map +1 -1
  342. package/dist/simple-tree/api/customTree.d.ts +1 -1
  343. package/dist/simple-tree/api/customTree.d.ts.map +1 -1
  344. package/dist/simple-tree/api/customTree.js +24 -24
  345. package/dist/simple-tree/api/customTree.js.map +1 -1
  346. package/dist/simple-tree/api/getSimpleSchema.d.ts.map +1 -1
  347. package/dist/simple-tree/api/getSimpleSchema.js.map +1 -1
  348. package/dist/simple-tree/api/identifierIndex.js +2 -2
  349. package/dist/simple-tree/api/identifierIndex.js.map +1 -1
  350. package/dist/simple-tree/api/index.d.ts +2 -3
  351. package/dist/simple-tree/api/index.d.ts.map +1 -1
  352. package/dist/simple-tree/api/index.js +4 -9
  353. package/dist/simple-tree/api/index.js.map +1 -1
  354. package/dist/simple-tree/api/schemaCompatibilityTester.d.ts.map +1 -1
  355. package/dist/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
  356. package/dist/simple-tree/api/schemaFactory.d.ts +5 -5
  357. package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
  358. package/dist/simple-tree/api/schemaFactory.js +8 -8
  359. package/dist/simple-tree/api/schemaFactory.js.map +1 -1
  360. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +1 -3
  361. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  362. package/dist/simple-tree/api/schemaFactoryAlpha.js +4 -6
  363. package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  364. package/dist/simple-tree/api/schemaFactoryRecursive.d.ts +2 -2
  365. package/dist/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
  366. package/dist/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
  367. package/dist/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
  368. package/dist/simple-tree/api/schemaFromSimple.js.map +1 -1
  369. package/dist/simple-tree/api/simpleSchemaToJsonSchema.d.ts +1 -1
  370. package/dist/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -1
  371. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js +4 -6
  372. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  373. package/dist/simple-tree/api/storedSchema.d.ts +1 -1
  374. package/dist/simple-tree/api/storedSchema.d.ts.map +1 -1
  375. package/dist/simple-tree/api/storedSchema.js +7 -6
  376. package/dist/simple-tree/api/storedSchema.js.map +1 -1
  377. package/dist/simple-tree/api/tree.d.ts +2 -2
  378. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  379. package/dist/simple-tree/api/tree.js.map +1 -1
  380. package/dist/simple-tree/api/treeBeta.d.ts.map +1 -1
  381. package/dist/simple-tree/api/treeBeta.js +1 -1
  382. package/dist/simple-tree/api/treeBeta.js.map +1 -1
  383. package/dist/simple-tree/api/treeNodeApi.d.ts +38 -3
  384. package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  385. package/dist/simple-tree/api/treeNodeApi.js +42 -28
  386. package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
  387. package/dist/simple-tree/api/typesUnsafe.d.ts +1 -1
  388. package/dist/simple-tree/api/typesUnsafe.d.ts.map +1 -1
  389. package/dist/simple-tree/api/typesUnsafe.js.map +1 -1
  390. package/dist/simple-tree/api/verboseTree.js +3 -3
  391. package/dist/simple-tree/api/verboseTree.js.map +1 -1
  392. package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
  393. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js +4 -6
  394. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
  395. package/dist/simple-tree/core/context.d.ts.map +1 -1
  396. package/dist/simple-tree/core/context.js.map +1 -1
  397. package/dist/simple-tree/core/getOrCreateNode.d.ts +1 -1
  398. package/dist/simple-tree/core/getOrCreateNode.d.ts.map +1 -1
  399. package/dist/simple-tree/core/getOrCreateNode.js +1 -1
  400. package/dist/simple-tree/core/getOrCreateNode.js.map +1 -1
  401. package/dist/simple-tree/core/treeNode.d.ts.map +1 -1
  402. package/dist/simple-tree/core/treeNode.js +1 -1
  403. package/dist/simple-tree/core/treeNode.js.map +1 -1
  404. package/dist/simple-tree/core/treeNodeKernel.d.ts +8 -20
  405. package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  406. package/dist/simple-tree/core/treeNodeKernel.js +19 -50
  407. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
  408. package/dist/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  409. package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
  410. package/dist/simple-tree/core/types.d.ts.map +1 -1
  411. package/dist/simple-tree/core/types.js.map +1 -1
  412. package/dist/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  413. package/dist/simple-tree/core/unhydratedFlexTree.js +21 -21
  414. package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  415. package/dist/simple-tree/core/withType.d.ts +1 -1
  416. package/dist/simple-tree/core/withType.d.ts.map +1 -1
  417. package/dist/simple-tree/core/withType.js.map +1 -1
  418. package/dist/simple-tree/createContext.d.ts.map +1 -1
  419. package/dist/simple-tree/createContext.js.map +1 -1
  420. package/{lib/simple-tree/proxies.d.ts → dist/simple-tree/getTreeNodeForField.d.ts} +1 -1
  421. package/dist/simple-tree/getTreeNodeForField.d.ts.map +1 -0
  422. package/dist/simple-tree/{proxies.js → getTreeNodeForField.js} +1 -1
  423. package/dist/simple-tree/getTreeNodeForField.js.map +1 -0
  424. package/dist/simple-tree/index.d.ts +3 -10
  425. package/dist/simple-tree/index.d.ts.map +1 -1
  426. package/dist/simple-tree/index.js +17 -23
  427. package/dist/simple-tree/index.js.map +1 -1
  428. package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
  429. package/dist/simple-tree/leafNodeSchema.js.map +1 -1
  430. package/dist/simple-tree/{arrayNode.d.ts → node-kinds/array/arrayNode.d.ts} +3 -3
  431. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -0
  432. package/dist/simple-tree/{arrayNode.js → node-kinds/array/arrayNode.js} +10 -10
  433. package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -0
  434. package/dist/simple-tree/{arrayNodeTypes.d.ts → node-kinds/array/arrayNodeTypes.d.ts} +3 -3
  435. package/dist/simple-tree/node-kinds/array/arrayNodeTypes.d.ts.map +1 -0
  436. package/dist/simple-tree/{arrayNodeTypes.js → node-kinds/array/arrayNodeTypes.js} +1 -1
  437. package/dist/simple-tree/node-kinds/array/arrayNodeTypes.js.map +1 -0
  438. package/dist/simple-tree/node-kinds/array/index.d.ts +7 -0
  439. package/dist/simple-tree/node-kinds/array/index.d.ts.map +1 -0
  440. package/dist/simple-tree/node-kinds/array/index.js +16 -0
  441. package/dist/simple-tree/node-kinds/array/index.js.map +1 -0
  442. package/dist/simple-tree/node-kinds/index.d.ts +8 -0
  443. package/dist/simple-tree/node-kinds/index.d.ts.map +1 -0
  444. package/dist/simple-tree/node-kinds/index.js +26 -0
  445. package/dist/simple-tree/node-kinds/index.js.map +1 -0
  446. package/dist/simple-tree/node-kinds/map/index.d.ts +7 -0
  447. package/dist/simple-tree/node-kinds/map/index.d.ts.map +1 -0
  448. package/dist/simple-tree/node-kinds/map/index.js +13 -0
  449. package/dist/simple-tree/node-kinds/map/index.js.map +1 -0
  450. package/{lib/simple-tree → dist/simple-tree/node-kinds/map}/mapNode.d.ts +3 -3
  451. package/dist/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -0
  452. package/dist/simple-tree/{mapNode.js → node-kinds/map/mapNode.js} +11 -11
  453. package/dist/simple-tree/node-kinds/map/mapNode.js.map +1 -0
  454. package/dist/simple-tree/{mapNodeTypes.d.ts → node-kinds/map/mapNodeTypes.d.ts} +3 -3
  455. package/dist/simple-tree/node-kinds/map/mapNodeTypes.d.ts.map +1 -0
  456. package/dist/simple-tree/{mapNodeTypes.js → node-kinds/map/mapNodeTypes.js} +1 -1
  457. package/dist/simple-tree/node-kinds/map/mapNodeTypes.js.map +1 -0
  458. package/dist/simple-tree/node-kinds/object/index.d.ts +7 -0
  459. package/dist/simple-tree/node-kinds/object/index.d.ts.map +1 -0
  460. package/dist/simple-tree/node-kinds/object/index.js +16 -0
  461. package/dist/simple-tree/node-kinds/object/index.js.map +1 -0
  462. package/{lib/simple-tree → dist/simple-tree/node-kinds/object}/objectNode.d.ts +17 -6
  463. package/dist/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -0
  464. package/dist/simple-tree/{objectNode.js → node-kinds/object/objectNode.js} +49 -26
  465. package/dist/simple-tree/node-kinds/object/objectNode.js.map +1 -0
  466. package/{lib/simple-tree → dist/simple-tree/node-kinds/object}/objectNodeTypes.d.ts +5 -5
  467. package/dist/simple-tree/node-kinds/object/objectNodeTypes.d.ts.map +1 -0
  468. package/dist/simple-tree/{objectNodeTypes.js → node-kinds/object/objectNodeTypes.js} +1 -1
  469. package/dist/simple-tree/node-kinds/object/objectNodeTypes.js.map +1 -0
  470. package/dist/simple-tree/prepareForInsertion.d.ts +18 -6
  471. package/dist/simple-tree/prepareForInsertion.d.ts.map +1 -1
  472. package/dist/simple-tree/prepareForInsertion.js +51 -22
  473. package/dist/simple-tree/prepareForInsertion.js.map +1 -1
  474. package/dist/simple-tree/schemaTypes.d.ts +2 -2
  475. package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
  476. package/dist/simple-tree/schemaTypes.js.map +1 -1
  477. package/dist/simple-tree/simpleSchema.d.ts.map +1 -1
  478. package/dist/simple-tree/simpleSchema.js.map +1 -1
  479. package/dist/simple-tree/toMapTree.d.ts +2 -22
  480. package/dist/simple-tree/toMapTree.d.ts.map +1 -1
  481. package/dist/simple-tree/toMapTree.js +44 -23
  482. package/dist/simple-tree/toMapTree.js.map +1 -1
  483. package/dist/simple-tree/toStoredSchema.d.ts.map +1 -1
  484. package/dist/simple-tree/toStoredSchema.js +1 -1
  485. package/dist/simple-tree/toStoredSchema.js.map +1 -1
  486. package/dist/simple-tree/treeNodeValid.d.ts +1 -1
  487. package/dist/simple-tree/treeNodeValid.d.ts.map +1 -1
  488. package/dist/simple-tree/treeNodeValid.js +10 -10
  489. package/dist/simple-tree/treeNodeValid.js.map +1 -1
  490. package/dist/simple-tree/walkFieldSchema.d.ts.map +1 -1
  491. package/dist/simple-tree/walkFieldSchema.js.map +1 -1
  492. package/dist/tableSchema.d.ts +119 -72
  493. package/dist/tableSchema.d.ts.map +1 -1
  494. package/dist/tableSchema.js +83 -36
  495. package/dist/tableSchema.js.map +1 -1
  496. package/dist/treeFactory.d.ts +1 -1
  497. package/dist/treeFactory.d.ts.map +1 -1
  498. package/dist/treeFactory.js +3 -3
  499. package/dist/treeFactory.js.map +1 -1
  500. package/dist/util/bTreeUtils.d.ts.map +1 -1
  501. package/dist/util/bTreeUtils.js.map +1 -1
  502. package/dist/util/breakable.d.ts +23 -4
  503. package/dist/util/breakable.d.ts.map +1 -1
  504. package/dist/util/breakable.js +12 -3
  505. package/dist/util/breakable.js.map +1 -1
  506. package/docs/SharedTree Philosophy.md +5 -5
  507. package/lib/alpha.d.ts +3 -0
  508. package/lib/codec/codec.d.ts +52 -7
  509. package/lib/codec/codec.d.ts.map +1 -1
  510. package/lib/codec/codec.js +60 -8
  511. package/lib/codec/codec.js.map +1 -1
  512. package/lib/core/change-family/editBuilder.d.ts.map +1 -1
  513. package/lib/core/change-family/editBuilder.js.map +1 -1
  514. package/lib/core/forest/forest.d.ts.map +1 -1
  515. package/lib/core/forest/forest.js.map +1 -1
  516. package/lib/core/index.d.ts +1 -1
  517. package/lib/core/index.d.ts.map +1 -1
  518. package/lib/core/index.js +1 -1
  519. package/lib/core/index.js.map +1 -1
  520. package/lib/core/rebase/types.d.ts +2 -2
  521. package/lib/core/rebase/types.js +2 -2
  522. package/lib/core/rebase/types.js.map +1 -1
  523. package/lib/core/rebase/utils.d.ts +0 -2
  524. package/lib/core/rebase/utils.d.ts.map +1 -1
  525. package/lib/core/rebase/utils.js +6 -10
  526. package/lib/core/rebase/utils.js.map +1 -1
  527. package/lib/core/schema-stored/formatV1.d.ts +0 -1
  528. package/lib/core/schema-stored/formatV1.d.ts.map +1 -1
  529. package/lib/core/schema-stored/formatV1.js +0 -1
  530. package/lib/core/schema-stored/formatV1.js.map +1 -1
  531. package/lib/core/schema-stored/index.d.ts +1 -1
  532. package/lib/core/schema-stored/index.d.ts.map +1 -1
  533. package/lib/core/schema-stored/index.js +1 -1
  534. package/lib/core/schema-stored/index.js.map +1 -1
  535. package/lib/core/schema-stored/schema.d.ts +6 -0
  536. package/lib/core/schema-stored/schema.d.ts.map +1 -1
  537. package/lib/core/schema-stored/schema.js +7 -0
  538. package/lib/core/schema-stored/schema.js.map +1 -1
  539. package/lib/core/schema-stored/storedSchemaRepository.d.ts +1 -1
  540. package/lib/core/schema-stored/storedSchemaRepository.d.ts.map +1 -1
  541. package/lib/core/schema-stored/storedSchemaRepository.js +1 -1
  542. package/lib/core/schema-stored/storedSchemaRepository.js.map +1 -1
  543. package/lib/core/tree/anchorSet.d.ts +2 -1
  544. package/lib/core/tree/anchorSet.d.ts.map +1 -1
  545. package/lib/core/tree/anchorSet.js +4 -3
  546. package/lib/core/tree/anchorSet.js.map +1 -1
  547. package/lib/core/tree/chunk.d.ts.map +1 -1
  548. package/lib/core/tree/chunk.js.map +1 -1
  549. package/lib/core/tree/delta.d.ts.map +1 -1
  550. package/lib/core/tree/delta.js.map +1 -1
  551. package/lib/core/tree/deltaUtil.d.ts.map +1 -1
  552. package/lib/core/tree/deltaUtil.js.map +1 -1
  553. package/lib/core/tree/detachedFieldIndex.d.ts +1 -1
  554. package/lib/core/tree/detachedFieldIndex.d.ts.map +1 -1
  555. package/lib/core/tree/detachedFieldIndex.js.map +1 -1
  556. package/lib/core/tree/detachedFieldIndexCodec.d.ts +1 -1
  557. package/lib/core/tree/detachedFieldIndexCodec.d.ts.map +1 -1
  558. package/lib/core/tree/detachedFieldIndexCodec.js +1 -1
  559. package/lib/core/tree/detachedFieldIndexCodec.js.map +1 -1
  560. package/lib/core/tree/pathTree.d.ts +12 -11
  561. package/lib/core/tree/pathTree.d.ts.map +1 -1
  562. package/lib/core/tree/pathTree.js +8 -7
  563. package/lib/core/tree/pathTree.js.map +1 -1
  564. package/lib/core/tree/treeTextFormat.d.ts +1 -1
  565. package/lib/core/tree/treeTextFormat.d.ts.map +1 -1
  566. package/lib/core/tree/treeTextFormat.js +1 -1
  567. package/lib/core/tree/treeTextFormat.js.map +1 -1
  568. package/lib/core/tree/visitDelta.d.ts +1 -1
  569. package/lib/core/tree/visitDelta.d.ts.map +1 -1
  570. package/lib/core/tree/visitDelta.js.map +1 -1
  571. package/lib/core/tree/visitorUtils.d.ts +2 -2
  572. package/lib/core/tree/visitorUtils.d.ts.map +1 -1
  573. package/lib/core/tree/visitorUtils.js.map +1 -1
  574. package/lib/feature-libraries/chunked-forest/chunkTree.d.ts +1 -1
  575. package/lib/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  576. package/lib/feature-libraries/chunked-forest/chunkTree.js +1 -1
  577. package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  578. package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts +2 -2
  579. package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  580. package/lib/feature-libraries/chunked-forest/chunkedForest.js +2 -2
  581. package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  582. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +1 -1
  583. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  584. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  585. package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts +2 -2
  586. package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts.map +1 -1
  587. package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
  588. package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts.map +1 -1
  589. package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
  590. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts +8 -2
  591. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  592. package/lib/feature-libraries/chunked-forest/codec/codecs.js +10 -0
  593. package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  594. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +1 -1
  595. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
  596. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  597. package/lib/feature-libraries/chunked-forest/codec/index.d.ts +1 -1
  598. package/lib/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
  599. package/lib/feature-libraries/chunked-forest/codec/index.js +1 -1
  600. package/lib/feature-libraries/chunked-forest/codec/index.js.map +1 -1
  601. package/lib/feature-libraries/chunked-forest/codec/nodeShape.d.ts.map +1 -1
  602. package/lib/feature-libraries/chunked-forest/codec/nodeShape.js +1 -1
  603. package/lib/feature-libraries/chunked-forest/codec/nodeShape.js.map +1 -1
  604. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts +1 -1
  605. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -1
  606. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
  607. package/lib/feature-libraries/chunked-forest/emptyChunk.d.ts.map +1 -1
  608. package/lib/feature-libraries/chunked-forest/emptyChunk.js.map +1 -1
  609. package/lib/feature-libraries/chunked-forest/index.d.ts +1 -1
  610. package/lib/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  611. package/lib/feature-libraries/chunked-forest/index.js +1 -1
  612. package/lib/feature-libraries/chunked-forest/index.js.map +1 -1
  613. package/lib/feature-libraries/chunked-forest/sequenceChunk.d.ts +1 -1
  614. package/lib/feature-libraries/chunked-forest/sequenceChunk.d.ts.map +1 -1
  615. package/lib/feature-libraries/chunked-forest/sequenceChunk.js +1 -1
  616. package/lib/feature-libraries/chunked-forest/sequenceChunk.js.map +1 -1
  617. package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts +1 -1
  618. package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
  619. package/lib/feature-libraries/chunked-forest/uniformChunk.js +1 -1
  620. package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  621. package/lib/feature-libraries/default-schema/defaultEditBuilder.js +1 -1
  622. package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  623. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  624. package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  625. package/lib/feature-libraries/default-schema/index.d.ts +1 -1
  626. package/lib/feature-libraries/default-schema/index.d.ts.map +1 -1
  627. package/lib/feature-libraries/default-schema/index.js +1 -1
  628. package/lib/feature-libraries/default-schema/index.js.map +1 -1
  629. package/lib/feature-libraries/default-schema/mappedEditBuilder.d.ts.map +1 -1
  630. package/lib/feature-libraries/default-schema/mappedEditBuilder.js.map +1 -1
  631. package/lib/feature-libraries/default-schema/schemaChecker.d.ts +18 -14
  632. package/lib/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
  633. package/lib/feature-libraries/default-schema/schemaChecker.js +76 -53
  634. package/lib/feature-libraries/default-schema/schemaChecker.js.map +1 -1
  635. package/lib/feature-libraries/flex-tree/context.d.ts +18 -2
  636. package/lib/feature-libraries/flex-tree/context.d.ts.map +1 -1
  637. package/lib/feature-libraries/flex-tree/context.js +23 -7
  638. package/lib/feature-libraries/flex-tree/context.js.map +1 -1
  639. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts +3 -2
  640. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  641. package/lib/feature-libraries/flex-tree/flexTreeTypes.js +3 -2
  642. package/lib/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  643. package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  644. package/lib/feature-libraries/flex-tree/lazyField.js +1 -1
  645. package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
  646. package/lib/feature-libraries/flex-tree/utilities.d.ts.map +1 -1
  647. package/lib/feature-libraries/flex-tree/utilities.js.map +1 -1
  648. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts +1 -1
  649. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  650. package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  651. package/lib/feature-libraries/index.d.ts +3 -3
  652. package/lib/feature-libraries/index.d.ts.map +1 -1
  653. package/lib/feature-libraries/index.js +3 -3
  654. package/lib/feature-libraries/index.js.map +1 -1
  655. package/lib/feature-libraries/indexing/anchorTreeIndex.d.ts +2 -2
  656. package/lib/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -1
  657. package/lib/feature-libraries/indexing/anchorTreeIndex.js +1 -1
  658. package/lib/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
  659. package/lib/feature-libraries/initializeForest.d.ts.map +1 -1
  660. package/lib/feature-libraries/initializeForest.js.map +1 -1
  661. package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
  662. package/lib/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
  663. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts +1 -1
  664. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  665. package/lib/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  666. package/lib/feature-libraries/modular-schema/fieldKindWithEditor.d.ts +1 -1
  667. package/lib/feature-libraries/modular-schema/fieldKindWithEditor.js +1 -1
  668. package/lib/feature-libraries/modular-schema/fieldKindWithEditor.js.map +1 -1
  669. package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  670. package/lib/feature-libraries/modular-schema/genericFieldKind.js +2 -2
  671. package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  672. package/lib/feature-libraries/modular-schema/genericFieldKindCodecs.d.ts.map +1 -1
  673. package/lib/feature-libraries/modular-schema/genericFieldKindCodecs.js.map +1 -1
  674. package/lib/feature-libraries/modular-schema/genericFieldKindTypes.d.ts.map +1 -1
  675. package/lib/feature-libraries/modular-schema/genericFieldKindTypes.js.map +1 -1
  676. package/lib/feature-libraries/modular-schema/isNeverTree.d.ts +0 -2
  677. package/lib/feature-libraries/modular-schema/isNeverTree.d.ts.map +1 -1
  678. package/lib/feature-libraries/modular-schema/isNeverTree.js +0 -2
  679. package/lib/feature-libraries/modular-schema/isNeverTree.js.map +1 -1
  680. package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  681. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  682. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +2 -0
  683. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  684. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +2 -0
  685. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  686. package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
  687. package/lib/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
  688. package/lib/feature-libraries/node-identifier/mockNodeIdentifierManager.d.ts.map +1 -1
  689. package/lib/feature-libraries/node-identifier/mockNodeIdentifierManager.js +8 -3
  690. package/lib/feature-libraries/node-identifier/mockNodeIdentifierManager.js.map +1 -1
  691. package/lib/feature-libraries/object-forest/objectForest.d.ts +22 -5
  692. package/lib/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  693. package/lib/feature-libraries/object-forest/objectForest.js +299 -209
  694. package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
  695. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.d.ts +2 -2
  696. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
  697. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js +4 -3
  698. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
  699. package/lib/feature-libraries/schema-edits/schemaChangeFormat.d.ts +2 -2
  700. package/lib/feature-libraries/schema-index/codec.d.ts +6 -12
  701. package/lib/feature-libraries/schema-index/codec.d.ts.map +1 -1
  702. package/lib/feature-libraries/schema-index/codec.js +8 -15
  703. package/lib/feature-libraries/schema-index/codec.js.map +1 -1
  704. package/lib/feature-libraries/schema-index/formatV1.d.ts +2 -2
  705. package/lib/feature-libraries/schema-index/formatV1.d.ts.map +1 -1
  706. package/lib/feature-libraries/schema-index/formatV1.js +2 -2
  707. package/lib/feature-libraries/schema-index/formatV1.js.map +1 -1
  708. package/lib/feature-libraries/schema-index/index.d.ts +1 -1
  709. package/lib/feature-libraries/schema-index/index.d.ts.map +1 -1
  710. package/lib/feature-libraries/schema-index/index.js +1 -1
  711. package/lib/feature-libraries/schema-index/index.js.map +1 -1
  712. package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts +1 -1
  713. package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
  714. package/lib/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
  715. package/lib/feature-libraries/sequence-field/formatV3.d.ts.map +1 -1
  716. package/lib/feature-libraries/sequence-field/formatV3.js.map +1 -1
  717. package/lib/feature-libraries/sequence-field/markQueue.d.ts.map +1 -1
  718. package/lib/feature-libraries/sequence-field/markQueue.js.map +1 -1
  719. package/lib/feature-libraries/sequence-field/prune.d.ts.map +1 -1
  720. package/lib/feature-libraries/sequence-field/prune.js.map +1 -1
  721. package/lib/feature-libraries/sequence-field/rebase.js +1 -1
  722. package/lib/feature-libraries/sequence-field/rebase.js.map +1 -1
  723. package/lib/feature-libraries/sequence-field/relevantRemovedRoots.d.ts +1 -1
  724. package/lib/feature-libraries/sequence-field/relevantRemovedRoots.d.ts.map +1 -1
  725. package/lib/feature-libraries/sequence-field/relevantRemovedRoots.js.map +1 -1
  726. package/lib/feature-libraries/sequence-field/replaceRevisions.d.ts.map +1 -1
  727. package/lib/feature-libraries/sequence-field/replaceRevisions.js.map +1 -1
  728. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts +1 -1
  729. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts.map +1 -1
  730. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js +1 -1
  731. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +1 -1
  732. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts +2 -2
  733. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
  734. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js +1 -1
  735. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
  736. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts +1 -1
  737. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts.map +1 -1
  738. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.js +2 -2
  739. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -1
  740. package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts +1 -1
  741. package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts.map +1 -1
  742. package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.js.map +1 -1
  743. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts +1 -1
  744. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts.map +1 -1
  745. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
  746. package/lib/feature-libraries/sequence-field/utils.d.ts +7 -5
  747. package/lib/feature-libraries/sequence-field/utils.d.ts.map +1 -1
  748. package/lib/feature-libraries/sequence-field/utils.js +7 -5
  749. package/lib/feature-libraries/sequence-field/utils.js.map +1 -1
  750. package/lib/feature-libraries/treeCursorUtils.d.ts.map +1 -1
  751. package/lib/feature-libraries/treeCursorUtils.js +3 -3
  752. package/lib/feature-libraries/treeCursorUtils.js.map +1 -1
  753. package/lib/feature-libraries/treeTextCursor.d.ts +1 -1
  754. package/lib/feature-libraries/treeTextCursor.js +1 -1
  755. package/lib/feature-libraries/treeTextCursor.js.map +1 -1
  756. package/lib/feature-libraries/valueUtilities.d.ts.map +1 -1
  757. package/lib/feature-libraries/valueUtilities.js +1 -1
  758. package/lib/feature-libraries/valueUtilities.js.map +1 -1
  759. package/lib/index.d.ts +2 -2
  760. package/lib/index.d.ts.map +1 -1
  761. package/lib/index.js +0 -2
  762. package/lib/index.js.map +1 -1
  763. package/lib/jsonDomainSchema.d.ts.map +1 -1
  764. package/lib/jsonDomainSchema.js.map +1 -1
  765. package/lib/packageVersion.d.ts +1 -1
  766. package/lib/packageVersion.d.ts.map +1 -1
  767. package/lib/packageVersion.js +1 -1
  768. package/lib/packageVersion.js.map +1 -1
  769. package/lib/serializableDomainSchema.d.ts.map +1 -1
  770. package/lib/serializableDomainSchema.js.map +1 -1
  771. package/lib/shared-tree/checkoutFlexTreeView.d.ts.map +1 -1
  772. package/lib/shared-tree/checkoutFlexTreeView.js.map +1 -1
  773. package/lib/shared-tree/independentView.d.ts +1 -1
  774. package/lib/shared-tree/independentView.d.ts.map +1 -1
  775. package/lib/shared-tree/independentView.js +10 -5
  776. package/lib/shared-tree/independentView.js.map +1 -1
  777. package/lib/shared-tree/index.d.ts +1 -1
  778. package/lib/shared-tree/index.d.ts.map +1 -1
  779. package/lib/shared-tree/index.js +1 -1
  780. package/lib/shared-tree/index.js.map +1 -1
  781. package/lib/shared-tree/schematizeTree.d.ts +1 -1
  782. package/lib/shared-tree/schematizeTree.d.ts.map +1 -1
  783. package/lib/shared-tree/schematizeTree.js.map +1 -1
  784. package/lib/shared-tree/schematizingTreeView.d.ts +1 -1
  785. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  786. package/lib/shared-tree/schematizingTreeView.js +1 -1
  787. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  788. package/lib/shared-tree/sharedTree.d.ts +3 -3
  789. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  790. package/lib/shared-tree/sharedTree.js +10 -10
  791. package/lib/shared-tree/sharedTree.js.map +1 -1
  792. package/lib/shared-tree/sharedTreeChangeFamily.d.ts +1 -1
  793. package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  794. package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  795. package/lib/shared-tree/tree.js +1 -1
  796. package/lib/shared-tree/tree.js.map +1 -1
  797. package/lib/shared-tree/treeAlpha.d.ts +84 -2
  798. package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
  799. package/lib/shared-tree/treeAlpha.js +65 -12
  800. package/lib/shared-tree/treeAlpha.js.map +1 -1
  801. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  802. package/lib/shared-tree/treeCheckout.js +3 -2
  803. package/lib/shared-tree/treeCheckout.js.map +1 -1
  804. package/lib/shared-tree-core/branch.d.ts +2 -2
  805. package/lib/shared-tree-core/branch.d.ts.map +1 -1
  806. package/lib/shared-tree-core/branch.js +2 -2
  807. package/lib/shared-tree-core/branch.js.map +1 -1
  808. package/lib/shared-tree-core/branchCommitEnricher.d.ts +1 -1
  809. package/lib/shared-tree-core/branchCommitEnricher.d.ts.map +1 -1
  810. package/lib/shared-tree-core/branchCommitEnricher.js.map +1 -1
  811. package/lib/shared-tree-core/defaultResubmitMachine.d.ts.map +1 -1
  812. package/lib/shared-tree-core/defaultResubmitMachine.js.map +1 -1
  813. package/lib/shared-tree-core/editManager.d.ts +3 -1
  814. package/lib/shared-tree-core/editManager.d.ts.map +1 -1
  815. package/lib/shared-tree-core/editManager.js +4 -2
  816. package/lib/shared-tree-core/editManager.js.map +1 -1
  817. package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  818. package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
  819. package/lib/shared-tree-core/editManagerSummarizer.d.ts +1 -1
  820. package/lib/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
  821. package/lib/shared-tree-core/editManagerSummarizer.js.map +1 -1
  822. package/lib/shared-tree-core/messageCodecs.d.ts +1 -1
  823. package/lib/shared-tree-core/messageCodecs.js +1 -1
  824. package/lib/shared-tree-core/messageCodecs.js.map +1 -1
  825. package/lib/shared-tree-core/sequenceIdUtils.d.ts.map +1 -1
  826. package/lib/shared-tree-core/sequenceIdUtils.js.map +1 -1
  827. package/lib/shared-tree-core/sharedTreeCore.d.ts +2 -2
  828. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  829. package/lib/shared-tree-core/sharedTreeCore.js +4 -4
  830. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  831. package/lib/shared-tree-core/transaction.d.ts.map +1 -1
  832. package/lib/shared-tree-core/transaction.js +1 -1
  833. package/lib/shared-tree-core/transaction.js.map +1 -1
  834. package/lib/shared-tree-core/transactionEnricher.d.ts.map +1 -1
  835. package/lib/shared-tree-core/transactionEnricher.js.map +1 -1
  836. package/lib/sharedTreeAttributes.d.ts.map +1 -1
  837. package/lib/sharedTreeAttributes.js.map +1 -1
  838. package/lib/simple-tree/api/conciseTree.d.ts.map +1 -1
  839. package/lib/simple-tree/api/conciseTree.js +1 -1
  840. package/lib/simple-tree/api/conciseTree.js.map +1 -1
  841. package/lib/simple-tree/api/configuration.js +1 -1
  842. package/lib/simple-tree/api/configuration.js.map +1 -1
  843. package/lib/simple-tree/api/create.d.ts +2 -26
  844. package/lib/simple-tree/api/create.d.ts.map +1 -1
  845. package/lib/simple-tree/api/create.js +2 -37
  846. package/lib/simple-tree/api/create.js.map +1 -1
  847. package/lib/simple-tree/api/customTree.d.ts +1 -1
  848. package/lib/simple-tree/api/customTree.d.ts.map +1 -1
  849. package/lib/simple-tree/api/customTree.js +3 -3
  850. package/lib/simple-tree/api/customTree.js.map +1 -1
  851. package/lib/simple-tree/api/getSimpleSchema.d.ts.map +1 -1
  852. package/lib/simple-tree/api/getSimpleSchema.js.map +1 -1
  853. package/lib/simple-tree/api/identifierIndex.js +1 -1
  854. package/lib/simple-tree/api/identifierIndex.js.map +1 -1
  855. package/lib/simple-tree/api/index.d.ts +2 -3
  856. package/lib/simple-tree/api/index.d.ts.map +1 -1
  857. package/lib/simple-tree/api/index.js +2 -5
  858. package/lib/simple-tree/api/index.js.map +1 -1
  859. package/lib/simple-tree/api/schemaCompatibilityTester.d.ts.map +1 -1
  860. package/lib/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
  861. package/lib/simple-tree/api/schemaFactory.d.ts +5 -5
  862. package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
  863. package/lib/simple-tree/api/schemaFactory.js +5 -5
  864. package/lib/simple-tree/api/schemaFactory.js.map +1 -1
  865. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +1 -3
  866. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  867. package/lib/simple-tree/api/schemaFactoryAlpha.js +1 -3
  868. package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  869. package/lib/simple-tree/api/schemaFactoryRecursive.d.ts +2 -2
  870. package/lib/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
  871. package/lib/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
  872. package/lib/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
  873. package/lib/simple-tree/api/schemaFromSimple.js.map +1 -1
  874. package/lib/simple-tree/api/simpleSchemaToJsonSchema.d.ts +1 -1
  875. package/lib/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -1
  876. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js +1 -3
  877. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  878. package/lib/simple-tree/api/storedSchema.d.ts +1 -1
  879. package/lib/simple-tree/api/storedSchema.d.ts.map +1 -1
  880. package/lib/simple-tree/api/storedSchema.js +3 -2
  881. package/lib/simple-tree/api/storedSchema.js.map +1 -1
  882. package/lib/simple-tree/api/tree.d.ts +2 -2
  883. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  884. package/lib/simple-tree/api/tree.js.map +1 -1
  885. package/lib/simple-tree/api/treeBeta.d.ts.map +1 -1
  886. package/lib/simple-tree/api/treeBeta.js +1 -1
  887. package/lib/simple-tree/api/treeBeta.js.map +1 -1
  888. package/lib/simple-tree/api/treeNodeApi.d.ts +38 -3
  889. package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  890. package/lib/simple-tree/api/treeNodeApi.js +39 -28
  891. package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
  892. package/lib/simple-tree/api/typesUnsafe.d.ts +1 -1
  893. package/lib/simple-tree/api/typesUnsafe.d.ts.map +1 -1
  894. package/lib/simple-tree/api/typesUnsafe.js.map +1 -1
  895. package/lib/simple-tree/api/verboseTree.js +1 -1
  896. package/lib/simple-tree/api/verboseTree.js.map +1 -1
  897. package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
  898. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js +1 -3
  899. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
  900. package/lib/simple-tree/core/context.d.ts.map +1 -1
  901. package/lib/simple-tree/core/context.js.map +1 -1
  902. package/lib/simple-tree/core/getOrCreateNode.d.ts +1 -1
  903. package/lib/simple-tree/core/getOrCreateNode.d.ts.map +1 -1
  904. package/lib/simple-tree/core/getOrCreateNode.js +2 -2
  905. package/lib/simple-tree/core/getOrCreateNode.js.map +1 -1
  906. package/lib/simple-tree/core/treeNode.d.ts.map +1 -1
  907. package/lib/simple-tree/core/treeNode.js +1 -1
  908. package/lib/simple-tree/core/treeNode.js.map +1 -1
  909. package/lib/simple-tree/core/treeNodeKernel.d.ts +8 -20
  910. package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  911. package/lib/simple-tree/core/treeNodeKernel.js +18 -49
  912. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
  913. package/lib/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  914. package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
  915. package/lib/simple-tree/core/types.d.ts.map +1 -1
  916. package/lib/simple-tree/core/types.js.map +1 -1
  917. package/lib/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  918. package/lib/simple-tree/core/unhydratedFlexTree.js +3 -3
  919. package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  920. package/lib/simple-tree/core/withType.d.ts +1 -1
  921. package/lib/simple-tree/core/withType.d.ts.map +1 -1
  922. package/lib/simple-tree/core/withType.js.map +1 -1
  923. package/lib/simple-tree/createContext.d.ts.map +1 -1
  924. package/lib/simple-tree/createContext.js.map +1 -1
  925. package/{dist/simple-tree/proxies.d.ts → lib/simple-tree/getTreeNodeForField.d.ts} +1 -1
  926. package/lib/simple-tree/getTreeNodeForField.d.ts.map +1 -0
  927. package/lib/simple-tree/{proxies.js → getTreeNodeForField.js} +1 -1
  928. package/lib/simple-tree/getTreeNodeForField.js.map +1 -0
  929. package/lib/simple-tree/index.d.ts +3 -10
  930. package/lib/simple-tree/index.d.ts.map +1 -1
  931. package/lib/simple-tree/index.js +3 -7
  932. package/lib/simple-tree/index.js.map +1 -1
  933. package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
  934. package/lib/simple-tree/leafNodeSchema.js.map +1 -1
  935. package/lib/simple-tree/{arrayNode.d.ts → node-kinds/array/arrayNode.d.ts} +3 -3
  936. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -0
  937. package/lib/simple-tree/{arrayNode.js → node-kinds/array/arrayNode.js} +10 -10
  938. package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -0
  939. package/lib/simple-tree/{arrayNodeTypes.d.ts → node-kinds/array/arrayNodeTypes.d.ts} +3 -3
  940. package/lib/simple-tree/node-kinds/array/arrayNodeTypes.d.ts.map +1 -0
  941. package/lib/simple-tree/{arrayNodeTypes.js → node-kinds/array/arrayNodeTypes.js} +1 -1
  942. package/{dist/simple-tree → lib/simple-tree/node-kinds/array}/arrayNodeTypes.js.map +1 -1
  943. package/lib/simple-tree/node-kinds/array/index.d.ts +7 -0
  944. package/lib/simple-tree/node-kinds/array/index.d.ts.map +1 -0
  945. package/lib/simple-tree/node-kinds/array/index.js +7 -0
  946. package/lib/simple-tree/node-kinds/array/index.js.map +1 -0
  947. package/lib/simple-tree/node-kinds/index.d.ts +8 -0
  948. package/lib/simple-tree/node-kinds/index.d.ts.map +1 -0
  949. package/lib/simple-tree/node-kinds/index.js +8 -0
  950. package/lib/simple-tree/node-kinds/index.js.map +1 -0
  951. package/lib/simple-tree/node-kinds/map/index.d.ts +7 -0
  952. package/lib/simple-tree/node-kinds/map/index.d.ts.map +1 -0
  953. package/lib/simple-tree/node-kinds/map/index.js +7 -0
  954. package/lib/simple-tree/node-kinds/map/index.js.map +1 -0
  955. package/{dist/simple-tree → lib/simple-tree/node-kinds/map}/mapNode.d.ts +3 -3
  956. package/lib/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -0
  957. package/lib/simple-tree/{mapNode.js → node-kinds/map/mapNode.js} +8 -8
  958. package/lib/simple-tree/node-kinds/map/mapNode.js.map +1 -0
  959. package/lib/simple-tree/{mapNodeTypes.d.ts → node-kinds/map/mapNodeTypes.d.ts} +3 -3
  960. package/lib/simple-tree/node-kinds/map/mapNodeTypes.d.ts.map +1 -0
  961. package/lib/simple-tree/{mapNodeTypes.js → node-kinds/map/mapNodeTypes.js} +1 -1
  962. package/lib/simple-tree/node-kinds/map/mapNodeTypes.js.map +1 -0
  963. package/lib/simple-tree/node-kinds/object/index.d.ts +7 -0
  964. package/lib/simple-tree/node-kinds/object/index.d.ts.map +1 -0
  965. package/lib/simple-tree/node-kinds/object/index.js +7 -0
  966. package/lib/simple-tree/node-kinds/object/index.js.map +1 -0
  967. package/{dist/simple-tree → lib/simple-tree/node-kinds/object}/objectNode.d.ts +17 -6
  968. package/lib/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -0
  969. package/lib/simple-tree/{objectNode.js → node-kinds/object/objectNode.js} +35 -13
  970. package/lib/simple-tree/node-kinds/object/objectNode.js.map +1 -0
  971. package/{dist/simple-tree → lib/simple-tree/node-kinds/object}/objectNodeTypes.d.ts +5 -5
  972. package/lib/simple-tree/node-kinds/object/objectNodeTypes.d.ts.map +1 -0
  973. package/lib/simple-tree/{objectNodeTypes.js → node-kinds/object/objectNodeTypes.js} +1 -1
  974. package/lib/simple-tree/node-kinds/object/objectNodeTypes.js.map +1 -0
  975. package/lib/simple-tree/prepareForInsertion.d.ts +18 -6
  976. package/lib/simple-tree/prepareForInsertion.d.ts.map +1 -1
  977. package/lib/simple-tree/prepareForInsertion.js +51 -22
  978. package/lib/simple-tree/prepareForInsertion.js.map +1 -1
  979. package/lib/simple-tree/schemaTypes.d.ts +2 -2
  980. package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
  981. package/lib/simple-tree/schemaTypes.js.map +1 -1
  982. package/lib/simple-tree/simpleSchema.d.ts.map +1 -1
  983. package/lib/simple-tree/simpleSchema.js.map +1 -1
  984. package/lib/simple-tree/toMapTree.d.ts +2 -22
  985. package/lib/simple-tree/toMapTree.d.ts.map +1 -1
  986. package/lib/simple-tree/toMapTree.js +44 -22
  987. package/lib/simple-tree/toMapTree.js.map +1 -1
  988. package/lib/simple-tree/toStoredSchema.d.ts.map +1 -1
  989. package/lib/simple-tree/toStoredSchema.js +1 -1
  990. package/lib/simple-tree/toStoredSchema.js.map +1 -1
  991. package/lib/simple-tree/treeNodeValid.d.ts +1 -1
  992. package/lib/simple-tree/treeNodeValid.d.ts.map +1 -1
  993. package/lib/simple-tree/treeNodeValid.js +2 -2
  994. package/lib/simple-tree/treeNodeValid.js.map +1 -1
  995. package/lib/simple-tree/walkFieldSchema.d.ts.map +1 -1
  996. package/lib/simple-tree/walkFieldSchema.js.map +1 -1
  997. package/lib/tableSchema.d.ts +119 -72
  998. package/lib/tableSchema.d.ts.map +1 -1
  999. package/lib/tableSchema.js +83 -36
  1000. package/lib/tableSchema.js.map +1 -1
  1001. package/lib/treeFactory.d.ts +1 -1
  1002. package/lib/treeFactory.d.ts.map +1 -1
  1003. package/lib/treeFactory.js +3 -3
  1004. package/lib/treeFactory.js.map +1 -1
  1005. package/lib/util/bTreeUtils.d.ts.map +1 -1
  1006. package/lib/util/bTreeUtils.js.map +1 -1
  1007. package/lib/util/breakable.d.ts +23 -4
  1008. package/lib/util/breakable.d.ts.map +1 -1
  1009. package/lib/util/breakable.js +12 -3
  1010. package/lib/util/breakable.js.map +1 -1
  1011. package/package.json +21 -21
  1012. package/src/codec/codec.ts +64 -8
  1013. package/src/core/change-family/editBuilder.ts +1 -0
  1014. package/src/core/forest/forest.ts +1 -1
  1015. package/src/core/index.ts +1 -0
  1016. package/src/core/rebase/types.ts +2 -2
  1017. package/src/core/rebase/utils.ts +10 -10
  1018. package/src/core/schema-stored/formatV1.ts +0 -2
  1019. package/src/core/schema-stored/index.ts +1 -0
  1020. package/src/core/schema-stored/schema.ts +9 -0
  1021. package/src/core/schema-stored/storedSchemaRepository.ts +2 -2
  1022. package/src/core/tree/anchorSet.ts +6 -5
  1023. package/src/core/tree/chunk.ts +2 -1
  1024. package/src/core/tree/delta.ts +1 -0
  1025. package/src/core/tree/deltaUtil.ts +1 -1
  1026. package/src/core/tree/detachedFieldIndex.ts +1 -1
  1027. package/src/core/tree/detachedFieldIndexCodec.ts +2 -2
  1028. package/src/core/tree/pathTree.ts +13 -12
  1029. package/src/core/tree/treeTextFormat.ts +2 -1
  1030. package/src/core/tree/visitDelta.ts +1 -1
  1031. package/src/core/tree/visitorUtils.ts +3 -2
  1032. package/src/feature-libraries/chunked-forest/chunkTree.ts +2 -2
  1033. package/src/feature-libraries/chunked-forest/chunkedForest.ts +4 -4
  1034. package/src/feature-libraries/chunked-forest/codec/chunkDecoding.ts +5 -5
  1035. package/src/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.ts +2 -2
  1036. package/src/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.ts +1 -0
  1037. package/src/feature-libraries/chunked-forest/codec/codecs.ts +15 -1
  1038. package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +1 -1
  1039. package/src/feature-libraries/chunked-forest/codec/index.ts +1 -0
  1040. package/src/feature-libraries/chunked-forest/codec/nodeShape.ts +1 -1
  1041. package/src/feature-libraries/chunked-forest/codec/schemaBasedEncode.ts +1 -1
  1042. package/src/feature-libraries/chunked-forest/emptyChunk.ts +1 -0
  1043. package/src/feature-libraries/chunked-forest/index.ts +1 -0
  1044. package/src/feature-libraries/chunked-forest/sequenceChunk.ts +1 -1
  1045. package/src/feature-libraries/chunked-forest/uniformChunk.ts +2 -3
  1046. package/src/feature-libraries/default-schema/defaultEditBuilder.ts +2 -2
  1047. package/src/feature-libraries/default-schema/defaultFieldKinds.ts +1 -0
  1048. package/src/feature-libraries/default-schema/index.ts +6 -1
  1049. package/src/feature-libraries/default-schema/mappedEditBuilder.ts +1 -0
  1050. package/src/feature-libraries/default-schema/schemaChecker.ts +74 -48
  1051. package/src/feature-libraries/flex-tree/context.ts +29 -8
  1052. package/src/feature-libraries/flex-tree/flexTreeTypes.ts +3 -2
  1053. package/src/feature-libraries/flex-tree/lazyField.ts +1 -1
  1054. package/src/feature-libraries/flex-tree/utilities.ts +1 -1
  1055. package/src/feature-libraries/forest-summary/forestSummarizer.ts +1 -1
  1056. package/src/feature-libraries/index.ts +3 -2
  1057. package/src/feature-libraries/indexing/anchorTreeIndex.ts +4 -2
  1058. package/src/feature-libraries/initializeForest.ts +1 -1
  1059. package/src/feature-libraries/modular-schema/crossFieldQueries.ts +1 -0
  1060. package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +1 -1
  1061. package/src/feature-libraries/modular-schema/fieldKindWithEditor.ts +1 -1
  1062. package/src/feature-libraries/modular-schema/genericFieldKind.ts +4 -2
  1063. package/src/feature-libraries/modular-schema/genericFieldKindCodecs.ts +1 -0
  1064. package/src/feature-libraries/modular-schema/genericFieldKindTypes.ts +1 -0
  1065. package/src/feature-libraries/modular-schema/isNeverTree.ts +0 -2
  1066. package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +1 -1
  1067. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +2 -0
  1068. package/src/feature-libraries/modular-schema/modularChangeTypes.ts +1 -0
  1069. package/src/feature-libraries/node-identifier/mockNodeIdentifierManager.ts +11 -5
  1070. package/src/feature-libraries/object-forest/objectForest.ts +65 -7
  1071. package/src/feature-libraries/schema-edits/schemaChangeCodecs.ts +5 -8
  1072. package/src/feature-libraries/schema-index/codec.ts +13 -21
  1073. package/src/feature-libraries/schema-index/formatV1.ts +2 -2
  1074. package/src/feature-libraries/schema-index/index.ts +0 -1
  1075. package/src/feature-libraries/schema-index/schemaSummarizer.ts +1 -1
  1076. package/src/feature-libraries/sequence-field/formatV3.ts +1 -0
  1077. package/src/feature-libraries/sequence-field/markQueue.ts +1 -0
  1078. package/src/feature-libraries/sequence-field/prune.ts +1 -0
  1079. package/src/feature-libraries/sequence-field/rebase.ts +1 -1
  1080. package/src/feature-libraries/sequence-field/relevantRemovedRoots.ts +1 -1
  1081. package/src/feature-libraries/sequence-field/replaceRevisions.ts +3 -1
  1082. package/src/feature-libraries/sequence-field/sequenceFieldCodecV1.ts +2 -2
  1083. package/src/feature-libraries/sequence-field/sequenceFieldCodecV2.ts +3 -3
  1084. package/src/feature-libraries/sequence-field/sequenceFieldCodecV3.ts +3 -3
  1085. package/src/feature-libraries/sequence-field/sequenceFieldCodecs.ts +2 -2
  1086. package/src/feature-libraries/sequence-field/sequenceFieldToDelta.ts +1 -1
  1087. package/src/feature-libraries/sequence-field/utils.ts +7 -5
  1088. package/src/feature-libraries/treeCursorUtils.ts +3 -3
  1089. package/src/feature-libraries/treeTextCursor.ts +1 -1
  1090. package/src/feature-libraries/valueUtilities.ts +1 -1
  1091. package/src/index.ts +1 -4
  1092. package/src/jsonDomainSchema.ts +0 -1
  1093. package/src/packageVersion.ts +1 -1
  1094. package/src/serializableDomainSchema.ts +1 -0
  1095. package/src/shared-tree/checkoutFlexTreeView.ts +1 -0
  1096. package/src/shared-tree/independentView.ts +10 -3
  1097. package/src/shared-tree/index.ts +4 -1
  1098. package/src/shared-tree/schematizeTree.ts +2 -1
  1099. package/src/shared-tree/schematizingTreeView.ts +2 -2
  1100. package/src/shared-tree/sharedTree.ts +26 -19
  1101. package/src/shared-tree/sharedTreeChangeFamily.ts +1 -1
  1102. package/src/shared-tree/tree.ts +1 -1
  1103. package/src/shared-tree/treeAlpha.ts +171 -26
  1104. package/src/shared-tree/treeCheckout.ts +3 -2
  1105. package/src/shared-tree-core/branch.ts +3 -4
  1106. package/src/shared-tree-core/branchCommitEnricher.ts +3 -1
  1107. package/src/shared-tree-core/defaultResubmitMachine.ts +2 -0
  1108. package/src/shared-tree-core/editManager.ts +4 -2
  1109. package/src/shared-tree-core/editManagerCodecs.ts +1 -0
  1110. package/src/shared-tree-core/editManagerSummarizer.ts +1 -1
  1111. package/src/shared-tree-core/messageCodecs.ts +1 -1
  1112. package/src/shared-tree-core/sequenceIdUtils.ts +1 -0
  1113. package/src/shared-tree-core/sharedTreeCore.ts +5 -5
  1114. package/src/shared-tree-core/transaction.ts +4 -2
  1115. package/src/shared-tree-core/transactionEnricher.ts +2 -0
  1116. package/src/sharedTreeAttributes.ts +1 -0
  1117. package/src/simple-tree/api/conciseTree.ts +3 -2
  1118. package/src/simple-tree/api/configuration.ts +1 -1
  1119. package/src/simple-tree/api/create.ts +4 -80
  1120. package/src/simple-tree/api/customTree.ts +4 -4
  1121. package/src/simple-tree/api/getSimpleSchema.ts +1 -0
  1122. package/src/simple-tree/api/identifierIndex.ts +1 -1
  1123. package/src/simple-tree/api/index.ts +8 -11
  1124. package/src/simple-tree/api/schemaCompatibilityTester.ts +2 -0
  1125. package/src/simple-tree/api/schemaFactory.ts +28 -23
  1126. package/src/simple-tree/api/schemaFactoryAlpha.ts +8 -6
  1127. package/src/simple-tree/api/schemaFactoryRecursive.ts +3 -3
  1128. package/src/simple-tree/api/schemaFromSimple.ts +3 -1
  1129. package/src/simple-tree/api/simpleSchemaToJsonSchema.ts +1 -3
  1130. package/src/simple-tree/api/storedSchema.ts +5 -4
  1131. package/src/simple-tree/api/tree.ts +3 -4
  1132. package/src/simple-tree/api/treeBeta.ts +3 -2
  1133. package/src/simple-tree/api/treeNodeApi.ts +91 -42
  1134. package/src/simple-tree/api/typesUnsafe.ts +1 -1
  1135. package/src/simple-tree/api/verboseTree.ts +1 -1
  1136. package/src/simple-tree/api/viewSchemaToSimpleSchema.ts +1 -3
  1137. package/src/simple-tree/core/context.ts +1 -0
  1138. package/src/simple-tree/core/getOrCreateNode.ts +4 -3
  1139. package/src/simple-tree/core/treeNode.ts +1 -1
  1140. package/src/simple-tree/core/treeNodeKernel.ts +32 -61
  1141. package/src/simple-tree/core/treeNodeSchema.ts +1 -0
  1142. package/src/simple-tree/core/types.ts +1 -1
  1143. package/src/simple-tree/core/unhydratedFlexTree.ts +4 -3
  1144. package/src/simple-tree/core/withType.ts +1 -1
  1145. package/src/simple-tree/createContext.ts +1 -0
  1146. package/src/simple-tree/{proxies.ts → getTreeNodeForField.ts} +2 -0
  1147. package/src/simple-tree/index.ts +17 -22
  1148. package/src/simple-tree/leafNodeSchema.ts +1 -0
  1149. package/src/simple-tree/{arrayNode.ts → node-kinds/array/arrayNode.ts} +11 -11
  1150. package/src/simple-tree/{arrayNodeTypes.ts → node-kinds/array/arrayNodeTypes.ts} +3 -3
  1151. package/src/simple-tree/node-kinds/array/index.ts +18 -0
  1152. package/src/simple-tree/node-kinds/index.ts +40 -0
  1153. package/src/simple-tree/node-kinds/map/index.ts +16 -0
  1154. package/src/simple-tree/{mapNode.ts → node-kinds/map/mapNode.ts} +10 -10
  1155. package/src/simple-tree/{mapNodeTypes.ts → node-kinds/map/mapNodeTypes.ts} +3 -3
  1156. package/src/simple-tree/node-kinds/object/index.ts +17 -0
  1157. package/src/simple-tree/{objectNode.ts → node-kinds/object/objectNode.ts} +63 -34
  1158. package/src/simple-tree/{objectNodeTypes.ts → node-kinds/object/objectNodeTypes.ts} +5 -5
  1159. package/src/simple-tree/prepareForInsertion.ts +68 -28
  1160. package/src/simple-tree/schemaTypes.ts +4 -3
  1161. package/src/simple-tree/simpleSchema.ts +1 -0
  1162. package/src/simple-tree/toMapTree.ts +13 -56
  1163. package/src/simple-tree/toStoredSchema.ts +3 -2
  1164. package/src/simple-tree/treeNodeValid.ts +3 -3
  1165. package/src/simple-tree/walkFieldSchema.ts +0 -1
  1166. package/src/tableSchema.ts +109 -62
  1167. package/src/treeFactory.ts +3 -5
  1168. package/src/util/bTreeUtils.ts +1 -0
  1169. package/src/util/breakable.ts +19 -4
  1170. package/dist/simple-tree/api/testRecursiveDomain.d.ts +0 -62
  1171. package/dist/simple-tree/api/testRecursiveDomain.d.ts.map +0 -1
  1172. package/dist/simple-tree/api/testRecursiveDomain.js +0 -45
  1173. package/dist/simple-tree/api/testRecursiveDomain.js.map +0 -1
  1174. package/dist/simple-tree/arrayNode.d.ts.map +0 -1
  1175. package/dist/simple-tree/arrayNode.js.map +0 -1
  1176. package/dist/simple-tree/arrayNodeTypes.d.ts.map +0 -1
  1177. package/dist/simple-tree/mapNode.d.ts.map +0 -1
  1178. package/dist/simple-tree/mapNode.js.map +0 -1
  1179. package/dist/simple-tree/mapNodeTypes.d.ts.map +0 -1
  1180. package/dist/simple-tree/mapNodeTypes.js.map +0 -1
  1181. package/dist/simple-tree/objectNode.d.ts.map +0 -1
  1182. package/dist/simple-tree/objectNode.js.map +0 -1
  1183. package/dist/simple-tree/objectNodeTypes.d.ts.map +0 -1
  1184. package/dist/simple-tree/objectNodeTypes.js.map +0 -1
  1185. package/dist/simple-tree/proxies.d.ts.map +0 -1
  1186. package/dist/simple-tree/proxies.js.map +0 -1
  1187. package/lib/simple-tree/api/testRecursiveDomain.d.ts +0 -62
  1188. package/lib/simple-tree/api/testRecursiveDomain.d.ts.map +0 -1
  1189. package/lib/simple-tree/api/testRecursiveDomain.js +0 -41
  1190. package/lib/simple-tree/api/testRecursiveDomain.js.map +0 -1
  1191. package/lib/simple-tree/arrayNode.d.ts.map +0 -1
  1192. package/lib/simple-tree/arrayNode.js.map +0 -1
  1193. package/lib/simple-tree/arrayNodeTypes.d.ts.map +0 -1
  1194. package/lib/simple-tree/arrayNodeTypes.js.map +0 -1
  1195. package/lib/simple-tree/mapNode.d.ts.map +0 -1
  1196. package/lib/simple-tree/mapNode.js.map +0 -1
  1197. package/lib/simple-tree/mapNodeTypes.d.ts.map +0 -1
  1198. package/lib/simple-tree/mapNodeTypes.js.map +0 -1
  1199. package/lib/simple-tree/objectNode.d.ts.map +0 -1
  1200. package/lib/simple-tree/objectNode.js.map +0 -1
  1201. package/lib/simple-tree/objectNodeTypes.d.ts.map +0 -1
  1202. package/lib/simple-tree/objectNodeTypes.js.map +0 -1
  1203. package/lib/simple-tree/proxies.d.ts.map +0 -1
  1204. package/lib/simple-tree/proxies.js.map +0 -1
  1205. package/src/simple-tree/api/testRecursiveDomain.ts +0 -53
@@ -1 +1 @@
1
- {"version":3,"file":"sharedTree.js","sourceRoot":"","sources":["../../src/shared-tree/sharedTree.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,kEAAmE;AAYnE,uEAGkD;AAGlD,gDAAsE;AACtE,+CAmB0B;AAE1B,4DAeuC;AACvC,2DAKsC;AACtC,sDAoBiC;AAEjC,uEAAuE;AACvE,+EAAiF;AACjF,2EAAqE;AAGrE,uDAA+F;AAC/F,+CAK0B;AAyE1B,MAAM,oCAAoC,GAAG,IAAI,GAAG,CAAgC;IACnF;QACC,CAAC;QACD,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,kBAAkB,EAAE,CAAC,EAAE,WAAW,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE;KAC1F;IACD;QACC,CAAC;QACD,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,kBAAkB,EAAE,CAAC,EAAE,WAAW,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE;KAC1F;IACD;QACC,CAAC;QACD,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,kBAAkB,EAAE,CAAC,EAAE,WAAW,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE;KAC1F;IACD;QACC,CAAC;QACD,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,kBAAkB,EAAE,CAAC,EAAE,WAAW,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE;KAC1F;CACD,CAAC,CAAC;AAEH,SAAS,gBAAgB,CAAC,aAAqB;IAC9C,MAAM,QAAQ,GAAG,oC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IAAI,KAAK,qBAAU,CAAC,QAAQ,CAAC,UAAU,EACxD,KAAK,CAAC,wBAAwB,CAC9B,CAAC;QACF,OAAO;YACN,IAAI,EAAE,mBAAQ,CAAC,GAAG;YAClB,uBAAuB,EAAE,MAAM,CAAC,SAAS,CAAC,KAAK;YAC/C,QAAQ,EAAE,EAAE;SACZ,CAAC;IACH,CAAC;IACD,IAAI,MAAM,YAAY,+BAAoB,EAAE,CAAC;QAC5C,OAAO,EAAE,IAAI,EAAE,mBAAQ,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,CAAC,SAAS,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;IAC1E,CAAC;IACD,IAAA,eAAI,EAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC;AACvC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, fail } from \"@fluidframework/core-utils/internal\";\nimport type {\n\tErasedType,\n\tIFluidHandle,\n\tIFluidLoadable,\n} from \"@fluidframework/core-interfaces/internal\";\nimport type { IChannelStorageService } from \"@fluidframework/datastore-definitions/internal\";\nimport type {\n\tIChannelView,\n\tIFluidSerializer,\n\tSharedKernel,\n} from \"@fluidframework/shared-object-base/internal\";\nimport {\n\tUsageError,\n\ttype ITelemetryLoggerExt,\n} from \"@fluidframework/telemetry-utils/internal\";\nimport type { IIdCompressor } from \"@fluidframework/id-compressor\";\n\nimport { type ICodecOptions, noopValidator } from \"../codec/index.js\";\nimport {\n\ttype FieldKey,\n\ttype GraphCommit,\n\ttype IEditableForest,\n\ttype ITreeCursor,\n\ttype JsonableTree,\n\tLeafNodeStoredSchema,\n\tMapNodeStoredSchema,\n\tObjectNodeStoredSchema,\n\tRevisionTagCodec,\n\ttype TaggedChange,\n\ttype TreeFieldStoredSchema,\n\ttype TreeNodeSchemaIdentifier,\n\ttype TreeNodeStoredSchema,\n\ttype TreeStoredSchema,\n\tTreeStoredSchemaRepository,\n\ttype TreeStoredSchemaSubscription,\n\tmakeDetachedFieldIndex,\n\tmoveToDetachedField,\n} from \"../core/index.js\";\n\nimport {\n\tDetachedFieldIndexSummarizer,\n\tFieldKinds,\n\tForestSummarizer,\n\tSchemaCodecVersion,\n\tSchemaSummarizer,\n\tTreeCompressionStrategy,\n\tbuildChunkedForest,\n\tbuildForest,\n\tdefaultSchemaPolicy,\n\tjsonableTreeFromFieldCursor,\n\tmakeFieldBatchCodec,\n\tmakeMitigatedChangeFamily,\n\tmakeSchemaCodec,\n\tmakeTreeChunker,\n} from \"../feature-libraries/index.js\";\nimport {\n\ttype ClonableSchemaAndPolicy,\n\tDefaultResubmitMachine,\n\ttype ExplicitCoreCodecVersions,\n\tSharedTreeCore,\n} from \"../shared-tree-core/index.js\";\nimport {\n\ttype ITree,\n\ttype ImplicitFieldSchema,\n\tNodeKind,\n\ttype ReadSchema,\n\ttype SimpleFieldSchema,\n\ttype SimpleTreeSchema,\n\ttype TreeView,\n\ttype TreeViewAlpha,\n\ttype TreeViewConfiguration,\n\ttype UnsafeUnknownSchema,\n\ttype VerboseTree,\n\ttryStoredSchemaAsArray,\n\ttype SimpleNodeSchema,\n\tcustomFromCursorStored,\n\tFieldKind,\n\ttype CustomTreeNode,\n\ttype CustomTreeValue,\n\ttype ITreeAlpha,\n\ttype SimpleObjectFieldSchema,\n} from \"../simple-tree/index.js\";\n\nimport { SchematizingSimpleTreeView } from \"./schematizingTreeView.js\";\nimport { SharedTreeReadonlyChangeEnricher } from \"./sharedTreeChangeEnricher.js\";\nimport { SharedTreeChangeFamily } from \"./sharedTreeChangeFamily.js\";\nimport type { SharedTreeChange } from \"./sharedTreeChangeTypes.js\";\nimport type { SharedTreeEditBuilder } from \"./sharedTreeEditBuilder.js\";\nimport { type TreeCheckout, type BranchableTree, createTreeCheckout } from \"./treeCheckout.js\";\nimport {\n\ttype Breakable,\n\tbreakingClass,\n\ttype JsonCompatible,\n\tthrowIfBroken,\n} from \"../util/index.js\";\n// eslint-disable-next-line import/no-internal-modules\nimport type { Format } from \"../feature-libraries/schema-index/index.js\";\n\n/**\n * Copy of data from an {@link ITreePrivate} at some point in time.\n * @remarks\n * This is unrelated to Fluids concept of \"snapshots\".\n */\nexport interface SharedTreeContentSnapshot {\n\t/**\n\t * The schema stored in the document.\n\t *\n\t * @remarks\n\t * Edits to the schema can mutate the schema stored of the tree which took this snapshot (but this snapshot will remain the same)\n\t * This is mainly useful for debugging cases where schematize reports an incompatible view schema.\n\t */\n\treadonly schema: TreeStoredSchema;\n\t/**\n\t * All {@link TreeStatus.InDocument} content.\n\t */\n\treadonly tree: JsonableTree[];\n\t/**\n\t * All {@link TreeStatus.Removed} content.\n\t */\n\treadonly removed: [string | number | undefined, number, JsonableTree][];\n}\n\n/**\n * {@link ITree} extended with some non-public APIs.\n * @internal\n */\nexport interface ITreeInternal extends IChannelView, ITreeAlpha {}\n\n/**\n * {@link ITreeInternal} extended with some non-exported APIs.\n * @remarks\n * This allows access to the tree content using the internal data model used at the storage and \"flex\" layers,\n * and should only be needed for testing and debugging this package's internals.\n */\nexport interface ITreePrivate extends ITreeInternal {\n\t/**\n\t * Provides a copy of the current content of the tree.\n\t * This can be useful for inspecting the tree when no suitable view schema is available.\n\t * This is only intended for use in testing and exceptional code paths: it is not performant.\n\t *\n\t * This does not include everything that is included in a tree summary, since information about how to merge future edits is omitted.\n\t */\n\tcontentSnapshot(): SharedTreeContentSnapshot;\n\n\t/**\n\t * Access to internals for testing.\n\t */\n\treadonly kernel: SharedTreeKernel;\n}\n\n/**\n * Has an entry for each codec which writes an explicit version into its data.\n *\n * This is used to map the single API entrypoint controlling the format {@link SharedTreeOptions.formatVersion}\n * to a list of write versions that for each codec that should be used for that format.\n *\n * Note that all explicitly versioned codecs should be using the format version from the data to read encoded data.\n *\n * TODO: Plumb these write versions into forest, schema, detached field index codec creation.\n */\ninterface ExplicitCodecVersions extends ExplicitCoreCodecVersions {\n\tforest: number;\n\tschema: SchemaCodecVersion;\n\tdetachedFieldIndex: number;\n\tfieldBatch: number;\n}\n\nconst formatVersionToTopLevelCodecVersions = new Map<number, ExplicitCodecVersions>([\n\t[\n\t\t1,\n\t\t{ forest: 1, schema: 1, detachedFieldIndex: 1, editManager: 1, message: 1, fieldBatch: 1 },\n\t],\n\t[\n\t\t2,\n\t\t{ forest: 1, schema: 1, detachedFieldIndex: 1, editManager: 2, message: 2, fieldBatch: 1 },\n\t],\n\t[\n\t\t3,\n\t\t{ forest: 1, schema: 1, detachedFieldIndex: 1, editManager: 3, message: 3, fieldBatch: 1 },\n\t],\n\t[\n\t\t4,\n\t\t{ forest: 1, schema: 1, detachedFieldIndex: 1, editManager: 4, message: 4, fieldBatch: 1 },\n\t],\n]);\n\nfunction getCodecVersions(formatVersion: number): ExplicitCodecVersions {\n\tconst versions = formatVersionToTopLevelCodecVersions.get(formatVersion);\n\tassert(versions !== undefined, 0x90e /* Unknown format version */);\n\treturn versions;\n}\n\n/**\n * The type SharedTree's kernel's view must implement so what when its merged with the underling SharedObject's API it fully implements the required tree API surface ({@link ITreePrivate }).\n */\nexport type SharedTreeKernelView = Omit<ITreePrivate, keyof (IChannelView & IFluidLoadable)>;\n\n/**\n * SharedTreeCore, configured with a good set of indexes and field kinds which will maintain compatibility over time.\n *\n * TODO: detail compatibility requirements.\n */\n@breakingClass\nexport class SharedTreeKernel\n\textends SharedTreeCore<SharedTreeEditBuilder, SharedTreeChange>\n\timplements SharedKernel\n{\n\tpublic readonly checkout: TreeCheckout;\n\tpublic get storedSchema(): TreeStoredSchemaRepository {\n\t\treturn this.checkout.storedSchema;\n\t}\n\n\t/**\n\t * The app-facing API for SharedTree implemented by this Kernel.\n\t * @remarks\n\t * This is the API grafted onto the ISharedObject which apps can access.\n\t * It includes both the APIs used for internal testing, and public facing APIs (both stable and unstable).\n\t * Different users will have access to different subsets of this API, see {@link ITree}, {@link ITreeAlpha} and {@link ITreeInternal} which this {@link ITreePrivate} extends.\n\t */\n\tpublic readonly view: SharedTreeKernelView;\n\n\tpublic constructor(\n\t\tbreaker: Breakable,\n\t\tsharedObject: IChannelView & IFluidLoadable,\n\t\tserializer: IFluidSerializer,\n\t\tsubmitLocalMessage: (content: unknown, localOpMetadata?: unknown) => void,\n\t\tlastSequenceNumber: () => number | undefined,\n\t\tlogger: ITelemetryLoggerExt | undefined,\n\t\tidCompressor: IIdCompressor,\n\t\toptionsParam: SharedTreeOptionsInternal,\n\t) {\n\t\tconst options = { ...defaultSharedTreeOptions, ...optionsParam };\n\t\tconst codecVersions = getCodecVersions(options.formatVersion);\n\t\tconst schema = new TreeStoredSchemaRepository();\n\t\tconst forest = buildConfiguredForest(options.forest, schema, idCompressor);\n\t\tconst revisionTagCodec = new RevisionTagCodec(idCompressor);\n\t\tconst removedRoots = makeDetachedFieldIndex(\n\t\t\t\"repair\",\n\t\t\trevisionTagCodec,\n\t\t\tidCompressor,\n\t\t\toptions,\n\t\t);\n\t\tconst schemaCodec = makeSchemaCodec(options, codecVersions.schema);\n\t\tconst schemaSummarizer = new SchemaSummarizer(\n\t\t\tschema,\n\t\t\t{\n\t\t\t\tgetCurrentSeq: lastSequenceNumber,\n\t\t\t},\n\t\t\tschemaCodec,\n\t\t);\n\t\tconst fieldBatchCodec = makeFieldBatchCodec(options, codecVersions.fieldBatch);\n\n\t\tconst encoderContext = {\n\t\t\tschema: {\n\t\t\t\tschema,\n\t\t\t\tpolicy: defaultSchemaPolicy,\n\t\t\t},\n\t\t\tencodeType: options.treeEncodeType,\n\t\t\toriginatorId: idCompressor.localSessionId,\n\t\t\tidCompressor,\n\t\t};\n\t\tconst forestSummarizer = new ForestSummarizer(\n\t\t\tforest,\n\t\t\trevisionTagCodec,\n\t\t\tfieldBatchCodec,\n\t\t\tencoderContext,\n\t\t\toptions,\n\t\t\tidCompressor,\n\t\t);\n\t\tconst removedRootsSummarizer = new DetachedFieldIndexSummarizer(removedRoots);\n\t\tconst innerChangeFamily = new SharedTreeChangeFamily(\n\t\t\trevisionTagCodec,\n\t\t\tfieldBatchCodec,\n\t\t\toptions,\n\t\t\toptions.treeEncodeType,\n\t\t\tidCompressor,\n\t\t);\n\t\tconst changeFamily = makeMitigatedChangeFamily(\n\t\t\tinnerChangeFamily,\n\t\t\tSharedTreeChangeFamily.emptyChange,\n\t\t\t(error: unknown) => {\n\t\t\t\t// TODO:6344 Add telemetry for these errors.\n\t\t\t\t// Rethrowing the error has a different effect depending on the context in which the\n\t\t\t\t// ChangeFamily was invoked:\n\t\t\t\t// - If the ChangeFamily was invoked as part of incoming op processing, rethrowing the error\n\t\t\t\t// will cause the runtime to disconnect the client, log a severe error, and not reconnect.\n\t\t\t\t// This will not cause the host application to crash because it is not on the stack at that time.\n\t\t\t\t// TODO: let the host application know that the client is now disconnected.\n\t\t\t\t// - If the ChangeFamily was invoked as part of dealing with a local change, rethrowing the\n\t\t\t\t// error will cause the host application to crash. This is not ideal, but is better than\n\t\t\t\t// letting the application either send an invalid change to the server or allowing the\n\t\t\t\t// application to continue working when its local branches contain edits that cannot be\n\t\t\t\t// reflected in its views.\n\t\t\t\t// The best course of action for a host application in such a state is to restart.\n\t\t\t\t// TODO: let the host application know about this situation and provide a way to\n\t\t\t\t// programmatically reload the SharedTree container.\n\t\t\t\tthrow error;\n\t\t\t},\n\t\t);\n\t\tconst changeEnricher = new SharedTreeReadonlyChangeEnricher(forest, schema, removedRoots);\n\t\tsuper(\n\t\t\tbreaker,\n\t\t\tsharedObject,\n\t\t\tserializer,\n\t\t\tsubmitLocalMessage,\n\t\t\tlogger,\n\t\t\t[schemaSummarizer, forestSummarizer, removedRootsSummarizer],\n\t\t\tchangeFamily,\n\t\t\toptions,\n\t\t\tcodecVersions,\n\t\t\tidCompressor,\n\t\t\tschema,\n\t\t\tdefaultSchemaPolicy,\n\t\t\tnew DefaultResubmitMachine(\n\t\t\t\t(change: TaggedChange<SharedTreeChange>) =>\n\t\t\t\t\tchangeFamily.rebaser.invert(change, true, this.mintRevisionTag()),\n\t\t\t\tchangeEnricher,\n\t\t\t),\n\t\t\tchangeEnricher,\n\t\t);\n\t\tconst localBranch = this.getLocalBranch();\n\t\tthis.checkout = createTreeCheckout(idCompressor, this.mintRevisionTag, revisionTagCodec, {\n\t\t\tbranch: localBranch,\n\t\t\tchangeFamily,\n\t\t\tschema,\n\t\t\tforest,\n\t\t\tfieldBatchCodec,\n\t\t\tremovedRoots,\n\t\t\tchunkCompressionStrategy: options.treeEncodeType,\n\t\t\tlogger,\n\t\t\tbreaker: this.breaker,\n\t\t\tdisposeForksAfterTransaction: options.disposeForksAfterTransaction,\n\t\t});\n\n\t\tthis.checkout.transaction.events.on(\"started\", () => {\n\t\t\tif (sharedObject.isAttached()) {\n\t\t\t\t// It is currently forbidden to attach during a transaction, so transaction state changes can be ignored until after attaching.\n\t\t\t\tthis.commitEnricher.startTransaction();\n\t\t\t}\n\t\t});\n\t\tthis.checkout.transaction.events.on(\"aborting\", () => {\n\t\t\tif (sharedObject.isAttached()) {\n\t\t\t\t// It is currently forbidden to attach during a transaction, so transaction state changes can be ignored until after attaching.\n\t\t\t\tthis.commitEnricher.abortTransaction();\n\t\t\t}\n\t\t});\n\t\tthis.checkout.transaction.events.on(\"committing\", () => {\n\t\t\tif (sharedObject.isAttached()) {\n\t\t\t\t// It is currently forbidden to attach during a transaction, so transaction state changes can be ignored until after attaching.\n\t\t\t\tthis.commitEnricher.commitTransaction();\n\t\t\t}\n\t\t});\n\t\tthis.checkout.events.on(\"beforeBatch\", (event) => {\n\t\t\tif (event.type === \"append\" && sharedObject.isAttached()) {\n\t\t\t\tif (this.checkout.transaction.isInProgress()) {\n\t\t\t\t\tthis.commitEnricher.addTransactionCommits(event.newCommits);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\tthis.view = {\n\t\t\tcontentSnapshot: () => this.contentSnapshot(),\n\t\t\texportSimpleSchema: () => this.exportSimpleSchema(),\n\t\t\texportVerbose: () => this.exportVerbose(),\n\t\t\tviewWith: this.viewWith.bind(this),\n\t\t\tkernel: this,\n\t\t};\n\t}\n\n\tpublic exportVerbose(): VerboseTree | undefined {\n\t\tconst cursor = this.checkout.forest.allocateCursor(\"contentSnapshot\");\n\t\ttry {\n\t\t\tmoveToDetachedField(this.checkout.forest, cursor);\n\t\t\tconst length = cursor.getFieldLength();\n\t\t\tif (length === 0) {\n\t\t\t\treturn undefined;\n\t\t\t} else if (length === 1) {\n\t\t\t\tcursor.enterNode(0);\n\t\t\t\treturn verboseFromCursor(cursor, this.storedSchema.nodeSchema);\n\t\t\t} else {\n\t\t\t\tfail(0xac8 /* Invalid document root length */);\n\t\t\t}\n\t\t} finally {\n\t\t\tcursor.free();\n\t\t}\n\t}\n\n\tpublic exportSimpleSchema(): SimpleTreeSchema {\n\t\treturn exportSimpleSchema(this.storedSchema);\n\t}\n\n\t@throwIfBroken\n\tpublic contentSnapshot(): SharedTreeContentSnapshot {\n\t\tconst cursor = this.checkout.forest.allocateCursor(\"contentSnapshot\");\n\t\ttry {\n\t\t\tmoveToDetachedField(this.checkout.forest, cursor);\n\t\t\treturn {\n\t\t\t\tschema: this.storedSchema.clone(),\n\t\t\t\ttree: jsonableTreeFromFieldCursor(cursor),\n\t\t\t\tremoved: this.checkout.getRemovedRoots(),\n\t\t\t};\n\t\t} finally {\n\t\t\tcursor.free();\n\t\t}\n\t}\n\n\t// For the new TreeViewAlpha API\n\tpublic viewWith<TRoot extends ImplicitFieldSchema | UnsafeUnknownSchema>(\n\t\tconfig: TreeViewConfiguration<ReadSchema<TRoot>>,\n\t): SchematizingSimpleTreeView<TRoot> & TreeView<ReadSchema<TRoot>>;\n\n\t// For the old TreeView API\n\tpublic viewWith<TRoot extends ImplicitFieldSchema>(\n\t\tconfig: TreeViewConfiguration<TRoot>,\n\t): SchematizingSimpleTreeView<TRoot> & TreeView<TRoot>;\n\n\tpublic viewWith<TRoot extends ImplicitFieldSchema | UnsafeUnknownSchema>(\n\t\tconfig: TreeViewConfiguration<ReadSchema<TRoot>>,\n\t): SchematizingSimpleTreeView<TRoot> & TreeView<ReadSchema<TRoot>> {\n\t\treturn this.checkout.viewWith(config) as SchematizingSimpleTreeView<TRoot> &\n\t\t\tTreeView<ReadSchema<TRoot>>;\n\t}\n\n\tpublic override async loadCore(services: IChannelStorageService): Promise<void> {\n\t\tawait super.loadCore(services);\n\t\tthis.checkout.load();\n\t}\n\n\tpublic override didAttach(): void {\n\t\tif (this.checkout.transaction.isInProgress()) {\n\t\t\t// Attaching during a transaction is not currently supported.\n\t\t\t// At least part of of the system is known to not handle this case correctly - commit enrichment - and there may be others.\n\t\t\tthrow new UsageError(\n\t\t\t\t\"Cannot attach while a transaction is in progress. Commit or abort the transaction before attaching.\",\n\t\t\t);\n\t\t}\n\t\tsuper.didAttach();\n\t}\n\n\tpublic override applyStashedOp(\n\t\t...args: Parameters<\n\t\t\tSharedTreeCore<SharedTreeEditBuilder, SharedTreeChange>[\"applyStashedOp\"]\n\t\t>\n\t): void {\n\t\tassert(\n\t\t\t!this.checkout.transaction.isInProgress(),\n\t\t\t0x674 /* Unexpected transaction is open while applying stashed ops */,\n\t\t);\n\t\tsuper.applyStashedOp(...args);\n\t}\n\n\tprotected override submitCommit(\n\t\tcommit: GraphCommit<SharedTreeChange>,\n\t\tschemaAndPolicy: ClonableSchemaAndPolicy,\n\t\tisResubmit: boolean,\n\t): void {\n\t\tassert(\n\t\t\t!this.checkout.transaction.isInProgress(),\n\t\t\t0xaa6 /* Cannot submit a commit while a transaction is in progress */,\n\t\t);\n\t\tif (isResubmit) {\n\t\t\treturn super.submitCommit(commit, schemaAndPolicy, isResubmit);\n\t\t}\n\n\t\t// Refrain from submitting new commits until they are validated by the checkout.\n\t\t// This is not a strict requirement for correctness in our system, but in the event that there is a bug when applying commits to the checkout\n\t\t// that causes a crash (e.g. in the forest), this will at least prevent this client from sending the problematic commit to any other clients.\n\t\tthis.checkout.onCommitValid(commit, () =>\n\t\t\tsuper.submitCommit(commit, schemaAndPolicy, isResubmit),\n\t\t);\n\t}\n\n\tpublic onDisconnect(): void {}\n}\n\nexport function exportSimpleSchema(storedSchema: TreeStoredSchema): SimpleTreeSchema {\n\treturn {\n\t\troot: exportSimpleFieldSchemaStored(storedSchema.rootFieldSchema),\n\t\tdefinitions: new Map(\n\t\t\t[...storedSchema.nodeSchema].map(([key, schema]) => {\n\t\t\t\treturn [key, exportSimpleNodeSchemaStored(schema)];\n\t\t\t}),\n\t\t),\n\t};\n}\n\n/**\n * A way to parse schema in the persisted format from {@link extractPersistedSchema}.\n * @remarks\n * This behaves identically to {@link ITreeAlpha.exportSimpleSchema},\n * except that it gets the schema from the caller instead of from an existing tree.\n *\n * This can be useful for inspecting the contents of persisted schema,\n * such as those generated by {@link extractPersistedSchema} for use in testing.\n * Since that data format is otherwise unspecified,\n * this provides a way to inspect its contents with documented semantics.\n * @alpha\n */\nexport function persistedToSimpleSchema(\n\tpersisted: JsonCompatible,\n\toptions: ICodecOptions,\n): SimpleTreeSchema {\n\tconst schemaCodec = makeSchemaCodec(options, SchemaCodecVersion.v1);\n\tconst stored = schemaCodec.decode(persisted as Format);\n\treturn exportSimpleSchema(stored);\n}\n\n/**\n * Get a {@link BranchableTree} from a {@link ITree}.\n * @remarks The branch can be used for \"version control\"-style coordination of edits on the tree.\n * @privateRemarks This function will be removed if/when the branching API becomes public,\n * but it (or something like it) is necessary in the meantime to prevent the alpha types from being exposed as public.\n * @alpha\n * @deprecated This API is superseded by {@link TreeBranch}, which should be used instead.\n */\nexport function getBranch(tree: ITree): BranchableTree;\n/**\n * Get a {@link BranchableTree} from a {@link TreeView}.\n * @remarks The branch can be used for \"version control\"-style coordination of edits on the tree.\n * Branches are currently an unstable \"alpha\" API and are subject to change in the future.\n * @privateRemarks This function will be removed if/when the branching API becomes public,\n * but it (or something like it) is necessary in the meantime to prevent the alpha types from being exposed as public.\n * @alpha\n * @deprecated This API is superseded by {@link TreeBranch}, which should be used instead.\n */\nexport function getBranch<T extends ImplicitFieldSchema | UnsafeUnknownSchema>(\n\tview: TreeViewAlpha<T>,\n): BranchableTree;\nexport function getBranch<T extends ImplicitFieldSchema | UnsafeUnknownSchema>(\n\ttreeOrView: ITree | TreeViewAlpha<T>,\n): BranchableTree {\n\tif (treeOrView instanceof SchematizingSimpleTreeView) {\n\t\treturn treeOrView.checkout as unknown as BranchableTree;\n\t}\n\tconst kernel = (treeOrView as ITree as ITreePrivate).kernel;\n\tassert(kernel instanceof SharedTreeKernel, 0xb56 /* Invalid ITree */);\n\t// This cast is safe so long as TreeCheckout supports all the operations on the branch interface.\n\treturn kernel.checkout as unknown as BranchableTree;\n}\n\n/**\n * Format versions supported by SharedTree.\n *\n * Each version documents a required minimum version of the \\@fluidframework/tree package.\n * @alpha\n */\nexport const SharedTreeFormatVersion = {\n\t/**\n\t * Requires \\@fluidframework/tree \\>= 2.0.0.\n\t *\n\t * @deprecated - FF does not currently plan on supporting this format long-term.\n\t * Do not write production documents using this format, as they may not be loadable in the future.\n\t */\n\tv1: 1,\n\n\t/**\n\t * Requires \\@fluidframework/tree \\>= 2.0.0.\n\t */\n\tv2: 2,\n\n\t/**\n\t * Requires \\@fluidframework/tree \\>= 2.0.0.\n\t */\n\tv3: 3,\n} as const;\n\n/**\n * Format versions supported by SharedTree.\n *\n * Each version documents a required minimum version of the \\@fluidframework/tree package.\n * @alpha\n * @privateRemarks\n * See packages/dds/tree/docs/main/compatibility.md for information on how to add support for a new format.\n *\n * TODO: Before this gets promoted past Alpha,\n * a separate abstraction more suited for use in the public API should be adopted rather than reusing the same types used internally.\n * Such an abstraction should probably be in the form of a Fluid-Framework wide compatibility enum.\n */\nexport type SharedTreeFormatVersion = typeof SharedTreeFormatVersion;\n\n/**\n * Configuration options for SharedTree.\n * @alpha\n */\nexport type SharedTreeOptions = Partial<ICodecOptions> &\n\tPartial<SharedTreeFormatOptions> &\n\tForestOptions;\n\nexport interface SharedTreeOptionsInternal extends SharedTreeOptions {\n\tdisposeForksAfterTransaction?: boolean;\n}\n/**\n * Configuration options for SharedTree's internal tree storage.\n * @alpha\n */\nexport interface ForestOptions {\n\t/**\n\t * The {@link ForestType} indicating which forest type should be created for the SharedTree.\n\t */\n\treadonly forest?: ForestType;\n}\n\n/**\n * Options for configuring the persisted format SharedTree uses.\n * @alpha\n */\nexport interface SharedTreeFormatOptions {\n\t/**\n\t * See {@link TreeCompressionStrategy}.\n\t * default: TreeCompressionStrategy.Compressed\n\t */\n\ttreeEncodeType: TreeCompressionStrategy;\n\t/**\n\t * The format version SharedTree should use to persist documents.\n\t *\n\t * This option has compatibility implications for applications using SharedTree.\n\t * Each version documents a required minimum version of \\@fluidframework/tree.\n\t * If this minimum version fails to be met, the SharedTree may fail to load.\n\t * To be safe, application authors should verify that they have saturated this version\n\t * of \\@fluidframework/tree in their ecosystem before changing the format version.\n\t *\n\t * This option defaults to SharedTreeFormatVersion.v2.\n\t */\n\tformatVersion: SharedTreeFormatVersion[keyof SharedTreeFormatVersion];\n}\n\n/**\n * Used to distinguish between different forest types.\n * @remarks\n * Current options are {@link ForestTypeReference}, {@link ForestTypeOptimized} and {@link ForestTypeExpensiveDebug}.\n * @sealed @alpha\n */\nexport interface ForestType extends ErasedType<\"ForestType\"> {}\n\n/**\n * Reference implementation of forest.\n * @remarks\n * A simple implementation with minimal complexity and moderate debuggability, validation and performance.\n * @privateRemarks\n * The \"ObjectForest\" forest type.\n * @alpha\n */\nexport const ForestTypeReference = toForestType(() => buildForest());\n\n/**\n * Optimized implementation of forest.\n * @remarks\n * A complex optimized forest implementation, which has minimal validation and debuggability to optimize for performance.\n * Uses an internal representation optimized for size designed to scale to larger datasets with reduced overhead.\n * @privateRemarks\n * The \"ChunkedForest\" forest type.\n * @alpha\n */\nexport const ForestTypeOptimized = toForestType(\n\t(schema: TreeStoredSchemaSubscription, idCompressor: IIdCompressor) =>\n\t\tbuildChunkedForest(makeTreeChunker(schema, defaultSchemaPolicy), undefined, idCompressor),\n);\n\n/**\n * Slow implementation of forest intended only for debugging.\n * @remarks\n * Includes validation with scales poorly.\n * May be asymptotically slower than {@link ForestTypeReference}, and may perform very badly with larger data sizes.\n * @privateRemarks\n * The \"ObjectForest\" forest type with expensive asserts for debugging.\n * @alpha\n */\nexport const ForestTypeExpensiveDebug = toForestType(() => buildForest(undefined, true));\n\ntype ForestFactory = (\n\tschema: TreeStoredSchemaSubscription,\n\tidCompressor: IIdCompressor,\n) => IEditableForest;\n\nfunction toForestType(factory: ForestFactory): ForestType {\n\treturn factory as unknown as ForestType;\n}\n\n/**\n * Build and return a forest of the requested type.\n */\nexport function buildConfiguredForest(\n\tfactory: ForestType,\n\tschema: TreeStoredSchemaSubscription,\n\tidCompressor: IIdCompressor,\n): IEditableForest {\n\treturn (factory as unknown as ForestFactory)(schema, idCompressor);\n}\n\nexport const defaultSharedTreeOptions: Required<SharedTreeOptionsInternal> = {\n\tjsonValidator: noopValidator,\n\tforest: ForestTypeReference,\n\ttreeEncodeType: TreeCompressionStrategy.Compressed,\n\tformatVersion: SharedTreeFormatVersion.v3,\n\tdisposeForksAfterTransaction: true,\n};\n\nfunction verboseFromCursor(\n\treader: ITreeCursor,\n\tschema: ReadonlyMap<TreeNodeSchemaIdentifier, TreeNodeStoredSchema>,\n): VerboseTree {\n\tconst fields = customFromCursorStored(reader, schema, verboseFromCursor);\n\tconst nodeSchema =\n\t\tschema.get(reader.type) ?? fail(0xac9 /* missing schema for type in cursor */);\n\tif (nodeSchema instanceof LeafNodeStoredSchema) {\n\t\treturn fields as CustomTreeValue;\n\t}\n\n\treturn {\n\t\ttype: reader.type,\n\t\tfields: fields as CustomTreeNode<IFluidHandle>,\n\t};\n}\n\nfunction exportSimpleFieldSchemaStored(schema: TreeFieldStoredSchema): SimpleFieldSchema {\n\tlet kind: FieldKind;\n\tswitch (schema.kind) {\n\t\tcase FieldKinds.identifier.identifier:\n\t\t\tkind = FieldKind.Identifier;\n\t\t\tbreak;\n\t\tcase FieldKinds.optional.identifier:\n\t\t\tkind = FieldKind.Optional;\n\t\t\tbreak;\n\t\tcase FieldKinds.required.identifier:\n\t\t\tkind = FieldKind.Required;\n\t\t\tbreak;\n\t\tcase FieldKinds.forbidden.identifier:\n\t\t\tkind = FieldKind.Optional;\n\t\t\tassert(schema.types.size === 0, 0xa94 /* invalid forbidden field */);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tfail(0xaca /* invalid field kind */);\n\t}\n\treturn { kind, allowedTypesIdentifiers: schema.types, metadata: {} };\n}\n\nfunction exportSimpleNodeSchemaStored(schema: TreeNodeStoredSchema): SimpleNodeSchema {\n\tconst arrayTypes = tryStoredSchemaAsArray(schema);\n\tif (arrayTypes !== undefined) {\n\t\treturn { kind: NodeKind.Array, allowedTypesIdentifiers: arrayTypes, metadata: {} };\n\t}\n\tif (schema instanceof ObjectNodeStoredSchema) {\n\t\tconst fields = new Map<FieldKey, SimpleObjectFieldSchema>();\n\t\tfor (const [storedKey, field] of schema.objectNodeFields) {\n\t\t\tfields.set(storedKey, { ...exportSimpleFieldSchemaStored(field), storedKey });\n\t\t}\n\t\treturn { kind: NodeKind.Object, fields, metadata: {} };\n\t}\n\tif (schema instanceof MapNodeStoredSchema) {\n\t\tassert(\n\t\t\tschema.mapFields.kind === FieldKinds.optional.identifier,\n\t\t\t0xa95 /* Invalid map schema */,\n\t\t);\n\t\treturn {\n\t\t\tkind: NodeKind.Map,\n\t\t\tallowedTypesIdentifiers: schema.mapFields.types,\n\t\t\tmetadata: {},\n\t\t};\n\t}\n\tif (schema instanceof LeafNodeStoredSchema) {\n\t\treturn { kind: NodeKind.Leaf, leafKind: schema.leafValue, metadata: {} };\n\t}\n\tfail(0xacb /* invalid schema kind */);\n}\n"]}
1
+ {"version":3,"file":"sharedTree.js","sourceRoot":"","sources":["../../src/shared-tree/sharedTree.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOH,kEAAmE;AAQnE,uEAGkD;AAElD,gDAAsE;AACtE,+CAoB0B;AAC1B,4DAcuC;AAGvC,2DAKsC;AACtC,sDAoBiC;AACjC,+CAK0B;AAE1B,uEAAuE;AACvE,+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C,KAAK;YAC/C,QAAQ,EAAE,EAAE;SACZ,CAAC;IACH,CAAC;IACD,IAAI,MAAM,YAAY,+BAAoB,EAAE,CAAC;QAC5C,OAAO,EAAE,IAAI,EAAE,mBAAQ,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,CAAC,SAAS,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;IAC1E,CAAC;IACD,IAAA,eAAI,EAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC;AACvC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tErasedType,\n\tIFluidHandle,\n\tIFluidLoadable,\n} from \"@fluidframework/core-interfaces/internal\";\nimport { assert, fail } from \"@fluidframework/core-utils/internal\";\nimport type { IChannelStorageService } from \"@fluidframework/datastore-definitions/internal\";\nimport type { IIdCompressor } from \"@fluidframework/id-compressor\";\nimport type {\n\tIChannelView,\n\tIFluidSerializer,\n\tSharedKernel,\n} from \"@fluidframework/shared-object-base/internal\";\nimport {\n\tUsageError,\n\ttype ITelemetryLoggerExt,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport { type ICodecOptions, noopValidator } from \"../codec/index.js\";\nimport {\n\ttype FieldKey,\n\ttype GraphCommit,\n\ttype IEditableForest,\n\ttype ITreeCursor,\n\ttype JsonableTree,\n\tLeafNodeStoredSchema,\n\tMapNodeStoredSchema,\n\tObjectNodeStoredSchema,\n\tRevisionTagCodec,\n\tSchemaVersion,\n\ttype TaggedChange,\n\ttype TreeFieldStoredSchema,\n\ttype TreeNodeSchemaIdentifier,\n\ttype TreeNodeStoredSchema,\n\ttype TreeStoredSchema,\n\tTreeStoredSchemaRepository,\n\ttype TreeStoredSchemaSubscription,\n\tmakeDetachedFieldIndex,\n\tmoveToDetachedField,\n} from \"../core/index.js\";\nimport {\n\tDetachedFieldIndexSummarizer,\n\tFieldKinds,\n\tForestSummarizer,\n\tSchemaSummarizer,\n\tTreeCompressionStrategy,\n\tbuildChunkedForest,\n\tbuildForest,\n\tdefaultSchemaPolicy,\n\tjsonableTreeFromFieldCursor,\n\tmakeFieldBatchCodec,\n\tmakeMitigatedChangeFamily,\n\tmakeSchemaCodec,\n\tmakeTreeChunker,\n} from \"../feature-libraries/index.js\";\n// eslint-disable-next-line import/no-internal-modules\nimport type { Format } from \"../feature-libraries/schema-index/index.js\";\nimport {\n\ttype ClonableSchemaAndPolicy,\n\tDefaultResubmitMachine,\n\ttype ExplicitCoreCodecVersions,\n\tSharedTreeCore,\n} from \"../shared-tree-core/index.js\";\nimport {\n\ttype ITree,\n\ttype ImplicitFieldSchema,\n\tNodeKind,\n\ttype ReadSchema,\n\ttype SimpleFieldSchema,\n\ttype SimpleTreeSchema,\n\ttype TreeView,\n\ttype TreeViewAlpha,\n\ttype TreeViewConfiguration,\n\ttype UnsafeUnknownSchema,\n\ttype VerboseTree,\n\ttryStoredSchemaAsArray,\n\ttype SimpleNodeSchema,\n\tcustomFromCursorStored,\n\tFieldKind,\n\ttype CustomTreeNode,\n\ttype CustomTreeValue,\n\ttype ITreeAlpha,\n\ttype SimpleObjectFieldSchema,\n} from \"../simple-tree/index.js\";\nimport {\n\ttype Breakable,\n\tbreakingClass,\n\ttype JsonCompatible,\n\tthrowIfBroken,\n} from \"../util/index.js\";\n\nimport { SchematizingSimpleTreeView } from \"./schematizingTreeView.js\";\nimport { SharedTreeReadonlyChangeEnricher } from \"./sharedTreeChangeEnricher.js\";\nimport { SharedTreeChangeFamily } from \"./sharedTreeChangeFamily.js\";\nimport type { SharedTreeChange } from \"./sharedTreeChangeTypes.js\";\nimport type { SharedTreeEditBuilder } from \"./sharedTreeEditBuilder.js\";\nimport { type TreeCheckout, type BranchableTree, createTreeCheckout } from \"./treeCheckout.js\";\n\n/**\n * Copy of data from an {@link ITreePrivate} at some point in time.\n * @remarks\n * This is unrelated to Fluids concept of \"snapshots\".\n */\nexport interface SharedTreeContentSnapshot {\n\t/**\n\t * The schema stored in the document.\n\t *\n\t * @remarks\n\t * Edits to the schema can mutate the schema stored of the tree which took this snapshot (but this snapshot will remain the same)\n\t * This is mainly useful for debugging cases where schematize reports an incompatible view schema.\n\t */\n\treadonly schema: TreeStoredSchema;\n\t/**\n\t * All {@link TreeStatus.InDocument} content.\n\t */\n\treadonly tree: JsonableTree[];\n\t/**\n\t * All {@link TreeStatus.Removed} content.\n\t */\n\treadonly removed: [string | number | undefined, number, JsonableTree][];\n}\n\n/**\n * {@link ITree} extended with some non-public APIs.\n * @internal\n */\nexport interface ITreeInternal extends IChannelView, ITreeAlpha {}\n\n/**\n * {@link ITreeInternal} extended with some non-exported APIs.\n * @remarks\n * This allows access to the tree content using the internal data model used at the storage and \"flex\" layers,\n * and should only be needed for testing and debugging this package's internals.\n */\nexport interface ITreePrivate extends ITreeInternal {\n\t/**\n\t * Provides a copy of the current content of the tree.\n\t * This can be useful for inspecting the tree when no suitable view schema is available.\n\t * This is only intended for use in testing and exceptional code paths: it is not performant.\n\t *\n\t * This does not include everything that is included in a tree summary, since information about how to merge future edits is omitted.\n\t */\n\tcontentSnapshot(): SharedTreeContentSnapshot;\n\n\t/**\n\t * Access to internals for testing.\n\t */\n\treadonly kernel: SharedTreeKernel;\n}\n\n/**\n * Has an entry for each codec which writes an explicit version into its data.\n *\n * This is used to map the single API entrypoint controlling the format {@link SharedTreeOptions.formatVersion}\n * to a list of write versions that for each codec that should be used for that format.\n *\n * Note that all explicitly versioned codecs should be using the format version from the data to read encoded data.\n *\n * TODO: Plumb these write versions into forest, schema, detached field index codec creation.\n */\ninterface ExplicitCodecVersions extends ExplicitCoreCodecVersions {\n\tforest: number;\n\tschema: SchemaVersion;\n\tdetachedFieldIndex: number;\n\tfieldBatch: number;\n}\n\nconst formatVersionToTopLevelCodecVersions = new Map<number, ExplicitCodecVersions>([\n\t[\n\t\t1,\n\t\t{ forest: 1, schema: 1, detachedFieldIndex: 1, editManager: 1, message: 1, fieldBatch: 1 },\n\t],\n\t[\n\t\t2,\n\t\t{ forest: 1, schema: 1, detachedFieldIndex: 1, editManager: 2, message: 2, fieldBatch: 1 },\n\t],\n\t[\n\t\t3,\n\t\t{ forest: 1, schema: 1, detachedFieldIndex: 1, editManager: 3, message: 3, fieldBatch: 1 },\n\t],\n\t[\n\t\t4,\n\t\t{ forest: 1, schema: 1, detachedFieldIndex: 1, editManager: 4, message: 4, fieldBatch: 1 },\n\t],\n]);\n\nfunction getCodecVersions(formatVersion: number): ExplicitCodecVersions {\n\tconst versions = formatVersionToTopLevelCodecVersions.get(formatVersion);\n\tassert(versions !== undefined, 0x90e /* Unknown format version */);\n\treturn versions;\n}\n\n/**\n * The type SharedTree's kernel's view must implement so what when its merged with the underling SharedObject's API it fully implements the required tree API surface ({@link ITreePrivate }).\n */\nexport type SharedTreeKernelView = Omit<ITreePrivate, keyof (IChannelView & IFluidLoadable)>;\n\n/**\n * SharedTreeCore, configured with a good set of indexes and field kinds which will maintain compatibility over time.\n *\n * TODO: detail compatibility requirements.\n */\n@breakingClass\nexport class SharedTreeKernel\n\textends SharedTreeCore<SharedTreeEditBuilder, SharedTreeChange>\n\timplements SharedKernel\n{\n\tpublic readonly checkout: TreeCheckout;\n\tpublic get storedSchema(): TreeStoredSchemaRepository {\n\t\treturn this.checkout.storedSchema;\n\t}\n\n\t/**\n\t * The app-facing API for SharedTree implemented by this Kernel.\n\t * @remarks\n\t * This is the API grafted onto the ISharedObject which apps can access.\n\t * It includes both the APIs used for internal testing, and public facing APIs (both stable and unstable).\n\t * Different users will have access to different subsets of this API, see {@link ITree}, {@link ITreeAlpha} and {@link ITreeInternal} which this {@link ITreePrivate} extends.\n\t */\n\tpublic readonly view: SharedTreeKernelView;\n\n\tpublic constructor(\n\t\tbreaker: Breakable,\n\t\tsharedObject: IChannelView & IFluidLoadable,\n\t\tserializer: IFluidSerializer,\n\t\tsubmitLocalMessage: (content: unknown, localOpMetadata?: unknown) => void,\n\t\tlastSequenceNumber: () => number | undefined,\n\t\tlogger: ITelemetryLoggerExt | undefined,\n\t\tidCompressor: IIdCompressor,\n\t\toptionsParam: SharedTreeOptionsInternal,\n\t) {\n\t\tconst options = { ...defaultSharedTreeOptions, ...optionsParam };\n\t\tconst codecVersions = getCodecVersions(options.formatVersion);\n\t\tconst schema = new TreeStoredSchemaRepository();\n\t\tconst forest = buildConfiguredForest(breaker, options.forest, schema, idCompressor);\n\t\tconst revisionTagCodec = new RevisionTagCodec(idCompressor);\n\t\tconst removedRoots = makeDetachedFieldIndex(\n\t\t\t\"repair\",\n\t\t\trevisionTagCodec,\n\t\t\tidCompressor,\n\t\t\toptions,\n\t\t);\n\t\tconst schemaCodec = makeSchemaCodec(options, codecVersions.schema);\n\t\tconst schemaSummarizer = new SchemaSummarizer(\n\t\t\tschema,\n\t\t\t{\n\t\t\t\tgetCurrentSeq: lastSequenceNumber,\n\t\t\t},\n\t\t\tschemaCodec,\n\t\t);\n\t\tconst fieldBatchCodec = makeFieldBatchCodec(options, codecVersions.fieldBatch);\n\n\t\tconst encoderContext = {\n\t\t\tschema: {\n\t\t\t\tschema,\n\t\t\t\tpolicy: defaultSchemaPolicy,\n\t\t\t},\n\t\t\tencodeType: options.treeEncodeType,\n\t\t\toriginatorId: idCompressor.localSessionId,\n\t\t\tidCompressor,\n\t\t};\n\t\tconst forestSummarizer = new ForestSummarizer(\n\t\t\tforest,\n\t\t\trevisionTagCodec,\n\t\t\tfieldBatchCodec,\n\t\t\tencoderContext,\n\t\t\toptions,\n\t\t\tidCompressor,\n\t\t);\n\t\tconst removedRootsSummarizer = new DetachedFieldIndexSummarizer(removedRoots);\n\t\tconst innerChangeFamily = new SharedTreeChangeFamily(\n\t\t\trevisionTagCodec,\n\t\t\tfieldBatchCodec,\n\t\t\toptions,\n\t\t\toptions.treeEncodeType,\n\t\t\tidCompressor,\n\t\t);\n\t\tconst changeFamily = makeMitigatedChangeFamily(\n\t\t\tinnerChangeFamily,\n\t\t\tSharedTreeChangeFamily.emptyChange,\n\t\t\t(error: unknown) => {\n\t\t\t\t// TODO:6344 Add telemetry for these errors.\n\t\t\t\t// Rethrowing the error has a different effect depending on the context in which the\n\t\t\t\t// ChangeFamily was invoked:\n\t\t\t\t// - If the ChangeFamily was invoked as part of incoming op processing, rethrowing the error\n\t\t\t\t// will cause the runtime to disconnect the client, log a severe error, and not reconnect.\n\t\t\t\t// This will not cause the host application to crash because it is not on the stack at that time.\n\t\t\t\t// TODO: let the host application know that the client is now disconnected.\n\t\t\t\t// - If the ChangeFamily was invoked as part of dealing with a local change, rethrowing the\n\t\t\t\t// error will cause the host application to crash. This is not ideal, but is better than\n\t\t\t\t// letting the application either send an invalid change to the server or allowing the\n\t\t\t\t// application to continue working when its local branches contain edits that cannot be\n\t\t\t\t// reflected in its views.\n\t\t\t\t// The best course of action for a host application in such a state is to restart.\n\t\t\t\t// TODO: let the host application know about this situation and provide a way to\n\t\t\t\t// programmatically reload the SharedTree container.\n\t\t\t\tthrow error;\n\t\t\t},\n\t\t);\n\t\tconst changeEnricher = new SharedTreeReadonlyChangeEnricher(forest, schema, removedRoots);\n\t\tsuper(\n\t\t\tbreaker,\n\t\t\tsharedObject,\n\t\t\tserializer,\n\t\t\tsubmitLocalMessage,\n\t\t\tlogger,\n\t\t\t[schemaSummarizer, forestSummarizer, removedRootsSummarizer],\n\t\t\tchangeFamily,\n\t\t\toptions,\n\t\t\tcodecVersions,\n\t\t\tidCompressor,\n\t\t\tschema,\n\t\t\tdefaultSchemaPolicy,\n\t\t\tnew DefaultResubmitMachine(\n\t\t\t\t(change: TaggedChange<SharedTreeChange>) =>\n\t\t\t\t\tchangeFamily.rebaser.invert(change, true, this.mintRevisionTag()),\n\t\t\t\tchangeEnricher,\n\t\t\t),\n\t\t\tchangeEnricher,\n\t\t);\n\t\tconst localBranch = this.getLocalBranch();\n\t\tthis.checkout = createTreeCheckout(idCompressor, this.mintRevisionTag, revisionTagCodec, {\n\t\t\tbranch: localBranch,\n\t\t\tchangeFamily,\n\t\t\tschema,\n\t\t\tforest,\n\t\t\tfieldBatchCodec,\n\t\t\tremovedRoots,\n\t\t\tchunkCompressionStrategy: options.treeEncodeType,\n\t\t\tlogger,\n\t\t\tbreaker: this.breaker,\n\t\t\tdisposeForksAfterTransaction: options.disposeForksAfterTransaction,\n\t\t});\n\n\t\tthis.checkout.transaction.events.on(\"started\", () => {\n\t\t\tif (sharedObject.isAttached()) {\n\t\t\t\t// It is currently forbidden to attach during a transaction, so transaction state changes can be ignored until after attaching.\n\t\t\t\tthis.commitEnricher.startTransaction();\n\t\t\t}\n\t\t});\n\t\tthis.checkout.transaction.events.on(\"aborting\", () => {\n\t\t\tif (sharedObject.isAttached()) {\n\t\t\t\t// It is currently forbidden to attach during a transaction, so transaction state changes can be ignored until after attaching.\n\t\t\t\tthis.commitEnricher.abortTransaction();\n\t\t\t}\n\t\t});\n\t\tthis.checkout.transaction.events.on(\"committing\", () => {\n\t\t\tif (sharedObject.isAttached()) {\n\t\t\t\t// It is currently forbidden to attach during a transaction, so transaction state changes can be ignored until after attaching.\n\t\t\t\tthis.commitEnricher.commitTransaction();\n\t\t\t}\n\t\t});\n\t\tthis.checkout.events.on(\"beforeBatch\", (event) => {\n\t\t\tif (event.type === \"append\" && sharedObject.isAttached()) {\n\t\t\t\tif (this.checkout.transaction.isInProgress()) {\n\t\t\t\t\tthis.commitEnricher.addTransactionCommits(event.newCommits);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\tthis.view = {\n\t\t\tcontentSnapshot: () => this.contentSnapshot(),\n\t\t\texportSimpleSchema: () => this.exportSimpleSchema(),\n\t\t\texportVerbose: () => this.exportVerbose(),\n\t\t\tviewWith: this.viewWith.bind(this),\n\t\t\tkernel: this,\n\t\t};\n\t}\n\n\tpublic exportVerbose(): VerboseTree | undefined {\n\t\tconst cursor = this.checkout.forest.allocateCursor(\"contentSnapshot\");\n\t\ttry {\n\t\t\tmoveToDetachedField(this.checkout.forest, cursor);\n\t\t\tconst length = cursor.getFieldLength();\n\t\t\tif (length === 0) {\n\t\t\t\treturn undefined;\n\t\t\t} else if (length === 1) {\n\t\t\t\tcursor.enterNode(0);\n\t\t\t\treturn verboseFromCursor(cursor, this.storedSchema.nodeSchema);\n\t\t\t} else {\n\t\t\t\tfail(0xac8 /* Invalid document root length */);\n\t\t\t}\n\t\t} finally {\n\t\t\tcursor.free();\n\t\t}\n\t}\n\n\tpublic exportSimpleSchema(): SimpleTreeSchema {\n\t\treturn exportSimpleSchema(this.storedSchema);\n\t}\n\n\t@throwIfBroken\n\tpublic contentSnapshot(): SharedTreeContentSnapshot {\n\t\tconst cursor = this.checkout.forest.allocateCursor(\"contentSnapshot\");\n\t\ttry {\n\t\t\tmoveToDetachedField(this.checkout.forest, cursor);\n\t\t\treturn {\n\t\t\t\tschema: this.storedSchema.clone(),\n\t\t\t\ttree: jsonableTreeFromFieldCursor(cursor),\n\t\t\t\tremoved: this.checkout.getRemovedRoots(),\n\t\t\t};\n\t\t} finally {\n\t\t\tcursor.free();\n\t\t}\n\t}\n\n\t// For the new TreeViewAlpha API\n\tpublic viewWith<TRoot extends ImplicitFieldSchema | UnsafeUnknownSchema>(\n\t\tconfig: TreeViewConfiguration<ReadSchema<TRoot>>,\n\t): SchematizingSimpleTreeView<TRoot> & TreeView<ReadSchema<TRoot>>;\n\n\t// For the old TreeView API\n\tpublic viewWith<TRoot extends ImplicitFieldSchema>(\n\t\tconfig: TreeViewConfiguration<TRoot>,\n\t): SchematizingSimpleTreeView<TRoot> & TreeView<TRoot>;\n\n\tpublic viewWith<TRoot extends ImplicitFieldSchema | UnsafeUnknownSchema>(\n\t\tconfig: TreeViewConfiguration<ReadSchema<TRoot>>,\n\t): SchematizingSimpleTreeView<TRoot> & TreeView<ReadSchema<TRoot>> {\n\t\treturn this.checkout.viewWith(config) as SchematizingSimpleTreeView<TRoot> &\n\t\t\tTreeView<ReadSchema<TRoot>>;\n\t}\n\n\tpublic override async loadCore(services: IChannelStorageService): Promise<void> {\n\t\tawait super.loadCore(services);\n\t\tthis.checkout.load();\n\t}\n\n\tpublic override didAttach(): void {\n\t\tif (this.checkout.transaction.isInProgress()) {\n\t\t\t// Attaching during a transaction is not currently supported.\n\t\t\t// At least part of of the system is known to not handle this case correctly - commit enrichment - and there may be others.\n\t\t\tthrow new UsageError(\n\t\t\t\t\"Cannot attach while a transaction is in progress. Commit or abort the transaction before attaching.\",\n\t\t\t);\n\t\t}\n\t\tsuper.didAttach();\n\t}\n\n\tpublic override applyStashedOp(\n\t\t...args: Parameters<\n\t\t\tSharedTreeCore<SharedTreeEditBuilder, SharedTreeChange>[\"applyStashedOp\"]\n\t\t>\n\t): void {\n\t\tassert(\n\t\t\t!this.checkout.transaction.isInProgress(),\n\t\t\t0x674 /* Unexpected transaction is open while applying stashed ops */,\n\t\t);\n\t\tsuper.applyStashedOp(...args);\n\t}\n\n\tprotected override submitCommit(\n\t\tcommit: GraphCommit<SharedTreeChange>,\n\t\tschemaAndPolicy: ClonableSchemaAndPolicy,\n\t\tisResubmit: boolean,\n\t): void {\n\t\tassert(\n\t\t\t!this.checkout.transaction.isInProgress(),\n\t\t\t0xaa6 /* Cannot submit a commit while a transaction is in progress */,\n\t\t);\n\t\tif (isResubmit) {\n\t\t\treturn super.submitCommit(commit, schemaAndPolicy, isResubmit);\n\t\t}\n\n\t\t// Refrain from submitting new commits until they are validated by the checkout.\n\t\t// This is not a strict requirement for correctness in our system, but in the event that there is a bug when applying commits to the checkout\n\t\t// that causes a crash (e.g. in the forest), this will at least prevent this client from sending the problematic commit to any other clients.\n\t\tthis.checkout.onCommitValid(commit, () =>\n\t\t\tsuper.submitCommit(commit, schemaAndPolicy, isResubmit),\n\t\t);\n\t}\n\n\tpublic onDisconnect(): void {}\n}\n\nexport function exportSimpleSchema(storedSchema: TreeStoredSchema): SimpleTreeSchema {\n\treturn {\n\t\troot: exportSimpleFieldSchemaStored(storedSchema.rootFieldSchema),\n\t\tdefinitions: new Map(\n\t\t\t[...storedSchema.nodeSchema].map(([key, schema]) => {\n\t\t\t\treturn [key, exportSimpleNodeSchemaStored(schema)];\n\t\t\t}),\n\t\t),\n\t};\n}\n\n/**\n * A way to parse schema in the persisted format from {@link extractPersistedSchema}.\n * @remarks\n * This behaves identically to {@link ITreeAlpha.exportSimpleSchema},\n * except that it gets the schema from the caller instead of from an existing tree.\n *\n * This can be useful for inspecting the contents of persisted schema,\n * such as those generated by {@link extractPersistedSchema} for use in testing.\n * Since that data format is otherwise unspecified,\n * this provides a way to inspect its contents with documented semantics.\n * @alpha\n */\nexport function persistedToSimpleSchema(\n\tpersisted: JsonCompatible,\n\toptions: ICodecOptions,\n): SimpleTreeSchema {\n\tconst schemaCodec = makeSchemaCodec(options, SchemaVersion.v1);\n\tconst stored = schemaCodec.decode(persisted as Format);\n\treturn exportSimpleSchema(stored);\n}\n\n/**\n * Get a {@link BranchableTree} from a {@link ITree}.\n * @remarks The branch can be used for \"version control\"-style coordination of edits on the tree.\n * @privateRemarks This function will be removed if/when the branching API becomes public,\n * but it (or something like it) is necessary in the meantime to prevent the alpha types from being exposed as public.\n * @alpha\n * @deprecated This API is superseded by {@link TreeBranch}, which should be used instead.\n */\nexport function getBranch(tree: ITree): BranchableTree;\n/**\n * Get a {@link BranchableTree} from a {@link TreeView}.\n * @remarks The branch can be used for \"version control\"-style coordination of edits on the tree.\n * Branches are currently an unstable \"alpha\" API and are subject to change in the future.\n * @privateRemarks This function will be removed if/when the branching API becomes public,\n * but it (or something like it) is necessary in the meantime to prevent the alpha types from being exposed as public.\n * @alpha\n * @deprecated This API is superseded by {@link TreeBranch}, which should be used instead.\n */\nexport function getBranch<T extends ImplicitFieldSchema | UnsafeUnknownSchema>(\n\tview: TreeViewAlpha<T>,\n): BranchableTree;\nexport function getBranch<T extends ImplicitFieldSchema | UnsafeUnknownSchema>(\n\ttreeOrView: ITree | TreeViewAlpha<T>,\n): BranchableTree {\n\tif (treeOrView instanceof SchematizingSimpleTreeView) {\n\t\treturn treeOrView.checkout as unknown as BranchableTree;\n\t}\n\tconst kernel = (treeOrView as ITree as ITreePrivate).kernel;\n\tassert(kernel instanceof SharedTreeKernel, 0xb56 /* Invalid ITree */);\n\t// This cast is safe so long as TreeCheckout supports all the operations on the branch interface.\n\treturn kernel.checkout as unknown as BranchableTree;\n}\n\n/**\n * Format versions supported by SharedTree.\n *\n * Each version documents a required minimum version of the \\@fluidframework/tree package.\n * @alpha\n */\nexport const SharedTreeFormatVersion = {\n\t/**\n\t * Requires \\@fluidframework/tree \\>= 2.0.0.\n\t *\n\t * @deprecated - FF does not currently plan on supporting this format long-term.\n\t * Do not write production documents using this format, as they may not be loadable in the future.\n\t */\n\tv1: 1,\n\n\t/**\n\t * Requires \\@fluidframework/tree \\>= 2.0.0.\n\t */\n\tv2: 2,\n\n\t/**\n\t * Requires \\@fluidframework/tree \\>= 2.0.0.\n\t */\n\tv3: 3,\n} as const;\n\n/**\n * Format versions supported by SharedTree.\n *\n * Each version documents a required minimum version of the \\@fluidframework/tree package.\n * @alpha\n * @privateRemarks\n * See packages/dds/tree/docs/main/compatibility.md for information on how to add support for a new format.\n *\n * TODO: Before this gets promoted past Alpha,\n * a separate abstraction more suited for use in the public API should be adopted rather than reusing the same types used internally.\n * Such an abstraction should probably be in the form of a Fluid-Framework wide compatibility enum.\n */\nexport type SharedTreeFormatVersion = typeof SharedTreeFormatVersion;\n\n/**\n * Configuration options for SharedTree.\n * @alpha\n */\nexport type SharedTreeOptions = Partial<ICodecOptions> &\n\tPartial<SharedTreeFormatOptions> &\n\tForestOptions;\n\nexport interface SharedTreeOptionsInternal extends SharedTreeOptions {\n\tdisposeForksAfterTransaction?: boolean;\n}\n/**\n * Configuration options for SharedTree's internal tree storage.\n * @alpha\n */\nexport interface ForestOptions {\n\t/**\n\t * The {@link ForestType} indicating which forest type should be created for the SharedTree.\n\t */\n\treadonly forest?: ForestType;\n}\n\n/**\n * Options for configuring the persisted format SharedTree uses.\n * @alpha\n */\nexport interface SharedTreeFormatOptions {\n\t/**\n\t * See {@link TreeCompressionStrategy}.\n\t * default: TreeCompressionStrategy.Compressed\n\t */\n\ttreeEncodeType: TreeCompressionStrategy;\n\t/**\n\t * The format version SharedTree should use to persist documents.\n\t *\n\t * This option has compatibility implications for applications using SharedTree.\n\t * Each version documents a required minimum version of \\@fluidframework/tree.\n\t * If this minimum version fails to be met, the SharedTree may fail to load.\n\t * To be safe, application authors should verify that they have saturated this version\n\t * of \\@fluidframework/tree in their ecosystem before changing the format version.\n\t *\n\t * This option defaults to SharedTreeFormatVersion.v2.\n\t */\n\tformatVersion: SharedTreeFormatVersion[keyof SharedTreeFormatVersion];\n}\n\n/**\n * Used to distinguish between different forest types.\n * @remarks\n * Current options are {@link ForestTypeReference}, {@link ForestTypeOptimized} and {@link ForestTypeExpensiveDebug}.\n * @sealed @alpha\n */\nexport interface ForestType extends ErasedType<\"ForestType\"> {}\n\n/**\n * Reference implementation of forest.\n * @remarks\n * A simple implementation with minimal complexity and moderate debuggability, validation and performance.\n * @privateRemarks\n * The \"ObjectForest\" forest type.\n * @alpha\n */\nexport const ForestTypeReference = toForestType(\n\t(breaker: Breakable, schema: TreeStoredSchemaSubscription, idCompressor: IIdCompressor) =>\n\t\tbuildForest(breaker, schema),\n);\n\n/**\n * Optimized implementation of forest.\n * @remarks\n * A complex optimized forest implementation, which has minimal validation and debuggability to optimize for performance.\n * Uses an internal representation optimized for size designed to scale to larger datasets with reduced overhead.\n * @privateRemarks\n * The \"ChunkedForest\" forest type.\n * @alpha\n */\nexport const ForestTypeOptimized = toForestType(\n\t(breaker: Breakable, schema: TreeStoredSchemaSubscription, idCompressor: IIdCompressor) =>\n\t\tbuildChunkedForest(makeTreeChunker(schema, defaultSchemaPolicy), undefined, idCompressor),\n);\n\n/**\n * Slow implementation of forest intended only for debugging.\n * @remarks\n * Includes validation with scales poorly.\n * May be asymptotically slower than {@link ForestTypeReference}, and may perform very badly with larger data sizes.\n * @privateRemarks\n * The \"ObjectForest\" forest type with expensive asserts for debugging.\n * @alpha\n */\nexport const ForestTypeExpensiveDebug = toForestType(\n\t(breaker: Breakable, schema: TreeStoredSchemaSubscription) =>\n\t\tbuildForest(breaker, schema, undefined, true),\n);\n\ntype ForestFactory = (\n\tbreaker: Breakable,\n\tschema: TreeStoredSchemaSubscription,\n\tidCompressor: IIdCompressor,\n) => IEditableForest;\n\nfunction toForestType(factory: ForestFactory): ForestType {\n\treturn factory as unknown as ForestType;\n}\n\n/**\n * Build and return a forest of the requested type.\n */\nexport function buildConfiguredForest(\n\tbreaker: Breakable,\n\tfactory: ForestType,\n\tschema: TreeStoredSchemaSubscription,\n\tidCompressor: IIdCompressor,\n): IEditableForest {\n\treturn (factory as unknown as ForestFactory)(breaker, schema, idCompressor);\n}\n\nexport const defaultSharedTreeOptions: Required<SharedTreeOptionsInternal> = {\n\tjsonValidator: noopValidator,\n\tforest: ForestTypeReference,\n\ttreeEncodeType: TreeCompressionStrategy.Compressed,\n\tformatVersion: SharedTreeFormatVersion.v3,\n\tdisposeForksAfterTransaction: true,\n};\n\nfunction verboseFromCursor(\n\treader: ITreeCursor,\n\tschema: ReadonlyMap<TreeNodeSchemaIdentifier, TreeNodeStoredSchema>,\n): VerboseTree {\n\tconst fields = customFromCursorStored(reader, schema, verboseFromCursor);\n\tconst nodeSchema =\n\t\tschema.get(reader.type) ?? fail(0xac9 /* missing schema for type in cursor */);\n\tif (nodeSchema instanceof LeafNodeStoredSchema) {\n\t\treturn fields as CustomTreeValue;\n\t}\n\n\treturn {\n\t\ttype: reader.type,\n\t\tfields: fields as CustomTreeNode<IFluidHandle>,\n\t};\n}\n\nfunction exportSimpleFieldSchemaStored(schema: TreeFieldStoredSchema): SimpleFieldSchema {\n\tlet kind: FieldKind;\n\tswitch (schema.kind) {\n\t\tcase FieldKinds.identifier.identifier:\n\t\t\tkind = FieldKind.Identifier;\n\t\t\tbreak;\n\t\tcase FieldKinds.optional.identifier:\n\t\t\tkind = FieldKind.Optional;\n\t\t\tbreak;\n\t\tcase FieldKinds.required.identifier:\n\t\t\tkind = FieldKind.Required;\n\t\t\tbreak;\n\t\tcase FieldKinds.forbidden.identifier:\n\t\t\tkind = FieldKind.Optional;\n\t\t\tassert(schema.types.size === 0, 0xa94 /* invalid forbidden field */);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tfail(0xaca /* invalid field kind */);\n\t}\n\treturn { kind, allowedTypesIdentifiers: schema.types, metadata: {} };\n}\n\nfunction exportSimpleNodeSchemaStored(schema: TreeNodeStoredSchema): SimpleNodeSchema {\n\tconst arrayTypes = tryStoredSchemaAsArray(schema);\n\tif (arrayTypes !== undefined) {\n\t\treturn { kind: NodeKind.Array, allowedTypesIdentifiers: arrayTypes, metadata: {} };\n\t}\n\tif (schema instanceof ObjectNodeStoredSchema) {\n\t\tconst fields = new Map<FieldKey, SimpleObjectFieldSchema>();\n\t\tfor (const [storedKey, field] of schema.objectNodeFields) {\n\t\t\tfields.set(storedKey, { ...exportSimpleFieldSchemaStored(field), storedKey });\n\t\t}\n\t\treturn { kind: NodeKind.Object, fields, metadata: {} };\n\t}\n\tif (schema instanceof MapNodeStoredSchema) {\n\t\tassert(\n\t\t\tschema.mapFields.kind === FieldKinds.optional.identifier,\n\t\t\t0xa95 /* Invalid map schema */,\n\t\t);\n\t\treturn {\n\t\t\tkind: NodeKind.Map,\n\t\t\tallowedTypesIdentifiers: schema.mapFields.types,\n\t\t\tmetadata: {},\n\t\t};\n\t}\n\tif (schema instanceof LeafNodeStoredSchema) {\n\t\treturn { kind: NodeKind.Leaf, leafKind: schema.leafValue, metadata: {} };\n\t}\n\tfail(0xacb /* invalid schema kind */);\n}\n"]}
@@ -2,12 +2,12 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
+ import type { IIdCompressor } from "@fluidframework/id-compressor";
5
6
  import type { ICodecFamily, ICodecOptions } from "../codec/index.js";
6
7
  import { type ChangeEncodingContext, type ChangeFamily, type ChangeRebaser, type DeltaDetachedNodeId, type RevisionMetadataSource, type RevisionTag, type RevisionTagCodec, type TaggedChange } from "../core/index.js";
7
8
  import { type FieldBatchCodec, type ModularChangeset, type TreeChunk, type TreeCompressionStrategy } from "../feature-libraries/index.js";
8
9
  import type { SharedTreeChange } from "./sharedTreeChangeTypes.js";
9
10
  import { SharedTreeEditBuilder } from "./sharedTreeEditBuilder.js";
10
- import type { IIdCompressor } from "@fluidframework/id-compressor";
11
11
  /**
12
12
  * Implementation of {@link ChangeFamily} that combines edits to fields and schema changes.
13
13
  *
@@ -1 +1 @@
1
- {"version":3,"file":"sharedTreeChangeFamily.d.ts","sourceRoot":"","sources":["../../src/shared-tree/sharedTreeChangeFamily.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACrE,OAAO,EACN,KAAK,qBAAqB,EAC1B,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EAEjB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACN,KAAK,eAAe,EAEpB,KAAK,gBAAgB,EACrB,KAAK,SAAS,EACd,KAAK,uBAAuB,EAI5B,MAAM,+BAA+B,CAAC;AAUvC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAEnE;;;;GAIG;AACH,qBAAa,sBACZ,YACC,YAAY,CAAC,qBAAqB,EAAE,gBAAgB,CAAC,EACrD,aAAa,CAAC,gBAAgB,CAAC;IAc/B,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC;IAZ/B,gBAAuB,WAAW,EAAE,gBAAgB,CAElD;IAEF,SAAgB,MAAM,EAAE,YAAY,CAAC,gBAAgB,EAAE,qBAAqB,CAAC,CAAC;IAC9E,O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;YACP,OAAO,0BAA0B,CAChC,UAAU,EACV,0BAA0B,EAC1B,mBAAmB,CAAC,YAAY,CAAC,EACjC,KAAK,CACL,CAAC;QACH,CAAC;IACF,CAAC,CAAC,CAAC;AACJ,CAAC;AAlED,4CAkEC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, fail } from \"@fluidframework/core-utils/internal\";\n\nimport type { ICodecFamily, ICodecOptions } from \"../codec/index.js\";\nimport {\n\ttype ChangeEncodingContext,\n\ttype ChangeFamily,\n\ttype ChangeRebaser,\n\ttype DeltaDetachedNodeId,\n\ttype RevisionMetadataSource,\n\ttype RevisionTag,\n\ttype RevisionTagCodec,\n\ttype TaggedChange,\n\tmapTaggedChange,\n} from \"../core/index.js\";\nimport {\n\ttype FieldBatchCodec,\n\tModularChangeFamily,\n\ttype ModularChangeset,\n\ttype TreeChunk,\n\ttype TreeCompressionStrategy,\n\tfieldKindConfigurations,\n\tfieldKinds,\n\tmakeModularChangeCodecFamily,\n} from \"../feature-libraries/index.js\";\nimport {\n\ttype Mutable,\n\ttype NestedSet,\n\taddToNestedSet,\n\thasSingle,\n\tnestedSetContains,\n} from \"../util/index.js\";\n\nimport { makeSharedTreeChangeCodecFamily } from \"./sharedTreeChangeCodecs.js\";\nimport type { SharedTreeChange } from \"./sharedTreeChangeTypes.js\";\nimport { SharedTreeEditBuilder } from \"./sharedTreeEditBuilder.js\";\nimport type { IIdCompressor } from \"@fluidframework/id-compressor\";\n\n/**\n * Implementation of {@link ChangeFamily} that combines edits to fields and schema changes.\n *\n * @sealed\n */\nexport class SharedTreeChangeFamily\n\timplements\n\t\tChangeFamily<SharedTreeEditBuilder, SharedTreeChange>,\n\t\tChangeRebaser<SharedTreeChange>\n{\n\tpublic static readonly emptyChange: SharedTreeChange = {\n\t\tchanges: [],\n\t};\n\n\tpublic readonly codecs: ICodecFamily<SharedTreeChange, ChangeEncodingContext>;\n\tprivate readonly modularChangeFamily: ModularChangeFamily;\n\n\tpublic constructor(\n\t\trevisionTagCodec: RevisionTagCodec,\n\t\tfieldBatchCodec: FieldBatchCodec,\n\t\tcodecOptions: ICodecOptions,\n\t\tchunkCompressionStrategy?: TreeCompressionStrategy,\n\t\tprivate readonly idCompressor?: IIdCompressor,\n\t) {\n\t\tconst modularChangeCodec = makeModularChangeCodecFamily(\n\t\t\tfieldKindConfigurations,\n\t\t\trevisionTagCodec,\n\t\t\tfieldBatchCodec,\n\t\t\tcodecOptions,\n\t\t\tchunkCompressionStrategy,\n\t\t);\n\t\tthis.modularChangeFamily = new ModularChangeFamily(fieldKinds, modularChangeCodec);\n\t\tthis.codecs = makeSharedTreeChangeCodecFamily(\n\t\t\tthis.modularChangeFamily.codecs,\n\t\t\tcodecOptions,\n\t\t);\n\t}\n\n\tpublic buildEditor(\n\t\tmintRevisionTag: () => RevisionTag,\n\t\tchangeReceiver: (change: TaggedChange<SharedTreeChange>) => void,\n\t): SharedTreeEditBuilder {\n\t\treturn new SharedTreeEditBuilder(\n\t\t\tthis.modularChangeFamily,\n\t\t\tmintRevisionTag,\n\t\t\tchangeReceiver,\n\t\t);\n\t}\n\n\tpublic compose(changes: TaggedChange<SharedTreeChange>[]): SharedTreeChange {\n\t\tconst newChanges: Mutable<SharedTreeChange[\"changes\"]> = [];\n\t\tconst dataChangeRun: TaggedChange<ModularChangeset>[] = [];\n\n\t\tconst flushDataChangeRun = (): void => {\n\t\t\tif (dataChangeRun.length > 0) {\n\t\t\t\tnewChanges.push({\n\t\t\t\t\ttype: \"data\",\n\t\t\t\t\tinnerChange: this.modularChangeFamily.compose(dataChangeRun),\n\t\t\t\t});\n\t\t\t\tdataChangeRun.length = 0;\n\t\t\t}\n\t\t};\n\n\t\tfor (const topChange of changes) {\n\t\t\tfor (const change of topChange.change.changes) {\n\t\t\t\tif (change.type === \"schema\") {\n\t\t\t\t\tflushDataChangeRun();\n\t\t\t\t\tnewChanges.push(change);\n\t\t\t\t} else {\n\t\t\t\t\tdataChangeRun.push(mapTaggedChange(topChange, change.innerChange));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tflushDataChangeRun();\n\t\treturn { changes: newChanges };\n\t}\n\n\tpublic invert(\n\t\tchange: TaggedChange<SharedTreeChange>,\n\t\tisRollback: boolean,\n\t\trevision: RevisionTag,\n\t): SharedTreeChange {\n\t\tconst invertInnerChange: (\n\t\t\tinnerChange: SharedTreeChange[\"changes\"][number],\n\t\t) => SharedTreeChange[\"changes\"][number] = (innerChange) => {\n\t\t\tswitch (innerChange.type) {\n\t\t\t\tcase \"data\":\n\t\t\t\t\treturn {\n\t\t\t\t\t\ttype: \"data\",\n\t\t\t\t\t\tinnerChange: this.modularChangeFamily.invert(\n\t\t\t\t\t\t\tmapTaggedChange(change, innerChange.innerChange),\n\t\t\t\t\t\t\tisRollback,\n\t\t\t\t\t\t\trevision,\n\t\t\t\t\t\t),\n\t\t\t\t\t};\n\t\t\t\tcase \"schema\": {\n\t\t\t\t\treturn {\n\t\t\t\t\t\ttype: \"schema\",\n\t\t\t\t\t\tinnerChange: {\n\t\t\t\t\t\t\tschema: {\n\t\t\t\t\t\t\t\tnew: innerChange.innerChange.schema.old,\n\t\t\t\t\t\t\t\told: innerChange.innerChange.schema.new,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tisInverse: true,\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tfail(0xacc /* Unknown SharedTree change type. */);\n\t\t\t}\n\t\t};\n\t\treturn {\n\t\t\tchanges: change.change.changes.map(invertInnerChange).reverse(),\n\t\t};\n\t}\n\n\tpublic rebase(\n\t\tchange: TaggedChange<SharedTreeChange>,\n\t\tover: TaggedChange<SharedTreeChange>,\n\t\trevisionMetadata: RevisionMetadataSource,\n\t): SharedTreeChange {\n\t\tif (change.change.changes.length === 0 || over.change.changes.length === 0) {\n\t\t\treturn change.change;\n\t\t}\n\n\t\tif (hasSchemaChange(change.change) || hasSchemaChange(over.change)) {\n\t\t\t// Any SharedTreeChange (a list of sub-changes) that contains a schema change will cause ANY change that rebases over it to conflict.\n\t\t\t// Similarly, any SharedTreeChange containing a schema change will fail to rebase over ANY change.\n\t\t\t// Those two combine to mean: no concurrency with schema changes is supported.\n\t\t\t// This is fine because it's an open problem. Example: a tree with an A at the root and a schema that allows an A | B at the root will\n\t\t\t// become out of schema if a schema changes to restrict root types to just A is concurrent with a data change that sets it to a B.\n\t\t\t// We don't have an efficient way to detect this document-wide and there are varying opinions on restricting schema changes to prevent this.\n\t\t\t// A SharedTreeChange containing a schema change will NOT conflict in a non-concurrency case, as the \"meatless sandwich\" optimization\n\t\t\t// will result in rebase never being called.\n\t\t\treturn SharedTreeChangeFamily.emptyChange;\n\t\t}\n\t\tassert(\n\t\t\thasSingle(change.change.changes) && hasSingle(over.change.changes),\n\t\t\t0x884 /* SharedTreeChange should have exactly one inner change if no schema change is present. */,\n\t\t);\n\n\t\tconst dataChangeIntention = change.change.changes[0];\n\t\tconst dataChangeOver = over.change.changes[0];\n\t\tassert(\n\t\t\tdataChangeIntention.type === \"data\" && dataChangeOver.type === \"data\",\n\t\t\t0x885 /* Data change should be present. */,\n\t\t);\n\n\t\treturn {\n\t\t\tchanges: [\n\t\t\t\t{\n\t\t\t\t\ttype: \"data\",\n\t\t\t\t\tinnerChange: this.modularChangeFamily.rebase(\n\t\t\t\t\t\tmapTaggedChange(change, dataChangeIntention.innerChange),\n\t\t\t\t\t\tmapTaggedChange(over, dataChangeOver.innerChange),\n\t\t\t\t\t\trevisionMetadata,\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t],\n\t\t};\n\t}\n\n\tpublic changeRevision(\n\t\tchange: SharedTreeChange,\n\t\tnewRevision: RevisionTag | undefined,\n\t\trollbackOf?: RevisionTag,\n\t): SharedTreeChange {\n\t\treturn {\n\t\t\tchanges: change.changes.map((inner) => {\n\t\t\t\treturn inner.type === \"data\"\n\t\t\t\t\t? {\n\t\t\t\t\t\t\t...inner,\n\t\t\t\t\t\t\tinnerChange: this.modularChangeFamily.rebaser.changeRevision(\n\t\t\t\t\t\t\t\tinner.innerChange,\n\t\t\t\t\t\t\t\tnewRevision,\n\t\t\t\t\t\t\t\trollbackOf,\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t}\n\t\t\t\t\t: inner;\n\t\t\t}),\n\t\t};\n\t}\n\n\tpublic get rebaser(): ChangeRebaser<SharedTreeChange> {\n\t\treturn this;\n\t}\n}\n\nexport function hasSchemaChange(change: SharedTreeChange): boolean {\n\treturn change.changes.some((innerChange) => innerChange.type === \"schema\");\n}\n\nfunction mapDataChanges(\n\tchange: SharedTreeChange,\n\tmap: (change: ModularChangeset) => ModularChangeset,\n): SharedTreeChange {\n\treturn {\n\t\tchanges: change.changes.map((dataOrSchemaChange) => {\n\t\t\tif (dataOrSchemaChange.type === \"data\") {\n\t\t\t\treturn {\n\t\t\t\t\ttype: \"data\",\n\t\t\t\t\tinnerChange: map(dataOrSchemaChange.innerChange),\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn dataOrSchemaChange;\n\t\t}),\n\t};\n}\n\n/**\n * Produces an equivalent change with an updated set of appropriate refreshers.\n * @param change - The change to compute refreshers for. Not mutated.\n * @param getDetachedNode - retrieves a {@link TreeChunk} for the corresponding detached node id.\n * Is expected to read from a forest in a state that corresponds to the input context of the given change.\n * @returns An equivalent change with an updated set of appropriate refreshers.\n */\nexport function updateRefreshers(\n\tchange: SharedTreeChange,\n\tgetDetachedNode: (id: DeltaDetachedNodeId) => TreeChunk | undefined,\n\trelevantRemovedRootsFromDataChange: (\n\t\ttaggedChange: ModularChangeset,\n\t) => Iterable<DeltaDetachedNodeId>,\n\tupdateDataChangeRefreshers: (\n\t\tchange: ModularChangeset,\n\t\tgetDetachedNode: (id: DeltaDetachedNodeId) => TreeChunk | undefined,\n\t\tremovedRoots: Iterable<DeltaDetachedNodeId>,\n\t\trequireRefreshers: boolean,\n\t) => ModularChangeset,\n): SharedTreeChange {\n\t// Adding refreshers to a SharedTreeChange is not as simple as adding refreshers to each of its data changes.\n\t// This is because earlier data changes affect the state of the forest in ways that can influence the refreshers\n\t// needed for later data changes. This can happen in two ways:\n\t// 1. By removing a tree that is a relevant root to a later data change.\n\t// 2. By changing the contents of a tree that is a relevant root to a later data change.\n\t// (Note that these two cases can compound)\n\t// Thankfully, in both of these cases, refreshers can be omitted from the later data changes because the forest\n\t// applying those data changes is guaranteed to still have have the relevant trees in memory.\n\t// This means that for the first data change, all required refreshers should be added (and none should be missing).\n\t// While for later data changes, we should not include refreshers that either:\n\t// A) were already included in the earlier data changes\n\t// B) correspond to trees that were removed by earlier data changes\n\t// Set A is excluded by tracking which roots have already been included in the earlier data changes, and filtering\n\t// them out from the relevant removed roots.\n\t// Set B is excluded because the `getDetachedNode` is bound to return `undefined` for them, which tell\n\t// `defaultUpdateRefreshers` to ignore. One downside of this approach is that it prevents `defaultUpdateRefreshers`\n\t// from detecting cases where a detached node is missing for another reason (which would be a bug).\n\n\t// The roots that have been included as refreshers across all data changes so far.\n\tconst includedRoots: NestedSet<RevisionTag | undefined, number> = new Map();\n\tfunction getAndRememberDetachedNode(id: DeltaDetachedNodeId): TreeChunk | undefined {\n\t\taddToNestedSet(includedRoots, id.major, id.minor);\n\t\treturn getDetachedNode(id);\n\t}\n\tfunction* filterIncludedRoots(\n\t\ttoFilter: Iterable<DeltaDetachedNodeId>,\n\t): Iterable<DeltaDetachedNodeId> {\n\t\tfor (const id of toFilter) {\n\t\t\tif (!nestedSetContains(includedRoots, id.major, id.minor)) {\n\t\t\t\tyield id;\n\t\t\t}\n\t\t}\n\t}\n\tlet isFirstDataChange = true;\n\treturn mapDataChanges(change, (dataChange) => {\n\t\tconst removedRoots = relevantRemovedRootsFromDataChange(dataChange);\n\t\tif (isFirstDataChange) {\n\t\t\tisFirstDataChange = false;\n\t\t\treturn updateDataChangeRefreshers(\n\t\t\t\tdataChange,\n\t\t\t\tgetAndRememberDetachedNode,\n\t\t\t\tremovedRoots,\n\t\t\t\ttrue,\n\t\t\t);\n\t\t} else {\n\t\t\treturn updateDataChangeRefreshers(\n\t\t\t\tdataChange,\n\t\t\t\tgetAndRememberDetachedNode,\n\t\t\t\tfilterIncludedRoots(removedRoots),\n\t\t\t\tfalse,\n\t\t\t);\n\t\t}\n\t});\n}\n"]}
1
+ {"version":3,"file":"sharedTreeChangeFamily.js","sourceRoot":"","sources":["../../src/shared-tree/sharedTreeChangeFamily.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAAmE;AAInE,+CAU0B;AAC1B,4DASuC;AACvC,+CAM0B;AAE1B,2EAA8E;AAE9E,yEAAmE;AAEnE;;;;GAIG;AACH,MAAa,sBAAsB;IAYlC,YACC,gBAAkC,EAClC,eAAgC,EAChC,YAA2B,EAC3B,wBAAkD,EACjC,YAA4B;QAA5B,iBAAY,GAAZ,YAAY,CAAgB;QAE7C,MAAM,kBAAkB,GAAG,IAAA,uCAA4B,EACtD,kCAAuB,EACvB,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,wBAAwB,CACxB,CAAC;QACF,IAAI,CAAC,mBAAmB,GAAG,IAAI,8BAAmB,CAAC,qBAAU,EAAE,kBAAkB,CAAC,CAAC;QACnF,IAAI,CAAC,MAAM,GAAG,IAAA,2DAA+B,EAC5C,IAAI,CAAC,mBAAmB,CAAC,MAAM,EAC/B,YAAY,CACZ,CAAC;IACH,CAAC;IAEM,WAAW,CACjB,eAAkC,EAClC,cAAgE;QAEhE,OAAO,IAAI,gDAAqB,CAC/B,IAAI,CAAC,mBAAmB,EACxB,eAAe,EACf,cAAc,CACd,CAAC;IACH,CAAC;IAEM,OAAO,CAAC,OAAyC;QACvD,MAAM,UAAU,GAAyC,EAAE,CAAC;QAC5D,MAAM,aAAa,GAAqC,EAAE,CAAC;QAE3D,MAAM,kBAAkB,GAAG,GAAS,EAAE;YACrC,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC9B,U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MAAM,YAAY,GAAG,kCAAkC,CAAC,UAAU,CAAC,CAAC;QACpE,IAAI,iBAAiB,EAAE,CAAC;YACvB,iBAAiB,GAAG,KAAK,CAAC;YAC1B,OAAO,0BAA0B,CAChC,UAAU,EACV,0BAA0B,EAC1B,YAAY,EACZ,IAAI,CACJ,CAAC;QACH,CAAC;aAAM,CAAC;YACP,OAAO,0BAA0B,CAChC,UAAU,EACV,0BAA0B,EAC1B,mBAAmB,CAAC,YAAY,CAAC,EACjC,KAAK,CACL,CAAC;QACH,CAAC;IACF,CAAC,CAAC,CAAC;AACJ,CAAC;AAlED,4CAkEC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, fail } from \"@fluidframework/core-utils/internal\";\nimport type { IIdCompressor } from \"@fluidframework/id-compressor\";\n\nimport type { ICodecFamily, ICodecOptions } from \"../codec/index.js\";\nimport {\n\ttype ChangeEncodingContext,\n\ttype ChangeFamily,\n\ttype ChangeRebaser,\n\ttype DeltaDetachedNodeId,\n\ttype RevisionMetadataSource,\n\ttype RevisionTag,\n\ttype RevisionTagCodec,\n\ttype TaggedChange,\n\tmapTaggedChange,\n} from \"../core/index.js\";\nimport {\n\ttype FieldBatchCodec,\n\tModularChangeFamily,\n\ttype ModularChangeset,\n\ttype TreeChunk,\n\ttype TreeCompressionStrategy,\n\tfieldKindConfigurations,\n\tfieldKinds,\n\tmakeModularChangeCodecFamily,\n} from \"../feature-libraries/index.js\";\nimport {\n\ttype Mutable,\n\ttype NestedSet,\n\taddToNestedSet,\n\thasSingle,\n\tnestedSetContains,\n} from \"../util/index.js\";\n\nimport { makeSharedTreeChangeCodecFamily } from \"./sharedTreeChangeCodecs.js\";\nimport type { SharedTreeChange } from \"./sharedTreeChangeTypes.js\";\nimport { SharedTreeEditBuilder } from \"./sharedTreeEditBuilder.js\";\n\n/**\n * Implementation of {@link ChangeFamily} that combines edits to fields and schema changes.\n *\n * @sealed\n */\nexport class SharedTreeChangeFamily\n\timplements\n\t\tChangeFamily<SharedTreeEditBuilder, SharedTreeChange>,\n\t\tChangeRebaser<SharedTreeChange>\n{\n\tpublic static readonly emptyChange: SharedTreeChange = {\n\t\tchanges: [],\n\t};\n\n\tpublic readonly codecs: ICodecFamily<SharedTreeChange, ChangeEncodingContext>;\n\tprivate readonly modularChangeFamily: ModularChangeFamily;\n\n\tpublic constructor(\n\t\trevisionTagCodec: RevisionTagCodec,\n\t\tfieldBatchCodec: FieldBatchCodec,\n\t\tcodecOptions: ICodecOptions,\n\t\tchunkCompressionStrategy?: TreeCompressionStrategy,\n\t\tprivate readonly idCompressor?: IIdCompressor,\n\t) {\n\t\tconst modularChangeCodec = makeModularChangeCodecFamily(\n\t\t\tfieldKindConfigurations,\n\t\t\trevisionTagCodec,\n\t\t\tfieldBatchCodec,\n\t\t\tcodecOptions,\n\t\t\tchunkCompressionStrategy,\n\t\t);\n\t\tthis.modularChangeFamily = new ModularChangeFamily(fieldKinds, modularChangeCodec);\n\t\tthis.codecs = makeSharedTreeChangeCodecFamily(\n\t\t\tthis.modularChangeFamily.codecs,\n\t\t\tcodecOptions,\n\t\t);\n\t}\n\n\tpublic buildEditor(\n\t\tmintRevisionTag: () => RevisionTag,\n\t\tchangeReceiver: (change: TaggedChange<SharedTreeChange>) => void,\n\t): SharedTreeEditBuilder {\n\t\treturn new SharedTreeEditBuilder(\n\t\t\tthis.modularChangeFamily,\n\t\t\tmintRevisionTag,\n\t\t\tchangeReceiver,\n\t\t);\n\t}\n\n\tpublic compose(changes: TaggedChange<SharedTreeChange>[]): SharedTreeChange {\n\t\tconst newChanges: Mutable<SharedTreeChange[\"changes\"]> = [];\n\t\tconst dataChangeRun: TaggedChange<ModularChangeset>[] = [];\n\n\t\tconst flushDataChangeRun = (): void => {\n\t\t\tif (dataChangeRun.length > 0) {\n\t\t\t\tnewChanges.push({\n\t\t\t\t\ttype: \"data\",\n\t\t\t\t\tinnerChange: this.modularChangeFamily.compose(dataChangeRun),\n\t\t\t\t});\n\t\t\t\tdataChangeRun.length = 0;\n\t\t\t}\n\t\t};\n\n\t\tfor (const topChange of changes) {\n\t\t\tfor (const change of topChange.change.changes) {\n\t\t\t\tif (change.type === \"schema\") {\n\t\t\t\t\tflushDataChangeRun();\n\t\t\t\t\tnewChanges.push(change);\n\t\t\t\t} else {\n\t\t\t\t\tdataChangeRun.push(mapTaggedChange(topChange, change.innerChange));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tflushDataChangeRun();\n\t\treturn { changes: newChanges };\n\t}\n\n\tpublic invert(\n\t\tchange: TaggedChange<SharedTreeChange>,\n\t\tisRollback: boolean,\n\t\trevision: RevisionTag,\n\t): SharedTreeChange {\n\t\tconst invertInnerChange: (\n\t\t\tinnerChange: SharedTreeChange[\"changes\"][number],\n\t\t) => SharedTreeChange[\"changes\"][number] = (innerChange) => {\n\t\t\tswitch (innerChange.type) {\n\t\t\t\tcase \"data\":\n\t\t\t\t\treturn {\n\t\t\t\t\t\ttype: \"data\",\n\t\t\t\t\t\tinnerChange: this.modularChangeFamily.invert(\n\t\t\t\t\t\t\tmapTaggedChange(change, innerChange.innerChange),\n\t\t\t\t\t\t\tisRollback,\n\t\t\t\t\t\t\trevision,\n\t\t\t\t\t\t),\n\t\t\t\t\t};\n\t\t\t\tcase \"schema\": {\n\t\t\t\t\treturn {\n\t\t\t\t\t\ttype: \"schema\",\n\t\t\t\t\t\tinnerChange: {\n\t\t\t\t\t\t\tschema: {\n\t\t\t\t\t\t\t\tnew: innerChange.innerChange.schema.old,\n\t\t\t\t\t\t\t\told: innerChange.innerChange.schema.new,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tisInverse: true,\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tfail(0xacc /* Unknown SharedTree change type. */);\n\t\t\t}\n\t\t};\n\t\treturn {\n\t\t\tchanges: change.change.changes.map(invertInnerChange).reverse(),\n\t\t};\n\t}\n\n\tpublic rebase(\n\t\tchange: TaggedChange<SharedTreeChange>,\n\t\tover: TaggedChange<SharedTreeChange>,\n\t\trevisionMetadata: RevisionMetadataSource,\n\t): SharedTreeChange {\n\t\tif (change.change.changes.length === 0 || over.change.changes.length === 0) {\n\t\t\treturn change.change;\n\t\t}\n\n\t\tif (hasSchemaChange(change.change) || hasSchemaChange(over.change)) {\n\t\t\t// Any SharedTreeChange (a list of sub-changes) that contains a schema change will cause ANY change that rebases over it to conflict.\n\t\t\t// Similarly, any SharedTreeChange containing a schema change will fail to rebase over ANY change.\n\t\t\t// Those two combine to mean: no concurrency with schema changes is supported.\n\t\t\t// This is fine because it's an open problem. Example: a tree with an A at the root and a schema that allows an A | B at the root will\n\t\t\t// become out of schema if a schema changes to restrict root types to just A is concurrent with a data change that sets it to a B.\n\t\t\t// We don't have an efficient way to detect this document-wide and there are varying opinions on restricting schema changes to prevent this.\n\t\t\t// A SharedTreeChange containing a schema change will NOT conflict in a non-concurrency case, as the \"meatless sandwich\" optimization\n\t\t\t// will result in rebase never being called.\n\t\t\treturn SharedTreeChangeFamily.emptyChange;\n\t\t}\n\t\tassert(\n\t\t\thasSingle(change.change.changes) && hasSingle(over.change.changes),\n\t\t\t0x884 /* SharedTreeChange should have exactly one inner change if no schema change is present. */,\n\t\t);\n\n\t\tconst dataChangeIntention = change.change.changes[0];\n\t\tconst dataChangeOver = over.change.changes[0];\n\t\tassert(\n\t\t\tdataChangeIntention.type === \"data\" && dataChangeOver.type === \"data\",\n\t\t\t0x885 /* Data change should be present. */,\n\t\t);\n\n\t\treturn {\n\t\t\tchanges: [\n\t\t\t\t{\n\t\t\t\t\ttype: \"data\",\n\t\t\t\t\tinnerChange: this.modularChangeFamily.rebase(\n\t\t\t\t\t\tmapTaggedChange(change, dataChangeIntention.innerChange),\n\t\t\t\t\t\tmapTaggedChange(over, dataChangeOver.innerChange),\n\t\t\t\t\t\trevisionMetadata,\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t],\n\t\t};\n\t}\n\n\tpublic changeRevision(\n\t\tchange: SharedTreeChange,\n\t\tnewRevision: RevisionTag | undefined,\n\t\trollbackOf?: RevisionTag,\n\t): SharedTreeChange {\n\t\treturn {\n\t\t\tchanges: change.changes.map((inner) => {\n\t\t\t\treturn inner.type === \"data\"\n\t\t\t\t\t? {\n\t\t\t\t\t\t\t...inner,\n\t\t\t\t\t\t\tinnerChange: this.modularChangeFamily.rebaser.changeRevision(\n\t\t\t\t\t\t\t\tinner.innerChange,\n\t\t\t\t\t\t\t\tnewRevision,\n\t\t\t\t\t\t\t\trollbackOf,\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t}\n\t\t\t\t\t: inner;\n\t\t\t}),\n\t\t};\n\t}\n\n\tpublic get rebaser(): ChangeRebaser<SharedTreeChange> {\n\t\treturn this;\n\t}\n}\n\nexport function hasSchemaChange(change: SharedTreeChange): boolean {\n\treturn change.changes.some((innerChange) => innerChange.type === \"schema\");\n}\n\nfunction mapDataChanges(\n\tchange: SharedTreeChange,\n\tmap: (change: ModularChangeset) => ModularChangeset,\n): SharedTreeChange {\n\treturn {\n\t\tchanges: change.changes.map((dataOrSchemaChange) => {\n\t\t\tif (dataOrSchemaChange.type === \"data\") {\n\t\t\t\treturn {\n\t\t\t\t\ttype: \"data\",\n\t\t\t\t\tinnerChange: map(dataOrSchemaChange.innerChange),\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn dataOrSchemaChange;\n\t\t}),\n\t};\n}\n\n/**\n * Produces an equivalent change with an updated set of appropriate refreshers.\n * @param change - The change to compute refreshers for. Not mutated.\n * @param getDetachedNode - retrieves a {@link TreeChunk} for the corresponding detached node id.\n * Is expected to read from a forest in a state that corresponds to the input context of the given change.\n * @returns An equivalent change with an updated set of appropriate refreshers.\n */\nexport function updateRefreshers(\n\tchange: SharedTreeChange,\n\tgetDetachedNode: (id: DeltaDetachedNodeId) => TreeChunk | undefined,\n\trelevantRemovedRootsFromDataChange: (\n\t\ttaggedChange: ModularChangeset,\n\t) => Iterable<DeltaDetachedNodeId>,\n\tupdateDataChangeRefreshers: (\n\t\tchange: ModularChangeset,\n\t\tgetDetachedNode: (id: DeltaDetachedNodeId) => TreeChunk | undefined,\n\t\tremovedRoots: Iterable<DeltaDetachedNodeId>,\n\t\trequireRefreshers: boolean,\n\t) => ModularChangeset,\n): SharedTreeChange {\n\t// Adding refreshers to a SharedTreeChange is not as simple as adding refreshers to each of its data changes.\n\t// This is because earlier data changes affect the state of the forest in ways that can influence the refreshers\n\t// needed for later data changes. This can happen in two ways:\n\t// 1. By removing a tree that is a relevant root to a later data change.\n\t// 2. By changing the contents of a tree that is a relevant root to a later data change.\n\t// (Note that these two cases can compound)\n\t// Thankfully, in both of these cases, refreshers can be omitted from the later data changes because the forest\n\t// applying those data changes is guaranteed to still have have the relevant trees in memory.\n\t// This means that for the first data change, all required refreshers should be added (and none should be missing).\n\t// While for later data changes, we should not include refreshers that either:\n\t// A) were already included in the earlier data changes\n\t// B) correspond to trees that were removed by earlier data changes\n\t// Set A is excluded by tracking which roots have already been included in the earlier data changes, and filtering\n\t// them out from the relevant removed roots.\n\t// Set B is excluded because the `getDetachedNode` is bound to return `undefined` for them, which tell\n\t// `defaultUpdateRefreshers` to ignore. One downside of this approach is that it prevents `defaultUpdateRefreshers`\n\t// from detecting cases where a detached node is missing for another reason (which would be a bug).\n\n\t// The roots that have been included as refreshers across all data changes so far.\n\tconst includedRoots: NestedSet<RevisionTag | undefined, number> = new Map();\n\tfunction getAndRememberDetachedNode(id: DeltaDetachedNodeId): TreeChunk | undefined {\n\t\taddToNestedSet(includedRoots, id.major, id.minor);\n\t\treturn getDetachedNode(id);\n\t}\n\tfunction* filterIncludedRoots(\n\t\ttoFilter: Iterable<DeltaDetachedNodeId>,\n\t): Iterable<DeltaDetachedNodeId> {\n\t\tfor (const id of toFilter) {\n\t\t\tif (!nestedSetContains(includedRoots, id.major, id.minor)) {\n\t\t\t\tyield id;\n\t\t\t}\n\t\t}\n\t}\n\tlet isFirstDataChange = true;\n\treturn mapDataChanges(change, (dataChange) => {\n\t\tconst removedRoots = relevantRemovedRootsFromDataChange(dataChange);\n\t\tif (isFirstDataChange) {\n\t\t\tisFirstDataChange = false;\n\t\t\treturn updateDataChangeRefreshers(\n\t\t\t\tdataChange,\n\t\t\t\tgetAndRememberDetachedNode,\n\t\t\t\tremovedRoots,\n\t\t\t\ttrue,\n\t\t\t);\n\t\t} else {\n\t\t\treturn updateDataChangeRefreshers(\n\t\t\t\tdataChange,\n\t\t\t\tgetAndRememberDetachedNode,\n\t\t\t\tfilterIncludedRoots(removedRoots),\n\t\t\t\tfalse,\n\t\t\t);\n\t\t}\n\t});\n}\n"]}
@@ -9,8 +9,8 @@ const internal_1 = require("@fluidframework/core-utils/internal");
9
9
  const internal_2 = require("@fluidframework/telemetry-utils/internal");
10
10
  const index_js_1 = require("../feature-libraries/index.js");
11
11
  const index_js_2 = require("../simple-tree/index.js");
12
- const schematizingTreeView_js_1 = require("./schematizingTreeView.js");
13
12
  const checkoutFlexTreeView_js_1 = require("./checkoutFlexTreeView.js");
13
+ const schematizingTreeView_js_1 = require("./schematizingTreeView.js");
14
14
  /**
15
15
  * The {@link (Tree:interface)} singleton which holds various functions for interacting with {@link TreeNode}s.
16
16
  * @public
@@ -1 +1 @@
1
- {"version":3,"file":"tree.js","sourceRoot":"","sources":["../../src/shared-tree/tree.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAAsE;AACtE,uEAAsE;AAEtE,4DAA2D;AAC3D,sDASiC;AAEjC,uEAAuE;AAEvE,uEAAoE;AA+BpE;;;GAGG;AACU,QAAA,IAAI,GAAS;IACzB,GAAG,sBAAW;IAEd,cAAc,EAAE,oBAAoB,EAAE;IAEtC,QAAQ,CAAC,MAAgB,EAAE,KAAe;QACzC,IAAI,OAAO,GAAyB,KAAK,CAAC;QAC1C,OAAO,OAAO,KAAK,SAAS,EAAE,CAAC;YAC9B,IAAI,OAAO,KAAK,MAAM,E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AO,MAAM,CAAC;AACf,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { TreeStatus } from \"../feature-libraries/index.js\";\nimport {\n\ttype ImplicitFieldSchema,\n\ttype TreeNode,\n\ttype TreeNodeApi,\n\ttype TreeView,\n\tgetOrCreateInnerNode,\n\ttreeNodeApi,\n\trollback,\n\ttype TransactionConstraint,\n} from \"../simple-tree/index.js\";\n\nimport { SchematizingSimpleTreeView } from \"./schematizingTreeView.js\";\nimport type { ITreeCheckout } from \"./treeCheckout.js\";\nimport { getCheckoutFlexTreeView } from \"./checkoutFlexTreeView.js\";\n\n/**\n * Provides various functions for interacting with {@link TreeNode}s.\n * @remarks\n * This type should only be used via the {@link (Tree:variable)} export.\n * @system @sealed @public\n */\nexport interface Tree extends TreeNodeApi {\n\t/**\n\t * Run a {@link RunTransaction | transaction}.\n\t */\n\treadonly runTransaction: RunTransaction;\n\t/**\n\t * Check if the subtree defined by `node` contains `other`.\n\t *\n\t * @returns true if `other` is an inclusive descendant of `node`, and false otherwise.\n\t * @remarks\n\t * This includes direct and indirect children:\n\t * as long as `node` is an ancestor of `other` (occurs in its parentage chain), this returns true, regardless of the number of levels of the tree between.\n\t *\n\t * `node` is considered to contain itself, so the case where `node === other` returns true.\n\t *\n\t * This is handy when checking if moving `node` into `other` would create a cycle and would thus be invalid.\n\t *\n\t * This check walks the parents of `other` looking for `node`,\n\t * and thus runs in time proportional to the depth of child in the tree.\n\t */\n\tcontains(node: TreeNode, other: TreeNode): boolean;\n}\n\n/**\n * The {@link (Tree:interface)} singleton which holds various functions for interacting with {@link TreeNode}s.\n * @public\n */\nexport const Tree: Tree = {\n\t...treeNodeApi,\n\n\trunTransaction: createRunTransaction(),\n\n\tcontains(parent: TreeNode, child: TreeNode): boolean {\n\t\tlet toCheck: TreeNode | undefined = child;\n\t\twhile (toCheck !== undefined) {\n\t\t\tif (toCheck === parent) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\ttoCheck = Tree.parent(toCheck);\n\t\t}\n\t\treturn false;\n\t},\n};\n\n/**\n * A function which runs a transaction in a SharedTree.\n * @privateRemarks\n * This interface exists so that the (generously) overloaded `Tree.runTransaction` function can have the \"rollback\" property hanging off of it.\n * The rollback property being available on the function itself gives users a convenient option for rolling back a transaction without having to import another symbol.\n * @sealed @public\n */\nexport interface RunTransaction {\n\t/**\n\t * The {@link rollback} object used to roll back a transaction.\n\t */\n\treadonly rollback: typeof rollback;\n\n\t/**\n\t * Apply one or more edits to the tree as a single atomic unit.\n\t * @param node - The node that will be passed to `transaction`.\n\t * This is typically the root node of the subtree that will be modified by the transaction.\n\t * @param transaction - The function to run as the body of the transaction.\n\t * This function is passed the provided `node`.\n\t * @returns The value returned by the inner `transaction` function.\n\t * @remarks\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 *\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 function throws an error then the transaction will be automatically rolled back (discarding any changes made to the tree so far) before the error is propagated up from this function.\n\t * If the transaction is rolled back, a corresponding change event will also be emitted for the rollback.\n\t */\n\t<TNode extends TreeNode, TResult>(\n\t\tnode: TNode,\n\t\ttransaction: (node: TNode) => TResult,\n\t): TResult;\n\t/**\n\t * Apply one or more edits to the tree as a single atomic unit.\n\t * @param tree - The tree which will be edited by the transaction\n\t * @param transaction - The function to run as the body of the transaction.\n\t * This function is passed the root of the tree.\n\t * @returns The value returned by the inner `transaction` function.\n\t * @remarks\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 *\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 function throws an error then the transaction will be automatically rolled back (discarding any changes made to the tree so far) before the error is propagated up from this function.\n\t * If the transaction is rolled back, a corresponding change event will also be emitted for the rollback.\n\t */\n\t// TODO: TreeView is invariant over the schema, so to accept any view, `any` is the only real option unless a non generic (or covariant) base type for view is introduced (which is planned).\n\t// This use of any is actually type safe as it is only used as a constraint, and the actual strongly typed view (TView) is passed to the callback.\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t<TView extends TreeView<any>, TResult>(\n\t\ttree: TView,\n\t\ttransaction: (root: TView[\"root\"]) => TResult,\n\t): TResult;\n\t/**\n\t * Apply one or more edits to the tree as a single atomic unit.\n\t * @param node - The node that will be passed to `transaction`.\n\t * This is typically the root node of the subtree that will be modified by the transaction.\n\t * @param transaction - The function to run as the body of the transaction.\n\t * This function is passed the provided `node`.\n\t * At any point during the transaction, the function may return the special {@link RunTransaction.rollback | rollback value} (`Tree.runTransaction.rollback`) to abort the transaction and discard any changes it made so far.\n\t * @returns The value returned by the inner `transaction` function.\n\t * @remarks\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 *\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 function throws an error then the transaction will be automatically rolled back (discarding any changes made to the tree so far) before the error is propagated up from this function.\n\t * If the transaction is rolled back (whether by an error or by returning the {@link RunTransaction.rollback} | rollback value), a corresponding change event will also be emitted for the rollback.\n\t */\n\t<TNode extends TreeNode, TResult>(\n\t\tnode: TNode,\n\t\ttransaction: (node: TNode) => TResult | typeof rollback,\n\t): TResult | typeof rollback;\n\t/**\n\t * Apply one or more edits to the tree as a single atomic unit.\n\t * @param tree - The tree which will be edited by the transaction\n\t * @param transaction - The function to run as the body of the transaction.\n\t * This function is passed the root of the tree.\n\t * At any point during the transaction, the function may return the special {@link RunTransaction.rollback | rollback value} (`Tree.runTransaction.rollback`) to abort the transaction and discard any changes it made so far.\n\t * @returns The value returned by the inner `transaction` function.\n\t * @remarks\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 *\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 function throws an error then the transaction will be automatically rolled back (discarding any changes made to the tree so far) before the error is propagated up from this function.\n\t * If the transaction is rolled back (whether by an error or by returning the {@link RunTransaction.rollback} | rollback value), a corresponding change event will also be emitted for the rollback.\n\t */\n\t// See comment on previous overload about use of any here.\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t<TView extends TreeView<any>, TResult>(\n\t\ttree: TView,\n\t\ttransaction: (root: TView[\"root\"]) => TResult | typeof rollback,\n\t): TResult | typeof rollback;\n\t/**\n\t * Apply one or more edits to the tree as a single atomic unit.\n\t * @param node - The node that will be passed to `transaction`.\n\t * This is typically the root node of the subtree that will be modified by the transaction.\n\t * @param transaction - The function to run as the body of the transaction.\n\t * This function is passed the provided `node`.\n\t * @remarks\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 *\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 function throws an error then the transaction will be automatically rolled back (discarding any changes made to the tree so far) before the error is propagated up from this function.\n\t * If the transaction is rolled back, a corresponding change event will also be emitted for the rollback.\n\t */\n\t<TNode extends TreeNode>(node: TNode, transaction: (node: TNode) => void): void;\n\t/**\n\t * Apply one or more edits to the tree as a single atomic unit.\n\t * @param tree - The tree which will be edited by the transaction\n\t * @param transaction - The function to run as the body of the transaction.\n\t * This function is passed the root of the tree.\n\t * @remarks\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 *\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 function throws an error then the transaction will be automatically rolled back (discarding any changes made to the tree so far) before the error is propagated up from this function.\n\t * If the transaction is rolled back, a corresponding change event will also be emitted for the rollback.\n\t */\n\t// See comment on previous overload about use of any here.\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t<TView extends TreeView<any>>(tree: TView, transaction: (root: TView[\"root\"]) => void): void;\n\t/**\n\t * Apply one or more edits to the tree as a single atomic unit.\n\t * @param node - The node that will be passed to `transaction`.\n\t * This is typically the root node of the subtree that will be modified by the transaction.\n\t * @param transaction - The function to run as the body of the transaction.\n\t * This function is passed the provided `node`.\n\t * @param preconditions - 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, it will throw an error.\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 this client and ignored by all other clients.\n\t * @returns The value returned by the inner `transaction` function.\n\t * @remarks\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 *\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 function throws an error then the transaction will be automatically rolled back (discarding any changes made to the tree so far) before the error is propagated up from this function.\n\t * If the transaction is rolled back, a corresponding change event will also be emitted for the rollback.\n\t */\n\t<TNode extends TreeNode, TResult>(\n\t\tnode: TNode,\n\t\ttransaction: (node: TNode) => TResult,\n\t\tpreconditions?: readonly TransactionConstraint[],\n\t): TResult;\n\t/**\n\t * Apply one or more edits to the tree as a single atomic unit.\n\t * @param tree - The tree which will be edited by the transaction\n\t * @param transaction - The function to run as the body of the transaction.\n\t * This function is passed the root of the tree.\n\t * @param preconditions - 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, it will throw an error.\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 this client and ignored by all other clients.\n\t * @returns The value returned by the inner `transaction` function.\n\t * @remarks\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 *\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 function throws an error then the transaction will be automatically rolled back (discarding any changes made to the tree so far) before the error is propagated up from this function.\n\t * If the transaction is rolled back, a corresponding change event will also be emitted for the rollback.\n\t */\n\t// See comment on previous overload about use of any here.\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t<TView extends TreeView<any>, TResult>(\n\t\ttree: TView,\n\t\ttransaction: (root: TView[\"root\"]) => TResult,\n\t\tpreconditions?: readonly TransactionConstraint[],\n\t): TResult;\n\t/**\n\t * Apply one or more edits to the tree as a single atomic unit.\n\t * @param node - The node that will be passed to `transaction`.\n\t * This is typically the root node of the subtree that will be modified by the transaction.\n\t * @param transaction - The function to run as the body of the transaction.\n\t * This function is passed the provided `node`.\n\t * At any point during the transaction, the function may return the special {@link RunTransaction.rollback | rollback value} (`Tree.runTransaction.rollback`) to abort the transaction and discard any changes it made so far.\n\t * @param preconditions - 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, it will throw an error.\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 this client and ignored by all other clients.\n\t * @returns The value returned by the inner `transaction` function.\n\t * @remarks\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 *\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 function throws an error then the transaction will be automatically rolled back (discarding any changes made to the tree so far) before the error is propagated up from this function.\n\t * If the transaction is rolled back (whether by an error or by returning the {@link RunTransaction.rollback} | rollback value), a corresponding change event will also be emitted for the rollback.\n\t */\n\t<TNode extends TreeNode, TResult>(\n\t\tnode: TNode,\n\t\ttransaction: (node: TNode) => TResult | typeof rollback,\n\t\tpreconditions?: readonly TransactionConstraint[],\n\t): TResult | typeof rollback;\n\t/**\n\t * Apply one or more edits to the tree as a single atomic unit.\n\t * @param tree - The tree which will be edited by the transaction\n\t * @param transaction - The function to run as the body of the transaction.\n\t * This function is passed the root of the tree.\n\t * At any point during the transaction, the function may return the special {@link RunTransaction.rollback | rollback value} (`Tree.runTransaction.rollback`) to abort the transaction and discard any changes it made so far.\n\t * @param preconditions - 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, it will throw an error.\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 this client and ignored by all other clients.\n\t * @returns The value returned by the inner `transaction` function.\n\t * @remarks\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 *\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 function throws an error then the transaction will be automatically rolled back (discarding any changes made to the tree so far) before the error is propagated up from this function.\n\t * If the transaction is rolled back (whether by an error or by returning the {@link RunTransaction.rollback} | rollback value), a corresponding change event will also be emitted for the rollback.\n\t */\n\t// See comment on previous overload about use of any here.\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t<TView extends TreeView<any>, TResult>(\n\t\ttree: TView,\n\t\ttransaction: (root: TView[\"root\"]) => TResult | typeof rollback,\n\t\tpreconditions?: readonly TransactionConstraint[],\n\t): TResult | typeof rollback;\n\t/**\n\t * Apply one or more edits to the tree as a single atomic unit.\n\t * @param node - The node that will be passed to `transaction`.\n\t * This is typically the root node of the subtree that will be modified by the transaction.\n\t * @param transaction - The function to run as the body of the transaction.\n\t * This function is passed the provided `node`.\n\t * @param preconditions - 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, it will throw an error.\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 this client and ignored by all other clients.\n\t * @remarks\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 *\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 function throws an error then the transaction will be automatically rolled back (discarding any changes made to the tree so far) before the error is propagated up from this function.\n\t * If the transaction is rolled back, a corresponding change event will also be emitted for the rollback.\n\t */\n\t<TNode extends TreeNode>(\n\t\tnode: TNode,\n\t\ttransaction: (node: TNode) => void,\n\t\tpreconditions?: readonly TransactionConstraint[],\n\t): void;\n\t/**\n\t * Apply one or more edits to the tree as a single atomic unit.\n\t * @param tree - The tree which will be edited by the transaction\n\t * @param transaction - The function to run as the body of the transaction.\n\t * This function is passed the root of the tree.\n\t * @param preconditions - 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, it will throw an error.\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 this client and ignored by all other clients.\n\t * @remarks\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 *\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 function throws an error then the transaction will be automatically rolled back (discarding any changes made to the tree so far) before the error is propagated up from this function.\n\t * If the transaction is rolled back, a corresponding change event will also be emitted for the rollback.\n\t */\n\t// See comment on previous overload about use of any here.\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t<TView extends TreeView<any>>(\n\t\ttree: TView,\n\t\ttransaction: (root: TView[\"root\"]) => void,\n\t\tpreconditions?: readonly TransactionConstraint[],\n\t): void;\n}\n\n// TODO: Add more constraint types here\n\n/** Creates a copy of `runTransaction` with the `rollback` property added so as to satisfy the `RunTransaction` interface. */\nfunction createRunTransaction(): RunTransaction {\n\t/** A type-safe helper to add a \"rollback\" property (as required by the `RunTransaction` interface) to a given object */\n\tfunction defineRollbackProperty<T extends object>(\n\t\ttarget: T,\n\t): T & { rollback: typeof rollback } {\n\t\tReflect.defineProperty(target, \"rollback\", { value: rollback });\n\t\treturn target as T & { readonly rollback: typeof rollback };\n\t}\n\n\treturn defineRollbackProperty(runTransaction.bind({}));\n}\n\n/**\n * Run the given transaction.\n * @remarks\n * This API is not publicly exported but is exported outside of this module so that test code may unit test the `Tree.runTransaction` function directly without being restricted to its public API overloads.\n * @deprecated This API catches exceptions then tries to modify the tree before rethrowing: this is not robust. Use {@link TreeViewAlpha.runTransaction} instead which does not try to edit content in the error case.\n */\nexport function runTransaction<\n\tTNode extends TreeNode,\n\tTRoot extends ImplicitFieldSchema,\n\tTResult,\n>(\n\ttreeOrNode: TNode | TreeView<TRoot>,\n\ttransaction:\n\t\t| ((node: TNode) => TResult | typeof rollback)\n\t\t| ((root: TRoot) => TResult | typeof rollback),\n\tpreconditions: readonly TransactionConstraint[] = [],\n): TResult | typeof rollback {\n\tif (treeOrNode instanceof SchematizingSimpleTreeView) {\n\t\tconst t = transaction as (root: TRoot) => TResult | typeof rollback;\n\t\treturn runTransactionInCheckout(\n\t\t\ttreeOrNode.checkout,\n\t\t\t() => t(treeOrNode.root as TRoot),\n\t\t\tpreconditions,\n\t\t);\n\t} else {\n\t\tconst node = treeOrNode as TNode;\n\t\tconst t = transaction as (node: TNode) => TResult | typeof rollback;\n\t\tconst context = getOrCreateInnerNode(node).context;\n\t\tif (context.isHydrated() === false) {\n\t\t\tthrow new UsageError(\n\t\t\t\t\"Transactions cannot be run on Unhydrated nodes. Transactions apply to a TreeView and Unhydrated nodes are not part of a TreeView.\",\n\t\t\t);\n\t\t}\n\t\tconst treeView = getCheckoutFlexTreeView(context);\n\t\treturn runTransactionInCheckout(treeView.checkout, () => t(node), preconditions);\n\t}\n}\n\n/**\n * Run the given transaction.\n * @deprecated This API catches exceptions then tries to modify the tree before rethrowing: this is not robust. Use {@link TreeViewAlpha.runTransaction} instead which does not try to editing content in the error case.\n */\nfunction runTransactionInCheckout<TResult>(\n\tcheckout: ITreeCheckout,\n\ttransaction: () => TResult | typeof rollback,\n\tpreconditions: readonly TransactionConstraint[],\n): TResult | typeof rollback {\n\tcheckout.transaction.start();\n\tfor (const constraint of preconditions) {\n\t\tswitch (constraint.type) {\n\t\t\tcase \"nodeInDocument\": {\n\t\t\t\tconst node = getOrCreateInnerNode(constraint.node);\n\t\t\t\tconst nodeStatus = Tree.status(constraint.node);\n\t\t\t\tif (nodeStatus !== TreeStatus.InDocument) {\n\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t`Attempted to add a \"nodeInDocument\" constraint, but the node is not currently in the document. Node status: ${nodeStatus}`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tcheckout.editor.addNodeExistsConstraint(node.anchorNode);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tunreachableCase(constraint.type);\n\t\t}\n\t}\n\n\tlet result: ReturnType<typeof transaction>;\n\ttry {\n\t\tresult = transaction();\n\t} catch (error) {\n\t\t// If the transaction has an unhandled error, abort and rollback the transaction but continue to propagate the error.\n\t\t// This might try and modify the tree or trigger events while things are in an inconsistent state.\n\t\t// It is up to the user of runTransaction to ensure that does not cause problems (and they have no robust way to do that, which is why its deprecated).\n\t\tcheckout.transaction.abort();\n\t\tthrow error;\n\t}\n\n\tif (result === rollback) {\n\t\tcheckout.transaction.abort();\n\t} else {\n\t\tcheckout.transaction.commit();\n\t}\n\n\treturn result;\n}\n"]}
1
+ {"version":3,"file":"tree.js","sourceRoot":"","sources":["../../src/shared-tree/tree.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAAsE;AACtE,uEAAsE;AAEtE,4DAA2D;AAC3D,sDASiC;AAEjC,uEAAoE;AACpE,uEAAuE;AAgCvE;;;GAGG;AACU,QAAA,IAAI,GAAS;IACzB,GAAG,sBAAW;IAEd,cAAc,EAAE,oBAAoB,EAAE;IAEtC,QAAQ,CAAC,MAAgB,EAAE,KAAe;QACzC,IAAI,OAAO,GAAyB,KAAK,CAAC;QAC1C,OAAO,OAAO,KAAK,SAAS,EAAE,CAAC;YAC9B,IAAI,OAAO,KAAK,MAAM,EAAE,CAAC;gBACxB,OAAO,IAAI,CAAC;YACb,CAAC;YACD,OAAO,GAAG,YAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAChC,CAAC;QACD,OAAO,KAAK,CAAC;IACd,CAAC;CACD,CAAC;AA0UF,uCAAuC;AAEvC,6HAA6H;AAC7H,SAAS,oBAAoB;IAC5B,wHAAwH;IACxH,SAAS,sBAAsB,CAC9B,MAAS;QAET,OAAO,CAAC,cAAc,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE,KAAK,EAAE,mBAAQ,EAAE,CAAC,CAAC;QAChE,OAAO,MAAoD,CAAC;IAC7D,CAAC;IAED,OAAO,sBAAsB,CAAC,cAAc,CAAC,IAAI,CA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AU,CAAC,IAAI,CAAC,CAAC;gBAChD,IAAI,UAAU,KAAK,qBAAU,CAAC,UAAU,EAAE,CAAC;oBAC1C,MAAM,IAAI,qBAAU,CACnB,+GAA+G,UAAU,EAAE,CAC3H,CAAC;gBACH,CAAC;gBACD,QAAQ,CAAC,MAAM,CAAC,uBAAuB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;gBACzD,MAAM;YACP,CAAC;YACD;gBACC,IAAA,0BAAe,EAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QACnC,CAAC;IACF,CAAC;IAED,IAAI,MAAsC,CAAC;IAC3C,IAAI,CAAC;QACJ,MAAM,GAAG,WAAW,EAAE,CAAC;IACxB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,qHAAqH;QACrH,kGAAkG;QAClG,uJAAuJ;QACvJ,QAAQ,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC;QAC7B,MAAM,KAAK,CAAC;IACb,CAAC;IAED,IAAI,MAAM,KAAK,mBAAQ,EAAE,CAAC;QACzB,QAAQ,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC;IAC9B,CAAC;SAAM,CAAC;QACP,QAAQ,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC;IAC/B,CAAC;IAED,OAAO,MAAM,CAAC;AACf,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { TreeStatus } from \"../feature-libraries/index.js\";\nimport {\n\ttype ImplicitFieldSchema,\n\ttype TreeNode,\n\ttype TreeNodeApi,\n\ttype TreeView,\n\tgetOrCreateInnerNode,\n\ttreeNodeApi,\n\trollback,\n\ttype TransactionConstraint,\n} from \"../simple-tree/index.js\";\n\nimport { getCheckoutFlexTreeView } from \"./checkoutFlexTreeView.js\";\nimport { SchematizingSimpleTreeView } from \"./schematizingTreeView.js\";\nimport type { ITreeCheckout } from \"./treeCheckout.js\";\n\n/**\n * Provides various functions for interacting with {@link TreeNode}s.\n * @remarks\n * This type should only be used via the {@link (Tree:variable)} export.\n * @system @sealed @public\n */\nexport interface Tree extends TreeNodeApi {\n\t/**\n\t * Run a {@link RunTransaction | transaction}.\n\t */\n\treadonly runTransaction: RunTransaction;\n\t/**\n\t * Check if the subtree defined by `node` contains `other`.\n\t *\n\t * @returns true if `other` is an inclusive descendant of `node`, and false otherwise.\n\t * @remarks\n\t * This includes direct and indirect children:\n\t * as long as `node` is an ancestor of `other` (occurs in its parentage chain), this returns true, regardless of the number of levels of the tree between.\n\t *\n\t * `node` is considered to contain itself, so the case where `node === other` returns true.\n\t *\n\t * This is handy when checking if moving `node` into `other` would create a cycle and would thus be invalid.\n\t *\n\t * This check walks the parents of `other` looking for `node`,\n\t * and thus runs in time proportional to the depth of child in the tree.\n\t */\n\tcontains(node: TreeNode, other: TreeNode): boolean;\n}\n\n/**\n * The {@link (Tree:interface)} singleton which holds various functions for interacting with {@link TreeNode}s.\n * @public\n */\nexport const Tree: Tree = {\n\t...treeNodeApi,\n\n\trunTransaction: createRunTransaction(),\n\n\tcontains(parent: TreeNode, child: TreeNode): boolean {\n\t\tlet toCheck: TreeNode | undefined = child;\n\t\twhile (toCheck !== undefined) {\n\t\t\tif (toCheck === parent) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\ttoCheck = Tree.parent(toCheck);\n\t\t}\n\t\treturn false;\n\t},\n};\n\n/**\n * A function which runs a transaction in a SharedTree.\n * @privateRemarks\n * This interface exists so that the (generously) overloaded `Tree.runTransaction` function can have the \"rollback\" property hanging off of it.\n * The rollback property being available on the function itself gives users a convenient option for rolling back a transaction without having to import another symbol.\n * @sealed @public\n */\nexport interface RunTransaction {\n\t/**\n\t * The {@link rollback} object used to roll back a transaction.\n\t */\n\treadonly rollback: typeof rollback;\n\n\t/**\n\t * Apply one or more edits to the tree as a single atomic unit.\n\t * @param node - The node that will be passed to `transaction`.\n\t * This is typically the root node of the subtree that will be modified by the transaction.\n\t * @param transaction - The function to run as the body of the transaction.\n\t * This function is passed the provided `node`.\n\t * @returns The value returned by the inner `transaction` function.\n\t * @remarks\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 *\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 function throws an error then the transaction will be automatically rolled back (discarding any changes made to the tree so far) before the error is propagated up from this function.\n\t * If the transaction is rolled back, a corresponding change event will also be emitted for the rollback.\n\t */\n\t<TNode extends TreeNode, TResult>(\n\t\tnode: TNode,\n\t\ttransaction: (node: TNode) => TResult,\n\t): TResult;\n\t/**\n\t * Apply one or more edits to the tree as a single atomic unit.\n\t * @param tree - The tree which will be edited by the transaction\n\t * @param transaction - The function to run as the body of the transaction.\n\t * This function is passed the root of the tree.\n\t * @returns The value returned by the inner `transaction` function.\n\t * @remarks\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 *\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 function throws an error then the transaction will be automatically rolled back (discarding any changes made to the tree so far) before the error is propagated up from this function.\n\t * If the transaction is rolled back, a corresponding change event will also be emitted for the rollback.\n\t */\n\t// TODO: TreeView is invariant over the schema, so to accept any view, `any` is the only real option unless a non generic (or covariant) base type for view is introduced (which is planned).\n\t// This use of any is actually type safe as it is only used as a constraint, and the actual strongly typed view (TView) is passed to the callback.\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t<TView extends TreeView<any>, TResult>(\n\t\ttree: TView,\n\t\ttransaction: (root: TView[\"root\"]) => TResult,\n\t): TResult;\n\t/**\n\t * Apply one or more edits to the tree as a single atomic unit.\n\t * @param node - The node that will be passed to `transaction`.\n\t * This is typically the root node of the subtree that will be modified by the transaction.\n\t * @param transaction - The function to run as the body of the transaction.\n\t * This function is passed the provided `node`.\n\t * At any point during the transaction, the function may return the special {@link RunTransaction.rollback | rollback value} (`Tree.runTransaction.rollback`) to abort the transaction and discard any changes it made so far.\n\t * @returns The value returned by the inner `transaction` function.\n\t * @remarks\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 *\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 function throws an error then the transaction will be automatically rolled back (discarding any changes made to the tree so far) before the error is propagated up from this function.\n\t * If the transaction is rolled back (whether by an error or by returning the {@link RunTransaction.rollback} | rollback value), a corresponding change event will also be emitted for the rollback.\n\t */\n\t<TNode extends TreeNode, TResult>(\n\t\tnode: TNode,\n\t\ttransaction: (node: TNode) => TResult | typeof rollback,\n\t): TResult | typeof rollback;\n\t/**\n\t * Apply one or more edits to the tree as a single atomic unit.\n\t * @param tree - The tree which will be edited by the transaction\n\t * @param transaction - The function to run as the body of the transaction.\n\t * This function is passed the root of the tree.\n\t * At any point during the transaction, the function may return the special {@link RunTransaction.rollback | rollback value} (`Tree.runTransaction.rollback`) to abort the transaction and discard any changes it made so far.\n\t * @returns The value returned by the inner `transaction` function.\n\t * @remarks\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 *\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 function throws an error then the transaction will be automatically rolled back (discarding any changes made to the tree so far) before the error is propagated up from this function.\n\t * If the transaction is rolled back (whether by an error or by returning the {@link RunTransaction.rollback} | rollback value), a corresponding change event will also be emitted for the rollback.\n\t */\n\t// See comment on previous overload about use of any here.\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t<TView extends TreeView<any>, TResult>(\n\t\ttree: TView,\n\t\ttransaction: (root: TView[\"root\"]) => TResult | typeof rollback,\n\t): TResult | typeof rollback;\n\t/**\n\t * Apply one or more edits to the tree as a single atomic unit.\n\t * @param node - The node that will be passed to `transaction`.\n\t * This is typically the root node of the subtree that will be modified by the transaction.\n\t * @param transaction - The function to run as the body of the transaction.\n\t * This function is passed the provided `node`.\n\t * @remarks\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 *\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 function throws an error then the transaction will be automatically rolled back (discarding any changes made to the tree so far) before the error is propagated up from this function.\n\t * If the transaction is rolled back, a corresponding change event will also be emitted for the rollback.\n\t */\n\t<TNode extends TreeNode>(node: TNode, transaction: (node: TNode) => void): void;\n\t/**\n\t * Apply one or more edits to the tree as a single atomic unit.\n\t * @param tree - The tree which will be edited by the transaction\n\t * @param transaction - The function to run as the body of the transaction.\n\t * This function is passed the root of the tree.\n\t * @remarks\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 *\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 function throws an error then the transaction will be automatically rolled back (discarding any changes made to the tree so far) before the error is propagated up from this function.\n\t * If the transaction is rolled back, a corresponding change event will also be emitted for the rollback.\n\t */\n\t// See comment on previous overload about use of any here.\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t<TView extends TreeView<any>>(tree: TView, transaction: (root: TView[\"root\"]) => void): void;\n\t/**\n\t * Apply one or more edits to the tree as a single atomic unit.\n\t * @param node - The node that will be passed to `transaction`.\n\t * This is typically the root node of the subtree that will be modified by the transaction.\n\t * @param transaction - The function to run as the body of the transaction.\n\t * This function is passed the provided `node`.\n\t * @param preconditions - 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, it will throw an error.\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 this client and ignored by all other clients.\n\t * @returns The value returned by the inner `transaction` function.\n\t * @remarks\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 *\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 function throws an error then the transaction will be automatically rolled back (discarding any changes made to the tree so far) before the error is propagated up from this function.\n\t * If the transaction is rolled back, a corresponding change event will also be emitted for the rollback.\n\t */\n\t<TNode extends TreeNode, TResult>(\n\t\tnode: TNode,\n\t\ttransaction: (node: TNode) => TResult,\n\t\tpreconditions?: readonly TransactionConstraint[],\n\t): TResult;\n\t/**\n\t * Apply one or more edits to the tree as a single atomic unit.\n\t * @param tree - The tree which will be edited by the transaction\n\t * @param transaction - The function to run as the body of the transaction.\n\t * This function is passed the root of the tree.\n\t * @param preconditions - 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, it will throw an error.\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 this client and ignored by all other clients.\n\t * @returns The value returned by the inner `transaction` function.\n\t * @remarks\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 *\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 function throws an error then the transaction will be automatically rolled back (discarding any changes made to the tree so far) before the error is propagated up from this function.\n\t * If the transaction is rolled back, a corresponding change event will also be emitted for the rollback.\n\t */\n\t// See comment on previous overload about use of any here.\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t<TView extends TreeView<any>, TResult>(\n\t\ttree: TView,\n\t\ttransaction: (root: TView[\"root\"]) => TResult,\n\t\tpreconditions?: readonly TransactionConstraint[],\n\t): TResult;\n\t/**\n\t * Apply one or more edits to the tree as a single atomic unit.\n\t * @param node - The node that will be passed to `transaction`.\n\t * This is typically the root node of the subtree that will be modified by the transaction.\n\t * @param transaction - The function to run as the body of the transaction.\n\t * This function is passed the provided `node`.\n\t * At any point during the transaction, the function may return the special {@link RunTransaction.rollback | rollback value} (`Tree.runTransaction.rollback`) to abort the transaction and discard any changes it made so far.\n\t * @param preconditions - 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, it will throw an error.\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 this client and ignored by all other clients.\n\t * @returns The value returned by the inner `transaction` function.\n\t * @remarks\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 *\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 function throws an error then the transaction will be automatically rolled back (discarding any changes made to the tree so far) before the error is propagated up from this function.\n\t * If the transaction is rolled back (whether by an error or by returning the {@link RunTransaction.rollback} | rollback value), a corresponding change event will also be emitted for the rollback.\n\t */\n\t<TNode extends TreeNode, TResult>(\n\t\tnode: TNode,\n\t\ttransaction: (node: TNode) => TResult | typeof rollback,\n\t\tpreconditions?: readonly TransactionConstraint[],\n\t): TResult | typeof rollback;\n\t/**\n\t * Apply one or more edits to the tree as a single atomic unit.\n\t * @param tree - The tree which will be edited by the transaction\n\t * @param transaction - The function to run as the body of the transaction.\n\t * This function is passed the root of the tree.\n\t * At any point during the transaction, the function may return the special {@link RunTransaction.rollback | rollback value} (`Tree.runTransaction.rollback`) to abort the transaction and discard any changes it made so far.\n\t * @param preconditions - 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, it will throw an error.\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 this client and ignored by all other clients.\n\t * @returns The value returned by the inner `transaction` function.\n\t * @remarks\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 *\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 function throws an error then the transaction will be automatically rolled back (discarding any changes made to the tree so far) before the error is propagated up from this function.\n\t * If the transaction is rolled back (whether by an error or by returning the {@link RunTransaction.rollback} | rollback value), a corresponding change event will also be emitted for the rollback.\n\t */\n\t// See comment on previous overload about use of any here.\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t<TView extends TreeView<any>, TResult>(\n\t\ttree: TView,\n\t\ttransaction: (root: TView[\"root\"]) => TResult | typeof rollback,\n\t\tpreconditions?: readonly TransactionConstraint[],\n\t): TResult | typeof rollback;\n\t/**\n\t * Apply one or more edits to the tree as a single atomic unit.\n\t * @param node - The node that will be passed to `transaction`.\n\t * This is typically the root node of the subtree that will be modified by the transaction.\n\t * @param transaction - The function to run as the body of the transaction.\n\t * This function is passed the provided `node`.\n\t * @param preconditions - 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, it will throw an error.\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 this client and ignored by all other clients.\n\t * @remarks\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 *\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 function throws an error then the transaction will be automatically rolled back (discarding any changes made to the tree so far) before the error is propagated up from this function.\n\t * If the transaction is rolled back, a corresponding change event will also be emitted for the rollback.\n\t */\n\t<TNode extends TreeNode>(\n\t\tnode: TNode,\n\t\ttransaction: (node: TNode) => void,\n\t\tpreconditions?: readonly TransactionConstraint[],\n\t): void;\n\t/**\n\t * Apply one or more edits to the tree as a single atomic unit.\n\t * @param tree - The tree which will be edited by the transaction\n\t * @param transaction - The function to run as the body of the transaction.\n\t * This function is passed the root of the tree.\n\t * @param preconditions - 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, it will throw an error.\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 this client and ignored by all other clients.\n\t * @remarks\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 *\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 function throws an error then the transaction will be automatically rolled back (discarding any changes made to the tree so far) before the error is propagated up from this function.\n\t * If the transaction is rolled back, a corresponding change event will also be emitted for the rollback.\n\t */\n\t// See comment on previous overload about use of any here.\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t<TView extends TreeView<any>>(\n\t\ttree: TView,\n\t\ttransaction: (root: TView[\"root\"]) => void,\n\t\tpreconditions?: readonly TransactionConstraint[],\n\t): void;\n}\n\n// TODO: Add more constraint types here\n\n/** Creates a copy of `runTransaction` with the `rollback` property added so as to satisfy the `RunTransaction` interface. */\nfunction createRunTransaction(): RunTransaction {\n\t/** A type-safe helper to add a \"rollback\" property (as required by the `RunTransaction` interface) to a given object */\n\tfunction defineRollbackProperty<T extends object>(\n\t\ttarget: T,\n\t): T & { rollback: typeof rollback } {\n\t\tReflect.defineProperty(target, \"rollback\", { value: rollback });\n\t\treturn target as T & { readonly rollback: typeof rollback };\n\t}\n\n\treturn defineRollbackProperty(runTransaction.bind({}));\n}\n\n/**\n * Run the given transaction.\n * @remarks\n * This API is not publicly exported but is exported outside of this module so that test code may unit test the `Tree.runTransaction` function directly without being restricted to its public API overloads.\n * @deprecated This API catches exceptions then tries to modify the tree before rethrowing: this is not robust. Use {@link TreeViewAlpha.runTransaction} instead which does not try to edit content in the error case.\n */\nexport function runTransaction<\n\tTNode extends TreeNode,\n\tTRoot extends ImplicitFieldSchema,\n\tTResult,\n>(\n\ttreeOrNode: TNode | TreeView<TRoot>,\n\ttransaction:\n\t\t| ((node: TNode) => TResult | typeof rollback)\n\t\t| ((root: TRoot) => TResult | typeof rollback),\n\tpreconditions: readonly TransactionConstraint[] = [],\n): TResult | typeof rollback {\n\tif (treeOrNode instanceof SchematizingSimpleTreeView) {\n\t\tconst t = transaction as (root: TRoot) => TResult | typeof rollback;\n\t\treturn runTransactionInCheckout(\n\t\t\ttreeOrNode.checkout,\n\t\t\t() => t(treeOrNode.root as TRoot),\n\t\t\tpreconditions,\n\t\t);\n\t} else {\n\t\tconst node = treeOrNode as TNode;\n\t\tconst t = transaction as (node: TNode) => TResult | typeof rollback;\n\t\tconst context = getOrCreateInnerNode(node).context;\n\t\tif (context.isHydrated() === false) {\n\t\t\tthrow new UsageError(\n\t\t\t\t\"Transactions cannot be run on Unhydrated nodes. Transactions apply to a TreeView and Unhydrated nodes are not part of a TreeView.\",\n\t\t\t);\n\t\t}\n\t\tconst treeView = getCheckoutFlexTreeView(context);\n\t\treturn runTransactionInCheckout(treeView.checkout, () => t(node), preconditions);\n\t}\n}\n\n/**\n * Run the given transaction.\n * @deprecated This API catches exceptions then tries to modify the tree before rethrowing: this is not robust. Use {@link TreeViewAlpha.runTransaction} instead which does not try to editing content in the error case.\n */\nfunction runTransactionInCheckout<TResult>(\n\tcheckout: ITreeCheckout,\n\ttransaction: () => TResult | typeof rollback,\n\tpreconditions: readonly TransactionConstraint[],\n): TResult | typeof rollback {\n\tcheckout.transaction.start();\n\tfor (const constraint of preconditions) {\n\t\tswitch (constraint.type) {\n\t\t\tcase \"nodeInDocument\": {\n\t\t\t\tconst node = getOrCreateInnerNode(constraint.node);\n\t\t\t\tconst nodeStatus = Tree.status(constraint.node);\n\t\t\t\tif (nodeStatus !== TreeStatus.InDocument) {\n\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t`Attempted to add a \"nodeInDocument\" constraint, but the node is not currently in the document. Node status: ${nodeStatus}`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tcheckout.editor.addNodeExistsConstraint(node.anchorNode);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tunreachableCase(constraint.type);\n\t\t}\n\t}\n\n\tlet result: ReturnType<typeof transaction>;\n\ttry {\n\t\tresult = transaction();\n\t} catch (error) {\n\t\t// If the transaction has an unhandled error, abort and rollback the transaction but continue to propagate the error.\n\t\t// This might try and modify the tree or trigger events while things are in an inconsistent state.\n\t\t// It is up to the user of runTransaction to ensure that does not cause problems (and they have no robust way to do that, which is why its deprecated).\n\t\tcheckout.transaction.abort();\n\t\tthrow error;\n\t}\n\n\tif (result === rollback) {\n\t\tcheckout.transaction.abort();\n\t} else {\n\t\tcheckout.transaction.commit();\n\t}\n\n\treturn result;\n}\n"]}
@@ -5,8 +5,78 @@
5
5
  import type { IFluidHandle } from "@fluidframework/core-interfaces";
6
6
  import type { IIdCompressor } from "@fluidframework/id-compressor";
7
7
  import { type TreeNode, type Unhydrated, type ImplicitFieldSchema, type InsertableField, type TreeFieldFromImplicitField, type TreeLeafValue, type UnsafeUnknownSchema, type ConciseTree, type TreeEncodingOptions, type VerboseTree, type TreeBranch } from "../simple-tree/index.js";
8
- import type { JsonCompatible } from "../util/index.js";
8
+ import { type JsonCompatible } from "../util/index.js";
9
9
  import { type FluidClientVersion, type ICodecOptions } from "../codec/index.js";
10
+ /**
11
+ * A utility interface for retrieving or converting node identifiers.
12
+ *
13
+ * @remarks
14
+ * This provides methods to:
15
+ *
16
+ * - Retrieve long or short identifiers from nodes
17
+ *
18
+ * - Convert between long identifiers and short identifiers
19
+ *
20
+ * - Generates long identifiers
21
+ *
22
+ * @alpha @sealed
23
+ */
24
+ export interface TreeIdentifierUtils {
25
+ /**
26
+ * Returns the contents of a node's {@link SchemaFactory.identifier} field as a stable identifier.
27
+ * If the identifier field does not exist, returns undefined.
28
+ *
29
+ * @param node - The TreeNode you want to get the identifier from,
30
+ */
31
+ (node: TreeNode): string | undefined;
32
+ /**
33
+ * Returns the shortened identifier as a number given long identifier known by the id compressor on the branch if possible.
34
+ * Otherwise, it will return the original string identifier provided.
35
+ * If the id does not exist, or is unknown by the id compressor, it returns undefined.
36
+ *
37
+ * This method is the inverse of {@link TreeIdentifierUtils.lengthen}. If you shorten an identifier
38
+ * and then immediately pass it to {@link TreeIdentifierUtils.lengthen}, you will get the original string back.
39
+ *
40
+ * @param branch - TreeBranch from where you get the idCompressor to do the decompression.
41
+ * @param nodeIdentifier - the stable identifier that needs to be shortened.
42
+ */
43
+ shorten(branch: TreeBranch, nodeIdentifier: string): number | undefined;
44
+ /**
45
+ * Returns the stable id as a string if the identifier is decompressible and known by the id compressor. Otherwise, it will throw an error.
46
+ *
47
+ * This method is the inverse of {@link TreeIdentifierUtils.shorten}. If you lengthen an identifier
48
+ * and then immediately pass it to {@link TreeIdentifierUtils.shorten}, you will get the original short identifier back.
49
+ *
50
+ * @param branch - TreeBranch from where you want to get the id compressor to do the decompression.
51
+ * @param nodeIdentifier - The local identifier that needs to be expanded.
52
+ */
53
+ lengthen(branch: TreeBranch, nodeIdentifier: number): string;
54
+ /**
55
+ * Returns the {@link SchemaFactory.identifier | identifier} of the given node in the most compressed form possible.
56
+ * @remarks
57
+ * If the node is {@link Unhydrated | hydrated} and its identifier is a valid UUID that was automatically generated by the SharedTree it is part of (or something else using the same {@link @fluidframework/id-compressor#IIdCompressor}), then this will return a process-unique integer corresponding to that identifier.
58
+ * This is useful for performance-sensitive scenarios involving many nodes with identifiers that need to be compactly retained in memory or used for efficient lookup.
59
+ * Note that automatically generated identifiers that were accessed before the node was hydrated will return the generated UUID, not the process-unique integer.
60
+ *
61
+ * If the node's identifier is any other user-provided string, then this will return undefined.
62
+ *
63
+ * If the node has no identifier (that is, it has no {@link SchemaFactory.identifier | identifier} field), then this returns `undefined`.
64
+ *
65
+ * If the node has more than one identifier, then this will throw an error.
66
+ *
67
+ * The returned integer should not be serialized or preserved outside of the current process.
68
+ * Its lifetime is that of the current in-memory instance of the FF container for this client, and it is not guaranteed to be unique or stable outside of that context.
69
+ * The same node's identifier may, for example, be different across multiple sessions for the same client and document, or different across two clients in the same session.
70
+ */
71
+ getShort(node: TreeNode): number | undefined;
72
+ /**
73
+ * Creates and returns a long identifier.
74
+ * The long identifier is a compressible, stable identifier generated by the tree's ID compressor.
75
+ *
76
+ * @param branch - TreeBranch from where you want to get the id compressor to generate the identifier from.
77
+ */
78
+ create(branch: TreeBranch): string;
79
+ }
10
80
  /**
11
81
  * Extensions to {@link (Tree:interface)} and {@link (TreeBeta:interface)} which are not yet stable.
12
82
  * @remarks
@@ -95,7 +165,7 @@ export interface TreeAlpha {
95
165
  * Additionally using `createIdCompressor` to make an idCompressor is `@legacy` and thus not intended for use in this API surface.
96
166
  * It would probably make more sense if we provided a way to get an idCompressor from the context of a node,
97
167
  * which could be optional (and settable if missing) for un0hydrated nodes and required for hydrated ones.
98
- * Add in a stable public APi for creating idCompressors, and a way to get them from a tree (without view schema), and that should address the anticipated use-cases.
168
+ * Add in a stable public API for creating idCompressors, and a way to get them from a tree (without view schema), and that should address the anticipated use-cases.
99
169
  */
100
170
  exportCompressed(tree: TreeNode | TreeLeafValue, options: {
101
171
  oldestCompatibleClient: FluidClientVersion;
@@ -123,6 +193,18 @@ export interface TreeAlpha {
123
193
  importCompressed<const TSchema extends ImplicitFieldSchema>(schema: TSchema, compressedData: JsonCompatible<IFluidHandle>, options: {
124
194
  idCompressor?: IIdCompressor;
125
195
  } & ICodecOptions): Unhydrated<TreeFieldFromImplicitField<TSchema>>;
196
+ /**
197
+ * APIs for creating, converting, and retrieving identifiers.
198
+ */
199
+ readonly identifier: TreeIdentifierUtils;
200
+ /**
201
+ * The key of the given node under its parent.
202
+ * @remarks
203
+ * If `node` is an element in a {@link (TreeArrayNode:interface)}, this returns the index of `node` in the array node (a `number`).
204
+ * If `node` is the root node, this returns undefined.
205
+ * Otherwise, this returns the key of the field that it is under (a `string`).
206
+ */
207
+ key2(node: TreeNode): string | number | undefined;
126
208
  }
127
209
  /**
128
210
  * Extensions to {@link (Tree:variable)} and {@link (TreeBeta:variable)} which are not yet stable.