@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
@@ -1 +1 @@
1
- {"version":3,"file":"defaultFieldKinds.js","sourceRoot":"","sources":["../../../src/feature-libraries/default-schema/defaultFieldKinds.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,qCAAqC,CAAC;AAG3D,OAAO,EAGN,4BAA4B,EAC5B,YAAY,GACZ,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,EAMN,aAAa,EAEb,0BAA0B,EAE1B,+BAA+B,GAC/B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAEtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE1D;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAA0B;IACrD,OAAO,EAAE,+BAA+B,CAAC;QACxC,O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UAAU,EAAE,CAAC,CAAC,CAAC,CACnF,CAAC;AAoBF;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAOnB,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC;AAE5D;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAqB;IACpD,UAAU;CACV,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { fail } from \"@fluidframework/core-utils/internal\";\n\nimport type { CodecTree } from \"../../codec/index.js\";\nimport {\n\ttype DeltaDetachedNodeId,\n\ttype FieldKindIdentifier,\n\tforbiddenFieldKindIdentifier,\n\tMultiplicity,\n} from \"../../core/index.js\";\nimport { identifierFieldIdentifier } from \"../fieldKindIdentifiers.js\";\nimport {\n\ttype FieldChangeDelta,\n\ttype FieldChangeHandler,\n\ttype FieldEditor,\n\ttype FieldKindConfiguration,\n\ttype FieldKindConfigurationEntry,\n\tFlexFieldKind,\n\ttype FullSchemaPolicy,\n\tModularChangeFormatVersion,\n\ttype ToDelta,\n\treferenceFreeFieldChangeRebaser,\n} from \"../modular-schema/index.js\";\nimport { optional, required } from \"../optional-field/index.js\";\nimport { sequence } from \"../sequence-field/index.js\";\n\nimport { noChangeCodecFamily } from \"./noChangeCodecs.js\";\n\n/**\n * ChangeHandler that only handles no-op / identity changes.\n */\nexport const noChangeHandler: FieldChangeHandler<0> = {\n\trebaser: referenceFreeFieldChangeRebaser({\n\t\tcompose: (change1: 0, change2: 0) => 0,\n\t\tinvert: (changes: 0) => 0,\n\t\trebase: (change: 0, over: 0) => 0,\n\t\tmute: (changes: 0) => 0,\n\t}),\n\tcodecsFactory: () => noChangeCodecFamily,\n\teditor: { buildChildChanges: () => fail(0xb0d /* Child changes not supported */) },\n\tintoDelta: (change, deltaFromChild: ToDelta): FieldChangeDelta => ({}),\n\trelevantRemovedRoots: (change): Iterable<DeltaDetachedNodeId> => [],\n\tisEmpty: (change: 0) => true,\n\tgetNestedChanges: (change: 0) => [],\n\tcreateEmpty: () => 0,\n\tgetCrossFieldKeys: () => [],\n};\n\n/**\n * Exactly one identifier.\n */\nexport const identifier: Identifier = new FlexFieldKind(\n\tidentifierFieldIdentifier,\n\tMultiplicity.Single,\n\t{\n\t\tchangeHandler: noChangeHandler,\n\t\t// By omitting required here,\n\t\t// this is making a policy choice that a schema upgrade cannot be done from required to identifier.\n\t\t// Since an identifier can be upgraded into a required field,\n\t\t// preventing the inverse helps ensure that schema upgrades are monotonic.\n\t\t// Which direction is allowed is a subjective policy choice.\n\t\tallowMonotonicUpgradeFrom: new Set([]),\n\t},\n);\n\n/**\n * Exactly 0 items.\n *\n * Using Forbidden makes what types are listed for allowed in a field irrelevant\n * since the field will never have values in it.\n *\n * Using Forbidden is equivalent to picking a kind that permits empty (like sequence or optional)\n * and having no allowed types (or only never types).\n * Because of this, its possible to express everything constraint wise without Forbidden,\n * but using Forbidden can be more semantically clear than optional with no allowed types.\n *\n * For view schema, this can be useful if you need to:\n * - run a specific out of schema handler when a field is present,\n * but otherwise are ignoring or tolerating (ex: via extra fields) unmentioned fields.\n * - prevent a specific field from being used as an extra field\n * (perhaps for some past of future compatibility reason)\n * - keep a field in a schema for metadata purposes\n * (ex: for improved error messaging, error handling or documentation)\n * that is not used in this specific version of the schema (ex: to document what it was or will be used for).\n *\n * For stored schema, this can be useful if you need to:\n * - have a field which can have its schema updated to Optional or Sequence of any type.\n * - to exclude a field from extra fields\n * - for the schema system to use as a default for fields which aren't declared\n * (ex: when updating a field that did not exist into one that does)\n *\n * See {@link emptyField} for a constant, reusable field using Forbidden.\n */\nexport const forbidden: Forbidden = new FlexFieldKind(\n\tforbiddenFieldKindIdentifier,\n\tMultiplicity.Forbidden,\n\t{\n\t\tchangeHandler: noChangeHandler,\n\t\tallowMonotonicUpgradeFrom: new Set(),\n\t},\n);\n\nexport const fieldKindConfigurations: ReadonlyMap<\n\tModularChangeFormatVersion,\n\tFieldKindConfiguration\n> = new Map<ModularChangeFormatVersion, FieldKindConfiguration>([\n\t[\n\t\tModularChangeFormatVersion.v3,\n\t\tnew Map<FieldKindIdentifier, FieldKindConfigurationEntry>([\n\t\t\t[required.identifier, { kind: required, formatVersion: 2 }],\n\t\t\t[optional.identifier, { kind: optional, formatVersion: 2 }],\n\t\t\t[sequence.identifier, { kind: sequence, formatVersion: 2 }],\n\t\t\t[forbidden.identifier, { kind: forbidden, formatVersion: 1 }],\n\t\t\t[identifier.identifier, { kind: identifier, formatVersion: 1 }],\n\t\t]),\n\t],\n\t[\n\t\tModularChangeFormatVersion.v4,\n\t\tnew Map<FieldKindIdentifier, FieldKindConfigurationEntry>([\n\t\t\t[required.identifier, { kind: required, formatVersion: 2 }],\n\t\t\t[optional.identifier, { kind: optional, formatVersion: 2 }],\n\t\t\t[sequence.identifier, { kind: sequence, formatVersion: 3 }],\n\t\t\t[forbidden.identifier, { kind: forbidden, formatVersion: 1 }],\n\t\t\t[identifier.identifier, { kind: identifier, formatVersion: 1 }],\n\t\t]),\n\t],\n\t[\n\t\tModularChangeFormatVersion.v5,\n\t\tnew Map<FieldKindIdentifier, FieldKindConfigurationEntry>([\n\t\t\t[required.identifier, { kind: required, formatVersion: 2 }],\n\t\t\t[optional.identifier, { kind: optional, formatVersion: 2 }],\n\t\t\t[sequence.identifier, { kind: sequence, formatVersion: 3 }],\n\t\t\t[forbidden.identifier, { kind: forbidden, formatVersion: 1 }],\n\t\t\t[identifier.identifier, { kind: identifier, formatVersion: 1 }],\n\t\t]),\n\t],\n]);\n\nexport function getCodecTreeForModularChangeFormat(\n\tversion: ModularChangeFormatVersion,\n): CodecTree {\n\tconst dependencies =\n\t\tfieldKindConfigurations.get(version) ?? fail(0xc7c /* Unknown modular change format */);\n\tconst children: CodecTree[] = [...dependencies.entries()].map(\n\t\t([key, { formatVersion }]) => ({\n\t\t\tname: `FieldKind:${key}`,\n\t\t\tversion: formatVersion,\n\t\t}),\n\t);\n\treturn {\n\t\tname: \"ModularChange\",\n\t\tversion,\n\t\tchildren,\n\t};\n}\n\n/**\n * All supported field kinds.\n *\n * @privateRemarks\n * Before making a SharedTree format change which impacts which set of field kinds are allowed,\n * code which uses this should be audited for compatibility considerations.\n */\nexport const fieldKinds: ReadonlyMap<FieldKindIdentifier, FlexFieldKind> = new Map(\n\t[required, optional, sequence, identifier, forbidden].map((s) => [s.identifier, s]),\n);\n\n// Create named Aliases for nicer intellisense.\n\n// TODO: Find a way to make docs like {@inheritDoc required} work in vscode.\n// TODO: ensure thy work in generated docs.\n// TODO: add these comments to the rest of the cases below.\nexport interface Identifier\n\textends FlexFieldKind<\n\t\tFieldEditor<0>,\n\t\ttypeof identifierFieldIdentifier,\n\t\tMultiplicity.Single\n\t> {}\nexport interface Forbidden\n\textends FlexFieldKind<\n\t\tFieldEditor<0>,\n\t\ttypeof forbiddenFieldKindIdentifier,\n\t\tMultiplicity.Forbidden\n\t> {}\n\n/**\n * Default FieldKinds with their editor types erased.\n */\nexport const FieldKinds: {\n\t// TODO: inheritDoc for these somehow\n\treadonly required: typeof required;\n\treadonly optional: typeof optional;\n\treadonly sequence: typeof sequence;\n\treadonly identifier: Identifier;\n\treadonly forbidden: Forbidden;\n} = { required, optional, sequence, identifier, forbidden };\n\n/**\n * FullSchemaPolicy with the default field kinds.\n */\nexport const defaultSchemaPolicy: FullSchemaPolicy = {\n\tfieldKinds,\n};\n"]}
1
+ {"version":3,"file":"defaultFieldKinds.js","sourceRoot":"","sources":["../../../src/feature-libraries/default-schema/defaultFieldKinds.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,qCAAqC,CAAC;AAG3D,OAAO,EAGN,4BAA4B,EAC5B,YAAY,GACZ,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,EAKN,aAAa,EAEb,0BAA0B,EAE1B,+BAA+B,GAC/B,M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SAAS,EAAE,aAAa,EAAE,CAAC,EAAE,CAAC;YAC7D,CAAC,UAAU,CAAC,UAAU,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,aAAa,EAAE,CAAC,EAAE,CAAC;SAC/D,CAAC;KACF;CACD,CAAC,CAAC;AAEH,MAAM,UAAU,kCAAkC,CACjD,OAAmC;IAEnC,MAAM,YAAY,GACjB,uBAAuB,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,mCAAmC,CAAC,CAAC;IACzF,MAAM,QAAQ,GAAgB,CAAC,GAAG,YAAY,CAAC,OAAO,EAAE,CAAC,CAAC,GAAG,CAC5D,CAAC,CAAC,GAAG,EAAE,EAAE,aAAa,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;QAC9B,IAAI,EAAE,aAAa,GAAG,EAAE;QACxB,OAAO,EAAE,aAAa;KACtB,CAAC,CACF,CAAC;IACF,OAAO;QACN,IAAI,EAAE,eAAe;QACrB,OAAO;QACP,QAAQ;KACR,CAAC;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,UAAU,GAAoD,IAAI,GAAG,CACjF,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,CACnF,CAAC;AAoBF;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAOnB,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC;AAE5D;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAqB;IACpD,UAAU;CACV,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { fail } from \"@fluidframework/core-utils/internal\";\n\nimport type { CodecTree } from \"../../codec/index.js\";\nimport {\n\ttype DeltaFieldChanges,\n\ttype FieldKindIdentifier,\n\tforbiddenFieldKindIdentifier,\n\tMultiplicity,\n} from \"../../core/index.js\";\nimport { identifierFieldIdentifier } from \"../fieldKindIdentifiers.js\";\nimport {\n\ttype FieldChangeHandler,\n\ttype FieldEditor,\n\ttype FieldKindConfiguration,\n\ttype FieldKindConfigurationEntry,\n\tFlexFieldKind,\n\ttype FullSchemaPolicy,\n\tModularChangeFormatVersion,\n\ttype ToDelta,\n\treferenceFreeFieldChangeRebaser,\n} from \"../modular-schema/index.js\";\nimport { optional, required } from \"../optional-field/index.js\";\nimport { sequence } from \"../sequence-field/index.js\";\n\nimport { noChangeCodecFamily } from \"./noChangeCodecs.js\";\n\n/**\n * ChangeHandler that only handles no-op / identity changes.\n */\nexport const noChangeHandler: FieldChangeHandler<0> = {\n\trebaser: referenceFreeFieldChangeRebaser({\n\t\tcompose: (change1: 0, change2: 0) => 0,\n\t\tinvert: (changes: 0) => 0,\n\t\trebase: (change: 0, over: 0) => 0,\n\t\tmute: (changes: 0) => 0,\n\t}),\n\tcodecsFactory: () => noChangeCodecFamily,\n\teditor: { buildChildChanges: () => fail(0xb0d /* Child changes not supported */) },\n\tintoDelta: (change, deltaFromChild: ToDelta): DeltaFieldChanges => ({ marks: [] }),\n\tisEmpty: (change: 0) => true,\n\tgetNestedChanges: (change: 0) => [],\n\tcreateEmpty: () => 0,\n\tgetCrossFieldKeys: () => [],\n\tgetDetachCellIds: () => [],\n};\n\n/**\n * Exactly one identifier.\n */\nexport const identifier: Identifier = new FlexFieldKind(\n\tidentifierFieldIdentifier,\n\tMultiplicity.Single,\n\t{\n\t\tchangeHandler: noChangeHandler,\n\t\t// By omitting required here,\n\t\t// this is making a policy choice that a schema upgrade cannot be done from required to identifier.\n\t\t// Since an identifier can be upgraded into a required field,\n\t\t// preventing the inverse helps ensure that schema upgrades are monotonic.\n\t\t// Which direction is allowed is a subjective policy choice.\n\t\tallowMonotonicUpgradeFrom: new Set([]),\n\t},\n);\n\n/**\n * Exactly 0 items.\n *\n * Using Forbidden makes what types are listed for allowed in a field irrelevant\n * since the field will never have values in it.\n *\n * Using Forbidden is equivalent to picking a kind that permits empty (like sequence or optional)\n * and having no allowed types (or only never types).\n * Because of this, its possible to express everything constraint wise without Forbidden,\n * but using Forbidden can be more semantically clear than optional with no allowed types.\n *\n * For view schema, this can be useful if you need to:\n * - run a specific out of schema handler when a field is present,\n * but otherwise are ignoring or tolerating (ex: via extra fields) unmentioned fields.\n * - prevent a specific field from being used as an extra field\n * (perhaps for some past of future compatibility reason)\n * - keep a field in a schema for metadata purposes\n * (ex: for improved error messaging, error handling or documentation)\n * that is not used in this specific version of the schema (ex: to document what it was or will be used for).\n *\n * For stored schema, this can be useful if you need to:\n * - have a field which can have its schema updated to Optional or Sequence of any type.\n * - to exclude a field from extra fields\n * - for the schema system to use as a default for fields which aren't declared\n * (ex: when updating a field that did not exist into one that does)\n *\n * See {@link emptyField} for a constant, reusable field using Forbidden.\n */\nexport const forbidden: Forbidden = new FlexFieldKind(\n\tforbiddenFieldKindIdentifier,\n\tMultiplicity.Forbidden,\n\t{\n\t\tchangeHandler: noChangeHandler,\n\t\tallowMonotonicUpgradeFrom: new Set(),\n\t},\n);\n\nexport const fieldKindConfigurations: ReadonlyMap<\n\tModularChangeFormatVersion,\n\tFieldKindConfiguration\n> = new Map<ModularChangeFormatVersion, FieldKindConfiguration>([\n\t[\n\t\tModularChangeFormatVersion.v3,\n\t\tnew Map<FieldKindIdentifier, FieldKindConfigurationEntry>([\n\t\t\t[required.identifier, { kind: required, formatVersion: 2 }],\n\t\t\t[optional.identifier, { kind: optional, formatVersion: 2 }],\n\t\t\t[sequence.identifier, { kind: sequence, formatVersion: 2 }],\n\t\t\t[forbidden.identifier, { kind: forbidden, formatVersion: 1 }],\n\t\t\t[identifier.identifier, { kind: identifier, formatVersion: 1 }],\n\t\t]),\n\t],\n\t[\n\t\tModularChangeFormatVersion.v4,\n\t\tnew Map<FieldKindIdentifier, FieldKindConfigurationEntry>([\n\t\t\t[required.identifier, { kind: required, formatVersion: 2 }],\n\t\t\t[optional.identifier, { kind: optional, formatVersion: 2 }],\n\t\t\t[sequence.identifier, { kind: sequence, formatVersion: 3 }],\n\t\t\t[forbidden.identifier, { kind: forbidden, formatVersion: 1 }],\n\t\t\t[identifier.identifier, { kind: identifier, formatVersion: 1 }],\n\t\t]),\n\t],\n\t[\n\t\tModularChangeFormatVersion.v5,\n\t\tnew Map<FieldKindIdentifier, FieldKindConfigurationEntry>([\n\t\t\t[required.identifier, { kind: required, formatVersion: 2 }],\n\t\t\t[optional.identifier, { kind: optional, formatVersion: 2 }],\n\t\t\t[sequence.identifier, { kind: sequence, formatVersion: 3 }],\n\t\t\t[forbidden.identifier, { kind: forbidden, formatVersion: 1 }],\n\t\t\t[identifier.identifier, { kind: identifier, formatVersion: 1 }],\n\t\t]),\n\t],\n\t[\n\t\tModularChangeFormatVersion.vDetachedRoots,\n\t\tnew Map<FieldKindIdentifier, FieldKindConfigurationEntry>([\n\t\t\t[required.identifier, { kind: required, formatVersion: 2 }],\n\t\t\t[optional.identifier, { kind: optional, formatVersion: 3 }],\n\t\t\t[sequence.identifier, { kind: sequence, formatVersion: 2 }],\n\t\t\t[forbidden.identifier, { kind: forbidden, formatVersion: 1 }],\n\t\t\t[identifier.identifier, { kind: identifier, formatVersion: 1 }],\n\t\t]),\n\t],\n]);\n\nexport function getCodecTreeForModularChangeFormat(\n\tversion: ModularChangeFormatVersion,\n): CodecTree {\n\tconst dependencies =\n\t\tfieldKindConfigurations.get(version) ?? fail(0xc7c /* Unknown modular change format */);\n\tconst children: CodecTree[] = [...dependencies.entries()].map(\n\t\t([key, { formatVersion }]) => ({\n\t\t\tname: `FieldKind:${key}`,\n\t\t\tversion: formatVersion,\n\t\t}),\n\t);\n\treturn {\n\t\tname: \"ModularChange\",\n\t\tversion,\n\t\tchildren,\n\t};\n}\n\n/**\n * All supported field kinds.\n *\n * @privateRemarks\n * Before making a SharedTree format change which impacts which set of field kinds are allowed,\n * code which uses this should be audited for compatibility considerations.\n */\nexport const fieldKinds: ReadonlyMap<FieldKindIdentifier, FlexFieldKind> = new Map(\n\t[required, optional, sequence, identifier, forbidden].map((s) => [s.identifier, s]),\n);\n\n// Create named Aliases for nicer intellisense.\n\n// TODO: Find a way to make docs like {@inheritDoc required} work in vscode.\n// TODO: ensure thy work in generated docs.\n// TODO: add these comments to the rest of the cases below.\nexport interface Identifier\n\textends FlexFieldKind<\n\t\tFieldEditor<0>,\n\t\ttypeof identifierFieldIdentifier,\n\t\tMultiplicity.Single\n\t> {}\nexport interface Forbidden\n\textends FlexFieldKind<\n\t\tFieldEditor<0>,\n\t\ttypeof forbiddenFieldKindIdentifier,\n\t\tMultiplicity.Forbidden\n\t> {}\n\n/**\n * Default FieldKinds with their editor types erased.\n */\nexport const FieldKinds: {\n\t// TODO: inheritDoc for these somehow\n\treadonly required: typeof required;\n\treadonly optional: typeof optional;\n\treadonly sequence: typeof sequence;\n\treadonly identifier: Identifier;\n\treadonly forbidden: Forbidden;\n} = { required, optional, sequence, identifier, forbidden };\n\n/**\n * FullSchemaPolicy with the default field kinds.\n */\nexport const defaultSchemaPolicy: FullSchemaPolicy = {\n\tfieldKinds,\n};\n"]}
@@ -3,6 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  export { FieldKinds, fieldKinds, fieldKindConfigurations, getCodecTreeForModularChangeFormat, defaultSchemaPolicy, } from "./defaultFieldKinds.js";
6
- export { type DefaultChangeset, DefaultChangeFamily, DefaultEditBuilder, type IDefaultEditBuilder, type ValueFieldEditBuilder, type OptionalFieldEditBuilder, type SequenceFieldEditBuilder, intoDelta, relevantRemovedRoots, } from "./defaultEditBuilder.js";
6
+ export { type DefaultChangeset, type DetachedRootIds, type DetachedRootIdRange, DefaultChangeFamily, type IdBasedChangeFamilyDataEditor, DefaultIdBasedDataEditor, type DataEditor, type RequiredFieldEditor, type OptionalFieldEditor, type SequenceFieldEditor, intoDelta, relevantRemovedRoots, } from "./defaultEditBuilder.js";
7
+ export { type DetachedRootLocation, type DetachedRootsLocation, type Locator, LocationBasedDataEditor, type ILocationBasedDataEditor, } from "./locationBasedEditBuilder.js";
7
8
  export { MappedEditBuilder } from "./mappedEditBuilder.js";
