@fluidframework/tree 2.82.0 → 2.90.0-378676

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 (986) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/README.md +33 -5
  3. package/api-report/tree.alpha.api.md +26 -21
  4. package/api-report/tree.beta.api.md +14 -2
  5. package/api-report/tree.legacy.beta.api.md +14 -2
  6. package/api-report/tree.legacy.public.api.md +1 -1
  7. package/api-report/tree.public.api.md +1 -1
  8. package/dist/alpha.d.ts +3 -3
  9. package/dist/beta.d.ts +1 -0
  10. package/dist/codec/codec.d.ts +3 -39
  11. package/dist/codec/codec.d.ts.map +1 -1
  12. package/dist/codec/codec.js +5 -50
  13. package/dist/codec/codec.js.map +1 -1
  14. package/dist/codec/index.d.ts +1 -1
  15. package/dist/codec/index.d.ts.map +1 -1
  16. package/dist/codec/index.js +1 -2
  17. package/dist/codec/index.js.map +1 -1
  18. package/dist/codec/versioned/codec.d.ts +20 -7
  19. package/dist/codec/versioned/codec.d.ts.map +1 -1
  20. package/dist/codec/versioned/codec.js +56 -30
  21. package/dist/codec/versioned/codec.js.map +1 -1
  22. package/dist/core/change-family/changeFamily.d.ts +4 -1
  23. package/dist/core/change-family/changeFamily.d.ts.map +1 -1
  24. package/dist/core/change-family/changeFamily.js.map +1 -1
  25. package/dist/core/change-family/index.d.ts +1 -1
  26. package/dist/core/change-family/index.d.ts.map +1 -1
  27. package/dist/core/change-family/index.js.map +1 -1
  28. package/dist/core/index.d.ts +3 -3
  29. package/dist/core/index.d.ts.map +1 -1
  30. package/dist/core/index.js +6 -4
  31. package/dist/core/index.js.map +1 -1
  32. package/dist/core/rebase/changeRebaser.d.ts +6 -1
  33. package/dist/core/rebase/changeRebaser.d.ts.map +1 -1
  34. package/dist/core/rebase/changeRebaser.js.map +1 -1
  35. package/dist/core/rebase/index.d.ts +1 -1
  36. package/dist/core/rebase/index.d.ts.map +1 -1
  37. package/dist/core/rebase/index.js +2 -1
  38. package/dist/core/rebase/index.js.map +1 -1
  39. package/dist/core/rebase/types.d.ts +1 -0
  40. package/dist/core/rebase/types.d.ts.map +1 -1
  41. package/dist/core/rebase/types.js +5 -1
  42. package/dist/core/rebase/types.js.map +1 -1
  43. package/dist/core/rebase/utils.d.ts.map +1 -1
  44. package/dist/core/rebase/utils.js +25 -7
  45. package/dist/core/rebase/utils.js.map +1 -1
  46. package/dist/core/tree/delta.d.ts +5 -0
  47. package/dist/core/tree/delta.d.ts.map +1 -1
  48. package/dist/core/tree/delta.js.map +1 -1
  49. package/dist/core/tree/detachedFieldIndex.d.ts +13 -1
  50. package/dist/core/tree/detachedFieldIndex.d.ts.map +1 -1
  51. package/dist/core/tree/detachedFieldIndex.js +14 -1
  52. package/dist/core/tree/detachedFieldIndex.js.map +1 -1
  53. package/dist/core/tree/detachedFieldIndexCodecs.d.ts.map +1 -1
  54. package/dist/core/tree/detachedFieldIndexCodecs.js +6 -4
  55. package/dist/core/tree/detachedFieldIndexCodecs.js.map +1 -1
  56. package/dist/core/tree/detachedFieldIndexTypes.d.ts +4 -0
  57. package/dist/core/tree/detachedFieldIndexTypes.d.ts.map +1 -1
  58. package/dist/core/tree/detachedFieldIndexTypes.js.map +1 -1
  59. package/dist/core/tree/index.d.ts +2 -2
  60. package/dist/core/tree/index.d.ts.map +1 -1
  61. package/dist/core/tree/index.js +4 -3
  62. package/dist/core/tree/index.js.map +1 -1
  63. package/dist/core/tree/pathTree.d.ts +11 -3
  64. package/dist/core/tree/pathTree.d.ts.map +1 -1
  65. package/dist/core/tree/pathTree.js +14 -2
  66. package/dist/core/tree/pathTree.js.map +1 -1
  67. package/dist/core/tree/visitDelta.d.ts.map +1 -1
  68. package/dist/core/tree/visitDelta.js +17 -13
  69. package/dist/core/tree/visitDelta.js.map +1 -1
  70. package/dist/extensibleUnionNode.d.ts +97 -0
  71. package/dist/extensibleUnionNode.d.ts.map +1 -0
  72. package/dist/{extensibleSchemaUnion.js → extensibleUnionNode.js} +28 -18
  73. package/dist/extensibleUnionNode.js.map +1 -0
  74. package/dist/feature-libraries/changeAtomIdBTree.d.ts +3 -2
  75. package/dist/feature-libraries/changeAtomIdBTree.d.ts.map +1 -1
  76. package/dist/feature-libraries/changeAtomIdBTree.js +15 -2
  77. package/dist/feature-libraries/changeAtomIdBTree.js.map +1 -1
  78. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts +1 -1
  79. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  80. package/dist/feature-libraries/chunked-forest/codec/codecs.js +4 -4
  81. package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  82. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts +92 -44
  83. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  84. package/dist/feature-libraries/default-schema/defaultEditBuilder.js +220 -70
  85. package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  86. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  87. package/dist/feature-libraries/default-schema/defaultFieldKinds.js +12 -2
  88. package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  89. package/dist/feature-libraries/default-schema/index.d.ts +2 -1
  90. package/dist/feature-libraries/default-schema/index.d.ts.map +1 -1
  91. package/dist/feature-libraries/default-schema/index.js +4 -2
  92. package/dist/feature-libraries/default-schema/index.js.map +1 -1
  93. package/dist/feature-libraries/default-schema/locationBasedEditBuilder.d.ts +40 -0
  94. package/dist/feature-libraries/default-schema/locationBasedEditBuilder.d.ts.map +1 -0
  95. package/dist/feature-libraries/default-schema/locationBasedEditBuilder.js +153 -0
  96. package/dist/feature-libraries/default-schema/locationBasedEditBuilder.js.map +1 -0
  97. package/dist/feature-libraries/default-schema/mappedEditBuilder.d.ts +7 -6
  98. package/dist/feature-libraries/default-schema/mappedEditBuilder.d.ts.map +1 -1
  99. package/dist/feature-libraries/default-schema/mappedEditBuilder.js +15 -0
  100. package/dist/feature-libraries/default-schema/mappedEditBuilder.js.map +1 -1
  101. package/dist/feature-libraries/deltaUtils.d.ts +1 -0
  102. package/dist/feature-libraries/deltaUtils.d.ts.map +1 -1
  103. package/dist/feature-libraries/deltaUtils.js +6 -1
  104. package/dist/feature-libraries/deltaUtils.js.map +1 -1
  105. package/dist/feature-libraries/flex-tree/context.d.ts +9 -0
  106. package/dist/feature-libraries/flex-tree/context.d.ts.map +1 -1
  107. package/dist/feature-libraries/flex-tree/context.js +6 -0
  108. package/dist/feature-libraries/flex-tree/context.js.map +1 -1
  109. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts +6 -6
  110. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  111. package/dist/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  112. package/dist/feature-libraries/flex-tree/lazyField.d.ts +8 -7
  113. package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  114. package/dist/feature-libraries/flex-tree/lazyField.js +39 -8
  115. package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
  116. package/dist/feature-libraries/forest-summary/codec.d.ts.map +1 -1
  117. package/dist/feature-libraries/forest-summary/codec.js +7 -1
  118. package/dist/feature-libraries/forest-summary/codec.js.map +1 -1
  119. package/dist/feature-libraries/forest-summary/formatCommon.d.ts +3 -3
  120. package/dist/feature-libraries/forest-summary/formatCommon.d.ts.map +1 -1
  121. package/dist/feature-libraries/forest-summary/formatCommon.js.map +1 -1
  122. package/dist/feature-libraries/forest-summary/formatV1.d.ts +2 -3
  123. package/dist/feature-libraries/forest-summary/formatV1.d.ts.map +1 -1
  124. package/dist/feature-libraries/forest-summary/formatV1.js +1 -2
  125. package/dist/feature-libraries/forest-summary/formatV1.js.map +1 -1
  126. package/dist/feature-libraries/forest-summary/formatV2.d.ts +2 -3
  127. package/dist/feature-libraries/forest-summary/formatV2.d.ts.map +1 -1
  128. package/dist/feature-libraries/forest-summary/formatV2.js +1 -2
  129. package/dist/feature-libraries/forest-summary/formatV2.js.map +1 -1
  130. package/dist/feature-libraries/index.d.ts +3 -3
  131. package/dist/feature-libraries/index.d.ts.map +1 -1
  132. package/dist/feature-libraries/index.js +8 -4
  133. package/dist/feature-libraries/index.js.map +1 -1
  134. package/dist/feature-libraries/mitigatedChangeFamily.d.ts.map +1 -1
  135. package/dist/feature-libraries/mitigatedChangeFamily.js +2 -2
  136. package/dist/feature-libraries/mitigatedChangeFamily.js.map +1 -1
  137. package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts +100 -24
  138. package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
  139. package/dist/feature-libraries/modular-schema/crossFieldQueries.js +8 -12
  140. package/dist/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
  141. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts +85 -51
  142. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  143. package/dist/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  144. package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  145. package/dist/feature-libraries/modular-schema/genericFieldKind.js +4 -9
  146. package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  147. package/dist/feature-libraries/modular-schema/index.d.ts +3 -3
  148. package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
  149. package/dist/feature-libraries/modular-schema/index.js +2 -3
  150. package/dist/feature-libraries/modular-schema/index.js.map +1 -1
  151. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts +20 -24
  152. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -1
  153. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js +277 -159
  154. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
  155. package/dist/feature-libraries/modular-schema/modularChangeCodecV2.d.ts.map +1 -1
  156. package/dist/feature-libraries/modular-schema/modularChangeCodecV2.js +1 -1
  157. package/dist/feature-libraries/modular-schema/modularChangeCodecV2.js.map +1 -1
  158. package/dist/feature-libraries/modular-schema/modularChangeCodecV3.d.ts +15 -0
  159. package/dist/feature-libraries/modular-schema/modularChangeCodecV3.d.ts.map +1 -0
  160. package/dist/feature-libraries/modular-schema/modularChangeCodecV3.js +296 -0
  161. package/dist/feature-libraries/modular-schema/modularChangeCodecV3.js.map +1 -0
  162. package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts +1 -0
  163. package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  164. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js +8 -0
  165. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  166. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +56 -22
  167. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  168. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +1390 -462
  169. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  170. package/dist/feature-libraries/modular-schema/modularChangeFormatV1.d.ts.map +1 -1
  171. package/dist/feature-libraries/modular-schema/modularChangeFormatV1.js.map +1 -1
  172. package/dist/feature-libraries/modular-schema/modularChangeFormatV2.d.ts +1 -2
  173. package/dist/feature-libraries/modular-schema/modularChangeFormatV2.d.ts.map +1 -1
  174. package/dist/feature-libraries/modular-schema/modularChangeFormatV2.js +3 -3
  175. package/dist/feature-libraries/modular-schema/modularChangeFormatV2.js.map +1 -1
  176. package/dist/feature-libraries/modular-schema/modularChangeFormatV3.d.ts +74 -0
  177. package/dist/feature-libraries/modular-schema/modularChangeFormatV3.d.ts.map +1 -0
  178. package/dist/feature-libraries/modular-schema/modularChangeFormatV3.js +35 -0
  179. package/dist/feature-libraries/modular-schema/modularChangeFormatV3.js.map +1 -0
  180. package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts +49 -10
  181. package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
  182. package/dist/feature-libraries/modular-schema/modularChangeTypes.js +3 -3
  183. package/dist/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
  184. package/dist/feature-libraries/optional-field/optionalField.d.ts +13 -32
  185. package/dist/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
  186. package/dist/feature-libraries/optional-field/optionalField.js +257 -446
  187. package/dist/feature-libraries/optional-field/optionalField.js.map +1 -1
  188. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV3.d.ts +23 -0
  189. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV3.d.ts.map +1 -0
  190. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV3.js +31 -0
  191. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV3.js.map +1 -0
  192. package/dist/feature-libraries/optional-field/optionalFieldChangeTypes.d.ts +31 -31
  193. package/dist/feature-libraries/optional-field/optionalFieldChangeTypes.d.ts.map +1 -1
  194. package/dist/feature-libraries/optional-field/optionalFieldChangeTypes.js.map +1 -1
  195. package/dist/feature-libraries/optional-field/optionalFieldCodecV2.d.ts +1 -1
  196. package/dist/feature-libraries/optional-field/optionalFieldCodecV2.d.ts.map +1 -1
  197. package/dist/feature-libraries/optional-field/optionalFieldCodecV2.js +57 -28
  198. package/dist/feature-libraries/optional-field/optionalFieldCodecV2.js.map +1 -1
  199. package/dist/feature-libraries/optional-field/optionalFieldCodecV3.d.ts +12 -0
  200. package/dist/feature-libraries/optional-field/optionalFieldCodecV3.d.ts.map +1 -0
  201. package/dist/feature-libraries/optional-field/optionalFieldCodecV3.js +57 -0
  202. package/dist/feature-libraries/optional-field/optionalFieldCodecV3.js.map +1 -0
  203. package/dist/feature-libraries/optional-field/optionalFieldCodecs.d.ts.map +1 -1
  204. package/dist/feature-libraries/optional-field/optionalFieldCodecs.js +5 -1
  205. package/dist/feature-libraries/optional-field/optionalFieldCodecs.js.map +1 -1
  206. package/dist/feature-libraries/optional-field/requiredField.d.ts +3 -2
  207. package/dist/feature-libraries/optional-field/requiredField.d.ts.map +1 -1
  208. package/dist/feature-libraries/optional-field/requiredField.js +6 -1
  209. package/dist/feature-libraries/optional-field/requiredField.js.map +1 -1
  210. package/dist/feature-libraries/schema-index/codec.d.ts.map +1 -1
  211. package/dist/feature-libraries/schema-index/codec.js +6 -4
  212. package/dist/feature-libraries/schema-index/codec.js.map +1 -1
  213. package/dist/feature-libraries/sequence-field/compose.d.ts +6 -7
  214. package/dist/feature-libraries/sequence-field/compose.d.ts.map +1 -1
  215. package/dist/feature-libraries/sequence-field/compose.js +81 -259
  216. package/dist/feature-libraries/sequence-field/compose.js.map +1 -1
  217. package/dist/feature-libraries/sequence-field/helperTypes.d.ts +14 -10
  218. package/dist/feature-libraries/sequence-field/helperTypes.d.ts.map +1 -1
  219. package/dist/feature-libraries/sequence-field/helperTypes.js.map +1 -1
  220. package/dist/feature-libraries/sequence-field/invert.d.ts +3 -3
  221. package/dist/feature-libraries/sequence-field/invert.d.ts.map +1 -1
  222. package/dist/feature-libraries/sequence-field/invert.js +65 -167
  223. package/dist/feature-libraries/sequence-field/invert.js.map +1 -1
  224. package/dist/feature-libraries/sequence-field/markQueue.d.ts +2 -2
  225. package/dist/feature-libraries/sequence-field/markQueue.d.ts.map +1 -1
  226. package/dist/feature-libraries/sequence-field/markQueue.js.map +1 -1
  227. package/dist/feature-libraries/sequence-field/moveEffectTable.d.ts +4 -56
  228. package/dist/feature-libraries/sequence-field/moveEffectTable.d.ts.map +1 -1
  229. package/dist/feature-libraries/sequence-field/moveEffectTable.js +7 -90
  230. package/dist/feature-libraries/sequence-field/moveEffectTable.js.map +1 -1
  231. package/dist/feature-libraries/sequence-field/rebase.d.ts +3 -3
  232. package/dist/feature-libraries/sequence-field/rebase.d.ts.map +1 -1
  233. package/dist/feature-libraries/sequence-field/rebase.js +109 -116
  234. package/dist/feature-libraries/sequence-field/rebase.js.map +1 -1
  235. package/dist/feature-libraries/sequence-field/replaceRevisions.d.ts.map +1 -1
  236. package/dist/feature-libraries/sequence-field/replaceRevisions.js +19 -32
  237. package/dist/feature-libraries/sequence-field/replaceRevisions.js.map +1 -1
  238. package/dist/feature-libraries/sequence-field/sequenceFieldChangeHandler.d.ts.map +1 -1
  239. package/dist/feature-libraries/sequence-field/sequenceFieldChangeHandler.js +1 -2
  240. package/dist/feature-libraries/sequence-field/sequenceFieldChangeHandler.js.map +1 -1
  241. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts +22 -4
  242. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
  243. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js +388 -187
  244. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
  245. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts.map +1 -1
  246. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.js +20 -62
  247. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -1
  248. package/dist/feature-libraries/sequence-field/sequenceFieldEditor.d.ts +2 -2
  249. package/dist/feature-libraries/sequence-field/sequenceFieldEditor.d.ts.map +1 -1
  250. package/dist/feature-libraries/sequence-field/sequenceFieldEditor.js +13 -13
  251. package/dist/feature-libraries/sequence-field/sequenceFieldEditor.js.map +1 -1
  252. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts +3 -2
  253. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts.map +1 -1
  254. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js +16 -111
  255. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
  256. package/dist/feature-libraries/sequence-field/types.d.ts +37 -74
  257. package/dist/feature-libraries/sequence-field/types.d.ts.map +1 -1
  258. package/dist/feature-libraries/sequence-field/types.js.map +1 -1
  259. package/dist/feature-libraries/sequence-field/utils.d.ts +20 -25
  260. package/dist/feature-libraries/sequence-field/utils.d.ts.map +1 -1
  261. package/dist/feature-libraries/sequence-field/utils.js +159 -320
  262. package/dist/feature-libraries/sequence-field/utils.js.map +1 -1
  263. package/dist/index.d.ts +2 -2
  264. package/dist/index.d.ts.map +1 -1
  265. package/dist/index.js +4 -4
  266. package/dist/index.js.map +1 -1
  267. package/dist/legacy.d.ts +1 -0
  268. package/dist/packageVersion.d.ts +1 -1
  269. package/dist/packageVersion.d.ts.map +1 -1
  270. package/dist/packageVersion.js +1 -1
  271. package/dist/packageVersion.js.map +1 -1
  272. package/dist/shared-tree/independentView.d.ts.map +1 -1
  273. package/dist/shared-tree/independentView.js +1 -1
  274. package/dist/shared-tree/independentView.js.map +1 -1
  275. package/dist/shared-tree/index.d.ts +1 -1
  276. package/dist/shared-tree/index.d.ts.map +1 -1
  277. package/dist/shared-tree/index.js.map +1 -1
  278. package/dist/shared-tree/schematizeTree.d.ts +4 -4
  279. package/dist/shared-tree/schematizeTree.d.ts.map +1 -1
  280. package/dist/shared-tree/schematizeTree.js +2 -1
  281. package/dist/shared-tree/schematizeTree.js.map +1 -1
  282. package/dist/shared-tree/schematizingTreeView.d.ts +1 -5
  283. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  284. package/dist/shared-tree/schematizingTreeView.js +21 -35
  285. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  286. package/dist/shared-tree/sharedTree.d.ts +9 -3
  287. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  288. package/dist/shared-tree/sharedTree.js +4 -1
  289. package/dist/shared-tree/sharedTree.js.map +1 -1
  290. package/dist/shared-tree/sharedTreeChangeCodecs.d.ts +1 -0
  291. package/dist/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  292. package/dist/shared-tree/sharedTreeChangeCodecs.js +9 -1
  293. package/dist/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  294. package/dist/shared-tree/sharedTreeChangeFamily.d.ts +4 -4
  295. package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  296. package/dist/shared-tree/sharedTreeChangeFamily.js +2 -2
  297. package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  298. package/dist/shared-tree/sharedTreeEditBuilder.d.ts +16 -6
  299. package/dist/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
  300. package/dist/shared-tree/sharedTreeEditBuilder.js +14 -7
  301. package/dist/shared-tree/sharedTreeEditBuilder.js.map +1 -1
  302. package/dist/shared-tree/tree.d.ts +1 -1
  303. package/dist/shared-tree/tree.js.map +1 -1
  304. package/dist/shared-tree/treeAlpha.d.ts +1 -1
  305. package/dist/shared-tree/treeAlpha.js.map +1 -1
  306. package/dist/shared-tree/treeCheckout.d.ts +13 -11
  307. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  308. package/dist/shared-tree/treeCheckout.js +58 -10
  309. package/dist/shared-tree/treeCheckout.js.map +1 -1
  310. package/dist/shared-tree-core/branch.d.ts +3 -2
  311. package/dist/shared-tree-core/branch.d.ts.map +1 -1
  312. package/dist/shared-tree-core/branch.js +4 -3
  313. package/dist/shared-tree-core/branch.js.map +1 -1
  314. package/dist/shared-tree-core/editManager.d.ts +2 -2
  315. package/dist/shared-tree-core/editManager.d.ts.map +1 -1
  316. package/dist/shared-tree-core/editManager.js +9 -9
  317. package/dist/shared-tree-core/editManager.js.map +1 -1
  318. package/dist/shared-tree-core/editManagerCodecs.d.ts +4 -0
  319. package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  320. package/dist/shared-tree-core/editManagerCodecs.js +10 -2
  321. package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
  322. package/dist/shared-tree-core/editManagerCodecsCommons.d.ts +3 -3
  323. package/dist/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
  324. package/dist/shared-tree-core/editManagerCodecsCommons.js +2 -2
  325. package/dist/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
  326. package/dist/shared-tree-core/editManagerCodecsV1toV4.d.ts +2 -2
  327. package/dist/shared-tree-core/editManagerCodecsV1toV4.d.ts.map +1 -1
  328. package/dist/shared-tree-core/editManagerCodecsV1toV4.js +1 -1
  329. package/dist/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -1
  330. package/dist/shared-tree-core/editManagerCodecsVSharedBranches.d.ts +2 -2
  331. package/dist/shared-tree-core/editManagerCodecsVSharedBranches.d.ts.map +1 -1
  332. package/dist/shared-tree-core/editManagerCodecsVSharedBranches.js +1 -1
  333. package/dist/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
  334. package/dist/shared-tree-core/editManagerFormatCommons.d.ts +1 -0
  335. package/dist/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
  336. package/dist/shared-tree-core/editManagerFormatCommons.js +6 -0
  337. package/dist/shared-tree-core/editManagerFormatCommons.js.map +1 -1
  338. package/dist/shared-tree-core/editManagerFormatV1toV4.d.ts +2 -2
  339. package/dist/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -1
  340. package/dist/shared-tree-core/editManagerFormatV1toV4.js +1 -0
  341. package/dist/shared-tree-core/editManagerFormatV1toV4.js.map +1 -1
  342. package/dist/shared-tree-core/index.d.ts +2 -2
  343. package/dist/shared-tree-core/index.d.ts.map +1 -1
  344. package/dist/shared-tree-core/index.js +3 -1
  345. package/dist/shared-tree-core/index.js.map +1 -1
  346. package/dist/shared-tree-core/messageCodecV1ToV4.d.ts +1 -1
  347. package/dist/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
  348. package/dist/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
  349. package/dist/shared-tree-core/messageCodecs.d.ts +4 -0
  350. package/dist/shared-tree-core/messageCodecs.d.ts.map +1 -1
  351. package/dist/shared-tree-core/messageCodecs.js +12 -4
  352. package/dist/shared-tree-core/messageCodecs.js.map +1 -1
  353. package/dist/shared-tree-core/messageFormat.d.ts +1 -0
  354. package/dist/shared-tree-core/messageFormat.d.ts.map +1 -1
  355. package/dist/shared-tree-core/messageFormat.js +6 -0
  356. package/dist/shared-tree-core/messageFormat.js.map +1 -1
  357. package/dist/shared-tree-core/messageFormatV1ToV4.d.ts +2 -2
  358. package/dist/shared-tree-core/messageFormatV1ToV4.d.ts.map +1 -1
  359. package/dist/shared-tree-core/messageFormatV1ToV4.js +1 -0
  360. package/dist/shared-tree-core/messageFormatV1ToV4.js.map +1 -1
  361. package/dist/shared-tree-core/sharedTreeCore.d.ts +1 -0
  362. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  363. package/dist/shared-tree-core/sharedTreeCore.js +1 -1
  364. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  365. package/dist/simple-tree/api/index.d.ts +1 -1
  366. package/dist/simple-tree/api/index.d.ts.map +1 -1
  367. package/dist/simple-tree/api/index.js +2 -2
  368. package/dist/simple-tree/api/index.js.map +1 -1
  369. package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts +148 -29
  370. package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -1
  371. package/dist/simple-tree/api/snapshotCompatibilityChecker.js +180 -99
  372. package/dist/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
  373. package/dist/simple-tree/api/tree.d.ts +1 -1
  374. package/dist/simple-tree/api/tree.js.map +1 -1
  375. package/dist/simple-tree/api/treeBeta.d.ts +1 -1
  376. package/dist/simple-tree/api/treeBeta.js.map +1 -1
  377. package/dist/simple-tree/core/allowedTypes.d.ts +1 -1
  378. package/dist/simple-tree/core/allowedTypes.js.map +1 -1
  379. package/dist/simple-tree/core/unhydratedFlexTree.d.ts +17 -12
  380. package/dist/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  381. package/dist/simple-tree/core/unhydratedFlexTree.js +88 -8
  382. package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  383. package/dist/simple-tree/fieldSchema.d.ts +4 -4
  384. package/dist/simple-tree/fieldSchema.d.ts.map +1 -1
  385. package/dist/simple-tree/fieldSchema.js.map +1 -1
  386. package/dist/simple-tree/index.d.ts +3 -3
  387. package/dist/simple-tree/index.d.ts.map +1 -1
  388. package/dist/simple-tree/index.js +3 -3
  389. package/dist/simple-tree/index.js.map +1 -1
  390. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  391. package/dist/simple-tree/node-kinds/array/arrayNode.js +9 -16
  392. package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  393. package/dist/simple-tree/node-kinds/common.d.ts.map +1 -1
  394. package/dist/simple-tree/node-kinds/common.js +1 -1
  395. package/dist/simple-tree/node-kinds/common.js.map +1 -1
  396. package/dist/simple-tree/node-kinds/map/mapNode.js +2 -2
  397. package/dist/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  398. package/dist/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  399. package/dist/simple-tree/node-kinds/object/objectNode.js +19 -19
  400. package/dist/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  401. package/dist/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
  402. package/dist/simple-tree/node-kinds/record/recordNode.js +4 -2
  403. package/dist/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  404. package/dist/simple-tree/prepareForInsertion.d.ts +54 -47
  405. package/dist/simple-tree/prepareForInsertion.d.ts.map +1 -1
  406. package/dist/simple-tree/prepareForInsertion.js +183 -125
  407. package/dist/simple-tree/prepareForInsertion.js.map +1 -1
  408. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.d.ts +8 -3
  409. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
  410. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js +59 -19
  411. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
  412. package/dist/text/textDomainFormatted.d.ts +3 -3
  413. package/dist/text/textDomainFormatted.d.ts.map +1 -1
  414. package/dist/text/textDomainFormatted.js +48 -32
  415. package/dist/text/textDomainFormatted.js.map +1 -1
  416. package/dist/treeFactory.d.ts.map +1 -1
  417. package/dist/treeFactory.js +12 -2
  418. package/dist/treeFactory.js.map +1 -1
  419. package/dist/util/bTreeUtils.d.ts.map +1 -1
  420. package/dist/util/bTreeUtils.js +6 -6
  421. package/dist/util/bTreeUtils.js.map +1 -1
  422. package/dist/util/index.d.ts +1 -1
  423. package/dist/util/index.d.ts.map +1 -1
  424. package/dist/util/index.js +2 -1
  425. package/dist/util/index.js.map +1 -1
  426. package/dist/util/rangeMap.d.ts +23 -11
  427. package/dist/util/rangeMap.d.ts.map +1 -1
  428. package/dist/util/rangeMap.js +42 -10
  429. package/dist/util/rangeMap.js.map +1 -1
  430. package/lib/alpha.d.ts +3 -3
  431. package/lib/beta.d.ts +1 -0
  432. package/lib/codec/codec.d.ts +3 -39
  433. package/lib/codec/codec.d.ts.map +1 -1
  434. package/lib/codec/codec.js +4 -47
  435. package/lib/codec/codec.js.map +1 -1
  436. package/lib/codec/index.d.ts +1 -1
  437. package/lib/codec/index.d.ts.map +1 -1
  438. package/lib/codec/index.js +1 -1
  439. package/lib/codec/index.js.map +1 -1
  440. package/lib/codec/versioned/codec.d.ts +20 -7
  441. package/lib/codec/versioned/codec.d.ts.map +1 -1
  442. package/lib/codec/versioned/codec.js +59 -33
  443. package/lib/codec/versioned/codec.js.map +1 -1
  444. package/lib/core/change-family/changeFamily.d.ts +4 -1
  445. package/lib/core/change-family/changeFamily.d.ts.map +1 -1
  446. package/lib/core/change-family/changeFamily.js.map +1 -1
  447. package/lib/core/change-family/index.d.ts +1 -1
  448. package/lib/core/change-family/index.d.ts.map +1 -1
  449. package/lib/core/change-family/index.js.map +1 -1
  450. package/lib/core/index.d.ts +3 -3
  451. package/lib/core/index.d.ts.map +1 -1
  452. package/lib/core/index.js +2 -2
  453. package/lib/core/index.js.map +1 -1
  454. package/lib/core/rebase/changeRebaser.d.ts +6 -1
  455. package/lib/core/rebase/changeRebaser.d.ts.map +1 -1
  456. package/lib/core/rebase/changeRebaser.js.map +1 -1
  457. package/lib/core/rebase/index.d.ts +1 -1
  458. package/lib/core/rebase/index.d.ts.map +1 -1
  459. package/lib/core/rebase/index.js +1 -1
  460. package/lib/core/rebase/index.js.map +1 -1
  461. package/lib/core/rebase/types.d.ts +1 -0
  462. package/lib/core/rebase/types.d.ts.map +1 -1
  463. package/lib/core/rebase/types.js +3 -0
  464. package/lib/core/rebase/types.js.map +1 -1
  465. package/lib/core/rebase/utils.d.ts.map +1 -1
  466. package/lib/core/rebase/utils.js +25 -7
  467. package/lib/core/rebase/utils.js.map +1 -1
  468. package/lib/core/tree/delta.d.ts +5 -0
  469. package/lib/core/tree/delta.d.ts.map +1 -1
  470. package/lib/core/tree/delta.js.map +1 -1
  471. package/lib/core/tree/detachedFieldIndex.d.ts +13 -1
  472. package/lib/core/tree/detachedFieldIndex.d.ts.map +1 -1
  473. package/lib/core/tree/detachedFieldIndex.js +15 -2
  474. package/lib/core/tree/detachedFieldIndex.js.map +1 -1
  475. package/lib/core/tree/detachedFieldIndexCodecs.d.ts.map +1 -1
  476. package/lib/core/tree/detachedFieldIndexCodecs.js +6 -4
  477. package/lib/core/tree/detachedFieldIndexCodecs.js.map +1 -1
  478. package/lib/core/tree/detachedFieldIndexTypes.d.ts +4 -0
  479. package/lib/core/tree/detachedFieldIndexTypes.d.ts.map +1 -1
  480. package/lib/core/tree/detachedFieldIndexTypes.js.map +1 -1
  481. package/lib/core/tree/index.d.ts +2 -2
  482. package/lib/core/tree/index.d.ts.map +1 -1
  483. package/lib/core/tree/index.js +1 -1
  484. package/lib/core/tree/index.js.map +1 -1
  485. package/lib/core/tree/pathTree.d.ts +11 -3
  486. package/lib/core/tree/pathTree.d.ts.map +1 -1
  487. package/lib/core/tree/pathTree.js +12 -1
  488. package/lib/core/tree/pathTree.js.map +1 -1
  489. package/lib/core/tree/visitDelta.d.ts.map +1 -1
  490. package/lib/core/tree/visitDelta.js +17 -13
  491. package/lib/core/tree/visitDelta.js.map +1 -1
  492. package/lib/extensibleUnionNode.d.ts +97 -0
  493. package/lib/extensibleUnionNode.d.ts.map +1 -0
  494. package/lib/{extensibleSchemaUnion.js → extensibleUnionNode.js} +28 -18
  495. package/lib/extensibleUnionNode.js.map +1 -0
  496. package/lib/feature-libraries/changeAtomIdBTree.d.ts +3 -2
  497. package/lib/feature-libraries/changeAtomIdBTree.d.ts.map +1 -1
  498. package/lib/feature-libraries/changeAtomIdBTree.js +15 -3
  499. package/lib/feature-libraries/changeAtomIdBTree.js.map +1 -1
  500. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts +1 -1
  501. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  502. package/lib/feature-libraries/chunked-forest/codec/codecs.js +5 -5
  503. package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  504. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts +92 -44
  505. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  506. package/lib/feature-libraries/default-schema/defaultEditBuilder.js +217 -69
  507. package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  508. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  509. package/lib/feature-libraries/default-schema/defaultFieldKinds.js +12 -2
  510. package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  511. package/lib/feature-libraries/default-schema/index.d.ts +2 -1
  512. package/lib/feature-libraries/default-schema/index.d.ts.map +1 -1
  513. package/lib/feature-libraries/default-schema/index.js +2 -1
  514. package/lib/feature-libraries/default-schema/index.js.map +1 -1
  515. package/lib/feature-libraries/default-schema/locationBasedEditBuilder.d.ts +40 -0
  516. package/lib/feature-libraries/default-schema/locationBasedEditBuilder.d.ts.map +1 -0
  517. package/lib/feature-libraries/default-schema/locationBasedEditBuilder.js +149 -0
  518. package/lib/feature-libraries/default-schema/locationBasedEditBuilder.js.map +1 -0
  519. package/lib/feature-libraries/default-schema/mappedEditBuilder.d.ts +7 -6
  520. package/lib/feature-libraries/default-schema/mappedEditBuilder.d.ts.map +1 -1
  521. package/lib/feature-libraries/default-schema/mappedEditBuilder.js +15 -0
  522. package/lib/feature-libraries/default-schema/mappedEditBuilder.js.map +1 -1
  523. package/lib/feature-libraries/deltaUtils.d.ts +1 -0
  524. package/lib/feature-libraries/deltaUtils.d.ts.map +1 -1
  525. package/lib/feature-libraries/deltaUtils.js +5 -1
  526. package/lib/feature-libraries/deltaUtils.js.map +1 -1
  527. package/lib/feature-libraries/flex-tree/context.d.ts +9 -0
  528. package/lib/feature-libraries/flex-tree/context.d.ts.map +1 -1
  529. package/lib/feature-libraries/flex-tree/context.js +6 -0
  530. package/lib/feature-libraries/flex-tree/context.js.map +1 -1
  531. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts +6 -6
  532. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  533. package/lib/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  534. package/lib/feature-libraries/flex-tree/lazyField.d.ts +8 -7
  535. package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  536. package/lib/feature-libraries/flex-tree/lazyField.js +40 -9
  537. package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
  538. package/lib/feature-libraries/forest-summary/codec.d.ts.map +1 -1
  539. package/lib/feature-libraries/forest-summary/codec.js +8 -2
  540. package/lib/feature-libraries/forest-summary/codec.js.map +1 -1
  541. package/lib/feature-libraries/forest-summary/formatCommon.d.ts +3 -3
  542. package/lib/feature-libraries/forest-summary/formatCommon.d.ts.map +1 -1
  543. package/lib/feature-libraries/forest-summary/formatCommon.js.map +1 -1
  544. package/lib/feature-libraries/forest-summary/formatV1.d.ts +2 -3
  545. package/lib/feature-libraries/forest-summary/formatV1.d.ts.map +1 -1
  546. package/lib/feature-libraries/forest-summary/formatV1.js +1 -2
  547. package/lib/feature-libraries/forest-summary/formatV1.js.map +1 -1
  548. package/lib/feature-libraries/forest-summary/formatV2.d.ts +2 -3
  549. package/lib/feature-libraries/forest-summary/formatV2.d.ts.map +1 -1
  550. package/lib/feature-libraries/forest-summary/formatV2.js +1 -2
  551. package/lib/feature-libraries/forest-summary/formatV2.js.map +1 -1
  552. package/lib/feature-libraries/index.d.ts +3 -3
  553. package/lib/feature-libraries/index.d.ts.map +1 -1
  554. package/lib/feature-libraries/index.js +3 -3
  555. package/lib/feature-libraries/index.js.map +1 -1
  556. package/lib/feature-libraries/mitigatedChangeFamily.d.ts.map +1 -1
  557. package/lib/feature-libraries/mitigatedChangeFamily.js +2 -2
  558. package/lib/feature-libraries/mitigatedChangeFamily.js.map +1 -1
  559. package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts +100 -24
  560. package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
  561. package/lib/feature-libraries/modular-schema/crossFieldQueries.js +7 -10
  562. package/lib/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
  563. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts +85 -51
  564. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  565. package/lib/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  566. package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  567. package/lib/feature-libraries/modular-schema/genericFieldKind.js +4 -9
  568. package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  569. package/lib/feature-libraries/modular-schema/index.d.ts +3 -3
  570. package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
  571. package/lib/feature-libraries/modular-schema/index.js +1 -1
  572. package/lib/feature-libraries/modular-schema/index.js.map +1 -1
  573. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts +20 -24
  574. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -1
  575. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js +268 -145
  576. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
  577. package/lib/feature-libraries/modular-schema/modularChangeCodecV2.d.ts.map +1 -1
  578. package/lib/feature-libraries/modular-schema/modularChangeCodecV2.js +1 -1
  579. package/lib/feature-libraries/modular-schema/modularChangeCodecV2.js.map +1 -1
  580. package/lib/feature-libraries/modular-schema/modularChangeCodecV3.d.ts +15 -0
  581. package/lib/feature-libraries/modular-schema/modularChangeCodecV3.d.ts.map +1 -0
  582. package/lib/feature-libraries/modular-schema/modularChangeCodecV3.js +292 -0
  583. package/lib/feature-libraries/modular-schema/modularChangeCodecV3.js.map +1 -0
  584. package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts +1 -0
  585. package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  586. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js +8 -0
  587. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  588. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +56 -22
  589. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  590. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +1387 -468
  591. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  592. package/lib/feature-libraries/modular-schema/modularChangeFormatV1.d.ts.map +1 -1
  593. package/lib/feature-libraries/modular-schema/modularChangeFormatV1.js.map +1 -1
  594. package/lib/feature-libraries/modular-schema/modularChangeFormatV2.d.ts +1 -2
  595. package/lib/feature-libraries/modular-schema/modularChangeFormatV2.d.ts.map +1 -1
  596. package/lib/feature-libraries/modular-schema/modularChangeFormatV2.js +1 -1
  597. package/lib/feature-libraries/modular-schema/modularChangeFormatV2.js.map +1 -1
  598. package/lib/feature-libraries/modular-schema/modularChangeFormatV3.d.ts +74 -0
  599. package/lib/feature-libraries/modular-schema/modularChangeFormatV3.d.ts.map +1 -0
  600. package/lib/feature-libraries/modular-schema/modularChangeFormatV3.js +32 -0
  601. package/lib/feature-libraries/modular-schema/modularChangeFormatV3.js.map +1 -0
  602. package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts +49 -10
  603. package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
  604. package/lib/feature-libraries/modular-schema/modularChangeTypes.js +1 -1
  605. package/lib/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
  606. package/lib/feature-libraries/optional-field/optionalField.d.ts +13 -32
  607. package/lib/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
  608. package/lib/feature-libraries/optional-field/optionalField.js +254 -442
  609. package/lib/feature-libraries/optional-field/optionalField.js.map +1 -1
  610. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV3.d.ts +23 -0
  611. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV3.d.ts.map +1 -0
  612. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV3.js +27 -0
  613. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV3.js.map +1 -0
  614. package/lib/feature-libraries/optional-field/optionalFieldChangeTypes.d.ts +31 -31
  615. package/lib/feature-libraries/optional-field/optionalFieldChangeTypes.d.ts.map +1 -1
  616. package/lib/feature-libraries/optional-field/optionalFieldChangeTypes.js.map +1 -1
  617. package/lib/feature-libraries/optional-field/optionalFieldCodecV2.d.ts +1 -1
  618. package/lib/feature-libraries/optional-field/optionalFieldCodecV2.d.ts.map +1 -1
  619. package/lib/feature-libraries/optional-field/optionalFieldCodecV2.js +55 -26
  620. package/lib/feature-libraries/optional-field/optionalFieldCodecV2.js.map +1 -1
  621. package/lib/feature-libraries/optional-field/optionalFieldCodecV3.d.ts +12 -0
  622. package/lib/feature-libraries/optional-field/optionalFieldCodecV3.d.ts.map +1 -0
  623. package/lib/feature-libraries/optional-field/optionalFieldCodecV3.js +53 -0
  624. package/lib/feature-libraries/optional-field/optionalFieldCodecV3.js.map +1 -0
  625. package/lib/feature-libraries/optional-field/optionalFieldCodecs.d.ts.map +1 -1
  626. package/lib/feature-libraries/optional-field/optionalFieldCodecs.js +5 -1
  627. package/lib/feature-libraries/optional-field/optionalFieldCodecs.js.map +1 -1
  628. package/lib/feature-libraries/optional-field/requiredField.d.ts +3 -2
  629. package/lib/feature-libraries/optional-field/requiredField.d.ts.map +1 -1
  630. package/lib/feature-libraries/optional-field/requiredField.js +5 -1
  631. package/lib/feature-libraries/optional-field/requiredField.js.map +1 -1
  632. package/lib/feature-libraries/schema-index/codec.d.ts.map +1 -1
  633. package/lib/feature-libraries/schema-index/codec.js +6 -4
  634. package/lib/feature-libraries/schema-index/codec.js.map +1 -1
  635. package/lib/feature-libraries/sequence-field/compose.d.ts +6 -7
  636. package/lib/feature-libraries/sequence-field/compose.d.ts.map +1 -1
  637. package/lib/feature-libraries/sequence-field/compose.js +83 -261
  638. package/lib/feature-libraries/sequence-field/compose.js.map +1 -1
  639. package/lib/feature-libraries/sequence-field/helperTypes.d.ts +14 -10
  640. package/lib/feature-libraries/sequence-field/helperTypes.d.ts.map +1 -1
  641. package/lib/feature-libraries/sequence-field/helperTypes.js.map +1 -1
  642. package/lib/feature-libraries/sequence-field/invert.d.ts +3 -3
  643. package/lib/feature-libraries/sequence-field/invert.d.ts.map +1 -1
  644. package/lib/feature-libraries/sequence-field/invert.js +67 -169
  645. package/lib/feature-libraries/sequence-field/invert.js.map +1 -1
  646. package/lib/feature-libraries/sequence-field/markQueue.d.ts +2 -2
  647. package/lib/feature-libraries/sequence-field/markQueue.d.ts.map +1 -1
  648. package/lib/feature-libraries/sequence-field/markQueue.js.map +1 -1
  649. package/lib/feature-libraries/sequence-field/moveEffectTable.d.ts +4 -56
  650. package/lib/feature-libraries/sequence-field/moveEffectTable.d.ts.map +1 -1
  651. package/lib/feature-libraries/sequence-field/moveEffectTable.js +6 -84
  652. package/lib/feature-libraries/sequence-field/moveEffectTable.js.map +1 -1
  653. package/lib/feature-libraries/sequence-field/rebase.d.ts +3 -3
  654. package/lib/feature-libraries/sequence-field/rebase.d.ts.map +1 -1
  655. package/lib/feature-libraries/sequence-field/rebase.js +111 -118
  656. package/lib/feature-libraries/sequence-field/rebase.js.map +1 -1
  657. package/lib/feature-libraries/sequence-field/replaceRevisions.d.ts.map +1 -1
  658. package/lib/feature-libraries/sequence-field/replaceRevisions.js +19 -32
  659. package/lib/feature-libraries/sequence-field/replaceRevisions.js.map +1 -1
  660. package/lib/feature-libraries/sequence-field/sequenceFieldChangeHandler.d.ts.map +1 -1
  661. package/lib/feature-libraries/sequence-field/sequenceFieldChangeHandler.js +2 -3
  662. package/lib/feature-libraries/sequence-field/sequenceFieldChangeHandler.js.map +1 -1
  663. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts +22 -4
  664. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
  665. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js +379 -182
  666. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
  667. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts.map +1 -1
  668. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.js +21 -63
  669. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -1
  670. package/lib/feature-libraries/sequence-field/sequenceFieldEditor.d.ts +2 -2
  671. package/lib/feature-libraries/sequence-field/sequenceFieldEditor.d.ts.map +1 -1
  672. package/lib/feature-libraries/sequence-field/sequenceFieldEditor.js +13 -13
  673. package/lib/feature-libraries/sequence-field/sequenceFieldEditor.js.map +1 -1
  674. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts +3 -2
  675. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts.map +1 -1
  676. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.js +16 -111
  677. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
  678. package/lib/feature-libraries/sequence-field/types.d.ts +37 -74
  679. package/lib/feature-libraries/sequence-field/types.d.ts.map +1 -1
  680. package/lib/feature-libraries/sequence-field/types.js.map +1 -1
  681. package/lib/feature-libraries/sequence-field/utils.d.ts +20 -25
  682. package/lib/feature-libraries/sequence-field/utils.d.ts.map +1 -1
  683. package/lib/feature-libraries/sequence-field/utils.js +155 -313
  684. package/lib/feature-libraries/sequence-field/utils.js.map +1 -1
  685. package/lib/index.d.ts +2 -2
  686. package/lib/index.d.ts.map +1 -1
  687. package/lib/index.js +2 -2
  688. package/lib/index.js.map +1 -1
  689. package/lib/legacy.d.ts +1 -0
  690. package/lib/packageVersion.d.ts +1 -1
  691. package/lib/packageVersion.d.ts.map +1 -1
  692. package/lib/packageVersion.js +1 -1
  693. package/lib/packageVersion.js.map +1 -1
  694. package/lib/shared-tree/independentView.d.ts.map +1 -1
  695. package/lib/shared-tree/independentView.js +1 -1
  696. package/lib/shared-tree/independentView.js.map +1 -1
  697. package/lib/shared-tree/index.d.ts +1 -1
  698. package/lib/shared-tree/index.d.ts.map +1 -1
  699. package/lib/shared-tree/index.js.map +1 -1
  700. package/lib/shared-tree/schematizeTree.d.ts +4 -4
  701. package/lib/shared-tree/schematizeTree.d.ts.map +1 -1
  702. package/lib/shared-tree/schematizeTree.js +3 -2
  703. package/lib/shared-tree/schematizeTree.js.map +1 -1
  704. package/lib/shared-tree/schematizingTreeView.d.ts +1 -5
  705. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  706. package/lib/shared-tree/schematizingTreeView.js +24 -38
  707. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  708. package/lib/shared-tree/sharedTree.d.ts +9 -3
  709. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  710. package/lib/shared-tree/sharedTree.js +4 -1
  711. package/lib/shared-tree/sharedTree.js.map +1 -1
  712. package/lib/shared-tree/sharedTreeChangeCodecs.d.ts +1 -0
  713. package/lib/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  714. package/lib/shared-tree/sharedTreeChangeCodecs.js +9 -1
  715. package/lib/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  716. package/lib/shared-tree/sharedTreeChangeFamily.d.ts +4 -4
  717. package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  718. package/lib/shared-tree/sharedTreeChangeFamily.js +3 -3
  719. package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  720. package/lib/shared-tree/sharedTreeEditBuilder.d.ts +16 -6
  721. package/lib/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
  722. package/lib/shared-tree/sharedTreeEditBuilder.js +12 -6
  723. package/lib/shared-tree/sharedTreeEditBuilder.js.map +1 -1
  724. package/lib/shared-tree/tree.d.ts +1 -1
  725. package/lib/shared-tree/tree.js.map +1 -1
  726. package/lib/shared-tree/treeAlpha.d.ts +1 -1
  727. package/lib/shared-tree/treeAlpha.js.map +1 -1
  728. package/lib/shared-tree/treeCheckout.d.ts +13 -11
  729. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  730. package/lib/shared-tree/treeCheckout.js +61 -13
  731. package/lib/shared-tree/treeCheckout.js.map +1 -1
  732. package/lib/shared-tree-core/branch.d.ts +3 -2
  733. package/lib/shared-tree-core/branch.d.ts.map +1 -1
  734. package/lib/shared-tree-core/branch.js +4 -3
  735. package/lib/shared-tree-core/branch.js.map +1 -1
  736. package/lib/shared-tree-core/editManager.d.ts +2 -2
  737. package/lib/shared-tree-core/editManager.d.ts.map +1 -1
  738. package/lib/shared-tree-core/editManager.js +9 -9
  739. package/lib/shared-tree-core/editManager.js.map +1 -1
  740. package/lib/shared-tree-core/editManagerCodecs.d.ts +4 -0
  741. package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  742. package/lib/shared-tree-core/editManagerCodecs.js +8 -1
  743. package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
  744. package/lib/shared-tree-core/editManagerCodecsCommons.d.ts +3 -3
  745. package/lib/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
  746. package/lib/shared-tree-core/editManagerCodecsCommons.js +2 -2
  747. package/lib/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
  748. package/lib/shared-tree-core/editManagerCodecsV1toV4.d.ts +2 -2
  749. package/lib/shared-tree-core/editManagerCodecsV1toV4.d.ts.map +1 -1
  750. package/lib/shared-tree-core/editManagerCodecsV1toV4.js +2 -2
  751. package/lib/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -1
  752. package/lib/shared-tree-core/editManagerCodecsVSharedBranches.d.ts +2 -2
  753. package/lib/shared-tree-core/editManagerCodecsVSharedBranches.d.ts.map +1 -1
  754. package/lib/shared-tree-core/editManagerCodecsVSharedBranches.js +2 -2
  755. package/lib/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
  756. package/lib/shared-tree-core/editManagerFormatCommons.d.ts +1 -0
  757. package/lib/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
  758. package/lib/shared-tree-core/editManagerFormatCommons.js +6 -0
  759. package/lib/shared-tree-core/editManagerFormatCommons.js.map +1 -1
  760. package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts +2 -2
  761. package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -1
  762. package/lib/shared-tree-core/editManagerFormatV1toV4.js +1 -0
  763. package/lib/shared-tree-core/editManagerFormatV1toV4.js.map +1 -1
  764. package/lib/shared-tree-core/index.d.ts +2 -2
  765. package/lib/shared-tree-core/index.d.ts.map +1 -1
  766. package/lib/shared-tree-core/index.js +2 -2
  767. package/lib/shared-tree-core/index.js.map +1 -1
  768. package/lib/shared-tree-core/messageCodecV1ToV4.d.ts +1 -1
  769. package/lib/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
  770. package/lib/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
  771. package/lib/shared-tree-core/messageCodecs.d.ts +4 -0
  772. package/lib/shared-tree-core/messageCodecs.d.ts.map +1 -1
  773. package/lib/shared-tree-core/messageCodecs.js +10 -3
  774. package/lib/shared-tree-core/messageCodecs.js.map +1 -1
  775. package/lib/shared-tree-core/messageFormat.d.ts +1 -0
  776. package/lib/shared-tree-core/messageFormat.d.ts.map +1 -1
  777. package/lib/shared-tree-core/messageFormat.js +6 -0
  778. package/lib/shared-tree-core/messageFormat.js.map +1 -1
  779. package/lib/shared-tree-core/messageFormatV1ToV4.d.ts +2 -2
  780. package/lib/shared-tree-core/messageFormatV1ToV4.d.ts.map +1 -1
  781. package/lib/shared-tree-core/messageFormatV1ToV4.js +1 -0
  782. package/lib/shared-tree-core/messageFormatV1ToV4.js.map +1 -1
  783. package/lib/shared-tree-core/sharedTreeCore.d.ts +1 -0
  784. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  785. package/lib/shared-tree-core/sharedTreeCore.js +1 -1
  786. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  787. package/lib/simple-tree/api/index.d.ts +1 -1
  788. package/lib/simple-tree/api/index.d.ts.map +1 -1
  789. package/lib/simple-tree/api/index.js +1 -1
  790. package/lib/simple-tree/api/index.js.map +1 -1
  791. package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts +148 -29
  792. package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -1
  793. package/lib/simple-tree/api/snapshotCompatibilityChecker.js +179 -98
  794. package/lib/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
  795. package/lib/simple-tree/api/tree.d.ts +1 -1
  796. package/lib/simple-tree/api/tree.js.map +1 -1
  797. package/lib/simple-tree/api/treeBeta.d.ts +1 -1
  798. package/lib/simple-tree/api/treeBeta.js.map +1 -1
  799. package/lib/simple-tree/core/allowedTypes.d.ts +1 -1
  800. package/lib/simple-tree/core/allowedTypes.js.map +1 -1
  801. package/lib/simple-tree/core/unhydratedFlexTree.d.ts +17 -12
  802. package/lib/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  803. package/lib/simple-tree/core/unhydratedFlexTree.js +87 -8
  804. package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  805. package/lib/simple-tree/fieldSchema.d.ts +4 -4
  806. package/lib/simple-tree/fieldSchema.d.ts.map +1 -1
  807. package/lib/simple-tree/fieldSchema.js.map +1 -1
  808. package/lib/simple-tree/index.d.ts +3 -3
  809. package/lib/simple-tree/index.d.ts.map +1 -1
  810. package/lib/simple-tree/index.js +2 -2
  811. package/lib/simple-tree/index.js.map +1 -1
  812. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  813. package/lib/simple-tree/node-kinds/array/arrayNode.js +11 -18
  814. package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  815. package/lib/simple-tree/node-kinds/common.d.ts.map +1 -1
  816. package/lib/simple-tree/node-kinds/common.js +2 -2
  817. package/lib/simple-tree/node-kinds/common.js.map +1 -1
  818. package/lib/simple-tree/node-kinds/map/mapNode.js +2 -2
  819. package/lib/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  820. package/lib/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  821. package/lib/simple-tree/node-kinds/object/objectNode.js +20 -20
  822. package/lib/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  823. package/lib/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
  824. package/lib/simple-tree/node-kinds/record/recordNode.js +4 -2
  825. package/lib/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  826. package/lib/simple-tree/prepareForInsertion.d.ts +54 -47
  827. package/lib/simple-tree/prepareForInsertion.d.ts.map +1 -1
  828. package/lib/simple-tree/prepareForInsertion.js +184 -125
  829. package/lib/simple-tree/prepareForInsertion.js.map +1 -1
  830. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.d.ts +8 -3
  831. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
  832. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js +56 -17
  833. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
  834. package/lib/text/textDomainFormatted.d.ts +3 -3
  835. package/lib/text/textDomainFormatted.d.ts.map +1 -1
  836. package/lib/text/textDomainFormatted.js +30 -14
  837. package/lib/text/textDomainFormatted.js.map +1 -1
  838. package/lib/treeFactory.d.ts.map +1 -1
  839. package/lib/treeFactory.js +13 -3
  840. package/lib/treeFactory.js.map +1 -1
  841. package/lib/util/bTreeUtils.d.ts.map +1 -1
  842. package/lib/util/bTreeUtils.js +6 -6
  843. package/lib/util/bTreeUtils.js.map +1 -1
  844. package/lib/util/index.d.ts +1 -1
  845. package/lib/util/index.d.ts.map +1 -1
  846. package/lib/util/index.js +1 -1
  847. package/lib/util/index.js.map +1 -1
  848. package/lib/util/rangeMap.d.ts +23 -11
  849. package/lib/util/rangeMap.d.ts.map +1 -1
  850. package/lib/util/rangeMap.js +40 -9
  851. package/lib/util/rangeMap.js.map +1 -1
  852. package/package.json +23 -23
  853. package/src/codec/codec.ts +10 -112
  854. package/src/codec/index.ts +0 -3
  855. package/src/codec/versioned/codec.ts +119 -83
  856. package/src/core/change-family/changeFamily.ts +5 -0
  857. package/src/core/change-family/index.ts +1 -0
  858. package/src/core/index.ts +4 -1
  859. package/src/core/rebase/changeRebaser.ts +6 -1
  860. package/src/core/rebase/index.ts +1 -0
  861. package/src/core/rebase/types.ts +4 -0
  862. package/src/core/rebase/utils.ts +31 -7
  863. package/src/core/tree/delta.ts +6 -0
  864. package/src/core/tree/detachedFieldIndex.ts +29 -1
  865. package/src/core/tree/detachedFieldIndexCodecs.ts +6 -4
  866. package/src/core/tree/detachedFieldIndexTypes.ts +5 -0
  867. package/src/core/tree/index.ts +13 -12
  868. package/src/core/tree/pathTree.ts +16 -4
  869. package/src/core/tree/visitDelta.ts +31 -11
  870. package/src/{extensibleSchemaUnion.ts → extensibleUnionNode.ts} +61 -19
  871. package/src/feature-libraries/changeAtomIdBTree.ts +28 -3
  872. package/src/feature-libraries/chunked-forest/codec/codecs.ts +5 -11
  873. package/src/feature-libraries/default-schema/defaultEditBuilder.ts +369 -127
  874. package/src/feature-libraries/default-schema/defaultFieldKinds.ts +13 -4
  875. package/src/feature-libraries/default-schema/index.ts +16 -5
  876. package/src/feature-libraries/default-schema/locationBasedEditBuilder.ts +231 -0
  877. package/src/feature-libraries/default-schema/mappedEditBuilder.ts +35 -9
  878. package/src/feature-libraries/deltaUtils.ts +6 -1
  879. package/src/feature-libraries/flex-tree/context.ts +17 -0
  880. package/src/feature-libraries/flex-tree/flexTreeTypes.ts +7 -8
  881. package/src/feature-libraries/flex-tree/lazyField.ts +65 -24
  882. package/src/feature-libraries/forest-summary/codec.ts +8 -7
  883. package/src/feature-libraries/forest-summary/formatCommon.ts +5 -3
  884. package/src/feature-libraries/forest-summary/formatV1.ts +1 -3
  885. package/src/feature-libraries/forest-summary/formatV2.ts +1 -3
  886. package/src/feature-libraries/index.ts +22 -9
  887. package/src/feature-libraries/mitigatedChangeFamily.ts +3 -1
  888. package/src/feature-libraries/modular-schema/crossFieldQueries.ts +144 -47
  889. package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +113 -58
  890. package/src/feature-libraries/modular-schema/genericFieldKind.ts +7 -18
  891. package/src/feature-libraries/modular-schema/index.ts +16 -16
  892. package/src/feature-libraries/modular-schema/modularChangeCodecV1.ts +626 -352
  893. package/src/feature-libraries/modular-schema/modularChangeCodecV2.ts +1 -0
  894. package/src/feature-libraries/modular-schema/modularChangeCodecV3.ts +649 -0
  895. package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +14 -0
  896. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +2694 -748
  897. package/src/feature-libraries/modular-schema/modularChangeFormatV1.ts +1 -0
  898. package/src/feature-libraries/modular-schema/modularChangeFormatV2.ts +1 -1
  899. package/src/feature-libraries/modular-schema/modularChangeFormatV3.ts +67 -0
  900. package/src/feature-libraries/modular-schema/modularChangeTypes.ts +62 -10
  901. package/src/feature-libraries/optional-field/optionalField.ts +359 -568
  902. package/src/feature-libraries/optional-field/optionalFieldChangeFormatV3.ts +45 -0
  903. package/src/feature-libraries/optional-field/optionalFieldChangeTypes.ts +31 -35
  904. package/src/feature-libraries/optional-field/optionalFieldCodecV2.ts +89 -35
  905. package/src/feature-libraries/optional-field/optionalFieldCodecV3.ts +94 -0
  906. package/src/feature-libraries/optional-field/optionalFieldCodecs.ts +5 -1
  907. package/src/feature-libraries/optional-field/requiredField.ts +15 -2
  908. package/src/feature-libraries/schema-index/codec.ts +6 -4
  909. package/src/feature-libraries/sequence-field/compose.ts +137 -522
  910. package/src/feature-libraries/sequence-field/helperTypes.ts +34 -19
  911. package/src/feature-libraries/sequence-field/invert.ts +102 -228
  912. package/src/feature-libraries/sequence-field/markQueue.ts +2 -2
  913. package/src/feature-libraries/sequence-field/moveEffectTable.ts +8 -195
  914. package/src/feature-libraries/sequence-field/rebase.ts +171 -207
  915. package/src/feature-libraries/sequence-field/replaceRevisions.ts +26 -52
  916. package/src/feature-libraries/sequence-field/sequenceFieldChangeHandler.ts +8 -3
  917. package/src/feature-libraries/sequence-field/sequenceFieldCodecV2.ts +677 -229
  918. package/src/feature-libraries/sequence-field/sequenceFieldCodecV3.ts +56 -70
  919. package/src/feature-libraries/sequence-field/sequenceFieldEditor.ts +28 -30
  920. package/src/feature-libraries/sequence-field/sequenceFieldToDelta.ts +21 -131
  921. package/src/feature-libraries/sequence-field/types.ts +40 -79
  922. package/src/feature-libraries/sequence-field/utils.ts +211 -370
  923. package/src/index.ts +3 -3
  924. package/src/packageVersion.ts +1 -1
  925. package/src/shared-tree/independentView.ts +12 -6
  926. package/src/shared-tree/index.ts +3 -2
  927. package/src/shared-tree/schematizeTree.ts +21 -8
  928. package/src/shared-tree/schematizingTreeView.ts +38 -68
  929. package/src/shared-tree/sharedTree.ts +30 -15
  930. package/src/shared-tree/sharedTreeChangeCodecs.ts +10 -2
  931. package/src/shared-tree/sharedTreeChangeFamily.ts +7 -4
  932. package/src/shared-tree/sharedTreeEditBuilder.ts +43 -8
  933. package/src/shared-tree/tree.ts +1 -1
  934. package/src/shared-tree/treeAlpha.ts +1 -1
  935. package/src/shared-tree/treeCheckout.ts +95 -21
  936. package/src/shared-tree-core/branch.ts +8 -2
  937. package/src/shared-tree-core/editManager.ts +16 -2
  938. package/src/shared-tree-core/editManagerCodecs.ts +11 -1
  939. package/src/shared-tree-core/editManagerCodecsCommons.ts +7 -7
  940. package/src/shared-tree-core/editManagerCodecsV1toV4.ts +3 -10
  941. package/src/shared-tree-core/editManagerCodecsVSharedBranches.ts +3 -10
  942. package/src/shared-tree-core/editManagerFormatCommons.ts +6 -0
  943. package/src/shared-tree-core/editManagerFormatV1toV4.ts +3 -1
  944. package/src/shared-tree-core/index.ts +2 -0
  945. package/src/shared-tree-core/messageCodecV1ToV4.ts +2 -1
  946. package/src/shared-tree-core/messageCodecs.ts +13 -7
  947. package/src/shared-tree-core/messageFormat.ts +6 -0
  948. package/src/shared-tree-core/messageFormatV1ToV4.ts +3 -1
  949. package/src/shared-tree-core/sharedTreeCore.ts +4 -1
  950. package/src/simple-tree/api/index.ts +2 -2
  951. package/src/simple-tree/api/snapshotCompatibilityChecker.ts +344 -142
  952. package/src/simple-tree/api/tree.ts +1 -1
  953. package/src/simple-tree/api/treeBeta.ts +1 -1
  954. package/src/simple-tree/core/allowedTypes.ts +1 -1
  955. package/src/simple-tree/core/unhydratedFlexTree.ts +124 -35
  956. package/src/simple-tree/fieldSchema.ts +6 -4
  957. package/src/simple-tree/index.ts +4 -3
  958. package/src/simple-tree/node-kinds/array/arrayNode.ts +20 -24
  959. package/src/simple-tree/node-kinds/common.ts +2 -5
  960. package/src/simple-tree/node-kinds/map/mapNode.ts +4 -4
  961. package/src/simple-tree/node-kinds/object/objectNode.ts +26 -26
  962. package/src/simple-tree/node-kinds/record/recordNode.ts +10 -9
  963. package/src/simple-tree/prepareForInsertion.ts +342 -200
  964. package/src/simple-tree/unhydratedFlexTreeFromInsertable.ts +83 -22
  965. package/src/text/textDomainFormatted.ts +37 -17
  966. package/src/treeFactory.ts +16 -4
  967. package/src/util/bTreeUtils.ts +10 -6
  968. package/src/util/index.ts +3 -0
  969. package/src/util/rangeMap.ts +67 -22
  970. package/api-extractor-lint.json +0 -4
  971. package/dist/extensibleSchemaUnion.d.ts +0 -72
  972. package/dist/extensibleSchemaUnion.d.ts.map +0 -1
  973. package/dist/extensibleSchemaUnion.js.map +0 -1
  974. package/dist/feature-libraries/sequence-field/relevantRemovedRoots.d.ts +0 -9
  975. package/dist/feature-libraries/sequence-field/relevantRemovedRoots.d.ts.map +0 -1
  976. package/dist/feature-libraries/sequence-field/relevantRemovedRoots.js +0 -50
  977. package/dist/feature-libraries/sequence-field/relevantRemovedRoots.js.map +0 -1
  978. package/docs/main/sequence-field/move-composition.md +0 -46
  979. package/lib/extensibleSchemaUnion.d.ts +0 -72
  980. package/lib/extensibleSchemaUnion.d.ts.map +0 -1
  981. package/lib/extensibleSchemaUnion.js.map +0 -1
  982. package/lib/feature-libraries/sequence-field/relevantRemovedRoots.d.ts +0 -9
  983. package/lib/feature-libraries/sequence-field/relevantRemovedRoots.d.ts.map +0 -1
  984. package/lib/feature-libraries/sequence-field/relevantRemovedRoots.js +0 -46
  985. package/lib/feature-libraries/sequence-field/relevantRemovedRoots.js.map +0 -1
  986. package/src/feature-libraries/sequence-field/relevantRemovedRoots.ts +0 -57
