@fluidframework/tree 2.91.0 → 2.92.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 (866) hide show
  1. package/CHANGELOG.md +118 -0
  2. package/api-report/tree.alpha.api.md +60 -22
  3. package/dist/api.d.ts +6 -1
  4. package/dist/api.d.ts.map +1 -1
  5. package/dist/api.js.map +1 -1
  6. package/dist/codec/codec.d.ts +28 -2
  7. package/dist/codec/codec.d.ts.map +1 -1
  8. package/dist/codec/codec.js +1 -0
  9. package/dist/codec/codec.js.map +1 -1
  10. package/dist/codec/index.d.ts +2 -2
  11. package/dist/codec/index.d.ts.map +1 -1
  12. package/dist/codec/index.js +2 -4
  13. package/dist/codec/index.js.map +1 -1
  14. package/dist/codec/versioned/codec.d.ts +18 -36
  15. package/dist/codec/versioned/codec.d.ts.map +1 -1
  16. package/dist/codec/versioned/codec.js +46 -59
  17. package/dist/codec/versioned/codec.js.map +1 -1
  18. package/dist/codec/versioned/index.d.ts +1 -1
  19. package/dist/codec/versioned/index.d.ts.map +1 -1
  20. package/dist/codec/versioned/index.js +2 -4
  21. package/dist/codec/versioned/index.js.map +1 -1
  22. package/dist/core/forest/forest.d.ts +5 -2
  23. package/dist/core/forest/forest.d.ts.map +1 -1
  24. package/dist/core/forest/forest.js.map +1 -1
  25. package/dist/core/index.d.ts +1 -1
  26. package/dist/core/index.d.ts.map +1 -1
  27. package/dist/core/index.js +6 -2
  28. package/dist/core/index.js.map +1 -1
  29. package/dist/core/rebase/changeRebaser.d.ts +8 -1
  30. package/dist/core/rebase/changeRebaser.d.ts.map +1 -1
  31. package/dist/core/rebase/changeRebaser.js.map +1 -1
  32. package/dist/core/rebase/revisionTagCodec.d.ts +4 -3
  33. package/dist/core/rebase/revisionTagCodec.d.ts.map +1 -1
  34. package/dist/core/rebase/revisionTagCodec.js +2 -0
  35. package/dist/core/rebase/revisionTagCodec.js.map +1 -1
  36. package/dist/core/rebase/utils.d.ts +2 -2
  37. package/dist/core/rebase/utils.d.ts.map +1 -1
  38. package/dist/core/rebase/utils.js +4 -4
  39. package/dist/core/rebase/utils.js.map +1 -1
  40. package/dist/core/schema-stored/formatV2.d.ts +1 -1
  41. package/dist/core/schema-stored/formatV2.js +1 -1
  42. package/dist/core/schema-stored/formatV2.js.map +1 -1
  43. package/dist/core/tree/anchorSet.d.ts +8 -0
  44. package/dist/core/tree/anchorSet.d.ts.map +1 -1
  45. package/dist/core/tree/anchorSet.js +42 -7
  46. package/dist/core/tree/anchorSet.js.map +1 -1
  47. package/dist/core/tree/cursor.d.ts +25 -1
  48. package/dist/core/tree/cursor.d.ts.map +1 -1
  49. package/dist/core/tree/cursor.js +45 -1
  50. package/dist/core/tree/cursor.js.map +1 -1
  51. package/dist/core/tree/deltaUtil.d.ts +13 -1
  52. package/dist/core/tree/deltaUtil.d.ts.map +1 -1
  53. package/dist/core/tree/deltaUtil.js +34 -1
  54. package/dist/core/tree/deltaUtil.js.map +1 -1
  55. package/dist/core/tree/detachedFieldIndexCodecs.d.ts +5 -5
  56. package/dist/core/tree/detachedFieldIndexCodecs.d.ts.map +1 -1
  57. package/dist/core/tree/detachedFieldIndexCodecs.js.map +1 -1
  58. package/dist/core/tree/index.d.ts +2 -2
  59. package/dist/core/tree/index.d.ts.map +1 -1
  60. package/dist/core/tree/index.js +6 -2
  61. package/dist/core/tree/index.js.map +1 -1
  62. package/dist/core/tree/visitDelta.d.ts +11 -0
  63. package/dist/core/tree/visitDelta.d.ts.map +1 -1
  64. package/dist/core/tree/visitDelta.js +1 -1
  65. package/dist/core/tree/visitDelta.js.map +1 -1
  66. package/dist/core/tree/visitorUtils.d.ts.map +1 -1
  67. package/dist/core/tree/visitorUtils.js +5 -0
  68. package/dist/core/tree/visitorUtils.js.map +1 -1
  69. package/dist/entrypoints/alpha.d.ts +1 -1
  70. package/dist/entrypoints/alpha.d.ts.map +1 -1
  71. package/dist/entrypoints/alpha.js +2 -3
  72. package/dist/entrypoints/alpha.js.map +1 -1
  73. package/dist/entrypoints/beta.js +1 -1
  74. package/dist/entrypoints/beta.js.map +1 -1
  75. package/dist/entrypoints/legacy.d.ts +1 -1
  76. package/dist/entrypoints/legacy.d.ts.map +1 -1
  77. package/dist/entrypoints/legacy.js +1 -1
  78. package/dist/entrypoints/legacy.js.map +1 -1
  79. package/dist/entrypoints/public.js +1 -1
  80. package/dist/entrypoints/public.js.map +1 -1
  81. package/dist/feature-libraries/changeAtomIdCodec.d.ts +4 -3
  82. package/dist/feature-libraries/changeAtomIdCodec.d.ts.map +1 -1
  83. package/dist/feature-libraries/changeAtomIdCodec.js +2 -0
  84. package/dist/feature-libraries/changeAtomIdCodec.js.map +1 -1
  85. package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts +2 -1
  86. package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  87. package/dist/feature-libraries/chunked-forest/chunkedForest.js +2 -2
  88. package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  89. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +4 -4
  90. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  91. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js +6 -6
  92. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  93. package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts +1 -1
  94. package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts.map +1 -1
  95. package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
  96. package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts +1 -2
  97. package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts.map +1 -1
  98. package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
  99. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts +4 -4
  100. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  101. package/dist/feature-libraries/chunked-forest/codec/codecs.js +6 -6
  102. package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  103. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +12 -12
  104. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
  105. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +3 -3
  106. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  107. package/dist/feature-libraries/chunked-forest/codec/{formatGeneric.d.ts → format/formatGeneric.d.ts} +1 -1
  108. package/dist/feature-libraries/chunked-forest/codec/format/formatGeneric.d.ts.map +1 -0
  109. package/dist/feature-libraries/chunked-forest/codec/format/formatGeneric.js.map +1 -0
  110. package/dist/feature-libraries/chunked-forest/codec/format/formatV1.d.ts +187 -0
  111. package/dist/feature-libraries/chunked-forest/codec/format/formatV1.d.ts.map +1 -0
  112. package/dist/feature-libraries/chunked-forest/codec/format/formatV1.js +115 -0
  113. package/dist/feature-libraries/chunked-forest/codec/format/formatV1.js.map +1 -0
  114. package/dist/feature-libraries/chunked-forest/codec/format/formatV2.d.ts +33 -0
  115. package/dist/feature-libraries/chunked-forest/codec/format/formatV2.d.ts.map +1 -0
  116. package/dist/feature-libraries/chunked-forest/codec/format/formatV2.js +16 -0
  117. package/dist/feature-libraries/chunked-forest/codec/format/formatV2.js.map +1 -0
  118. package/dist/feature-libraries/chunked-forest/codec/format/index.d.ts +10 -0
  119. package/dist/feature-libraries/chunked-forest/codec/format/index.d.ts.map +1 -0
  120. package/dist/feature-libraries/chunked-forest/codec/format/index.js +18 -0
  121. package/dist/feature-libraries/chunked-forest/codec/format/index.js.map +1 -0
  122. package/dist/feature-libraries/chunked-forest/codec/format/versions.d.ts +93 -0
  123. package/dist/feature-libraries/chunked-forest/codec/format/versions.d.ts.map +1 -0
  124. package/dist/feature-libraries/chunked-forest/codec/format/versions.js +29 -0
  125. package/dist/feature-libraries/chunked-forest/codec/format/versions.js.map +1 -0
  126. package/dist/feature-libraries/chunked-forest/codec/index.d.ts +2 -2
  127. package/dist/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
  128. package/dist/feature-libraries/chunked-forest/codec/index.js +2 -2
  129. package/dist/feature-libraries/chunked-forest/codec/index.js.map +1 -1
  130. package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts +7 -7
  131. package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts.map +1 -1
  132. package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.js.map +1 -1
  133. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts +1 -1
  134. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -1
  135. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +6 -4
  136. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
  137. package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.d.ts +1 -1
  138. package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.d.ts.map +1 -1
  139. package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.js +3 -3
  140. package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.js.map +1 -1
  141. package/dist/feature-libraries/chunked-forest/index.d.ts +1 -1
  142. package/dist/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  143. package/dist/feature-libraries/chunked-forest/index.js.map +1 -1
  144. package/dist/feature-libraries/cursorComparator.d.ts +23 -0
  145. package/dist/feature-libraries/cursorComparator.d.ts.map +1 -0
  146. package/dist/feature-libraries/cursorComparator.js +65 -0
  147. package/dist/feature-libraries/cursorComparator.js.map +1 -0
  148. package/dist/feature-libraries/forest-summary/codec.d.ts +1 -1
  149. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts +3 -3
  150. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts.map +1 -1
  151. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -1
  152. package/dist/feature-libraries/index.d.ts +3 -2
  153. package/dist/feature-libraries/index.d.ts.map +1 -1
  154. package/dist/feature-libraries/index.js +5 -5
  155. package/dist/feature-libraries/index.js.map +1 -1
  156. package/dist/feature-libraries/indexing/anchorTreeIndex.d.ts +2 -0
  157. package/dist/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -1
  158. package/dist/feature-libraries/indexing/anchorTreeIndex.js +12 -7
  159. package/dist/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
  160. package/dist/feature-libraries/mitigatedChangeFamily.d.ts.map +1 -1
  161. package/dist/feature-libraries/mitigatedChangeFamily.js +2 -2
  162. package/dist/feature-libraries/mitigatedChangeFamily.js.map +1 -1
  163. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts +3 -3
  164. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  165. package/dist/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  166. package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  167. package/dist/feature-libraries/modular-schema/genericFieldKind.js +0 -1
  168. package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  169. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts +10 -10
  170. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -1
  171. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js +2 -4
  172. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
  173. package/dist/feature-libraries/modular-schema/modularChangeCodecV2.d.ts +3 -3
  174. package/dist/feature-libraries/modular-schema/modularChangeCodecV2.d.ts.map +1 -1
  175. package/dist/feature-libraries/modular-schema/modularChangeCodecV2.js.map +1 -1
  176. package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts +3 -3
  177. package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  178. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  179. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +1 -1
  180. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  181. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +4 -3
  182. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  183. package/dist/feature-libraries/object-forest/objectForest.d.ts +1 -1
  184. package/dist/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  185. package/dist/feature-libraries/object-forest/objectForest.js +2 -2
  186. package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
  187. package/dist/feature-libraries/optional-field/optionalFieldCodecV2.d.ts +4 -4
  188. package/dist/feature-libraries/optional-field/optionalFieldCodecV2.d.ts.map +1 -1
  189. package/dist/feature-libraries/optional-field/optionalFieldCodecV2.js.map +1 -1
  190. package/dist/feature-libraries/optional-field/optionalFieldCodecs.d.ts +3 -3
  191. package/dist/feature-libraries/optional-field/optionalFieldCodecs.d.ts.map +1 -1
  192. package/dist/feature-libraries/optional-field/optionalFieldCodecs.js.map +1 -1
  193. package/dist/feature-libraries/schema-edits/index.d.ts +1 -1
  194. package/dist/feature-libraries/schema-edits/index.d.ts.map +1 -1
  195. package/dist/feature-libraries/schema-edits/index.js +2 -3
  196. package/dist/feature-libraries/schema-edits/index.js.map +1 -1
  197. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.d.ts +6 -15
  198. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
  199. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js +8 -54
  200. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
  201. package/dist/feature-libraries/schema-index/codec.d.ts +3 -16
  202. package/dist/feature-libraries/schema-index/codec.d.ts.map +1 -1
  203. package/dist/feature-libraries/schema-index/codec.js +1 -21
  204. package/dist/feature-libraries/schema-index/codec.js.map +1 -1
  205. package/dist/feature-libraries/schema-index/formatV2.d.ts +1 -1
  206. package/dist/feature-libraries/schema-index/formatV2.js +1 -1
  207. package/dist/feature-libraries/schema-index/formatV2.js.map +1 -1
  208. package/dist/feature-libraries/schema-index/index.d.ts +1 -1
  209. package/dist/feature-libraries/schema-index/index.d.ts.map +1 -1
  210. package/dist/feature-libraries/schema-index/index.js +1 -2
  211. package/dist/feature-libraries/schema-index/index.js.map +1 -1
  212. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts +4 -4
  213. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
  214. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
  215. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts +3 -3
  216. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts.map +1 -1
  217. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -1
  218. package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts +3 -3
  219. package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts.map +1 -1
  220. package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.js.map +1 -1
  221. package/dist/index.d.ts +2 -2
  222. package/dist/index.d.ts.map +1 -1
  223. package/dist/index.js +2 -3
  224. package/dist/index.js.map +1 -1
  225. package/dist/packageVersion.d.ts +1 -1
  226. package/dist/packageVersion.js +1 -1
  227. package/dist/packageVersion.js.map +1 -1
  228. package/dist/shared-tree/independentView.d.ts +1 -1
  229. package/dist/shared-tree/independentView.d.ts.map +1 -1
  230. package/dist/shared-tree/independentView.js +14 -21
  231. package/dist/shared-tree/independentView.js.map +1 -1
  232. package/dist/shared-tree/index.d.ts +2 -2
  233. package/dist/shared-tree/index.d.ts.map +1 -1
  234. package/dist/shared-tree/index.js +1 -2
  235. package/dist/shared-tree/index.js.map +1 -1
  236. package/dist/shared-tree/schematizingTreeView.d.ts +2 -36
  237. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  238. package/dist/shared-tree/schematizingTreeView.js +15 -117
  239. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  240. package/dist/shared-tree/sharedTree.d.ts +3 -22
  241. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  242. package/dist/shared-tree/sharedTree.js +10 -27
  243. package/dist/shared-tree/sharedTree.js.map +1 -1
  244. package/dist/shared-tree/sharedTreeChangeCodecs.d.ts +3 -2
  245. package/dist/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  246. package/dist/shared-tree/sharedTreeChangeCodecs.js +23 -16
  247. package/dist/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  248. package/dist/shared-tree/sharedTreeChangeEnricher.d.ts.map +1 -1
  249. package/dist/shared-tree/sharedTreeChangeEnricher.js +1 -1
  250. package/dist/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
  251. package/dist/shared-tree/sharedTreeChangeFamily.d.ts +1 -1
  252. package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  253. package/dist/shared-tree/sharedTreeChangeFamily.js +2 -2
  254. package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  255. package/dist/shared-tree/sharedTreeChangeFormat.d.ts +8 -7
  256. package/dist/shared-tree/sharedTreeChangeFormat.d.ts.map +1 -1
  257. package/dist/shared-tree/sharedTreeChangeFormat.js +13 -5
  258. package/dist/shared-tree/sharedTreeChangeFormat.js.map +1 -1
  259. package/dist/shared-tree/tree.d.ts.map +1 -1
  260. package/dist/shared-tree/tree.js +2 -1
  261. package/dist/shared-tree/tree.js.map +1 -1
  262. package/dist/shared-tree/treeAlpha.d.ts +13 -1
  263. package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
  264. package/dist/shared-tree/treeAlpha.js +3 -0
  265. package/dist/shared-tree/treeAlpha.js.map +1 -1
  266. package/dist/shared-tree/treeCheckout.d.ts +34 -69
  267. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  268. package/dist/shared-tree/treeCheckout.js +885 -678
  269. package/dist/shared-tree/treeCheckout.js.map +1 -1
  270. package/dist/shared-tree/unhydratedTreeContext.js +3 -3
  271. package/dist/shared-tree/unhydratedTreeContext.js.map +1 -1
  272. package/dist/shared-tree-core/editManagerCodecs.d.ts +23 -12
  273. package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  274. package/dist/shared-tree-core/editManagerCodecs.js +40 -67
  275. package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
  276. package/dist/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
  277. package/dist/shared-tree-core/editManagerCodecsCommons.js +0 -1
  278. package/dist/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
  279. package/dist/shared-tree-core/editManagerCodecsV1toV4.d.ts +10 -2
  280. package/dist/shared-tree-core/editManagerCodecsV1toV4.d.ts.map +1 -1
  281. package/dist/shared-tree-core/editManagerCodecsV1toV4.js +18 -13
  282. package/dist/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -1
  283. package/dist/shared-tree-core/editManagerCodecsVSharedBranches.d.ts +2 -2
  284. package/dist/shared-tree-core/editManagerCodecsVSharedBranches.d.ts.map +1 -1
  285. package/dist/shared-tree-core/editManagerCodecsVSharedBranches.js +6 -9
  286. package/dist/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
  287. package/dist/shared-tree-core/index.d.ts +3 -3
  288. package/dist/shared-tree-core/index.d.ts.map +1 -1
  289. package/dist/shared-tree-core/index.js +5 -8
  290. package/dist/shared-tree-core/index.js.map +1 -1
  291. package/dist/shared-tree-core/messageCodecV1ToV4.d.ts +2 -3
  292. package/dist/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
  293. package/dist/shared-tree-core/messageCodecV1ToV4.js +8 -8
  294. package/dist/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
  295. package/dist/shared-tree-core/messageCodecVSharedBranches.d.ts +2 -3
  296. package/dist/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -1
  297. package/dist/shared-tree-core/messageCodecVSharedBranches.js +5 -4
  298. package/dist/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
  299. package/dist/shared-tree-core/messageCodecs.d.ts +15 -14
  300. package/dist/shared-tree-core/messageCodecs.d.ts.map +1 -1
  301. package/dist/shared-tree-core/messageCodecs.js +38 -74
  302. package/dist/shared-tree-core/messageCodecs.js.map +1 -1
  303. package/dist/shared-tree-core/messageFormat.d.ts +0 -1
  304. package/dist/shared-tree-core/messageFormat.d.ts.map +1 -1
  305. package/dist/shared-tree-core/messageFormat.js +1 -2
  306. package/dist/shared-tree-core/messageFormat.js.map +1 -1
  307. package/dist/shared-tree-core/sharedTreeCore.d.ts +1 -3
  308. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  309. package/dist/shared-tree-core/sharedTreeCore.js +12 -2
  310. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  311. package/dist/sharedTreeAttributes.d.ts.map +1 -1
  312. package/dist/sharedTreeAttributes.js +3 -0
  313. package/dist/sharedTreeAttributes.js.map +1 -1
  314. package/dist/simple-tree/api/index.d.ts +1 -0
  315. package/dist/simple-tree/api/index.d.ts.map +1 -1
  316. package/dist/simple-tree/api/index.js.map +1 -1
  317. package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
  318. package/dist/simple-tree/api/schemaFactory.js.map +1 -1
  319. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +2 -2
  320. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  321. package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  322. package/dist/simple-tree/api/storedSchema.d.ts.map +1 -1
  323. package/dist/simple-tree/api/storedSchema.js +6 -6
  324. package/dist/simple-tree/api/storedSchema.js.map +1 -1
  325. package/dist/simple-tree/api/tree.d.ts +7 -19
  326. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  327. package/dist/simple-tree/api/tree.js.map +1 -1
  328. package/dist/simple-tree/api/treeAlpha.d.ts +69 -0
  329. package/dist/simple-tree/api/treeAlpha.d.ts.map +1 -0
  330. package/dist/simple-tree/api/treeAlpha.js +7 -0
  331. package/dist/simple-tree/api/treeAlpha.js.map +1 -0
  332. package/dist/simple-tree/api/treeBeta.d.ts +1 -1
  333. package/dist/simple-tree/api/treeBeta.js.map +1 -1
  334. package/dist/simple-tree/api/treeChangeEvents.d.ts +3 -0
  335. package/dist/simple-tree/api/treeChangeEvents.d.ts.map +1 -1
  336. package/dist/simple-tree/api/treeChangeEvents.js.map +1 -1
  337. package/dist/simple-tree/api/treeNodeApi.d.ts +49 -0
  338. package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  339. package/dist/simple-tree/api/treeNodeApi.js +41 -2
  340. package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
  341. package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  342. package/dist/simple-tree/core/treeNodeKernel.js +45 -8
  343. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
  344. package/dist/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  345. package/dist/simple-tree/core/unhydratedFlexTree.js +5 -1
  346. package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  347. package/dist/simple-tree/index.d.ts +2 -2
  348. package/dist/simple-tree/index.d.ts.map +1 -1
  349. package/dist/simple-tree/index.js.map +1 -1
  350. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts +16 -0
  351. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  352. package/dist/simple-tree/node-kinds/array/arrayNode.js +23 -0
  353. package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  354. package/dist/simple-tree/node-kinds/array/arrayNodeTypes.d.ts +10 -1
  355. package/dist/simple-tree/node-kinds/array/arrayNodeTypes.d.ts.map +1 -1
  356. package/dist/simple-tree/node-kinds/array/arrayNodeTypes.js.map +1 -1
  357. package/dist/simple-tree/node-kinds/array/index.d.ts +2 -2
  358. package/dist/simple-tree/node-kinds/array/index.d.ts.map +1 -1
  359. package/dist/simple-tree/node-kinds/array/index.js.map +1 -1
  360. package/dist/simple-tree/node-kinds/index.d.ts +1 -1
  361. package/dist/simple-tree/node-kinds/index.d.ts.map +1 -1
  362. package/dist/simple-tree/node-kinds/index.js.map +1 -1
  363. package/dist/text/textDomainFormatted.d.ts +319 -9
  364. package/dist/text/textDomainFormatted.d.ts.map +1 -1
  365. package/dist/text/textDomainFormatted.js +100 -25
  366. package/dist/text/textDomainFormatted.js.map +1 -1
  367. package/dist/treeFactory.d.ts.map +1 -1
  368. package/dist/treeFactory.js +5 -2
  369. package/dist/treeFactory.js.map +1 -1
  370. package/dist/util/referenceCounting.d.ts.map +1 -1
  371. package/dist/util/referenceCounting.js +0 -1
  372. package/dist/util/referenceCounting.js.map +1 -1
  373. package/legacy.d.ts +2 -3
  374. package/lib/api.d.ts +6 -1
  375. package/lib/api.d.ts.map +1 -1
  376. package/lib/api.js.map +1 -1
  377. package/lib/codec/codec.d.ts +28 -2
  378. package/lib/codec/codec.d.ts.map +1 -1
  379. package/lib/codec/codec.js +1 -0
  380. package/lib/codec/codec.js.map +1 -1
  381. package/lib/codec/index.d.ts +2 -2
  382. package/lib/codec/index.d.ts.map +1 -1
  383. package/lib/codec/index.js +1 -1
  384. package/lib/codec/index.js.map +1 -1
  385. package/lib/codec/versioned/codec.d.ts +18 -36
  386. package/lib/codec/versioned/codec.d.ts.map +1 -1
  387. package/lib/codec/versioned/codec.js +45 -56
  388. package/lib/codec/versioned/codec.js.map +1 -1
  389. package/lib/codec/versioned/index.d.ts +1 -1
  390. package/lib/codec/versioned/index.d.ts.map +1 -1
  391. package/lib/codec/versioned/index.js +1 -1
  392. package/lib/codec/versioned/index.js.map +1 -1
  393. package/lib/core/forest/forest.d.ts +5 -2
  394. package/lib/core/forest/forest.d.ts.map +1 -1
  395. package/lib/core/forest/forest.js.map +1 -1
  396. package/lib/core/index.d.ts +1 -1
  397. package/lib/core/index.d.ts.map +1 -1
  398. package/lib/core/index.js +1 -1
  399. package/lib/core/index.js.map +1 -1
  400. package/lib/core/rebase/changeRebaser.d.ts +8 -1
  401. package/lib/core/rebase/changeRebaser.d.ts.map +1 -1
  402. package/lib/core/rebase/changeRebaser.js.map +1 -1
  403. package/lib/core/rebase/revisionTagCodec.d.ts +4 -3
  404. package/lib/core/rebase/revisionTagCodec.d.ts.map +1 -1
  405. package/lib/core/rebase/revisionTagCodec.js +2 -0
  406. package/lib/core/rebase/revisionTagCodec.js.map +1 -1
  407. package/lib/core/rebase/utils.d.ts +2 -2
  408. package/lib/core/rebase/utils.d.ts.map +1 -1
  409. package/lib/core/rebase/utils.js +4 -4
  410. package/lib/core/rebase/utils.js.map +1 -1
  411. package/lib/core/schema-stored/formatV2.d.ts +1 -1
  412. package/lib/core/schema-stored/formatV2.js +1 -1
  413. package/lib/core/schema-stored/formatV2.js.map +1 -1
  414. package/lib/core/tree/anchorSet.d.ts +8 -0
  415. package/lib/core/tree/anchorSet.d.ts.map +1 -1
  416. package/lib/core/tree/anchorSet.js +42 -7
  417. package/lib/core/tree/anchorSet.js.map +1 -1
  418. package/lib/core/tree/cursor.d.ts +25 -1
  419. package/lib/core/tree/cursor.d.ts.map +1 -1
  420. package/lib/core/tree/cursor.js +43 -0
  421. package/lib/core/tree/cursor.js.map +1 -1
  422. package/lib/core/tree/deltaUtil.d.ts +13 -1
  423. package/lib/core/tree/deltaUtil.d.ts.map +1 -1
  424. package/lib/core/tree/deltaUtil.js +31 -0
  425. package/lib/core/tree/deltaUtil.js.map +1 -1
  426. package/lib/core/tree/detachedFieldIndexCodecs.d.ts +5 -5
  427. package/lib/core/tree/detachedFieldIndexCodecs.d.ts.map +1 -1
  428. package/lib/core/tree/detachedFieldIndexCodecs.js.map +1 -1
  429. package/lib/core/tree/index.d.ts +2 -2
  430. package/lib/core/tree/index.d.ts.map +1 -1
  431. package/lib/core/tree/index.js +2 -2
  432. package/lib/core/tree/index.js.map +1 -1
  433. package/lib/core/tree/visitDelta.d.ts +11 -0
  434. package/lib/core/tree/visitDelta.d.ts.map +1 -1
  435. package/lib/core/tree/visitDelta.js +1 -1
  436. package/lib/core/tree/visitDelta.js.map +1 -1
  437. package/lib/core/tree/visitorUtils.d.ts.map +1 -1
  438. package/lib/core/tree/visitorUtils.js +5 -0
  439. package/lib/core/tree/visitorUtils.js.map +1 -1
  440. package/lib/entrypoints/alpha.d.ts +1 -1
  441. package/lib/entrypoints/alpha.d.ts.map +1 -1
  442. package/lib/entrypoints/alpha.js +2 -2
  443. package/lib/entrypoints/alpha.js.map +1 -1
  444. package/lib/entrypoints/beta.js +1 -1
  445. package/lib/entrypoints/beta.js.map +1 -1
  446. package/lib/entrypoints/legacy.d.ts +1 -1
  447. package/lib/entrypoints/legacy.d.ts.map +1 -1
  448. package/lib/entrypoints/legacy.js +1 -1
  449. package/lib/entrypoints/legacy.js.map +1 -1
  450. package/lib/entrypoints/public.js +1 -1
  451. package/lib/entrypoints/public.js.map +1 -1
  452. package/lib/feature-libraries/changeAtomIdCodec.d.ts +4 -3
  453. package/lib/feature-libraries/changeAtomIdCodec.d.ts.map +1 -1
  454. package/lib/feature-libraries/changeAtomIdCodec.js +2 -0
  455. package/lib/feature-libraries/changeAtomIdCodec.js.map +1 -1
  456. package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts +2 -1
  457. package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  458. package/lib/feature-libraries/chunked-forest/chunkedForest.js +2 -2
  459. package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  460. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +4 -4
  461. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  462. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js +4 -4
  463. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  464. package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts +1 -1
  465. package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts.map +1 -1
  466. package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
  467. package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts +1 -2
  468. package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts.map +1 -1
  469. package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
  470. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts +4 -4
  471. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  472. package/lib/feature-libraries/chunked-forest/codec/codecs.js +1 -1
  473. package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  474. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +12 -12
  475. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
  476. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +1 -1
  477. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  478. package/lib/feature-libraries/chunked-forest/codec/{formatGeneric.d.ts → format/formatGeneric.d.ts} +1 -1
  479. package/lib/feature-libraries/chunked-forest/codec/format/formatGeneric.d.ts.map +1 -0
  480. package/lib/feature-libraries/chunked-forest/codec/format/formatGeneric.js.map +1 -0
  481. package/lib/feature-libraries/chunked-forest/codec/format/formatV1.d.ts +187 -0
  482. package/lib/feature-libraries/chunked-forest/codec/format/formatV1.d.ts.map +1 -0
  483. package/lib/feature-libraries/chunked-forest/codec/format/formatV1.js +112 -0
  484. package/lib/feature-libraries/chunked-forest/codec/format/formatV1.js.map +1 -0
  485. package/lib/feature-libraries/chunked-forest/codec/format/formatV2.d.ts +33 -0
  486. package/lib/feature-libraries/chunked-forest/codec/format/formatV2.d.ts.map +1 -0
  487. package/lib/feature-libraries/chunked-forest/codec/format/formatV2.js +13 -0
  488. package/lib/feature-libraries/chunked-forest/codec/format/formatV2.js.map +1 -0
  489. package/lib/feature-libraries/chunked-forest/codec/format/index.d.ts +10 -0
  490. package/lib/feature-libraries/chunked-forest/codec/format/index.d.ts.map +1 -0
  491. package/lib/feature-libraries/chunked-forest/codec/format/index.js +8 -0
  492. package/lib/feature-libraries/chunked-forest/codec/format/index.js.map +1 -0
  493. package/lib/feature-libraries/chunked-forest/codec/format/versions.d.ts +93 -0
  494. package/lib/feature-libraries/chunked-forest/codec/format/versions.d.ts.map +1 -0
  495. package/lib/feature-libraries/chunked-forest/codec/format/versions.js +26 -0
  496. package/lib/feature-libraries/chunked-forest/codec/format/versions.js.map +1 -0
  497. package/lib/feature-libraries/chunked-forest/codec/index.d.ts +2 -2
  498. package/lib/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
  499. package/lib/feature-libraries/chunked-forest/codec/index.js +1 -1
  500. package/lib/feature-libraries/chunked-forest/codec/index.js.map +1 -1
  501. package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts +7 -7
  502. package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts.map +1 -1
  503. package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.js.map +1 -1
  504. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts +1 -1
  505. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -1
  506. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +4 -2
  507. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
  508. package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.d.ts +1 -1
  509. package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.d.ts.map +1 -1
  510. package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.js +1 -1
  511. package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.js.map +1 -1
  512. package/lib/feature-libraries/chunked-forest/index.d.ts +1 -1
  513. package/lib/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  514. package/lib/feature-libraries/chunked-forest/index.js.map +1 -1
  515. package/lib/feature-libraries/cursorComparator.d.ts +23 -0
  516. package/lib/feature-libraries/cursorComparator.d.ts.map +1 -0
  517. package/lib/feature-libraries/cursorComparator.js +61 -0
  518. package/lib/feature-libraries/cursorComparator.js.map +1 -0
  519. package/lib/feature-libraries/forest-summary/codec.d.ts +1 -1
  520. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts +3 -3
  521. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts.map +1 -1
  522. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -1
  523. package/lib/feature-libraries/index.d.ts +3 -2
  524. package/lib/feature-libraries/index.d.ts.map +1 -1
  525. package/lib/feature-libraries/index.js +3 -2
  526. package/lib/feature-libraries/index.js.map +1 -1
  527. package/lib/feature-libraries/indexing/anchorTreeIndex.d.ts +2 -0
  528. package/lib/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -1
  529. package/lib/feature-libraries/indexing/anchorTreeIndex.js +12 -7
  530. package/lib/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
  531. package/lib/feature-libraries/mitigatedChangeFamily.d.ts.map +1 -1
  532. package/lib/feature-libraries/mitigatedChangeFamily.js +2 -2
  533. package/lib/feature-libraries/mitigatedChangeFamily.js.map +1 -1
  534. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts +3 -3
  535. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  536. package/lib/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  537. package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  538. package/lib/feature-libraries/modular-schema/genericFieldKind.js +0 -1
  539. package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  540. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts +10 -10
  541. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -1
  542. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js +2 -4
  543. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
  544. package/lib/feature-libraries/modular-schema/modularChangeCodecV2.d.ts +3 -3
  545. package/lib/feature-libraries/modular-schema/modularChangeCodecV2.d.ts.map +1 -1
  546. package/lib/feature-libraries/modular-schema/modularChangeCodecV2.js.map +1 -1
  547. package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts +3 -3
  548. package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  549. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  550. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +1 -1
  551. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  552. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +4 -3
  553. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  554. package/lib/feature-libraries/object-forest/objectForest.d.ts +1 -1
  555. package/lib/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  556. package/lib/feature-libraries/object-forest/objectForest.js +2 -2
  557. package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
  558. package/lib/feature-libraries/optional-field/optionalFieldCodecV2.d.ts +4 -4
  559. package/lib/feature-libraries/optional-field/optionalFieldCodecV2.d.ts.map +1 -1
  560. package/lib/feature-libraries/optional-field/optionalFieldCodecV2.js +1 -1
  561. package/lib/feature-libraries/optional-field/optionalFieldCodecV2.js.map +1 -1
  562. package/lib/feature-libraries/optional-field/optionalFieldCodecs.d.ts +3 -3
  563. package/lib/feature-libraries/optional-field/optionalFieldCodecs.d.ts.map +1 -1
  564. package/lib/feature-libraries/optional-field/optionalFieldCodecs.js.map +1 -1
  565. package/lib/feature-libraries/schema-edits/index.d.ts +1 -1
  566. package/lib/feature-libraries/schema-edits/index.d.ts.map +1 -1
  567. package/lib/feature-libraries/schema-edits/index.js +1 -1
  568. package/lib/feature-libraries/schema-edits/index.js.map +1 -1
  569. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.d.ts +6 -15
  570. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
  571. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js +6 -50
  572. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
  573. package/lib/feature-libraries/schema-index/codec.d.ts +3 -16
  574. package/lib/feature-libraries/schema-index/codec.d.ts.map +1 -1
  575. package/lib/feature-libraries/schema-index/codec.js +0 -19
  576. package/lib/feature-libraries/schema-index/codec.js.map +1 -1
  577. package/lib/feature-libraries/schema-index/formatV2.d.ts +1 -1
  578. package/lib/feature-libraries/schema-index/formatV2.js +1 -1
  579. package/lib/feature-libraries/schema-index/formatV2.js.map +1 -1
  580. package/lib/feature-libraries/schema-index/index.d.ts +1 -1
  581. package/lib/feature-libraries/schema-index/index.d.ts.map +1 -1
  582. package/lib/feature-libraries/schema-index/index.js +1 -1
  583. package/lib/feature-libraries/schema-index/index.js.map +1 -1
  584. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts +4 -4
  585. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
  586. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
  587. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts +3 -3
  588. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts.map +1 -1
  589. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.js +1 -1
  590. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -1
  591. package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts +3 -3
  592. package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts.map +1 -1
  593. package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.js.map +1 -1
  594. package/lib/index.d.ts +2 -2
  595. package/lib/index.d.ts.map +1 -1
  596. package/lib/index.js +1 -1
  597. package/lib/index.js.map +1 -1
  598. package/lib/packageVersion.d.ts +1 -1
  599. package/lib/packageVersion.js +1 -1
  600. package/lib/packageVersion.js.map +1 -1
  601. package/lib/shared-tree/independentView.d.ts +1 -1
  602. package/lib/shared-tree/independentView.d.ts.map +1 -1
  603. package/lib/shared-tree/independentView.js +4 -11
  604. package/lib/shared-tree/independentView.js.map +1 -1
  605. package/lib/shared-tree/index.d.ts +2 -2
  606. package/lib/shared-tree/index.d.ts.map +1 -1
  607. package/lib/shared-tree/index.js +1 -1
  608. package/lib/shared-tree/index.js.map +1 -1
  609. package/lib/shared-tree/schematizingTreeView.d.ts +2 -36
  610. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  611. package/lib/shared-tree/schematizingTreeView.js +17 -116
  612. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  613. package/lib/shared-tree/sharedTree.d.ts +3 -22
  614. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  615. package/lib/shared-tree/sharedTree.js +11 -27
  616. package/lib/shared-tree/sharedTree.js.map +1 -1
  617. package/lib/shared-tree/sharedTreeChangeCodecs.d.ts +3 -2
  618. package/lib/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  619. package/lib/shared-tree/sharedTreeChangeCodecs.js +19 -12
  620. package/lib/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  621. package/lib/shared-tree/sharedTreeChangeEnricher.d.ts.map +1 -1
  622. package/lib/shared-tree/sharedTreeChangeEnricher.js +2 -2
  623. package/lib/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
  624. package/lib/shared-tree/sharedTreeChangeFamily.d.ts +1 -1
  625. package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  626. package/lib/shared-tree/sharedTreeChangeFamily.js +2 -2
  627. package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  628. package/lib/shared-tree/sharedTreeChangeFormat.d.ts +8 -7
  629. package/lib/shared-tree/sharedTreeChangeFormat.d.ts.map +1 -1
  630. package/lib/shared-tree/sharedTreeChangeFormat.js +11 -5
  631. package/lib/shared-tree/sharedTreeChangeFormat.js.map +1 -1
  632. package/lib/shared-tree/tree.d.ts.map +1 -1
  633. package/lib/shared-tree/tree.js +2 -1
  634. package/lib/shared-tree/tree.js.map +1 -1
  635. package/lib/shared-tree/treeAlpha.d.ts +13 -1
  636. package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
  637. package/lib/shared-tree/treeAlpha.js +3 -0
  638. package/lib/shared-tree/treeAlpha.js.map +1 -1
  639. package/lib/shared-tree/treeCheckout.d.ts +34 -69
  640. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  641. package/lib/shared-tree/treeCheckout.js +889 -683
  642. package/lib/shared-tree/treeCheckout.js.map +1 -1
  643. package/lib/shared-tree/unhydratedTreeContext.js +1 -1
  644. package/lib/shared-tree/unhydratedTreeContext.js.map +1 -1
  645. package/lib/shared-tree-core/editManagerCodecs.d.ts +23 -12
  646. package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  647. package/lib/shared-tree-core/editManagerCodecs.js +41 -65
  648. package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
  649. package/lib/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
  650. package/lib/shared-tree-core/editManagerCodecsCommons.js +0 -1
  651. package/lib/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
  652. package/lib/shared-tree-core/editManagerCodecsV1toV4.d.ts +10 -2
  653. package/lib/shared-tree-core/editManagerCodecsV1toV4.d.ts.map +1 -1
  654. package/lib/shared-tree-core/editManagerCodecsV1toV4.js +16 -11
  655. package/lib/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -1
  656. package/lib/shared-tree-core/editManagerCodecsVSharedBranches.d.ts +2 -2
  657. package/lib/shared-tree-core/editManagerCodecsVSharedBranches.d.ts.map +1 -1
  658. package/lib/shared-tree-core/editManagerCodecsVSharedBranches.js +5 -8
  659. package/lib/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
  660. package/lib/shared-tree-core/index.d.ts +3 -3
  661. package/lib/shared-tree-core/index.d.ts.map +1 -1
  662. package/lib/shared-tree-core/index.js +3 -3
  663. package/lib/shared-tree-core/index.js.map +1 -1
  664. package/lib/shared-tree-core/messageCodecV1ToV4.d.ts +2 -3
  665. package/lib/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
  666. package/lib/shared-tree-core/messageCodecV1ToV4.js +8 -8
  667. package/lib/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
  668. package/lib/shared-tree-core/messageCodecVSharedBranches.d.ts +2 -3
  669. package/lib/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -1
  670. package/lib/shared-tree-core/messageCodecVSharedBranches.js +5 -4
  671. package/lib/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
  672. package/lib/shared-tree-core/messageCodecs.d.ts +15 -14
  673. package/lib/shared-tree-core/messageCodecs.d.ts.map +1 -1
  674. package/lib/shared-tree-core/messageCodecs.js +38 -71
  675. package/lib/shared-tree-core/messageCodecs.js.map +1 -1
  676. package/lib/shared-tree-core/messageFormat.d.ts +0 -1
  677. package/lib/shared-tree-core/messageFormat.d.ts.map +1 -1
  678. package/lib/shared-tree-core/messageFormat.js +0 -1
  679. package/lib/shared-tree-core/messageFormat.js.map +1 -1
  680. package/lib/shared-tree-core/sharedTreeCore.d.ts +1 -3
  681. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  682. package/lib/shared-tree-core/sharedTreeCore.js +14 -4
  683. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  684. package/lib/sharedTreeAttributes.d.ts.map +1 -1
  685. package/lib/sharedTreeAttributes.js +3 -0
  686. package/lib/sharedTreeAttributes.js.map +1 -1
  687. package/lib/simple-tree/api/index.d.ts +1 -0
  688. package/lib/simple-tree/api/index.d.ts.map +1 -1
  689. package/lib/simple-tree/api/index.js.map +1 -1
  690. package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
  691. package/lib/simple-tree/api/schemaFactory.js.map +1 -1
  692. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +2 -2
  693. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  694. package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  695. package/lib/simple-tree/api/storedSchema.d.ts.map +1 -1
  696. package/lib/simple-tree/api/storedSchema.js +7 -7
  697. package/lib/simple-tree/api/storedSchema.js.map +1 -1
  698. package/lib/simple-tree/api/tree.d.ts +7 -19
  699. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  700. package/lib/simple-tree/api/tree.js.map +1 -1
  701. package/lib/simple-tree/api/treeAlpha.d.ts +69 -0
  702. package/lib/simple-tree/api/treeAlpha.d.ts.map +1 -0
  703. package/lib/simple-tree/api/treeAlpha.js +6 -0
  704. package/lib/simple-tree/api/treeAlpha.js.map +1 -0
  705. package/lib/simple-tree/api/treeBeta.d.ts +1 -1
  706. package/lib/simple-tree/api/treeBeta.js.map +1 -1
  707. package/lib/simple-tree/api/treeChangeEvents.d.ts +3 -0
  708. package/lib/simple-tree/api/treeChangeEvents.d.ts.map +1 -1
  709. package/lib/simple-tree/api/treeChangeEvents.js.map +1 -1
  710. package/lib/simple-tree/api/treeNodeApi.d.ts +49 -0
  711. package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  712. package/lib/simple-tree/api/treeNodeApi.js +41 -2
  713. package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
  714. package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  715. package/lib/simple-tree/core/treeNodeKernel.js +45 -8
  716. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
  717. package/lib/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  718. package/lib/simple-tree/core/unhydratedFlexTree.js +5 -1
  719. package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  720. package/lib/simple-tree/index.d.ts +2 -2
  721. package/lib/simple-tree/index.d.ts.map +1 -1
  722. package/lib/simple-tree/index.js.map +1 -1
  723. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts +16 -0
  724. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  725. package/lib/simple-tree/node-kinds/array/arrayNode.js +23 -0
  726. package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  727. package/lib/simple-tree/node-kinds/array/arrayNodeTypes.d.ts +10 -1
  728. package/lib/simple-tree/node-kinds/array/arrayNodeTypes.d.ts.map +1 -1
  729. package/lib/simple-tree/node-kinds/array/arrayNodeTypes.js.map +1 -1
  730. package/lib/simple-tree/node-kinds/array/index.d.ts +2 -2
  731. package/lib/simple-tree/node-kinds/array/index.d.ts.map +1 -1
  732. package/lib/simple-tree/node-kinds/array/index.js.map +1 -1
  733. package/lib/simple-tree/node-kinds/index.d.ts +1 -1
  734. package/lib/simple-tree/node-kinds/index.d.ts.map +1 -1
  735. package/lib/simple-tree/node-kinds/index.js.map +1 -1
  736. package/lib/text/textDomainFormatted.d.ts +319 -9
  737. package/lib/text/textDomainFormatted.d.ts.map +1 -1
  738. package/lib/text/textDomainFormatted.js +103 -28
  739. package/lib/text/textDomainFormatted.js.map +1 -1
  740. package/lib/treeFactory.d.ts.map +1 -1
  741. package/lib/treeFactory.js +6 -3
  742. package/lib/treeFactory.js.map +1 -1
  743. package/lib/util/referenceCounting.d.ts.map +1 -1
  744. package/lib/util/referenceCounting.js +0 -1
  745. package/lib/util/referenceCounting.js.map +1 -1
  746. package/package.json +27 -27
  747. package/scripts/generate-entrypoint-sources.sh +4 -2
  748. package/src/api.ts +11 -0
  749. package/src/codec/codec.ts +32 -2
  750. package/src/codec/index.ts +2 -3
  751. package/src/codec/versioned/codec.ts +99 -109
  752. package/src/codec/versioned/index.ts +1 -3
  753. package/src/core/forest/forest.ts +5 -2
  754. package/src/core/index.ts +4 -0
  755. package/src/core/rebase/changeRebaser.ts +8 -0
  756. package/src/core/rebase/revisionTagCodec.ts +4 -4
  757. package/src/core/rebase/utils.ts +9 -2
  758. package/src/core/schema-stored/formatV2.ts +1 -1
  759. package/src/core/tree/anchorSet.ts +67 -10
  760. package/src/core/tree/cursor.ts +52 -1
  761. package/src/core/tree/deltaUtil.ts +37 -1
  762. package/src/core/tree/detachedFieldIndexCodecs.ts +4 -4
  763. package/src/core/tree/index.ts +4 -0
  764. package/src/core/tree/visitDelta.ts +13 -1
  765. package/src/core/tree/visitorUtils.ts +5 -0
  766. package/src/entrypoints/alpha.ts +13 -6
  767. package/src/entrypoints/beta.ts +2 -2
  768. package/src/entrypoints/legacy.ts +11 -3
  769. package/src/entrypoints/public.ts +1 -1
  770. package/src/feature-libraries/changeAtomIdCodec.ts +8 -7
  771. package/src/feature-libraries/chunked-forest/chunkedForest.ts +3 -2
  772. package/src/feature-libraries/chunked-forest/codec/chunkDecoding.ts +18 -13
  773. package/src/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.ts +1 -1
  774. package/src/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.ts +1 -2
  775. package/src/feature-libraries/chunked-forest/codec/codecs.ts +16 -10
  776. package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +16 -14
  777. package/src/feature-libraries/chunked-forest/codec/{formatGeneric.ts → format/formatGeneric.ts} +1 -1
  778. package/src/feature-libraries/chunked-forest/codec/{format.ts → format/formatV1.ts} +41 -111
  779. package/src/feature-libraries/chunked-forest/codec/format/formatV2.ts +31 -0
  780. package/src/feature-libraries/chunked-forest/codec/format/index.ts +31 -0
  781. package/src/feature-libraries/chunked-forest/codec/format/versions.ts +81 -0
  782. package/src/feature-libraries/chunked-forest/codec/index.ts +6 -2
  783. package/src/feature-libraries/chunked-forest/codec/nodeEncoder.ts +19 -12
  784. package/src/feature-libraries/chunked-forest/codec/schemaBasedEncode.ts +6 -4
  785. package/src/feature-libraries/chunked-forest/codec/uncompressedEncode.ts +10 -10
  786. package/src/feature-libraries/chunked-forest/index.ts +2 -1
  787. package/src/feature-libraries/cursorComparator.ts +77 -0
  788. package/src/feature-libraries/forest-summary/incrementalSummaryBuilder.ts +5 -5
  789. package/src/feature-libraries/index.ts +5 -3
  790. package/src/feature-libraries/indexing/anchorTreeIndex.ts +20 -10
  791. package/src/feature-libraries/mitigatedChangeFamily.ts +4 -1
  792. package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +4 -5
  793. package/src/feature-libraries/modular-schema/genericFieldKind.ts +0 -1
  794. package/src/feature-libraries/modular-schema/modularChangeCodecV1.ts +19 -26
  795. package/src/feature-libraries/modular-schema/modularChangeCodecV2.ts +4 -4
  796. package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +4 -5
  797. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +6 -2
  798. package/src/feature-libraries/object-forest/objectForest.ts +8 -2
  799. package/src/feature-libraries/optional-field/optionalFieldCodecV2.ts +11 -13
  800. package/src/feature-libraries/optional-field/optionalFieldCodecs.ts +4 -5
  801. package/src/feature-libraries/schema-edits/index.ts +1 -4
  802. package/src/feature-libraries/schema-edits/schemaChangeCodecs.ts +10 -78
  803. package/src/feature-libraries/schema-index/codec.ts +0 -25
  804. package/src/feature-libraries/schema-index/formatV2.ts +1 -1
  805. package/src/feature-libraries/schema-index/index.ts +1 -4
  806. package/src/feature-libraries/sequence-field/sequenceFieldCodecV2.ts +6 -6
  807. package/src/feature-libraries/sequence-field/sequenceFieldCodecV3.ts +8 -5
  808. package/src/feature-libraries/sequence-field/sequenceFieldCodecs.ts +4 -5
  809. package/src/index.ts +10 -3
  810. package/src/packageVersion.ts +1 -1
  811. package/src/shared-tree/independentView.ts +5 -18
  812. package/src/shared-tree/index.ts +0 -4
  813. package/src/shared-tree/schematizingTreeView.ts +19 -165
  814. package/src/shared-tree/sharedTree.ts +16 -59
  815. package/src/shared-tree/sharedTreeChangeCodecs.ts +23 -29
  816. package/src/shared-tree/sharedTreeChangeEnricher.ts +1 -2
  817. package/src/shared-tree/sharedTreeChangeFamily.ts +2 -0
  818. package/src/shared-tree/sharedTreeChangeFormat.ts +23 -8
  819. package/src/shared-tree/tree.ts +2 -5
  820. package/src/shared-tree/treeAlpha.ts +26 -0
  821. package/src/shared-tree/treeCheckout.ts +275 -99
  822. package/src/shared-tree/unhydratedTreeContext.ts +1 -1
  823. package/src/shared-tree-core/editManagerCodecs.ts +99 -124
  824. package/src/shared-tree-core/editManagerCodecsCommons.ts +0 -1
  825. package/src/shared-tree-core/editManagerCodecsV1toV4.ts +54 -59
  826. package/src/shared-tree-core/editManagerCodecsVSharedBranches.ts +72 -95
  827. package/src/shared-tree-core/index.ts +4 -8
  828. package/src/shared-tree-core/messageCodecV1ToV4.ts +56 -71
  829. package/src/shared-tree-core/messageCodecVSharedBranches.ts +76 -92
  830. package/src/shared-tree-core/messageCodecs.ts +88 -126
  831. package/src/shared-tree-core/messageFormat.ts +0 -3
  832. package/src/shared-tree-core/sharedTreeCore.ts +14 -21
  833. package/src/sharedTreeAttributes.ts +3 -0
  834. package/src/simple-tree/api/index.ts +10 -0
  835. package/src/simple-tree/api/schemaFactory.ts +0 -2
  836. package/src/simple-tree/api/schemaFactoryAlpha.ts +13 -2
  837. package/src/simple-tree/api/storedSchema.ts +8 -19
  838. package/src/simple-tree/api/tree.ts +7 -20
  839. package/src/simple-tree/api/treeAlpha.ts +90 -0
  840. package/src/simple-tree/api/treeBeta.ts +1 -1
  841. package/src/simple-tree/api/treeChangeEvents.ts +3 -0
  842. package/src/simple-tree/api/treeNodeApi.ts +95 -3
  843. package/src/simple-tree/core/treeNodeKernel.ts +53 -7
  844. package/src/simple-tree/core/unhydratedFlexTree.ts +5 -1
  845. package/src/simple-tree/index.ts +10 -0
  846. package/src/simple-tree/node-kinds/array/arrayNode.ts +64 -0
  847. package/src/simple-tree/node-kinds/array/arrayNodeTypes.ts +25 -1
  848. package/src/simple-tree/node-kinds/array/index.ts +2 -0
  849. package/src/simple-tree/node-kinds/index.ts +2 -0
  850. package/src/text/textDomainFormatted.ts +113 -11
  851. package/src/treeFactory.ts +10 -5
  852. package/src/util/referenceCounting.ts +0 -1
  853. package/dist/feature-libraries/chunked-forest/codec/format.d.ts +0 -383
  854. package/dist/feature-libraries/chunked-forest/codec/format.d.ts.map +0 -1
  855. package/dist/feature-libraries/chunked-forest/codec/format.js +0 -191
  856. package/dist/feature-libraries/chunked-forest/codec/format.js.map +0 -1
  857. package/dist/feature-libraries/chunked-forest/codec/formatGeneric.d.ts.map +0 -1
  858. package/dist/feature-libraries/chunked-forest/codec/formatGeneric.js.map +0 -1
  859. package/lib/feature-libraries/chunked-forest/codec/format.d.ts +0 -383
  860. package/lib/feature-libraries/chunked-forest/codec/format.d.ts.map +0 -1
  861. package/lib/feature-libraries/chunked-forest/codec/format.js +0 -188
  862. package/lib/feature-libraries/chunked-forest/codec/format.js.map +0 -1
  863. package/lib/feature-libraries/chunked-forest/codec/formatGeneric.d.ts.map +0 -1
  864. package/lib/feature-libraries/chunked-forest/codec/formatGeneric.js.map +0 -1
  865. /package/dist/feature-libraries/chunked-forest/codec/{formatGeneric.js → format/formatGeneric.js} +0 -0
  866. /package/lib/feature-libraries/chunked-forest/codec/{formatGeneric.js → format/formatGeneric.js} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,123 @@