8
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/default-schema/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,UAAU,EACV,UAAU,EACV,uBAAuB,EACvB,kCAAkC,EAClC,mBAAmB,GACnB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACN,KAAK,gBAAgB,EACrB,mBAAmB,EACnB,kBAAkB,EAClB,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAC7B,SAAS,EACT,oBAAoB,GACpB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/default-schema/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,UAAU,EACV,UAAU,EACV,uBAAuB,EACvB,kCAAkC,EAClC,mBAAmB,GACnB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACN,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,mBAAmB,EACnB,KAAK,6BAA6B,EAClC,wBAAwB,EACxB,KAAK,UAAU,EACf,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,SAAS,EACT,oBAAoB,GACpB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACN,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,OAAO,EACZ,uBAAuB,EACvB,KAAK,wBAAwB,GAC7B,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC"}
@@ -3,6 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  export { FieldKinds, fieldKinds, fieldKindConfigurations, getCodecTreeForModularChangeFormat, defaultSchemaPolicy, } from "./defaultFieldKinds.js";
6
- export { DefaultChangeFamily, DefaultEditBuilder, intoDelta, relevantRemovedRoots, } from "./defaultEditBuilder.js";
6
+ export { DefaultChangeFamily, DefaultIdBasedDataEditor, intoDelta, relevantRemovedRoots, } from "./defaultEditBuilder.js";
7
+ export { LocationBasedDataEditor, } from "./locationBasedEditBuilder.js";
7
8
  export { MappedEditBuilder } from "./mappedEditBuilder.js";