@@ -2,12 +2,13 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
+ import { UsageError } from "@fluidframework/telemetry-utils/internal";
5
6
  import { TreeAlpha, Tree } from "./shared-tree/index.js";
6
- import { createCustomizedFluidFrameworkScopedFactory, eraseSchemaDetailsSubclassable, SchemaFactory, TreeBeta, } from "./simple-tree/index.js";
7
+ import { createCustomizedFluidFrameworkScopedFactory, eraseSchemaDetailsSubclassable, getInnerNode, SchemaFactory, TreeBeta, } from "./simple-tree/index.js";
7
8
  /**
8
- * Utilities for creating extensible schema unions.
9
+ * Utilities for creating extensible unions using a node.
9
10
  * @remarks
10
- * Use {@link ExtensibleSchemaUnion.extensibleSchemaUnion} to create the union schema.
11
+ * Use {@link ExtensibleUnionNode.createSchema} to create the union schema.
11
12
  *
12
13
  * Unlike a schema union created using {@link SchemaStaticsBeta.staged | staged} allowed types, this union allows for unknown future types to exist in addition to the known types.
13
14
  * This allows for faster roll-outs of new types without waiting for old clients to be updated to be aware of them.
@@ -19,49 +20,58 @@ import { createCustomizedFluidFrameworkScopedFactory, eraseSchemaDetailsSubclass
19
20
  *
20
21
  * @example
21
22
  * ```typescript
22
- * const sf = new SchemaFactoryBeta("extensibleSchemaUnionExample.items");
23
+ * const sf = new SchemaFactoryBeta("extensibleUnionNodeExample.items");
23
24
  * class ItemA extends sf.object("A", { x: sf.string }) {}
24
25
  * class ItemB extends sf.object("B", { x: sf.number }) {}
25
26
  *
26
- * class AnyItem extends ExtensibleSchemaUnion.extensibleSchemaUnion(
27
+ * class AnyItem extends ExtensibleUnionNode.createSchema(
27
28
  * [ItemA, ItemB], // Future versions may add more members here
28
29
  * sf,
29
30
  * "ExtensibleUnion",
30
31
  * ) {}
31
32
  * // Instances of the union are created using `create`.
32
33
  * const anyItem = AnyItem.create(new ItemA({ x: "hello" }));
33
- * // Reading the content from the union is done via `child`,
34
+ * // Reading the content from the union is done via the `union` property,
34
35
  * // which can be `undefined` to handle the case where a future version of this schema allows a type unknown to the current version.
35
- * const childNode: ItemA | ItemB | undefined = anyItem.child;
36
+ * const childNode: ItemA | ItemB | undefined = anyItem.union;
36
37
  * // To determine which member of the union was present, its schema can be inspected:
37
38
  * const aSchema = Tree.schema(childNode ?? assert.fail("No child"));
38
39
  * assert.equal(aSchema, ItemA);
39
40
  * ```
40
- * @alpha
41
+ * @beta
41
42
  */