1
1
  # @fluidframework/tree
2
2
 
3
+ ## 2.92.0
4
+
5
+ ### Minor Changes
6
+
7
+ - The deprecated getBranch API has been removed ([#26796](https://github.com/microsoft/FluidFramework/pull/26796)) [e80a48e25e](https://github.com/microsoft/FluidFramework/commit/e80a48e25ebab540ce9a0093edc12b9aa5ab03fb)
8
+
9
+ To obtain a branch-like object, create a view from your tree via `viewWith`.
10
+ Or, use `TreeAlpha.context` to get a view from a `TreeNode`.
11
+
12
+ - Array node nodeChanged events now include a delta payload (via TreeAlpha) ([#26677](https://github.com/microsoft/FluidFramework/pull/26677)) [bf02e33aed](https://github.com/microsoft/FluidFramework/commit/bf02e33aed74295840ffa5b6ef889860d58f5654)
13
+
14
+ The `nodeChanged` event for array nodes (accessed via `TreeAlpha.on`) now provides a `delta` field, a sequence of `ArrayNodeDeltaOp` values that describe exactly what changed in the array. This lets you efficiently sync an external representation with tree changes, without taking a snapshot of the old state or diffing the entire array.
15
+
16
+ The delta follows [Quill](https://quilljs.com/docs/)-style semantics: each op covers a contiguous run of positions in the array before the change.
17
+ - `{ type: "retain", count: N }`—N elements stayed in place. Their positions are unchanged, though their contents may have changed (which would fire separate `nodeChanged` events on those elements).
18
+ - `{ type: "insert", count: N }`—N elements were inserted; read their values from the current tree at these positions.
19
+ - `{ type: "remove", count: N }`—N elements were removed.
20
+
21
+ Trailing unchanged elements are not represented by a trailing `"retain"` op.
22
+
23
+ Use `TreeAlpha.on` to subscribe to the richer alpha events. The data passed to the callback is typed as `NodeChangedDataAlpha<TNode>`:
24
+ - Object, map, and record nodes receive `NodeChangedDataProperties` (with a required `changedProperties` set).
25
+ - Array nodes receive `NodeChangedDataDelta` (with a `delta` field).
26
+
27
+ `TreeBeta.on` is unchanged and does not include delta information.
28
+
29
+ #### Example: Applying a Delta to a Plain Array Mirror
30
+
31
+ ```typescript
32
+ // Walk the delta to keep a plain JS array in sync with an array node.
33
+ // retain = advance past unchanged elements,
34
+ // insert = splice in new elements,
35
+ // remove = splice out removed elements.
36
+ const mirror: number[] = [1, 2, 3];
37
+
38
+ TreeAlpha.on(myArrayNode, "nodeChanged", ({ delta }) => {
39
+ let readPos = 0; // position in the current (post-change) tree
40
+ let writePos = 0; // position in the mirror array
41
+
42
+ for (const op of delta ?? []) {
43
+ if (op.type === "retain") {
44
+ writePos += op.count;
45
+ readPos += op.count;
46
+ } else if (op.type === "insert") {
47
+ const newItems = Array.from(
48
+ { length: op.count },
49
+ (_, i) => myArrayNode[readPos + i],
50
+ );
51
+ mirror.splice(writePos, 0, ...newItems);
52
+ writePos += op.count;
53
+ readPos += op.count;
54
+ } else if (op.type === "remove") {
55
+ mirror.splice(writePos, op.count);
56
+ }
57
+ }
58
+ });
59
+ ```
60
+
61
+ #### Example: Narrowing the Union in a Generic Handler
62
+
63
+ ```typescript
64
+ TreeAlpha.on(node as TreeNode, "nodeChanged", (data) => {
65
+ if ("delta" in data) {
66
+ // Array node — data is NodeChangedDataDelta
67
+ console.log("array changed, delta:", data.delta);
68
+ } else {
69
+ // Object/map/record node — data is NodeChangedDataProperties
70
+ console.log("properties changed:", data.changedProperties);
71
+ }
72
+ });
73
+ ```
74
+
75
+ > **Note:** The `delta` value may be `undefined` in two cases:
76
+ >
77
+ > - The node was created locally and has not yet been inserted into a document tree (a known temporary limitation).
78
+ > - The document was updated in a way that required multiple internal change passes in a single operation (for example, a data change combined with a schema upgrade).
79
+
80
+ - Add TreeArrayNodeAlpha with a new splice method ([#26740](https://github.com/microsoft/FluidFramework/pull/26740)) [f2b0cf9176](https://github.com/microsoft/FluidFramework/commit/f2b0cf917609b84952db2b9492867e70e0d57981)
81
+
82
+ Adds a `splice` method on `TreeArrayNodeAlpha` that supports removing and inserting items in a single operation to align with JavaScript's Array splice API.
83
+ Returns the removed items as an array.
84
+ Supports negative `start` indices (wraps from end).
85
+ Optional `deleteCount` (omitting removes everything from `start` onward).
86
+ The alpha API is accessible by an `asAlpha` cast on existing TreeArrayNodes, or using `schemaFactoryAlpha`.
87
+ `arrayAlpha` nodes are accepted wherever `TreeArrayNode` is expected, but not the reverse.
88
+ `asAlpha` is bidirectional since it's the same underlying schema.
89
+
90
+ #### Usage
91
+
92
+ ```typescript
93
+ import {
94
+ SchemaFactory,
95
+ SchemaFactoryAlpha,
96
+ asAlpha,
97
+ } from "@fluidframework/tree";
98
+
99
+ // Using asAlpha to cast an existing TreeArrayNode
100
+ const sf = new SchemaFactory("example");
101
+ const Inventory = sf.array("Inventory", sf.string);
102
+ const inventory = new Inventory(["Apples", "Bananas", "Pears"]);
103
+ const inventoryAlpha = asAlpha(inventory);
104
+
105
+ // Using SchemaFactoryAlpha so splice is available directly
106
+ const sf = new SchemaFactoryAlpha("example");
107
+ const Inventory = sf.arrayAlpha("Inventory", sf.string);
108
+ const inventoryAlpha = new Inventory(["Apples", "Bananas", "Pears"]);
109
+
110
+ // Remove 2 items starting at index 0, insert new items in their place
111
+ const removed = inventoryAlpha.splice(0, 2, "Oranges", "Grapes");
112
+ // removed: ["Apples", "Bananas"]
113
+ // inventory: ["Oranges", "Grapes", "Pears"]
114
+
115
+ // Removed everything from index 1 onward (omitting deleteCount)
116
+ const rest = inventoryAlpha.splice(1);
117
+ // rest: ["Grapes", "Pears"]
118
+ // inventory: ["Oranges"]
119
+ ```
120
+
3
121
  ## 2.91.0
4
122
 
5
123
  ### Minor Changes
@@ -96,16 +96,47 @@ Kind
96
96
  export interface ArrayNodeCustomizableSchema<out TName extends string = string, in out T extends ImplicitAllowedTypes = ImplicitAllowedTypes, out ImplicitlyConstructable extends boolean = true, out TCustomMetadata = unknown> extends TreeNodeSchemaClass<TName, NodeKind.Array, TreeArrayNode<T> & WithType<TName, NodeKind.Array, T>, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>, ImplicitlyConstructable, T, undefined, TCustomMetadata>, SimpleArrayNodeSchema<SchemaType.View, TCustomMetadata> {
97
97
  }
98
98
 
99
+ // @alpha @sealed @system
100
+ export interface ArrayNodeCustomizableSchemaAlpha<out TName extends string = string, in out T extends ImplicitAllowedTypes = ImplicitAllowedTypes, out ImplicitlyConstructable extends boolean = true, out TCustomMetadata = unknown> extends TreeNodeSchemaClass<TName, NodeKind.Array, TreeArrayNodeAlpha<T> & WithType<TName, NodeKind.Array, T>, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>, ImplicitlyConstructable, T, undefined, TCustomMetadata>, SimpleArrayNodeSchema<SchemaType.View, TCustomMetadata> {
101
+ }
102
+
99
103
  // @alpha @sealed @system
100
104
  export interface ArrayNodeCustomizableSchemaUnsafe<out TName extends string, in out T extends System_Unsafe.ImplicitAllowedTypesUnsafe, out TCustomMetadata> extends TreeNodeSchemaClass<TName, NodeKind.Array, System_Unsafe.TreeArrayNodeUnsafe<T> & WithType<TName, NodeKind.Array, T>, {
101
105
  [Symbol.iterator](): Iterator<System_Unsafe.InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>>;
102
106
  }, false, T, undefined, TCustomMetadata>, SimpleArrayNodeSchema<SchemaType.View, TCustomMetadata> {
103
107
  }
104
108
 
109
+ // @alpha @sealed
110
+ export type ArrayNodeDeltaOp = ArrayNodeRetainOp | ArrayNodeInsertOp | ArrayNodeRemoveOp;
111
+
112
+ // @alpha @sealed
113
+ export interface ArrayNodeInsertOp {
114
+ // (undocumented)
115
+ readonly count: number;
116
+ // (undocumented)
117
+ readonly type: "insert";
118
+ }
119
+
105
120
  // @alpha @sealed @system
106
121
  export interface ArrayNodePojoEmulationSchema<out TName extends string = string, in out T extends ImplicitAllowedTypes = ImplicitAllowedTypes, out ImplicitlyConstructable extends boolean = true, out TCustomMetadata = unknown> extends TreeNodeSchemaNonClass<TName, NodeKind.Array, TreeArrayNode<T> & WithType<TName, NodeKind.Array, T>, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>, ImplicitlyConstructable, T, undefined, TCustomMetadata>, SimpleArrayNodeSchema<SchemaType.View, TCustomMetadata> {
107
122
  }
108
123
 
124
+ // @alpha @sealed
125
+ export interface ArrayNodeRemoveOp {
126
+ // (undocumented)
127
+ readonly count: number;
128
+ // (undocumented)
129
+ readonly type: "remove";
130
+ }
131
+
132
+ // @alpha @sealed
133
+ export interface ArrayNodeRetainOp {
134
+ // (undocumented)
135
+ readonly count: number;
136
+ // (undocumented)
137
+ readonly type: "retain";
138
+ }
139
+
109
140
  // @alpha
110
141
  export type ArrayNodeSchema = ArrayNodeCustomizableSchema | ArrayNodePojoEmulationSchema;
111
142
 
@@ -125,20 +156,15 @@ export function asAlpha<TSchema extends ImplicitFieldSchema>(view: TreeView<TSch
125
156
  // @alpha
126
157
  export function asAlpha<TSchema extends ImplicitFieldSchema>(view: TreeViewConfiguration<TSchema>): TreeViewConfigurationAlpha<TSchema>;
127
158
 
159
+ // @alpha
160
+ export function asAlpha<TAllowedTypes extends ImplicitAllowedTypes>(node: TreeArrayNode<TAllowedTypes>): TreeArrayNodeAlpha<TAllowedTypes>;
161
+
128
162
  // @beta
129
163
  export function asBeta<TSchema extends ImplicitFieldSchema>(view: TreeView<TSchema>): TreeViewBeta<TSchema>;
130
164
 
131
165
  // @alpha @deprecated
132
166
  export function asTreeViewAlpha<TSchema extends ImplicitFieldSchema>(view: TreeView<TSchema>): TreeViewAlpha<TSchema>;
133
167
 
134
- // @alpha @sealed
135
- export interface BranchableTree extends ViewableTree {
136
- branch(): TreeBranchFork;
137
- merge(branch: TreeBranchFork): void;
138
- merge(branch: TreeBranchFork, disposeMerged: boolean): void;
139
- rebase(branch: TreeBranchFork): void;
140
- }
141
-
142
168
  // @alpha @sealed
143
169
  export type ChangeMetadata = LocalChangeMetadata | RemoteChangeMetadata;
144
170
 
@@ -462,12 +488,6 @@ export type FormatVersion = number | string | undefined;
462
488
  // @alpha
463
489
  export function generateSchemaFromSimpleSchema(simple: SimpleTreeSchema): TreeSchema;
464
490
 
465
- // @alpha @deprecated
466
- export function getBranch(tree: ITree): BranchableTree;
467
-
468
- // @alpha @deprecated
469
- export function getBranch<T extends ImplicitFieldSchema | UnsafeUnknownSchema>(view: TreeViewAlpha<T>): BranchableTree;
470
-
471
491
  // @alpha
472
492
  export function getJsonSchema(schema: ImplicitAllowedTypes, options: Required<TreeSchemaEncodingOptions>): JsonTreeSchema;
473
493
 
@@ -824,6 +844,19 @@ export interface NodeChangedData<TNode extends TreeNode = TreeNode> {
824
844
  readonly changedProperties?: ReadonlySet<TNode extends WithType<string, NodeKind.Object, infer TInfo> ? string & keyof TInfo : string>;
825
845
  }
826
846
 
847
+ // @alpha
848
+ export type NodeChangedDataAlpha<TNode extends TreeNode = TreeNode> = TNode extends WithType<string, NodeKind.Array> ? NodeChangedDataDelta : TNode extends WithType<string, NodeKind.Map | NodeKind.Object | NodeKind.Record> ? NodeChangedDataProperties<TNode> : NodeChangedDataProperties<TNode> | NodeChangedDataDelta;
849
+
850
+ // @alpha @sealed
851
+ export interface NodeChangedDataDelta {
852
+ readonly delta: readonly ArrayNodeDeltaOp[] | undefined;
853
+ }
854
+
855
+ // @alpha @sealed
856
+ export interface NodeChangedDataProperties<TNode extends TreeNode = TreeNode> {
857
+ readonly changedProperties: ReadonlySet<TNode extends WithType<string, NodeKind.Object, infer TInfo> ? string & keyof TInfo : string>;
858
+ }
859
+
827
860
  // @public
828
861
  export type NodeFromSchema<T extends TreeNodeSchema> = T extends TreeNodeSchemaClass<string, NodeKind, infer TNode> ? TNode : T extends TreeNodeSchemaNonClass<string, NodeKind, infer TNode> ? TNode : never;
829
862
 
@@ -1066,7 +1099,7 @@ export const SchemaFactory_base: SchemaStatics & (new () => SchemaStatics);
1066
1099
 
1067
1100
  // @alpha
1068
1101
  export class SchemaFactoryAlpha<out TScope extends string | undefined = string | undefined, TName extends number | string = string> extends SchemaFactoryBeta<TScope, TName> {
1069
- arrayAlpha<const Name extends TName, const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(name: Name, allowedTypes: T, options?: NodeSchemaOptionsAlpha<TCustomMetadata>): ArrayNodeCustomizableSchema<ScopedSchemaName<TScope, Name>, T, true, TCustomMetadata>;
1102
+ arrayAlpha<const Name extends TName, const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(name: Name, allowedTypes: T, options?: NodeSchemaOptionsAlpha<TCustomMetadata>): ArrayNodeCustomizableSchemaAlpha<ScopedSchemaName<TScope, Name>, T, true, TCustomMetadata>;
1070
1103
  arrayRecursive<const Name extends TName, const T extends System_Unsafe.ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(name: Name, allowedTypes: T, options?: NodeSchemaOptionsAlpha<TCustomMetadata>): ArrayNodeCustomizableSchemaUnsafe<ScopedSchemaName<TScope, Name>, T, TCustomMetadata>;
1071
1104
  static readonly identifier: <const TCustomMetadata = unknown>(props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider"> | undefined) => FieldSchemaAlpha<FieldKind.Identifier, LeafSchema<"string", string> & SimpleLeafNodeSchema<SchemaType>, TCustomMetadata, FieldPropsAlpha<TCustomMetadata>>;
1072
1105
  static readonly leaves: readonly [LeafSchema<"string", string> & SimpleLeafNodeSchema<SchemaType>, LeafSchema<"number", number> & SimpleLeafNodeSchema<SchemaType>, LeafSchema<"boolean", boolean> & SimpleLeafNodeSchema<SchemaType>, LeafSchema<"null", null> & SimpleLeafNodeSchema<SchemaType>, LeafSchema<"handle", IFluidHandle_2<unknown>> & SimpleLeafNodeSchema<SchemaType>];
@@ -1610,6 +1643,7 @@ export interface TreeAlpha {
1610
1643
  importConcise<const TSchema extends ImplicitFieldSchema | UnsafeUnknownSchema>(schema: UnsafeUnknownSchema extends TSchema ? ImplicitFieldSchema : TSchema & ImplicitFieldSchema, data: ConciseTree | undefined): Unhydrated<TSchema extends ImplicitFieldSchema ? TreeFieldFromImplicitField<TSchema> : TreeNode | TreeLeafValue | undefined>;
1611
1644
  importVerbose<const TSchema extends ImplicitFieldSchema>(schema: TSchema, data: VerboseTree | undefined, options?: TreeParsingOptions): Unhydrated<TreeFieldFromImplicitField<TSchema>>;
1612
1645
  key2(node: TreeNode): string | number | undefined;
1646
+ on<K extends keyof TreeChangeEventsAlpha<TNode>, TNode extends TreeNode>(node: TNode, eventName: K, listener: NoInfer<TreeChangeEventsAlpha<TNode>[K]>): () => void;
1613
1647
  tagContentSchema<TSchema extends TreeNodeSchema, TContent extends InsertableField<TSchema>>(schema: TSchema, content: TContent): TContent;
1614
1648
  trackObservations<TResult>(onInvalidation: () => void, trackDuring: () => TResult): ObservationResults<TResult>;
1615
1649
  trackObservationsOnce<TResult>(onInvalidation: () => void, trackDuring: () => TResult): ObservationResults<TResult>;
@@ -1646,6 +1680,11 @@ export const TreeArrayNode: {
1646
1680
  readonly spread: <T>(content: Iterable<T>) => IterableTreeArrayContent<T>;
1647
1681
  };
1648
1682
 
1683
+ // @alpha @sealed
1684
+ export interface TreeArrayNodeAlpha<TAllowedTypes extends System_Unsafe.ImplicitAllowedTypesUnsafe = ImplicitAllowedTypes, out T = [TAllowedTypes] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TAllowedTypes> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, in TNew = [TAllowedTypes] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TAllowedTypes> : InsertableTreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>> extends TreeArrayNode<TAllowedTypes, T, TNew> {
1685
+ splice(start: number, deleteCount?: number, ...items: readonly (TNew | IterableTreeArrayContent<TNew>)[]): T[];
1686
+ }
1687
+
1649
1688
  // @beta @sealed
1650
1689
  export interface TreeBeta {
1651
1690
  clone<const TSchema extends ImplicitFieldSchema>(node: TreeFieldFromImplicitField<TSchema>): TreeFieldFromImplicitField<TSchema>;
@@ -1681,14 +1720,8 @@ export interface TreeBranchAlpha extends TreeBranch, TreeContextAlpha {
1681
1720
  }
1682
1721
 
1683
1722
  // @alpha @sealed
1684
- export interface TreeBranchEvents extends Omit<TreeViewEvents, "commitApplied"> {
1723
+ export interface TreeBranchEvents {
1685
1724
  changed(data: ChangeMetadata, getRevertible?: RevertibleAlphaFactory): void;
1686
- commitApplied(data: ChangeMetadata, getRevertible?: RevertibleAlphaFactory): void;
1687
- }
1688
-
1689
- // @alpha @sealed
1690
- export interface TreeBranchFork extends BranchableTree, IDisposable {
1691
- rebaseOnto(branch: BranchableTree): void;
1692
1725
  }
1693
1726
 
1694
1727
  // @public @sealed
@@ -1697,6 +1730,11 @@ export interface TreeChangeEvents {
1697
1730
  treeChanged(): void;
1698
1731
  }
1699
1732
 
1733
+ // @alpha @sealed
1734
+ export interface TreeChangeEventsAlpha<TNode extends TreeNode = TreeNode> extends TreeChangeEvents {
1735
+ nodeChanged: (data: NodeChangedDataAlpha<TNode>) => void;
1736
+ }
1737
+
1700
1738
  // @beta @sealed
1701
1739
  export interface TreeChangeEventsBeta<TNode extends TreeNode = TreeNode> extends TreeChangeEvents {
1702
1740
  nodeChanged: (data: NodeChangedData<TNode> & (TNode extends WithType<string, NodeKind.Map | NodeKind.Object | NodeKind.Record> ? Required<Pick<NodeChangedData<TNode>, "changedProperties">> : unknown)) => void;
package/dist/api.d.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import type { TreeView, TreeViewAlpha, TreeViewBeta, ImplicitFieldSchema, TreeViewConfiguration, TreeViewConfigurationAlpha } from "./simple-tree/index.js";
5
+ import type { TreeView, TreeViewAlpha, TreeViewBeta, ImplicitAllowedTypes, ImplicitFieldSchema, TreeViewConfiguration, TreeViewConfigurationAlpha, TreeArrayNode, TreeArrayNodeAlpha } from "./simple-tree/index.js";
6
6
  /**
7
7
  * Module entry points for retrieving alternate (alpha/beta) versions of tree APIs.
8
8
  * For each API (usually a class) that has an alpha/beta version, add overloads to the function(s) below.
@@ -18,6 +18,11 @@ export declare function asAlpha<TSchema extends ImplicitFieldSchema>(view: TreeV
18
18
  * @alpha
19
19
  */
20
20
  export declare function asAlpha<TSchema extends ImplicitFieldSchema>(view: TreeViewConfiguration<TSchema>): TreeViewConfigurationAlpha<TSchema>;
21
+ /**
22
+ * Retrieve the {@link TreeArrayNodeAlpha | alpha API} for a {@link (TreeArrayNode:interface)}.
23
+ * @alpha
24
+ */
25
+ export declare function asAlpha<TAllowedTypes extends ImplicitAllowedTypes>(node: TreeArrayNode<TAllowedTypes>): TreeArrayNodeAlpha<TAllowedTypes>;
21
26
  /**
22
27
  * Retrieve the {@link TreeViewBeta | beta API} for a {@link TreeView}.
23
28
  * @beta
package/dist/api.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,QAAQ,EACR,aAAa,EACb,YAAY,EACZ,mBAAmB,EACnB,qBAAqB,EACrB,0BAA0B,EAC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AE,QAAQ,CAAC,OAAO,CAAC,GACrB,YAAY,CAAC,OAAO,CAAC,CAEvB"}
package/dist/api.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAiCH;;GAEG;AACH,SAAgB,OAAO,CAAC,IAAa;IACpC,OAAO,IAAI,CAAC;AACb,CAAC;AAFD,0BAEC;AAED;;;GAGG;AACH,SAAgB,MAAM,CACrB,IAAuB;IAEvB,OAAO,IAA6B,CAAC;AACtC,CAAC;AAJD,wBAIC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tTreeView,\n\tTreeViewAlpha,\n\tTreeViewBeta,\n\tImplicitFieldSchema,\n\tTreeViewConfiguration,\n\tTreeViewConfigurationAlpha,\n} from \"./simple-tree/index.js\";\n\n/**\n * Module entry points for retrieving alternate (alpha/beta) versions of tree APIs.\n * For each API (usually a class) that has an alpha/beta version, add overloads to the function(s) below.\n * These functions should only be used by external consumers, not referenced internally within the tree package, to avoid circular import dependencies.\n */\n\n/**\n * Retrieve the {@link TreeViewAlpha | alpha API} for a {@link TreeView}.\n * @alpha\n */\nexport function asAlpha<TSchema extends ImplicitFieldSchema>(\n\tview: TreeView<TSchema>,\n): TreeViewAlpha<TSchema>;\n\n/**\n * Retrieve the {@link TreeViewConfigurationAlpha | alpha API} for a {@link TreeViewConfiguration}.\n * @alpha\n */\nexport function asAlpha<TSchema extends ImplicitFieldSchema>(\n\tview: TreeViewConfiguration<TSchema>,\n): TreeViewConfigurationAlpha<TSchema>;\n\n/**\n * Implementation of overloads for {@link asAlpha}.\n */\nexport function asAlpha(view: unknown): unknown {\n\treturn view;\n}\n\n/**\n * Retrieve the {@link TreeViewBeta | beta API} for a {@link TreeView}.\n * @beta\n */\nexport function asBeta<TSchema extends ImplicitFieldSchema>(\n\tview: TreeView<TSchema>,\n): TreeViewBeta<TSchema> {\n\treturn view as TreeViewBeta<TSchema>;\n}\n"]}
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AA4CH;;GAEG;AACH,SAAgB,OAAO,CAAC,IAAa;IACpC,OAAO,IAAI,CAAC;AACb,CAAC;AAFD,0BAEC;AAED;;;GAGG;AACH,SAAgB,MAAM,CACrB,IAAuB;IAEvB,OAAO,IAA6B,CAAC;AACtC,CAAC;AAJD,wBAIC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tTreeView,\n\tTreeViewAlpha,\n\tTreeViewBeta,\n\tImplicitAllowedTypes,\n\tImplicitFieldSchema,\n\tTreeViewConfiguration,\n\tTreeViewConfigurationAlpha,\n\tTreeArrayNode,\n\tTreeArrayNodeAlpha,\n} from \"./simple-tree/index.js\";\n\n/**\n * Module entry points for retrieving alternate (alpha/beta) versions of tree APIs.\n * For each API (usually a class) that has an alpha/beta version, add overloads to the function(s) below.\n * These functions should only be used by external consumers, not referenced internally within the tree package, to avoid circular import dependencies.\n */\n\n/**\n * Retrieve the {@link TreeViewAlpha | alpha API} for a {@link TreeView}.\n * @alpha\n */\nexport function asAlpha<TSchema extends ImplicitFieldSchema>(\n\tview: TreeView<TSchema>,\n): TreeViewAlpha<TSchema>;\n\n/**\n * Retrieve the {@link TreeViewConfigurationAlpha | alpha API} for a {@link TreeViewConfiguration}.\n * @alpha\n */\nexport function asAlpha<TSchema extends ImplicitFieldSchema>(\n\tview: TreeViewConfiguration<TSchema>,\n): TreeViewConfigurationAlpha<TSchema>;\n\n/**\n * Retrieve the {@link TreeArrayNodeAlpha | alpha API} for a {@link (TreeArrayNode:interface)}.\n * @alpha\n */\nexport function asAlpha<TAllowedTypes extends ImplicitAllowedTypes>(\n\tnode: TreeArrayNode<TAllowedTypes>,\n): TreeArrayNodeAlpha<TAllowedTypes>;\n\n/**\n * Implementation of overloads for {@link asAlpha}.\n */\nexport function asAlpha(view: unknown): unknown {\n\treturn view;\n}\n\n/**\n * Retrieve the {@link TreeViewBeta | beta API} for a {@link TreeView}.\n * @beta\n */\nexport function asBeta<TSchema extends ImplicitFieldSchema>(\n\tview: TreeView<TSchema>,\n): TreeViewBeta<TSchema> {\n\treturn view as TreeViewBeta<TSchema>;\n}\n"]}
@@ -166,6 +166,24 @@ export interface CodecWriteOptions extends ICodecOptions, CodecWriteOptionsBeta
166
166
  export interface IJsonCodec<TDecoded, TEncoded = JsonCompatibleReadOnly, TValidate = TEncoded, TContext = void> extends IEncoder<TDecoded, TEncoded, TContext>, IDecoder<TDecoded, TValidate, TContext> {
167
167
  encodedSchema?: TAnySchema;
168
168
  }
169
+ /**
170
+ * Part of a codec.
171
+ * @remarks
172
+ * Encode and decode logic and schema for some chunk of data.
173
+ * Can be composed into larger codecs, and eventually versioned at the top level using
174
+ * {@link VersionDispatchingCodecBuilder}.
175
+ *
176
+ * This portion of a codec is not responsible for managing versioning or validation of the data against the schema.
177
+ */
178
+ export interface JsonCodecPart<TDecoded, TEncodedSchema extends TAnySchema, TContext = void> extends IEncoder<TDecoded, Static<TEncodedSchema>, TContext>, IDecoder<TDecoded, Static<TEncodedSchema>, TContext> {
179
+ /**
180
+ * TypeBox schema which describes the encoded format for this chunk of data.
181
+ * @remarks
182
+ * The user of this codec can use this to build its own larger schema,
183
+ * until eventually it is provided to the {@link VersionDispatchingCodecBuilder}.
184
+ */
185
+ encodedSchema: TEncodedSchema;
186
+ }
169
187
  /**
170
188
  * Type erase the more detailed encoded type from a codec.
171
189
  */
@@ -371,9 +389,17 @@ export declare const FluidClientVersion: {
371
389
  * If in the future for some reason this becomes not okay, runtime-utils could instead export a function that performs that cleanup logic which could be reused here.
372
390
  */
373
391
  export declare const currentVersion: MinimumVersionForCollab;
374
- export interface CodecTree {
392
+ /**
393
+ * TODO:
394
+ * This needs to be documented.
395
+ * Its documentation should cover at least the following:
396
+ * - Is this used for anything other than testing.
397
+ * - What should be included as children. For example should it include versioned codecs which dispatch base on the min version for collaboration? If so, what version of them should be used?
398
+ * - What risks does having this mitigate?
399
+ */
400
+ export interface CodecTree<TFormatVersion extends FormatVersion = FormatVersion> {
375
401
  readonly name: string;
376
- readonly version: FormatVersion;
402
+ readonly version: TFormatVersion;
377
403
  readonly children?: readonly CodecTree[];
378
404
  }
379
405
  export declare function jsonableCodecTree(tree: CodecTree): JsonCompatibleReadOnly;
@@ -1 +1 @@
1
- {"version":3,"file":"codec.d.ts","sourceRoot":"","sources":["../../src/codec/codec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAE3E,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AAE5F,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAErE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAE/D;;;GAGG;AACH,MAAM,WAAW,QAAQ,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ;IACrD;;OAEG;IACH,MAAM,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,GAAG,QAAQ,CAAC;CACnD;AAED;;;GAGG;AACH,MAAM,WAAW,QAAQ,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ;IACrD;;OAEG;IACH,MAAM,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,GAAG,QAAQ,CAAC;CACnD;AAED;;;GAGG;AACH,MAAM,WAAW,wBAAwB,CAAC,MAAM,SAAS,OAAO;IAC/D;;OAEG;IACH,KAAK,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,MAAM,CAAC,MAAM,CAAC,CAAC;CAC7C;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,WAAW,eAAgB,SAAQ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;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,eAAO,MAAM,kBAAkB;IAC9B;;;;;;OAMG;IAGH;;OAEG;;IAGH,4CAA4C;IAM5C;;;;;;;;OAQG;;IAGH;;;;;OAKG;;IAGH;;;;;OAKG;;IAGH;;;;;;;;;;;OAWG;;IAGH;;;;;;;;OAQG;;CAEwD,CAAC;AAE7D;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,cAAc,EAAE,uBAA2D,CAAC;AAEzF;;;;;;;GAOG;AACH,MAAM,WAAW,SAAS,CAAC,cAAc,SAAS,aAAa,GAAG,aAAa;IAC9E,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;IACjC,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,SAAS,EAAE,CAAC;CACzC;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,SAAS,GAAG,sBAAsB,CAMzE"}
@@ -119,6 +119,7 @@ function withSchemaValidation(schema, codec, validator) {
119
119
  }
120
120
  return codec.decode(encoded, context);
121
121
  },
122
+ encodedSchema: schema,
122
123
  };
123
124
  }
124
125
  exports.withSchemaValidation = withSchemaValidation;
@@ -1 +1 @@
1
- {"version":3,"file":"codec.js","sourceRoot":"","sources":["../../src/codec/codec.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,kEAAmE;AAEnE,qEAAoH;AA0DpH;;;;GAIG;AACH,MAAM,aAAa,GAAkB;IACpC,OAAO,EAAE,GAA2B,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,IAAI,EAA0B,EAAE,CAAC,IAAI,EAAE,CAAC;CAC1F,CAAC;AAEF;;;GAGG;AACU,QAAA,mBAAmB,GAAG,iBAAiB,CAAC,aAAa,CAAC,CAAC;AAEpE;;GAEG;AACH,SAAgB,iBAAiB,CAAC,OAAsB;IACvD,OAAO,OAAqC,CAAC;AAC9C,CAAC;AAFD,8CAEC;AAED;;GA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CAAC,CAAC;YACtD,CAAC;YACD,OAAO,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACvC,CAAC;KACD,CAAC;AACH,CAAC;AA9BD,oDA8BC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACU,QAAA,kBAAkB,GAAG;IACjC;;;;;;OAMG;IACH,gBAAgB;IAEhB;;OAEG;IACH,IAAI,EAAE,OAAO;IAEb,4CAA4C;IAC5C,8HAA8H;IAC9H,0GAA0G;IAC1G,sEAAsE;IACtE,eAAe;IAEf;;;;;;;;OAQG;IACH,KAAK,EAAE,QAAQ;IAEf;;;;;OAKG;IACH,KAAK,EAAE,QAAQ;IAEf;;;;;OAKG;IACH,KAAK,EAAE,QAAQ;IAEf;;;;;;;;;;;OAWG;IACH,KAAK,EAAE,QAAQ;IAEf;;;;;;;;OAQG;IACH,KAAK,EAAE,QAAQ;CAC4C,CAAC;AAE7D;;;;;;;;;;;;;;;GAeG;AACU,QAAA,cAAc,GAA4B,gCAAiC,CAAC;AAQzF,SAAgB,iBAAiB,CAAC,IAAe;IAChD,OAAO;QACN,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,OAAO,EAAE,IAAI,CAAC,OAAO,IAAI,MAAM;QAC/B,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,iBAAiB,CAAC;KAC/C,CAAC;AACH,CAAC;AAND,8CAMC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ErasedType } from \"@fluidframework/core-interfaces/internal\";\nimport { assert, fail } from \"@fluidframework/core-utils/internal\";\nimport type { MinimumVersionForCollab } from \"@fluidframework/runtime-definitions/internal\";\nimport { cleanedPackageVersion as runtimeUtilsCleanedPackageVersion } from \"@fluidframework/runtime-utils/internal\";\nimport type { Static, TAnySchema, TSchema } from \"@sinclair/typebox\";\n\nimport type { JsonCompatibleReadOnly } from \"../util/index.js\";\n\n/**\n * Translates decoded data to encoded data.\n * @remarks Typically paired with an {@link IEncoder}.\n */\nexport interface IEncoder<TDecoded, TEncoded, TContext> {\n\t/**\n\t * Encodes `obj` into some encoded format.\n\t */\n\tencode(obj: TDecoded, context: TContext): TEncoded;\n}\n\n/**\n * Translates encoded data to decoded data.\n * @remarks Typically paired with an {@link IEncoder}.\n */\nexport interface IDecoder<TDecoded, TEncoded, TContext> {\n\t/**\n\t * Decodes `obj` from some encoded format.\n\t */\n\tdecode(obj: TEncoded, context: TContext): TDecoded;\n}\n\n/**\n * Validates data complies with some particular schema.\n * Implementations are typically created by a {@link JsonValidator}.\n */\nexport interface SchemaValidationFunction<Schema extends TSchema> {\n\t/**\n\t * Returns whether the data matches a schema.\n\t */\n\tcheck(data: unknown): data is Static<Schema>;\n}\n\n/**\n * A kind of validator for SharedTree's internal data formats.\n * @remarks\n * Assuming no data corruption or type confusion, such validation should never fail.\n * Any client version compatibility issues should instead be detected by the data format versioning which Shared Tree does internally independent of data format validation.\n * However, persisted data can sometimes be corrupted, bugs can produce invalid data, or users can mix up which data is compatible with which APIs.\n * In such cases, a format validator can help catch issues.\n *\n * Current options are {@link FormatValidatorNoOp} and {@link FormatValidatorBasic}.\n * @privateRemarks\n * Implement using {@link toFormatValidator}.\n * Consume using {@link extractJsonValidator}.\n *\n * Exposing this as the stable API entry point (instead of {@link JsonValidator}) means that we avoid leaking the reference to TypeBox to the API surface.\n * Additionally, if we adopt non JSON formats, we can just update the validators as needed without breaking the API.\n * This also allows us to avoid stabilizing or documenting how handles interact with JSON validation since that is not exposed through this type.\n * @sealed @alpha\n */\nexport interface FormatValidator extends ErasedType<\"FormatValidator\"> {}\n\n/**\n * A {@link JsonValidator} implementation which performs no validation and accepts all data as valid.\n * @privateRemarks Having this as an option unifies opting out of validation with selection of\n * validators, simplifying code performing validation.\n */\nconst noopValidator: JsonValidator = {\n\tcompile: <Schema extends TSchema>() => ({ check: (data): data is Static<Schema> => true }),\n};\n\n/**\n * A {@link FormatValidator} which does no validation.\n * @alpha\n */\nexport const FormatValidatorNoOp = toFormatValidator(noopValidator);\n\n/**\n * Type erase a {@link JsonValidator} to a {@link FormatValidator}.\n */\nexport function toFormatValidator(factory: JsonValidator): FormatValidator {\n\treturn factory as unknown as FormatValidator;\n}\n\n/**\n * Un-type-erase the {@link FormatValidator}.\n */\nexport function extractJsonValidator(input: FormatValidator | JsonValidator): JsonValidator {\n\treturn input as unknown as JsonValidator;\n}\n\n/**\n * JSON schema validator compliant with draft 6 schema. See https://json-schema.org.\n * @alpha @input\n */\nexport interface JsonValidator {\n\t/**\n\t * Compiles the provided JSON schema into a validator for that schema.\n\t * @param schema - A valid draft 6 JSON schema\n\t * @remarks IFluidHandles--which have circular property references--are used in various places in SharedTree's persisted\n\t * format. Handles should only be contained in sections of data which are validated against the empty schema `{}`\n\t * (see https://datatracker.ietf.org/doc/html/draft-wright-json-schema-01#section-4.4).\n\t *\n\t * Implementations of `JsonValidator` must therefore tolerate these values, despite the input not being valid JSON.\n\t */\n\tcompile<Schema extends TSchema>(schema: Schema): SchemaValidationFunction<Schema>;\n}\n\n/**\n * Options relating to handling of persisted data.\n *\n * @see {@link CodecWriteOptions} for options that are specific to encoding data.\n * @alpha @input\n */\nexport interface ICodecOptions {\n\t/**\n\t * {@link FormatValidator} which SharedTree uses to validate persisted data it reads & writes\n\t * matches the expected encoded format (i.e. the wire format for ops and summaries).\n\t * @remarks\n\t * See {@link FormatValidatorNoOp} and {@link FormatValidatorBasic} for out-of-the-box implementations.\n\t *\n\t * This option is not \"on-by-default\" because JSON schema validation comes with a small but noticeable\n\t * runtime performance cost, and popular schema validation libraries have relatively large bundle size.\n\t *\n\t * SharedTree users are still encouraged to use a non-trivial validator (i.e. not `FormatValidatorNoOp`)\n\t * whenever reasonable: it gives better fail-fast behavior when unexpected encoded data is found,\n\t * which reduces the risk of unrecoverable data corruption.\n\t * @privateRemarks\n\t * This property should probably be renamed to `validator` before stabilizing the API.\n\t */\n\treadonly jsonValidator: FormatValidator;\n}\n\n/**\n * Options relating to encoding of persisted data.\n * @input @beta\n */\nexport interface CodecWriteOptionsBeta {\n\t/**\n\t * The minimum version of the Fluid Framework client output must be encoded to be compatible with.\n\t * @remarks\n\t * This is used to ensure that the the output from this codec can be used with older versions of the Fluid Framework client.\n\t * This includes both concurrent collaboration, and an older version opening the document later.\n\t *\n\t * Note that versions older than this should not result in data corruption if they access the data:\n\t * the data's format should be versioned and if they can't handle the format they should error.\n\t */\n\treadonly minVersionForCollab: MinimumVersionForCollab;\n}\n\n/**\n * Options relating to encoding of persisted data.\n * @remarks\n * Extends {@link ICodecOptions} with options that are specific to encoding data.\n * @alpha @input\n */\nexport interface CodecWriteOptions extends ICodecOptions, CodecWriteOptionsBeta {\n\t/**\n\t * Overrides the version of the codec to use for encoding.\n\t * @remarks\n\t * Without an override, the selected version will be based on {@link CodecWriteOptionsBeta.minVersionForCollab}.\n\t */\n\treadonly writeVersionOverrides?: ReadonlyMap<CodecName, FormatVersion>;\n\n\t/**\n\t * If true, suppress errors when `writeVersionOverrides` selects a version which may not be compatible with the {@link CodecWriteOptionsBeta.minVersionForCollab}.\n\t */\n\treadonly allowPossiblyIncompatibleWriteVersionOverrides?: boolean;\n}\n\n/**\n * `TContext` allows passing context to the codec which may configure how data is encoded/decoded.\n * This parameter is typically used for:\n * - Codecs which can pick from multiple encoding options, and imbue the encoded data with information about which option was used.\n * The caller of such a codec can provide context about which encoding choice to make as part of the `encode` call without creating\n * additional codecs. Note that this pattern can always be implemented by having the caller create multiple codecs and selecting the\n * appropriate one, but depending on API layering this might be less ergonomic.\n * - Context for the object currently being encoded, which might enable more efficient encoding. When used in this fashion, the codec author\n * should be careful to include the context somewhere in the encoded data such that decoding can correctly round-trip.\n * For example, a composed set of codecs could implement a form of {@link https://en.wikipedia.org/wiki/Dictionary_coder | dictionary coding}\n * using a context map which was created by the top-level codec and passed to the inner codecs.\n * This pattern is used:\n * - To avoid repeatedly encoding session ids on commits (only recording it once at the top level)\n * @remarks `TEncoded` should always be valid Json (i.e. not contain functions), but due to TypeScript's handling\n * of index signatures and `JsonCompatibleReadOnly`'s index signature in the Json object case, specifying this as a\n * type-system level constraint makes code that uses this interface more difficult to write.\n *\n * If provided, `TValidate` allows the input type passed to `decode` to be different than `TEncoded`.\n * This is useful when, for example, the type being decoded is `unknown` and must be validated to be a `TEncoded` before being decoded to a `TDecoded`.\n */\nexport interface IJsonCodec<\n\tTDecoded,\n\tTEncoded = JsonCompatibleReadOnly,\n\tTValidate = TEncoded,\n\tTContext = void,\n> extends IEncoder<TDecoded, TEncoded, TContext>,\n\t\tIDecoder<TDecoded, TValidate, TContext> {\n\tencodedSchema?: TAnySchema;\n}\n\n/**\n * Type erase the more detailed encoded type from a codec.\n */\nexport function eraseEncodedType<\n\tTDecoded,\n\tTEncoded = JsonCompatibleReadOnly,\n\tTValidate = TEncoded,\n\tTContext = void,\n>(\n\tcodec: IJsonCodec<TDecoded, TEncoded, TValidate, TContext>,\n): IJsonCodec<TDecoded, TValidate, TValidate, TContext> {\n\treturn codec as unknown as IJsonCodec<TDecoded, TValidate, TValidate, TContext>;\n}\n\n/**\n * Represents a family of codecs that can be used to encode and decode data in different formats.\n * The family is identified by a format version, which is typically used to select the codec to use.\n *\n * Separating codecs into families rather than having a single codec support multiple versions (i.e. currying\n * the `formatVersion` parameter)\n * allows avoiding some duplicate work at encode/decode time, since the vast majority of document usage will not\n * involve mixed format versions.\n *\n * @privateRemarks This interface currently assumes all codecs in a family require the same encode/decode context,\n * which isn't necessarily true.\n * This may need to be relaxed in the future.\n */\nexport interface ICodecFamily<TDecoded, TContext = void> {\n\t/**\n\t * @returns a codec that can be used to encode and decode data in the specified format.\n\t * @throws if the format version is not supported by this family.\n\t * @remarks Implementations should typically emit telemetry (either indirectly by throwing a well-known error with\n\t * logged properties or directly using some logger) when a format version is requested that is not supported.\n\t * This ensures that applications can diagnose compatibility issues.\n\t */\n\tresolve(\n\t\tformatVersion: FormatVersion,\n\t): IJsonCodec<TDecoded, JsonCompatibleReadOnly, JsonCompatibleReadOnly, TContext>;\n\n\t/**\n\t * @returns an iterable of all format versions supported by this family.\n\t */\n\tgetSupportedFormats(): Iterable<FormatVersion>;\n}\n\n/**\n * A version stamp for encoded data.\n * @remarks\n * Strings are used for formats that are not yet officially supported.\n * When such formats become officially supported/stable, they will be switched to using a number.\n * Undefined is tolerated to enable the scenario where data was not initially versioned.\n * @alpha\n */\nexport type FormatVersion = number | string | undefined;\n\n/**\n * A unique name given to this codec family.\n * @remarks\n * This is not persisted: it is only used to specify version overrides and in errors.\n * @alpha\n */\nexport type CodecName = string;\n\n/**\n * A format version which is dependent on some parent format version.\n */\nexport interface DependentFormatVersion<\n\tTParentVersion extends FormatVersion = FormatVersion,\n\tTChildVersion extends FormatVersion = FormatVersion,\n> {\n\t/**\n\t * Looks up the child format version for a given parent format version.\n\t * @param parent - The parent format version.\n\t * @returns The corresponding child format version.\n\t */\n\tlookup(parent: TParentVersion): TChildVersion;\n}\n\nexport class UniqueDependentFormatVersion<TChildVersion extends FormatVersion>\n\timplements DependentFormatVersion<FormatVersion, TChildVersion>\n{\n\tpublic constructor(private readonly child: TChildVersion) {}\n\tpublic lookup(_parent: FormatVersion): TChildVersion {\n\t\treturn this.child;\n\t}\n}\n\nexport class MappedDependentFormatVersion<\n\tTParentVersion extends FormatVersion = FormatVersion,\n\tTChildVersion extends FormatVersion = FormatVersion,\n> implements DependentFormatVersion<TParentVersion, TChildVersion>\n{\n\tpublic constructor(private readonly map: ReadonlyMap<TParentVersion, TChildVersion>) {}\n\tpublic lookup(parent: TParentVersion): TChildVersion {\n\t\treturn this.map.get(parent) ?? fail(0xc73 /* Unknown parent version */);\n\t}\n}\n\nexport const DependentFormatVersion = {\n\tfromUnique: <TChildVersion extends FormatVersion>(\n\t\tchild: TChildVersion,\n\t): UniqueDependentFormatVersion<TChildVersion> => new UniqueDependentFormatVersion(child),\n\tfromMap: <TParentVersion extends FormatVersion, TChildVersion extends FormatVersion>(\n\t\tmap: ReadonlyMap<TParentVersion, TChildVersion>,\n\t): MappedDependentFormatVersion<TParentVersion, TChildVersion> =>\n\t\tnew MappedDependentFormatVersion(map),\n\tfromPairs: <TParentVersion extends FormatVersion, TChildVersion extends FormatVersion>(\n\t\tpairs: Iterable<[TParentVersion, TChildVersion]>,\n\t): MappedDependentFormatVersion<TParentVersion, TChildVersion> =>\n\t\tnew MappedDependentFormatVersion(new Map(pairs)),\n};\n\n/**\n * Creates a codec family from a registry of codecs.\n */\nexport function makeCodecFamily<TDecoded, TContext>(\n\tregistry: Iterable<\n\t\t[\n\t\t\tformatVersion: FormatVersion,\n\t\t\tcodec: IJsonCodec<TDecoded, JsonCompatibleReadOnly, JsonCompatibleReadOnly, TContext>,\n\t\t]\n\t>,\n): ICodecFamily<TDecoded, TContext> {\n\tconst codecs: Map<\n\t\tFormatVersion,\n\t\tIJsonCodec<TDecoded, JsonCompatibleReadOnly, JsonCompatibleReadOnly, TContext>\n\t> = new Map();\n\tfor (const [formatVersion, codec] of registry) {\n\t\tif (codecs.has(formatVersion)) {\n\t\t\tfail(0xabf /* Duplicate codecs specified. */);\n\t\t}\n\t\tcodecs.set(formatVersion, codec);\n\t}\n\n\treturn {\n\t\tresolve(\n\t\t\tformatVersion: FormatVersion,\n\t\t): IJsonCodec<TDecoded, JsonCompatibleReadOnly, JsonCompatibleReadOnly, TContext> {\n\t\t\tconst codec = codecs.get(formatVersion);\n\t\t\tassert(codec !== undefined, 0x5e6 /* Requested codec for unsupported format. */);\n\t\t\treturn codec;\n\t\t},\n\t\tgetSupportedFormats(): Iterable<FormatVersion> {\n\t\t\treturn codecs.keys();\n\t\t},\n\t};\n}\n\n/**\n * Codec for objects which carry no information.\n */\nexport const unitCodec: IJsonCodec<\n\t0,\n\tJsonCompatibleReadOnly,\n\tJsonCompatibleReadOnly,\n\tunknown\n> = {\n\tencode: () => 0,\n\tdecode: () => 0,\n};\n\n/**\n * Wraps a codec with JSON schema validation for its encoded type.\n * @returns An {@link IJsonCodec} which validates the data it encodes and decodes matches the provided schema.\n * @remarks\n * Eventually all codecs should use the same pattern implemented by ClientVersionDispatchingCodecBuilder, resulting in that having the only use of this API.\n */\nexport function withSchemaValidation<\n\tTInMemoryFormat,\n\tEncodedSchema extends TSchema,\n\tTEncodedFormat,\n\tTValidate,\n\tTContext,\n>(\n\tschema: EncodedSchema,\n\tcodec: IJsonCodec<TInMemoryFormat, TEncodedFormat, TValidate, TContext>,\n\tvalidator?: JsonValidator | FormatValidator,\n): IJsonCodec<TInMemoryFormat, TEncodedFormat, TValidate, TContext> {\n\tif (!validator) {\n\t\treturn codec;\n\t}\n\tconst compiledFormat = extractJsonValidator(validator).compile(schema);\n\treturn {\n\t\tencode: (obj: TInMemoryFormat, context: TContext): TEncodedFormat => {\n\t\t\tconst encoded = codec.encode(obj, context);\n\t\t\tif (!compiledFormat.check(encoded)) {\n\t\t\t\tfail(0xac0 /* Encoded data should validate */);\n\t\t\t}\n\t\t\treturn encoded;\n\t\t},\n\t\tdecode: (encoded: TValidate, context: TContext): TInMemoryFormat => {\n\t\t\tif (!compiledFormat.check(encoded)) {\n\t\t\t\tfail(0xac1 /* Data being decoded should validate */);\n\t\t\t}\n\t\t\treturn codec.decode(encoded, context);\n\t\t},\n\t};\n}\n\n/**\n * Versions of Fluid Framework client packages.\n * @remarks\n * Used to express compatibility requirements by indicating the oldest version with which compatibility must be maintained.\n *\n * When no compatibility-impacting change is made in a given version, the value associated with its enum entry may point to the older version which it's fully compatible with.\n * Note that this can change if a future version of the framework introduces an option to use something which is only supported at a particular version. In which case, the values of the enum may shift,\n * but the semantics of keys in this enum will not change.\n *\n * Do not depend on the value of this enums's entries: only depend on the keys (enum members) themselves.\n *\n * Some release may also be omitted if there is currently no need to express that specific version.\n * If the need arises, they might be added in the future.\n *\n * @privateRemarks\n * The entries in these enums should document the following:\n * - The user facing impact of opting into a particular version. This will help customers decide if they want to opt into\n * a new version. For example, document if there is an encoding efficiency improvement of oping into that version or newer.\n * - Any new data formats that are introduced in that version. This will help developers tell which data formats a given\n * version will write. For example, document if a new summary or encoding format is added in a version.\n * - Whether the above features or data formats introduced in a version are enabled by default or require the\n * {@link minVersionForCollab} option to be set to that particular version.\n *\n * Versions with no notable impact can be omitted.\n *\n * This scheme assumes a single version will always be enough to communicate compatibility.\n * For this to work, compatibility has to be strictly increasing.\n * If this is violated (for example a subset of incompatible features from 3.x that are not in 3.0 are back ported to 2.x),\n * a more complex scheme may be needed to allow safely opting into incompatible features in those cases:\n * such a system can be added if/when its needed since it will be opt in and thus non-breaking.\n *\n * TODO: this should likely be defined higher in the stack and specified when creating the container, possibly as part of its schema.\n * TODO: compatibility requirements for how this enum can and cannot be changed should be clarified when/if it's used across multiple layers in the stack.\n * For example, if needed, would adding more leading zeros to the minor version break things.\n * @alpha\n */\nexport const FluidClientVersion = {\n\t/**\n\t * Fluid Framework Client 1.4 and newer.\n\t * @remarks\n\t * This opts into support for the 1.4 LTS branch.\n\t * @privateRemarks\n\t * As long as this code is in Tree, there is no reason to have this option as SharedTree did not exist in 1.4.\n\t */\n\t// v1_4 = 1.004,\n\n\t/**\n\t * Fluid Framework Client 2.0 and newer.\n\t */\n\tv2_0: \"2.0.0\",\n\n\t/** Fluid Framework Client 2.1 and newer. */\n\t// If we think we might want to start allowing opting into something that landed in 2.1 (without opting into something newer),\n\t// we could add an entry like this to allow users to indicate that they can be opted in once we are ready,\n\t// then update it to \"2.001\" once we actually have the opt in working.\n\t// v2_1 = v2_0,\n\n\t/**\n\t * Fluid Framework Client 2.43 and newer.\n\t * @remarks\n\t * New formats introduced in 2.43:\n\t * - SchemaFormatVersion.v2 - written when minVersionForCollab \\>= 2.43\n\t * - MessageFormatVersion.v4 - written when minVersionForCollab \\>= 2.43\n\t * - EditManagerFormatVersion.v4 - written when minVersionForCollab \\>= 2.43\n\t * - sequence-field/formatV3 - written when minVersionForCollab \\>= 2.43\n\t */\n\tv2_43: \"2.43.0\",\n\n\t/**\n\t * Fluid Framework Client 2.52 and newer.\n\t * @remarks\n\t * New formats introduced in 2.52:\n\t * - DetachedFieldIndexFormatVersion.v2 - written when minVersionForCollab \\>= 2.52\n\t */\n\tv2_52: \"2.52.0\",\n\n\t/**\n\t * Fluid Framework Client 2.73 and newer.\n\t * @remarks\n\t * New formats introduced in 2.73:\n\t * - FieldBatchFormatVersion.v2 - written when minVersionForCollab \\>= 2.73\n\t */\n\tv2_73: \"2.73.0\",\n\n\t/**\n\t * Fluid Framework Client 2.74 and newer.\n\t * @remarks\n\t * New formats introduced in 2.74:\n\t * - SharedTreeSummaryFormatVersion.v2 - written by default\n\t * - DetachedFieldIndexSummaryFormatVersion.v2 - written by default\n\t * - SchemaSummaryFormatVersion.v2 - written by default\n\t * - EditManagerSummaryFormatVersion.v2 - written by default\n\t * - ForestSummaryFormatVersion.v2 - written by default\n\t * - ForestFormatVersion.v2 - written when minVersionForCollab \\>= 2.74\n\t * - ForestSummaryFormatVersion.v3 - written when minVersionForCollab \\>= 2.74\n\t */\n\tv2_74: \"2.74.0\",\n\n\t/**\n\t * Fluid Framework Client 2.80 and newer.\n\t * @remarks\n\t * New formats introduced in 2.80:\n\t * - MessageFormatVersion.v6 - written when minVersionForCollab \\>= 2.80\n\t * - EditManagerFormatVersion.v6 - written when minVersionForCollab \\>= 2.80\n\t * - SharedTreeChangeFormatVersion.v5 - written when minVersionForCollab \\>= 2.80\n\t * - ModularChangeFormatVersion.v5 - written when minVersionForCollab \\>= 2.80\n\t */\n\tv2_80: \"2.80.0\",\n} as const satisfies Record<string, MinimumVersionForCollab>;\n\n/**\n * An up to date version which includes all stable features.\n * @remarks\n * Use for cases when data is not persisted and thus would only ever be read by the the same version of the code which read this value.\n *\n * The pkgVersion from this package (tree) can not be used here as it is not guaranteed to be a valid MinimumVersionForCollab\n * and would also unexpectedly disable features in prereleases and on CI if it didn't fail validation.\n * See {@link @fluidframework/runtime-utils/internal#cleanedPackageVersion} for more details on why cleanedPackageVersion is preferred over pkgVersion.\n *\n * @privateRemarks\n * It is safe to use CleanedPackageVersion from runtime-utils here since features are enabled in minor versions,\n * and this package (tree) depends on runtime-utils with a `~` semver range\n * ensuring that the version of runtime-utils this was imported from will match the version of this (tree) package at least up to the minor version.\n * Reusing this from runtime-utils avoids duplicating the cleanup logic here as well as the cost or recomputing it.\n * If in the future for some reason this becomes not okay, runtime-utils could instead export a function that performs that cleanup logic which could be reused here.\n */\nexport const currentVersion: MinimumVersionForCollab = runtimeUtilsCleanedPackageVersion;\n\nexport interface CodecTree {\n\treadonly name: string;\n\treadonly version: FormatVersion;\n\treadonly children?: readonly CodecTree[];\n}\n\nexport function jsonableCodecTree(tree: CodecTree): JsonCompatibleReadOnly {\n\treturn {\n\t\tname: tree.name,\n\t\tversion: tree.version ?? \"null\",\n\t\tchildren: tree.children?.map(jsonableCodecTree),\n\t};\n}\n"]}
1
+ {"version":3,"file":"codec.js","sourceRoot":"","sources":["../../src/codec/codec.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,kEAAmE;AAEnE,qEAAoH;AA0DpH;;;;GAIG;AACH,MAAM,aAAa,GAAkB;IACpC,OAAO,EAAE,GAA2B,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,IAAI,EAA0B,EAAE,CAAC,IAAI,EAAE,CAAC;CAC1F,CAAC;AAEF;;;GAGG;AACU,QAAA,mBAAmB,GAAG,iBAAiB,CAAC,aAAa,CAAC,CAAC;AAEpE;;GAEG;AACH,SAAgB,iBAAiB,CAAC,OAAsB;IACvD,OAAO,OAAqC,CAAC;AAC9C,CAAC;AAFD,8CAEC;AAED;;GAEG;AACH,SAAgB,oBAAoB,CAAC,KAAsC;IAC1E,OAAO,KAAiC,CAAC;AAC1C,CAAC;AAFD,oDAEC;AAoID;;GAEG;AACH,SAAgB,gBAAgB,CAM/B,KAA0D;IAE1D,OAAO,KAAwE,CAAC;AACjF,CAAC;AATD,4CASC;AAkED,MAAa,4BAA4B;IAGxC,YAAoC,KAAoB;QAApB,UAAK,GAAL,KAAK,CA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;IACH,gBAAgB;IAEhB;;OAEG;IACH,IAAI,EAAE,OAAO;IAEb,4CAA4C;IAC5C,8HAA8H;IAC9H,0GAA0G;IAC1G,sEAAsE;IACtE,eAAe;IAEf;;;;;;;;OAQG;IACH,KAAK,EAAE,QAAQ;IAEf;;;;;OAKG;IACH,KAAK,EAAE,QAAQ;IAEf;;;;;OAKG;IACH,KAAK,EAAE,QAAQ;IAEf;;;;;;;;;;;OAWG;IACH,KAAK,EAAE,QAAQ;IAEf;;;;;;;;OAQG;IACH,KAAK,EAAE,QAAQ;CAC4C,CAAC;AAE7D;;;;;;;;;;;;;;;GAeG;AACU,QAAA,cAAc,GAA4B,gCAAiC,CAAC;AAgBzF,SAAgB,iBAAiB,CAAC,IAAe;IAChD,OAAO;QACN,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,OAAO,EAAE,IAAI,CAAC,OAAO,IAAI,MAAM;QAC/B,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,iBAAiB,CAAC;KAC/C,CAAC;AACH,CAAC;AAND,8CAMC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ErasedType } from \"@fluidframework/core-interfaces/internal\";\nimport { assert, fail } from \"@fluidframework/core-utils/internal\";\nimport type { MinimumVersionForCollab } from \"@fluidframework/runtime-definitions/internal\";\nimport { cleanedPackageVersion as runtimeUtilsCleanedPackageVersion } from \"@fluidframework/runtime-utils/internal\";\nimport type { Static, TAnySchema, TSchema } from \"@sinclair/typebox\";\n\nimport type { JsonCompatibleReadOnly } from \"../util/index.js\";\n\n/**\n * Translates decoded data to encoded data.\n * @remarks Typically paired with an {@link IEncoder}.\n */\nexport interface IEncoder<TDecoded, TEncoded, TContext> {\n\t/**\n\t * Encodes `obj` into some encoded format.\n\t */\n\tencode(obj: TDecoded, context: TContext): TEncoded;\n}\n\n/**\n * Translates encoded data to decoded data.\n * @remarks Typically paired with an {@link IEncoder}.\n */\nexport interface IDecoder<TDecoded, TEncoded, TContext> {\n\t/**\n\t * Decodes `obj` from some encoded format.\n\t */\n\tdecode(obj: TEncoded, context: TContext): TDecoded;\n}\n\n/**\n * Validates data complies with some particular schema.\n * Implementations are typically created by a {@link JsonValidator}.\n */\nexport interface SchemaValidationFunction<Schema extends TSchema> {\n\t/**\n\t * Returns whether the data matches a schema.\n\t */\n\tcheck(data: unknown): data is Static<Schema>;\n}\n\n/**\n * A kind of validator for SharedTree's internal data formats.\n * @remarks\n * Assuming no data corruption or type confusion, such validation should never fail.\n * Any client version compatibility issues should instead be detected by the data format versioning which Shared Tree does internally independent of data format validation.\n * However, persisted data can sometimes be corrupted, bugs can produce invalid data, or users can mix up which data is compatible with which APIs.\n * In such cases, a format validator can help catch issues.\n *\n * Current options are {@link FormatValidatorNoOp} and {@link FormatValidatorBasic}.\n * @privateRemarks\n * Implement using {@link toFormatValidator}.\n * Consume using {@link extractJsonValidator}.\n *\n * Exposing this as the stable API entry point (instead of {@link JsonValidator}) means that we avoid leaking the reference to TypeBox to the API surface.\n * Additionally, if we adopt non JSON formats, we can just update the validators as needed without breaking the API.\n * This also allows us to avoid stabilizing or documenting how handles interact with JSON validation since that is not exposed through this type.\n * @sealed @alpha\n */\nexport interface FormatValidator extends ErasedType<\"FormatValidator\"> {}\n\n/**\n * A {@link JsonValidator} implementation which performs no validation and accepts all data as valid.\n * @privateRemarks Having this as an option unifies opting out of validation with selection of\n * validators, simplifying code performing validation.\n */\nconst noopValidator: JsonValidator = {\n\tcompile: <Schema extends TSchema>() => ({ check: (data): data is Static<Schema> => true }),\n};\n\n/**\n * A {@link FormatValidator} which does no validation.\n * @alpha\n */\nexport const FormatValidatorNoOp = toFormatValidator(noopValidator);\n\n/**\n * Type erase a {@link JsonValidator} to a {@link FormatValidator}.\n */\nexport function toFormatValidator(factory: JsonValidator): FormatValidator {\n\treturn factory as unknown as FormatValidator;\n}\n\n/**\n * Un-type-erase the {@link FormatValidator}.\n */\nexport function extractJsonValidator(input: FormatValidator | JsonValidator): JsonValidator {\n\treturn input as unknown as JsonValidator;\n}\n\n/**\n * JSON schema validator compliant with draft 6 schema. See https://json-schema.org.\n * @alpha @input\n */\nexport interface JsonValidator {\n\t/**\n\t * Compiles the provided JSON schema into a validator for that schema.\n\t * @param schema - A valid draft 6 JSON schema\n\t * @remarks IFluidHandles--which have circular property references--are used in various places in SharedTree's persisted\n\t * format. Handles should only be contained in sections of data which are validated against the empty schema `{}`\n\t * (see https://datatracker.ietf.org/doc/html/draft-wright-json-schema-01#section-4.4).\n\t *\n\t * Implementations of `JsonValidator` must therefore tolerate these values, despite the input not being valid JSON.\n\t */\n\tcompile<Schema extends TSchema>(schema: Schema): SchemaValidationFunction<Schema>;\n}\n\n/**\n * Options relating to handling of persisted data.\n *\n * @see {@link CodecWriteOptions} for options that are specific to encoding data.\n * @alpha @input\n */\nexport interface ICodecOptions {\n\t/**\n\t * {@link FormatValidator} which SharedTree uses to validate persisted data it reads & writes\n\t * matches the expected encoded format (i.e. the wire format for ops and summaries).\n\t * @remarks\n\t * See {@link FormatValidatorNoOp} and {@link FormatValidatorBasic} for out-of-the-box implementations.\n\t *\n\t * This option is not \"on-by-default\" because JSON schema validation comes with a small but noticeable\n\t * runtime performance cost, and popular schema validation libraries have relatively large bundle size.\n\t *\n\t * SharedTree users are still encouraged to use a non-trivial validator (i.e. not `FormatValidatorNoOp`)\n\t * whenever reasonable: it gives better fail-fast behavior when unexpected encoded data is found,\n\t * which reduces the risk of unrecoverable data corruption.\n\t * @privateRemarks\n\t * This property should probably be renamed to `validator` before stabilizing the API.\n\t */\n\treadonly jsonValidator: FormatValidator;\n}\n\n/**\n * Options relating to encoding of persisted data.\n * @input @beta\n */\nexport interface CodecWriteOptionsBeta {\n\t/**\n\t * The minimum version of the Fluid Framework client output must be encoded to be compatible with.\n\t * @remarks\n\t * This is used to ensure that the the output from this codec can be used with older versions of the Fluid Framework client.\n\t * This includes both concurrent collaboration, and an older version opening the document later.\n\t *\n\t * Note that versions older than this should not result in data corruption if they access the data:\n\t * the data's format should be versioned and if they can't handle the format they should error.\n\t */\n\treadonly minVersionForCollab: MinimumVersionForCollab;\n}\n\n/**\n * Options relating to encoding of persisted data.\n * @remarks\n * Extends {@link ICodecOptions} with options that are specific to encoding data.\n * @alpha @input\n */\nexport interface CodecWriteOptions extends ICodecOptions, CodecWriteOptionsBeta {\n\t/**\n\t * Overrides the version of the codec to use for encoding.\n\t * @remarks\n\t * Without an override, the selected version will be based on {@link CodecWriteOptionsBeta.minVersionForCollab}.\n\t */\n\treadonly writeVersionOverrides?: ReadonlyMap<CodecName, FormatVersion>;\n\n\t/**\n\t * If true, suppress errors when `writeVersionOverrides` selects a version which may not be compatible with the {@link CodecWriteOptionsBeta.minVersionForCollab}.\n\t */\n\treadonly allowPossiblyIncompatibleWriteVersionOverrides?: boolean;\n}\n\n/**\n * `TContext` allows passing context to the codec which may configure how data is encoded/decoded.\n * This parameter is typically used for:\n * - Codecs which can pick from multiple encoding options, and imbue the encoded data with information about which option was used.\n * The caller of such a codec can provide context about which encoding choice to make as part of the `encode` call without creating\n * additional codecs. Note that this pattern can always be implemented by having the caller create multiple codecs and selecting the\n * appropriate one, but depending on API layering this might be less ergonomic.\n * - Context for the object currently being encoded, which might enable more efficient encoding. When used in this fashion, the codec author\n * should be careful to include the context somewhere in the encoded data such that decoding can correctly round-trip.\n * For example, a composed set of codecs could implement a form of {@link https://en.wikipedia.org/wiki/Dictionary_coder | dictionary coding}\n * using a context map which was created by the top-level codec and passed to the inner codecs.\n * This pattern is used:\n * - To avoid repeatedly encoding session ids on commits (only recording it once at the top level)\n * @remarks `TEncoded` should always be valid Json (i.e. not contain functions), but due to TypeScript's handling\n * of index signatures and `JsonCompatibleReadOnly`'s index signature in the Json object case, specifying this as a\n * type-system level constraint makes code that uses this interface more difficult to write.\n *\n * If provided, `TValidate` allows the input type passed to `decode` to be different than `TEncoded`.\n * This is useful when, for example, the type being decoded is `unknown` and must be validated to be a `TEncoded` before being decoded to a `TDecoded`.\n */\nexport interface IJsonCodec<\n\tTDecoded,\n\tTEncoded = JsonCompatibleReadOnly,\n\tTValidate = TEncoded,\n\tTContext = void,\n> extends IEncoder<TDecoded, TEncoded, TContext>,\n\t\tIDecoder<TDecoded, TValidate, TContext> {\n\tencodedSchema?: TAnySchema;\n}\n\n/**\n * Part of a codec.\n * @remarks\n * Encode and decode logic and schema for some chunk of data.\n * Can be composed into larger codecs, and eventually versioned at the top level using\n * {@link VersionDispatchingCodecBuilder}.\n *\n * This portion of a codec is not responsible for managing versioning or validation of the data against the schema.\n */\nexport interface JsonCodecPart<TDecoded, TEncodedSchema extends TAnySchema, TContext = void>\n\textends IEncoder<TDecoded, Static<TEncodedSchema>, TContext>,\n\t\tIDecoder<TDecoded, Static<TEncodedSchema>, TContext> {\n\t/**\n\t * TypeBox schema which describes the encoded format for this chunk of data.\n\t * @remarks\n\t * The user of this codec can use this to build its own larger schema,\n\t * until eventually it is provided to the {@link VersionDispatchingCodecBuilder}.\n\t */\n\tencodedSchema: TEncodedSchema;\n}\n\n/**\n * Type erase the more detailed encoded type from a codec.\n */\nexport function eraseEncodedType<\n\tTDecoded,\n\tTEncoded = JsonCompatibleReadOnly,\n\tTValidate = TEncoded,\n\tTContext = void,\n>(\n\tcodec: IJsonCodec<TDecoded, TEncoded, TValidate, TContext>,\n): IJsonCodec<TDecoded, TValidate, TValidate, TContext> {\n\treturn codec as unknown as IJsonCodec<TDecoded, TValidate, TValidate, TContext>;\n}\n\n/**\n * Represents a family of codecs that can be used to encode and decode data in different formats.\n * The family is identified by a format version, which is typically used to select the codec to use.\n *\n * Separating codecs into families rather than having a single codec support multiple versions (i.e. currying\n * the `formatVersion` parameter)\n * allows avoiding some duplicate work at encode/decode time, since the vast majority of document usage will not\n * involve mixed format versions.\n *\n * @privateRemarks This interface currently assumes all codecs in a family require the same encode/decode context,\n * which isn't necessarily true.\n * This may need to be relaxed in the future.\n */\nexport interface ICodecFamily<TDecoded, TContext = void> {\n\t/**\n\t * @returns a codec that can be used to encode and decode data in the specified format.\n\t * @throws if the format version is not supported by this family.\n\t * @remarks Implementations should typically emit telemetry (either indirectly by throwing a well-known error with\n\t * logged properties or directly using some logger) when a format version is requested that is not supported.\n\t * This ensures that applications can diagnose compatibility issues.\n\t */\n\tresolve(\n\t\tformatVersion: FormatVersion,\n\t): IJsonCodec<TDecoded, JsonCompatibleReadOnly, JsonCompatibleReadOnly, TContext>;\n\n\t/**\n\t * @returns an iterable of all format versions supported by this family.\n\t */\n\tgetSupportedFormats(): Iterable<FormatVersion>;\n}\n\n/**\n * A version stamp for encoded data.\n * @remarks\n * Strings are used for formats that are not yet officially supported.\n * When such formats become officially supported/stable, they will be switched to using a number.\n * Undefined is tolerated to enable the scenario where data was not initially versioned.\n * @alpha\n */\nexport type FormatVersion = number | string | undefined;\n\n/**\n * A unique name given to this codec family.\n * @remarks\n * This is not persisted: it is only used to specify version overrides and in errors.\n * @alpha\n */\nexport type CodecName = string;\n\n/**\n * A format version which is dependent on some parent format version.\n */\nexport interface DependentFormatVersion<\n\tTParentVersion extends FormatVersion = FormatVersion,\n\tTChildVersion extends FormatVersion = FormatVersion,\n> {\n\t/**\n\t * Looks up the child format version for a given parent format version.\n\t * @param parent - The parent format version.\n\t * @returns The corresponding child format version.\n\t */\n\tlookup(parent: TParentVersion): TChildVersion;\n}\n\nexport class UniqueDependentFormatVersion<TChildVersion extends FormatVersion>\n\timplements DependentFormatVersion<FormatVersion, TChildVersion>\n{\n\tpublic constructor(private readonly child: TChildVersion) {}\n\tpublic lookup(_parent: FormatVersion): TChildVersion {\n\t\treturn this.child;\n\t}\n}\n\nexport class MappedDependentFormatVersion<\n\tTParentVersion extends FormatVersion = FormatVersion,\n\tTChildVersion extends FormatVersion = FormatVersion,\n> implements DependentFormatVersion<TParentVersion, TChildVersion>\n{\n\tpublic constructor(private readonly map: ReadonlyMap<TParentVersion, TChildVersion>) {}\n\tpublic lookup(parent: TParentVersion): TChildVersion {\n\t\treturn this.map.get(parent) ?? fail(0xc73 /* Unknown parent version */);\n\t}\n}\n\nexport const DependentFormatVersion = {\n\tfromUnique: <TChildVersion extends FormatVersion>(\n\t\tchild: TChildVersion,\n\t): UniqueDependentFormatVersion<TChildVersion> => new UniqueDependentFormatVersion(child),\n\tfromMap: <TParentVersion extends FormatVersion, TChildVersion extends FormatVersion>(\n\t\tmap: ReadonlyMap<TParentVersion, TChildVersion>,\n\t): MappedDependentFormatVersion<TParentVersion, TChildVersion> =>\n\t\tnew MappedDependentFormatVersion(map),\n\tfromPairs: <TParentVersion extends FormatVersion, TChildVersion extends FormatVersion>(\n\t\tpairs: Iterable<[TParentVersion, TChildVersion]>,\n\t): MappedDependentFormatVersion<TParentVersion, TChildVersion> =>\n\t\tnew MappedDependentFormatVersion(new Map(pairs)),\n};\n\n/**\n * Creates a codec family from a registry of codecs.\n */\nexport function makeCodecFamily<TDecoded, TContext>(\n\tregistry: Iterable<\n\t\t[\n\t\t\tformatVersion: FormatVersion,\n\t\t\tcodec: IJsonCodec<TDecoded, JsonCompatibleReadOnly, JsonCompatibleReadOnly, TContext>,\n\t\t]\n\t>,\n): ICodecFamily<TDecoded, TContext> {\n\tconst codecs: Map<\n\t\tFormatVersion,\n\t\tIJsonCodec<TDecoded, JsonCompatibleReadOnly, JsonCompatibleReadOnly, TContext>\n\t> = new Map();\n\tfor (const [formatVersion, codec] of registry) {\n\t\tif (codecs.has(formatVersion)) {\n\t\t\tfail(0xabf /* Duplicate codecs specified. */);\n\t\t}\n\t\tcodecs.set(formatVersion, codec);\n\t}\n\n\treturn {\n\t\tresolve(\n\t\t\tformatVersion: FormatVersion,\n\t\t): IJsonCodec<TDecoded, JsonCompatibleReadOnly, JsonCompatibleReadOnly, TContext> {\n\t\t\tconst codec = codecs.get(formatVersion);\n\t\t\tassert(codec !== undefined, 0x5e6 /* Requested codec for unsupported format. */);\n\t\t\treturn codec;\n\t\t},\n\t\tgetSupportedFormats(): Iterable<FormatVersion> {\n\t\t\treturn codecs.keys();\n\t\t},\n\t};\n}\n\n/**\n * Codec for objects which carry no information.\n */\nexport const unitCodec: IJsonCodec<\n\t0,\n\tJsonCompatibleReadOnly,\n\tJsonCompatibleReadOnly,\n\tunknown\n> = {\n\tencode: () => 0,\n\tdecode: () => 0,\n};\n\n/**\n * Wraps a codec with JSON schema validation for its encoded type.\n * @returns An {@link IJsonCodec} which validates the data it encodes and decodes matches the provided schema.\n * @remarks\n * Eventually all codecs should use the same pattern implemented by ClientVersionDispatchingCodecBuilder, resulting in that having the only use of this API.\n */\nexport function withSchemaValidation<\n\tTInMemoryFormat,\n\tEncodedSchema extends TSchema,\n\tTEncodedFormat,\n\tTValidate,\n\tTContext,\n>(\n\tschema: EncodedSchema,\n\tcodec: IJsonCodec<TInMemoryFormat, TEncodedFormat, TValidate, TContext>,\n\tvalidator?: JsonValidator | FormatValidator,\n): IJsonCodec<TInMemoryFormat, TEncodedFormat, TValidate, TContext> {\n\tif (!validator) {\n\t\treturn codec;\n\t}\n\tconst compiledFormat = extractJsonValidator(validator).compile(schema);\n\treturn {\n\t\tencode: (obj: TInMemoryFormat, context: TContext): TEncodedFormat => {\n\t\t\tconst encoded = codec.encode(obj, context);\n\t\t\tif (!compiledFormat.check(encoded)) {\n\t\t\t\tfail(0xac0 /* Encoded data should validate */);\n\t\t\t}\n\t\t\treturn encoded;\n\t\t},\n\t\tdecode: (encoded: TValidate, context: TContext): TInMemoryFormat => {\n\t\t\tif (!compiledFormat.check(encoded)) {\n\t\t\t\tfail(0xac1 /* Data being decoded should validate */);\n\t\t\t}\n\t\t\treturn codec.decode(encoded, context);\n\t\t},\n\t\tencodedSchema: schema,\n\t};\n}\n\n/**\n * Versions of Fluid Framework client packages.\n * @remarks\n * Used to express compatibility requirements by indicating the oldest version with which compatibility must be maintained.\n *\n * When no compatibility-impacting change is made in a given version, the value associated with its enum entry may point to the older version which it's fully compatible with.\n * Note that this can change if a future version of the framework introduces an option to use something which is only supported at a particular version. In which case, the values of the enum may shift,\n * but the semantics of keys in this enum will not change.\n *\n * Do not depend on the value of this enums's entries: only depend on the keys (enum members) themselves.\n *\n * Some release may also be omitted if there is currently no need to express that specific version.\n * If the need arises, they might be added in the future.\n *\n * @privateRemarks\n * The entries in these enums should document the following:\n * - The user facing impact of opting into a particular version. This will help customers decide if they want to opt into\n * a new version. For example, document if there is an encoding efficiency improvement of oping into that version or newer.\n * - Any new data formats that are introduced in that version. This will help developers tell which data formats a given\n * version will write. For example, document if a new summary or encoding format is added in a version.\n * - Whether the above features or data formats introduced in a version are enabled by default or require the\n * {@link minVersionForCollab} option to be set to that particular version.\n *\n * Versions with no notable impact can be omitted.\n *\n * This scheme assumes a single version will always be enough to communicate compatibility.\n * For this to work, compatibility has to be strictly increasing.\n * If this is violated (for example a subset of incompatible features from 3.x that are not in 3.0 are back ported to 2.x),\n * a more complex scheme may be needed to allow safely opting into incompatible features in those cases:\n * such a system can be added if/when its needed since it will be opt in and thus non-breaking.\n *\n * TODO: this should likely be defined higher in the stack and specified when creating the container, possibly as part of its schema.\n * TODO: compatibility requirements for how this enum can and cannot be changed should be clarified when/if it's used across multiple layers in the stack.\n * For example, if needed, would adding more leading zeros to the minor version break things.\n * @alpha\n */\nexport const FluidClientVersion = {\n\t/**\n\t * Fluid Framework Client 1.4 and newer.\n\t * @remarks\n\t * This opts into support for the 1.4 LTS branch.\n\t * @privateRemarks\n\t * As long as this code is in Tree, there is no reason to have this option as SharedTree did not exist in 1.4.\n\t */\n\t// v1_4 = 1.004,\n\n\t/**\n\t * Fluid Framework Client 2.0 and newer.\n\t */\n\tv2_0: \"2.0.0\",\n\n\t/** Fluid Framework Client 2.1 and newer. */\n\t// If we think we might want to start allowing opting into something that landed in 2.1 (without opting into something newer),\n\t// we could add an entry like this to allow users to indicate that they can be opted in once we are ready,\n\t// then update it to \"2.001\" once we actually have the opt in working.\n\t// v2_1 = v2_0,\n\n\t/**\n\t * Fluid Framework Client 2.43 and newer.\n\t * @remarks\n\t * New formats introduced in 2.43:\n\t * - SchemaFormatVersion.v2 - written when minVersionForCollab \\>= 2.43\n\t * - MessageFormatVersion.v4 - written when minVersionForCollab \\>= 2.43\n\t * - EditManagerFormatVersion.v4 - written when minVersionForCollab \\>= 2.43\n\t * - sequence-field/formatV3 - written when minVersionForCollab \\>= 2.43\n\t */\n\tv2_43: \"2.43.0\",\n\n\t/**\n\t * Fluid Framework Client 2.52 and newer.\n\t * @remarks\n\t * New formats introduced in 2.52:\n\t * - DetachedFieldIndexFormatVersion.v2 - written when minVersionForCollab \\>= 2.52\n\t */\n\tv2_52: \"2.52.0\",\n\n\t/**\n\t * Fluid Framework Client 2.73 and newer.\n\t * @remarks\n\t * New formats introduced in 2.73:\n\t * - FieldBatchFormatVersion.v2 - written when minVersionForCollab \\>= 2.73\n\t */\n\tv2_73: \"2.73.0\",\n\n\t/**\n\t * Fluid Framework Client 2.74 and newer.\n\t * @remarks\n\t * New formats introduced in 2.74:\n\t * - SharedTreeSummaryFormatVersion.v2 - written by default\n\t * - DetachedFieldIndexSummaryFormatVersion.v2 - written by default\n\t * - SchemaSummaryFormatVersion.v2 - written by default\n\t * - EditManagerSummaryFormatVersion.v2 - written by default\n\t * - ForestSummaryFormatVersion.v2 - written by default\n\t * - ForestFormatVersion.v2 - written when minVersionForCollab \\>= 2.74\n\t * - ForestSummaryFormatVersion.v3 - written when minVersionForCollab \\>= 2.74\n\t */\n\tv2_74: \"2.74.0\",\n\n\t/**\n\t * Fluid Framework Client 2.80 and newer.\n\t * @remarks\n\t * New formats introduced in 2.80:\n\t * - MessageFormatVersion.v6 - written when minVersionForCollab \\>= 2.80\n\t * - EditManagerFormatVersion.v6 - written when minVersionForCollab \\>= 2.80\n\t * - SharedTreeChangeFormatVersion.v5 - written when minVersionForCollab \\>= 2.80\n\t * - ModularChangeFormatVersion.v5 - written when minVersionForCollab \\>= 2.80\n\t */\n\tv2_80: \"2.80.0\",\n} as const satisfies Record<string, MinimumVersionForCollab>;\n\n/**\n * An up to date version which includes all stable features.\n * @remarks\n * Use for cases when data is not persisted and thus would only ever be read by the the same version of the code which read this value.\n *\n * The pkgVersion from this package (tree) can not be used here as it is not guaranteed to be a valid MinimumVersionForCollab\n * and would also unexpectedly disable features in prereleases and on CI if it didn't fail validation.\n * See {@link @fluidframework/runtime-utils/internal#cleanedPackageVersion} for more details on why cleanedPackageVersion is preferred over pkgVersion.\n *\n * @privateRemarks\n * It is safe to use CleanedPackageVersion from runtime-utils here since features are enabled in minor versions,\n * and this package (tree) depends on runtime-utils with a `~` semver range\n * ensuring that the version of runtime-utils this was imported from will match the version of this (tree) package at least up to the minor version.\n * Reusing this from runtime-utils avoids duplicating the cleanup logic here as well as the cost or recomputing it.\n * If in the future for some reason this becomes not okay, runtime-utils could instead export a function that performs that cleanup logic which could be reused here.\n */\nexport const currentVersion: MinimumVersionForCollab = runtimeUtilsCleanedPackageVersion;\n\n/**\n * TODO:\n * This needs to be documented.\n * Its documentation should cover at least the following:\n * - Is this used for anything other than testing.\n * - What should be included as children. For example should it include versioned codecs which dispatch base on the min version for collaboration? If so, what version of them should be used?\n * - What risks does having this mitigate?\n */\nexport interface CodecTree<TFormatVersion extends FormatVersion = FormatVersion> {\n\treadonly name: string;\n\treadonly version: TFormatVersion;\n\treadonly children?: readonly CodecTree[];\n}\n\nexport function jsonableCodecTree(tree: CodecTree): JsonCompatibleReadOnly {\n\treturn {\n\t\tname: tree.name,\n\t\tversion: tree.version ?? \"null\",\n\t\tchildren: tree.children?.map(jsonableCodecTree),\n\t};\n}\n"]}
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- export { type FormatVersion, DependentFormatVersion, type ICodecFamily, type ICodecOptions, type CodecWriteOptions, type CodecWriteOptionsBeta, type IDecoder, type IEncoder, type IJsonCodec, type JsonValidator, makeCodecFamily, type SchemaValidationFunction, unitCodec, withSchemaValidation, FluidClientVersion, currentVersion, toFormatValidator, FormatValidatorNoOp, type FormatValidator, type CodecTree, jsonableCodecTree, extractJsonValidator, type CodecName, eraseEncodedType, } from "./codec.js";
5
+ export { type FormatVersion, DependentFormatVersion, type ICodecFamily, type ICodecOptions, type CodecWriteOptions, type CodecWriteOptionsBeta, type IDecoder, type IEncoder, type IJsonCodec, type JsonValidator, makeCodecFamily, type SchemaValidationFunction, unitCodec, withSchemaValidation, FluidClientVersion, currentVersion, toFormatValidator, FormatValidatorNoOp, type FormatValidator, type CodecTree, jsonableCodecTree, extractJsonValidator, type CodecName, eraseEncodedType, type JsonCodecPart, } from "./codec.js";
6
6
  export { DiscriminatedUnionDispatcher, type DiscriminatedUnionLibrary, unionOptions, } from "./discriminatedUnions.js";
7
- export { Versioned, makeVersionedValidatedCodec, makeVersionDispatchingCodec, makeDiscontinuedCodecVersion, ClientVersionDispatchingCodecBuilder, type CodecVersion, type CodecAndSchema, versionField, } from "./versioned/index.js";
7
+ export { Versioned, makeDiscontinuedCodecAndSchema, ClientVersionDispatchingCodecBuilder, type CodecVersion, type CodecAndSchema, versionField, } from "./versioned/index.js";
8
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/codec/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,aAAa,EAClB,sBAAsB,EACtB,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,QAAQ,EACb,KAAK,QAAQ,EACb,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,eAAe,EACf,KAAK,wBAAwB,EAC7B,SAAS,EACT,oBAAoB,EACpB,kBAAkB,EAClB,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,KAAK,eAAe,EACpB,KAAK,SAAS,EACd,iBAAiB,EACjB,oBAAoB,EACpB,KAAK,SAAS,EACd,gBAAgB,GAChB,MAAM,YAAY,CAAC;AACpB,OAAO,EACN,4BAA4B,EAC5B,KAAK,yBAAyB,EAC9B,YAAY,GACZ,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACN,SAAS,EACT,2BAA2B,EAC3B,2BAA2B,EAC3B,4BAA4B,EAC5B,oCAAoC,EACpC,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,YAAY,GACZ,MAAM,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/codec/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,aAAa,EAClB,sBAAsB,EACtB,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,QAAQ,EACb,KAAK,QAAQ,EACb,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,eAAe,EACf,KAAK,wBAAwB,EAC7B,SAAS,EACT,oBAAoB,EACpB,kBAAkB,EAClB,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,KAAK,eAAe,EACpB,KAAK,SAAS,EACd,iBAAiB,EACjB,oBAAoB,EACpB,KAAK,SAAS,EACd,gBAAgB,EAChB,KAAK,aAAa,GAClB,MAAM,YAAY,CAAC;AACpB,OAAO,EACN,4BAA4B,EAC5B,KAAK,yBAAyB,EAC9B,YAAY,GACZ,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACN,SAAS,EACT,8BAA8B,EAC9B,oCAAoC,EACpC,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,YAAY,GACZ,MAAM,sBAAsB,CAAC"}
@@ -4,7 +4,7 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.versionField = exports.ClientVersionDispatchingCodecBuilder = exports.makeDiscontinuedCodecVersion = exports.makeVersionDispatchingCodec = exports.makeVersionedValidatedCodec = exports.Versioned = exports.unionOptions = exports.DiscriminatedUnionDispatcher = exports.eraseEncodedType = exports.extractJsonValidator = exports.jsonableCodecTree = exports.FormatValidatorNoOp = exports.toFormatValidator = exports.currentVersion = exports.FluidClientVersion = exports.withSchemaValidation = exports.unitCodec = exports.makeCodecFamily = exports.DependentFormatVersion = void 0;
7
+ exports.versionField = exports.ClientVersionDispatchingCodecBuilder = exports.makeDiscontinuedCodecAndSchema = exports.Versioned = exports.unionOptions = exports.DiscriminatedUnionDispatcher = exports.eraseEncodedType = exports.extractJsonValidator = exports.jsonableCodecTree = exports.FormatValidatorNoOp = exports.toFormatValidator = exports.currentVersion = exports.FluidClientVersion = exports.withSchemaValidation = exports.unitCodec = exports.makeCodecFamily = exports.DependentFormatVersion = void 0;
8
8
  var codec_js_1 = require("./codec.js");
9
9
  Object.defineProperty(exports, "DependentFormatVersion", { enumerable: true, get: function () { return codec_js_1.DependentFormatVersion; } });
10
10
  Object.defineProperty(exports, "makeCodecFamily", { enumerable: true, get: function () { return codec_js_1.makeCodecFamily; } });
@@ -22,9 +22,7 @@ Object.defineProperty(exports, "DiscriminatedUnionDispatcher", { enumerable: tru
22
22
  Object.defineProperty(exports, "unionOptions", { enumerable: true, get: function () { return discriminatedUnions_js_1.unionOptions; } });
23
23
  var index_js_1 = require("./versioned/index.js");
24
24
  Object.defineProperty(exports, "Versioned", { enumerable: true, get: function () { return index_js_1.Versioned; } });
25
- Object.defineProperty(exports, "makeVersionedValidatedCodec", { enumerable: true, get: function () { return index_js_1.makeVersionedValidatedCodec; } });
26
- Object.defineProperty(exports, "makeVersionDispatchingCodec", { enumerable: true, get: function () { return index_js_1.makeVersionDispatchingCodec; } });
27
- Object.defineProperty(exports, "makeDiscontinuedCodecVersion", { enumerable: true, get: function () { return index_js_1.makeDiscontinuedCodecVersion; } });
25
+ Object.defineProperty(exports, "makeDiscontinuedCodecAndSchema", { enumerable: true, get: function () { return index_js_1.makeDiscontinuedCodecAndSchema; } });
28
26
  Object.defineProperty(exports, "ClientVersionDispatchingCodecBuilder", { enumerable: true, get: function () { return index_js_1.ClientVersionDispatchingCodecBuilder; } });
29
27
  Object.defineProperty(exports, "versionField", { enumerable: true, get: function () { return index_js_1.versionField; } });
30
28
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/codec/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,uCAyBoB;AAvBnB,kHAAA,sBAAsB,OAAA;AAStB,2GAAA,eAAe,OAAA;AAEf,qGAAA,SAAS,OAAA;AACT,gHAAA,oBAAoB,OAAA;AACpB,8GAAA,kBAAkB,OAAA;AAClB,0GAAA,cAAc,OAAA;AACd,6GAAA,iBAAiB,OAAA;AACjB,+GAAA,mBAAmB,OAAA;AAGnB,6GAAA,iBAAiB,OAAA;AACjB,gHAAA,oBAAoB,OAAA;AAEpB,4GAAA,gBAAgB,OAAA;AAEjB,mEAIkC;AAHjC,sIAAA,4BAA4B,OAAA;AAE5B,sHAAA,YAAY,OAAA;AAEb,iDAS8B;AAR7B,qGAAA,SAAS,OAAA;AACT,uHAAA,2BAA2B,OAAA;AAC3B,uHAAA,2BAA2B,OAAA;AAC3B,wHAAA,4BAA4B,OAAA;AAC5B,gIAAA,oCAAoC,OAAA;AAGpC,wGAAA,YAAY,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\ttype FormatVersion,\n\tDependentFormatVersion,\n\ttype ICodecFamily,\n\ttype ICodecOptions,\n\ttype CodecWriteOptions,\n\ttype CodecWriteOptionsBeta,\n\ttype IDecoder,\n\ttype IEncoder,\n\ttype IJsonCodec,\n\ttype JsonValidator,\n\tmakeCodecFamily,\n\ttype SchemaValidationFunction,\n\tunitCodec,\n\twithSchemaValidation,\n\tFluidClientVersion,\n\tcurrentVersion,\n\ttoFormatValidator,\n\tFormatValidatorNoOp,\n\ttype FormatValidator,\n\ttype CodecTree,\n\tjsonableCodecTree,\n\textractJsonValidator,\n\ttype CodecName,\n\teraseEncodedType,\n} from \"./codec.js\";\nexport {\n\tDiscriminatedUnionDispatcher,\n\ttype DiscriminatedUnionLibrary,\n\tunionOptions,\n} from \"./discriminatedUnions.js\";\nexport {\n\tVersioned,\n\tmakeVersionedValidatedCodec,\n\tmakeVersionDispatchingCodec,\n\tmakeDiscontinuedCodecVersion,\n\tClientVersionDispatchingCodecBuilder,\n\ttype CodecVersion,\n\ttype CodecAndSchema,\n\tversionField,\n} from \"./versioned/index.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/codec/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,uCA0BoB;AAxBnB,kHAAA,sBAAsB,OAAA;AAStB,2GAAA,eAAe,OAAA;AAEf,qGAAA,SAAS,OAAA;AACT,gHAAA,oBAAoB,OAAA;AACpB,8GAAA,kBAAkB,OAAA;AAClB,0GAAA,cAAc,OAAA;AACd,6GAAA,iBAAiB,OAAA;AACjB,+GAAA,mBAAmB,OAAA;AAGnB,6GAAA,iBAAiB,OAAA;AACjB,gHAAA,oBAAoB,OAAA;AAEpB,4GAAA,gBAAgB,OAAA;AAGjB,mEAIkC;AAHjC,sIAAA,4BAA4B,OAAA;AAE5B,sHAAA,YAAY,OAAA;AAEb,iDAO8B;AAN7B,qGAAA,SAAS,OAAA;AACT,0HAAA,8BAA8B,OAAA;AAC9B,gIAAA,oCAAoC,OAAA;AAGpC,wGAAA,YAAY,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\ttype FormatVersion,\n\tDependentFormatVersion,\n\ttype ICodecFamily,\n\ttype ICodecOptions,\n\ttype CodecWriteOptions,\n\ttype CodecWriteOptionsBeta,\n\ttype IDecoder,\n\ttype IEncoder,\n\ttype IJsonCodec,\n\ttype JsonValidator,\n\tmakeCodecFamily,\n\ttype SchemaValidationFunction,\n\tunitCodec,\n\twithSchemaValidation,\n\tFluidClientVersion,\n\tcurrentVersion,\n\ttoFormatValidator,\n\tFormatValidatorNoOp,\n\ttype FormatValidator,\n\ttype CodecTree,\n\tjsonableCodecTree,\n\textractJsonValidator,\n\ttype CodecName,\n\teraseEncodedType,\n\ttype JsonCodecPart,\n} from \"./codec.js\";\nexport {\n\tDiscriminatedUnionDispatcher,\n\ttype DiscriminatedUnionLibrary,\n\tunionOptions,\n} from \"./discriminatedUnions.js\";\nexport {\n\tVersioned,\n\tmakeDiscontinuedCodecAndSchema,\n\tClientVersionDispatchingCodecBuilder,\n\ttype CodecVersion,\n\ttype CodecAndSchema,\n\tversionField,\n} from \"./versioned/index.js\";\n"]}