8
9
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/feature-libraries/default-schema/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,UAAU,EACV,UAAU,EACV,uBAAuB,EACvB,kCAAkC,EAClC,mBAAmB,GACnB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAEN,mBAAmB,EACnB,kBAAkB,EAKlB,SAAS,EACT,oBAAoB,GACpB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\tFieldKinds,\n\tfieldKinds,\n\tfieldKindConfigurations,\n\tgetCodecTreeForModularChangeFormat,\n\tdefaultSchemaPolicy,\n} from \"./defaultFieldKinds.js\";\n\nexport {\n\ttype DefaultChangeset,\n\tDefaultChangeFamily,\n\tDefaultEditBuilder,\n\ttype IDefaultEditBuilder,\n\ttype ValueFieldEditBuilder,\n\ttype OptionalFieldEditBuilder,\n\ttype SequenceFieldEditBuilder,\n\tintoDelta,\n\trelevantRemovedRoots,\n} from \"./defaultEditBuilder.js\";\n\nexport { MappedEditBuilder } from \"./mappedEditBuilder.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/feature-libraries/default-schema/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,UAAU,EACV,UAAU,EACV,uBAAuB,EACvB,kCAAkC,EAClC,mBAAmB,GACnB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAIN,mBAAmB,EAEnB,wBAAwB,EAKxB,SAAS,EACT,oBAAoB,GACpB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAIN,uBAAuB,GAEvB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\tFieldKinds,\n\tfieldKinds,\n\tfieldKindConfigurations,\n\tgetCodecTreeForModularChangeFormat,\n\tdefaultSchemaPolicy,\n} from \"./defaultFieldKinds.js\";\n\nexport {\n\ttype DefaultChangeset,\n\ttype DetachedRootIds,\n\ttype DetachedRootIdRange,\n\tDefaultChangeFamily,\n\ttype IdBasedChangeFamilyDataEditor,\n\tDefaultIdBasedDataEditor,\n\ttype DataEditor,\n\ttype RequiredFieldEditor,\n\ttype OptionalFieldEditor,\n\ttype SequenceFieldEditor,\n\tintoDelta,\n\trelevantRemovedRoots,\n} from \"./defaultEditBuilder.js\";\n\nexport {\n\ttype DetachedRootLocation,\n\ttype DetachedRootsLocation,\n\ttype Locator,\n\tLocationBasedDataEditor,\n\ttype ILocationBasedDataEditor,\n} from \"./locationBasedEditBuilder.js\";\n\nexport { MappedEditBuilder } from \"./mappedEditBuilder.js\";\n"]}
@@ -0,0 +1,40 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { type ChangeAtomId, type FieldKey, type FieldUpPath, type UpPath, type TreeChunk, type EditorOptions } from "../../core/index.js";
6
+ import type { DetachedRootIds, DataEditor, OptionalFieldEditor, RequiredFieldEditor, SequenceFieldEditor } from "./defaultEditBuilder.js";
7
+ export type DetachedRootLocation = FieldKey;
8
+ export type DetachedRootsLocation = readonly DetachedRootRangeLocation[];
9
+ export interface DetachedRootRangeLocation {
10
+ readonly field: FieldKey;
11
+ readonly count: number;
12
+ }
13
+ export interface Locator {
14
+ locationFromId(id: ChangeAtomId): DetachedRootLocation;
15
+ idFromLocation(id: DetachedRootLocation): ChangeAtomId;
16
+ locationsFromIdRanges(id: DetachedRootIds): DetachedRootsLocation;
17
+ idRangesFromLocations(id: DetachedRootsLocation): DetachedRootIds;
18
+ isAttachable(id: ChangeAtomId): boolean | undefined;
19
+ }
20
+ export type ILocationBasedDataEditor = DataEditor<TreeChunk, DetachedRootLocation, DetachedRootsLocation>;
21
+ /**
22
+ * Implementation of {@link DataEditor} based on the default set of supported field kinds.
23
+ * @sealed
24
+ */
25
+ export declare class LocationBasedDataEditor implements DataEditor<TreeChunk, DetachedRootLocation, DetachedRootsLocation> {
26
+ private readonly idBasedEditor;
27
+ private readonly locator;
28
+ private readonly options;
29
+ constructor(idBasedEditor: DataEditor<TreeChunk, ChangeAtomId, DetachedRootIds>, locator: Locator, options: EditorOptions);
30
+ addNodeExistsConstraint(path: UpPath): void;
31
+ addNodeExistsConstraintOnRevert(path: UpPath): void;
32
+ addNoChangeConstraint(): void;
33
+ addNoChangeConstraintOnRevert(): void;
34
+ buildRoots(content: TreeChunk): DetachedRootsLocation;
35
+ valueField(field: FieldUpPath): RequiredFieldEditor<TreeChunk, DetachedRootLocation>;
36
+ optionalField(field: FieldUpPath): OptionalFieldEditor<TreeChunk, DetachedRootLocation>;
37
+ move(sourceField: FieldUpPath, sourceIndex: number, count: number, destinationField: FieldUpPath, destIndex: number): void;
38
+ sequenceField(field: FieldUpPath): SequenceFieldEditor<TreeChunk, DetachedRootsLocation>;
39
+ }
40
+ //# sourceMappingURL=locationBasedEditBuilder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locationBasedEditBuilder.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/default-schema/locationBasedEditBuilder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EACN,KAAK,YAAY,EACjB,KAAK,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,MAAM,EACX,KAAK,SAAS,EAMd,KAAK,aAAa,EAClB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EACX,eAAe,EACf,UAAU,EACV,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,MAAM,oBAAoB,GAAG,QAAQ,CAAC;AAC5C,MAAM,MAAM,qBAAqB,GAAG,SAAS,yBAAyB,EAAE,CAAC;AACzE,MAAM,WAAW,yBAAyB;IACzC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,OAAO;IACvB,cAAc,CAAC,EAAE,EAAE,YAAY,GAAG,oBAAoB,CAAC;IACvD,cAAc,CAAC,EAAE,EAAE,oBAAoB,GAAG,YAAY,CAAC;IACvD,qBAAqB,CAAC,EAAE,EAAE,eAAe,GAAG,qBAAqB,CAAC;IAClE,qBAAqB,CAAC,EAAE,EAAE,qBAAqB,GAAG,eAAe,CAAC;IAClE,YAAY,CAAC,EAAE,EAAE,YAAY,GAAG,OAAO,GAAG,SAAS,CAAC;CACpD;AAED,MAAM,MAAM,wBAAwB,GAAG,UAAU,CAChD,SAAS,EACT,oBAAoB,EACpB,qBAAqB,CACrB,CAAC;AAEF;;;GAGG;AACH,qBAAa,uBACZ,YAAW,UAAU,CAAC,SAAS,EAAE,oBAAoB,EAAE,qBAAqB,CAAC;IAG5E,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAFP,aAAa,EAAE,UAAU,CAAC,SAAS,EAAE,YAAY,EAAE,eAAe,CAAC,EACnE,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,aAAa;IAGjC,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAK3C,+BAA+B,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAKnD,qBAAqB,IAAI,IAAI;IAI7B,6BAA6B,IAAI,IAAI;IAIrC,UAAU,CAAC,OAAO,EAAE,SAAS,GAAG,qBAAqB;IAMrD,UAAU,CAAC,KAAK,EAAE,WAAW,GAAG,mBAAmB,CAAC,SAAS,EAAE,oBAAoB,CAAC;IAiBpF,aAAa,CACnB,KAAK,EAAE,WAAW,GAChB,mBAAmB,CAAC,SAAS,EAAE,oBAAoB,CAAC;IAwBhD,IAAI,CACV,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,MAAM,EACb,gBAAgB,EAAE,WAAW,EAC7B,SAAS,EAAE,MAAM,GACf,IAAI;IAUA,aAAa,CACnB,KAAK,EAAE,WAAW,GAChB,mBAAmB,CAAC,SAAS,EAAE,qBAAqB,CAAC;CAmBxD"}
@@ -0,0 +1,149 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { UsageError } from "@fluidframework/telemetry-utils/internal";
6
+ import { rootFieldKey, makeDetachedNodeId, offsetChangeAtomId, } from "../../core/index.js";
7
+ /**
8
+ * Implementation of {@link DataEditor} based on the default set of supported field kinds.
9
+ * @sealed
10
+ */
11
+ export class LocationBasedDataEditor {
12
+ constructor(idBasedEditor, locator, options) {
13
+ this.idBasedEditor = idBasedEditor;
14
+ this.locator = locator;
15
+ this.options = options;
16
+ }
17
+ addNodeExistsConstraint(path) {
18
+ const normal = normalizeUpPath(path, this.locator, this.options);
19
+ this.idBasedEditor.addNodeExistsConstraint(normal);
20
+ }
21
+ addNodeExistsConstraintOnRevert(path) {
22
+ const normal = normalizeUpPath(path, this.locator, this.options);
23
+ this.idBasedEditor.addNodeExistsConstraintOnRevert(normal);
24
+ }
25
+ addNoChangeConstraint() {
26
+ this.idBasedEditor.addNoChangeConstraint();
27
+ }
28
+ addNoChangeConstraintOnRevert() {
29
+ this.idBasedEditor.addNoChangeConstraintOnRevert();
30
+ }
31
+ buildRoots(content) {
32
+ const roots = this.idBasedEditor.buildRoots(content);
33
+ const locations = this.locator.locationsFromIdRanges(roots);
34
+ return locations;
35
+ }
36
+ valueField(field) {
37
+ const normal = normalizeFieldUpPath(field, this.locator, this.options);
38
+ const lowLevelEditor = this.idBasedEditor.valueField(normal);
39
+ const locator = this.locator;
40
+ const editBuilder = {
41
+ set: (newContent) => {
42
+ lowLevelEditor.set(newContent);
43
+ },
44
+ attach: (newContent) => {
45
+ const changeAtom = locator.idFromLocation(newContent);
46
+ validateIsAttachable(changeAtom, locator);
47
+ lowLevelEditor.attach(changeAtom);
48
+ },
49
+ };
50
+ return editBuilder;
51
+ }
52
+ optionalField(field) {
53
+ const normal = normalizeFieldUpPath(field, this.locator, this.options);
54
+ const lowLevelEditor = this.idBasedEditor.optionalField(normal);
55
+ const locator = this.locator;
56
+ const editBuilder = {
57
+ set: (newContent, wasEmpty) => {
58
+ lowLevelEditor.set(newContent, wasEmpty);
59
+ },
60
+ attach: (newContent, wasEmpty) => {
61
+ if (newContent === undefined) {
62
+ editBuilder.clear(wasEmpty);
63
+ return;
64
+ }
65
+ const changeAtom = locator.idFromLocation(newContent);
66
+ validateIsAttachable(changeAtom, locator);
67
+ lowLevelEditor.attach(changeAtom, wasEmpty);
68
+ },
69
+ clear: (wasEmpty) => {
70
+ lowLevelEditor.clear(wasEmpty);
71
+ },
72
+ };
73
+ return editBuilder;
74
+ }
75
+ move(sourceField, sourceIndex, count, destinationField, destIndex) {
76
+ const normalSource = normalizeFieldUpPath(sourceField, this.locator, this.options);
77
+ const normalDestination = normalizeFieldUpPath(destinationField, this.locator, this.options);
78
+ this.idBasedEditor.move(normalSource, sourceIndex, count, normalDestination, destIndex);
79
+ }
80
+ sequenceField(field) {
81
+ const normal = normalizeFieldUpPath(field, this.locator, this.options);
82
+ const lowLevelEditor = this.idBasedEditor.sequenceField(normal);
83
+ const locator = this.locator;
84
+ const editBuilder = {
85
+ insert: (index, content) => {
86
+ lowLevelEditor.insert(index, content);
87
+ },
88
+ attach: (index, newContent) => {
89
+ const range = locator.idRangesFromLocations(newContent);
90
+ validateAreAttachable(range, locator);
91
+ lowLevelEditor.attach(index, range);
92
+ },
93
+ remove: (index, count) => {
94
+ lowLevelEditor.remove(index, count);
95
+ },
96
+ };
97
+ return editBuilder;
98
+ }
99
+ }
100
+ function normalizeUpPath(path, locator, options) {
101
+ if (path.parent === undefined) {
102
+ if (path.parentField === rootFieldKey) {
103
+ return { ...path, parent: undefined, detachedNodeId: undefined };
104
+ }
105
+ else {
106
+ if (options.enableDetachedRootEditing !== true) {
107
+ throw new UsageError(`Edits and constraints on detached trees require a minimum version for collaboration >= TBD.`);
108
+ }
109
+ const nodeId = locator.idFromLocation(path.parentField);
110
+ const detachedNodeId = makeDetachedNodeId(nodeId.revision, nodeId.localId);
111
+ return { ...path, parent: undefined, detachedNodeId };
112
+ }
113
+ }
114
+ else {
115
+ return {
116
+ parent: normalizeUpPath(path.parent, locator, options),
117
+ parentField: path.parentField,
118
+ parentIndex: path.parentIndex,
119
+ };
120
+ }
121
+ }
122
+ function normalizeFieldUpPath(path, locator, options) {
123
+ if (path.parent === undefined) {
124
+ if (path.field === rootFieldKey) {
125
+ return { parent: undefined, field: rootFieldKey };
126
+ }
127
+ else {
128
+ throw new UsageError("Editing only allowed on the root field or on fields under nodes with TreeStatus.InDocument or TreeStatus.Removed status");
129
+ }
130
+ }
131
+ else {
132
+ return { parent: normalizeUpPath(path.parent, locator, options), field: path.field };
133
+ }
134
+ }
135
+ function validateAreAttachable(nodeIds, locator) {
136
+ for (const idRange of nodeIds) {
137
+ const baseAtom = idRange.first;
138
+ for (let idOffset = 0; idOffset < idRange.count; idOffset++) {
139
+ validateIsAttachable(offsetChangeAtomId(baseAtom, idOffset), locator);
140
+ }
141
+ }
142
+ }
143
+ function validateIsAttachable(nodeId, locator) {
144
+ const isAttachable = locator.isAttachable(nodeId);
145
+ if (!(isAttachable ?? false)) {
146
+ throw new UsageError(`Nodes that may have been detached from a required field can only be re-attached by reverting the detach.`);
147
+ }
148
+ }
149
+ //# sourceMappingURL=locationBasedEditBuilder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locationBasedEditBuilder.js","sourceRoot":"","sources":["../../../src/feature-libraries/default-schema/locationBasedEditBuilder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAEtE,OAAO,EAQN,YAAY,EACZ,kBAAkB,EAClB,kBAAkB,GAElB,MAAM,qBAAqB,CAAC;AA+B7B;;;GAGG;AACH,MAAM,OAAO,uBAAuB;IAGnC,YACkB,aAAmE,EACnE,OAAgB,EAChB,OAAsB;QAFtB,kBAAa,GAAb,aAAa,CAAsD;QACnE,YAAO,GAAP,OAAO,CAAS;QAChB,YAAO,GAAP,OAAO,CAAe;IACrC,CAAC;IAEG,uBAAuB,CAAC,IAAY;QAC1C,MAAM,MAAM,GAAG,eAAe,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QACjE,IAAI,CAAC,aAAa,CAAC,uBAAuB,CAAC,MAAM,CAAC,CAAC;IACpD,CAAC;IAEM,+BAA+B,CAAC,IAAY;QAClD,MAAM,MAAM,GAAG,eAAe,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QACjE,IAAI,CAAC,aAAa,CAAC,+BAA+B,CAAC,MAAM,CAAC,CAAC;IAC5D,CAAC;IAEM,qBAAq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AE,OAAO,CAAC,CAAC;QACvE,CAAC;IACF,CAAC;AACF,CAAC;AAED,SAAS,oBAAoB,CAAC,MAAoB,EAAE,OAAgB;IACnE,MAAM,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IAClD,IAAI,CAAC,CAAC,YAAY,IAAI,KAAK,CAAC,EAAE,CAAC;QAC9B,MAAM,IAAI,UAAU,CACnB,0GAA0G,CAC1G,CAAC;IACH,CAAC;AACF,CAAC","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 {\n\ttype ChangeAtomId,\n\ttype FieldKey,\n\ttype FieldUpPath,\n\ttype UpPath,\n\ttype TreeChunk,\n\ttype NormalizedUpPath,\n\ttype NormalizedFieldUpPath,\n\trootFieldKey,\n\tmakeDetachedNodeId,\n\toffsetChangeAtomId,\n\ttype EditorOptions,\n} from \"../../core/index.js\";\n\nimport type {\n\tDetachedRootIds,\n\tDataEditor,\n\tOptionalFieldEditor,\n\tRequiredFieldEditor,\n\tSequenceFieldEditor,\n} from \"./defaultEditBuilder.js\";\n\nexport type DetachedRootLocation = FieldKey;\nexport type DetachedRootsLocation = readonly DetachedRootRangeLocation[];\nexport interface DetachedRootRangeLocation {\n\treadonly field: FieldKey;\n\treadonly count: number;\n}\n\nexport interface Locator {\n\tlocationFromId(id: ChangeAtomId): DetachedRootLocation;\n\tidFromLocation(id: DetachedRootLocation): ChangeAtomId;\n\tlocationsFromIdRanges(id: DetachedRootIds): DetachedRootsLocation;\n\tidRangesFromLocations(id: DetachedRootsLocation): DetachedRootIds;\n\tisAttachable(id: ChangeAtomId): boolean | undefined;\n}\n\nexport type ILocationBasedDataEditor = DataEditor<\n\tTreeChunk,\n\tDetachedRootLocation,\n\tDetachedRootsLocation\n>;\n\n/**\n * Implementation of {@link DataEditor} based on the default set of supported field kinds.\n * @sealed\n */\nexport class LocationBasedDataEditor\n\timplements DataEditor<TreeChunk, DetachedRootLocation, DetachedRootsLocation>\n{\n\tpublic constructor(\n\t\tprivate readonly idBasedEditor: DataEditor<TreeChunk, ChangeAtomId, DetachedRootIds>,\n\t\tprivate readonly locator: Locator,\n\t\tprivate readonly options: EditorOptions,\n\t) {}\n\n\tpublic addNodeExistsConstraint(path: UpPath): void {\n\t\tconst normal = normalizeUpPath(path, this.locator, this.options);\n\t\tthis.idBasedEditor.addNodeExistsConstraint(normal);\n\t}\n\n\tpublic addNodeExistsConstraintOnRevert(path: UpPath): void {\n\t\tconst normal = normalizeUpPath(path, this.locator, this.options);\n\t\tthis.idBasedEditor.addNodeExistsConstraintOnRevert(normal);\n\t}\n\n\tpublic addNoChangeConstraint(): void {\n\t\tthis.idBasedEditor.addNoChangeConstraint();\n\t}\n\n\tpublic addNoChangeConstraintOnRevert(): void {\n\t\tthis.idBasedEditor.addNoChangeConstraintOnRevert();\n\t}\n\n\tpublic buildRoots(content: TreeChunk): DetachedRootsLocation {\n\t\tconst roots = this.idBasedEditor.buildRoots(content);\n\t\tconst locations = this.locator.locationsFromIdRanges(roots);\n\t\treturn locations;\n\t}\n\n\tpublic valueField(field: FieldUpPath): RequiredFieldEditor<TreeChunk, DetachedRootLocation> {\n\t\tconst normal = normalizeFieldUpPath(field, this.locator, this.options);\n\t\tconst lowLevelEditor = this.idBasedEditor.valueField(normal);\n\t\tconst locator = this.locator;\n\t\tconst editBuilder = {\n\t\t\tset: (newContent: TreeChunk): void => {\n\t\t\t\tlowLevelEditor.set(newContent);\n\t\t\t},\n\t\t\tattach: (newContent: DetachedRootLocation): void => {\n\t\t\t\tconst changeAtom = locator.idFromLocation(newContent);\n\t\t\t\tvalidateIsAttachable(changeAtom, locator);\n\t\t\t\tlowLevelEditor.attach(changeAtom);\n\t\t\t},\n\t\t};\n\t\treturn editBuilder;\n\t}\n\n\tpublic optionalField(\n\t\tfield: FieldUpPath,\n\t): OptionalFieldEditor<TreeChunk, DetachedRootLocation> {\n\t\tconst normal = normalizeFieldUpPath(field, this.locator, this.options);\n\t\tconst lowLevelEditor = this.idBasedEditor.optionalField(normal);\n\t\tconst locator = this.locator;\n\t\tconst editBuilder = {\n\t\t\tset: (newContent: TreeChunk | undefined, wasEmpty: boolean): void => {\n\t\t\t\tlowLevelEditor.set(newContent, wasEmpty);\n\t\t\t},\n\t\t\tattach: (newContent: DetachedRootLocation | undefined, wasEmpty: boolean): void => {\n\t\t\t\tif (newContent === undefined) {\n\t\t\t\t\teditBuilder.clear(wasEmpty);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst changeAtom = locator.idFromLocation(newContent);\n\t\t\t\tvalidateIsAttachable(changeAtom, locator);\n\t\t\t\tlowLevelEditor.attach(changeAtom, wasEmpty);\n\t\t\t},\n\t\t\tclear: (wasEmpty: boolean): void => {\n\t\t\t\tlowLevelEditor.clear(wasEmpty);\n\t\t\t},\n\t\t};\n\t\treturn editBuilder;\n\t}\n\n\tpublic move(\n\t\tsourceField: FieldUpPath,\n\t\tsourceIndex: number,\n\t\tcount: number,\n\t\tdestinationField: FieldUpPath,\n\t\tdestIndex: number,\n\t): void {\n\t\tconst normalSource = normalizeFieldUpPath(sourceField, this.locator, this.options);\n\t\tconst normalDestination = normalizeFieldUpPath(\n\t\t\tdestinationField,\n\t\t\tthis.locator,\n\t\t\tthis.options,\n\t\t);\n\t\tthis.idBasedEditor.move(normalSource, sourceIndex, count, normalDestination, destIndex);\n\t}\n\n\tpublic sequenceField(\n\t\tfield: FieldUpPath,\n\t): SequenceFieldEditor<TreeChunk, DetachedRootsLocation> {\n\t\tconst normal = normalizeFieldUpPath(field, this.locator, this.options);\n\t\tconst lowLevelEditor = this.idBasedEditor.sequenceField(normal);\n\t\tconst locator = this.locator;\n\t\tconst editBuilder = {\n\t\t\tinsert: (index: number, content: TreeChunk): void => {\n\t\t\t\tlowLevelEditor.insert(index, content);\n\t\t\t},\n\t\t\tattach: (index: number, newContent: DetachedRootsLocation): void => {\n\t\t\t\tconst range = locator.idRangesFromLocations(newContent);\n\t\t\t\tvalidateAreAttachable(range, locator);\n\t\t\t\tlowLevelEditor.attach(index, range);\n\t\t\t},\n\t\t\tremove: (index: number, count: number): void => {\n\t\t\t\tlowLevelEditor.remove(index, count);\n\t\t\t},\n\t\t};\n\t\treturn editBuilder;\n\t}\n}\n\nfunction normalizeUpPath(\n\tpath: UpPath,\n\tlocator: Locator,\n\toptions: EditorOptions,\n): NormalizedUpPath {\n\tif (path.parent === undefined) {\n\t\tif (path.parentField === rootFieldKey) {\n\t\t\treturn { ...path, parent: undefined, detachedNodeId: undefined };\n\t\t} else {\n\t\t\tif (options.enableDetachedRootEditing !== true) {\n\t\t\t\tthrow new UsageError(\n\t\t\t\t\t`Edits and constraints on detached trees require a minimum version for collaboration >= TBD.`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst nodeId = locator.idFromLocation(path.parentField);\n\t\t\tconst detachedNodeId = makeDetachedNodeId(nodeId.revision, nodeId.localId);\n\t\t\treturn { ...path, parent: undefined, detachedNodeId };\n\t\t}\n\t} else {\n\t\treturn {\n\t\t\tparent: normalizeUpPath(path.parent, locator, options),\n\t\t\tparentField: path.parentField,\n\t\t\tparentIndex: path.parentIndex,\n\t\t};\n\t}\n}\n\nfunction normalizeFieldUpPath(\n\tpath: FieldUpPath,\n\tlocator: Locator,\n\toptions: EditorOptions,\n): NormalizedFieldUpPath {\n\tif (path.parent === undefined) {\n\t\tif (path.field === rootFieldKey) {\n\t\t\treturn { parent: undefined, field: rootFieldKey };\n\t\t} else {\n\t\t\tthrow new UsageError(\n\t\t\t\t\"Editing only allowed on the root field or on fields under nodes with TreeStatus.InDocument or TreeStatus.Removed status\",\n\t\t\t);\n\t\t}\n\t} else {\n\t\treturn { parent: normalizeUpPath(path.parent, locator, options), field: path.field };\n\t}\n}\n\nfunction validateAreAttachable(nodeIds: DetachedRootIds, locator: Locator): void {\n\tfor (const idRange of nodeIds) {\n\t\tconst baseAtom = idRange.first;\n\t\tfor (let idOffset = 0; idOffset < idRange.count; idOffset++) {\n\t\t\tvalidateIsAttachable(offsetChangeAtomId(baseAtom, idOffset), locator);\n\t\t}\n\t}\n}\n\nfunction validateIsAttachable(nodeId: ChangeAtomId, locator: Locator): void {\n\tconst isAttachable = locator.isAttachable(nodeId);\n\tif (!(isAttachable ?? false)) {\n\t\tthrow new UsageError(\n\t\t\t`Nodes that may have been detached from a required field can only be re-attached by reverting the detach.`,\n\t\t);\n\t}\n}\n"]}
@@ -3,17 +3,18 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import type { NormalizedFieldUpPath, NormalizedUpPath } from "../../core/index.js";
6
- import type { IDefaultEditBuilder, OptionalFieldEditBuilder, SequenceFieldEditBuilder, ValueFieldEditBuilder } from "./defaultEditBuilder.js";
6
+ import type { DataEditor, OptionalFieldEditor, SequenceFieldEditor, RequiredFieldEditor } from "./defaultEditBuilder.js";
7
7
  /**
8
8
  * An IDefaultEditBuilder implementation based on another IDefaultEditBuilder that uses a different content type for insertions.
9
9
  */
