@fluidframework/tree 2.113.1 → 2.115.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 (660) hide show
  1. package/CHANGELOG.md +289 -0
  2. package/api-report/tree.alpha.api.md +127 -39
  3. package/dist/core/change-family/changeFamily.d.ts +15 -4
  4. package/dist/core/change-family/changeFamily.d.ts.map +1 -1
  5. package/dist/core/change-family/changeFamily.js.map +1 -1
  6. package/dist/core/change-family/editBuilder.d.ts +2 -3
  7. package/dist/core/change-family/editBuilder.d.ts.map +1 -1
  8. package/dist/core/change-family/editBuilder.js +1 -2
  9. package/dist/core/change-family/editBuilder.js.map +1 -1
  10. package/dist/core/change-family/index.d.ts +1 -1
  11. package/dist/core/change-family/index.d.ts.map +1 -1
  12. package/dist/core/change-family/index.js.map +1 -1
  13. package/dist/core/index.d.ts +4 -3
  14. package/dist/core/index.d.ts.map +1 -1
  15. package/dist/core/index.js +3 -2
  16. package/dist/core/index.js.map +1 -1
  17. package/dist/core/rebase/index.d.ts +1 -1
  18. package/dist/core/rebase/index.d.ts.map +1 -1
  19. package/dist/core/rebase/index.js +2 -1
  20. package/dist/core/rebase/index.js.map +1 -1
  21. package/dist/core/rebase/types.d.ts +110 -0
  22. package/dist/core/rebase/types.d.ts.map +1 -1
  23. package/dist/core/rebase/types.js +47 -1
  24. package/dist/core/rebase/types.js.map +1 -1
  25. package/dist/core/tree/delta.d.ts +62 -16
  26. package/dist/core/tree/delta.d.ts.map +1 -1
  27. package/dist/core/tree/delta.js.map +1 -1
  28. package/dist/core/tree/detachedFieldIndex.d.ts +7 -13
  29. package/dist/core/tree/detachedFieldIndex.d.ts.map +1 -1
  30. package/dist/core/tree/detachedFieldIndex.js +32 -46
  31. package/dist/core/tree/detachedFieldIndex.js.map +1 -1
  32. package/dist/core/tree/index.d.ts +1 -0
  33. package/dist/core/tree/index.d.ts.map +1 -1
  34. package/dist/core/tree/index.js.map +1 -1
  35. package/dist/core/tree/visitorUtils.d.ts +2 -4
  36. package/dist/core/tree/visitorUtils.d.ts.map +1 -1
  37. package/dist/core/tree/visitorUtils.js +2 -2
  38. package/dist/core/tree/visitorUtils.js.map +1 -1
  39. package/dist/entrypoints/alpha.d.ts +1 -1
  40. package/dist/entrypoints/alpha.d.ts.map +1 -1
  41. package/dist/entrypoints/alpha.js +8 -3
  42. package/dist/entrypoints/alpha.js.map +1 -1
  43. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts +9 -6
  44. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  45. package/dist/feature-libraries/chunked-forest/codec/codecs.js +16 -13
  46. package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  47. package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
  48. package/dist/feature-libraries/chunked-forest/uniformChunk.js +10 -2
  49. package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  50. package/dist/feature-libraries/comparison-forest/comparisonForest.d.ts +51 -0
  51. package/dist/feature-libraries/comparison-forest/comparisonForest.d.ts.map +1 -0
  52. package/dist/feature-libraries/comparison-forest/comparisonForest.js +98 -0
  53. package/dist/feature-libraries/comparison-forest/comparisonForest.js.map +1 -0
  54. package/dist/feature-libraries/comparison-forest/index.d.ts +6 -0
  55. package/dist/feature-libraries/comparison-forest/index.d.ts.map +1 -0
  56. package/dist/feature-libraries/comparison-forest/index.js +10 -0
  57. package/dist/feature-libraries/comparison-forest/index.js.map +1 -0
  58. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts +8 -6
  59. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  60. package/dist/feature-libraries/default-schema/defaultEditBuilder.js +6 -3
  61. package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  62. package/dist/feature-libraries/default-schema/index.d.ts +1 -1
  63. package/dist/feature-libraries/default-schema/index.d.ts.map +1 -1
  64. package/dist/feature-libraries/default-schema/index.js.map +1 -1
  65. package/dist/feature-libraries/default-schema/noChangeCodecs.d.ts +2 -2
  66. package/dist/feature-libraries/default-schema/noChangeCodecs.d.ts.map +1 -1
  67. package/dist/feature-libraries/default-schema/noChangeCodecs.js +3 -1
  68. package/dist/feature-libraries/default-schema/noChangeCodecs.js.map +1 -1
  69. package/dist/feature-libraries/detachedFieldIndexSummarizer.d.ts +6 -3
  70. package/dist/feature-libraries/detachedFieldIndexSummarizer.d.ts.map +1 -1
  71. package/dist/feature-libraries/detachedFieldIndexSummarizer.js +18 -6
  72. package/dist/feature-libraries/detachedFieldIndexSummarizer.js.map +1 -1
  73. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts +2 -3
  74. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  75. package/dist/feature-libraries/forest-summary/forestSummarizer.js +2 -3
  76. package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  77. package/dist/feature-libraries/index.d.ts +4 -3
  78. package/dist/feature-libraries/index.d.ts.map +1 -1
  79. package/dist/feature-libraries/index.js +77 -72
  80. package/dist/feature-libraries/index.js.map +1 -1
  81. package/dist/feature-libraries/mitigatedChangeFamily.d.ts +1 -1
  82. package/dist/feature-libraries/mitigatedChangeFamily.d.ts.map +1 -1
  83. package/dist/feature-libraries/mitigatedChangeFamily.js +12 -0
  84. package/dist/feature-libraries/mitigatedChangeFamily.js.map +1 -1
  85. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts +9 -1
  86. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  87. package/dist/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  88. package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.d.ts +2 -2
  89. package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.d.ts.map +1 -1
  90. package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.js.map +1 -1
  91. package/dist/feature-libraries/modular-schema/index.d.ts +1 -1
  92. package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
  93. package/dist/feature-libraries/modular-schema/index.js.map +1 -1
  94. package/dist/feature-libraries/modular-schema/invert.d.ts +15 -0
  95. package/dist/feature-libraries/modular-schema/invert.d.ts.map +1 -0
  96. package/dist/feature-libraries/modular-schema/invert.js +159 -0
  97. package/dist/feature-libraries/modular-schema/invert.js.map +1 -0
  98. package/dist/feature-libraries/modular-schema/minimizeModularChange.d.ts +3 -4
  99. package/dist/feature-libraries/modular-schema/minimizeModularChange.d.ts.map +1 -1
  100. package/dist/feature-libraries/modular-schema/minimizeModularChange.js +2 -2
  101. package/dist/feature-libraries/modular-schema/minimizeModularChange.js.map +1 -1
  102. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts +9 -9
  103. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -1
  104. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js +0 -2
  105. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
  106. package/dist/feature-libraries/modular-schema/modularChangeCodecV2.d.ts +2 -2
  107. package/dist/feature-libraries/modular-schema/modularChangeCodecV2.d.ts.map +1 -1
  108. package/dist/feature-libraries/modular-schema/modularChangeCodecV2.js.map +1 -1
  109. package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts +2 -2
  110. package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  111. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  112. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +8 -22
  113. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  114. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +53 -406
  115. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  116. package/dist/feature-libraries/modular-schema/modularChangeUtils.d.ts +61 -0
  117. package/dist/feature-libraries/modular-schema/modularChangeUtils.d.ts.map +1 -0
  118. package/dist/feature-libraries/modular-schema/modularChangeUtils.js +205 -0
  119. package/dist/feature-libraries/modular-schema/modularChangeUtils.js.map +1 -0
  120. package/dist/feature-libraries/modular-schema/prune.d.ts +10 -0
  121. package/dist/feature-libraries/modular-schema/prune.d.ts.map +1 -0
  122. package/dist/feature-libraries/modular-schema/prune.js +49 -0
  123. package/dist/feature-libraries/modular-schema/prune.js.map +1 -0
  124. package/dist/feature-libraries/optional-field/optionalFieldCodecV2.d.ts +2 -2
  125. package/dist/feature-libraries/optional-field/optionalFieldCodecV2.d.ts.map +1 -1
  126. package/dist/feature-libraries/optional-field/optionalFieldCodecV2.js.map +1 -1
  127. package/dist/feature-libraries/optional-field/optionalFieldCodecs.d.ts +2 -2
  128. package/dist/feature-libraries/optional-field/optionalFieldCodecs.d.ts.map +1 -1
  129. package/dist/feature-libraries/optional-field/optionalFieldCodecs.js.map +1 -1
  130. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts +2 -2
  131. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
  132. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
  133. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts +2 -2
  134. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts.map +1 -1
  135. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -1
  136. package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts +2 -2
  137. package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts.map +1 -1
  138. package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.js.map +1 -1
  139. package/dist/feature-libraries/treeTextCursor.d.ts +15 -0
  140. package/dist/feature-libraries/treeTextCursor.d.ts.map +1 -1
  141. package/dist/feature-libraries/treeTextCursor.js +64 -1
  142. package/dist/feature-libraries/treeTextCursor.js.map +1 -1
  143. package/dist/index.d.ts +6 -4
  144. package/dist/index.d.ts.map +1 -1
  145. package/dist/index.js +10 -5
  146. package/dist/index.js.map +1 -1
  147. package/dist/packageVersion.d.ts +1 -1
  148. package/dist/packageVersion.js +1 -1
  149. package/dist/packageVersion.js.map +1 -1
  150. package/dist/shared-tree/serializedChange.d.ts +2 -2
  151. package/dist/shared-tree/serializedChange.d.ts.map +1 -1
  152. package/dist/shared-tree/serializedChange.js.map +1 -1
  153. package/dist/shared-tree/sharedTree.d.ts +11 -3
  154. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  155. package/dist/shared-tree/sharedTree.js +9 -7
  156. package/dist/shared-tree/sharedTree.js.map +1 -1
  157. package/dist/shared-tree/sharedTreeChangeCodecs.d.ts +2 -2
  158. package/dist/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  159. package/dist/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  160. package/dist/shared-tree/sharedTreeChangeFamily.d.ts +41 -4
  161. package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  162. package/dist/shared-tree/sharedTreeChangeFamily.js +57 -1
  163. package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  164. package/dist/shared-tree/transactionMinimize.d.ts.map +1 -1
  165. package/dist/shared-tree/transactionMinimize.js +2 -2
  166. package/dist/shared-tree/transactionMinimize.js.map +1 -1
  167. package/dist/shared-tree/transactionPostProcessor.d.ts +2 -1
  168. package/dist/shared-tree/transactionPostProcessor.d.ts.map +1 -1
  169. package/dist/shared-tree/transactionPostProcessor.js.map +1 -1
  170. package/dist/shared-tree/treeCheckout.d.ts +13 -7
  171. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  172. package/dist/shared-tree/treeCheckout.js +59 -13
  173. package/dist/shared-tree/treeCheckout.js.map +1 -1
  174. package/dist/shared-tree-core/branch.d.ts +24 -9
  175. package/dist/shared-tree-core/branch.d.ts.map +1 -1
  176. package/dist/shared-tree-core/branch.js +7 -0
  177. package/dist/shared-tree-core/branch.js.map +1 -1
  178. package/dist/shared-tree-core/editManager.d.ts +4 -4
  179. package/dist/shared-tree-core/editManager.d.ts.map +1 -1
  180. package/dist/shared-tree-core/editManager.js +2 -0
  181. package/dist/shared-tree-core/editManager.js.map +1 -1
  182. package/dist/shared-tree-core/editManagerCodecs.d.ts +3 -14
  183. package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  184. package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
  185. package/dist/shared-tree-core/editManagerCodecsCommons.d.ts +11 -1
  186. package/dist/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
  187. package/dist/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
  188. package/dist/shared-tree-core/editManagerCodecsV1toV4.d.ts +4 -11
  189. package/dist/shared-tree-core/editManagerCodecsV1toV4.d.ts.map +1 -1
  190. package/dist/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -1
  191. package/dist/shared-tree-core/editManagerCodecsVSharedBranches.d.ts +4 -11
  192. package/dist/shared-tree-core/editManagerCodecsVSharedBranches.d.ts.map +1 -1
  193. package/dist/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
  194. package/dist/shared-tree-core/editManagerSummarizer.d.ts +4 -4
  195. package/dist/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
  196. package/dist/shared-tree-core/editManagerSummarizer.js +0 -1
  197. package/dist/shared-tree-core/editManagerSummarizer.js.map +1 -1
  198. package/dist/shared-tree-core/messageCodecV1ToV4.d.ts +2 -2
  199. package/dist/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
  200. package/dist/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
  201. package/dist/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -1
  202. package/dist/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
  203. package/dist/shared-tree-core/messageCodecs.d.ts +8 -1
  204. package/dist/shared-tree-core/messageCodecs.d.ts.map +1 -1
  205. package/dist/shared-tree-core/messageCodecs.js.map +1 -1
  206. package/dist/shared-tree-core/sharedTreeCore.d.ts +5 -5
  207. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  208. package/dist/shared-tree-core/sharedTreeCore.js +1 -1
  209. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  210. package/dist/shared-tree-core/transaction.d.ts +10 -10
  211. package/dist/shared-tree-core/transaction.d.ts.map +1 -1
  212. package/dist/shared-tree-core/transaction.js +6 -3
  213. package/dist/shared-tree-core/transaction.js.map +1 -1
  214. package/dist/simple-tree/api/eraseSchemaDetails.d.ts +15 -0
  215. package/dist/simple-tree/api/eraseSchemaDetails.d.ts.map +1 -1
  216. package/dist/simple-tree/api/eraseSchemaDetails.js +15 -0
  217. package/dist/simple-tree/api/eraseSchemaDetails.js.map +1 -1
  218. package/dist/simple-tree/api/index.d.ts +1 -1
  219. package/dist/simple-tree/api/index.d.ts.map +1 -1
  220. package/dist/simple-tree/api/index.js +2 -3
  221. package/dist/simple-tree/api/index.js.map +1 -1
  222. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +3 -3
  223. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  224. package/dist/simple-tree/api/schemaStatics.d.ts +6 -7
  225. package/dist/simple-tree/api/schemaStatics.d.ts.map +1 -1
  226. package/dist/simple-tree/api/schemaStatics.js.map +1 -1
  227. package/dist/simple-tree/api/treeNodeApi.d.ts +20 -24
  228. package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  229. package/dist/simple-tree/api/treeNodeApi.js +48 -49
  230. package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
  231. package/dist/simple-tree/core/treeNode.d.ts +5 -6
  232. package/dist/simple-tree/core/treeNode.d.ts.map +1 -1
  233. package/dist/simple-tree/core/treeNode.js +2 -4
  234. package/dist/simple-tree/core/treeNode.js.map +1 -1
  235. package/dist/simple-tree/core/withType.d.ts +20 -7
  236. package/dist/simple-tree/core/withType.d.ts.map +1 -1
  237. package/dist/simple-tree/core/withType.js +4 -7
  238. package/dist/simple-tree/core/withType.js.map +1 -1
  239. package/dist/simple-tree/index.d.ts +2 -2
  240. package/dist/simple-tree/index.d.ts.map +1 -1
  241. package/dist/simple-tree/index.js +3 -4
  242. package/dist/simple-tree/index.js.map +1 -1
  243. package/dist/simple-tree/leafNodeSchema.d.ts +6 -1
  244. package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
  245. package/dist/simple-tree/leafNodeSchema.js +0 -1
  246. package/dist/simple-tree/leafNodeSchema.js.map +1 -1
  247. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts +53 -5
  248. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  249. package/dist/simple-tree/node-kinds/array/arrayNode.js +91 -10
  250. package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  251. package/dist/simple-tree/node-kinds/map/mapNode.d.ts +90 -0
  252. package/dist/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
  253. package/dist/simple-tree/node-kinds/map/mapNode.js +26 -1
  254. package/dist/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  255. package/dist/simple-tree/node-kinds/object/objectNode.js +2 -2
  256. package/dist/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  257. package/dist/simple-tree/node-kinds/record/recordNode.js +2 -2
  258. package/dist/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  259. package/dist/text/codePointUtils.d.ts +2 -2
  260. package/dist/text/codePointUtils.js +2 -2
  261. package/dist/text/codePointUtils.js.map +1 -1
  262. package/dist/text/index.d.ts +3 -3
  263. package/dist/text/index.d.ts.map +1 -1
  264. package/dist/text/index.js +4 -4
  265. package/dist/text/index.js.map +1 -1
  266. package/dist/text/textDomain.d.ts +30 -18
  267. package/dist/text/textDomain.d.ts.map +1 -1
  268. package/dist/text/textDomain.js +44 -23
  269. package/dist/text/textDomain.js.map +1 -1
  270. package/dist/text/textDomainFormatted.d.ts +180 -82
  271. package/dist/text/textDomainFormatted.d.ts.map +1 -1
  272. package/dist/text/textDomainFormatted.js +164 -84
  273. package/dist/text/textDomainFormatted.js.map +1 -1
  274. package/dist/text/textDomainFormattedDefault.d.ts +48 -25
  275. package/dist/text/textDomainFormattedDefault.d.ts.map +1 -1
  276. package/dist/text/textDomainFormattedDefault.js +24 -19
  277. package/dist/text/textDomainFormattedDefault.js.map +1 -1
  278. package/dist/treeDataStore.d.ts +49 -0
  279. package/dist/treeDataStore.d.ts.map +1 -0
  280. package/dist/treeDataStore.js +57 -0
  281. package/dist/treeDataStore.js.map +1 -0
  282. package/dist/treeFactory.d.ts +8 -3
  283. package/dist/treeFactory.d.ts.map +1 -1
  284. package/dist/treeFactory.js +6 -1
  285. package/dist/treeFactory.js.map +1 -1
  286. package/dist/util/compressedIds.d.ts +22 -2
  287. package/dist/util/compressedIds.d.ts.map +1 -1
  288. package/dist/util/compressedIds.js +22 -1
  289. package/dist/util/compressedIds.js.map +1 -1
  290. package/lib/core/change-family/changeFamily.d.ts +15 -4
  291. package/lib/core/change-family/changeFamily.d.ts.map +1 -1
  292. package/lib/core/change-family/changeFamily.js.map +1 -1
  293. package/lib/core/change-family/editBuilder.d.ts +2 -3
  294. package/lib/core/change-family/editBuilder.d.ts.map +1 -1
  295. package/lib/core/change-family/editBuilder.js +1 -2
  296. package/lib/core/change-family/editBuilder.js.map +1 -1
  297. package/lib/core/change-family/index.d.ts +1 -1
  298. package/lib/core/change-family/index.d.ts.map +1 -1
  299. package/lib/core/change-family/index.js.map +1 -1
  300. package/lib/core/index.d.ts +4 -3
  301. package/lib/core/index.d.ts.map +1 -1
  302. package/lib/core/index.js +2 -2
  303. package/lib/core/index.js.map +1 -1
  304. package/lib/core/rebase/index.d.ts +1 -1
  305. package/lib/core/rebase/index.d.ts.map +1 -1
  306. package/lib/core/rebase/index.js +1 -1
  307. package/lib/core/rebase/index.js.map +1 -1
  308. package/lib/core/rebase/types.d.ts +110 -0
  309. package/lib/core/rebase/types.d.ts.map +1 -1
  310. package/lib/core/rebase/types.js +46 -0
  311. package/lib/core/rebase/types.js.map +1 -1
  312. package/lib/core/tree/delta.d.ts +62 -16
  313. package/lib/core/tree/delta.d.ts.map +1 -1
  314. package/lib/core/tree/delta.js.map +1 -1
  315. package/lib/core/tree/detachedFieldIndex.d.ts +7 -13
  316. package/lib/core/tree/detachedFieldIndex.d.ts.map +1 -1
  317. package/lib/core/tree/detachedFieldIndex.js +7 -21
  318. package/lib/core/tree/detachedFieldIndex.js.map +1 -1
  319. package/lib/core/tree/index.d.ts +1 -0
  320. package/lib/core/tree/index.d.ts.map +1 -1
  321. package/lib/core/tree/index.js.map +1 -1
  322. package/lib/core/tree/visitorUtils.d.ts +2 -4
  323. package/lib/core/tree/visitorUtils.d.ts.map +1 -1
  324. package/lib/core/tree/visitorUtils.js +2 -2
  325. package/lib/core/tree/visitorUtils.js.map +1 -1
  326. package/lib/entrypoints/alpha.d.ts +1 -1
  327. package/lib/entrypoints/alpha.d.ts.map +1 -1
  328. package/lib/entrypoints/alpha.js +1 -1
  329. package/lib/entrypoints/alpha.js.map +1 -1
  330. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts +9 -6
  331. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  332. package/lib/feature-libraries/chunked-forest/codec/codecs.js +16 -13
  333. package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  334. package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
  335. package/lib/feature-libraries/chunked-forest/uniformChunk.js +10 -2
  336. package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  337. package/lib/feature-libraries/comparison-forest/comparisonForest.d.ts +51 -0
  338. package/lib/feature-libraries/comparison-forest/comparisonForest.d.ts.map +1 -0
  339. package/lib/feature-libraries/comparison-forest/comparisonForest.js +94 -0
  340. package/lib/feature-libraries/comparison-forest/comparisonForest.js.map +1 -0
  341. package/lib/feature-libraries/comparison-forest/index.d.ts +6 -0
  342. package/lib/feature-libraries/comparison-forest/index.d.ts.map +1 -0
  343. package/lib/feature-libraries/comparison-forest/index.js +6 -0
  344. package/lib/feature-libraries/comparison-forest/index.js.map +1 -0
  345. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts +8 -6
  346. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  347. package/lib/feature-libraries/default-schema/defaultEditBuilder.js +6 -3
  348. package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  349. package/lib/feature-libraries/default-schema/index.d.ts +1 -1
  350. package/lib/feature-libraries/default-schema/index.d.ts.map +1 -1
  351. package/lib/feature-libraries/default-schema/index.js.map +1 -1
  352. package/lib/feature-libraries/default-schema/noChangeCodecs.d.ts +2 -2
  353. package/lib/feature-libraries/default-schema/noChangeCodecs.d.ts.map +1 -1
  354. package/lib/feature-libraries/default-schema/noChangeCodecs.js +3 -1
  355. package/lib/feature-libraries/default-schema/noChangeCodecs.js.map +1 -1
  356. package/lib/feature-libraries/detachedFieldIndexSummarizer.d.ts +6 -3
  357. package/lib/feature-libraries/detachedFieldIndexSummarizer.d.ts.map +1 -1
  358. package/lib/feature-libraries/detachedFieldIndexSummarizer.js +16 -4
  359. package/lib/feature-libraries/detachedFieldIndexSummarizer.js.map +1 -1
  360. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts +2 -3
  361. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  362. package/lib/feature-libraries/forest-summary/forestSummarizer.js +2 -3
  363. package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  364. package/lib/feature-libraries/index.d.ts +4 -3
  365. package/lib/feature-libraries/index.d.ts.map +1 -1
  366. package/lib/feature-libraries/index.js +2 -1
  367. package/lib/feature-libraries/index.js.map +1 -1
  368. package/lib/feature-libraries/mitigatedChangeFamily.d.ts +1 -1
  369. package/lib/feature-libraries/mitigatedChangeFamily.d.ts.map +1 -1
  370. package/lib/feature-libraries/mitigatedChangeFamily.js +12 -0
  371. package/lib/feature-libraries/mitigatedChangeFamily.js.map +1 -1
  372. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts +9 -1
  373. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  374. package/lib/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  375. package/lib/feature-libraries/modular-schema/genericFieldKindCodecs.d.ts +2 -2
  376. package/lib/feature-libraries/modular-schema/genericFieldKindCodecs.d.ts.map +1 -1
  377. package/lib/feature-libraries/modular-schema/genericFieldKindCodecs.js.map +1 -1
  378. package/lib/feature-libraries/modular-schema/index.d.ts +1 -1
  379. package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
  380. package/lib/feature-libraries/modular-schema/index.js.map +1 -1
  381. package/lib/feature-libraries/modular-schema/invert.d.ts +15 -0
  382. package/lib/feature-libraries/modular-schema/invert.d.ts.map +1 -0
  383. package/lib/feature-libraries/modular-schema/invert.js +155 -0
  384. package/lib/feature-libraries/modular-schema/invert.js.map +1 -0
  385. package/lib/feature-libraries/modular-schema/minimizeModularChange.d.ts +3 -4
  386. package/lib/feature-libraries/modular-schema/minimizeModularChange.d.ts.map +1 -1
  387. package/lib/feature-libraries/modular-schema/minimizeModularChange.js +2 -2
  388. package/lib/feature-libraries/modular-schema/minimizeModularChange.js.map +1 -1
  389. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts +9 -9
  390. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -1
  391. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js +0 -2
  392. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
  393. package/lib/feature-libraries/modular-schema/modularChangeCodecV2.d.ts +2 -2
  394. package/lib/feature-libraries/modular-schema/modularChangeCodecV2.d.ts.map +1 -1
  395. package/lib/feature-libraries/modular-schema/modularChangeCodecV2.js.map +1 -1
  396. package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts +2 -2
  397. package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  398. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  399. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +8 -22
  400. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  401. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +16 -367
  402. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  403. package/lib/feature-libraries/modular-schema/modularChangeUtils.d.ts +61 -0
  404. package/lib/feature-libraries/modular-schema/modularChangeUtils.d.ts.map +1 -0
  405. package/lib/feature-libraries/modular-schema/modularChangeUtils.js +192 -0
  406. package/lib/feature-libraries/modular-schema/modularChangeUtils.js.map +1 -0
  407. package/lib/feature-libraries/modular-schema/prune.d.ts +10 -0
  408. package/lib/feature-libraries/modular-schema/prune.d.ts.map +1 -0
  409. package/lib/feature-libraries/modular-schema/prune.js +45 -0
  410. package/lib/feature-libraries/modular-schema/prune.js.map +1 -0
  411. package/lib/feature-libraries/optional-field/optionalFieldCodecV2.d.ts +2 -2
  412. package/lib/feature-libraries/optional-field/optionalFieldCodecV2.d.ts.map +1 -1
  413. package/lib/feature-libraries/optional-field/optionalFieldCodecV2.js.map +1 -1
  414. package/lib/feature-libraries/optional-field/optionalFieldCodecs.d.ts +2 -2
  415. package/lib/feature-libraries/optional-field/optionalFieldCodecs.d.ts.map +1 -1
  416. package/lib/feature-libraries/optional-field/optionalFieldCodecs.js.map +1 -1
  417. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts +2 -2
  418. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
  419. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
  420. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts +2 -2
  421. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts.map +1 -1
  422. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -1
  423. package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts +2 -2
  424. package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts.map +1 -1
  425. package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.js.map +1 -1
  426. package/lib/feature-libraries/treeTextCursor.d.ts +15 -0
  427. package/lib/feature-libraries/treeTextCursor.d.ts.map +1 -1
  428. package/lib/feature-libraries/treeTextCursor.js +62 -1
  429. package/lib/feature-libraries/treeTextCursor.js.map +1 -1
  430. package/lib/index.d.ts +6 -4
  431. package/lib/index.d.ts.map +1 -1
  432. package/lib/index.js +4 -3
  433. package/lib/index.js.map +1 -1
  434. package/lib/packageVersion.d.ts +1 -1
  435. package/lib/packageVersion.js +1 -1
  436. package/lib/packageVersion.js.map +1 -1
  437. package/lib/shared-tree/serializedChange.d.ts +2 -2
  438. package/lib/shared-tree/serializedChange.d.ts.map +1 -1
  439. package/lib/shared-tree/serializedChange.js.map +1 -1
  440. package/lib/shared-tree/sharedTree.d.ts +11 -3
  441. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  442. package/lib/shared-tree/sharedTree.js +10 -8
  443. package/lib/shared-tree/sharedTree.js.map +1 -1
  444. package/lib/shared-tree/sharedTreeChangeCodecs.d.ts +2 -2
  445. package/lib/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  446. package/lib/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  447. package/lib/shared-tree/sharedTreeChangeFamily.d.ts +41 -4
  448. package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  449. package/lib/shared-tree/sharedTreeChangeFamily.js +55 -0
  450. package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  451. package/lib/shared-tree/transactionMinimize.d.ts.map +1 -1
  452. package/lib/shared-tree/transactionMinimize.js +3 -3
  453. package/lib/shared-tree/transactionMinimize.js.map +1 -1
  454. package/lib/shared-tree/transactionPostProcessor.d.ts +2 -1
  455. package/lib/shared-tree/transactionPostProcessor.d.ts.map +1 -1
  456. package/lib/shared-tree/transactionPostProcessor.js.map +1 -1
  457. package/lib/shared-tree/treeCheckout.d.ts +13 -7
  458. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  459. package/lib/shared-tree/treeCheckout.js +61 -15
  460. package/lib/shared-tree/treeCheckout.js.map +1 -1
  461. package/lib/shared-tree-core/branch.d.ts +24 -9
  462. package/lib/shared-tree-core/branch.d.ts.map +1 -1
  463. package/lib/shared-tree-core/branch.js +7 -0
  464. package/lib/shared-tree-core/branch.js.map +1 -1
  465. package/lib/shared-tree-core/editManager.d.ts +4 -4
  466. package/lib/shared-tree-core/editManager.d.ts.map +1 -1
  467. package/lib/shared-tree-core/editManager.js +2 -0
  468. package/lib/shared-tree-core/editManager.js.map +1 -1
  469. package/lib/shared-tree-core/editManagerCodecs.d.ts +3 -14
  470. package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  471. package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
  472. package/lib/shared-tree-core/editManagerCodecsCommons.d.ts +11 -1
  473. package/lib/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
  474. package/lib/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
  475. package/lib/shared-tree-core/editManagerCodecsV1toV4.d.ts +4 -11
  476. package/lib/shared-tree-core/editManagerCodecsV1toV4.d.ts.map +1 -1
  477. package/lib/shared-tree-core/editManagerCodecsV1toV4.js +1 -1
  478. package/lib/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -1
  479. package/lib/shared-tree-core/editManagerCodecsVSharedBranches.d.ts +4 -11
  480. package/lib/shared-tree-core/editManagerCodecsVSharedBranches.d.ts.map +1 -1
  481. package/lib/shared-tree-core/editManagerCodecsVSharedBranches.js +1 -1
  482. package/lib/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
  483. package/lib/shared-tree-core/editManagerSummarizer.d.ts +4 -4
  484. package/lib/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
  485. package/lib/shared-tree-core/editManagerSummarizer.js +0 -1
  486. package/lib/shared-tree-core/editManagerSummarizer.js.map +1 -1
  487. package/lib/shared-tree-core/messageCodecV1ToV4.d.ts +2 -2
  488. package/lib/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
  489. package/lib/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
  490. package/lib/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -1
  491. package/lib/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
  492. package/lib/shared-tree-core/messageCodecs.d.ts +8 -1
  493. package/lib/shared-tree-core/messageCodecs.d.ts.map +1 -1
  494. package/lib/shared-tree-core/messageCodecs.js.map +1 -1
  495. package/lib/shared-tree-core/sharedTreeCore.d.ts +5 -5
  496. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  497. package/lib/shared-tree-core/sharedTreeCore.js +1 -1
  498. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  499. package/lib/shared-tree-core/transaction.d.ts +10 -10
  500. package/lib/shared-tree-core/transaction.d.ts.map +1 -1
  501. package/lib/shared-tree-core/transaction.js +6 -3
  502. package/lib/shared-tree-core/transaction.js.map +1 -1
  503. package/lib/simple-tree/api/eraseSchemaDetails.d.ts +15 -0
  504. package/lib/simple-tree/api/eraseSchemaDetails.d.ts.map +1 -1
  505. package/lib/simple-tree/api/eraseSchemaDetails.js +15 -0
  506. package/lib/simple-tree/api/eraseSchemaDetails.js.map +1 -1
  507. package/lib/simple-tree/api/index.d.ts +1 -1
  508. package/lib/simple-tree/api/index.d.ts.map +1 -1
  509. package/lib/simple-tree/api/index.js +1 -1
  510. package/lib/simple-tree/api/index.js.map +1 -1
  511. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +3 -3
  512. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  513. package/lib/simple-tree/api/schemaStatics.d.ts +6 -7
  514. package/lib/simple-tree/api/schemaStatics.d.ts.map +1 -1
  515. package/lib/simple-tree/api/schemaStatics.js.map +1 -1
  516. package/lib/simple-tree/api/treeNodeApi.d.ts +20 -24
  517. package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  518. package/lib/simple-tree/api/treeNodeApi.js +46 -46
  519. package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
  520. package/lib/simple-tree/core/treeNode.d.ts +5 -6
  521. package/lib/simple-tree/core/treeNode.d.ts.map +1 -1
  522. package/lib/simple-tree/core/treeNode.js +2 -4
  523. package/lib/simple-tree/core/treeNode.js.map +1 -1
  524. package/lib/simple-tree/core/withType.d.ts +20 -7
  525. package/lib/simple-tree/core/withType.d.ts.map +1 -1
  526. package/lib/simple-tree/core/withType.js +4 -7
  527. package/lib/simple-tree/core/withType.js.map +1 -1
  528. package/lib/simple-tree/index.d.ts +2 -2
  529. package/lib/simple-tree/index.d.ts.map +1 -1
  530. package/lib/simple-tree/index.js +1 -1
  531. package/lib/simple-tree/index.js.map +1 -1
  532. package/lib/simple-tree/leafNodeSchema.d.ts +6 -1
  533. package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
  534. package/lib/simple-tree/leafNodeSchema.js +0 -1
  535. package/lib/simple-tree/leafNodeSchema.js.map +1 -1
  536. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts +53 -5
  537. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  538. package/lib/simple-tree/node-kinds/array/arrayNode.js +93 -12
  539. package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  540. package/lib/simple-tree/node-kinds/map/mapNode.d.ts +90 -0
  541. package/lib/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
  542. package/lib/simple-tree/node-kinds/map/mapNode.js +27 -2
  543. package/lib/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  544. package/lib/simple-tree/node-kinds/object/objectNode.js +3 -3
  545. package/lib/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  546. package/lib/simple-tree/node-kinds/record/recordNode.js +3 -3
  547. package/lib/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  548. package/lib/text/codePointUtils.d.ts +2 -2
  549. package/lib/text/codePointUtils.js +2 -2
  550. package/lib/text/codePointUtils.js.map +1 -1
  551. package/lib/text/index.d.ts +3 -3
  552. package/lib/text/index.d.ts.map +1 -1
  553. package/lib/text/index.js +3 -3
  554. package/lib/text/index.js.map +1 -1
  555. package/lib/text/textDomain.d.ts +30 -18
  556. package/lib/text/textDomain.d.ts.map +1 -1
  557. package/lib/text/textDomain.js +41 -22
  558. package/lib/text/textDomain.js.map +1 -1
  559. package/lib/text/textDomainFormatted.d.ts +180 -82
  560. package/lib/text/textDomainFormatted.d.ts.map +1 -1
  561. package/lib/text/textDomainFormatted.js +165 -86
  562. package/lib/text/textDomainFormatted.js.map +1 -1
  563. package/lib/text/textDomainFormattedDefault.d.ts +48 -25
  564. package/lib/text/textDomainFormattedDefault.d.ts.map +1 -1
  565. package/lib/text/textDomainFormattedDefault.js +25 -20
  566. package/lib/text/textDomainFormattedDefault.js.map +1 -1
  567. package/lib/treeDataStore.d.ts +49 -0
  568. package/lib/treeDataStore.d.ts.map +1 -0
  569. package/lib/treeDataStore.js +52 -0
  570. package/lib/treeDataStore.js.map +1 -0
  571. package/lib/treeFactory.d.ts +8 -3
  572. package/lib/treeFactory.d.ts.map +1 -1
  573. package/lib/treeFactory.js +5 -0
  574. package/lib/treeFactory.js.map +1 -1
  575. package/lib/util/compressedIds.d.ts +22 -2
  576. package/lib/util/compressedIds.d.ts.map +1 -1
  577. package/lib/util/compressedIds.js +22 -1
  578. package/lib/util/compressedIds.js.map +1 -1
  579. package/package.json +32 -24
  580. package/src/core/change-family/changeFamily.ts +32 -4
  581. package/src/core/change-family/editBuilder.ts +1 -2
  582. package/src/core/change-family/index.ts +2 -0
  583. package/src/core/index.ts +11 -6
  584. package/src/core/rebase/index.ts +2 -0
  585. package/src/core/rebase/types.ts +113 -0
  586. package/src/core/tree/delta.ts +62 -16
  587. package/src/core/tree/detachedFieldIndex.ts +7 -38
  588. package/src/core/tree/index.ts +2 -0
  589. package/src/core/tree/visitorUtils.ts +3 -17
  590. package/src/entrypoints/alpha.ts +9 -1
  591. package/src/feature-libraries/chunked-forest/codec/codecs.ts +17 -14
  592. package/src/feature-libraries/chunked-forest/uniformChunk.ts +11 -1
  593. package/src/feature-libraries/comparison-forest/comparisonForest.ts +140 -0
  594. package/src/feature-libraries/comparison-forest/index.ts +6 -0
  595. package/src/feature-libraries/default-schema/defaultEditBuilder.ts +20 -6
  596. package/src/feature-libraries/default-schema/index.ts +1 -0
  597. package/src/feature-libraries/default-schema/noChangeCodecs.ts +11 -3
  598. package/src/feature-libraries/detachedFieldIndexSummarizer.ts +33 -5
  599. package/src/feature-libraries/forest-summary/forestSummarizer.ts +1 -3
  600. package/src/feature-libraries/index.ts +5 -0
  601. package/src/feature-libraries/mitigatedChangeFamily.ts +21 -3
  602. package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +10 -1
  603. package/src/feature-libraries/modular-schema/genericFieldKindCodecs.ts +9 -4
  604. package/src/feature-libraries/modular-schema/index.ts +1 -0
  605. package/src/feature-libraries/modular-schema/invert.ts +338 -0
  606. package/src/feature-libraries/modular-schema/minimizeModularChange.ts +3 -5
  607. package/src/feature-libraries/modular-schema/modularChangeCodecV1.ts +16 -13
  608. package/src/feature-libraries/modular-schema/modularChangeCodecV2.ts +3 -1
  609. package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +2 -1
  610. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +45 -644
  611. package/src/feature-libraries/modular-schema/modularChangeUtils.ts +340 -0
  612. package/src/feature-libraries/modular-schema/prune.ts +69 -0
  613. package/src/feature-libraries/optional-field/optionalFieldCodecV2.ts +4 -2
  614. package/src/feature-libraries/optional-field/optionalFieldCodecs.ts +5 -2
  615. package/src/feature-libraries/sequence-field/sequenceFieldCodecV2.ts +4 -2
  616. package/src/feature-libraries/sequence-field/sequenceFieldCodecV3.ts +4 -2
  617. package/src/feature-libraries/sequence-field/sequenceFieldCodecs.ts +6 -3
  618. package/src/feature-libraries/treeTextCursor.ts +66 -1
  619. package/src/index.ts +11 -4
  620. package/src/packageVersion.ts +1 -1
  621. package/src/shared-tree/serializedChange.ts +2 -2
  622. package/src/shared-tree/sharedTree.ts +40 -15
  623. package/src/shared-tree/sharedTreeChangeCodecs.ts +11 -3
  624. package/src/shared-tree/sharedTreeChangeFamily.ts +77 -2
  625. package/src/shared-tree/transactionMinimize.ts +7 -3
  626. package/src/shared-tree/transactionPostProcessor.ts +5 -1
  627. package/src/shared-tree/treeCheckout.ts +136 -30
  628. package/src/shared-tree-core/branch.ts +41 -12
  629. package/src/shared-tree-core/editManager.ts +46 -25
  630. package/src/shared-tree-core/editManagerCodecs.ts +9 -21
  631. package/src/shared-tree-core/editManagerCodecsCommons.ts +14 -2
  632. package/src/shared-tree-core/editManagerCodecsV1toV4.ts +18 -21
  633. package/src/shared-tree-core/editManagerCodecsVSharedBranches.ts +18 -20
  634. package/src/shared-tree-core/editManagerSummarizer.ts +9 -6
  635. package/src/shared-tree-core/messageCodecV1ToV4.ts +3 -3
  636. package/src/shared-tree-core/messageCodecVSharedBranches.ts +2 -2
  637. package/src/shared-tree-core/messageCodecs.ts +12 -2
  638. package/src/shared-tree-core/sharedTreeCore.ts +16 -7
  639. package/src/shared-tree-core/transaction.ts +47 -25
  640. package/src/simple-tree/api/eraseSchemaDetails.ts +15 -0
  641. package/src/simple-tree/api/index.ts +0 -1
  642. package/src/simple-tree/api/schemaStatics.ts +2 -2
  643. package/src/simple-tree/api/treeNodeApi.ts +64 -48
  644. package/src/simple-tree/core/treeNode.ts +13 -10
  645. package/src/simple-tree/core/withType.ts +20 -7
  646. package/src/simple-tree/index.ts +1 -2
  647. package/src/simple-tree/leafNodeSchema.ts +6 -1
  648. package/src/simple-tree/node-kinds/array/arrayNode.ts +130 -16
  649. package/src/simple-tree/node-kinds/map/mapNode.ts +137 -5
  650. package/src/simple-tree/node-kinds/object/objectNode.ts +3 -3
  651. package/src/simple-tree/node-kinds/record/recordNode.ts +3 -3
  652. package/src/text/README.md +1 -1
  653. package/src/text/codePointUtils.ts +2 -2
  654. package/src/text/index.ts +3 -3
  655. package/src/text/textDomain.ts +50 -27
  656. package/src/text/textDomainFormatted.ts +384 -163
  657. package/src/text/textDomainFormattedDefault.ts +32 -32
  658. package/src/treeDataStore.ts +125 -0
  659. package/src/treeFactory.ts +11 -3
  660. package/src/util/compressedIds.ts +36 -3
