@fluidframework/tree 2.101.1 → 2.103.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (609) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/api-report/tree.alpha.api.md +19 -0
  3. package/dist/codec/codec.d.ts +22 -53
  4. package/dist/codec/codec.d.ts.map +1 -1
  5. package/dist/codec/codec.js +7 -44
  6. package/dist/codec/codec.js.map +1 -1
  7. package/dist/codec/index.d.ts +1 -1
  8. package/dist/codec/index.d.ts.map +1 -1
  9. package/dist/codec/index.js +2 -2
  10. package/dist/codec/index.js.map +1 -1
  11. package/dist/codec/versioned/codec.d.ts +56 -28
  12. package/dist/codec/versioned/codec.d.ts.map +1 -1
  13. package/dist/codec/versioned/codec.js +29 -12
  14. package/dist/codec/versioned/codec.js.map +1 -1
  15. package/dist/codec/versioned/format.d.ts +5 -4
  16. package/dist/codec/versioned/format.d.ts.map +1 -1
  17. package/dist/codec/versioned/format.js +26 -3
  18. package/dist/codec/versioned/format.js.map +1 -1
  19. package/dist/codec/versioned/index.d.ts +1 -1
  20. package/dist/codec/versioned/index.d.ts.map +1 -1
  21. package/dist/codec/versioned/index.js +2 -2
  22. package/dist/codec/versioned/index.js.map +1 -1
  23. package/dist/core/rebase/types.d.ts +4 -3
  24. package/dist/core/rebase/types.d.ts.map +1 -1
  25. package/dist/core/rebase/types.js +27 -4
  26. package/dist/core/rebase/types.js.map +1 -1
  27. package/dist/core/schema-stored/formatV1.d.ts +16 -15
  28. package/dist/core/schema-stored/formatV1.d.ts.map +1 -1
  29. package/dist/core/schema-stored/formatV1.js +31 -8
  30. package/dist/core/schema-stored/formatV1.js.map +1 -1
  31. package/dist/core/schema-stored/formatV2.d.ts +29 -28
  32. package/dist/core/schema-stored/formatV2.d.ts.map +1 -1
  33. package/dist/core/schema-stored/formatV2.js +33 -10
  34. package/dist/core/schema-stored/formatV2.js.map +1 -1
  35. package/dist/core/tree/deltaUtil.d.ts +2 -2
  36. package/dist/core/tree/deltaUtil.js +2 -2
  37. package/dist/core/tree/deltaUtil.js.map +1 -1
  38. package/dist/core/tree/detachedFieldIndexCodecV1.d.ts.map +1 -1
  39. package/dist/core/tree/detachedFieldIndexCodecV1.js +3 -2
  40. package/dist/core/tree/detachedFieldIndexCodecV1.js.map +1 -1
  41. package/dist/core/tree/detachedFieldIndexCodecV2.d.ts.map +1 -1
  42. package/dist/core/tree/detachedFieldIndexCodecV2.js +4 -2
  43. package/dist/core/tree/detachedFieldIndexCodecV2.js.map +1 -1
  44. package/dist/core/tree/detachedFieldIndexCodecs.d.ts +3 -3
  45. package/dist/core/tree/detachedFieldIndexCodecs.d.ts.map +1 -1
  46. package/dist/core/tree/detachedFieldIndexCodecs.js +1 -1
  47. package/dist/core/tree/detachedFieldIndexCodecs.js.map +1 -1
  48. package/dist/core/tree/detachedFieldIndexFormatCommon.d.ts +11 -10
  49. package/dist/core/tree/detachedFieldIndexFormatCommon.d.ts.map +1 -1
  50. package/dist/core/tree/detachedFieldIndexFormatCommon.js +33 -10
  51. package/dist/core/tree/detachedFieldIndexFormatCommon.js.map +1 -1
  52. package/dist/core/tree/detachedFieldIndexFormatV2.d.ts +7 -6
  53. package/dist/core/tree/detachedFieldIndexFormatV2.d.ts.map +1 -1
  54. package/dist/core/tree/detachedFieldIndexFormatV2.js +25 -2
  55. package/dist/core/tree/detachedFieldIndexFormatV2.js.map +1 -1
  56. package/dist/core/tree/persistedTreeTextFormat.d.ts +19 -18
  57. package/dist/core/tree/persistedTreeTextFormat.d.ts.map +1 -1
  58. package/dist/core/tree/persistedTreeTextFormat.js +33 -10
  59. package/dist/core/tree/persistedTreeTextFormat.js.map +1 -1
  60. package/dist/feature-libraries/chunked-forest/chunkTree.d.ts +38 -1
  61. package/dist/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  62. package/dist/feature-libraries/chunked-forest/chunkTree.js +63 -5
  63. package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  64. package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  65. package/dist/feature-libraries/chunked-forest/chunkedForest.js +18 -4
  66. package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  67. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +34 -2
  68. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  69. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js +106 -3
  70. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  71. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts +5 -5
  72. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  73. package/dist/feature-libraries/chunked-forest/codec/codecs.js +2 -2
  74. package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  75. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +7 -7
  76. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
  77. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  78. package/dist/feature-libraries/chunked-forest/codec/format/formatGeneric.d.ts +13 -12
  79. package/dist/feature-libraries/chunked-forest/codec/format/formatGeneric.d.ts.map +1 -1
  80. package/dist/feature-libraries/chunked-forest/codec/format/formatGeneric.js +36 -13
  81. package/dist/feature-libraries/chunked-forest/codec/format/formatGeneric.js.map +1 -1
  82. package/dist/feature-libraries/chunked-forest/codec/format/formatV1.d.ts +36 -35
  83. package/dist/feature-libraries/chunked-forest/codec/format/formatV1.d.ts.map +1 -1
  84. package/dist/feature-libraries/chunked-forest/codec/format/formatV1.js +41 -18
  85. package/dist/feature-libraries/chunked-forest/codec/format/formatV1.js.map +1 -1
  86. package/dist/feature-libraries/chunked-forest/codec/format/formatV2.d.ts +35 -14
  87. package/dist/feature-libraries/chunked-forest/codec/format/formatV2.d.ts.map +1 -1
  88. package/dist/feature-libraries/chunked-forest/codec/format/formatV2.js +35 -6
  89. package/dist/feature-libraries/chunked-forest/codec/format/formatV2.js.map +1 -1
  90. package/dist/feature-libraries/chunked-forest/codec/format/formatVText.d.ts +106 -0
  91. package/dist/feature-libraries/chunked-forest/codec/format/formatVText.d.ts.map +1 -0
  92. package/dist/feature-libraries/chunked-forest/codec/format/formatVText.js +67 -0
  93. package/dist/feature-libraries/chunked-forest/codec/format/formatVText.js.map +1 -0
  94. package/dist/feature-libraries/chunked-forest/codec/format/index.d.ts +2 -1
  95. package/dist/feature-libraries/chunked-forest/codec/format/index.d.ts.map +1 -1
  96. package/dist/feature-libraries/chunked-forest/codec/format/index.js +5 -1
  97. package/dist/feature-libraries/chunked-forest/codec/format/index.js.map +1 -1
  98. package/dist/feature-libraries/chunked-forest/codec/format/versions.d.ts +38 -4
  99. package/dist/feature-libraries/chunked-forest/codec/format/versions.d.ts.map +1 -1
  100. package/dist/feature-libraries/chunked-forest/codec/format/versions.js +7 -1
  101. package/dist/feature-libraries/chunked-forest/codec/format/versions.js.map +1 -1
  102. package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts +7 -7
  103. package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts.map +1 -1
  104. package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.js +1 -2
  105. package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.js.map +1 -1
  106. package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts +66 -14
  107. package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
  108. package/dist/feature-libraries/chunked-forest/uniformChunk.js +101 -36
  109. package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  110. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  111. package/dist/feature-libraries/default-schema/defaultEditBuilder.js +36 -14
  112. package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  113. package/dist/feature-libraries/forest-summary/codec.d.ts +5 -4
  114. package/dist/feature-libraries/forest-summary/codec.d.ts.map +1 -1
  115. package/dist/feature-libraries/forest-summary/codec.js +2 -2
  116. package/dist/feature-libraries/forest-summary/codec.js.map +1 -1
  117. package/dist/feature-libraries/forest-summary/formatCommon.d.ts +6 -5
  118. package/dist/feature-libraries/forest-summary/formatCommon.d.ts.map +1 -1
  119. package/dist/feature-libraries/forest-summary/formatCommon.js +26 -3
  120. package/dist/feature-libraries/forest-summary/formatCommon.js.map +1 -1
  121. package/dist/feature-libraries/modular-schema/genericFieldKindFormat.d.ts +4 -3
  122. package/dist/feature-libraries/modular-schema/genericFieldKindFormat.d.ts.map +1 -1
  123. package/dist/feature-libraries/modular-schema/genericFieldKindFormat.js +26 -3
  124. package/dist/feature-libraries/modular-schema/genericFieldKindFormat.js.map +1 -1
  125. package/dist/feature-libraries/modular-schema/modularChangeFormatV1.d.ts +45 -44
  126. package/dist/feature-libraries/modular-schema/modularChangeFormatV1.d.ts.map +1 -1
  127. package/dist/feature-libraries/modular-schema/modularChangeFormatV1.js +48 -25
  128. package/dist/feature-libraries/modular-schema/modularChangeFormatV1.js.map +1 -1
  129. package/dist/feature-libraries/modular-schema/modularChangeFormatV2.d.ts +23 -22
  130. package/dist/feature-libraries/modular-schema/modularChangeFormatV2.d.ts.map +1 -1
  131. package/dist/feature-libraries/modular-schema/modularChangeFormatV2.js +29 -6
  132. package/dist/feature-libraries/modular-schema/modularChangeFormatV2.js.map +1 -1
  133. package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts +1 -1
  134. package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
  135. package/dist/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
  136. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts +9 -8
  137. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts.map +1 -1
  138. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV1.js +31 -8
  139. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV1.js.map +1 -1
  140. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts +14 -13
  141. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts.map +1 -1
  142. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV2.js +34 -11
  143. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV2.js.map +1 -1
  144. package/dist/feature-libraries/schema-edits/schemaChangeFormat.d.ts +5 -4
  145. package/dist/feature-libraries/schema-edits/schemaChangeFormat.d.ts.map +1 -1
  146. package/dist/feature-libraries/schema-edits/schemaChangeFormat.js +25 -2
  147. package/dist/feature-libraries/schema-edits/schemaChangeFormat.js.map +1 -1
  148. package/dist/feature-libraries/schema-index/codec.d.ts +2 -2
  149. package/dist/feature-libraries/schema-index/codec.d.ts.map +1 -1
  150. package/dist/feature-libraries/schema-index/codec.js +1 -1
  151. package/dist/feature-libraries/schema-index/codec.js.map +1 -1
  152. package/dist/feature-libraries/schema-index/formatV1.d.ts +15 -14
  153. package/dist/feature-libraries/schema-index/formatV1.d.ts.map +1 -1
  154. package/dist/feature-libraries/schema-index/formatV1.js +27 -4
  155. package/dist/feature-libraries/schema-index/formatV1.js.map +1 -1
  156. package/dist/feature-libraries/schema-index/formatV2.d.ts +20 -19
  157. package/dist/feature-libraries/schema-index/formatV2.d.ts.map +1 -1
  158. package/dist/feature-libraries/schema-index/formatV2.js +27 -4
  159. package/dist/feature-libraries/schema-index/formatV2.js.map +1 -1
  160. package/dist/feature-libraries/sequence-field/compose.d.ts.map +1 -1
  161. package/dist/feature-libraries/sequence-field/compose.js +1 -3
  162. package/dist/feature-libraries/sequence-field/compose.js.map +1 -1
  163. package/dist/feature-libraries/sequence-field/formatV1.d.ts +283 -282
  164. package/dist/feature-libraries/sequence-field/formatV1.d.ts.map +1 -1
  165. package/dist/feature-libraries/sequence-field/formatV1.js +63 -40
  166. package/dist/feature-libraries/sequence-field/formatV1.js.map +1 -1
  167. package/dist/feature-libraries/sequence-field/formatV2.d.ts +180 -179
  168. package/dist/feature-libraries/sequence-field/formatV2.d.ts.map +1 -1
  169. package/dist/feature-libraries/sequence-field/formatV2.js +55 -32
  170. package/dist/feature-libraries/sequence-field/formatV2.js.map +1 -1
  171. package/dist/feature-libraries/sequence-field/formatV3.d.ts +126 -125
  172. package/dist/feature-libraries/sequence-field/formatV3.d.ts.map +1 -1
  173. package/dist/feature-libraries/sequence-field/formatV3.js +27 -4
  174. package/dist/feature-libraries/sequence-field/formatV3.js.map +1 -1
  175. package/dist/index.d.ts +1 -1
  176. package/dist/index.d.ts.map +1 -1
  177. package/dist/index.js +3 -1
  178. package/dist/index.js.map +1 -1
  179. package/dist/packageVersion.d.ts +1 -1
  180. package/dist/packageVersion.js +1 -1
  181. package/dist/packageVersion.js.map +1 -1
  182. package/dist/shared-tree/isAuditableFromOutcome.d.ts +20 -0
  183. package/dist/shared-tree/isAuditableFromOutcome.d.ts.map +1 -0
  184. package/dist/shared-tree/isAuditableFromOutcome.js +36 -0
  185. package/dist/shared-tree/isAuditableFromOutcome.js.map +1 -0
  186. package/dist/shared-tree/sharedTree.d.ts +2 -2
  187. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  188. package/dist/shared-tree/sharedTree.js.map +1 -1
  189. package/dist/shared-tree/sharedTreeChangeFormat.d.ts +8 -7
  190. package/dist/shared-tree/sharedTreeChangeFormat.d.ts.map +1 -1
  191. package/dist/shared-tree/sharedTreeChangeFormat.js +28 -5
  192. package/dist/shared-tree/sharedTreeChangeFormat.js.map +1 -1
  193. package/dist/shared-tree/treeCheckout.d.ts +5 -3
  194. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  195. package/dist/shared-tree/treeCheckout.js +37 -8
  196. package/dist/shared-tree/treeCheckout.js.map +1 -1
  197. package/dist/shared-tree-core/editManager.d.ts +2 -2
  198. package/dist/shared-tree-core/editManager.d.ts.map +1 -1
  199. package/dist/shared-tree-core/editManager.js.map +1 -1
  200. package/dist/shared-tree-core/editManagerCodecs.d.ts +3 -3
  201. package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  202. package/dist/shared-tree-core/editManagerCodecs.js +2 -2
  203. package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
  204. package/dist/shared-tree-core/editManagerFormatCommons.d.ts +35 -34
  205. package/dist/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
  206. package/dist/shared-tree-core/editManagerFormatCommons.js +39 -16
  207. package/dist/shared-tree-core/editManagerFormatCommons.js.map +1 -1
  208. package/dist/shared-tree-core/editManagerFormatV1toV4.d.ts +15 -15
  209. package/dist/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -1
  210. package/dist/shared-tree-core/editManagerFormatV1toV4.js +33 -10
  211. package/dist/shared-tree-core/editManagerFormatV1toV4.js.map +1 -1
  212. package/dist/shared-tree-core/editManagerFormatVSharedBranches.d.ts +40 -40
  213. package/dist/shared-tree-core/editManagerFormatVSharedBranches.d.ts.map +1 -1
  214. package/dist/shared-tree-core/editManagerFormatVSharedBranches.js +27 -4
  215. package/dist/shared-tree-core/editManagerFormatVSharedBranches.js.map +1 -1
  216. package/dist/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -1
  217. package/dist/shared-tree-core/messageCodecVSharedBranches.js +25 -2
  218. package/dist/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
  219. package/dist/shared-tree-core/messageCodecs.d.ts +3 -3
  220. package/dist/shared-tree-core/messageCodecs.d.ts.map +1 -1
  221. package/dist/shared-tree-core/messageCodecs.js +2 -2
  222. package/dist/shared-tree-core/messageCodecs.js.map +1 -1
  223. package/dist/shared-tree-core/messageFormatV1ToV4.d.ts +5 -5
  224. package/dist/shared-tree-core/messageFormatV1ToV4.d.ts.map +1 -1
  225. package/dist/shared-tree-core/messageFormatV1ToV4.js +31 -8
  226. package/dist/shared-tree-core/messageFormatV1ToV4.js.map +1 -1
  227. package/dist/shared-tree-core/messageFormatVSharedBranches.d.ts +7 -7
  228. package/dist/shared-tree-core/messageFormatVSharedBranches.d.ts.map +1 -1
  229. package/dist/shared-tree-core/messageFormatVSharedBranches.js +29 -6
  230. package/dist/shared-tree-core/messageFormatVSharedBranches.js.map +1 -1
  231. package/dist/simple-tree/core/treeNodeKernel.d.ts +5 -0
  232. package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  233. package/dist/simple-tree/core/treeNodeKernel.js +62 -24
  234. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
  235. package/dist/simple-tree/simpleSchemaFormatV1.d.ts +121 -120
  236. package/dist/simple-tree/simpleSchemaFormatV1.d.ts.map +1 -1
  237. package/dist/simple-tree/simpleSchemaFormatV1.js +54 -31
  238. package/dist/simple-tree/simpleSchemaFormatV1.js.map +1 -1
  239. package/dist/text/codePointUtils.d.ts +48 -0
  240. package/dist/text/codePointUtils.d.ts.map +1 -0
  241. package/dist/text/codePointUtils.js +80 -0
  242. package/dist/text/codePointUtils.js.map +1 -0
  243. package/dist/text/index.d.ts +1 -0
  244. package/dist/text/index.d.ts.map +1 -1
  245. package/dist/text/index.js +4 -1
  246. package/dist/text/index.js.map +1 -1
  247. package/dist/text/textDomain.d.ts +93 -1
  248. package/dist/text/textDomain.d.ts.map +1 -1
  249. package/dist/text/textDomain.js +65 -8
  250. package/dist/text/textDomain.js.map +1 -1
  251. package/dist/text/textDomainFormatted.d.ts +24 -6
  252. package/dist/text/textDomainFormatted.d.ts.map +1 -1
  253. package/dist/text/textDomainFormatted.js +29 -1
  254. package/dist/text/textDomainFormatted.js.map +1 -1
  255. package/dist/treeFactory.d.ts.map +1 -1
  256. package/dist/treeFactory.js +9 -7
  257. package/dist/treeFactory.js.map +1 -1
  258. package/dist/util/breakable.d.ts +7 -1
  259. package/dist/util/breakable.d.ts.map +1 -1
  260. package/dist/util/breakable.js +18 -4
  261. package/dist/util/breakable.js.map +1 -1
  262. package/dist/util/typeboxBrand.d.ts +1 -1
  263. package/dist/util/typeboxBrand.d.ts.map +1 -1
  264. package/dist/util/typeboxBrand.js +26 -3
  265. package/dist/util/typeboxBrand.js.map +1 -1
  266. package/dist/util/utils.d.ts +2 -2
  267. package/dist/util/utils.d.ts.map +1 -1
  268. package/dist/util/utils.js +25 -2
  269. package/dist/util/utils.js.map +1 -1
  270. package/eslint.config.mts +44 -0
  271. package/lib/codec/codec.d.ts +22 -53
  272. package/lib/codec/codec.d.ts.map +1 -1
  273. package/lib/codec/codec.js +7 -44
  274. package/lib/codec/codec.js.map +1 -1
  275. package/lib/codec/index.d.ts +1 -1
  276. package/lib/codec/index.d.ts.map +1 -1
  277. package/lib/codec/index.js +1 -1
  278. package/lib/codec/index.js.map +1 -1
  279. package/lib/codec/versioned/codec.d.ts +56 -28
  280. package/lib/codec/versioned/codec.d.ts.map +1 -1
  281. package/lib/codec/versioned/codec.js +27 -10
  282. package/lib/codec/versioned/codec.js.map +1 -1
  283. package/lib/codec/versioned/format.d.ts +5 -4
  284. package/lib/codec/versioned/format.d.ts.map +1 -1
  285. package/lib/codec/versioned/format.js +1 -1
  286. package/lib/codec/versioned/format.js.map +1 -1
  287. package/lib/codec/versioned/index.d.ts +1 -1
  288. package/lib/codec/versioned/index.d.ts.map +1 -1
  289. package/lib/codec/versioned/index.js +1 -1
  290. package/lib/codec/versioned/index.js.map +1 -1
  291. package/lib/core/rebase/types.d.ts +4 -3
  292. package/lib/core/rebase/types.d.ts.map +1 -1
  293. package/lib/core/rebase/types.js +1 -1
  294. package/lib/core/rebase/types.js.map +1 -1
  295. package/lib/core/schema-stored/formatV1.d.ts +16 -15
  296. package/lib/core/schema-stored/formatV1.d.ts.map +1 -1
  297. package/lib/core/schema-stored/formatV1.js +1 -1
  298. package/lib/core/schema-stored/formatV1.js.map +1 -1
  299. package/lib/core/schema-stored/formatV2.d.ts +29 -28
  300. package/lib/core/schema-stored/formatV2.d.ts.map +1 -1
  301. package/lib/core/schema-stored/formatV2.js +1 -1
  302. package/lib/core/schema-stored/formatV2.js.map +1 -1
  303. package/lib/core/tree/deltaUtil.d.ts +2 -2
  304. package/lib/core/tree/deltaUtil.js +2 -2
  305. package/lib/core/tree/deltaUtil.js.map +1 -1
  306. package/lib/core/tree/detachedFieldIndexCodecV1.d.ts.map +1 -1
  307. package/lib/core/tree/detachedFieldIndexCodecV1.js +3 -2
  308. package/lib/core/tree/detachedFieldIndexCodecV1.js.map +1 -1
  309. package/lib/core/tree/detachedFieldIndexCodecV2.d.ts.map +1 -1
  310. package/lib/core/tree/detachedFieldIndexCodecV2.js +5 -3
  311. package/lib/core/tree/detachedFieldIndexCodecV2.js.map +1 -1
  312. package/lib/core/tree/detachedFieldIndexCodecs.d.ts +3 -3
  313. package/lib/core/tree/detachedFieldIndexCodecs.d.ts.map +1 -1
  314. package/lib/core/tree/detachedFieldIndexCodecs.js +2 -2
  315. package/lib/core/tree/detachedFieldIndexCodecs.js.map +1 -1
  316. package/lib/core/tree/detachedFieldIndexFormatCommon.d.ts +11 -10
  317. package/lib/core/tree/detachedFieldIndexFormatCommon.d.ts.map +1 -1
  318. package/lib/core/tree/detachedFieldIndexFormatCommon.js +1 -1
  319. package/lib/core/tree/detachedFieldIndexFormatCommon.js.map +1 -1
  320. package/lib/core/tree/detachedFieldIndexFormatV2.d.ts +7 -6
  321. package/lib/core/tree/detachedFieldIndexFormatV2.d.ts.map +1 -1
  322. package/lib/core/tree/detachedFieldIndexFormatV2.js +1 -1
  323. package/lib/core/tree/detachedFieldIndexFormatV2.js.map +1 -1
  324. package/lib/core/tree/persistedTreeTextFormat.d.ts +19 -18
  325. package/lib/core/tree/persistedTreeTextFormat.d.ts.map +1 -1
  326. package/lib/core/tree/persistedTreeTextFormat.js +1 -1
  327. package/lib/core/tree/persistedTreeTextFormat.js.map +1 -1
  328. package/lib/feature-libraries/chunked-forest/chunkTree.d.ts +38 -1
  329. package/lib/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  330. package/lib/feature-libraries/chunked-forest/chunkTree.js +62 -5
  331. package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  332. package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  333. package/lib/feature-libraries/chunked-forest/chunkedForest.js +20 -6
  334. package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  335. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +34 -2
  336. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  337. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js +102 -2
  338. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  339. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts +5 -5
  340. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  341. package/lib/feature-libraries/chunked-forest/codec/codecs.js +3 -3
  342. package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  343. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +7 -7
  344. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
  345. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  346. package/lib/feature-libraries/chunked-forest/codec/format/formatGeneric.d.ts +13 -12
  347. package/lib/feature-libraries/chunked-forest/codec/format/formatGeneric.d.ts.map +1 -1
  348. package/lib/feature-libraries/chunked-forest/codec/format/formatGeneric.js +1 -1
  349. package/lib/feature-libraries/chunked-forest/codec/format/formatGeneric.js.map +1 -1
  350. package/lib/feature-libraries/chunked-forest/codec/format/formatV1.d.ts +36 -35
  351. package/lib/feature-libraries/chunked-forest/codec/format/formatV1.d.ts.map +1 -1
  352. package/lib/feature-libraries/chunked-forest/codec/format/formatV1.js +1 -1
  353. package/lib/feature-libraries/chunked-forest/codec/format/formatV1.js.map +1 -1
  354. package/lib/feature-libraries/chunked-forest/codec/format/formatV2.d.ts +35 -14
  355. package/lib/feature-libraries/chunked-forest/codec/format/formatV2.d.ts.map +1 -1
  356. package/lib/feature-libraries/chunked-forest/codec/format/formatV2.js +9 -3
  357. package/lib/feature-libraries/chunked-forest/codec/format/formatV2.js.map +1 -1
  358. package/lib/feature-libraries/chunked-forest/codec/format/formatVText.d.ts +106 -0
  359. package/lib/feature-libraries/chunked-forest/codec/format/formatVText.d.ts.map +1 -0
  360. package/lib/feature-libraries/chunked-forest/codec/format/formatVText.js +41 -0
  361. package/lib/feature-libraries/chunked-forest/codec/format/formatVText.js.map +1 -0
  362. package/lib/feature-libraries/chunked-forest/codec/format/index.d.ts +2 -1
  363. package/lib/feature-libraries/chunked-forest/codec/format/index.d.ts.map +1 -1
  364. package/lib/feature-libraries/chunked-forest/codec/format/index.js +2 -1
  365. package/lib/feature-libraries/chunked-forest/codec/format/index.js.map +1 -1
  366. package/lib/feature-libraries/chunked-forest/codec/format/versions.d.ts +38 -4
  367. package/lib/feature-libraries/chunked-forest/codec/format/versions.d.ts.map +1 -1
  368. package/lib/feature-libraries/chunked-forest/codec/format/versions.js +6 -0
  369. package/lib/feature-libraries/chunked-forest/codec/format/versions.js.map +1 -1
  370. package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts +7 -7
  371. package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts.map +1 -1
  372. package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.js +2 -3
  373. package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.js.map +1 -1
  374. package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts +66 -14
  375. package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
  376. package/lib/feature-libraries/chunked-forest/uniformChunk.js +101 -36
  377. package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  378. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  379. package/lib/feature-libraries/default-schema/defaultEditBuilder.js +36 -14
  380. package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  381. package/lib/feature-libraries/forest-summary/codec.d.ts +5 -4
  382. package/lib/feature-libraries/forest-summary/codec.d.ts.map +1 -1
  383. package/lib/feature-libraries/forest-summary/codec.js +3 -3
  384. package/lib/feature-libraries/forest-summary/codec.js.map +1 -1
  385. package/lib/feature-libraries/forest-summary/formatCommon.d.ts +6 -5
  386. package/lib/feature-libraries/forest-summary/formatCommon.d.ts.map +1 -1
  387. package/lib/feature-libraries/forest-summary/formatCommon.js +1 -1
  388. package/lib/feature-libraries/forest-summary/formatCommon.js.map +1 -1
  389. package/lib/feature-libraries/modular-schema/genericFieldKindFormat.d.ts +4 -3
  390. package/lib/feature-libraries/modular-schema/genericFieldKindFormat.d.ts.map +1 -1
  391. package/lib/feature-libraries/modular-schema/genericFieldKindFormat.js +1 -1
  392. package/lib/feature-libraries/modular-schema/genericFieldKindFormat.js.map +1 -1
  393. package/lib/feature-libraries/modular-schema/modularChangeFormatV1.d.ts +45 -44
  394. package/lib/feature-libraries/modular-schema/modularChangeFormatV1.d.ts.map +1 -1
  395. package/lib/feature-libraries/modular-schema/modularChangeFormatV1.js +1 -1
  396. package/lib/feature-libraries/modular-schema/modularChangeFormatV1.js.map +1 -1
  397. package/lib/feature-libraries/modular-schema/modularChangeFormatV2.d.ts +23 -22
  398. package/lib/feature-libraries/modular-schema/modularChangeFormatV2.d.ts.map +1 -1
  399. package/lib/feature-libraries/modular-schema/modularChangeFormatV2.js +1 -1
  400. package/lib/feature-libraries/modular-schema/modularChangeFormatV2.js.map +1 -1
  401. package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts +1 -1
  402. package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
  403. package/lib/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
  404. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts +9 -8
  405. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts.map +1 -1
  406. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV1.js +1 -1
  407. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV1.js.map +1 -1
  408. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts +14 -13
  409. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts.map +1 -1
  410. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV2.js +1 -1
  411. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV2.js.map +1 -1
  412. package/lib/feature-libraries/schema-edits/schemaChangeFormat.d.ts +5 -4
  413. package/lib/feature-libraries/schema-edits/schemaChangeFormat.d.ts.map +1 -1
  414. package/lib/feature-libraries/schema-edits/schemaChangeFormat.js +1 -1
  415. package/lib/feature-libraries/schema-edits/schemaChangeFormat.js.map +1 -1
  416. package/lib/feature-libraries/schema-index/codec.d.ts +2 -2
  417. package/lib/feature-libraries/schema-index/codec.d.ts.map +1 -1
  418. package/lib/feature-libraries/schema-index/codec.js +2 -2
  419. package/lib/feature-libraries/schema-index/codec.js.map +1 -1
  420. package/lib/feature-libraries/schema-index/formatV1.d.ts +15 -14
  421. package/lib/feature-libraries/schema-index/formatV1.d.ts.map +1 -1
  422. package/lib/feature-libraries/schema-index/formatV1.js +1 -1
  423. package/lib/feature-libraries/schema-index/formatV1.js.map +1 -1
  424. package/lib/feature-libraries/schema-index/formatV2.d.ts +20 -19
  425. package/lib/feature-libraries/schema-index/formatV2.d.ts.map +1 -1
  426. package/lib/feature-libraries/schema-index/formatV2.js +1 -1
  427. package/lib/feature-libraries/schema-index/formatV2.js.map +1 -1
  428. package/lib/feature-libraries/sequence-field/compose.d.ts.map +1 -1
  429. package/lib/feature-libraries/sequence-field/compose.js +1 -3
  430. package/lib/feature-libraries/sequence-field/compose.js.map +1 -1
  431. package/lib/feature-libraries/sequence-field/formatV1.d.ts +283 -282
  432. package/lib/feature-libraries/sequence-field/formatV1.d.ts.map +1 -1
  433. package/lib/feature-libraries/sequence-field/formatV1.js +1 -1
  434. package/lib/feature-libraries/sequence-field/formatV1.js.map +1 -1
  435. package/lib/feature-libraries/sequence-field/formatV2.d.ts +180 -179
  436. package/lib/feature-libraries/sequence-field/formatV2.d.ts.map +1 -1
  437. package/lib/feature-libraries/sequence-field/formatV2.js +1 -1
  438. package/lib/feature-libraries/sequence-field/formatV2.js.map +1 -1
  439. package/lib/feature-libraries/sequence-field/formatV3.d.ts +126 -125
  440. package/lib/feature-libraries/sequence-field/formatV3.d.ts.map +1 -1
  441. package/lib/feature-libraries/sequence-field/formatV3.js +1 -1
  442. package/lib/feature-libraries/sequence-field/formatV3.js.map +1 -1
  443. package/lib/index.d.ts +1 -1
  444. package/lib/index.d.ts.map +1 -1
  445. package/lib/index.js +1 -1
  446. package/lib/index.js.map +1 -1
  447. package/lib/packageVersion.d.ts +1 -1
  448. package/lib/packageVersion.js +1 -1
  449. package/lib/packageVersion.js.map +1 -1
  450. package/lib/shared-tree/isAuditableFromOutcome.d.ts +20 -0
  451. package/lib/shared-tree/isAuditableFromOutcome.d.ts.map +1 -0
  452. package/lib/shared-tree/isAuditableFromOutcome.js +32 -0
  453. package/lib/shared-tree/isAuditableFromOutcome.js.map +1 -0
  454. package/lib/shared-tree/sharedTree.d.ts +2 -2
  455. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  456. package/lib/shared-tree/sharedTree.js +1 -1
  457. package/lib/shared-tree/sharedTree.js.map +1 -1
  458. package/lib/shared-tree/sharedTreeChangeFormat.d.ts +8 -7
  459. package/lib/shared-tree/sharedTreeChangeFormat.d.ts.map +1 -1
  460. package/lib/shared-tree/sharedTreeChangeFormat.js +1 -1
  461. package/lib/shared-tree/sharedTreeChangeFormat.js.map +1 -1
  462. package/lib/shared-tree/treeCheckout.d.ts +5 -3
  463. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  464. package/lib/shared-tree/treeCheckout.js +38 -9
  465. package/lib/shared-tree/treeCheckout.js.map +1 -1
  466. package/lib/shared-tree-core/editManager.d.ts +2 -2
  467. package/lib/shared-tree-core/editManager.d.ts.map +1 -1
  468. package/lib/shared-tree-core/editManager.js.map +1 -1
  469. package/lib/shared-tree-core/editManagerCodecs.d.ts +3 -3
  470. package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  471. package/lib/shared-tree-core/editManagerCodecs.js +3 -3
  472. package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
  473. package/lib/shared-tree-core/editManagerFormatCommons.d.ts +35 -34
  474. package/lib/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
  475. package/lib/shared-tree-core/editManagerFormatCommons.js +1 -1
  476. package/lib/shared-tree-core/editManagerFormatCommons.js.map +1 -1
  477. package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts +15 -15
  478. package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -1
  479. package/lib/shared-tree-core/editManagerFormatV1toV4.js +1 -1
  480. package/lib/shared-tree-core/editManagerFormatV1toV4.js.map +1 -1
  481. package/lib/shared-tree-core/editManagerFormatVSharedBranches.d.ts +40 -40
  482. package/lib/shared-tree-core/editManagerFormatVSharedBranches.d.ts.map +1 -1
  483. package/lib/shared-tree-core/editManagerFormatVSharedBranches.js +1 -1
  484. package/lib/shared-tree-core/editManagerFormatVSharedBranches.js.map +1 -1
  485. package/lib/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -1
  486. package/lib/shared-tree-core/messageCodecVSharedBranches.js +1 -1
  487. package/lib/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
  488. package/lib/shared-tree-core/messageCodecs.d.ts +3 -3
  489. package/lib/shared-tree-core/messageCodecs.d.ts.map +1 -1
  490. package/lib/shared-tree-core/messageCodecs.js +3 -3
  491. package/lib/shared-tree-core/messageCodecs.js.map +1 -1
  492. package/lib/shared-tree-core/messageFormatV1ToV4.d.ts +5 -5
  493. package/lib/shared-tree-core/messageFormatV1ToV4.d.ts.map +1 -1
  494. package/lib/shared-tree-core/messageFormatV1ToV4.js +1 -1
  495. package/lib/shared-tree-core/messageFormatV1ToV4.js.map +1 -1
  496. package/lib/shared-tree-core/messageFormatVSharedBranches.d.ts +7 -7
  497. package/lib/shared-tree-core/messageFormatVSharedBranches.d.ts.map +1 -1
  498. package/lib/shared-tree-core/messageFormatVSharedBranches.js +1 -1
  499. package/lib/shared-tree-core/messageFormatVSharedBranches.js.map +1 -1
  500. package/lib/simple-tree/core/treeNodeKernel.d.ts +5 -0
  501. package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  502. package/lib/simple-tree/core/treeNodeKernel.js +60 -23
  503. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
  504. package/lib/simple-tree/simpleSchemaFormatV1.d.ts +121 -120
  505. package/lib/simple-tree/simpleSchemaFormatV1.d.ts.map +1 -1
  506. package/lib/simple-tree/simpleSchemaFormatV1.js +1 -1
  507. package/lib/simple-tree/simpleSchemaFormatV1.js.map +1 -1
  508. package/lib/text/codePointUtils.d.ts +48 -0
  509. package/lib/text/codePointUtils.d.ts.map +1 -0
  510. package/lib/text/codePointUtils.js +75 -0
  511. package/lib/text/codePointUtils.js.map +1 -0
  512. package/lib/text/index.d.ts +1 -0
  513. package/lib/text/index.d.ts.map +1 -1
  514. package/lib/text/index.js +1 -0
  515. package/lib/text/index.js.map +1 -1
  516. package/lib/text/textDomain.d.ts +93 -1
  517. package/lib/text/textDomain.d.ts.map +1 -1
  518. package/lib/text/textDomain.js +56 -0
  519. package/lib/text/textDomain.js.map +1 -1
  520. package/lib/text/textDomainFormatted.d.ts +24 -6
  521. package/lib/text/textDomainFormatted.d.ts.map +1 -1
  522. package/lib/text/textDomainFormatted.js +30 -2
  523. package/lib/text/textDomainFormatted.js.map +1 -1
  524. package/lib/treeFactory.d.ts.map +1 -1
  525. package/lib/treeFactory.js +2 -0
  526. package/lib/treeFactory.js.map +1 -1
  527. package/lib/util/breakable.d.ts +7 -1
  528. package/lib/util/breakable.d.ts.map +1 -1
  529. package/lib/util/breakable.js +18 -4
  530. package/lib/util/breakable.js.map +1 -1
  531. package/lib/util/typeboxBrand.d.ts +1 -1
  532. package/lib/util/typeboxBrand.d.ts.map +1 -1
  533. package/lib/util/typeboxBrand.js +1 -1
  534. package/lib/util/typeboxBrand.js.map +1 -1
  535. package/lib/util/utils.d.ts +2 -2
  536. package/lib/util/utils.d.ts.map +1 -1
  537. package/lib/util/utils.js +1 -1
  538. package/lib/util/utils.js.map +1 -1
  539. package/package.json +24 -24
  540. package/src/codec/codec.ts +82 -73
  541. package/src/codec/index.ts +2 -1
  542. package/src/codec/versioned/codec.ts +173 -73
  543. package/src/codec/versioned/format.ts +2 -1
  544. package/src/codec/versioned/index.ts +2 -1
  545. package/src/core/rebase/types.ts +1 -1
  546. package/src/core/schema-stored/formatV1.ts +2 -1
  547. package/src/core/schema-stored/formatV2.ts +2 -1
  548. package/src/core/tree/deltaUtil.ts +2 -2
  549. package/src/core/tree/detachedFieldIndexCodecV1.ts +3 -2
  550. package/src/core/tree/detachedFieldIndexCodecV2.ts +5 -3
  551. package/src/core/tree/detachedFieldIndexCodecs.ts +2 -2
  552. package/src/core/tree/detachedFieldIndexFormatCommon.ts +2 -1
  553. package/src/core/tree/detachedFieldIndexFormatV2.ts +2 -1
  554. package/src/core/tree/persistedTreeTextFormat.ts +2 -1
  555. package/src/feature-libraries/chunked-forest/chunkTree.ts +88 -3
  556. package/src/feature-libraries/chunked-forest/chunkedForest.ts +27 -7
  557. package/src/feature-libraries/chunked-forest/codec/chunkDecoding.ts +143 -7
  558. package/src/feature-libraries/chunked-forest/codec/codecs.ts +30 -28
  559. package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +7 -7
  560. package/src/feature-libraries/chunked-forest/codec/format/formatGeneric.ts +2 -1
  561. package/src/feature-libraries/chunked-forest/codec/format/formatV1.ts +2 -1
  562. package/src/feature-libraries/chunked-forest/codec/format/formatV2.ts +13 -8
  563. package/src/feature-libraries/chunked-forest/codec/format/formatVText.ts +84 -0
  564. package/src/feature-libraries/chunked-forest/codec/format/index.ts +6 -1
  565. package/src/feature-libraries/chunked-forest/codec/format/versions.ts +25 -4
  566. package/src/feature-libraries/chunked-forest/codec/nodeEncoder.ts +14 -18
  567. package/src/feature-libraries/chunked-forest/uniformChunk.ts +131 -44
  568. package/src/feature-libraries/default-schema/defaultEditBuilder.ts +36 -14
  569. package/src/feature-libraries/forest-summary/codec.ts +9 -4
  570. package/src/feature-libraries/forest-summary/formatCommon.ts +2 -1
  571. package/src/feature-libraries/modular-schema/genericFieldKindFormat.ts +2 -1
  572. package/src/feature-libraries/modular-schema/modularChangeFormatV1.ts +2 -1
  573. package/src/feature-libraries/modular-schema/modularChangeFormatV2.ts +2 -1
  574. package/src/feature-libraries/modular-schema/modularChangeTypes.ts +1 -1
  575. package/src/feature-libraries/optional-field/optionalFieldChangeFormatV1.ts +2 -1
  576. package/src/feature-libraries/optional-field/optionalFieldChangeFormatV2.ts +2 -1
  577. package/src/feature-libraries/schema-edits/schemaChangeFormat.ts +2 -1
  578. package/src/feature-libraries/schema-index/codec.ts +2 -5
  579. package/src/feature-libraries/schema-index/formatV1.ts +2 -1
  580. package/src/feature-libraries/schema-index/formatV2.ts +2 -1
  581. package/src/feature-libraries/sequence-field/compose.ts +1 -4
  582. package/src/feature-libraries/sequence-field/formatV1.ts +2 -1
  583. package/src/feature-libraries/sequence-field/formatV2.ts +2 -1
  584. package/src/feature-libraries/sequence-field/formatV3.ts +2 -1
  585. package/src/index.ts +6 -1
  586. package/src/packageVersion.ts +1 -1
  587. package/src/shared-tree/isAuditableFromOutcome.ts +34 -0
  588. package/src/shared-tree/sharedTree.ts +2 -5
  589. package/src/shared-tree/sharedTreeChangeFormat.ts +2 -1
  590. package/src/shared-tree/treeCheckout.ts +55 -15
  591. package/src/shared-tree-core/editManager.ts +2 -2
  592. package/src/shared-tree-core/editManagerCodecs.ts +4 -6
  593. package/src/shared-tree-core/editManagerFormatCommons.ts +2 -1
  594. package/src/shared-tree-core/editManagerFormatV1toV4.ts +2 -1
  595. package/src/shared-tree-core/editManagerFormatVSharedBranches.ts +2 -1
  596. package/src/shared-tree-core/messageCodecVSharedBranches.ts +2 -1
  597. package/src/shared-tree-core/messageCodecs.ts +4 -4
  598. package/src/shared-tree-core/messageFormatV1ToV4.ts +2 -1
  599. package/src/shared-tree-core/messageFormatVSharedBranches.ts +2 -1
  600. package/src/simple-tree/core/treeNodeKernel.ts +66 -28
  601. package/src/simple-tree/simpleSchemaFormatV1.ts +2 -1
  602. package/src/text/codePointUtils.ts +81 -0
  603. package/src/text/index.ts +1 -0
  604. package/src/text/textDomain.ts +155 -2
  605. package/src/text/textDomainFormatted.ts +73 -2
  606. package/src/treeFactory.ts +5 -0
  607. package/src/util/breakable.ts +27 -6
  608. package/src/util/typeboxBrand.ts +2 -1
  609. package/src/util/utils.ts +2 -1