42
- export var ExtensibleSchemaUnion;
43
- (function (ExtensibleSchemaUnion) {
43
+ export var ExtensibleUnionNode;
44
+ (function (ExtensibleUnionNode) {
44
45
  /**
45
46
  * Create an extensible schema union which currently supports the types in `types`,
46
47
  * but tolerates collaboration with future versions that may include additional types.
47
48
  * @remarks
48
- * See {@link ExtensibleSchemaUnion} for an example use.
49
- * @alpha
49
+ * See {@link ExtensibleUnionNode} for an example use.
50
+ * @beta
50
51
  */
51
52
  // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
52
- function extensibleSchemaUnion(types, inputSchemaFactory, name) {
53
+ function createSchema(types, inputSchemaFactory, name) {
53
54
  const record = {};
54
55
  for (const type of types) {
55
56
  record[`_${type.identifier}`] = SchemaFactory.optional(type, { key: type.identifier });
56
57
  }
57
- const schemaFactory = createCustomizedFluidFrameworkScopedFactory(inputSchemaFactory, "extensibleSchemaUnion");
58
+ const schemaFactory = createCustomizedFluidFrameworkScopedFactory(inputSchemaFactory, "extensibleUnionNode");
58
59
  class Union extends schemaFactory.object(name, record, { allowUnknownOptionalFields: true }) {
59
- get child() {
60
+ get union() {
61
+ if (!this.isValid()) {
62
+ throw new UsageError(`This ExtensibleUnionNode (${Union.identifier}) is in an invalid state. It must have been edited by another client using a different schema or been directly imported or constructed in an invalid state.`);
63
+ }
60
64
  for (const [_key, child] of TreeAlpha.children(this)) {
61
65
  return child;
62
66
  }
63
67
  return undefined;
64
68
  }
69
+ isValid() {
70
+ // Use inner node, since it includes populated fields even when they are unknown.
71
+ const inner = getInnerNode(this);
72
+ // Fields only includes non-empty fields, so this is what we need to check the one child invariant.
73
+ return [...inner.fields].length === 1;
74
+ }
65
75
  static create(child) {
66
76
  const schema = Tree.schema(child);
67
77
  return TreeBeta.create(this, {
@@ -71,6 +81,6 @@ export var ExtensibleSchemaUnion;
71
81
  }
72
82
  return eraseSchemaDetailsSubclassable()(Union);
73
83
  }
74
- ExtensibleSchemaUnion.extensibleSchemaUnion = extensibleSchemaUnion;
75
- })(ExtensibleSchemaUnion || (ExtensibleSchemaUnion = {}));
76
- //# sourceMappingURL=extensibleSchemaUnion.js.map
84
+ ExtensibleUnionNode.createSchema = createSchema;
85
+ })(ExtensibleUnionNode || (ExtensibleUnionNode = {}));
86
+ //# sourceMappingURL=extensibleUnionNode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extensibleUnionNode.js","sourceRoot":"","sources":["../src/extensibleUnionNode.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAEtE,OAAO,EAAE,SAAS,EAAE,IAA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AAG,KAAK,CAAC,MAAM,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC;YACvC,CAAC;YAEM,MAAM,CAAC,MAAM,CAEnB,KAA0C;gBAE1C,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;gBAClC,OAAO,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE;oBAC5B,CAAC,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC,EAAE,KAAK;iBAIhC,CAAC,CAAC;YACJ,CAAC;SACD;QACD,OAAO,8BAA8B,EAGlC,CAAC,KAAK,CAAC,CAAC;IACZ,CAAC;IAtDe,gCAAY,eAsD3B,CAAA;AACF,CAAC,EApHgB,mBAAmB,KAAnB,mBAAmB,QAoHnC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { TreeAlpha, Tree } from \"./shared-tree/index.js\";\nimport type {\n\tTreeNodeSchema,\n\tTreeNodeFromImplicitAllowedTypes,\n\tTreeFieldFromImplicitField,\n\tImplicitFieldSchema,\n\tInsertableTreeFieldFromImplicitField,\n\tSchemaFactoryBeta,\n} from \"./simple-tree/index.js\";\nimport {\n\tcreateCustomizedFluidFrameworkScopedFactory,\n\teraseSchemaDetailsSubclassable,\n\tgetInnerNode,\n\tSchemaFactory,\n\tTreeBeta,\n} from \"./simple-tree/index.js\";\nimport type { UnionToIntersection } from \"./util/index.js\";\n\n/**\n * Utilities for creating extensible unions using a node.\n * @remarks\n * Use {@link ExtensibleUnionNode.createSchema} to create the union schema.\n *\n * Unlike a schema union created using {@link SchemaStaticsBeta.staged | staged} allowed types, this union allows for unknown future types to exist in addition to the known types.\n * This allows for faster roll-outs of new types without waiting for old clients to be updated to be aware of them.\n * This does mean however that old clients may see types they do not know about, which are simply exposed as `undefined` children.\n *\n * `staged` types are lower overhead, and might gain support for `unknown` types in the future, so prefer them when possible.\n * This is simply an alternative for when future compatibility with unknown types is required.\n * It is built on top of the existing {@link ObjectSchemaOptions.allowUnknownOptionalFields | allowUnknownOptionalFields} feature.\n *\n * @example\n * ```typescript\n * const sf = new SchemaFactoryBeta(\"extensibleUnionNodeExample.items\");\n * class ItemA extends sf.object(\"A\", { x: sf.string }) {}\n * class ItemB extends sf.object(\"B\", { x: sf.number }) {}\n *\n * class AnyItem extends ExtensibleUnionNode.createSchema(\n * \t[ItemA, ItemB], // Future versions may add more members here\n * \tsf,\n * \t\"ExtensibleUnion\",\n * ) {}\n * // Instances of the union are created using `create`.\n * const anyItem = AnyItem.create(new ItemA({ x: \"hello\" }));\n * // Reading the content from the union is done via the `union` property,\n * // which can be `undefined` to handle the case where a future version of this schema allows a type unknown to the current version.\n * const childNode: ItemA | ItemB | undefined = anyItem.union;\n * // To determine which member of the union was present, its schema can be inspected:\n * const aSchema = Tree.schema(childNode ?? assert.fail(\"No child\"));\n * assert.equal(aSchema, ItemA);\n * ```\n * @beta\n */\nexport namespace ExtensibleUnionNode {\n\t/**\n\t * Members for classes created by {@link ExtensibleUnionNode.createSchema}.\n\t * @beta\n\t */\n\texport interface Members<T> {\n\t\t/**\n\t\t * The child wrapped by this node has one of the types allowed by the union,\n\t\t * or `undefined` if the type is one which was added to the union by a future version of this schema.\n\t\t *\n\t\t * @throws if {@link ExtensibleUnionNode.Members.isValid} is false.\n\t\t */\n\t\treadonly union: T | undefined;\n\n\t\t/**\n\t\t * Returns true, unless this node is in an invalid state.\n\t\t * @remarks\n\t\t * A well behaved application should not need this API.\n\t\t * If an application is hitting errors when accessing {@link ExtensibleUnionNode.Members.union},\n\t\t * this API can be used to help detect and recover from the invalid state which causes those errors (for example by replacing the invalid nodes with new ones).\n\t\t *\n\t\t * In this context \"invalid\" means that the internal implementation details of this node have had their invariants violated.\n\t\t * This can happen when:\n\t\t * - Using weakly typed construction APIs like {@link (TreeBeta:interface).importConcise} or {@link (TreeAlpha:interface).importVerbose} to construct an invalid state directly.\n\t\t * Using such APIs, even when not creating invalid nodes, is not supported for this schema,\n\t\t * since doing so requires knowing the implementation details of this node which are subject to change.\n\t\t * - By editing a document using a different client using a different schema for this node.\n\t\t * - Violating the TypeScript types to directly manipulate the node internals.\n\t\t * - A bug in this node's implementation (possibly in a different client) corrupted the node.\n\t\t * - Corruption of the document this node is contained in.\n\t\t *\n\t\t * @privateRemarks\n\t\t * We could support {@link (TreeBeta:interface).exportVerbose} using {@link KeyEncodingOptions.allStoredKeys}\n\t\t * then {@link (TreeAlpha:interface).importVerbose} with {@link KeyEncodingOptions.knownStoredKeys}.\n\t\t * However, even this will error (but will not produce an invalid node) if there is a node of an unknown type in the union.\n\t\t */\n\t\tisValid(): boolean;\n\t}\n\n\t/**\n\t * Statics for classes created by {@link ExtensibleUnionNode.createSchema}.\n\t * @beta\n\t */\n\texport interface Statics<T extends readonly TreeNodeSchema[]> {\n\t\t/**\n\t\t * Create a {@link TreeNode} with `this` schema which wraps the provided child to create the union.\n\t\t */\n\t\tcreate<TThis extends TreeNodeSchema>(\n\t\t\tthis: TThis,\n\t\t\tchild: TreeNodeFromImplicitAllowedTypes<T>,\n\t\t): TreeFieldFromImplicitField<TThis>;\n\t}\n\n\t/**\n\t * Create an extensible schema union which currently supports the types in `types`,\n\t * but tolerates collaboration with future versions that may include additional types.\n\t * @remarks\n\t * See {@link ExtensibleUnionNode} for an example use.\n\t * @beta\n\t */\n\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n\texport function createSchema<\n\t\tconst T extends readonly TreeNodeSchema[],\n\t\tconst TScope extends string,\n\t\tconst TName extends string,\n\t>(types: T, inputSchemaFactory: SchemaFactoryBeta<TScope>, name: TName) {\n\t\tconst record: Record<string, ImplicitFieldSchema> = {};\n\t\tfor (const type of types) {\n\t\t\trecord[`_${type.identifier}`] = SchemaFactory.optional(type, { key: type.identifier });\n\t\t}\n\t\tconst schemaFactory = createCustomizedFluidFrameworkScopedFactory(\n\t\t\tinputSchemaFactory,\n\t\t\t\"extensibleUnionNode\",\n\t\t);\n\n\t\tclass Union\n\t\t\textends schemaFactory.object(name, record, { allowUnknownOptionalFields: true })\n\t\t\timplements Members<TreeNodeFromImplicitAllowedTypes<T>>\n\t\t{\n\t\t\tpublic get union(): TreeNodeFromImplicitAllowedTypes<T> | undefined {\n\t\t\t\tif (!this.isValid()) {\n\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t`This ExtensibleUnionNode (${Union.identifier}) is in an invalid state. It must have been edited by another client using a different schema or been directly imported or constructed in an invalid state.`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tfor (const [_key, child] of TreeAlpha.children(this)) {\n\t\t\t\t\treturn child as TreeNodeFromImplicitAllowedTypes<T>;\n\t\t\t\t}\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tpublic isValid(): boolean {\n\t\t\t\t// Use inner node, since it includes populated fields even when they are unknown.\n\t\t\t\tconst inner = getInnerNode(this);\n\t\t\t\t// Fields only includes non-empty fields, so this is what we need to check the one child invariant.\n\t\t\t\treturn [...inner.fields].length === 1;\n\t\t\t}\n\n\t\t\tpublic static create<TThis extends TreeNodeSchema>(\n\t\t\t\tthis: TThis,\n\t\t\t\tchild: TreeNodeFromImplicitAllowedTypes<T>,\n\t\t\t): TreeFieldFromImplicitField<TThis> {\n\t\t\t\tconst schema = Tree.schema(child);\n\t\t\t\treturn TreeBeta.create(this, {\n\t\t\t\t\t[`_${schema.identifier}`]: child,\n\t\t\t\t} as unknown as InsertableTreeFieldFromImplicitField<\n\t\t\t\t\tTThis,\n\t\t\t\t\tUnionToIntersection<TThis>\n\t\t\t\t>);\n\t\t\t}\n\t\t}\n\t\treturn eraseSchemaDetailsSubclassable<\n\t\t\tMembers<TreeNodeFromImplicitAllowedTypes<T>>,\n\t\t\tStatics<T>\n\t\t>()(Union);\n\t}\n}\n"]}
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { type ChangeAtomId, type ChangesetLocalId, type RevisionTag } from "../core/index.js";
6
- import { type TupleBTree } from "../util/index.js";
6
+ import { type RangeQueryResult, type TupleBTree } from "../util/index.js";
7
7
  /**
8
8
  * A BTree which uses ChangeAtomId flattened into a tuple as the key.
9
9
  * @remarks
@@ -13,5 +13,6 @@ export type ChangeAtomIdBTree<V> = TupleBTree<readonly [RevisionTag | undefined,
13
13
  /** Creates a new {@link ChangeAtomIdBTree} */
14
14
  export declare function newChangeAtomIdBTree<V>(entries?: [readonly [RevisionTag | undefined, ChangesetLocalId], V][]): ChangeAtomIdBTree<V>;
15
15
  export declare function getFromChangeAtomIdMap<T>(map: ChangeAtomIdBTree<T>, id: ChangeAtomId): T | undefined;
16
- export declare function setInChangeAtomIdMap<T>(map: ChangeAtomIdBTree<T>, id: ChangeAtomId, value: T): void;
16
+ export declare function setInChangeAtomIdMap<T>(map: ChangeAtomIdBTree<T>, id: ChangeAtomId, value: T): boolean;
17
+ export declare function rangeQueryChangeAtomIdMap<T>(map: ChangeAtomIdBTree<T>, id: ChangeAtomId, count: number): RangeQueryResult<T | undefined>;
17
18
  //# sourceMappingURL=changeAtomIdBTree.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"changeAtomIdBTree.d.ts","sourceRoot":"","sources":["../../src/feature-libraries/changeAtomIdBTree.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAGN,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAwC,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEzF;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,CAAC,CAAC,IAAI,UAAU,CAC5C,SAAS,CAAC,WAAW,GAAG,SAAS,EAAE,gBAAgB,CAAC,EACpD,CAAC,CACD,CAAC;AAEF,8CAA8C;AAC9C,wBAAgB,oBAAoB,CAAC,CAAC,EACrC,OAAO,CAAC,EAAE,CAAC,SAAS,CAAC,WAAW,GAAG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KAAK,EAAE,CAAC,GACN,OAAO,CAET;AAED,wBAAgB,yBAAyB,CAAC,CAAC,EAC1C,GAAG,EAAE,iBAAiB,CAAC,CAAC,CAAC,EACzB,EAAE,EAAE,YAAY,EAChB,KAAK,EAAE,MAAM,GACX,gBAAgB,CAAC,CAAC,GAAG,SAAS,CAAC,CAajC"}
@@ -2,8 +2,8 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { compareChangesetLocalIds, comparePartialRevisions, } from "../core/index.js";
6
- import { createTupleComparator, newTupleBTree } from "../util/index.js";
5
+ import { subtractChangeAtomIds, compareChangesetLocalIds, comparePartialRevisions, } from "../core/index.js";
6
+ import { createTupleComparator, newTupleBTree, } from "../util/index.js";
7
7
  /** Creates a new {@link ChangeAtomIdBTree} */
8
8
  export function newChangeAtomIdBTree(entries) {
9
9
  return newTupleBTree(compareKeys, entries);
@@ -13,6 +13,18 @@ export function getFromChangeAtomIdMap(map, id) {
13
13
  return map.get([id.revision, id.localId]);
14
14
  }
15
15
  export function setInChangeAtomIdMap(map, id, value) {
16
- map.set([id.revision, id.localId], value);
16
+ return map.set([id.revision, id.localId], value);
17
+ }
18
+ export function rangeQueryChangeAtomIdMap(map, id, count) {
19
+ const pair = map.getPairOrNextHigher([id.revision, id.localId]);
20
+ if (pair === undefined) {
21
+ return { value: undefined, length: count };
22
+ }
23
+ const [[revision, localId], value] = pair;
24
+ const lengthBefore = subtractChangeAtomIds({ revision, localId }, id);
25
+ if (lengthBefore === 0) {
26
+ return { value, length: 1 };
27
+ }
28
+ return { value: undefined, length: Math.min(lengthBefore, count) };
17
29
  }
18
30
  //# sourceMappingURL=changeAtomIdBTree.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"changeAtomIdBTree.js","sourceRoot":"","sources":["../../src/feature-libraries/changeAtomIdBTree.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,wBAAwB,EACxB,uBAAuB,GAIvB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,qBAAqB,EAAE,aAAa,EAAmB,MAAM,kBAAkB,CAAC;AAYzF,8CAA8C;AAC9C,MAAM,UAAU,oBAAoB,CACnC,OAAqE;IAErE,OAAO,aAAa,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;AAC5C,CAAC;AAED,MAAM,WAAW,GAAG,qBAAqB,CAAC,CAAC,uBAAuB,EAAE,wBAAwB,CAAC,CAAC,CAAC;AAE/F,MAAM,UAAU,sBAAsB,CACrC,GAAyB,EACzB,EAAgB;IAEhB,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;AAC3C,CAAC;AAED,MAAM,UAAU,oBAAoB,CACnC,GAAyB,EACzB,EAAgB,EAChB,KAAQ;IAER,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,KAAK,CAAC,CAAC;AAC3C,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tcompareChangesetLocalIds,\n\tcomparePartialRevisions,\n\ttype ChangeAtomId,\n\ttype ChangesetLocalId,\n\ttype RevisionTag,\n} from \"../core/index.js\";\nimport { createTupleComparator, newTupleBTree, type TupleBTree } from \"../util/index.js\";\n\n/**\n * A BTree which uses ChangeAtomId flattened into a tuple as the key.\n * @remarks\n * Read values with {@link getFromChangeAtomIdMap} and write values with {@link setInChangeAtomIdMap}.\n */\nexport type ChangeAtomIdBTree<V> = TupleBTree<\n\treadonly [RevisionTag | undefined, ChangesetLocalId],\n\tV\n>;\n\n/** Creates a new {@link ChangeAtomIdBTree} */\nexport function newChangeAtomIdBTree<V>(\n\tentries?: [readonly [RevisionTag | undefined, ChangesetLocalId], V][],\n): ChangeAtomIdBTree<V> {\n\treturn newTupleBTree(compareKeys, entries);\n}\n\nconst compareKeys = createTupleComparator([comparePartialRevisions, compareChangesetLocalIds]);\n\nexport function getFromChangeAtomIdMap<T>(\n\tmap: ChangeAtomIdBTree<T>,\n\tid: ChangeAtomId,\n): T | undefined {\n\treturn map.get([id.revision, id.localId]);\n}\n\nexport function setInChangeAtomIdMap<T>(\n\tmap: ChangeAtomIdBTree<T>,\n\tid: ChangeAtomId,\n\tvalue: T,\n): void {\n\tmap.set([id.revision, id.localId], value);\n}\n"]}
1
+ {"version":3,"file":"changeAtomIdBTree.js","sourceRoot":"","sources":["../../src/feature-libraries/changeAtomIdBTree.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,qBAAqB,EACrB,wBAAwB,EACxB,uBAAuB,GAIvB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACN,qBAAqB,EACrB,aAAa,GAGb,MAAM,kBAAkB,CAAC;AAY1B,8CAA8C;AAC9C,MAAM,UAAU,oBAAoB,CACnC,OAAqE;IAErE,OAAO,aAAa,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;AAC5C,CAAC;AAED,MAAM,WAAW,GAAG,qBAAqB,CAAC,CAAC,uBAAuB,EAAE,wBAAwB,CAAC,CAAC,CAAC;AAE/F,MAAM,UAAU,sBAAsB,CACrC,GAAyB,EACzB,EAAgB;IAEhB,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;AAC3C,CAAC;AAED,MAAM,UAAU,oBAAoB,CACnC,GAAyB,EACzB,EAAgB,EAChB,KAAQ;IAER,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,KAAK,CAAC,CAAC;AAClD,CAAC;AAED,MAAM,UAAU,yBAAyB,CACxC,GAAyB,EACzB,EAAgB,EAChB,KAAa;IAEb,MAAM,IAAI,GAAG,GAAG,CAAC,mBAAmB,CAAC,CAAC,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAChE,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACxB,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IAC5C,CAAC;IAED,MAAM,CAAC,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAE,KAAK,CAAC,GAAG,IAAI,CAAC;IAC1C,MAAM,YAAY,GAAG,qBAAqB,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC;IACtE,IAAI,YAAY,KAAK,CAAC,EAAE,CAAC;QACxB,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;IAC7B,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC;AACpE,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tsubtractChangeAtomIds,\n\tcompareChangesetLocalIds,\n\tcomparePartialRevisions,\n\ttype ChangeAtomId,\n\ttype ChangesetLocalId,\n\ttype RevisionTag,\n} from \"../core/index.js\";\nimport {\n\tcreateTupleComparator,\n\tnewTupleBTree,\n\ttype RangeQueryResult,\n\ttype TupleBTree,\n} from \"../util/index.js\";\n\n/**\n * A BTree which uses ChangeAtomId flattened into a tuple as the key.\n * @remarks\n * Read values with {@link getFromChangeAtomIdMap} and write values with {@link setInChangeAtomIdMap}.\n */\nexport type ChangeAtomIdBTree<V> = TupleBTree<\n\treadonly [RevisionTag | undefined, ChangesetLocalId],\n\tV\n>;\n\n/** Creates a new {@link ChangeAtomIdBTree} */\nexport function newChangeAtomIdBTree<V>(\n\tentries?: [readonly [RevisionTag | undefined, ChangesetLocalId], V][],\n): ChangeAtomIdBTree<V> {\n\treturn newTupleBTree(compareKeys, entries);\n}\n\nconst compareKeys = createTupleComparator([comparePartialRevisions, compareChangesetLocalIds]);\n\nexport function getFromChangeAtomIdMap<T>(\n\tmap: ChangeAtomIdBTree<T>,\n\tid: ChangeAtomId,\n): T | undefined {\n\treturn map.get([id.revision, id.localId]);\n}\n\nexport function setInChangeAtomIdMap<T>(\n\tmap: ChangeAtomIdBTree<T>,\n\tid: ChangeAtomId,\n\tvalue: T,\n): boolean {\n\treturn map.set([id.revision, id.localId], value);\n}\n\nexport function rangeQueryChangeAtomIdMap<T>(\n\tmap: ChangeAtomIdBTree<T>,\n\tid: ChangeAtomId,\n\tcount: number,\n): RangeQueryResult<T | undefined> {\n\tconst pair = map.getPairOrNextHigher([id.revision, id.localId]);\n\tif (pair === undefined) {\n\t\treturn { value: undefined, length: count };\n\t}\n\n\tconst [[revision, localId], value] = pair;\n\tconst lengthBefore = subtractChangeAtomIds({ revision, localId }, id);\n\tif (lengthBefore === 0) {\n\t\treturn { value, length: 1 };\n\t}\n\n\treturn { value: undefined, length: Math.min(lengthBefore, count) };\n}\n"]}
@@ -9,7 +9,7 @@ import { type ITreeCursorSynchronous, type SchemaAndPolicy, type TreeChunk } fro
9
9
  import { type Brand, type JsonCompatibleReadOnly } from "../../../util/index.js";
10
10
  import { TreeCompressionStrategy } from "../../treeCompressionUtils.js";
11
11
  import type { FieldBatch } from "./fieldBatch.js";
12
- import { type EncodedFieldBatch } from "./format.js";
12
+ import { EncodedFieldBatch } from "./format.js";
13
13
  import type { IncrementalEncodingPolicy } from "./incrementalEncodingPolicy.js";
14
14
  /**
15
15
  * Reference ID for a chunk that is incrementally encoded.
@@ -1 +1 @@
1
- {"version":3,"file":"codecs.d.ts","sourceRoot":"","sources":["../../../../src/feature-libraries/chunked-forest/codec/codecs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC9E,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AAE,yBAAyB,CAAC,CAAC;AAGxE;;;;;;;;GAQG;AACH,MAAM,WAAW,kBAAkB;IAClC;;;OAGG;IACH,yBAAyB,EAAE,yBAAyB,CAAC;IACrD;;;;;;;OAOG;IACH,sBAAsB,CACrB,MAAM,EAAE,sBAAsB,EAC9B,YAAY,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,iBAAiB,GACnD,gBAAgB,EAAE,CAAC;CACtB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,kBAAkB;IAClC;;;;;OAKG;IACH,sBAAsB,CACrB,WAAW,EAAE,gBAAgB,EAC7B,YAAY,EAAE,CAAC,OAAO,EAAE,iBAAiB,KAAK,SAAS,GACrD,SAAS,CAAC;CACb;AACD;;GAEG;AACH,MAAM,WAAW,yBAA0B,SAAQ,kBAAkB,EAAE,kBAAkB;CAAG;AAE5F,MAAM,WAAW,yBAAyB;IACzC,QAAQ,CAAC,UAAU,EAAE,uBAAuB,CAAC;IAC7C,QAAQ,CAAC,YAAY,EAAE,aAAa,CAAC;IACrC,QAAQ,CAAC,YAAY,EAAE,SAAS,CAAC;IACjC,QAAQ,CAAC,MAAM,CAAC,EAAE,eAAe,CAAC;IAClC;;;OAGG;IACH,QAAQ,CAAC,yBAAyB,CAAC,EAAE,yBAAyB,CAAC;CAC/D;AACD;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,UAAU,CACvC,UAAU,EACV,iBAAiB,EACjB,sBAAsB,EACtB,yBAAyB,CACzB,CAAC;AAiBF,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,iBAAiB,GAAG,eAAe,CA+F/E;AAED,wBAAgB,+BAA+B,CAC9C,aAAa,EAAE,uBAAuB,GACpC,SAAS,CAEX"}
@@ -8,7 +8,7 @@ import { FluidClientVersion, makeVersionedValidatedCodec, } from "../../../codec
8
8
  import { brand, brandedNumberType, unbrand, } from "../../../util/index.js";
9
9
  import { TreeCompressionStrategy } from "../../treeCompressionUtils.js";
10
10
  import { decode } from "./chunkDecoding.js";
11
- import { validVersions, FieldBatchFormatVersion, EncodedFieldBatchV1, EncodedFieldBatchV2, } from "./format.js";
11
+ import { EncodedFieldBatch, validVersions, FieldBatchFormatVersion } from "./format.js";
12
12
  import { schemaCompressedEncodeV1, schemaCompressedEncodeV2 } from "./schemaBasedEncode.js";
13
13
  import { uncompressedEncodeV1, uncompressedEncodeV2 } from "./uncompressedEncode.js";
14
14
  const ChunkReferenceId = brandedNumberType({ multipleOf: 1, minimum: 0 });
@@ -31,25 +31,25 @@ export function makeFieldBatchCodec(options) {
31
31
  assert(validVersions.has(writeVersion), 0x935 /* Invalid write version for FieldBatch codec */);
32
32
  let uncompressedEncodeFn;
33
33
  let schemaCompressedEncodeFn;
34
- let encodedFieldBatchType;
35
34
  switch (writeVersion) {
36
35
  case unbrand(FieldBatchFormatVersion.v1): {
37
36
  uncompressedEncodeFn = uncompressedEncodeV1;
38
37
  schemaCompressedEncodeFn = schemaCompressedEncodeV1;
39
- encodedFieldBatchType = EncodedFieldBatchV1;
40
38
  break;
41
39
  }
42
40
  case unbrand(FieldBatchFormatVersion.v2): {
43
41
  uncompressedEncodeFn = uncompressedEncodeV2;
44
42
  schemaCompressedEncodeFn = schemaCompressedEncodeV2;
45
- encodedFieldBatchType = EncodedFieldBatchV2;
46
43
  break;
47
44
  }
48
45
  default: {
49
46
  unreachableCase(writeVersion);
50
47
  }
51
48
  }
52
- return makeVersionedValidatedCodec(options, validVersions, encodedFieldBatchType, {
49
+ // Both the encode and decode logic here support both v1 and v2, as does `validVersions` and `EncodedFieldBatch`.
50
+ // This makes this use of makeVersionedValidatedCodec atypical as it is a single call being used to make a codec that supports all versions,
51
+ // instead of one call per version, then using another utility to select between them based on version.
52
+ return makeVersionedValidatedCodec(options, validVersions, EncodedFieldBatch, {
53
53
  encode: (data, context) => {
54
54
  for (const cursor of data) {
55
55
  assert(cursor.mode === 1 /* CursorLocationType.Fields */, 0x8a3 /* FieldBatch expects fields cursors */);
@@ -1 +1 @@
1
- {"version":3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CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport type { IIdCompressor, SessionId } from \"@fluidframework/id-compressor\";\nimport type { MinimumVersionForCollab } from \"@fluidframework/runtime-definitions/internal\";\nimport {\n\tgetConfigForMinVersionForCollab,\n\tlowestMinVersionForCollab,\n} from \"@fluidframework/runtime-utils/internal\";\n\nimport {\n\ttype CodecTree,\n\ttype CodecWriteOptions,\n\tFluidClientVersion,\n\ttype IJsonCodec,\n\tmakeVersionedValidatedCodec,\n} from \"../../../codec/index.js\";\nimport {\n\tCursorLocationType,\n\ttype ITreeCursorSynchronous,\n\ttype SchemaAndPolicy,\n\ttype TreeChunk,\n} from \"../../../core/index.js\";\nimport {\n\tbrand,\n\tbrandedNumberType,\n\ttype Brand,\n\ttype JsonCompatibleReadOnly,\n\tunbrand,\n} from \"../../../util/index.js\";\nimport { TreeCompressionStrategy } from \"../../treeCompressionUtils.js\";\n\nimport { decode } from \"./chunkDecoding.js\";\nimport type { FieldBatch } from \"./fieldBatch.js\";\nimport {\n\ttype EncodedFieldBatch,\n\tvalidVersions,\n\tFieldBatchFormatVersion,\n\tEncodedFieldBatchV1,\n\tEncodedFieldBatchV2,\n} from \"./format.js\";\nimport type { IncrementalEncodingPolicy } from \"./incrementalEncodingPolicy.js\";\nimport { schemaCompressedEncodeV1, schemaCompressedEncodeV2 } from \"./schemaBasedEncode.js\";\nimport { uncompressedEncodeV1, uncompressedEncodeV2 } from \"./uncompressedEncode.js\";\n\n/**\n * Reference ID for a chunk that is incrementally encoded.\n */\nexport type ChunkReferenceId = Brand<number, \"forest.ChunkReferenceId\">;\nconst ChunkReferenceId = brandedNumberType<ChunkReferenceId>({ multipleOf: 1, minimum: 0 });\n\n/**\n * Properties for incremental encoding.\n * Fields that support incremental encoding will encode their chunks separately by calling `encodeIncrementalField`.\n * @remarks\n * This supports features like incremental summarization where the summary from these fields can be re-used if\n * unchanged between summaries.\n * Note that each of these chunks that are incrementally encoded is fully self-describing (contain its own shapes\n * list and identifier table) and does not rely on context from its parent.\n */\nexport interface IncrementalEncoder {\n\t/**\n\t * Returns whether a node / field should be incrementally encoded.\n\t * @remarks See {@link IncrementalEncodingPolicy}.\n\t */\n\tshouldEncodeIncrementally: IncrementalEncodingPolicy;\n\t/**\n\t * Called to encode an incremental field at the cursor.\n\t * The chunks for this field are encoded separately from the main buffer.\n\t * @param cursor - The cursor pointing to the field to encode.\n\t * @param chunkEncoder - A function that encodes the contents of the passed chunk in the field.\n\t * @returns The reference IDs of the encoded chunks in the field.\n\t * This is used to retrieve the encoded chunks later.\n\t */\n\tencodeIncrementalField(\n\t\tcursor: ITreeCursorSynchronous,\n\t\tchunkEncoder: (chunk: TreeChunk) => EncodedFieldBatch,\n\t): ChunkReferenceId[];\n}\n\n/**\n * Properties for incremental decoding.\n *\n * Fields that had their chunks incrementally encoded will retrieve them by calling `getEncodedIncrementalChunk`.\n * @remarks\n * See {@link IncrementalEncoder} for more details.\n */\nexport interface IncrementalDecoder {\n\t/**\n\t * Called to decode an incremental chunk with the given reference ID.\n\t * @param referenceId - The reference ID of the chunk to decode.\n\t * @param chunkDecoder - A function that decodes the chunk.\n\t * @returns The decoded chunk.\n\t */\n\tdecodeIncrementalChunk(\n\t\treferenceId: ChunkReferenceId,\n\t\tchunkDecoder: (encoded: EncodedFieldBatch) => TreeChunk,\n\t): TreeChunk;\n}\n/**\n * Combines the properties of {@link IncrementalEncoder} and {@link IncrementalDecoder}.\n */\nexport interface IncrementalEncoderDecoder extends IncrementalEncoder, IncrementalDecoder {}\n\nexport interface FieldBatchEncodingContext {\n\treadonly encodeType: TreeCompressionStrategy;\n\treadonly idCompressor: IIdCompressor;\n\treadonly originatorId: SessionId;\n\treadonly schema?: SchemaAndPolicy;\n\t/**\n\t * An encoder / decoder for encoding and decoding of incremental fields.\n\t * This will be defined if incremental encoding is supported and enabled.\n\t */\n\treadonly incrementalEncoderDecoder?: IncrementalEncoderDecoder;\n}\n/**\n * @remarks\n * Fields in this batch currently don't have field schema for the root, which limits optimizations.\n */\nexport type FieldBatchCodec = IJsonCodec<\n\tFieldBatch,\n\tEncodedFieldBatch,\n\tJsonCompatibleReadOnly,\n\tFieldBatchEncodingContext\n>;\n\n/**\n * Convert a MinimumVersionForCollab to write version for {@link FieldBatchCodec}.\n * @param clientVersion - The MinimumVersionForCollab to convert.\n */\nfunction clientVersionToFieldBatchVersion(\n\tclientVersion: MinimumVersionForCollab,\n): FieldBatchFormatVersion {\n\treturn brand(\n\t\tgetConfigForMinVersionForCollab(clientVersion, {\n\t\t\t[lowestMinVersionForCollab]: FieldBatchFormatVersion.v1,\n\t\t\t[FluidClientVersion.v2_73]: FieldBatchFormatVersion.v2,\n\t\t}),\n\t);\n}\n\nexport function makeFieldBatchCodec(options: CodecWriteOptions): FieldBatchCodec {\n\tconst writeVersion = clientVersionToFieldBatchVersion(options.minVersionForCollab);\n\t// Note: it's important that the decode function is schema-agnostic for this strategy/layering to work, since\n\t// the schema that an op was encoded in doesn't necessarily match the current schema for the document (e.g. if\n\t// decode is being run on a client that just submitted a schema change, but the op is from another client who has\n\t// yet to receive that change).\n\tassert(\n\t\tvalidVersions.has(writeVersion),\n\t\t0x935 /* Invalid write version for FieldBatch codec */,\n\t);\n\n\tlet uncompressedEncodeFn: typeof uncompressedEncodeV1 | typeof uncompressedEncodeV2;\n\tlet schemaCompressedEncodeFn:\n\t\t| typeof schemaCompressedEncodeV1\n\t\t| typeof schemaCompressedEncodeV2;\n\tlet encodedFieldBatchType: typeof EncodedFieldBatchV1 | typeof EncodedFieldBatchV2;\n\tswitch (writeVersion) {\n\t\tcase unbrand(FieldBatchFormatVersion.v1): {\n\t\t\tuncompressedEncodeFn = uncompressedEncodeV1;\n\t\t\tschemaCompressedEncodeFn = schemaCompressedEncodeV1;\n\t\t\tencodedFieldBatchType = EncodedFieldBatchV1;\n\t\t\tbreak;\n\t\t}\n\t\tcase unbrand(FieldBatchFormatVersion.v2): {\n\t\t\tuncompressedEncodeFn = uncompressedEncodeV2;\n\t\t\tschemaCompressedEncodeFn = schemaCompressedEncodeV2;\n\t\t\tencodedFieldBatchType = EncodedFieldBatchV2;\n\t\t\tbreak;\n\t\t}\n\t\tdefault: {\n\t\t\tunreachableCase(writeVersion);\n\t\t}\n\t}\n\n\treturn makeVersionedValidatedCodec(options, validVersions, encodedFieldBatchType, {\n\t\tencode: (data: FieldBatch, context: FieldBatchEncodingContext): EncodedFieldBatch => {\n\t\t\tfor (const cursor of data) {\n\t\t\t\tassert(\n\t\t\t\t\tcursor.mode === CursorLocationType.Fields,\n\t\t\t\t\t0x8a3 /* FieldBatch expects fields cursors */,\n\t\t\t\t);\n\t\t\t}\n\t\t\tlet encoded: EncodedFieldBatch;\n\t\t\tlet incrementalEncoder: IncrementalEncoder | undefined;\n\t\t\tswitch (context.encodeType) {\n\t\t\t\tcase TreeCompressionStrategy.Uncompressed: {\n\t\t\t\t\tencoded = uncompressedEncodeFn(data);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase TreeCompressionStrategy.CompressedIncremental: {\n\t\t\t\t\tassert(\n\t\t\t\t\t\twriteVersion >= FieldBatchFormatVersion.v2,\n\t\t\t\t\t\t0xca0 /* Unsupported FieldBatchFormatVersion for incremental encoding; must be v2 or higher */,\n\t\t\t\t\t);\n\t\t\t\t\t// Incremental encoding is only supported for CompressedIncremental.\n\t\t\t\t\tincrementalEncoder = context.incrementalEncoderDecoder;\n\t\t\t\t}\n\t\t\t\t// fallthrough\n\t\t\t\tcase TreeCompressionStrategy.Compressed: {\n\t\t\t\t\t// eslint-disable-next-line unicorn/prefer-ternary\n\t\t\t\t\tif (context.schema === undefined) {\n\t\t\t\t\t\t// TODO: consider enabling a somewhat compressed but not schema accelerated encode.\n\t\t\t\t\t\tencoded = uncompressedEncodeFn(data);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tencoded = schemaCompressedEncodeFn(\n\t\t\t\t\t\t\tcontext.schema.schema,\n\t\t\t\t\t\t\tcontext.schema.policy,\n\t\t\t\t\t\t\tdata,\n\t\t\t\t\t\t\tcontext.idCompressor,\n\t\t\t\t\t\t\tincrementalEncoder,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\tunreachableCase(context.encodeType);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// TODO: consider checking input data was in schema.\n\t\t\treturn encoded;\n\t\t},\n\t\tdecode: (data: EncodedFieldBatch, context: FieldBatchEncodingContext): FieldBatch => {\n\t\t\t// TODO: consider checking data is in schema.\n\t\t\treturn decode(\n\t\t\t\tdata,\n\t\t\t\t{\n\t\t\t\t\tidCompressor: context.idCompressor,\n\t\t\t\t\toriginatorId: context.originatorId,\n\t\t\t\t},\n\t\t\t\tcontext.incrementalEncoderDecoder,\n\t\t\t).map((chunk) => chunk.cursor());\n\t\t},\n\t});\n}\n\nexport function getCodecTreeForFieldBatchFormat(\n\tclientVersion: MinimumVersionForCollab,\n): CodecTree {\n\treturn { name: \"FieldBatch\", version: clientVersionToFieldBatchVersion(clientVersion) };\n}\n"]}
1
+ {"version":3,"file":"codecs.js","sourceRoot":"","sources":["../../../../src/feature-libraries/chunked-forest/codec/codecs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAG9E,OAAO,EACN,+BAA+B,EAC/B,yBAAyB,GACzB,MAAM,wCAAwC,CAAC;AAEhD,OAAO,EAGN,kBAAkB,EAElB,2BAA2B,GAC3B,MAAM,yBAAyB,CAAC;AAOjC,OAAO,EACN,KAAK,EACL,iBAAiB,EAGjB,OAAO,GACP,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAExE,OAAO,EAAE,MAAM,EAAE,MAAM,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AC,YAAY,EACpB,kBAAkB,CAClB,CAAC;oBACH,CAAC;oBAED,MAAM;gBACP,CAAC;gBACD,OAAO,CAAC,CAAC,CAAC;oBACT,eAAe,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;gBACrC,CAAC;YACF,CAAC;YAED,oDAAoD;YACpD,OAAO,OAAO,CAAC;QAChB,CAAC;QACD,MAAM,EAAE,CAAC,IAAuB,EAAE,OAAkC,EAAc,EAAE;YACnF,6CAA6C;YAC7C,OAAO,MAAM,CACZ,IAAI,EACJ;gBACC,YAAY,EAAE,OAAO,CAAC,YAAY;gBAClC,YAAY,EAAE,OAAO,CAAC,YAAY;aAClC,EACD,OAAO,CAAC,yBAAyB,CACjC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;QAClC,CAAC;KACD,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,+BAA+B,CAC9C,aAAsC;IAEtC,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,gCAAgC,CAAC,aAAa,CAAC,EAAE,CAAC;AACzF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport type { IIdCompressor, SessionId } from \"@fluidframework/id-compressor\";\nimport type { MinimumVersionForCollab } from \"@fluidframework/runtime-definitions/internal\";\nimport {\n\tgetConfigForMinVersionForCollab,\n\tlowestMinVersionForCollab,\n} from \"@fluidframework/runtime-utils/internal\";\n\nimport {\n\ttype CodecTree,\n\ttype CodecWriteOptions,\n\tFluidClientVersion,\n\ttype IJsonCodec,\n\tmakeVersionedValidatedCodec,\n} from \"../../../codec/index.js\";\nimport {\n\tCursorLocationType,\n\ttype ITreeCursorSynchronous,\n\ttype SchemaAndPolicy,\n\ttype TreeChunk,\n} from \"../../../core/index.js\";\nimport {\n\tbrand,\n\tbrandedNumberType,\n\ttype Brand,\n\ttype JsonCompatibleReadOnly,\n\tunbrand,\n} from \"../../../util/index.js\";\nimport { TreeCompressionStrategy } from \"../../treeCompressionUtils.js\";\n\nimport { decode } from \"./chunkDecoding.js\";\nimport type { FieldBatch } from \"./fieldBatch.js\";\nimport { EncodedFieldBatch, validVersions, FieldBatchFormatVersion } from \"./format.js\";\nimport type { IncrementalEncodingPolicy } from \"./incrementalEncodingPolicy.js\";\nimport { schemaCompressedEncodeV1, schemaCompressedEncodeV2 } from \"./schemaBasedEncode.js\";\nimport { uncompressedEncodeV1, uncompressedEncodeV2 } from \"./uncompressedEncode.js\";\n\n/**\n * Reference ID for a chunk that is incrementally encoded.\n */\nexport type ChunkReferenceId = Brand<number, \"forest.ChunkReferenceId\">;\nconst ChunkReferenceId = brandedNumberType<ChunkReferenceId>({ multipleOf: 1, minimum: 0 });\n\n/**\n * Properties for incremental encoding.\n * Fields that support incremental encoding will encode their chunks separately by calling `encodeIncrementalField`.\n * @remarks\n * This supports features like incremental summarization where the summary from these fields can be re-used if\n * unchanged between summaries.\n * Note that each of these chunks that are incrementally encoded is fully self-describing (contain its own shapes\n * list and identifier table) and does not rely on context from its parent.\n */\nexport interface IncrementalEncoder {\n\t/**\n\t * Returns whether a node / field should be incrementally encoded.\n\t * @remarks See {@link IncrementalEncodingPolicy}.\n\t */\n\tshouldEncodeIncrementally: IncrementalEncodingPolicy;\n\t/**\n\t * Called to encode an incremental field at the cursor.\n\t * The chunks for this field are encoded separately from the main buffer.\n\t * @param cursor - The cursor pointing to the field to encode.\n\t * @param chunkEncoder - A function that encodes the contents of the passed chunk in the field.\n\t * @returns The reference IDs of the encoded chunks in the field.\n\t * This is used to retrieve the encoded chunks later.\n\t */\n\tencodeIncrementalField(\n\t\tcursor: ITreeCursorSynchronous,\n\t\tchunkEncoder: (chunk: TreeChunk) => EncodedFieldBatch,\n\t): ChunkReferenceId[];\n}\n\n/**\n * Properties for incremental decoding.\n *\n * Fields that had their chunks incrementally encoded will retrieve them by calling `getEncodedIncrementalChunk`.\n * @remarks\n * See {@link IncrementalEncoder} for more details.\n */\nexport interface IncrementalDecoder {\n\t/**\n\t * Called to decode an incremental chunk with the given reference ID.\n\t * @param referenceId - The reference ID of the chunk to decode.\n\t * @param chunkDecoder - A function that decodes the chunk.\n\t * @returns The decoded chunk.\n\t */\n\tdecodeIncrementalChunk(\n\t\treferenceId: ChunkReferenceId,\n\t\tchunkDecoder: (encoded: EncodedFieldBatch) => TreeChunk,\n\t): TreeChunk;\n}\n/**\n * Combines the properties of {@link IncrementalEncoder} and {@link IncrementalDecoder}.\n */\nexport interface IncrementalEncoderDecoder extends IncrementalEncoder, IncrementalDecoder {}\n\nexport interface FieldBatchEncodingContext {\n\treadonly encodeType: TreeCompressionStrategy;\n\treadonly idCompressor: IIdCompressor;\n\treadonly originatorId: SessionId;\n\treadonly schema?: SchemaAndPolicy;\n\t/**\n\t * An encoder / decoder for encoding and decoding of incremental fields.\n\t * This will be defined if incremental encoding is supported and enabled.\n\t */\n\treadonly incrementalEncoderDecoder?: IncrementalEncoderDecoder;\n}\n/**\n * @remarks\n * Fields in this batch currently don't have field schema for the root, which limits optimizations.\n */\nexport type FieldBatchCodec = IJsonCodec<\n\tFieldBatch,\n\tEncodedFieldBatch,\n\tJsonCompatibleReadOnly,\n\tFieldBatchEncodingContext\n>;\n\n/**\n * Convert a MinimumVersionForCollab to write version for {@link FieldBatchCodec}.\n * @param clientVersion - The MinimumVersionForCollab to convert.\n */\nfunction clientVersionToFieldBatchVersion(\n\tclientVersion: MinimumVersionForCollab,\n): FieldBatchFormatVersion {\n\treturn brand(\n\t\tgetConfigForMinVersionForCollab(clientVersion, {\n\t\t\t[lowestMinVersionForCollab]: FieldBatchFormatVersion.v1,\n\t\t\t[FluidClientVersion.v2_73]: FieldBatchFormatVersion.v2,\n\t\t}),\n\t);\n}\n\nexport function makeFieldBatchCodec(options: CodecWriteOptions): FieldBatchCodec {\n\tconst writeVersion = clientVersionToFieldBatchVersion(options.minVersionForCollab);\n\t// Note: it's important that the decode function is schema-agnostic for this strategy/layering to work, since\n\t// the schema that an op was encoded in doesn't necessarily match the current schema for the document (e.g. if\n\t// decode is being run on a client that just submitted a schema change, but the op is from another client who has\n\t// yet to receive that change).\n\tassert(\n\t\tvalidVersions.has(writeVersion),\n\t\t0x935 /* Invalid write version for FieldBatch codec */,\n\t);\n\n\tlet uncompressedEncodeFn: typeof uncompressedEncodeV1 | typeof uncompressedEncodeV2;\n\tlet schemaCompressedEncodeFn:\n\t\t| typeof schemaCompressedEncodeV1\n\t\t| typeof schemaCompressedEncodeV2;\n\tswitch (writeVersion) {\n\t\tcase unbrand(FieldBatchFormatVersion.v1): {\n\t\t\tuncompressedEncodeFn = uncompressedEncodeV1;\n\t\t\tschemaCompressedEncodeFn = schemaCompressedEncodeV1;\n\t\t\tbreak;\n\t\t}\n\t\tcase unbrand(FieldBatchFormatVersion.v2): {\n\t\t\tuncompressedEncodeFn = uncompressedEncodeV2;\n\t\t\tschemaCompressedEncodeFn = schemaCompressedEncodeV2;\n\t\t\tbreak;\n\t\t}\n\t\tdefault: {\n\t\t\tunreachableCase(writeVersion);\n\t\t}\n\t}\n\n\t// Both the encode and decode logic here support both v1 and v2, as does `validVersions` and `EncodedFieldBatch`.\n\t// This makes this use of makeVersionedValidatedCodec atypical as it is a single call being used to make a codec that supports all versions,\n\t// instead of one call per version, then using another utility to select between them based on version.\n\treturn makeVersionedValidatedCodec(options, validVersions, EncodedFieldBatch, {\n\t\tencode: (data: FieldBatch, context: FieldBatchEncodingContext): EncodedFieldBatch => {\n\t\t\tfor (const cursor of data) {\n\t\t\t\tassert(\n\t\t\t\t\tcursor.mode === CursorLocationType.Fields,\n\t\t\t\t\t0x8a3 /* FieldBatch expects fields cursors */,\n\t\t\t\t);\n\t\t\t}\n\t\t\tlet encoded: EncodedFieldBatch;\n\t\t\tlet incrementalEncoder: IncrementalEncoder | undefined;\n\t\t\tswitch (context.encodeType) {\n\t\t\t\tcase TreeCompressionStrategy.Uncompressed: {\n\t\t\t\t\tencoded = uncompressedEncodeFn(data);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase TreeCompressionStrategy.CompressedIncremental: {\n\t\t\t\t\tassert(\n\t\t\t\t\t\twriteVersion >= FieldBatchFormatVersion.v2,\n\t\t\t\t\t\t0xca0 /* Unsupported FieldBatchFormatVersion for incremental encoding; must be v2 or higher */,\n\t\t\t\t\t);\n\t\t\t\t\t// Incremental encoding is only supported for CompressedIncremental.\n\t\t\t\t\tincrementalEncoder = context.incrementalEncoderDecoder;\n\t\t\t\t}\n\t\t\t\t// fallthrough\n\t\t\t\tcase TreeCompressionStrategy.Compressed: {\n\t\t\t\t\t// eslint-disable-next-line unicorn/prefer-ternary\n\t\t\t\t\tif (context.schema === undefined) {\n\t\t\t\t\t\t// TODO: consider enabling a somewhat compressed but not schema accelerated encode.\n\t\t\t\t\t\tencoded = uncompressedEncodeFn(data);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tencoded = schemaCompressedEncodeFn(\n\t\t\t\t\t\t\tcontext.schema.schema,\n\t\t\t\t\t\t\tcontext.schema.policy,\n\t\t\t\t\t\t\tdata,\n\t\t\t\t\t\t\tcontext.idCompressor,\n\t\t\t\t\t\t\tincrementalEncoder,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\tunreachableCase(context.encodeType);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// TODO: consider checking input data was in schema.\n\t\t\treturn encoded;\n\t\t},\n\t\tdecode: (data: EncodedFieldBatch, context: FieldBatchEncodingContext): FieldBatch => {\n\t\t\t// TODO: consider checking data is in schema.\n\t\t\treturn decode(\n\t\t\t\tdata,\n\t\t\t\t{\n\t\t\t\t\tidCompressor: context.idCompressor,\n\t\t\t\t\toriginatorId: context.originatorId,\n\t\t\t\t},\n\t\t\t\tcontext.incrementalEncoderDecoder,\n\t\t\t).map((chunk) => chunk.cursor());\n\t\t},\n\t});\n}\n\nexport function getCodecTreeForFieldBatchFormat(\n\tclientVersion: MinimumVersionForCollab,\n): CodecTree {\n\treturn { name: \"FieldBatch\", version: clientVersionToFieldBatchVersion(clientVersion) };\n}\n"]}
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import type { CodecWriteOptions, ICodecFamily } from "../../codec/index.js";
6
- import { type ChangeEncodingContext, type ChangeFamily, type ChangeFamilyEditor, type ChangeRebaser, type DeltaDetachedNodeId, type DeltaRoot, type FieldUpPath, type NormalizedFieldUpPath, type NormalizedUpPath, type RevisionTag, type TaggedChange, type TreeChunk, type UpPath } from "../../core/index.js";
6
+ import { type ChangeAtomId, type ChangeEncodingContext, type ChangeFamily, type ChangeFamilyEditor, type ChangeRebaser, type ChangesetLocalId, type DeltaDetachedNodeId, type DeltaRoot, type EditorOptions, type NormalizedFieldUpPath, type NormalizedUpPath, type RevisionTag, type TaggedChange, type TreeChunk } from "../../core/index.js";
7
7
  import { type ModularChangeset } from "../modular-schema/index.js";
8
8
  export type DefaultChangeset = ModularChangeset;
9
9
  /**
@@ -11,12 +11,12 @@ export type DefaultChangeset = ModularChangeset;
11
11
  *
12
12
  * @sealed
13
13
  */
14
- export declare class DefaultChangeFamily implements ChangeFamily<DefaultEditBuilder, DefaultChangeset> {
14
+ export declare class DefaultChangeFamily implements ChangeFamily<IdBasedChangeFamilyDataEditor, DefaultChangeset> {
15
15
  private readonly modularFamily;
16
16
  constructor(codecs: ICodecFamily<ModularChangeset, ChangeEncodingContext>, codecOptions: CodecWriteOptions);
17
17
  get rebaser(): ChangeRebaser<DefaultChangeset>;
18
18
  get codecs(): ICodecFamily<DefaultChangeset, ChangeEncodingContext>;
19
- buildEditor(mintRevisionTag: () => RevisionTag, changeReceiver: (change: TaggedChange<DefaultChangeset>) => void): DefaultEditBuilder;
19
+ buildEditor(mintRevisionTag: () => RevisionTag, changeReceiver: (change: TaggedChange<DefaultChangeset>) => void, options?: EditorOptions): IdBasedChangeFamilyDataEditor;
20
20
  }
21
21
  /**
22
22
  * @param change - The change to convert into a delta.
@@ -37,8 +37,13 @@ export declare function intoDelta(taggedChange: TaggedChange<ModularChangeset>):
37
37
  * @param change - The change to be applied.
38
38
  */
39
39
  export declare function relevantRemovedRoots(change: ModularChangeset): Iterable<DeltaDetachedNodeId>;
40
+ export type DetachedRootIds = readonly DetachedRootIdRange[];
41
+ export interface DetachedRootIdRange {
42
+ readonly first: ChangeAtomId;
43
+ readonly count: number;
44
+ }
40
45
  /**
41
- * Default editor for transactional tree data changes.
46
+ * Default editor for tree data changes.
42
47
  * @privateRemarks
43
48
  * When taking into account not just the content of the tree,
44
49
  * but also how the merge identities (and thus anchors, flex-tree and simple-tree nodes) of nodes before and after the edits correspond,
@@ -54,29 +59,7 @@ export declare function relevantRemovedRoots(change: ModularChangeset): Iterable
54
59
  * If/when such a mechanism becomes available, an evaluation should be done to determine if any existing editing operations should be changed to leverage it
55
60
  * (Possibly by adding opt ins at the view schema layer).
56
61
  */
57
- export interface IDefaultEditBuilder<TContent = TreeChunk> {
58
- /**
59
- * @param field - the value field which is being edited under the parent node
60
- * @returns An object with methods to edit the given field of the given parent.
61
- * The returned object can be used (i.e., have its methods called) multiple times but its lifetime
62
- * is bounded by the lifetime of this edit builder.
63
- */
64
- valueField(field: NormalizedFieldUpPath): ValueFieldEditBuilder<TContent>;
65
- /**
66
- * @param field - the optional field which is being edited under the parent node
67
- * @returns An object with methods to edit the given field of the given parent.
68
- * The returned object can be used (i.e., have its methods called) multiple times but its lifetime
69
- * is bounded by the lifetime of this edit builder.
70
- */
71
- optionalField(field: NormalizedFieldUpPath): OptionalFieldEditBuilder<TContent>;
72
- /**
73
- * @param field - the sequence field which is being edited under the parent node
74
- *
75
- * @returns An object with methods to edit the given field of the given parent.
76
- * The returned object can be used (i.e., have its methods called) multiple times but its lifetime
77
- * is bounded by the lifetime of this edit builder.
78
- */
79
- sequenceField(field: NormalizedFieldUpPath): SequenceFieldEditBuilder<TContent>;
62
+ export interface DataEditor<TContent, TDetachedRoot, TDetachedRoots> {
80
63
  /**
81
64
  * Moves a subsequence from one sequence field to another sequence field.
82
65
  *
@@ -102,49 +85,114 @@ export interface IDefaultEditBuilder<TContent = TreeChunk> {
102
85
  * Add a constraint that, for the revert of this change to apply, the document must be in the same state immediately before the revert is applied as it was after this change was applied.
103
86
  */
104
87
  addNoChangeConstraintOnRevert(): void;
88
+ /**
89
+ * Builds the detached roots for the given content.
90
+ * @param content - The content to be built into detached nodes.
91
+ *
92
+ * Requires SharedTreeFormatVersion.vDetachedRoots or later.
93
+ */
94
+ buildRoots(content: TContent): TDetachedRoots;
95
+ /**
96
+ * @param field - the value field which is being edited under the parent node
97
+ * @returns An object with methods to edit the given field of the given parent.
98
+ * The returned object can be used (i.e., have its methods called) multiple times but its lifetime
99
+ * is bounded by the lifetime of this edit builder.
100
+ */
101
+ valueField(field: NormalizedFieldUpPath): RequiredFieldEditor<TContent, TDetachedRoot>;
102
+ /**
103
+ * @param field - the optional field which is being edited under the parent node
104
+ * @returns An object with methods to edit the given field of the given parent.
105
+ * The returned object can be used (i.e., have its methods called) multiple times but its lifetime
106
+ * is bounded by the lifetime of this edit builder.
107
+ */
108
+ optionalField(field: NormalizedFieldUpPath): OptionalFieldEditor<TContent, TDetachedRoot>;
109
+ /**
110
+ * @param field - the sequence field which is being edited under the parent node
111
+ *
112
+ * @returns An object with methods to edit the given field of the given parent.
113
+ * The returned object can be used (i.e., have its methods called) multiple times but its lifetime
114
+ * is bounded by the lifetime of this edit builder.
115
+ */
116
+ sequenceField(field: NormalizedFieldUpPath): SequenceFieldEditor<TContent, TDetachedRoots>;
105
117
  }
118
+ export type IdBasedChangeFamilyDataEditor = ChangeFamilyEditor & DataEditor<TreeChunk, ChangeAtomId, DetachedRootIds>;
119
+ export declare function offsetChangesetLocalId(id: ChangesetLocalId, offset: number): ChangesetLocalId;
120
+ export declare function subtractChangesetLocalId(a: ChangesetLocalId, b: ChangesetLocalId): number;
106
121
  /**
107
- * Implementation of {@link IDefaultEditBuilder} based on the default set of supported field kinds.
122
+ * Implementation of {@link IdBasedChangeFamilyDataEditor} based on the default set of supported field kinds.
108
123
  * @sealed
109
124
  */
110
- export declare class DefaultEditBuilder implements ChangeFamilyEditor, IDefaultEditBuilder {
125
+ export declare class DefaultIdBasedDataEditor implements IdBasedChangeFamilyDataEditor {
111
126
  private readonly mintRevisionTag;
127
+ private readonly options;
112
128
  private readonly modularBuilder;
113
- constructor(family: ChangeFamily<ChangeFamilyEditor, DefaultChangeset>, mintRevisionTag: () => RevisionTag, changeReceiver: (change: TaggedChange<DefaultChangeset>) => void, codecOptions: CodecWriteOptions);
129
+ private readonly nodesWithoutCells;
130
+ constructor(family: ChangeFamily<ChangeFamilyEditor, DefaultChangeset>, mintRevisionTag: () => RevisionTag, changeReceiver: (change: TaggedChange<DefaultChangeset>) => void, options: EditorOptions, codecOptions: CodecWriteOptions);
114
131
  enterTransaction(): void;
115
132
  exitTransaction(): void;
116
- addNodeExistsConstraint(path: UpPath): void;
117
- addNodeExistsConstraintOnRevert(path: UpPath): void;
133
+ addNodeExistsConstraint(path: NormalizedUpPath): void;
134
+ addNodeExistsConstraintOnRevert(path: NormalizedUpPath): void;
118
135
  addNoChangeConstraint(): void;
119
136
  addNoChangeConstraintOnRevert(): void;
120
- valueField(field: FieldUpPath): ValueFieldEditBuilder<TreeChunk>;
121
- optionalField(field: FieldUpPath): OptionalFieldEditBuilder<TreeChunk>;
122
- move(sourceField: FieldUpPath, sourceIndex: number, count: number, destinationField: FieldUpPath, destIndex: number): void;
123
- sequenceField(field: FieldUpPath): SequenceFieldEditBuilder<TreeChunk>;
137
+ buildRoots(content: TreeChunk): DetachedRootIds;
138
+ valueField(field: NormalizedFieldUpPath): RequiredFieldEditor<TreeChunk, ChangeAtomId>;
139
+ optionalField(field: NormalizedFieldUpPath): OptionalFieldEditor<TreeChunk, ChangeAtomId>;
140
+ move(sourceField: NormalizedFieldUpPath, sourceIndex: number, count: number, destinationField: NormalizedFieldUpPath, destIndex: number): void;
141
+ sequenceField(field: NormalizedFieldUpPath): SequenceFieldEditor<TreeChunk, DetachedRootIds>;
124
142
  }
125
- export interface ValueFieldEditBuilder<TContent> {
143
+ export interface RequiredFieldEditor<TContent, TDetachedRoot> {
126
144
  /**
127
- * Issues a change which replaces the current newContent of the field with `newContent`.
145
+ * Issues a change which replaces the content of the field with the given detached node.
146
+ * @param content - The content to be attached in the field in the given order.
147
+ * Must represent a single detached node.
148
+ * Must have been created in the same JS turn.
149
+ *
150
+ * Requires SharedTreeFormatVersion.vDetachedRoots or later.
151
+ */
152
+ attach(content: TDetachedRoot): void;
153
+ /**
154
+ * Issues a change which replaces the content of the field with `newContent`.
128
155
  * @param newContent - the new content for the field.
129
156
  */
130
157
  set(newContent: TContent): void;
131
158
  }
132
- export interface OptionalFieldEditBuilder<TContent> {
159
+ export interface OptionalFieldEditor<TContent, TDetachedRoots> {
133
160
  /**
134
- * Issues a change which replaces the current newContent of the field with `newContent`.
161
+ * Issues a change which replaces the content of the field with the given detached node.
162
+ * @param content - The content to be attached in the field in the given order.
163
+ * Must represent a single detached node.
164
+ *
165
+ * Requires SharedTreeFormatVersion.vDetachedRoots or later.
166
+ */
167
+ attach(content: TDetachedRoots | undefined, wasEmpty: boolean): void;
168
+ /**
169
+ * Issues a change which clears content of the field.
170
+ * @param wasEmpty - whether the field is empty when creating this change
171
+ */
172
+ clear(wasEmpty: boolean): void;
173
+ /**
174
+ * Issues a change which replaces the content of the field with `newContent`
135
175
  * @param newContent - the new content for the field.
136
- * @param wasEmpty - whether the field is empty when creating this change.
176
+ * @param wasEmpty - whether the field is empty when creating this change
137
177
  */
138
178
  set(newContent: TContent | undefined, wasEmpty: boolean): void;
139
179
  }
140
180
  /**
141
- * Edit builder for the sequence field kind.
181
+ * Editor for the sequence field kind.
142
182
  */
143
- export interface SequenceFieldEditBuilder<TContent, TRemoved = void> {
183
+ export interface SequenceFieldEditor<TContent, TDetachedRoots, TRemoved = void> {
184
+ /**
185
+ * Issues a change which attaches a sequence of detached nodes at the given `index`.
186
+ * @param index - The index at which to attach the detached nodes.
187
+ * @param detachedContent - The content to be attached in the field in the given order. Each node must be detached.
188
+ *
189
+ * Requires SharedTreeFormatVersion.vDetachedRoots or later.
190
+ */
191
+ attach(index: number, detachedContent: TDetachedRoots): void;
144
192
  /**
145
193
  * Issues a change which inserts the `newContent` at the given `index`.
146
194
  * @param index - the index at which to insert the `newContent`.
147
- * @param newContent - the new content to be inserted in the field. Cursor can be in either Field or Node mode.
195
+ * @param newContent - the new content to be inserted in the field.
148
196
  */
149
197
  insert(index: number, newContent: TContent): void;
150
198
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"defaultEditBuilder.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/default-schema/defaultEditBuilder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAEN,KAAK,qBAAqB,EAC1B,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,qBAAqB,EAC1B,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,MAAM,EAGX,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAKN,KAAK,gBAAgB,EAIrB,MAAM,4BAA4B,CAAC;AAMpC,MAAM,MAAM,gBAAgB,GAAG,gBAAgB,CAAC;AAEhD;;;;GAIG;AACH,qBAAa,mBACZ,YAAW,YAAY,CAAC,kBAAkB,EAAE,gBAAgB,CAAC;IAE7D,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAsB;gBAGnD,MAAM,EAAE,YAAY,CAAC,gBAAgB,EAAE,qBAAqB,CAAC,EAC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/D;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;IAClE;;;;OAIG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,GAAG,IAAI,CAAC;IAElD;;;;OAIG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,QAAQ,CAAC;CAC/C"}
1
+ {"version":3,"file":"defaultEditBuilder.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/default-schema/defaultEditBuilder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EACN,KAAK,YAAY,EACjB,KAAK,qBAAqB,EAC1B,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,qBAAqB,EAC1B,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,SAAS,EAId,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAMN,KAAK,gBAAgB,EAIrB,MAAM,4BAA4B,CAAC;AAMpC,MAAM,MAAM,gBAAgB,GAAG,gBAAgB,CAAC;AAEhD;;;;GAIG;AACH,qBAAa,mBACZ,YAAW,YAAY,CAAC,6BAA6B,EAAE,gBAAgB,CAAC;IAExE,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAsB;gBAGnD,MAAM,EAAE,YAAY,CAAC,gBAAgB,EAAE,qBAAqB,CAAC,EAC7D,YAAY,EAAE,iBAAiB;IAKhC,IAAW,OAAO,IAAI,aAAa,CAAC,gBAAgB,CAAC,CAEpD;IAED,IAAW,MAAM,IAAI,YAAY,CAAC,gBAAgB,EAAE,qBAAqB,CAAC,CAEzE;IAEM,W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