@@ -0,0 +1,340 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ import { assert, fail } from "@fluidframework/core-utils/internal";
7
+ import {
8
+ newChangeAtomIdRangeMap,
9
+ type ChangesetLocalId,
10
+ type FieldKey,
11
+ type FieldKindIdentifier,
12
+ type RevisionInfo,
13
+ type RevisionTag,
14
+ type TaggedChange,
15
+ type TreeChunk,
16
+ } from "../../core/index.js";
17
+ import { brand, type Mutable, type RangeQueryResult } from "../../util/index.js";
18
+ import {
19
+ getFromChangeAtomIdMap,
20
+ newChangeAtomIdBTree,
21
+ type ChangeAtomIdBTree,
22
+ } from "../changeAtomIdBTree.js";
23
+ import {
24
+ CrossFieldTarget,
25
+ getFirstFromCrossFieldMap,
26
+ setInCrossFieldMap,
27
+ type CrossFieldManager,
28
+ type CrossFieldMap,
29
+ } from "./crossFieldQueries.js";
30
+ import type { FieldChangeHandler } from "./fieldChangeHandler.js";
31
+ import { NodeAttachState } from "./fieldChangeHandler.js";
32
+ import type { FlexFieldKind } from "./fieldKind.js";
33
+ import { genericFieldKind } from "./genericFieldKind.js";
34
+ import {
35
+ newCrossFieldKeyTable,
36
+ type CrossFieldKeyTable,
37
+ type FieldChange,
38
+ type FieldChangeMap,
39
+ type FieldId,
40
+ type ModularChangeset,
41
+ type NoChangeConstraint,
42
+ type NodeChangeset,
43
+ type NodeId,
44
+ } from "./modularChangeTypes.js";
45
+
46
+ export function hasConflicts(change: ModularChangeset): boolean {
47
+ return (change.constraintViolationCount ?? 0) > 0;
48
+ }
49
+
50
+ export function makeModularChangeset(props?: {
51
+ fieldChanges?: FieldChangeMap;
52
+ nodeChanges?: ChangeAtomIdBTree<NodeChangeset>;
53
+ nodeToParent?: ChangeAtomIdBTree<FieldId>;
54
+ nodeAliases?: ChangeAtomIdBTree<NodeId>;
55
+ crossFieldKeys?: CrossFieldKeyTable;
56
+ maxId: number;
57
+ revisions?: readonly RevisionInfo[];
58
+ constraintViolationCount?: number;
59
+ noChangeConstraint?: NoChangeConstraint;
60
+ noChangeConstraintOnRevert?: NoChangeConstraint;
61
+ builds?: ChangeAtomIdBTree<TreeChunk>;
62
+ destroys?: ChangeAtomIdBTree<number>;
63
+ refreshers?: ChangeAtomIdBTree<TreeChunk>;
64
+ }): ModularChangeset {
65
+ const p = props ?? { maxId: -1 };
66
+ const changeset: Mutable<ModularChangeset> = {
67
+ fieldChanges: p.fieldChanges ?? new Map<FieldKey, FieldChange>(),
68
+ nodeChanges: p.nodeChanges ?? newChangeAtomIdBTree(),
69
+ nodeToParent: p.nodeToParent ?? newChangeAtomIdBTree(),
70
+ nodeAliases: p.nodeAliases ?? newChangeAtomIdBTree(),
71
+ crossFieldKeys: p.crossFieldKeys ?? newCrossFieldKeyTable(),
72
+ };
73
+
74
+ if (p.revisions !== undefined && p.revisions.length > 0) {
75
+ changeset.revisions = p.revisions;
76
+ }
77
+ if (p.maxId >= 0) {
78
+ changeset.maxId = brand(p.maxId);
79
+ }
80
+ if (p.constraintViolationCount !== undefined && p.constraintViolationCount > 0) {
81
+ changeset.constraintViolationCount = p.constraintViolationCount;
82
+ }
83
+ if (p.noChangeConstraint !== undefined) {
84
+ changeset.noChangeConstraint = p.noChangeConstraint;
85
+ }
86
+ if (p.noChangeConstraintOnRevert !== undefined) {
87
+ changeset.noChangeConstraintOnRevert = p.noChangeConstraintOnRevert;
88
+ }
89
+ if (p.builds !== undefined && p.builds.size > 0) {
90
+ changeset.builds = p.builds;
91
+ }
92
+ if (p.destroys !== undefined && p.destroys.size > 0) {
93
+ changeset.destroys = p.destroys;
94
+ }
95
+ if (p.refreshers !== undefined && p.refreshers.size > 0) {
96
+ changeset.refreshers = p.refreshers;
97
+ }
98
+ return changeset;
99
+ }
100
+
101
+ // TODO: TFieldData could instead just be a numeric ID generated by the CrossFieldTable
102
+ // The CrossFieldTable could have a generic field ID to context table
103
+ export interface CrossFieldTable<TFieldData> {
104
+ srcTable: CrossFieldMap<unknown>;
105
+ dstTable: CrossFieldMap<unknown>;
106
+ srcDependents: CrossFieldMap<TFieldData>;
107
+ dstDependents: CrossFieldMap<TFieldData>;
108
+ invalidatedFields: Set<TFieldData>;
109
+ }
110
+
111
+ export abstract class CrossFieldManagerI<T> implements CrossFieldManager {
112
+ public constructor(
113
+ protected readonly crossFieldTable: CrossFieldTable<T>,
114
+ private readonly currentFieldKey: T,
115
+ protected readonly allowInval = true,
116
+ ) {}
117
+
118
+ public set(
119
+ target: CrossFieldTarget,
120
+ revision: RevisionTag | undefined,
121
+ id: ChangesetLocalId,
122
+ count: number,
123
+ newValue: unknown,
124
+ invalidateDependents: boolean,
125
+ ): void {
126
+ if (invalidateDependents && this.allowInval) {
127
+ const lastChangedId = (id as number) + count - 1;
128
+ let firstId = id;
129
+ while (firstId <= lastChangedId) {
130
+ const dependentEntry = getFirstFromCrossFieldMap(
131
+ this.getDependents(target),
132
+ revision,
133
+ firstId,
134
+ lastChangedId - firstId + 1,
135
+ );
136
+ if (dependentEntry.value !== undefined) {
137
+ this.crossFieldTable.invalidatedFields.add(dependentEntry.value);
138
+ }
139
+
140
+ firstId = brand(firstId + dependentEntry.length);
141
+ }
142
+ }
143
+ setInCrossFieldMap(this.getMap(target), revision, id, count, newValue);
144
+ }
145
+
146
+ public get(
147
+ target: CrossFieldTarget,
148
+ revision: RevisionTag | undefined,
149
+ id: ChangesetLocalId,
150
+ count: number,
151
+ addDependency: boolean,
152
+ ): RangeQueryResult<unknown> {
153
+ if (addDependency) {
154
+ // We assume that if there is already an entry for this ID it is because
155
+ // a field handler has called compose on the same node multiple times.
156
+ // In this case we only want to update the latest version, so we overwrite the dependency.
157
+ setInCrossFieldMap(
158
+ this.getDependents(target),
159
+ revision,
160
+ id,
161
+ count,
162
+ this.currentFieldKey,
163
+ );
164
+ }
165
+ return getFirstFromCrossFieldMap(this.getMap(target), revision, id, count);
166
+ }
167
+
168
+ public abstract onMoveIn(id: NodeId): void;
169
+
170
+ public abstract moveKey(
171
+ target: CrossFieldTarget,
172
+ revision: RevisionTag | undefined,
173
+ id: ChangesetLocalId,
174
+ count: number,
175
+ ): void;
176
+
177
+ private getMap(target: CrossFieldTarget): CrossFieldMap<unknown> {
178
+ return target === CrossFieldTarget.Source
179
+ ? this.crossFieldTable.srcTable
180
+ : this.crossFieldTable.dstTable;
181
+ }
182
+
183
+ private getDependents(target: CrossFieldTarget): CrossFieldMap<T> {
184
+ return target === CrossFieldTarget.Source
185
+ ? this.crossFieldTable.srcDependents
186
+ : this.crossFieldTable.dstDependents;
187
+ }
188
+ }
189
+
190
+ export function newCrossFieldTable<T>(): CrossFieldTable<T> {
191
+ return {
192
+ srcTable: newChangeAtomIdRangeMap(),
193
+ dstTable: newChangeAtomIdRangeMap(),
194
+ srcDependents: newChangeAtomIdRangeMap(),
195
+ dstDependents: newChangeAtomIdRangeMap(),
196
+ invalidatedFields: new Set(),
197
+ };
198
+ }
199
+
200
+ export function getRevInfoFromTaggedChanges(changes: TaggedChange<ModularChangeset>[]): {
201
+ revInfos: RevisionInfo[];
202
+ maxId: ChangesetLocalId;
203
+ } {
204
+ let maxId = -1;
205
+ const revInfos: RevisionInfo[] = [];
206
+ const revisions = new Set<RevisionTag>();
207
+ for (const taggedChange of changes) {
208
+ const change = taggedChange.change;
209
+ maxId = Math.max(change.maxId ?? -1, maxId);
210
+ const infosToAdd = revisionInfoFromTaggedChange(taggedChange);
211
+ for (const info of infosToAdd) {
212
+ if (!revisions.has(info.revision)) {
213
+ revisions.add(info.revision);
214
+ revInfos.push(info);
215
+ }
216
+ }
217
+ }
218
+
219
+ const rolledBackRevisions: RevisionTag[] = [];
220
+ for (const info of revInfos) {
221
+ if (info.rollbackOf !== undefined) {
222
+ rolledBackRevisions.push(info.rollbackOf);
223
+ }
224
+ }
225
+
226
+ rolledBackRevisions.reverse();
227
+ for (const revision of rolledBackRevisions) {
228
+ if (!revisions.has(revision)) {
229
+ revInfos.push({ revision });
230
+ }
231
+ }
232
+
233
+ return { maxId: brand(maxId), revInfos };
234
+ }
235
+
236
+ export function revisionInfoFromTaggedChange(
237
+ taggedChange: TaggedChange<ModularChangeset>,
238
+ ): RevisionInfo[] {
239
+ const revInfos: RevisionInfo[] = [];
240
+ if (taggedChange.change.revisions !== undefined) {
241
+ revInfos.push(...taggedChange.change.revisions);
242
+ } else if (taggedChange.revision !== undefined) {
243
+ const info: Mutable<RevisionInfo> = { revision: taggedChange.revision };
244
+ if (taggedChange.rollbackOf !== undefined) {
245
+ info.rollbackOf = taggedChange.rollbackOf;
246
+ }
247
+ revInfos.push(info);
248
+ }
249
+ return revInfos;
250
+ }
251
+
252
+ export function getChangeHandler(
253
+ fieldKinds: ReadonlyMap<FieldKindIdentifier, FlexFieldKind>,
254
+ kind: FieldKindIdentifier,
255
+ ): FieldChangeHandler<unknown> {
256
+ return getFieldKind(fieldKinds, kind).changeHandler;
257
+ }
258
+
259
+ function getFieldKind(
260
+ fieldKinds: ReadonlyMap<FieldKindIdentifier, FlexFieldKind>,
261
+ kind: FieldKindIdentifier,
262
+ ): FlexFieldKind {
263
+ if (kind === genericFieldKind.identifier) {
264
+ return genericFieldKind;
265
+ }
266
+ const fieldKind = fieldKinds.get(kind);
267
+ assert(fieldKind !== undefined, 0x3ad /* Unknown field kind */);
268
+ return fieldKind;
269
+ }
270
+
271
+ export interface ConstraintState {
272
+ violationCount: number;
273
+ }
274
+
275
+ export function newConstraintState(violationCount: number): ConstraintState {
276
+ return {
277
+ violationCount,
278
+ };
279
+ }
280
+
281
+ export function updateConstraintsForFields(
282
+ fields: FieldChangeMap,
283
+ parentInputAttachState: NodeAttachState,
284
+ constraintState: ConstraintState,
285
+ nodes: ChangeAtomIdBTree<NodeChangeset>,
286
+ fieldKinds: ReadonlyMap<FieldKindIdentifier, FlexFieldKind>,
287
+ ): void {
288
+ for (const field of fields.values()) {
289
+ const handler = getChangeHandler(fieldKinds, field.fieldKind);
290
+ for (const [nodeId, inputIndex, _outputIndex] of handler.getNestedChanges(field.change)) {
291
+ const isInputDetached = inputIndex === undefined;
292
+ const inputAttachState =
293
+ parentInputAttachState === NodeAttachState.Detached || isInputDetached
294
+ ? NodeAttachState.Detached
295
+ : NodeAttachState.Attached;
296
+
297
+ updateConstraintsForNode(nodeId, inputAttachState, nodes, constraintState, fieldKinds);
298
+ }
299
+ }
300
+ }
301
+
302
+ function updateConstraintsForNode(
303
+ nodeId: NodeId,
304
+ inputAttachState: NodeAttachState,
305
+ nodes: ChangeAtomIdBTree<NodeChangeset>,
306
+ constraintState: ConstraintState,
307
+ fieldKinds: ReadonlyMap<FieldKindIdentifier, FlexFieldKind>,
308
+ ): void {
309
+ const node =
310
+ nodes.get([nodeId.revision, nodeId.localId]) ?? fail(0xb24 /* Unknown node ID */);
311
+ if (node.nodeExistsConstraint !== undefined) {
312
+ const isNowViolated = inputAttachState === NodeAttachState.Detached;
313
+ if (node.nodeExistsConstraint.violated !== isNowViolated) {
314
+ node.nodeExistsConstraint = {
315
+ ...node.nodeExistsConstraint,
316
+ violated: isNowViolated,
317
+ };
318
+ constraintState.violationCount += isNowViolated ? 1 : -1;
319
+ }
320
+ }
321
+
322
+ if (node.fieldChanges !== undefined) {
323
+ updateConstraintsForFields(
324
+ node.fieldChanges,
325
+ inputAttachState,
326
+ constraintState,
327
+ nodes,
328
+ fieldKinds,
329
+ );
330
+ }
331
+ }
332
+
333
+ export function nodeChangeFromId(
334
+ nodes: ChangeAtomIdBTree<NodeChangeset>,
335
+ id: NodeId,
336
+ ): NodeChangeset {
337
+ const node = getFromChangeAtomIdMap(nodes, id);
338
+ assert(node !== undefined, 0x9ca /* Unknown node ID */);
339
+ return node;
340
+ }
@@ -0,0 +1,69 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ import type { FieldKindIdentifier } from "../../core/index.js";
7
+ import { brand } from "../../util/index.js";
8
+ import { setInChangeAtomIdMap, type ChangeAtomIdBTree } from "../changeAtomIdBTree.js";
9
+ import type { FlexFieldKind } from "./fieldKind.js";
10
+ import type { FieldChangeMap, NodeChangeset, NodeId } from "./modularChangeTypes.js";
11
+ import { getChangeHandler, nodeChangeFromId } from "./modularChangeUtils.js";
12
+
13
+ export function pruneFieldMap(
14
+ changeset: FieldChangeMap | undefined,
15
+ nodeMap: ChangeAtomIdBTree<NodeChangeset>,
16
+ fieldKinds: ReadonlyMap<FieldKindIdentifier, FlexFieldKind>,
17
+ ): FieldChangeMap | undefined {
18
+ if (changeset === undefined) {
19
+ return undefined;
20
+ }
21
+
22
+ const prunedChangeset: FieldChangeMap = new Map();
23
+ for (const [field, fieldChange] of changeset) {
24
+ const handler = getChangeHandler(fieldKinds, fieldChange.fieldKind);
25
+
26
+ const prunedFieldChangeset = handler.rebaser.prune(fieldChange.change, (nodeId) =>
27
+ pruneNodeChange(nodeId, nodeMap, fieldKinds),
28
+ );
29
+
30
+ if (!handler.isEmpty(prunedFieldChangeset)) {
31
+ prunedChangeset.set(field, { ...fieldChange, change: brand(prunedFieldChangeset) });
32
+ }
33
+ }
34
+
35
+ return prunedChangeset.size > 0 ? prunedChangeset : undefined;
36
+ }
37
+
38
+ function pruneNodeChange(
39
+ nodeId: NodeId,
40
+ nodeMap: ChangeAtomIdBTree<NodeChangeset>,
41
+ fieldKinds: ReadonlyMap<FieldKindIdentifier, FlexFieldKind>,
42
+ ): NodeId | undefined {
43
+ const changeset = nodeChangeFromId(nodeMap, nodeId);
44
+ const prunedFields =
45
+ changeset.fieldChanges === undefined
46
+ ? undefined
47
+ : pruneFieldMap(changeset.fieldChanges, nodeMap, fieldKinds);
48
+
49
+ const prunedChange = { ...changeset, fieldChanges: prunedFields };
50
+ if (prunedChange.fieldChanges === undefined) {
51
+ delete prunedChange.fieldChanges;
52
+ }
53
+
54
+ if (isEmptyNodeChangeset(prunedChange)) {
55
+ nodeMap.delete([nodeId.revision, nodeId.localId]);
56
+ return undefined;
57
+ } else {
58
+ setInChangeAtomIdMap(nodeMap, nodeId, prunedChange);
59
+ return nodeId;
60
+ }
61
+ }
62
+
63
+ function isEmptyNodeChangeset(change: NodeChangeset): boolean {
64
+ return (
65
+ change.fieldChanges === undefined &&
66
+ change.nodeExistsConstraint === undefined &&
67
+ change.nodeExistsConstraintOnRevert === undefined
68
+ );
69
+ }
@@ -16,6 +16,7 @@ import type { Mutable } from "../../util/index.js";
16
16
  import { makeChangeAtomIdCodec } from "../changeAtomIdCodec.js";