@@ -25,7 +25,7 @@ import {
25
25
  type SchemaAndPolicy,
26
26
  type SchemaPolicy,
27
27
  } from "../../core/index.js";
28
- import { getOrCreate } from "../../util/index.js";
28
+ import { assertNonNegativeSafeInteger, getOrCreate } from "../../util/index.js";
29
29
  import { isStableNodeIdentifier } from "../node-identifier/index.js";
30
30
 
31
31
  import { BasicChunk } from "./basicChunk.js";
@@ -53,6 +53,7 @@ export function makeTreeChunker(
53
53
  defaultChunkPolicy.sequenceChunkInlineThreshold,
54
54
  defaultChunkPolicy.sequenceChunkInlineThreshold,
55
55
  defaultChunkPolicy.uniformChunkNodeCount,
56
+ defaultChunkPolicy.uniformChunkNodeCountDynamicTargetMax,
56
57
  (type: TreeNodeSchemaIdentifier, shapes: Map<TreeNodeSchemaIdentifier, ShapeInfo>) =>
57
58
  tryShapeFromNodeSchema(
58
59
  {
@@ -117,6 +118,7 @@ export class Chunker implements IChunker {
117
118
  public readonly sequenceChunkSplitThreshold: number,
118
119
  public readonly sequenceChunkInlineThreshold: number,
119
120
  public readonly uniformChunkNodeCount: number,
121
+ public readonly uniformChunkNodeCountDynamicTargetMax: number,
120
122
  // eslint-disable-next-line @typescript-eslint/no-shadow
121
123
  private readonly tryShapeFromNodeSchema: (
122
124
  type: TreeNodeSchemaIdentifier,
@@ -133,6 +135,7 @@ export class Chunker implements IChunker {
133
135
  this.sequenceChunkSplitThreshold,
134
136
  this.sequenceChunkInlineThreshold,
135
137
  this.uniformChunkNodeCount,
138
+ this.uniformChunkNodeCountDynamicTargetMax,
136
139
  this.tryShapeFromNodeSchema,
137
140
  );
138
141
  }
@@ -379,6 +382,7 @@ export const defaultChunkPolicy: ChunkPolicy = {
379
382
  sequenceChunkInlineThreshold: Number.POSITIVE_INFINITY,
380
383
  // Current UniformChunk handling doesn't scale well to large chunks, so set a modest size limit:
381
384
  uniformChunkNodeCount: 400,
385
+ uniformChunkNodeCountDynamicTargetMax: 25,
382
386
  // Without knowing what the schema is, all shapes are possible.
383
387
  // Use `makeTreeChunker` to do better.
384
388
  shapeFromSchema: () => polymorphic,
@@ -388,6 +392,7 @@ export const basicOnlyChunkPolicy: ChunkPolicy = {
388
392
  sequenceChunkSplitThreshold: Number.POSITIVE_INFINITY,
389
393
  sequenceChunkInlineThreshold: Number.POSITIVE_INFINITY,
390
394
  uniformChunkNodeCount: 0,
395
+ uniformChunkNodeCountDynamicTargetMax: 0,
391
396
  shapeFromSchema: () => polymorphic,
392
397
  };
393
398
 
@@ -413,6 +418,24 @@ export interface ChunkPolicy {
413
418
  */
414
419
  readonly uniformChunkNodeCount: number;
415
420
 
421
+ /**
422
+ * Target maximum top level length for a UniformChunk while a field is being edited.
423
+ *
424
+ * @remarks
425
+ * When {@link splitFieldAtIndex} has to split a chunk to land an attach/detach on a chunk
426
+ * boundary, chunks whose {@link TreeChunk.topLevelLength} exceeds this value are bisected
427
+ * recursively until each piece is at or below it, and only the piece holding the target index
428
+ * is split exactly. This bounds N splits inside an M-sized chunk at the cost of producing a
429
+ * few extra intermediate chunks.
430
+ *
431
+ * Future merge/extend logic for adjacent small chunks could use the same value as the
432
+ * upper bound it tries to stay under, so dynamic chunk sizes settle around this target.
433
+ *
434
+ * Independent of {@link ChunkPolicy.uniformChunkNodeCount}, which only bounds the size of
435
+ * chunks produced by the initial chunking pass.
436
+ */
437
+ readonly uniformChunkNodeCountDynamicTargetMax: number;
438
+
416
439
  /**
417
440
  * Returns information about the shapes trees of type `schema` can take.
418
441
  */
@@ -507,8 +530,9 @@ export function chunkRange(
507
530
  const shape = chunkCompressor.policy.shapeFromSchema(type);
508
531
  if (shape instanceof TreeShape) {
509
532
  const nodesPerTopLevelNode = shape.positions.length;
510
- const maxTopLevelLength = Math.ceil(
511
- nodesPerTopLevelNode / chunkCompressor.policy.uniformChunkNodeCount,
533
+ const maxTopLevelLength = Math.max(
534
+ 1,
535
+ Math.floor(chunkCompressor.policy.uniformChunkNodeCount / nodesPerTopLevelNode),
512
536
  );
513
537
  const maxLength = Math.min(maxTopLevelLength, remaining);
514
538
  const newChunk = uniformChunkFromCursor(
@@ -556,6 +580,67 @@ export function chunkRange(
556
580
 
557
581
  return output;
558
582
  }
583
+
584
+ /**
585
+ * Walks the `chunks` array of a field and splits a chunk if needed so that `nodeIndex` sits on
586
+ * a chunk boundary. After the call, inserting a chunk at the returned index would place its
587
+ * first top-level node at index `nodeIndex` when treating `chunks` as a field.
588
+ *
589
+ * @remarks
590
+ * When splitting chunks, large chunks are split evenly so that repeated calls to this method (or similar operations)
591
+ * avoid poor worst-case behavior. See {@link ChunkPolicy.uniformChunkNodeCountDynamicTargetMax} for details.
592
+ *
593
+ * @param chunks - The array of {@link TreeChunk}s for the field to split. Mutated in place.
594
+ * @param nodeIndex - The index to split at, measured in top-level nodes within the field.
595
+ * Must be in `[0, totalNodes]`, where `totalNodes` is the sum of {@link TreeChunk.topLevelLength}
596
+ * across all chunks.
597
+ * @param policy - The {@link ChunkCompressor} to use when splitting chunks and re-chunking each side
598
+ * of the split via {@link chunkRange}.
599
+ *
600
+ * @returns The index in `chunks` (after modifications made by this function) where if a chunk were inserted at that index its first top level node would have index `nodeIndex` when treating `chunks` as a field.
601
+ */
602
+ export function splitFieldAtIndex(
603
+ chunks: TreeChunk[],
604
+ nodeIndex: number,
605
+ policy: ChunkCompressor,
606
+ ): number {
607
+ assertNonNegativeSafeInteger(nodeIndex);
608
+ const bisectThreshold = policy.policy.uniformChunkNodeCountDynamicTargetMax;
609
+ let remaining = nodeIndex;
610
+ let chunkIndex = 0;
611
+ while (chunkIndex < chunks.length) {
612
+ if (remaining === 0) {
613
+ return chunkIndex;
614
+ }
615
+ const chunk = chunks[chunkIndex] ?? oob();
616
+ const total = chunk.topLevelLength;
617
+ if (remaining >= total) {
618
+ // nodeIndex is not in this chunk, so move forward one chunk and continue.
619
+ remaining -= total;
620
+ chunkIndex++;
621
+ continue;
622
+ }
623
+
624
+ // nodeIndex falls within this chunk, so split the chunk.
625
+ // This does not move the chunkIndex forward: the next iteration might need to split again at the same index.
626
+ //
627
+ // For chunks above the bisect threshold, cut at the midpoint and let the loop descend
628
+ // into whichever half holds nodeIndex. The other half is left untouched.
629
+ const splitPoint = total > bisectThreshold ? Math.floor(total / 2) : remaining;
630
+ const cursor = chunk.cursor();
631
+ cursor.firstNode();
632
+ const before = chunkRange(cursor, policy, splitPoint, false);
633
+ const after = chunkRange(cursor, policy, total - splitPoint, true);
634
+ // TODO: this could fail for really long chunks being split (due to argument count limits).
635
+ chunks.splice(chunkIndex, 1, ...before, ...after);
636
+ // The spliced-out slot held a ref to the original chunk. The two new chunks come with
637
+ // their own refs from chunkRange, so the slot's ref to the original needs to be released.
638
+ chunk.referenceRemoved();
639
+ }
640
+ assert(remaining === 0, 0xcf9 /* nodeIndex exceeds total node count in field */);
641
+ return chunks.length;
642
+ }
643
+
559
644
  /**
560
645
  * Extracts values from the current cursor position according to the provided tree shape.
561
646
  *
@@ -36,7 +36,6 @@ import {
36
36
  type DeltaDetachedNodeId,
37
37
  } from "../../core/index.js";
38
38
  import {
39
- assertValidRange,
40
39
  brand,
41
40
  getLast,
42
41
  getOrAddEmptyToMap,
@@ -45,7 +44,14 @@ import {
45
44
  } from "../../util/index.js";
46
45
 
47
46
  import { BasicChunk, BasicChunkCursor, type SiblingsOrKey } from "./basicChunk.js";
48
- import { type IChunker, basicChunkTree, chunkField, chunkTree } from "./chunkTree.js";
47
+ import {
48
+ type ChunkCompressor,
49
+ type IChunker,
50
+ basicChunkTree,
51
+ chunkField,
52
+ chunkTree,
53
+ splitFieldAtIndex,
54
+ } from "./chunkTree.js";
49
55
 
50
56
  function makeRoot(): BasicChunk {
51
57
  return new BasicChunk(aboveRootPlaceholder, new Map());
@@ -173,8 +179,12 @@ export class ChunkedForest implements IEditableForest {
173
179
 
174
180
  const parent = this.getParent();
175
181
  const destinationField = getOrAddEmptyToMap(parent.mutableChunk.fields, parent.key);
182
+ const destinationChunkIndex = splitFieldAtIndex(destinationField, destination, {
183
+ policy: this.forest.chunker,
184
+ idCompressor: this.forest.idCompressor,
185
+ });
176
186
  // TODO: this will fail for very large moves due to argument limits.
177
- destinationField.splice(destination, 0, ...sourceField);
187
+ destinationField.splice(destinationChunkIndex, 0, ...sourceField);
178
188
  },
179
189
  /**
180
190
  * Detaches the range from the current field and transfers it to the given destination if any.
@@ -193,9 +203,19 @@ export class ChunkedForest implements IEditableForest {
193
203
  this.forest.#events.emit("beforeChange");
194
204
  const parent = this.getParent();
195
205
  const sourceField = parent.mutableChunk.fields.get(parent.key) ?? [];
196
-
197
- assertValidRange(source, sourceField);
198
- const newField = sourceField.splice(source.start, source.end - source.start);
206
+ assert(source.start <= source.end, 0xcf8 /* detach range start must not exceed end */);
207
+
208
+ const policy: ChunkCompressor = {
209
+ policy: this.forest.chunker,
210
+ idCompressor: this.forest.idCompressor,
211
+ };
212
+ // Split start first: splitting end later only expands chunks at positions >= startChunkIndex,
213
+ // which leaves startChunkIndex valid. The reverse order would shift endChunkIndex when
214
+ // source.start and source.end land in different chunks.
215
+ // Performance: It's practical to have a variant of splitFieldAtIndex which can split at multiple locations in a single pass if the performance of this becomes worth optimizing.
216
+ const startChunkIndex = splitFieldAtIndex(sourceField, source.start, policy);
217
+ const endChunkIndex = splitFieldAtIndex(sourceField, source.end, policy);
218
+ const newField = sourceField.splice(startChunkIndex, endChunkIndex - startChunkIndex);
199
219
 
200
220
  if (destination === undefined) {
201
221
  for (const child of newField) {
@@ -225,12 +245,12 @@ export class ChunkedForest implements IEditableForest {
225
245
  let indexOfChunk = 0;
226
246
  let chunk = chunks[indexOfChunk] ?? oob();
227
247
  while (indexWithinChunk >= chunk.topLevelLength) {
228
- chunk = chunks[indexOfChunk] ?? oob();
229
248
  indexWithinChunk -= chunk.topLevelLength;
230
249
  indexOfChunk++;
231
250
  if (indexOfChunk === chunks.length) {
232
251
  fail(0xaf7 /* missing edited node */);
233
252
  }
253
+ chunk = chunks[indexOfChunk] ?? oob();
234
254
  }
235
255
  let found = chunks[indexOfChunk] ?? oob();
236
256
  if (!(found instanceof BasicChunk)) {
@@ -9,6 +9,7 @@ import type {
9
9
  OpSpaceCompressedId,
10
10
  SessionId,
11
11
  } from "@fluidframework/id-compressor";
12
+ import { isFinalId } from "@fluidframework/id-compressor/internal";
12
13
  import { v5 as uuidV5 } from "uuid";
13
14
 
14
15
  import { DiscriminatedUnionDispatcher } from "../../../codec/index.js";
@@ -42,7 +43,7 @@ import {
42
43
  import type { FieldBatchEncodingContext, IncrementalDecoder } from "./codecs.js";
43
44
  import {
44
45
  type EncodedAnyShape,
45
- type EncodedChunkShapeV1OrV2,
46
+ type EncodedChunkShape,
46
47
  type EncodedChunkShapeV2,
47
48
  type EncodedFieldBatchV1OrV2,
48
49
  type EncodedFieldBatchV2,
@@ -50,7 +51,9 @@ import {
50
51
  type EncodedInlineArrayShape,
51
52
  type EncodedNestedArrayShape,
52
53
  type EncodedNodeShape,
54
+ type EncodedSpecializedNodeShape,
53
55
  type EncodedValueShape,
56
+ type ShapeIndex,
54
57
  SpecialField,
55
58
  supportsIncrementalEncoding,
56
59
  } from "./format/index.js";
@@ -97,9 +100,137 @@ export function decode(
97
100
  );
98
101
  }
99
102
 
103
+ /**
104
+ * Resolves `shapeIndex` to a fully-resolved {@link EncodedNodeShape}, normalizing away any
105
+ * specialized node shapes (`f`) along the way by applying their overlays via
106
+ * {@link applySpecialization} until a concrete node shape is reached.
107
+ *
108
+ * @param input - The index of the shape to resolve, which must be a concrete or specialized node shape.
109
+ * @param context - The decoding context containing the shape definitions.
110
+ * @param pendingResolution - (Internal) A set of shape indices visited so far in the current resolution chain, used to detect cycles in the specialization chain. Most callers should not provide this argument.
111
+ *
112
+ * @remarks
113
+ * Exported for testing.
114
+ */
115
+ export function normalizeToNodeShape(
116
+ input: EncodedNodeShape | EncodedSpecializedNodeShape,
117
+ context: DecoderContext<EncodedChunkShape>,
118
+ pendingResolution: Set<ShapeIndex> = new Set(),
119
+ ): EncodedNodeShape {
120
+ if (!("base" in input)) {
121
+ return input;
122
+ }
123
+
124
+ const baseIndex = input.base;
125
+ assert(!pendingResolution.has(baseIndex), 0xcfb /* cyclic specialized node shape chain */);
126
+ pendingResolution.add(baseIndex);
127
+ const encoded = context.shapes[baseIndex];
128
+ assert(encoded !== undefined, 0xcfc /* shape index out of bounds */);
129
+
130
+ const baseShape = encoded.c ?? ("f" in encoded ? encoded.f : undefined);
131
+ assert(
132
+ baseShape !== undefined,
133
+ 0xcfd /* shape at index must be a concrete (c) or specialized (f) node shape */,
134
+ );
135
+
136
+ return applySpecialization(
137
+ normalizeToNodeShape(baseShape, context, pendingResolution),
138
+ input,
139
+ context,
140
+ );
141
+ }
142
+
143
+ /**
144
+ * Produces a specialized {@link EncodedNodeShape} by overlaying `overrides` onto `base`.
145
+ *
146
+ * See {@link EncodedSpecializedNodeShape} for the override/inherit/clear semantics.
147
+ *
148
+ * @remarks
149
+ * Exported for testing.
150
+ */
151
+ export function applySpecialization(
152
+ base: EncodedNodeShape,
153
+ overrides: EncodedSpecializedNodeShape,
154
+ context: DecoderContext<EncodedChunkShape>,
155
+ ): EncodedNodeShape {
156
+ const fields = [...(base.fields ?? [])];
157
+ const indexFromKey = new Map<FieldKey, number>();
158
+ for (const [i, [keyEncoded]] of fields.entries()) {
159
+ const key = context.identifier<FieldKey>(keyEncoded);
160
+ assert(!indexFromKey.has(key), 0xcfe /* duplicate field key in base node shape */);
161
+ indexFromKey.set(key, i);
162
+ }
163
+
164
+ // Replace fields in base with overrides, append new keys in overrides in the order they are specified.
165
+ const seenOverrideKeys = new Set<FieldKey>();
166
+ for (const [keyEncoded, shapeIndex] of overrides.fields ?? []) {
167
+ const key = context.identifier<FieldKey>(keyEncoded);
168
+ assert(
169
+ !seenOverrideKeys.has(key),
170
+ 0xcff /* duplicate field key in specialized node shape */,
171
+ );
172
+ seenOverrideKeys.add(key);
173
+ const existingIndex = indexFromKey.get(key);
174
+ if (existingIndex === undefined) {
175
+ fields.push([keyEncoded, shapeIndex]);
176
+ } else {
177
+ const index = fields[existingIndex];
178
+ assert(index !== undefined, 0xd00 /* expected existing field index */);
179
+ fields[existingIndex] = [index[0], shapeIndex];
180
+ }
181
+ }
182
+
183
+ return {
184
+ type: base.type,
185
+ value: resolveOverride(overrides.value, base.value),
186
+ fields: fields.length > 0 ? fields : undefined,
187
+ extraFields: resolveOverride(overrides.extraFields, base.extraFields),
188
+ };
189
+ }
190
+
191
+ /**
192
+ * Resolves an override against a base value.
193
+ *
194
+ * @param override - `undefined` means the override is absent (inherit from base); `null` is the
195
+ * explicit-clear sentinel needed because JSON.stringify drops `undefined`-valued properties, making
196
+ * property-presence indistinguishable from absent on the wire.
197
+ * @param baseValue - The value to inherit when the override is absent.
198
+ */
199
+ function resolveOverride<T>(
200
+ // eslint-disable-next-line @rushstack/no-new-null
201
+ override: T | null | undefined,
202
+ baseValue: T | undefined,
203
+ ): T | undefined {
204
+ if (override === undefined) {
205
+ return baseValue;
206
+ }
207
+ if (override === null) {
208
+ return undefined;
209
+ }
210
+ return override;
211
+ }
212
+
213
+ /**
214
+ * Decoder for {@link EncodedSpecializedNodeShape}s.
215
+ * Applies the specialization's field overrides to the resolved base node shape, then delegates
216
+ * to a {@link NodeDecoder} built from the resulting shape.
217
+ */
218
+ export class SpecializedNodeDecoder implements ChunkDecoder {
219
+ private readonly inner: NodeDecoder;
220
+ public constructor(
221
+ shape: EncodedSpecializedNodeShape,
222
+ context: DecoderContext<EncodedChunkShape>,
223
+ ) {
224
+ this.inner = new NodeDecoder(normalizeToNodeShape(shape, context), context);
225
+ }
226
+ public decode(decoders: readonly ChunkDecoder[], stream: StreamCursor): TreeChunk {
227
+ return this.inner.decode(decoders, stream);
228
+ }
229
+ }
230
+
100
231
  const decoderLibrary = new DiscriminatedUnionDispatcher<
101
- EncodedChunkShapeV1OrV2,
102
- [context: DecoderContext<EncodedChunkShapeV1OrV2>],
232
+ EncodedChunkShape,
233
+ [context: DecoderContext<EncodedChunkShape>],
103
234
  ChunkDecoder
104
235
  >({
105
236
  a(shape: EncodedNestedArrayShape, context): ChunkDecoder {
@@ -120,6 +251,9 @@ const decoderLibrary = new DiscriminatedUnionDispatcher<
120
251
  ): ChunkDecoder {
121
252
  return new IncrementalChunkDecoder(context);
122
253
  },
254
+ f(shape: EncodedSpecializedNodeShape, context): ChunkDecoder {
255
+ return new SpecializedNodeDecoder(shape, context);
256
+ },
123
257
  });
124
258
 
125
259
  /**
@@ -153,8 +287,10 @@ export function readValue(
153
287
  const idCompressor = idDecodingContext.idCompressor;
154
288
  // OpSpaceCompressedIds are negative, and require a session-id to compute their value.
155
289
  // Due to a bug, we have some special casing for them (see below).
156
- // TODO: isFinalId should probably be exported from id-compressor and that could be used to do the narrowing here.
157
- if (idDecodingContext.isSummary === true && streamValue < 0) {
290
+ if (
291
+ idDecodingContext.isSummary === true &&
292
+ !isFinalId(streamValue as OpSpaceCompressedId)
293
+ ) {
158
294
  if (
159
295
  idDecodingContext.healUnresolvableIdentifiersOnDecode === true &&
160
296
  idDecodingContext.sharedObjectId !== undefined
@@ -349,7 +485,7 @@ type BasicFieldDecoder = (
349
485
  * Get a decoder for fields of a provided (via `shape` and `context`).
350
486
  */
351
487
  function fieldDecoder(
352
- context: DecoderContext<EncodedChunkShapeV1OrV2>,
488
+ context: DecoderContext<EncodedChunkShape>,
353
489
  key: FieldKey,
354
490
  shape: number,
355
491
  ): BasicFieldDecoder {
@@ -368,7 +504,7 @@ export class NodeDecoder implements ChunkDecoder {
368
504
  private readonly fieldDecoders: readonly BasicFieldDecoder[];
369
505
  public constructor(
370
506
  private readonly shape: EncodedNodeShape,
371
- private readonly context: DecoderContext<EncodedChunkShapeV1OrV2>,
507
+ private readonly context: DecoderContext<EncodedChunkShape>,
372
508
  ) {
373
509
  this.type = shape.type === undefined ? undefined : context.identifier(shape.type);
374
510
 
@@ -9,8 +9,9 @@ import { lowestMinVersionForCollab } from "@fluidframework/runtime-utils/interna
9
9
  import type { TSchema } from "@sinclair/typebox";
10
10
 
11
11
  import {
12
- ClientVersionDispatchingCodecBuilder,
12
+ VersionDispatchingCodecBuilder,
13
13
  type CodecAndSchema,
14
+ type VersionDispatchingCodec,
14
15
  FluidClientVersion,
15
16
  } from "../../../codec/index.js";
16
17
  import {
@@ -138,7 +139,11 @@ export interface FieldBatchEncodingContext {
138
139
  * @remarks
139
140
  * Fields in this batch currently don't have field schema for the root, which limits optimizations.
140
141
  */
141
- export type FieldBatchCodec = ReturnType<typeof fieldBatchCodecBuilder.build>;
142
+ export type FieldBatchCodec = VersionDispatchingCodec<
143
+ FieldBatch,
144
+ FieldBatchEncodingContext,
145
+ FieldBatchFormatVersion
146
+ >;
142
147
 
143
148
  /**
144
149
  * Creates the encode/decode functions for a specific FieldBatch format version.
@@ -231,30 +236,27 @@ function makeFieldBatchCodecForVersion(
231
236
  }
232
237
 
233
238
  /**
234
- * {@link ClientVersionDispatchingCodecBuilder} for field batch codecs.
239
+ * {@link VersionDispatchingCodecBuilder} for field batch codecs.
235
240
  */
236
- export const fieldBatchCodecBuilder = ClientVersionDispatchingCodecBuilder.build(
237
- "FieldBatch",
238
- [
239
- {
240
- minVersionForCollab: lowestMinVersionForCollab,
241
- formatVersion: FieldBatchFormatVersion.v1,
242
- codec: makeFieldBatchCodecForVersion(
243
- FieldBatchFormatVersion.v1,
244
- uncompressedEncodeV1,
245
- schemaCompressedEncodeV1,
246
- EncodedFieldBatchV1,
247
- ),
248
- },
249
- {
250
- minVersionForCollab: FluidClientVersion.v2_73,
251
- formatVersion: FieldBatchFormatVersion.v2,
252
- codec: makeFieldBatchCodecForVersion(
253
- FieldBatchFormatVersion.v2,
254
- uncompressedEncodeV2,
255
- schemaCompressedEncodeV2,
256
- EncodedFieldBatchV2,
257
- ),
258
- },
259
- ],
260
- );
241
+ export const fieldBatchCodecBuilder = VersionDispatchingCodecBuilder.build("FieldBatch", [
242
+ {
243
+ minVersionForCollab: lowestMinVersionForCollab,
244
+ formatVersion: FieldBatchFormatVersion.v1,
245
+ codec: makeFieldBatchCodecForVersion(
246
+ FieldBatchFormatVersion.v1,
247
+ uncompressedEncodeV1,
248
+ schemaCompressedEncodeV1,
249
+ EncodedFieldBatchV1,
250
+ ),
251
+ },
252
+ {
253
+ minVersionForCollab: FluidClientVersion.v2_73,
254
+ formatVersion: FieldBatchFormatVersion.v2,
255
+ codec: makeFieldBatchCodecForVersion(
256
+ FieldBatchFormatVersion.v2,
257
+ uncompressedEncodeV2,
258
+ schemaCompressedEncodeV2,
259
+ EncodedFieldBatchV2,
260
+ ),
261
+ },
262
+ ]);
@@ -32,7 +32,7 @@ import type { FieldBatch } from "./fieldBatch.js";
32
32
  import {
33
33
  type EncodedAnyShape,
34
34
  type EncodedChunkShapeV1,
35
- type EncodedChunkShapeV1OrV2,
35
+ type EncodedChunkShape,
36
36
  type EncodedChunkShapeV2,
37
37
  type EncodedFieldBatchV1OrV2,
38
38
  type EncodedNestedArrayShape,
@@ -64,8 +64,8 @@ export function compressedEncode(
64
64
  return updateShapesAndIdentifiersEncoding(context.version, batchBuffer);
65
65
  }
66
66
 
67
- export type BufferFormat = BufferFormatGeneric<EncodedChunkShapeV1OrV2>;
68
- export type Shape = ShapeGeneric<EncodedChunkShapeV1OrV2>;
67
+ export type BufferFormat = BufferFormatGeneric<EncodedChunkShape>;
68
+ export type Shape = ShapeGeneric<EncodedChunkShape>;
69
69
 
70
70
  /**
71
71
  * Like {@link FieldEncoder}, except data will be prefixed with the key.
@@ -167,7 +167,7 @@ export function asNodesEncoder(encoder: NodeEncoder): NodesEncoder {
167
167
  /**
168
168
  * Encodes a chunk with {@link EncodedAnyShape} by prefixing the data with its shape.
169
169
  */
170
- export class AnyShape extends ShapeGeneric<EncodedChunkShapeV1OrV2> {
170
+ export class AnyShape extends ShapeGeneric<EncodedChunkShape> {
171
171
  private constructor() {
172
172
  super();
173
173
  }
@@ -272,7 +272,7 @@ export const anyFieldEncoder: FieldEncoder = {
272
272
  * which is an easy way to keep all the related code together without extra objects.
273
273
  */
274
274
  export class InlineArrayEncoder
275
- extends ShapeGeneric<EncodedChunkShapeV1OrV2>
275
+ extends ShapeGeneric<EncodedChunkShape>
276
276
  implements NodesEncoder, FieldEncoder
277
277
  {
278
278
  public static readonly empty: InlineArrayEncoder = new InlineArrayEncoder(0, {
@@ -356,7 +356,7 @@ export class InlineArrayEncoder
356
356
  /**
357
357
  * Encodes the shape for a nested array as {@link EncodedNestedArrayShape} shape.
358
358
  */
359
- export class NestedArrayShape extends ShapeGeneric<EncodedChunkShapeV1OrV2> {
359
+ export class NestedArrayShape extends ShapeGeneric<EncodedChunkShape> {
360
360
  /**
361
361
  * @param innerShape - The shape of each item in this nested array.
362
362
  */
@@ -367,7 +367,7 @@ export class NestedArrayShape extends ShapeGeneric<EncodedChunkShapeV1OrV2> {
367
367
  public encodeShape(
368
368
  identifiers: DeduplicationTable<string>,
369
369
  shapes: DeduplicationTable<Shape>,
370
- ): EncodedChunkShapeV1OrV2 {
370
+ ): EncodedChunkShape {
371
371
  const shape: EncodedNestedArrayShape =
372
372
  shapes.valueToIndex.get(this.innerShape) ??
373
373
  fail(0xb4f /* index for shape not found in table */);
@@ -3,7 +3,8 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { type Static, type TSchema, Type } from "@sinclair/typebox";
6
+ import * as Type from "@sinclair/typebox";
7
+ import type { Static, TSchema } from "@sinclair/typebox";
7
8
 
8
9
  import type { FieldBatchFormatVersion } from "./versions.js";
9
10
 
@@ -3,7 +3,8 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { type Static, Type } from "@sinclair/typebox";
6
+ import * as Type from "@sinclair/typebox";
7
+ import type { Static } from "@sinclair/typebox";
7
8
 
8
9
  import { unionOptions } from "../../../../codec/index.js";
9
10
 
@@ -3,7 +3,8 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { type Static, Type } from "@sinclair/typebox";
6
+ import * as Type from "@sinclair/typebox";
7
+ import type { Static } from "@sinclair/typebox";
7
8
 
8
9
  import { unionOptions } from "../../../../codec/index.js";
9
10
 
@@ -16,16 +17,20 @@ import { shapesV1 } from "./formatV1.js";
16
17
  export type EncodedIncrementalChunkShape = Static<typeof EncodedIncrementalChunkShape>;
17
18
  export const EncodedIncrementalChunkShape = Type.Literal(0);
18
19
 
20
+ /**
21
+ * The chunk shapes supported by the V2 format.
22
+ * @remarks
23
+ * See {@link EncodedChunkShapeV2}.
24
+ */
25
+ export const shapesV2 = {
26
+ ...shapesV1,
27
+ e: Type.Optional(EncodedIncrementalChunkShape),
28
+ } as const;
29
+
19
30
  /**
20
31
  * V2 extension of {@link EncodedChunkShapeV1}.
21
32
  * @remarks
22
33
  * See {@link DiscriminatedUnionDispatcher} for more information on this pattern.
23
34
  */
24
35
  export type EncodedChunkShapeV2 = Static<typeof EncodedChunkShapeV2>;
25
- export const EncodedChunkShapeV2 = Type.Object(
26
- {
27
- ...shapesV1,
28
- e: Type.Optional(EncodedIncrementalChunkShape),
29
- },
30
- unionOptions,
31
- );
36
+ export const EncodedChunkShapeV2 = Type.Object(shapesV2, unionOptions);