10
- export declare class MappedEditBuilder<TBase, TAdapted> implements IDefaultEditBuilder<TAdapted> {
10
+ export declare class MappedEditBuilder<TBase, TAdapted, TDetachedRoot, TDetachedRoots> implements DataEditor<TAdapted, TDetachedRoot, TDetachedRoots> {
11
11
  private readonly baseBuilder;
12
12
  private readonly mapDelegate;
13
- constructor(baseBuilder: IDefaultEditBuilder<TBase>, mapDelegate: (input: TAdapted) => TBase);
14
- valueField(field: NormalizedFieldUpPath): ValueFieldEditBuilder<TAdapted>;
15
- optionalField(field: NormalizedFieldUpPath): OptionalFieldEditBuilder<TAdapted>;
16
- sequenceField(field: NormalizedFieldUpPath): SequenceFieldEditBuilder<TAdapted>;
13
+ constructor(baseBuilder: DataEditor<TBase, TDetachedRoot, TDetachedRoots>, mapDelegate: (input: TAdapted) => TBase);
14
+ buildRoots(content: TAdapted): TDetachedRoots;
15
+ valueField(field: NormalizedFieldUpPath): RequiredFieldEditor<TAdapted, TDetachedRoot>;
16
+ optionalField(field: NormalizedFieldUpPath): OptionalFieldEditor<TAdapted, TDetachedRoot>;
17
+ sequenceField(field: NormalizedFieldUpPath): SequenceFieldEditor<TAdapted, TDetachedRoots>;
17
18
  move(sourceField: NormalizedFieldUpPath, sourceIndex: number, count: number, destinationField: NormalizedFieldUpPath, destinationIndex: number): void;
18
19
  addNodeExistsConstraint(path: NormalizedUpPath): void;
19
20
  addNodeExistsConstraintOnRevert(path: NormalizedUpPath): void;
@@ -1 +1 @@
1
- {"version":3,"file":"mappedEditBuilder.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/default-schema/mappedEditBuilder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEnF,OAAO,KAAK,EACX,mBAAmB,EACnB,wBAAwB,EACxB,wBAAwB,EACxB,qBAAqB,EACrB,MAAM,yBAAyB,CAAC;AAEjC;;GAEG;AACH,qBAAa,iBAAiB,CAAC,KAAK,EAAE,QAAQ,CAAE,YAAW,mBAAmB,CAAC,QAAQ,CAAC;IAEtF,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,WAAW;gBADX,WAAW,EAAE,mBAAmB,CAAC,KAAK,CAAC,EACvC,WAAW,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,KAAK;IAElD,UAAU,CAAC,KAAK,EAAE,qBAAqB,GAAG,qBAAqB,CAAC,QAAQ,CAAC;IASzE,aAAa,CAAC,KAAK,EAAE,qBAAqB,GAAG,wBAAwB,CAAC,QAAQ,CAAC;IAU/E,aAAa,CAAC,KAAK,EAAE,qBAAqB,GAAG,wBAAwB,CAAC,QAAQ,CAAC;IAY/E,IAAI,CACV,WAAW,EAAE,qBAAqB,EAClC,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,MAAM,EACb,gBAAgB,EAAE,qBAAqB,EACvC,gBAAg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b,gBAAgB,EAAE,qBAAqB,EACvC,gBAAgB,EAAE,MAAM,GACtB,IAAI;IAGA,uBAAuB,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI;IAGrD,+BAA+B,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI;IAG7D,qBAAqB,IAAI,IAAI;IAG7B,6BAA6B,IAAI,IAAI;CAG5C"}
@@ -10,6 +10,9 @@ export class MappedEditBuilder {
10
10
  this.baseBuilder = baseBuilder;
11
11
  this.mapDelegate = mapDelegate;
12
12
  }
13
+ buildRoots(content) {
14
+ return this.baseBuilder.buildRoots(this.mapDelegate(content));
15
+ }
13
16
  valueField(field) {
14
17
  const baseField = this.baseBuilder.valueField(field);
15
18
  return {
@@ -17,6 +20,9 @@ export class MappedEditBuilder {
17
20
  const mappedContent = this.mapDelegate(newContent);
18
21
  baseField.set(mappedContent);
19
22
  },
23
+ attach: (content) => {
24
+ baseField.attach(content);
25
+ },
20
26
  };
21
27
  }
22
28
  optionalField(field) {
@@ -26,6 +32,12 @@ export class MappedEditBuilder {
26
32
  const mappedContent = newContent === undefined ? undefined : this.mapDelegate(newContent);
27
33
  baseField.set(mappedContent, wasEmpty);
28
34
  },
35
+ attach: (content, wasEmpty) => {
36
+ baseField.attach(content, wasEmpty);
37
+ },
38
+ clear(wasEmpty) {
39
+ baseField.clear(wasEmpty);
40
+ },
29
41
  };
30
42
  }
31
43
  sequenceField(field) {
@@ -38,6 +50,9 @@ export class MappedEditBuilder {
38
50
  remove: (index, count) => {
39
51
  baseField.remove(index, count);
40
52
  },
53
+ attach: (index, detachedContent) => {
54
+ baseField.attach(index, detachedContent);
55
+ },
41
56
  };
42
57
  }
43
58
  move(sourceField, sourceIndex, count, destinationField, destinationIndex) {
@@ -1 +1 @@
1
- {"version":3,"file":"mappedEditBuilder.js","sourceRoot":"","sources":["../../../src/feature-libraries/default-schema/mappedEditBuilder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAWH;;GAEG;AACH,MAAM,OAAO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E,KAAK,CAAC,CAAC;YAChC,CAAC;SACD,CAAC;IACH,CAAC;IACM,IAAI,CACV,WAAkC,EAClC,WAAmB,EACnB,KAAa,EACb,gBAAuC,EACvC,gBAAwB;QAExB,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,WAAW,EAAE,WAAW,EAAE,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,CAAC,CAAC;IAC5F,CAAC;IACM,uBAAuB,CAAC,IAAsB;QACpD,IAAI,CAAC,WAAW,CAAC,uBAAuB,CAAC,IAAI,CAAC,CAAC;IAChD,CAAC;IACM,+BAA+B,CAAC,IAAsB;QAC5D,IAAI,CAAC,WAAW,CAAC,+BAA+B,CAAC,IAAI,CAAC,CAAC;IACxD,CAAC;IACM,qBAAqB;QAC3B,IAAI,CAAC,WAAW,CAAC,qBAAqB,EAAE,CAAC;IAC1C,CAAC;IACM,6BAA6B;QACnC,IAAI,CAAC,WAAW,CAAC,6BAA6B,EAAE,CAAC;IAClD,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { NormalizedFieldUpPath, NormalizedUpPath } from \"../../core/index.js\";\n\nimport type {\n\tIDefaultEditBuilder,\n\tOptionalFieldEditBuilder,\n\tSequenceFieldEditBuilder,\n\tValueFieldEditBuilder,\n} from \"./defaultEditBuilder.js\";\n\n/**\n * An IDefaultEditBuilder implementation based on another IDefaultEditBuilder that uses a different content type for insertions.\n */\nexport class MappedEditBuilder<TBase, TAdapted> implements IDefaultEditBuilder<TAdapted> {\n\tpublic constructor(\n\t\tprivate readonly baseBuilder: IDefaultEditBuilder<TBase>,\n\t\tprivate readonly mapDelegate: (input: TAdapted) => TBase,\n\t) {}\n\tpublic valueField(field: NormalizedFieldUpPath): ValueFieldEditBuilder<TAdapted> {\n\t\tconst baseField = this.baseBuilder.valueField(field);\n\t\treturn {\n\t\t\tset: (newContent: TAdapted): void => {\n\t\t\t\tconst mappedContent = this.mapDelegate(newContent);\n\t\t\t\tbaseField.set(mappedContent);\n\t\t\t},\n\t\t};\n\t}\n\tpublic optionalField(field: NormalizedFieldUpPath): OptionalFieldEditBuilder<TAdapted> {\n\t\tconst baseField = this.baseBuilder.optionalField(field);\n\t\treturn {\n\t\t\tset: (newContent: TAdapted | undefined, wasEmpty: boolean): void => {\n\t\t\t\tconst mappedContent =\n\t\t\t\t\tnewContent === undefined ? undefined : this.mapDelegate(newContent);\n\t\t\t\tbaseField.set(mappedContent, wasEmpty);\n\t\t\t},\n\t\t};\n\t}\n\tpublic sequenceField(field: NormalizedFieldUpPath): SequenceFieldEditBuilder<TAdapted> {\n\t\tconst baseField = this.baseBuilder.sequenceField(field);\n\t\treturn {\n\t\t\tinsert: (index: number, content: TAdapted): void => {\n\t\t\t\tconst mappedContent = this.mapDelegate(content);\n\t\t\t\tbaseField.insert(index, mappedContent);\n\t\t\t},\n\t\t\tremove: (index: number, count: number): void => {\n\t\t\t\tbaseField.remove(index, count);\n\t\t\t},\n\t\t};\n\t}\n\tpublic move(\n\t\tsourceField: NormalizedFieldUpPath,\n\t\tsourceIndex: number,\n\t\tcount: number,\n\t\tdestinationField: NormalizedFieldUpPath,\n\t\tdestinationIndex: number,\n\t): void {\n\t\tthis.baseBuilder.move(sourceField, sourceIndex, count, destinationField, destinationIndex);\n\t}\n\tpublic addNodeExistsConstraint(path: NormalizedUpPath): void {\n\t\tthis.baseBuilder.addNodeExistsConstraint(path);\n\t}\n\tpublic addNodeExistsConstraintOnRevert(path: NormalizedUpPath): void {\n\t\tthis.baseBuilder.addNodeExistsConstraintOnRevert(path);\n\t}\n\tpublic addNoChangeConstraint(): void {\n\t\tthis.baseBuilder.addNoChangeConstraint();\n\t}\n\tpublic addNoChangeConstraintOnRevert(): void {\n\t\tthis.baseBuilder.addNoChangeConstraintOnRevert();\n\t}\n}\n"]}
1
+ {"version":3,"file":"mappedEditBuilder.js","sourceRoot":"","sources":["../../../src/feature-libraries/default-schema/mappedEditBuilder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W,CAAC,6BAA6B,EAAE,CAAC;IAClD,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { NormalizedFieldUpPath, NormalizedUpPath } from \"../../core/index.js\";\n\nimport type {\n\tDataEditor,\n\tOptionalFieldEditor,\n\tSequenceFieldEditor,\n\tRequiredFieldEditor,\n} from \"./defaultEditBuilder.js\";\n\n/**\n * An IDefaultEditBuilder implementation based on another IDefaultEditBuilder that uses a different content type for insertions.\n */\nexport class MappedEditBuilder<TBase, TAdapted, TDetachedRoot, TDetachedRoots>\n\timplements DataEditor<TAdapted, TDetachedRoot, TDetachedRoots>\n{\n\tpublic constructor(\n\t\tprivate readonly baseBuilder: DataEditor<TBase, TDetachedRoot, TDetachedRoots>,\n\t\tprivate readonly mapDelegate: (input: TAdapted) => TBase,\n\t) {}\n\n\tpublic buildRoots(content: TAdapted): TDetachedRoots {\n\t\treturn this.baseBuilder.buildRoots(this.mapDelegate(content));\n\t}\n\n\tpublic valueField(\n\t\tfield: NormalizedFieldUpPath,\n\t): RequiredFieldEditor<TAdapted, TDetachedRoot> {\n\t\tconst baseField = this.baseBuilder.valueField(field);\n\t\treturn {\n\t\t\tset: (newContent: TAdapted): void => {\n\t\t\t\tconst mappedContent = this.mapDelegate(newContent);\n\t\t\t\tbaseField.set(mappedContent);\n\t\t\t},\n\t\t\tattach: (content: TDetachedRoot): void => {\n\t\t\t\tbaseField.attach(content);\n\t\t\t},\n\t\t};\n\t}\n\n\tpublic optionalField(\n\t\tfield: NormalizedFieldUpPath,\n\t): OptionalFieldEditor<TAdapted, TDetachedRoot> {\n\t\tconst baseField = this.baseBuilder.optionalField(field);\n\t\treturn {\n\t\t\tset: (newContent: TAdapted | undefined, wasEmpty: boolean): void => {\n\t\t\t\tconst mappedContent =\n\t\t\t\t\tnewContent === undefined ? undefined : this.mapDelegate(newContent);\n\t\t\t\tbaseField.set(mappedContent, wasEmpty);\n\t\t\t},\n\t\t\tattach: (content, wasEmpty: boolean): void => {\n\t\t\t\tbaseField.attach(content, wasEmpty);\n\t\t\t},\n\t\t\tclear(wasEmpty: boolean): void {\n\t\t\t\tbaseField.clear(wasEmpty);\n\t\t\t},\n\t\t};\n\t}\n\tpublic sequenceField(\n\t\tfield: NormalizedFieldUpPath,\n\t): SequenceFieldEditor<TAdapted, TDetachedRoots> {\n\t\tconst baseField = this.baseBuilder.sequenceField(field);\n\t\treturn {\n\t\t\tinsert: (index: number, content: TAdapted): void => {\n\t\t\t\tconst mappedContent = this.mapDelegate(content);\n\t\t\t\tbaseField.insert(index, mappedContent);\n\t\t\t},\n\t\t\tremove: (index: number, count: number): void => {\n\t\t\t\tbaseField.remove(index, count);\n\t\t\t},\n\t\t\tattach: (index: number, detachedContent: TDetachedRoots): void => {\n\t\t\t\tbaseField.attach(index, detachedContent);\n\t\t\t},\n\t\t};\n\t}\n\tpublic move(\n\t\tsourceField: NormalizedFieldUpPath,\n\t\tsourceIndex: number,\n\t\tcount: number,\n\t\tdestinationField: NormalizedFieldUpPath,\n\t\tdestinationIndex: number,\n\t): void {\n\t\tthis.baseBuilder.move(sourceField, sourceIndex, count, destinationField, destinationIndex);\n\t}\n\tpublic addNodeExistsConstraint(path: NormalizedUpPath): void {\n\t\tthis.baseBuilder.addNodeExistsConstraint(path);\n\t}\n\tpublic addNodeExistsConstraintOnRevert(path: NormalizedUpPath): void {\n\t\tthis.baseBuilder.addNodeExistsConstraintOnRevert(path);\n\t}\n\tpublic addNoChangeConstraint(): void {\n\t\tthis.baseBuilder.addNoChangeConstraint();\n\t}\n\tpublic addNoChangeConstraintOnRevert(): void {\n\t\tthis.baseBuilder.addNoChangeConstraintOnRevert();\n\t}\n}\n"]}
@@ -4,6 +4,7 @@
4
4
  */
5
5
  import { type ChangeAtomId, type DeltaDetachedNodeId, type DeltaRoot } from "../core/index.js";
6
6
  export declare function nodeIdFromChangeAtom(changeAtom: ChangeAtomId): DeltaDetachedNodeId;
7
+ export declare function changeAtomFromDetachedNodeId(changeAtom: DeltaDetachedNodeId): ChangeAtomId;
7
8
  /**
8
9
  * Converts a `Delta.Root` whose tree content is represented with by `TIn` instances
9
10
  * into a `Delta.Root`whose tree content is represented with by `TOut` instances.
@@ -1 +1 @@
1
- {"version":3,"file":"deltaUtils.d.ts","sourceRoot":"","sources":["../../src/feature-libraries/deltaUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,SAAS,EAEd,MAAM,kBAAkB,CAAC;AAG1B,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,YAAY,GAAG,mBAAmB,CAElF;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,IAAI,EACvC,IAAI,EAAE,SAAS,CAAC,GAAG,CAAC,EACpB,IAAI,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,GACvB,SAAS,CAAC,IAAI,CAAC,CAyBjB"}
1
+ {"version":3,"file":"deltaUtils.d.ts","sourceRoot":"","sources":["../../src/feature-libraries/deltaUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,SAAS,EAGd,MAAM,kBAAkB,CAAC;AAG1B,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,YAAY,GAAG,mBAAmB,CAElF;AAED,wBAAgB,4BAA4B,CAAC,UAAU,EAAE,mBAAmB,GAAG,YAAY,CAE1F;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,IAAI,EACvC,IAAI,EAAE,SAAS,CAAC,GAAG,CAAC,EACpB,IAAI,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,GACvB,SAAS,CAAC,IAAI,CAAC,CAyBjB"}
@@ -2,10 +2,14 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { makeDetachedNodeId, } from "../core/index.js";
5
+ import { makeChangeAtomId, makeDetachedNodeId, } from "../core/index.js";
6
+ import { brand } from "../util/index.js";
6
7
  export function nodeIdFromChangeAtom(changeAtom) {
7
8
  return makeDetachedNodeId(changeAtom.revision, changeAtom.localId);
8
9
  }
10
+ export function changeAtomFromDetachedNodeId(changeAtom) {
11
+ return makeChangeAtomId(brand(changeAtom.minor), changeAtom.major);
12
+ }
9
13
  /**
10
14
  * Converts a `Delta.Root` whose tree content is represented with by `TIn` instances
11
15
  * into a `Delta.Root`whose tree content is represented with by `TOut` instances.
@@ -1 +1 @@
1
- {"version":3,"file":"deltaUtils.js","sourceRoot":"","sources":["../../src/feature-libraries/deltaUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAIN,kBAAkB,GAClB,MAAM,kBAAkB,CAAC;AAG1B,MAAM,UAAU,oBAAoB,CAAC,UAAwB;IAC5D,OAAO,kBAAkB,CAAC,UAAU,CAAC,QAAQ,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC;AACpE,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,cAAc,CAC7B,IAAoB,EACpB,IAAyB;IAEzB,MAAM,GAAG,GAA6B,EAAE,CAAC;IACzC,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QAC/B,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;IAC1B,CAAC;IACD,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;QAC9B,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;YAC9C,EAAE;YACF,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC;SAClB,CAAC,CAAC,CAAC;IACL,CAAC;IACD,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QAC/B,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC;YACjD,EAAE;YACF,MAAM;SACN,CAAC,CAAC,CAAC;IACL,CAAC;IACD,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QAC/B,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;YAC1D,KAAK;YACL,KAAK;YACL,KAAK;SACL,CAAC,CAAC,CAAC;IACL,CAAC;IACD,OAAO,GAAG,CAAC;AACZ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\ttype ChangeAtomId,\n\ttype DeltaDetachedNodeId,\n\ttype DeltaRoot,\n\tmakeDetachedNodeId,\n} from \"../core/index.js\";\nimport type { Mutable } from \"../util/index.js\";\n\nexport function nodeIdFromChangeAtom(changeAtom: ChangeAtomId): DeltaDetachedNodeId {\n\treturn makeDetachedNodeId(changeAtom.revision, changeAtom.localId);\n}\n\n/**\n * Converts a `Delta.Root` whose tree content is represented with by `TIn` instances\n * into a `Delta.Root`whose tree content is represented with by `TOut` instances.\n *\n * This function is useful for converting `Delta`s that represent tree content with cursors\n * into `Delta`s that represent tree content with a deep-comparable representation of the content.\n * See {@link assertDeltaEqual}.\n * @param root - The delta to convert. Not mutated.\n * @param func - The functions used to map tree content.\n */\nexport function mapRootChanges<TIn, TOut>(\n\troot: DeltaRoot<TIn>,\n\tfunc: (tree: TIn) => TOut,\n): DeltaRoot<TOut> {\n\tconst out: Mutable<DeltaRoot<TOut>> = {};\n\tif (root.fields !== undefined) {\n\t\tout.fields = root.fields;\n\t}\n\tif (root.build !== undefined) {\n\t\tout.build = root.build.map(({ id, trees }) => ({\n\t\t\tid,\n\t\t\ttrees: func(trees),\n\t\t}));\n\t}\n\tif (root.global !== undefined) {\n\t\tout.global = root.global.map(({ id, fields }) => ({\n\t\t\tid,\n\t\t\tfields,\n\t\t}));\n\t}\n\tif (root.rename !== undefined) {\n\t\tout.rename = root.rename.map(({ count, oldId, newId }) => ({\n\t\t\tcount,\n\t\t\toldId,\n\t\t\tnewId,\n\t\t}));\n\t}\n\treturn out;\n}\n"]}
1
+ {"version":3,"file":"deltaUtils.js","sourceRoot":"","sources":["../../src/feature-libraries/deltaUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAIN,gBAAgB,EAChB,kBAAkB,GAClB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,KAAK,EAAgB,MAAM,kBAAkB,CAAC;AAEvD,MAAM,UAAU,oBAAoB,CAAC,UAAwB;IAC5D,OAAO,kBAAkB,CAAC,UAAU,CAAC,QAAQ,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC;AACpE,CAAC;AAED,MAAM,UAAU,4BAA4B,CAAC,UAA+B;IAC3E,OAAO,gBAAgB,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC;AACpE,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,cAAc,CAC7B,IAAoB,EACpB,IAAyB;IAEzB,MAAM,GAAG,GAA6B,EAAE,CAAC;IACzC,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QAC/B,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;IAC1B,CAAC;IACD,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;QAC9B,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;YAC9C,EAAE;YACF,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC;SAClB,CAAC,CAAC,CAAC;IACL,CAAC;IACD,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QAC/B,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC;YACjD,EAAE;YACF,MAAM;SACN,CAAC,CAAC,CAAC;IACL,CAAC;IACD,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QAC/B,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;YAC1D,KAAK;YACL,KAAK;YACL,KAAK;SACL,CAAC,CAAC,CAAC;IACL,CAAC;IACD,OAAO,GAAG,CAAC;AACZ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\ttype ChangeAtomId,\n\ttype DeltaDetachedNodeId,\n\ttype DeltaRoot,\n\tmakeChangeAtomId,\n\tmakeDetachedNodeId,\n} from \"../core/index.js\";\nimport { brand, type Mutable } from \"../util/index.js\";\n\nexport function nodeIdFromChangeAtom(changeAtom: ChangeAtomId): DeltaDetachedNodeId {\n\treturn makeDetachedNodeId(changeAtom.revision, changeAtom.localId);\n}\n\nexport function changeAtomFromDetachedNodeId(changeAtom: DeltaDetachedNodeId): ChangeAtomId {\n\treturn makeChangeAtomId(brand(changeAtom.minor), changeAtom.major);\n}\n\n/**\n * Converts a `Delta.Root` whose tree content is represented with by `TIn` instances\n * into a `Delta.Root`whose tree content is represented with by `TOut` instances.\n *\n * This function is useful for converting `Delta`s that represent tree content with cursors\n * into `Delta`s that represent tree content with a deep-comparable representation of the content.\n * See {@link assertDeltaEqual}.\n * @param root - The delta to convert. Not mutated.\n * @param func - The functions used to map tree content.\n */\nexport function mapRootChanges<TIn, TOut>(\n\troot: DeltaRoot<TIn>,\n\tfunc: (tree: TIn) => TOut,\n): DeltaRoot<TOut> {\n\tconst out: Mutable<DeltaRoot<TOut>> = {};\n\tif (root.fields !== undefined) {\n\t\tout.fields = root.fields;\n\t}\n\tif (root.build !== undefined) {\n\t\tout.build = root.build.map(({ id, trees }) => ({\n\t\t\tid,\n\t\t\ttrees: func(trees),\n\t\t}));\n\t}\n\tif (root.global !== undefined) {\n\t\tout.global = root.global.map(({ id, fields }) => ({\n\t\t\tid,\n\t\t\tfields,\n\t\t}));\n\t}\n\tif (root.rename !== undefined) {\n\t\tout.rename = root.rename.map(({ count, oldId, newId }) => ({\n\t\t\tcount,\n\t\t\toldId,\n\t\t\tnewId,\n\t\t}));\n\t}\n\treturn out;\n}\n"]}
@@ -33,6 +33,7 @@ export interface FlexTreeContext {
33
33
  * If true, none of the nodes in this context can be used.
34
34
  */
35
35
  isDisposed(): boolean;
36
+ runInTransaction(fn: () => void): void;
36
37
  }
37
38
  /**
38
39
  * Subset of a hydrated context which can be used in more cases (like before the root and events are set up).
@@ -46,6 +47,13 @@ export interface FlexTreeHydratedContextMinimal {
46
47
  * The checkout object associated with this context.
47
48
  */
48
49
  readonly checkout: ITreeCheckout;
50
+ /**
51
+ * Returns a new {@link FlexTreeField} that will live as long as the caller allows up to the next call to {@link clear} or disposal of the context.
52
+ * @remarks
53
+ * Due to limited support for detached fields, not all operations are supported.
54
+ * Additionally if the detached field's content is deleted, the field will become out of schema if it is required: it must not be used after that point.
55
+ */
56
+ detachedField?(key: DetachedField, schema: FieldKindIdentifier): FlexTreeField;
49
57
  }
50
58
  /**
51
59
  * A common context of a "forest" of FlexTrees.
@@ -104,6 +112,7 @@ export declare class Context implements FlexTreeHydratedContext, IDisposable {
104
112
  isHydrated(): this is FlexTreeHydratedContext;
105
113
  isDisposed(): boolean;
106
114
  get schema(): TreeStoredSchema;
115
+ runInTransaction(fn: () => void): void;
107
116
  /**
108
117
  * Called before editing.
109
118
  * Clears all cursors so editing can proceed.
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/context.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAGlE,OAAO,EACN,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,gBAAgB,EAIrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,KAAK,WAAW,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAEzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAGlD;;GAEG;AACH,MAAM,WAAW,eAAe;IAC/B;;;OAGG;IACH,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC;IAElC;;OAEG;IACH,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;IAEpC;;;;;OAKG;IACH,UAAU,IAAI,IAAI,IAAI,uBAAuB,CAAC;IAE9C;;OAEG;IACH,UAAU,IAAI,OAAO,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC9C;;OAEG;IACH,QAAQ,CAAC,cAAc,EAAE,qBAAqB,CAAC;IAE/C;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC;CACjC;AAED;;;GAGG;AACH,MAAM,WAAW,uBAChB,SAAQ,eAAe,EACtB,8BAA8B;IAC/B,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC,YAAY,CAAC,CAAC;IAC1C;;OAEG;IACH,IAA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AAQ,YAAW,uBAAuB,EAAE,WAAW;aAqBlD,YAAY,EAAE,YAAY;aAC1B,QAAQ,EAAE,aAAa;IACvC;;OAEG;aACa,cAAc,EAAE,qBAAqB;IAzBtD,SAAgB,WAAW,EAAE,GAAG,CAAC,UAAU,CAAC,CAAa;IACzD,SAAgB,WAAW,EAAE,GAAG,CAAC,UAAU,CAAC,CAAa;IAEzD;;;;OAIG;IACH,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAiB;IAC3C,OAAO,CAAC,QAAQ,CAAS;IAEzB;;;;;OAKG;IACH,OAAO,CAAC,aAAa,CAA4B;gBAGhC,YAAY,EAAE,YAAY,EAC1B,QAAQ,EAAE,aAAa;IACvC;;OAEG;IACa,cAAc,EAAE,qBAAqB;IAe/C,UAAU,IAAI,IAAI,IAAI,uBAAuB;IAK7C,UAAU,IAAI,OAAO;IAI5B,IAAW,MAAM,IAAI,gBAAgB,CAEpC;IAEM,gBAAgB,CAAC,EAAE,EAAE,MAAM,IAAI,GAAG,IAAI;IAO7C;;;OAGG;IACH,OAAO,CAAC,cAAc;IAQf,CAAC,aAAa,CAAC,IAAI,IAAI;IAa9B;;;;;;OAMG;IACI,KAAK,IAAI,IAAI;IASpB;;;;;OAKG;IACH,IAAW,IAAI,IAAI,aAAa,CAK/B;IAED;;;;;OAKG;IACI,aAAa,CAAC,GAAG,EAAE,aAAa,EAAE,MAAM,EAAE,mBAAmB,GAAG,aAAa;IAUpF,IAAW,MAAM,IAAI,UAAU,CAAC,YAAY,CAAC,CAE5C;CACD"}
@@ -51,6 +51,12 @@ export class Context {
51
51
  get schema() {
52
52
  return this.checkout.storedSchema;
53
53
  }
54
+ runInTransaction(fn) {
55
+ debugAssert(() => !this.disposed || "Disposed");
56
+ this.checkout.transaction.start(false);
57
+ fn();
58
+ this.checkout.transaction.commit();
59
+ }
54
60
  /**
55
61
  * Called before editing.
56
62
  * Clears all cursors so editing can proceed.
@@ -1 +1 @@
1
- {"version":3,"file":"context.js","sourceRoot":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AAG,SAAS,CAAC;QAC/B,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,KAAK,CAAC,EAAE,KAAK,CAAC,oCAAoC,CAAC,CAAC;QAChF,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,KAAK,CAAC,EAAE,KAAK,CAAC,oCAAoC,CAAC,CAAC;IACjF,CAAC;IAED;;;;;OAKG;IACH,IAAW,IAAI;QACd,MAAM,CAAC,IAAI,CAAC,QAAQ,KAAK,KAAK,EAAE,KAAK,CAAC,uBAAuB,CAAC,CAAC;QAE/D,IAAI,CAAC,aAAa,KAAK,IAAI,CAAC,aAAa,CAAC,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;QACvF,OAAO,IAAI,CAAC,aAAa,CAAC;IAC3B,CAAC;IAED;;;;;OAKG;IACI,aAAa,CAAC,GAAkB,EAAE,MAA2B;QACnE,MAAM,CAAC,IAAI,CAAC,QAAQ,KAAK,KAAK,EAAE,KAAK,CAAC,uBAAuB,CAAC,CAAC;QAE/D,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;QAC3D,mBAAmB,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC;QACvD,MAAM,KAAK,GAAG,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QAC9C,MAAM,CAAC,IAAI,EAAE,CAAC;QACd,OAAO,KAAK,CAAC;IACd,CAAC;IAED,IAAW,MAAM;QAChB,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;IACpC,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { Listenable } from \"@fluidframework/core-interfaces\";\nimport { assert, debugAssert } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\ttype DetachedField,\n\ttype FieldKindIdentifier,\n\ttype ForestEvents,\n\ttype SchemaPolicy,\n\ttype TreeStoredSchema,\n\tanchorSlot,\n\tmoveToDetachedField,\n\trootField,\n} from \"../../core/index.js\";\nimport type { ITreeCheckout } from \"../../shared-tree/index.js\";\nimport { type IDisposable, disposeSymbol } from \"../../util/index.js\";\nimport type { NodeIdentifierManager } from \"../node-identifier/index.js\";\n\nimport type { FlexTreeField } from \"./flexTreeTypes.js\";\nimport type { LazyEntity } from \"./lazyEntity.js\";\nimport { makeField } from \"./lazyField.js\";\n\n/**\n * Context for FlexTrees.\n */\nexport interface FlexTreeContext {\n\t/**\n\t * Schema used within this context.\n\t * All data must conform to these schema.\n\t */\n\treadonly schema: TreeStoredSchema;\n\n\t/**\n\t * SchemaPolicy used within this context.\n\t */\n\treadonly schemaPolicy: SchemaPolicy;\n\n\t/**\n\t * If true, this context is the canonical context instance for a given view,\n\t * and its schema include all schema from the document.\n\t *\n\t * If false, this context was created for use in a unhydrated tree, and the full document schema is unknown.\n\t */\n\tisHydrated(): this is FlexTreeHydratedContext;\n\n\t/**\n\t * If true, none of the nodes in this context can be used.\n\t */\n\tisDisposed(): boolean;\n}\n\n/**\n * Subset of a hydrated context which can be used in more cases (like before the root and events are set up).\n */\nexport interface FlexTreeHydratedContextMinimal {\n\t/**\n\t * The {@link NodeIdentifierManager} responsible for allocating and compressing identifiers for nodes in this context.\n\t */\n\treadonly nodeKeyManager: NodeIdentifierManager;\n\n\t/**\n\t * The checkout object associated with this context.\n\t */\n\treadonly checkout: ITreeCheckout;\n}\n\n/**\n * A common context of a \"forest\" of FlexTrees.\n * It handles group operations like transforming cursors into anchors for edits.\n */\nexport interface FlexTreeHydratedContext\n\textends FlexTreeContext,\n\t\tFlexTreeHydratedContextMinimal {\n\treadonly events: Listenable<ForestEvents>;\n\t/**\n\t * Gets the root field of the tree.\n\t */\n\tget root(): FlexTreeField;\n}\n\n/**\n * Creating multiple flex tree contexts for the same branch, and thus with the same underlying AnchorSet does not work due to how TreeNode caching works.\n * This slot is used to detect if one already exists and error if creating a second.\n */\nexport const ContextSlot = anchorSlot<Context>();\n\n/**\n * Implementation of `FlexTreeHydratedContext`.\n *\n * @remarks An editor is required to edit the FlexTree.\n *\n * A {@link FlexTreeContext} which is used to manage the cursors and anchors within the FlexTrees:\n * This is necessary for supporting using this tree across edits to the forest, and not leaking memory.\n *\n * This context and the trees it produces observe the kinds of fields from the schema\n */\nexport class Context implements FlexTreeHydratedContext, IDisposable {\n\tpublic readonly withCursors: Set<LazyEntity> = new Set();\n\tpublic readonly withAnchors: Set<LazyEntity> = new Set();\n\n\t/**\n\t * Callbacks to run when disposing.\n\t *\n\t * Mainly event un-registration.\n\t */\n\tprivate readonly onDispose: (() => void)[];\n\tprivate disposed = false;\n\n\t/**\n\t * Stores the last accessed version of the root.\n\t * @remarks\n\t * Anything which can delete this field must clear it.\n\t * Currently \"clear\" is the only case.\n\t */\n\tprivate lazyRootCache: FlexTreeField | undefined;\n\n\tpublic constructor(\n\t\tpublic readonly schemaPolicy: SchemaPolicy,\n\t\tpublic readonly checkout: ITreeCheckout,\n\t\t/**\n\t\t * An object which handles node key generation and conversion\n\t\t */\n\t\tpublic readonly nodeKeyManager: NodeIdentifierManager,\n\t) {\n\t\tthis.onDispose = [\n\t\t\tthis.checkout.forest.events.on(\"beforeChange\", () => {\n\t\t\t\tthis.prepareForEdit();\n\t\t\t}),\n\t\t];\n\n\t\tassert(\n\t\t\t!this.checkout.forest.anchors.slots.has(ContextSlot),\n\t\t\t0x92b /* Cannot create second flex-tree from checkout */,\n\t\t);\n\t\tthis.checkout.forest.anchors.slots.set(ContextSlot, this);\n\t}\n\n\tpublic isHydrated(): this is FlexTreeHydratedContext {\n\t\tdebugAssert(() => !this.disposed || \"Disposed\");\n\t\treturn true;\n\t}\n\n\tpublic isDisposed(): boolean {\n\t\treturn this.disposed;\n\t}\n\n\tpublic get schema(): TreeStoredSchema {\n\t\treturn this.checkout.storedSchema;\n\t}\n\n\t/**\n\t * Called before editing.\n\t * Clears all cursors so editing can proceed.\n\t */\n\tprivate prepareForEdit(): void {\n\t\tassert(this.disposed === false, 0x802 /* use after dispose */);\n\t\tfor (const target of this.withCursors) {\n\t\t\ttarget.prepareForEdit();\n\t\t}\n\t\tassert(this.withCursors.size === 0, 0x773 /* prepareForEdit should remove all cursors */);\n\t}\n\n\tpublic [disposeSymbol](): void {\n\t\tassert(this.disposed === false, 0x803 /* double dispose */);\n\t\tthis.disposed = true;\n\t\tthis.clear();\n\t\tfor (const unregister of this.onDispose) {\n\t\t\tunregister();\n\t\t}\n\t\tthis.onDispose.length = 0;\n\n\t\tconst deleted = this.checkout.forest.anchors.slots.delete(ContextSlot);\n\t\tassert(deleted, 0x8c4 /* unexpected dispose */);\n\t}\n\n\t/**\n\t * Release any cursors and anchors held by tree entities created in this context.\n\t * @remarks\n\t * Ensures the cashed references to those entities on the Anchors are also cleared.\n\t * The tree entities are invalid to use after this, but the context may still be used\n\t * to create new trees starting from the root.\n\t */\n\tpublic clear(): void {\n\t\tfor (const target of this.withAnchors) {\n\t\t\ttarget[disposeSymbol]();\n\t\t}\n\t\tthis.lazyRootCache = undefined;\n\t\tassert(this.withCursors.size === 0, 0x774 /* free should remove all cursors */);\n\t\tassert(this.withAnchors.size === 0, 0x775 /* free should remove all anchors */);\n\t}\n\n\t/**\n\t * Gets the root field of the tree.\n\t * @remarks\n\t * This is a cached value: it should not be disposed by the accessor.\n\t * Like all other fields from this context, it will become invalid to use after {@link clear} is called or the {@link disposeSymbol} method is called.\n\t */\n\tpublic get root(): FlexTreeField {\n\t\tassert(this.disposed === false, 0x804 /* use after dispose */);\n\n\t\tthis.lazyRootCache ??= this.detachedField(rootField, this.schema.rootFieldSchema.kind);\n\t\treturn this.lazyRootCache;\n\t}\n\n\t/**\n\t * Returns a new {@link FlexTreeField} that will live as long as the caller allows up to the next call to {@link clear} or disposal of the context.\n\t * @remarks\n\t * Due to limited support for detached fields, not all operations are supported.\n\t * Additionally if the detached field's content is deleted, the field will become out of schema if it is required: it must not be used after that point.\n\t */\n\tpublic detachedField(key: DetachedField, schema: FieldKindIdentifier): FlexTreeField {\n\t\tassert(this.disposed === false, 0xb9c /* use after dispose */);\n\n\t\tconst cursor = this.checkout.forest.allocateCursor(\"root\");\n\t\tmoveToDetachedField(this.checkout.forest, cursor, key);\n\t\tconst field = makeField(this, schema, cursor);\n\t\tcursor.free();\n\t\treturn field;\n\t}\n\n\tpublic get events(): Listenable<ForestEvents> {\n\t\treturn this.checkout.forest.events;\n\t}\n}\n"]}
1
+ {"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/context.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAE1E,OAAO,EAMN,UAAU,EACV,mBAAmB,EACnB,SAAS,GACT,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAoB,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAKtE,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAsE3C;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,UAAU,EAAW,CAAC;AAEjD;;;;;;;;;GASG;AACH,MAAM,OAAO,OAAO;IAoBnB,YACiB,YAA0B,EAC1B,QAAuB;IACvC;;OAEG;IACa,cAAqC;QALrC,iBAAY,GAAZ,YAAY,CAAc;QAC1B,aAAQ,GAAR,QAAQ,CAAe;QAIvB,mBAAc,GAAd,cAAc,CAAuB;QAzBtC,gBAAW,GAAoB,IAAI,GAAG,EAAE,CAAC;QACzC,gBAAW,GAAoB,IAAI,GAAG,EAAE,CAAC;QAQjD,aAAQ,GAAG,KAAK,CAAC;QAkBxB,IAAI,CAAC,SAAS,GAAG;YAChB,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,cAAc,EAAE,GAAG,EAAE;gBACnD,IAAI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E,MAA2B;QACnE,MAAM,CAAC,IAAI,CAAC,QAAQ,KAAK,KAAK,EAAE,KAAK,CAAC,uBAAuB,CAAC,CAAC;QAE/D,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;QAC3D,mBAAmB,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC;QACvD,MAAM,KAAK,GAAG,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QAC9C,MAAM,CAAC,IAAI,EAAE,CAAC;QACd,OAAO,KAAK,CAAC;IACd,CAAC;IAED,IAAW,MAAM;QAChB,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;IACpC,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { Listenable } from \"@fluidframework/core-interfaces\";\nimport { assert, debugAssert } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\ttype DetachedField,\n\ttype FieldKindIdentifier,\n\ttype ForestEvents,\n\ttype SchemaPolicy,\n\ttype TreeStoredSchema,\n\tanchorSlot,\n\tmoveToDetachedField,\n\trootField,\n} from \"../../core/index.js\";\nimport type { ITreeCheckout } from \"../../shared-tree/index.js\";\nimport { type IDisposable, disposeSymbol } from \"../../util/index.js\";\nimport type { NodeIdentifierManager } from \"../node-identifier/index.js\";\n\nimport type { FlexTreeField } from \"./flexTreeTypes.js\";\nimport type { LazyEntity } from \"./lazyEntity.js\";\nimport { makeField } from \"./lazyField.js\";\n\n/**\n * Context for FlexTrees.\n */\nexport interface FlexTreeContext {\n\t/**\n\t * Schema used within this context.\n\t * All data must conform to these schema.\n\t */\n\treadonly schema: TreeStoredSchema;\n\n\t/**\n\t * SchemaPolicy used within this context.\n\t */\n\treadonly schemaPolicy: SchemaPolicy;\n\n\t/**\n\t * If true, this context is the canonical context instance for a given view,\n\t * and its schema include all schema from the document.\n\t *\n\t * If false, this context was created for use in a unhydrated tree, and the full document schema is unknown.\n\t */\n\tisHydrated(): this is FlexTreeHydratedContext;\n\n\t/**\n\t * If true, none of the nodes in this context can be used.\n\t */\n\tisDisposed(): boolean;\n\n\trunInTransaction(fn: () => void): void;\n}\n\n/**\n * Subset of a hydrated context which can be used in more cases (like before the root and events are set up).\n */\nexport interface FlexTreeHydratedContextMinimal {\n\t/**\n\t * The {@link NodeIdentifierManager} responsible for allocating and compressing identifiers for nodes in this context.\n\t */\n\treadonly nodeKeyManager: NodeIdentifierManager;\n\n\t/**\n\t * The checkout object associated with this context.\n\t */\n\treadonly checkout: ITreeCheckout;\n\n\t/**\n\t * Returns a new {@link FlexTreeField} that will live as long as the caller allows up to the next call to {@link clear} or disposal of the context.\n\t * @remarks\n\t * Due to limited support for detached fields, not all operations are supported.\n\t * Additionally if the detached field's content is deleted, the field will become out of schema if it is required: it must not be used after that point.\n\t */\n\tdetachedField?(key: DetachedField, schema: FieldKindIdentifier): FlexTreeField;\n}\n\n/**\n * A common context of a \"forest\" of FlexTrees.\n * It handles group operations like transforming cursors into anchors for edits.\n */\nexport interface FlexTreeHydratedContext\n\textends FlexTreeContext,\n\t\tFlexTreeHydratedContextMinimal {\n\treadonly events: Listenable<ForestEvents>;\n\t/**\n\t * Gets the root field of the tree.\n\t */\n\tget root(): FlexTreeField;\n}\n\n/**\n * Creating multiple flex tree contexts for the same branch, and thus with the same underlying AnchorSet does not work due to how TreeNode caching works.\n * This slot is used to detect if one already exists and error if creating a second.\n */\nexport const ContextSlot = anchorSlot<Context>();\n\n/**\n * Implementation of `FlexTreeHydratedContext`.\n *\n * @remarks An editor is required to edit the FlexTree.\n *\n * A {@link FlexTreeContext} which is used to manage the cursors and anchors within the FlexTrees:\n * This is necessary for supporting using this tree across edits to the forest, and not leaking memory.\n *\n * This context and the trees it produces observe the kinds of fields from the schema\n */\nexport class Context implements FlexTreeHydratedContext, IDisposable {\n\tpublic readonly withCursors: Set<LazyEntity> = new Set();\n\tpublic readonly withAnchors: Set<LazyEntity> = new Set();\n\n\t/**\n\t * Callbacks to run when disposing.\n\t *\n\t * Mainly event un-registration.\n\t */\n\tprivate readonly onDispose: (() => void)[];\n\tprivate disposed = false;\n\n\t/**\n\t * Stores the last accessed version of the root.\n\t * @remarks\n\t * Anything which can delete this field must clear it.\n\t * Currently \"clear\" is the only case.\n\t */\n\tprivate lazyRootCache: FlexTreeField | undefined;\n\n\tpublic constructor(\n\t\tpublic readonly schemaPolicy: SchemaPolicy,\n\t\tpublic readonly checkout: ITreeCheckout,\n\t\t/**\n\t\t * An object which handles node key generation and conversion\n\t\t */\n\t\tpublic readonly nodeKeyManager: NodeIdentifierManager,\n\t) {\n\t\tthis.onDispose = [\n\t\t\tthis.checkout.forest.events.on(\"beforeChange\", () => {\n\t\t\t\tthis.prepareForEdit();\n\t\t\t}),\n\t\t];\n\n\t\tassert(\n\t\t\t!this.checkout.forest.anchors.slots.has(ContextSlot),\n\t\t\t0x92b /* Cannot create second flex-tree from checkout */,\n\t\t);\n\t\tthis.checkout.forest.anchors.slots.set(ContextSlot, this);\n\t}\n\n\tpublic isHydrated(): this is FlexTreeHydratedContext {\n\t\tdebugAssert(() => !this.disposed || \"Disposed\");\n\t\treturn true;\n\t}\n\n\tpublic isDisposed(): boolean {\n\t\treturn this.disposed;\n\t}\n\n\tpublic get schema(): TreeStoredSchema {\n\t\treturn this.checkout.storedSchema;\n\t}\n\n\tpublic runInTransaction(fn: () => void): void {\n\t\tdebugAssert(() => !this.disposed || \"Disposed\");\n\t\tthis.checkout.transaction.start(false);\n\t\tfn();\n\t\tthis.checkout.transaction.commit();\n\t}\n\n\t/**\n\t * Called before editing.\n\t * Clears all cursors so editing can proceed.\n\t */\n\tprivate prepareForEdit(): void {\n\t\tassert(this.disposed === false, 0x802 /* use after dispose */);\n\t\tfor (const target of this.withCursors) {\n\t\t\ttarget.prepareForEdit();\n\t\t}\n\t\tassert(this.withCursors.size === 0, 0x773 /* prepareForEdit should remove all cursors */);\n\t}\n\n\tpublic [disposeSymbol](): void {\n\t\tassert(this.disposed === false, 0x803 /* double dispose */);\n\t\tthis.disposed = true;\n\t\tthis.clear();\n\t\tfor (const unregister of this.onDispose) {\n\t\t\tunregister();\n\t\t}\n\t\tthis.onDispose.length = 0;\n\n\t\tconst deleted = this.checkout.forest.anchors.slots.delete(ContextSlot);\n\t\tassert(deleted, 0x8c4 /* unexpected dispose */);\n\t}\n\n\t/**\n\t * Release any cursors and anchors held by tree entities created in this context.\n\t * @remarks\n\t * Ensures the cashed references to those entities on the Anchors are also cleared.\n\t * The tree entities are invalid to use after this, but the context may still be used\n\t * to create new trees starting from the root.\n\t */\n\tpublic clear(): void {\n\t\tfor (const target of this.withAnchors) {\n\t\t\ttarget[disposeSymbol]();\n\t\t}\n\t\tthis.lazyRootCache = undefined;\n\t\tassert(this.withCursors.size === 0, 0x774 /* free should remove all cursors */);\n\t\tassert(this.withAnchors.size === 0, 0x775 /* free should remove all anchors */);\n\t}\n\n\t/**\n\t * Gets the root field of the tree.\n\t * @remarks\n\t * This is a cached value: it should not be disposed by the accessor.\n\t * Like all other fields from this context, it will become invalid to use after {@link clear} is called or the {@link disposeSymbol} method is called.\n\t */\n\tpublic get root(): FlexTreeField {\n\t\tassert(this.disposed === false, 0x804 /* use after dispose */);\n\n\t\tthis.lazyRootCache ??= this.detachedField(rootField, this.schema.rootFieldSchema.kind);\n\t\treturn this.lazyRootCache;\n\t}\n\n\t/**\n\t * Returns a new {@link FlexTreeField} that will live as long as the caller allows up to the next call to {@link clear} or disposal of the context.\n\t * @remarks\n\t * Due to limited support for detached fields, not all operations are supported.\n\t * Additionally if the detached field's content is deleted, the field will become out of schema if it is required: it must not be used after that point.\n\t */\n\tpublic detachedField(key: DetachedField, schema: FieldKindIdentifier): FlexTreeField {\n\t\tassert(this.disposed === false, 0xb9c /* use after dispose */);\n\n\t\tconst cursor = this.checkout.forest.allocateCursor(\"root\");\n\t\tmoveToDetachedField(this.checkout.forest, cursor, key);\n\t\tconst field = makeField(this, schema, cursor);\n\t\tcursor.free();\n\t\treturn field;\n\t}\n\n\tpublic get events(): Listenable<ForestEvents> {\n\t\treturn this.checkout.forest.events;\n\t}\n}\n"]}