17
17
  import type {
18
18
  FieldChangeEncodingContext,
19
+ FieldChangeDecodingContext,
19
20
  EncodedChangeAtomId,
20
21
  } from "../modular-schema/index.js";
21
22
  import { EncodedNodeChangeset } from "../modular-schema/index.js";
@@ -57,7 +58,8 @@ export function makeOptionalFieldCodec(
57
58
  OptionalChangeset,
58
59
  EncodedOptionalChangeset<TAnySchema>,
59
60
  EncodedOptionalChangeset<TAnySchema>,
60
- FieldChangeEncodingContext
61
+ FieldChangeEncodingContext,
62
+ FieldChangeDecodingContext
61
63
  > {
62
64
  const changeAtomIdCodec = makeChangeAtomIdCodec(revisionTagCodec);
63
65
  const registerIdCodec = makeRegisterIdCodec(changeAtomIdCodec);
@@ -98,7 +100,7 @@ export function makeOptionalFieldCodec(
98
100
 
99
101
  decode: (
100
102
  encoded: EncodedOptionalChangeset<TAnySchema>,
101
- context: FieldChangeEncodingContext,
103
+ context: FieldChangeDecodingContext,
102
104
  ) => {
103
105
  const decoded: Mutable<OptionalChangeset> = {
104
106
  moves:
@@ -9,7 +9,10 @@ import type {
9
9
  RevisionTag,
10
10
  RevisionTagSchema,
11
11
  } from "../../core/index.js";
12
- import type { FieldChangeEncodingContext } from "../modular-schema/index.js";
12
+ import type {
13
+ FieldChangeEncodingContext,
14
+ FieldChangeDecodingContext,
15
+ } from "../modular-schema/index.js";
13
16
 
14
17
  import type { OptionalChangeset } from "./optionalFieldChangeTypes.js";
15
18
  import { makeOptionalFieldCodec as makeV2Codec } from "./optionalFieldCodecV2.js";
@@ -20,5 +23,5 @@ export const makeOptionalFieldCodecFamily = (
20
23
  typeof RevisionTagSchema,
21
24
  ChangeEncodingContext
22
25
  >,
23
- ): ICodecFamily<OptionalChangeset, FieldChangeEncodingContext> =>
26
+ ): ICodecFamily<OptionalChangeset, FieldChangeEncodingContext, FieldChangeDecodingContext> =>
24
27
  makeCodecFamily([[2, makeV2Codec(revisionTagCodec)]]);
@@ -24,6 +24,7 @@ import { makeChangeAtomIdCodec } from "../changeAtomIdCodec.js";
24
24
  import {
25
25
  EncodedNodeChangeset,
26
26
  type FieldChangeEncodingContext,
27
+ type FieldChangeDecodingContext,
27
28
  } from "../modular-schema/index.js";
28
29
 
29
30
  import { Changeset as ChangesetSchema, type Encoded } from "./formatV2.js";
@@ -271,7 +272,8 @@ export function makeV2Codec(
271
272
  Changeset,
272
273
  JsonCompatibleReadOnly,
273
274
  JsonCompatibleReadOnly,
274
- FieldChangeEncodingContext
275
+ FieldChangeEncodingContext,
276
+ FieldChangeDecodingContext
275
277
  > {
276
278
  const { markEffectCodec, changeAtomIdCodec } = makeV2CodecHelpers(revisionTagCodec);
277
279
  /**
@@ -305,7 +307,7 @@ export function makeV2Codec(
305
307
  },
306
308
  decode: (
307
309
  changeset: Encoded.Changeset<NodeChangeSchema>,
308
- context: FieldChangeEncodingContext,
310
+ context: FieldChangeDecodingContext,
309
311
  ): Changeset => {
310
312
  const marks: Changeset = [];
311
313
  for (const mark of changeset) {
@@ -19,6 +19,7 @@ import type { JsonCompatibleReadOnly } from "../../util/index.js";
19
19
  import {
20
20
  EncodedNodeChangeset,
21
21
  type FieldChangeEncodingContext,
22
+ type FieldChangeDecodingContext,
22
23
  } from "../modular-schema/index.js";
23
24
 
24
25
  import { Changeset as ChangesetSchema, type Encoded } from "./formatV3.js";
@@ -36,7 +37,8 @@ export function makeV3Codec(
36
37
  Changeset,
37
38
  JsonCompatibleReadOnly,
38
39
  JsonCompatibleReadOnly,
39
- FieldChangeEncodingContext
40
+ FieldChangeEncodingContext,
41
+ FieldChangeDecodingContext
40
42
  > {
41
43
  const {
42
44
  changeAtomIdCodec: atomIdCodec,
@@ -115,7 +117,7 @@ export function makeV3Codec(
115
117
  },
116
118
  decode: (
117
119
  changeset: Encoded.Changeset<NodeChangeSchema>,
118
- context: FieldChangeEncodingContext,
120
+ context: FieldChangeDecodingContext,
119
121
  ): Changeset => {
120
122
  const marks: Changeset = [];
121
123
  for (const mark of changeset) {
@@ -9,7 +9,10 @@ import type {
9
9
  RevisionTag,
10
10
  RevisionTagSchema,
11
11
  } from "../../core/index.js";
12
- import type { FieldChangeEncodingContext } from "../modular-schema/index.js";
12
+ import type {
13
+ FieldChangeEncodingContext,
14
+ FieldChangeDecodingContext,
15
+ } from "../modular-schema/index.js";
13
16
 
14
17
  import { makeV2Codec } from "./sequenceFieldCodecV2.js";
15
18
  import { makeV3Codec } from "./sequenceFieldCodecV3.js";
@@ -21,8 +24,8 @@ export const sequenceFieldChangeCodecFactory = (
21
24
  typeof RevisionTagSchema,
22
25
  ChangeEncodingContext
23
26
  >,
24
- ): ICodecFamily<MarkList, FieldChangeEncodingContext> =>
25
- makeCodecFamily<Changeset, FieldChangeEncodingContext>([
27
+ ): ICodecFamily<MarkList, FieldChangeEncodingContext, FieldChangeDecodingContext> =>
28
+ makeCodecFamily<Changeset, FieldChangeEncodingContext, FieldChangeDecodingContext>([
26
29
  [2, makeV2Codec(revisionTagCodec)],
27
30
  [3, makeV3Codec(revisionTagCodec)],
28
31
  ]);
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { assert } from "@fluidframework/core-utils/internal";
6
+ import { assert, fail, oob } from "@fluidframework/core-utils/internal";
7
7
 
8
8
  import {
9
9
  CursorLocationType,
@@ -132,3 +132,68 @@ export function jsonableTreeFromForest(forest: IForestSubscription): JsonableTre
132
132
  readCursor.free();
133
133
  return jsonable;
134
134
  }
135
+
136
+ /**
137
+ * The full content of `forest` (every detached/removed field) as a single {@link JsonableTree}.
138
+ * @remarks
139
+ * The returned node is the forest's above-root placeholder: its fields are the forest's detached fields.
140
+ * Only content is captured: schema, anchors and other forest state are not.
141
+ */
142
+ function forestContent(forest: IForestSubscription): JsonableTree {
143
+ return jsonableTreeFromCursor(forest.getCursorAboveDetachedFields());
144
+ }
145
+
146
+ /**
147
+ * Structural equality of two {@link JsonableTree}s, comparing type, value and fields recursively.
148
+ * @remarks
149
+ * Fields are compared as an unordered set of keys, so this is independent of the order in which different
150
+ * forest implementations enumerate fields. The nodes within each field are compared in order.
151
+ */
152
+ function treesEqual(a: JsonableTree, b: JsonableTree): boolean {
153
+ if (a.type !== b.type || !Object.is(a.value, b.value)) {
154
+ return false;
155
+ }
156
+ // JsonableTree never stores empty fields, so equal key counts plus a matching field for every key in
157
+ // `a` implies `b` has no extra fields.
158
+ const aKeys = genericTreeKeys(a);
159
+ if (aKeys.length !== genericTreeKeys(b).length) {
160
+ return false;
161
+ }
162
+ for (const key of aKeys) {
163
+ const aField = getGenericTreeField(a, key, false);
164
+ const bField = getGenericTreeField(b, key, false);
165
+ if (aField.length !== bField.length) {
166
+ return false;
167
+ }
168
+ for (const [index, aChild] of aField.entries()) {
169
+ const bChild = bField[index] ?? oob();
170
+ if (!treesEqual(aChild, bChild)) {
171
+ return false;
172
+ }
173
+ }
174
+ }
175
+ return true;
176
+ }
177
+
178
+ /**
179
+ * Returns true if `a` and `b` have identical content, including all detached/removed fields.
180
+ * @remarks
181
+ * Only content is compared: schema, anchors and other forest state are ignored.
182
+ * This is intended for debugging and testing, and is not optimized.
183
+ */
184
+ export function forestsEqual(a: IForestSubscription, b: IForestSubscription): boolean {
185
+ return treesEqual(forestContent(a), forestContent(b));
186
+ }
187
+
188
+ /**
189
+ * Asserts that `a` and `b` have identical content, including all detached/removed fields.
190
+ * @remarks
191
+ * Only content is compared: schema, anchors and other forest state are ignored.
192
+ * This is intended for debugging and testing, and is not optimized.
193
+ * @throws an Error if the forests differ.
194
+ */
195
+ export function assertForestsEqual(a: IForestSubscription, b: IForestSubscription): void {
196
+ if (!forestsEqual(a, b)) {
197
+ fail(0xd10 /* Forests are not equal */);
198
+ }
199
+ }
package/src/index.ts CHANGED
@@ -12,6 +12,8 @@ export {
12
12
  CommitKind,
13
13
  RevertibleStatus,
14
14
  type CommitMetadata,
15
+ CommitOutcome,
16
+ type LocalCommitEvents,
15
17
  type LocalChangeMetadata,
16
18
  type RemoteChangeMetadata,
17
19
  type ChangeMetadata,
@@ -300,6 +302,7 @@ export {
300
302
  type HandleConverter,
301
303
  allowUnused,
302
304
  type LeafSchema,
305
+ type StringSchema,
303
306
  type ArrayNodeCustomizableSchema,
304
307
  type ArrayNodeCustomizableSchemaAlpha,
305
308
  type ArrayNodePojoEmulationSchema,
@@ -344,6 +347,7 @@ export {
344
347
  } from "./simple-tree/index.js";
345
348
  export {
346
349
  SharedTree,
350
+ SharedTreeAlpha,
347
351
  configuredSharedTree,
348
352
  configuredSharedTreeAlpha,
349
353
  configuredSharedTreeBeta,
@@ -403,7 +407,7 @@ import * as InternalTypes from "./internalTypes.js";
403
407
  export { InternalTypes };
404
408
 
405
409
  // Internal/System types:
406
- // These would be put in `internalTypes` except doing so tents to cause errors like:
410
+ // These would be put in `internalTypes` except doing so tends to cause errors like:
407
411
  // The inferred type of 'NodeMap' cannot be named without a reference to '../../node_modules/@fluidframework/tree/lib/internalTypes.js'. This is likely not portable. A type annotation is necessary.
408
412
  export type { MapNodeInsertableData } from "./simple-tree/index.js";
409
413
 
@@ -413,11 +417,14 @@ export { TableSchema, type System_TableSchema } from "./tableSchema.js";
413
417
  export { asAlpha, asBeta } from "./api.js";
414
418
 
415
419
  export {
416
- TextAsTree,
417
- FormattedTextAsTree,
418
- FormattedTextAsTreeDefault,
420
+ PlainText,
421
+ FormattedText,
422
+ FormattedTextDefault,
419
423
  codePointCount,
420
424
  utf16LengthForCodePoints,
421
425
  } from "./text/index.js";
422
426
  export { ExtensibleUnionNode } from "./extensibleUnionNode.js";
423
427
  export { Component } from "./componentApi.js";
428
+
429
+ export { defineTreeDataStore, instantiateTreeFirstTime } from "./treeDataStore.js";
430
+ export type { TreeDataStoreOptions } from "./treeDataStore.js";
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/tree";
9
- export const pkgVersion = "2.113.1";
9
+ export const pkgVersion = "2.115.0";
@@ -48,7 +48,7 @@ function isSerializedChangeV1(value: unknown): value is SerializedChange {
48
48
 
49
49
  function encodeSerializedChangeV1(
50
50
  idCompressor: IIdCompressor,
51
- changeFamily: ChangeFamily<SharedTreeEditBuilder, SharedTreeChange>,
51
+ changeFamily: ChangeFamily<SharedTreeEditBuilder, SharedTreeChange, unknown>,
52
52
  change: SharedTreeChange,
53
53
  changeRevision: RevisionTag,
54
54
  contextRevision?: RevisionTag,
@@ -73,7 +73,7 @@ function encodeSerializedChangeV1(
73
73
 
74
74
  function decodeSerializedChangeV1(
75
75
  idCompressor: IIdCompressor,
76
- changeFamily: ChangeFamily<SharedTreeEditBuilder, SharedTreeChange>,
76
+ changeFamily: ChangeFamily<SharedTreeEditBuilder, SharedTreeChange, unknown>,
77
77
  serializedChange: JsonCompatibleReadOnly,
78
78
  ): TaggedChange<SharedTreeChange> {
79
79
  if (!isSerializedChangeV1(serializedChange)) {