@fluidframework/tree 2.71.0 → 2.72.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 (603) hide show
  1. package/CHANGELOG.md +26 -40
  2. package/api-report/tree.alpha.api.md +27 -18
  3. package/api-report/tree.beta.api.md +42 -0
  4. package/api-report/tree.legacy.beta.api.md +42 -0
  5. package/dist/alpha.d.ts +9 -7
  6. package/dist/api.js +1 -1
  7. package/dist/api.js.map +1 -1
  8. package/dist/beta.d.ts +7 -0
  9. package/dist/codec/codec.d.ts +16 -1
  10. package/dist/codec/codec.d.ts.map +1 -1
  11. package/dist/codec/codec.js +16 -3
  12. package/dist/codec/codec.js.map +1 -1
  13. package/dist/core/index.d.ts +1 -1
  14. package/dist/core/index.d.ts.map +1 -1
  15. package/dist/core/index.js +2 -2
  16. package/dist/core/index.js.map +1 -1
  17. package/dist/core/schema-stored/index.d.ts +1 -1
  18. package/dist/core/schema-stored/index.d.ts.map +1 -1
  19. package/dist/core/schema-stored/index.js +2 -2
  20. package/dist/core/schema-stored/index.js.map +1 -1
  21. package/dist/core/schema-stored/schema.d.ts +6 -6
  22. package/dist/core/schema-stored/schema.d.ts.map +1 -1
  23. package/dist/core/schema-stored/schema.js +6 -7
  24. package/dist/core/schema-stored/schema.js.map +1 -1
  25. package/dist/core/tree/detachedFieldIndexCodecCommon.d.ts +2 -1
  26. package/dist/core/tree/detachedFieldIndexCodecCommon.d.ts.map +1 -1
  27. package/dist/core/tree/detachedFieldIndexCodecCommon.js.map +1 -1
  28. package/dist/core/tree/detachedFieldIndexCodecV1.d.ts +1 -1
  29. package/dist/core/tree/detachedFieldIndexCodecV1.d.ts.map +1 -1
  30. package/dist/core/tree/detachedFieldIndexCodecV1.js +3 -2
  31. package/dist/core/tree/detachedFieldIndexCodecV1.js.map +1 -1
  32. package/dist/core/tree/detachedFieldIndexCodecV2.d.ts.map +1 -1
  33. package/dist/core/tree/detachedFieldIndexCodecV2.js +3 -1
  34. package/dist/core/tree/detachedFieldIndexCodecV2.js.map +1 -1
  35. package/dist/core/tree/detachedFieldIndexCodecs.d.ts +2 -3
  36. package/dist/core/tree/detachedFieldIndexCodecs.d.ts.map +1 -1
  37. package/dist/core/tree/detachedFieldIndexCodecs.js +29 -8
  38. package/dist/core/tree/detachedFieldIndexCodecs.js.map +1 -1
  39. package/dist/core/tree/detachedFieldIndexFormatCommon.d.ts +10 -1
  40. package/dist/core/tree/detachedFieldIndexFormatCommon.d.ts.map +1 -1
  41. package/dist/core/tree/detachedFieldIndexFormatCommon.js +8 -1
  42. package/dist/core/tree/detachedFieldIndexFormatCommon.js.map +1 -1
  43. package/dist/core/tree/detachedFieldIndexFormatV1.d.ts +2 -2
  44. package/dist/core/tree/detachedFieldIndexFormatV1.d.ts.map +1 -1
  45. package/dist/core/tree/detachedFieldIndexFormatV1.js +3 -3
  46. package/dist/core/tree/detachedFieldIndexFormatV1.js.map +1 -1
  47. package/dist/core/tree/detachedFieldIndexFormatV2.d.ts +2 -2
  48. package/dist/core/tree/detachedFieldIndexFormatV2.d.ts.map +1 -1
  49. package/dist/core/tree/detachedFieldIndexFormatV2.js +3 -3
  50. package/dist/core/tree/detachedFieldIndexFormatV2.js.map +1 -1
  51. package/dist/core/tree/index.d.ts +2 -1
  52. package/dist/core/tree/index.d.ts.map +1 -1
  53. package/dist/core/tree/index.js.map +1 -1
  54. package/dist/external-utilities/typeboxValidator.js +1 -1
  55. package/dist/external-utilities/typeboxValidator.js.map +1 -1
  56. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts +4 -10
  57. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  58. package/dist/feature-libraries/chunked-forest/codec/codecs.js +12 -8
  59. package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  60. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +1 -1
  61. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  62. package/dist/feature-libraries/chunked-forest/codec/format.d.ts +8 -3
  63. package/dist/feature-libraries/chunked-forest/codec/format.d.ts.map +1 -1
  64. package/dist/feature-libraries/chunked-forest/codec/format.js +9 -4
  65. package/dist/feature-libraries/chunked-forest/codec/format.js.map +1 -1
  66. package/dist/feature-libraries/chunked-forest/codec/index.d.ts +2 -2
  67. package/dist/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
  68. package/dist/feature-libraries/chunked-forest/codec/index.js +1 -2
  69. package/dist/feature-libraries/chunked-forest/codec/index.js.map +1 -1
  70. package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.d.ts.map +1 -1
  71. package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.js +1 -1
  72. package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.js.map +1 -1
  73. package/dist/feature-libraries/chunked-forest/index.d.ts +1 -1
  74. package/dist/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  75. package/dist/feature-libraries/chunked-forest/index.js +1 -2
  76. package/dist/feature-libraries/chunked-forest/index.js.map +1 -1
  77. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts +1 -9
  78. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  79. package/dist/feature-libraries/default-schema/defaultFieldKinds.js +3 -21
  80. package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  81. package/dist/feature-libraries/forest-summary/codec.d.ts +4 -5
  82. package/dist/feature-libraries/forest-summary/codec.d.ts.map +1 -1
  83. package/dist/feature-libraries/forest-summary/codec.js +15 -4
  84. package/dist/feature-libraries/forest-summary/codec.js.map +1 -1
  85. package/dist/feature-libraries/forest-summary/forestSummarizer.js +1 -1
  86. package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  87. package/dist/feature-libraries/forest-summary/format.d.ts +8 -1
  88. package/dist/feature-libraries/forest-summary/format.d.ts.map +1 -1
  89. package/dist/feature-libraries/forest-summary/format.js +8 -3
  90. package/dist/feature-libraries/forest-summary/format.js.map +1 -1
  91. package/dist/feature-libraries/forest-summary/index.d.ts +2 -1
  92. package/dist/feature-libraries/forest-summary/index.d.ts.map +1 -1
  93. package/dist/feature-libraries/forest-summary/index.js +3 -1
  94. package/dist/feature-libraries/forest-summary/index.js.map +1 -1
  95. package/dist/feature-libraries/index.d.ts +3 -3
  96. package/dist/feature-libraries/index.d.ts.map +1 -1
  97. package/dist/feature-libraries/index.js +2 -2
  98. package/dist/feature-libraries/index.js.map +1 -1
  99. package/dist/feature-libraries/schema-edits/index.d.ts +1 -1
  100. package/dist/feature-libraries/schema-edits/index.d.ts.map +1 -1
  101. package/dist/feature-libraries/schema-edits/index.js.map +1 -1
  102. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.d.ts +6 -7
  103. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
  104. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js +5 -4
  105. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
  106. package/dist/feature-libraries/schema-index/codec.d.ts +10 -10
  107. package/dist/feature-libraries/schema-index/codec.d.ts.map +1 -1
  108. package/dist/feature-libraries/schema-index/codec.js +22 -18
  109. package/dist/feature-libraries/schema-index/codec.js.map +1 -1
  110. package/dist/feature-libraries/schema-index/formatV1.d.ts +2 -2
  111. package/dist/feature-libraries/schema-index/formatV1.d.ts.map +1 -1
  112. package/dist/feature-libraries/schema-index/formatV1.js +1 -1
  113. package/dist/feature-libraries/schema-index/formatV1.js.map +1 -1
  114. package/dist/feature-libraries/schema-index/formatV2.d.ts +1 -2
  115. package/dist/feature-libraries/schema-index/formatV2.d.ts.map +1 -1
  116. package/dist/feature-libraries/schema-index/formatV2.js +1 -1
  117. package/dist/feature-libraries/schema-index/formatV2.js.map +1 -1
  118. package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts +2 -2
  119. package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
  120. package/dist/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
  121. package/dist/index.d.ts +1 -1
  122. package/dist/index.d.ts.map +1 -1
  123. package/dist/index.js +3 -1
  124. package/dist/index.js.map +1 -1
  125. package/dist/legacy.d.ts +7 -0
  126. package/dist/packageVersion.d.ts +1 -1
  127. package/dist/packageVersion.js +1 -1
  128. package/dist/packageVersion.js.map +1 -1
  129. package/dist/shared-tree/independentView.d.ts +1 -1
  130. package/dist/shared-tree/independentView.d.ts.map +1 -1
  131. package/dist/shared-tree/independentView.js +22 -15
  132. package/dist/shared-tree/independentView.js.map +1 -1
  133. package/dist/shared-tree/sharedTree.d.ts +12 -16
  134. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  135. package/dist/shared-tree/sharedTree.js +87 -127
  136. package/dist/shared-tree/sharedTree.js.map +1 -1
  137. package/dist/shared-tree/sharedTreeChangeCodecs.d.ts +7 -6
  138. package/dist/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  139. package/dist/shared-tree/sharedTreeChangeCodecs.js +12 -11
  140. package/dist/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  141. package/dist/shared-tree/sharedTreeChangeFamily.d.ts +2 -2
  142. package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  143. package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  144. package/dist/shared-tree/treeAlpha.d.ts +1 -1
  145. package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
  146. package/dist/shared-tree/treeAlpha.js +4 -2
  147. package/dist/shared-tree/treeAlpha.js.map +1 -1
  148. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  149. package/dist/shared-tree/treeCheckout.js +1 -3
  150. package/dist/shared-tree/treeCheckout.js.map +1 -1
  151. package/dist/shared-tree-core/editManagerCodecs.d.ts +19 -6
  152. package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  153. package/dist/shared-tree-core/editManagerCodecs.js +35 -17
  154. package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
  155. package/dist/shared-tree-core/editManagerFormatCommons.d.ts +37 -0
  156. package/dist/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
  157. package/dist/shared-tree-core/editManagerFormatCommons.js +43 -1
  158. package/dist/shared-tree-core/editManagerFormatCommons.js.map +1 -1
  159. package/dist/shared-tree-core/editManagerFormatV1toV4.d.ts +2 -2
  160. package/dist/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -1
  161. package/dist/shared-tree-core/editManagerFormatV1toV4.js +4 -4
  162. package/dist/shared-tree-core/editManagerFormatV1toV4.js.map +1 -1
  163. package/dist/shared-tree-core/editManagerFormatV5.d.ts +2 -2
  164. package/dist/shared-tree-core/editManagerFormatV5.d.ts.map +1 -1
  165. package/dist/shared-tree-core/editManagerFormatV5.js +1 -1
  166. package/dist/shared-tree-core/editManagerFormatV5.js.map +1 -1
  167. package/dist/shared-tree-core/index.d.ts +5 -3
  168. package/dist/shared-tree-core/index.d.ts.map +1 -1
  169. package/dist/shared-tree-core/index.js +11 -3
  170. package/dist/shared-tree-core/index.js.map +1 -1
  171. package/dist/shared-tree-core/messageCodecV1ToV4.d.ts +2 -1
  172. package/dist/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
  173. package/dist/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
  174. package/dist/shared-tree-core/messageCodecV5.d.ts +2 -1
  175. package/dist/shared-tree-core/messageCodecV5.d.ts.map +1 -1
  176. package/dist/shared-tree-core/messageCodecV5.js.map +1 -1
  177. package/dist/shared-tree-core/messageCodecs.d.ts +19 -6
  178. package/dist/shared-tree-core/messageCodecs.d.ts.map +1 -1
  179. package/dist/shared-tree-core/messageCodecs.js +38 -21
  180. package/dist/shared-tree-core/messageCodecs.js.map +1 -1
  181. package/dist/shared-tree-core/messageFormat.d.ts +50 -0
  182. package/dist/shared-tree-core/messageFormat.d.ts.map +1 -0
  183. package/dist/shared-tree-core/messageFormat.js +51 -0
  184. package/dist/shared-tree-core/messageFormat.js.map +1 -0
  185. package/dist/shared-tree-core/sharedTreeCore.d.ts +8 -8
  186. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  187. package/dist/shared-tree-core/sharedTreeCore.js +3 -3
  188. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  189. package/dist/simple-tree/api/discrepancies.d.ts +2 -2
  190. package/dist/simple-tree/api/discrepancies.js.map +1 -1
  191. package/dist/simple-tree/api/incrementalAllowedTypes.d.ts +1 -1
  192. package/dist/simple-tree/api/incrementalAllowedTypes.js +1 -1
  193. package/dist/simple-tree/api/incrementalAllowedTypes.js.map +1 -1
  194. package/dist/simple-tree/api/index.d.ts +3 -2
  195. package/dist/simple-tree/api/index.d.ts.map +1 -1
  196. package/dist/simple-tree/api/index.js +4 -1
  197. package/dist/simple-tree/api/index.js.map +1 -1
  198. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +2 -98
  199. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  200. package/dist/simple-tree/api/schemaFactoryAlpha.js +1 -52
  201. package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  202. package/dist/simple-tree/api/schemaFactoryBeta.d.ts +98 -2
  203. package/dist/simple-tree/api/schemaFactoryBeta.d.ts.map +1 -1
  204. package/dist/simple-tree/api/schemaFactoryBeta.js +61 -7
  205. package/dist/simple-tree/api/schemaFactoryBeta.js.map +1 -1
  206. package/dist/simple-tree/api/schemaFromSimple.js +6 -3
  207. package/dist/simple-tree/api/schemaFromSimple.js.map +1 -1
  208. package/dist/simple-tree/api/simpleSchemaCodec.d.ts +28 -0
  209. package/dist/simple-tree/api/simpleSchemaCodec.d.ts.map +1 -0
  210. package/dist/simple-tree/api/simpleSchemaCodec.js +292 -0
  211. package/dist/simple-tree/api/simpleSchemaCodec.js.map +1 -0
  212. package/dist/simple-tree/api/storedSchema.d.ts +2 -2
  213. package/dist/simple-tree/api/storedSchema.d.ts.map +1 -1
  214. package/dist/simple-tree/api/storedSchema.js +8 -6
  215. package/dist/simple-tree/api/storedSchema.js.map +1 -1
  216. package/dist/simple-tree/api/tree.d.ts +2 -2
  217. package/dist/simple-tree/api/tree.js.map +1 -1
  218. package/dist/simple-tree/api/typesUnsafe.d.ts +6 -6
  219. package/dist/simple-tree/api/typesUnsafe.js.map +1 -1
  220. package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts +18 -3
  221. package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
  222. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js +78 -35
  223. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
  224. package/dist/simple-tree/core/allowedTypes.d.ts +3 -3
  225. package/dist/simple-tree/core/allowedTypes.js +1 -1
  226. package/dist/simple-tree/core/allowedTypes.js.map +1 -1
  227. package/dist/simple-tree/core/treeNode.js +1 -1
  228. package/dist/simple-tree/core/treeNode.js.map +1 -1
  229. package/dist/simple-tree/index.d.ts +2 -1
  230. package/dist/simple-tree/index.d.ts.map +1 -1
  231. package/dist/simple-tree/index.js +4 -0
  232. package/dist/simple-tree/index.js.map +1 -1
  233. package/dist/simple-tree/node-kinds/array/arrayNode.js +1 -1
  234. package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  235. package/dist/simple-tree/node-kinds/map/mapNode.js +1 -1
  236. package/dist/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  237. package/dist/simple-tree/node-kinds/object/objectNode.js +2 -2
  238. package/dist/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  239. package/dist/simple-tree/node-kinds/record/recordNode.js +2 -2
  240. package/dist/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  241. package/dist/simple-tree/simpleSchema.d.ts +11 -3
  242. package/dist/simple-tree/simpleSchema.d.ts.map +1 -1
  243. package/dist/simple-tree/simpleSchema.js.map +1 -1
  244. package/dist/simple-tree/simpleSchemaFormatV1.d.ts +249 -0
  245. package/dist/simple-tree/simpleSchemaFormatV1.d.ts.map +1 -0
  246. package/dist/simple-tree/simpleSchemaFormatV1.js +115 -0
  247. package/dist/simple-tree/simpleSchemaFormatV1.js.map +1 -0
  248. package/dist/tableSchema.d.ts.map +1 -1
  249. package/dist/tableSchema.js +1 -1
  250. package/dist/tableSchema.js.map +1 -1
  251. package/dist/treeFactory.d.ts +3 -1
  252. package/dist/treeFactory.d.ts.map +1 -1
  253. package/dist/treeFactory.js +26 -2
  254. package/dist/treeFactory.js.map +1 -1
  255. package/dist/util/brand.d.ts +31 -2
  256. package/dist/util/brand.d.ts.map +1 -1
  257. package/dist/util/brand.js +28 -2
  258. package/dist/util/brand.js.map +1 -1
  259. package/dist/util/brandedMap.d.ts +3 -1
  260. package/dist/util/brandedMap.d.ts.map +1 -1
  261. package/dist/util/brandedMap.js.map +1 -1
  262. package/dist/util/index.d.ts +1 -1
  263. package/dist/util/index.d.ts.map +1 -1
  264. package/dist/util/index.js +3 -2
  265. package/dist/util/index.js.map +1 -1
  266. package/lib/alpha.d.ts +9 -7
  267. package/lib/api.js +2 -2
  268. package/lib/api.js.map +1 -1
  269. package/lib/beta.d.ts +7 -0
  270. package/lib/codec/codec.d.ts +16 -1
  271. package/lib/codec/codec.d.ts.map +1 -1
  272. package/lib/codec/codec.js +16 -3
  273. package/lib/codec/codec.js.map +1 -1
  274. package/lib/core/index.d.ts +1 -1
  275. package/lib/core/index.d.ts.map +1 -1
  276. package/lib/core/index.js +1 -1
  277. package/lib/core/index.js.map +1 -1
  278. package/lib/core/schema-stored/index.d.ts +1 -1
  279. package/lib/core/schema-stored/index.d.ts.map +1 -1
  280. package/lib/core/schema-stored/index.js +1 -1
  281. package/lib/core/schema-stored/index.js.map +1 -1
  282. package/lib/core/schema-stored/schema.d.ts +6 -6
  283. package/lib/core/schema-stored/schema.d.ts.map +1 -1
  284. package/lib/core/schema-stored/schema.js +6 -7
  285. package/lib/core/schema-stored/schema.js.map +1 -1
  286. package/lib/core/tree/detachedFieldIndexCodecCommon.d.ts +2 -1
  287. package/lib/core/tree/detachedFieldIndexCodecCommon.d.ts.map +1 -1
  288. package/lib/core/tree/detachedFieldIndexCodecCommon.js.map +1 -1
  289. package/lib/core/tree/detachedFieldIndexCodecV1.d.ts +1 -1
  290. package/lib/core/tree/detachedFieldIndexCodecV1.d.ts.map +1 -1
  291. package/lib/core/tree/detachedFieldIndexCodecV1.js +3 -2
  292. package/lib/core/tree/detachedFieldIndexCodecV1.js.map +1 -1
  293. package/lib/core/tree/detachedFieldIndexCodecV2.d.ts.map +1 -1
  294. package/lib/core/tree/detachedFieldIndexCodecV2.js +4 -2
  295. package/lib/core/tree/detachedFieldIndexCodecV2.js.map +1 -1
  296. package/lib/core/tree/detachedFieldIndexCodecs.d.ts +2 -3
  297. package/lib/core/tree/detachedFieldIndexCodecs.d.ts.map +1 -1
  298. package/lib/core/tree/detachedFieldIndexCodecs.js +29 -8
  299. package/lib/core/tree/detachedFieldIndexCodecs.js.map +1 -1
  300. package/lib/core/tree/detachedFieldIndexFormatCommon.d.ts +10 -1
  301. package/lib/core/tree/detachedFieldIndexFormatCommon.d.ts.map +1 -1
  302. package/lib/core/tree/detachedFieldIndexFormatCommon.js +7 -0
  303. package/lib/core/tree/detachedFieldIndexFormatCommon.js.map +1 -1
  304. package/lib/core/tree/detachedFieldIndexFormatV1.d.ts +2 -2
  305. package/lib/core/tree/detachedFieldIndexFormatV1.d.ts.map +1 -1
  306. package/lib/core/tree/detachedFieldIndexFormatV1.js +3 -3
  307. package/lib/core/tree/detachedFieldIndexFormatV1.js.map +1 -1
  308. package/lib/core/tree/detachedFieldIndexFormatV2.d.ts +2 -2
  309. package/lib/core/tree/detachedFieldIndexFormatV2.d.ts.map +1 -1
  310. package/lib/core/tree/detachedFieldIndexFormatV2.js +3 -3
  311. package/lib/core/tree/detachedFieldIndexFormatV2.js.map +1 -1
  312. package/lib/core/tree/index.d.ts +2 -1
  313. package/lib/core/tree/index.d.ts.map +1 -1
  314. package/lib/core/tree/index.js +1 -1
  315. package/lib/core/tree/index.js.map +1 -1
  316. package/lib/external-utilities/typeboxValidator.js +1 -1
  317. package/lib/external-utilities/typeboxValidator.js.map +1 -1
  318. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts +4 -10
  319. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  320. package/lib/feature-libraries/chunked-forest/codec/codecs.js +13 -8
  321. package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  322. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +2 -2
  323. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  324. package/lib/feature-libraries/chunked-forest/codec/format.d.ts +8 -3
  325. package/lib/feature-libraries/chunked-forest/codec/format.d.ts.map +1 -1
  326. package/lib/feature-libraries/chunked-forest/codec/format.js +8 -3
  327. package/lib/feature-libraries/chunked-forest/codec/format.js.map +1 -1
  328. package/lib/feature-libraries/chunked-forest/codec/index.d.ts +2 -2
  329. package/lib/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
  330. package/lib/feature-libraries/chunked-forest/codec/index.js +2 -2
  331. package/lib/feature-libraries/chunked-forest/codec/index.js.map +1 -1
  332. package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.d.ts.map +1 -1
  333. package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.js +2 -2
  334. package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.js.map +1 -1
  335. package/lib/feature-libraries/chunked-forest/index.d.ts +1 -1
  336. package/lib/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  337. package/lib/feature-libraries/chunked-forest/index.js +1 -1
  338. package/lib/feature-libraries/chunked-forest/index.js.map +1 -1
  339. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts +1 -9
  340. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  341. package/lib/feature-libraries/default-schema/defaultFieldKinds.js +2 -20
  342. package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  343. package/lib/feature-libraries/forest-summary/codec.d.ts +4 -5
  344. package/lib/feature-libraries/forest-summary/codec.d.ts.map +1 -1
  345. package/lib/feature-libraries/forest-summary/codec.js +16 -5
  346. package/lib/feature-libraries/forest-summary/codec.js.map +1 -1
  347. package/lib/feature-libraries/forest-summary/forestSummarizer.js +1 -1
  348. package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  349. package/lib/feature-libraries/forest-summary/format.d.ts +8 -1
  350. package/lib/feature-libraries/forest-summary/format.d.ts.map +1 -1
  351. package/lib/feature-libraries/forest-summary/format.js +7 -2
  352. package/lib/feature-libraries/forest-summary/format.js.map +1 -1
  353. package/lib/feature-libraries/forest-summary/index.d.ts +2 -1
  354. package/lib/feature-libraries/forest-summary/index.d.ts.map +1 -1
  355. package/lib/feature-libraries/forest-summary/index.js +1 -0
  356. package/lib/feature-libraries/forest-summary/index.js.map +1 -1
  357. package/lib/feature-libraries/index.d.ts +3 -3
  358. package/lib/feature-libraries/index.d.ts.map +1 -1
  359. package/lib/feature-libraries/index.js +2 -2
  360. package/lib/feature-libraries/index.js.map +1 -1
  361. package/lib/feature-libraries/schema-edits/index.d.ts +1 -1
  362. package/lib/feature-libraries/schema-edits/index.d.ts.map +1 -1
  363. package/lib/feature-libraries/schema-edits/index.js.map +1 -1
  364. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.d.ts +6 -7
  365. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
  366. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js +6 -5
  367. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
  368. package/lib/feature-libraries/schema-index/codec.d.ts +10 -10
  369. package/lib/feature-libraries/schema-index/codec.d.ts.map +1 -1
  370. package/lib/feature-libraries/schema-index/codec.js +24 -20
  371. package/lib/feature-libraries/schema-index/codec.js.map +1 -1
  372. package/lib/feature-libraries/schema-index/formatV1.d.ts +2 -2
  373. package/lib/feature-libraries/schema-index/formatV1.d.ts.map +1 -1
  374. package/lib/feature-libraries/schema-index/formatV1.js +2 -2
  375. package/lib/feature-libraries/schema-index/formatV1.js.map +1 -1
  376. package/lib/feature-libraries/schema-index/formatV2.d.ts +1 -2
  377. package/lib/feature-libraries/schema-index/formatV2.d.ts.map +1 -1
  378. package/lib/feature-libraries/schema-index/formatV2.js +2 -2
  379. package/lib/feature-libraries/schema-index/formatV2.js.map +1 -1
  380. package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts +2 -2
  381. package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
  382. package/lib/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
  383. package/lib/index.d.ts +1 -1
  384. package/lib/index.d.ts.map +1 -1
  385. package/lib/index.js +1 -1
  386. package/lib/index.js.map +1 -1
  387. package/lib/legacy.d.ts +7 -0
  388. package/lib/packageVersion.d.ts +1 -1
  389. package/lib/packageVersion.js +1 -1
  390. package/lib/packageVersion.js.map +1 -1
  391. package/lib/shared-tree/independentView.d.ts +1 -1
  392. package/lib/shared-tree/independentView.d.ts.map +1 -1
  393. package/lib/shared-tree/independentView.js +11 -4
  394. package/lib/shared-tree/independentView.js.map +1 -1
  395. package/lib/shared-tree/sharedTree.d.ts +12 -16
  396. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  397. package/lib/shared-tree/sharedTree.js +90 -130
  398. package/lib/shared-tree/sharedTree.js.map +1 -1
  399. package/lib/shared-tree/sharedTreeChangeCodecs.d.ts +7 -6
  400. package/lib/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  401. package/lib/shared-tree/sharedTreeChangeCodecs.js +7 -6
  402. package/lib/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  403. package/lib/shared-tree/sharedTreeChangeFamily.d.ts +2 -2
  404. package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  405. package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  406. package/lib/shared-tree/treeAlpha.d.ts +1 -1
  407. package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
  408. package/lib/shared-tree/treeAlpha.js +5 -3
  409. package/lib/shared-tree/treeAlpha.js.map +1 -1
  410. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  411. package/lib/shared-tree/treeCheckout.js +1 -3
  412. package/lib/shared-tree/treeCheckout.js.map +1 -1
  413. package/lib/shared-tree-core/editManagerCodecs.d.ts +19 -6
  414. package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  415. package/lib/shared-tree-core/editManagerCodecs.js +32 -16
  416. package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
  417. package/lib/shared-tree-core/editManagerFormatCommons.d.ts +37 -0
  418. package/lib/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
  419. package/lib/shared-tree-core/editManagerFormatCommons.js +42 -0
  420. package/lib/shared-tree-core/editManagerFormatCommons.js.map +1 -1
  421. package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts +2 -2
  422. package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -1
  423. package/lib/shared-tree-core/editManagerFormatV1toV4.js +5 -5
  424. package/lib/shared-tree-core/editManagerFormatV1toV4.js.map +1 -1
  425. package/lib/shared-tree-core/editManagerFormatV5.d.ts +2 -2
  426. package/lib/shared-tree-core/editManagerFormatV5.d.ts.map +1 -1
  427. package/lib/shared-tree-core/editManagerFormatV5.js +2 -2
  428. package/lib/shared-tree-core/editManagerFormatV5.js.map +1 -1
  429. package/lib/shared-tree-core/index.d.ts +5 -3
  430. package/lib/shared-tree-core/index.d.ts.map +1 -1
  431. package/lib/shared-tree-core/index.js +4 -2
  432. package/lib/shared-tree-core/index.js.map +1 -1
  433. package/lib/shared-tree-core/messageCodecV1ToV4.d.ts +2 -1
  434. package/lib/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
  435. package/lib/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
  436. package/lib/shared-tree-core/messageCodecV5.d.ts +2 -1
  437. package/lib/shared-tree-core/messageCodecV5.d.ts.map +1 -1
  438. package/lib/shared-tree-core/messageCodecV5.js.map +1 -1
  439. package/lib/shared-tree-core/messageCodecs.d.ts +19 -6
  440. package/lib/shared-tree-core/messageCodecs.d.ts.map +1 -1
  441. package/lib/shared-tree-core/messageCodecs.js +35 -20
  442. package/lib/shared-tree-core/messageCodecs.js.map +1 -1
  443. package/lib/shared-tree-core/messageFormat.d.ts +50 -0
  444. package/lib/shared-tree-core/messageFormat.d.ts.map +1 -0
  445. package/lib/shared-tree-core/messageFormat.js +48 -0
  446. package/lib/shared-tree-core/messageFormat.js.map +1 -0
  447. package/lib/shared-tree-core/sharedTreeCore.d.ts +8 -8
  448. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  449. package/lib/shared-tree-core/sharedTreeCore.js +3 -3
  450. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  451. package/lib/simple-tree/api/discrepancies.d.ts +2 -2
  452. package/lib/simple-tree/api/discrepancies.js.map +1 -1
  453. package/lib/simple-tree/api/incrementalAllowedTypes.d.ts +1 -1
  454. package/lib/simple-tree/api/incrementalAllowedTypes.js +1 -1
  455. package/lib/simple-tree/api/incrementalAllowedTypes.js.map +1 -1
  456. package/lib/simple-tree/api/index.d.ts +3 -2
  457. package/lib/simple-tree/api/index.d.ts.map +1 -1
  458. package/lib/simple-tree/api/index.js +1 -0
  459. package/lib/simple-tree/api/index.js.map +1 -1
  460. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +2 -98
  461. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  462. package/lib/simple-tree/api/schemaFactoryAlpha.js +1 -52
  463. package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  464. package/lib/simple-tree/api/schemaFactoryBeta.d.ts +98 -2
  465. package/lib/simple-tree/api/schemaFactoryBeta.d.ts.map +1 -1
  466. package/lib/simple-tree/api/schemaFactoryBeta.js +58 -4
  467. package/lib/simple-tree/api/schemaFactoryBeta.js.map +1 -1
  468. package/lib/simple-tree/api/schemaFromSimple.js +6 -3
  469. package/lib/simple-tree/api/schemaFromSimple.js.map +1 -1
  470. package/lib/simple-tree/api/simpleSchemaCodec.d.ts +28 -0
  471. package/lib/simple-tree/api/simpleSchemaCodec.d.ts.map +1 -0
  472. package/lib/simple-tree/api/simpleSchemaCodec.js +264 -0
  473. package/lib/simple-tree/api/simpleSchemaCodec.js.map +1 -0
  474. package/lib/simple-tree/api/storedSchema.d.ts +2 -2
  475. package/lib/simple-tree/api/storedSchema.d.ts.map +1 -1
  476. package/lib/simple-tree/api/storedSchema.js +5 -3
  477. package/lib/simple-tree/api/storedSchema.js.map +1 -1
  478. package/lib/simple-tree/api/tree.d.ts +2 -2
  479. package/lib/simple-tree/api/tree.js.map +1 -1
  480. package/lib/simple-tree/api/typesUnsafe.d.ts +6 -6
  481. package/lib/simple-tree/api/typesUnsafe.js.map +1 -1
  482. package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts +18 -3
  483. package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
  484. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js +75 -34
  485. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
  486. package/lib/simple-tree/core/allowedTypes.d.ts +3 -3
  487. package/lib/simple-tree/core/allowedTypes.js +1 -1
  488. package/lib/simple-tree/core/allowedTypes.js.map +1 -1
  489. package/lib/simple-tree/core/treeNode.js +1 -1
  490. package/lib/simple-tree/core/treeNode.js.map +1 -1
  491. package/lib/simple-tree/index.d.ts +2 -1
  492. package/lib/simple-tree/index.d.ts.map +1 -1
  493. package/lib/simple-tree/index.js +1 -0
  494. package/lib/simple-tree/index.js.map +1 -1
  495. package/lib/simple-tree/node-kinds/array/arrayNode.js +2 -2
  496. package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  497. package/lib/simple-tree/node-kinds/map/mapNode.js +2 -2
  498. package/lib/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  499. package/lib/simple-tree/node-kinds/object/objectNode.js +3 -3
  500. package/lib/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  501. package/lib/simple-tree/node-kinds/record/recordNode.js +3 -3
  502. package/lib/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  503. package/lib/simple-tree/simpleSchema.d.ts +11 -3
  504. package/lib/simple-tree/simpleSchema.d.ts.map +1 -1
  505. package/lib/simple-tree/simpleSchema.js.map +1 -1
  506. package/lib/simple-tree/simpleSchemaFormatV1.d.ts +249 -0
  507. package/lib/simple-tree/simpleSchemaFormatV1.d.ts.map +1 -0
  508. package/lib/simple-tree/simpleSchemaFormatV1.js +112 -0
  509. package/lib/simple-tree/simpleSchemaFormatV1.js.map +1 -0
  510. package/lib/tableSchema.d.ts.map +1 -1
  511. package/lib/tableSchema.js +1 -1
  512. package/lib/tableSchema.js.map +1 -1
  513. package/lib/treeFactory.d.ts +3 -1
  514. package/lib/treeFactory.d.ts.map +1 -1
  515. package/lib/treeFactory.js +23 -1
  516. package/lib/treeFactory.js.map +1 -1
  517. package/lib/util/brand.d.ts +31 -2
  518. package/lib/util/brand.d.ts.map +1 -1
  519. package/lib/util/brand.js +26 -1
  520. package/lib/util/brand.js.map +1 -1
  521. package/lib/util/brandedMap.d.ts +3 -1
  522. package/lib/util/brandedMap.d.ts.map +1 -1
  523. package/lib/util/brandedMap.js.map +1 -1
  524. package/lib/util/index.d.ts +1 -1
  525. package/lib/util/index.d.ts.map +1 -1
  526. package/lib/util/index.js +1 -1
  527. package/lib/util/index.js.map +1 -1
  528. package/package.json +24 -24
  529. package/src/api.ts +2 -2
  530. package/src/codec/codec.ts +17 -3
  531. package/src/core/index.ts +1 -2
  532. package/src/core/schema-stored/index.ts +1 -2
  533. package/src/core/schema-stored/schema.ts +10 -7
  534. package/src/core/tree/detachedFieldIndexCodecCommon.ts +2 -1
  535. package/src/core/tree/detachedFieldIndexCodecV1.ts +4 -2
  536. package/src/core/tree/detachedFieldIndexCodecV2.ts +4 -6
  537. package/src/core/tree/detachedFieldIndexCodecs.ts +33 -11
  538. package/src/core/tree/detachedFieldIndexFormatCommon.ts +17 -2
  539. package/src/core/tree/detachedFieldIndexFormatV1.ts +6 -4
  540. package/src/core/tree/detachedFieldIndexFormatV2.ts +6 -4
  541. package/src/core/tree/index.ts +2 -4
  542. package/src/external-utilities/typeboxValidator.ts +1 -1
  543. package/src/feature-libraries/chunked-forest/codec/codecs.ts +18 -13
  544. package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +2 -2
  545. package/src/feature-libraries/chunked-forest/codec/format.ts +15 -4
  546. package/src/feature-libraries/chunked-forest/codec/index.ts +4 -2
  547. package/src/feature-libraries/chunked-forest/codec/uncompressedEncode.ts +2 -2
  548. package/src/feature-libraries/chunked-forest/index.ts +0 -1
  549. package/src/feature-libraries/default-schema/defaultFieldKinds.ts +2 -29
  550. package/src/feature-libraries/forest-summary/codec.ts +24 -9
  551. package/src/feature-libraries/forest-summary/forestSummarizer.ts +1 -1
  552. package/src/feature-libraries/forest-summary/format.ts +12 -2
  553. package/src/feature-libraries/forest-summary/index.ts +2 -1
  554. package/src/feature-libraries/index.ts +1 -2
  555. package/src/feature-libraries/schema-edits/index.ts +0 -1
  556. package/src/feature-libraries/schema-edits/schemaChangeCodecs.ts +16 -16
  557. package/src/feature-libraries/schema-index/codec.ts +34 -22
  558. package/src/feature-libraries/schema-index/formatV1.ts +2 -2
  559. package/src/feature-libraries/schema-index/formatV2.ts +2 -2
  560. package/src/feature-libraries/schema-index/schemaSummarizer.ts +2 -1
  561. package/src/index.ts +3 -1
  562. package/src/packageVersion.ts +1 -1
  563. package/src/shared-tree/independentView.ts +16 -5
  564. package/src/shared-tree/sharedTree.ts +112 -172
  565. package/src/shared-tree/sharedTreeChangeCodecs.ts +15 -9
  566. package/src/shared-tree/sharedTreeChangeFamily.ts +2 -2
  567. package/src/shared-tree/treeAlpha.ts +6 -5
  568. package/src/shared-tree/treeCheckout.ts +1 -3
  569. package/src/shared-tree-core/editManagerCodecs.ts +56 -19
  570. package/src/shared-tree-core/editManagerFormatCommons.ts +47 -0
  571. package/src/shared-tree-core/editManagerFormatV1toV4.ts +10 -5
  572. package/src/shared-tree-core/editManagerFormatV5.ts +3 -3
  573. package/src/shared-tree-core/index.ts +11 -5
  574. package/src/shared-tree-core/messageCodecV1ToV4.ts +6 -1
  575. package/src/shared-tree-core/messageCodecV5.ts +2 -1
  576. package/src/shared-tree-core/messageCodecs.ts +60 -26
  577. package/src/shared-tree-core/messageFormat.ts +56 -0
  578. package/src/shared-tree-core/sharedTreeCore.ts +11 -13
  579. package/src/simple-tree/api/discrepancies.ts +2 -2
  580. package/src/simple-tree/api/incrementalAllowedTypes.ts +1 -1
  581. package/src/simple-tree/api/index.ts +6 -2
  582. package/src/simple-tree/api/schemaFactoryAlpha.ts +2 -168
  583. package/src/simple-tree/api/schemaFactoryBeta.ts +180 -14
  584. package/src/simple-tree/api/schemaFromSimple.ts +6 -3
  585. package/src/simple-tree/api/simpleSchemaCodec.ts +360 -0
  586. package/src/simple-tree/api/storedSchema.ts +8 -5
  587. package/src/simple-tree/api/tree.ts +2 -2
  588. package/src/simple-tree/api/typesUnsafe.ts +6 -6
  589. package/src/simple-tree/api/viewSchemaToSimpleSchema.ts +80 -47
  590. package/src/simple-tree/core/allowedTypes.ts +3 -3
  591. package/src/simple-tree/core/treeNode.ts +2 -2
  592. package/src/simple-tree/index.ts +5 -1
  593. package/src/simple-tree/node-kinds/array/arrayNode.ts +2 -2
  594. package/src/simple-tree/node-kinds/map/mapNode.ts +2 -2
  595. package/src/simple-tree/node-kinds/object/objectNode.ts +3 -3
  596. package/src/simple-tree/node-kinds/record/recordNode.ts +3 -3
  597. package/src/simple-tree/simpleSchema.ts +12 -3
  598. package/src/simple-tree/simpleSchemaFormatV1.ts +179 -0
  599. package/src/tableSchema.ts +5 -2
  600. package/src/treeFactory.ts +33 -1
  601. package/src/util/brand.ts +40 -2
  602. package/src/util/brandedMap.ts +3 -1
  603. package/src/util/index.ts +1 -0
@@ -40,12 +40,12 @@ var __setFunctionName = (this && this.__setFunctionName) || function (f, name, p
40
40
  if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
41
41
  return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
42
42
  };
43
- import { assert, fail, unreachableCase } from "@fluidframework/core-utils/internal";
43
+ import { assert, fail } from "@fluidframework/core-utils/internal";
44
44
  import { UsageError, } from "@fluidframework/telemetry-utils/internal";
45
45
  import { DependentFormatVersion, FluidClientVersion, FormatValidatorNoOp, } from "../codec/index.js";
46
- import { LeafNodeStoredSchema, MapNodeStoredSchema, ObjectNodeStoredSchema, RevisionTagCodec, SchemaVersion, TreeStoredSchemaRepository, getCodecTreeForDetachedFieldIndexFormat, makeDetachedFieldIndex, moveToDetachedField, } from "../core/index.js";
46
+ import { LeafNodeStoredSchema, MapNodeStoredSchema, ObjectNodeStoredSchema, RevisionTagCodec, TreeStoredSchemaRepository, getCodecTreeForDetachedFieldIndexFormat, makeDetachedFieldIndex, moveToDetachedField, } from "../core/index.js";
47
47
  import { DetachedFieldIndexSummarizer, FieldKinds, ForestSummarizer, SchemaSummarizer, TreeCompressionStrategy, buildChunkedForest, buildForest, defaultIncrementalEncodingPolicy, defaultSchemaPolicy, getCodecTreeForFieldBatchFormat, getCodecTreeForForestFormat, getCodecTreeForSchemaFormat, jsonableTreeFromFieldCursor, makeFieldBatchCodec, makeMitigatedChangeFamily, makeSchemaCodec, makeTreeChunker, } from "../feature-libraries/index.js";
48
- import { getCodecTreeForEditManagerFormatWithChange, getCodecTreeForMessageFormatWithChange, SharedTreeCore, } from "../shared-tree-core/index.js";
48
+ import { clientVersionToEditManagerFormatVersion, clientVersionToMessageFormatVersion, getCodecTreeForEditManagerFormatWithChange, getCodecTreeForMessageFormatWithChange, MessageFormatVersion, SharedTreeCore, EditManagerFormatVersion, } from "../shared-tree-core/index.js";
49
49
  import { NodeKind, tryStoredSchemaAsArray, FieldKind, } from "../simple-tree/index.js";
50
50
  import { SchematizingSimpleTreeView } from "./schematizingTreeView.js";
51
51
  import { SharedTreeReadonlyChangeEnricher } from "./sharedTreeChangeEnricher.js";
@@ -53,79 +53,6 @@ import { SharedTreeChangeFamily } from "./sharedTreeChangeFamily.js";
53
53
  import { createTreeCheckout } from "./treeCheckout.js";
54
54
  import { brand, breakingClass, throwIfBroken, } from "../util/index.js";
55
55
  import { getCodecTreeForChangeFormat, } from "./sharedTreeChangeCodecs.js";
56
- const formatVersionToTopLevelCodecVersions = new Map([
57
- [
58
- 1,
59
- {
60
- forest: brand(1),
61
- schema: brand(1),
62
- detachedFieldIndex: brand(1),
63
- editManager: brand(1),
64
- message: brand(1),
65
- fieldBatch: brand(1),
66
- },
67
- ],
68
- [
69
- 2,
70
- {
71
- forest: brand(1),
72
- schema: brand(1),
73
- detachedFieldIndex: brand(1),
74
- editManager: brand(2),
75
- message: brand(2),
76
- fieldBatch: brand(1),
77
- },
78
- ],
79
- [
80
- 3,
81
- {
82
- forest: brand(1),
83
- schema: brand(1),
84
- detachedFieldIndex: brand(1),
85
- editManager: brand(3),
86
- message: brand(3),
87
- fieldBatch: brand(1),
88
- },
89
- ],
90
- [
91
- 4,
92
- {
93
- forest: brand(1),
94
- schema: brand(1),
95
- detachedFieldIndex: brand(1),
96
- editManager: brand(4),
97
- message: brand(4),
98
- fieldBatch: brand(1),
99
- },
100
- ],
101
- [
102
- 5,
103
- {
104
- forest: brand(1),
105
- schema: brand(2),
106
- detachedFieldIndex: brand(1),
107
- editManager: brand(4),
108
- message: brand(4),
109
- fieldBatch: brand(1),
110
- },
111
- ],
112
- [
113
- 100, // SharedTreeFormatVersion.vSharedBranches
114
- {
115
- forest: brand(1),
116
- schema: brand(2),
117
- detachedFieldIndex: brand(1),
118
- editManager: brand(5),
119
- message: brand(5),
120
- fieldBatch: brand(1),
121
- },
122
- ],
123
- ]);
124
- function getCodecVersions(formatVersion) {
125
- const versions = formatVersionToTopLevelCodecVersions.get(formatVersion);
126
- assert(versions !== undefined, 0x90e /* Unknown format version */);
127
- return versions;
128
- }
129
56
  /**
130
57
  * SharedTreeCore, configured with a good set of indexes and field kinds which will maintain compatibility over time.
131
58
  *
@@ -144,17 +71,22 @@ let SharedTreeKernel = (() => {
144
71
  return this.checkout.storedSchema;
145
72
  }
146
73
  constructor(breaker, sharedObject, serializer, submitLocalMessage, lastSequenceNumber, initialSequenceNumber, logger, idCompressor, optionsParam) {
147
- const options = { ...defaultSharedTreeOptions, ...optionsParam };
148
- const codecVersions = getCodecVersions(options.formatVersion);
74
+ const options = {
75
+ ...defaultSharedTreeOptions,
76
+ ...optionsParam,
77
+ };
78
+ if (options.minVersionForCollab < FluidClientVersion.v2_0) {
79
+ throw new UsageError("SharedTree requires minVersionForCollab of at least 2.0.0");
80
+ }
149
81
  const schema = new TreeStoredSchemaRepository();
150
82
  const forest = buildConfiguredForest(breaker, options.forest, schema, idCompressor, options.shouldEncodeIncrementally);
151
83
  const revisionTagCodec = new RevisionTagCodec(idCompressor);
152
84
  const removedRoots = makeDetachedFieldIndex("repair", revisionTagCodec, idCompressor, options);
153
- const schemaCodec = makeSchemaCodec(options, codecVersions.schema);
85
+ const schemaCodec = makeSchemaCodec(options);
154
86
  const schemaSummarizer = new SchemaSummarizer(schema, {
155
87
  getCurrentSeq: lastSequenceNumber,
156
88
  }, schemaCodec);
157
- const fieldBatchCodec = makeFieldBatchCodec(options, codecVersions.fieldBatch);
89
+ const fieldBatchCodec = makeFieldBatchCodec(options);
158
90
  const encoderContext = {
159
91
  schema: {
160
92
  schema,
@@ -186,7 +118,7 @@ let SharedTreeKernel = (() => {
186
118
  throw error;
187
119
  });
188
120
  const changeEnricher = new SharedTreeReadonlyChangeEnricher(forest, schema, removedRoots);
189
- super(breaker, sharedObject, serializer, submitLocalMessage, logger, [schemaSummarizer, forestSummarizer, removedRootsSummarizer], changeFamily, options, codecVersions, changeFormatVersionForEditManager, changeFormatVersionForMessage, idCompressor, schema, defaultSchemaPolicy, undefined, changeEnricher);
121
+ super(breaker, sharedObject, serializer, submitLocalMessage, logger, [schemaSummarizer, forestSummarizer, removedRootsSummarizer], changeFamily, options, changeFormatVersionForEditManager, changeFormatVersionForMessage, idCompressor, schema, defaultSchemaPolicy, undefined, changeEnricher);
190
122
  this.logger = (__runInitializers(this, _instanceExtraInitializers), logger);
191
123
  this.checkouts = new Map();
192
124
  this.checkout = createTreeCheckout(idCompressor, this.mintRevisionTag, revisionTagCodec, {
@@ -350,7 +282,12 @@ export function exportSimpleSchema(storedSchema) {
350
282
  * @alpha
351
283
  */
352
284
  export function persistedToSimpleSchema(persisted, options) {
353
- const schemaCodec = makeSchemaCodec(options, SchemaVersion.v1);
285
+ // Any version can be passed down to makeSchemaCodec here.
286
+ // We only use the decode part, which always dispatches to the correct codec based on the version in the data, not the version passed to `makeSchemaCodec`.
287
+ const schemaCodec = makeSchemaCodec({
288
+ ...options,
289
+ minVersionForCollab: FluidClientVersion.v2_0,
290
+ });
354
291
  const stored = schemaCodec.decode(persisted);
355
292
  return exportSimpleSchema(stored);
356
293
  }
@@ -401,11 +338,26 @@ export const SharedTreeFormatVersion = {
401
338
  * This is because the format for SharedTree changes are not explicitly versioned.
402
339
  */
403
340
  export const changeFormatVersionForEditManager = DependentFormatVersion.fromPairs([
404
- [brand(1), brand(1)],
405
- [brand(2), brand(2)],
406
- [brand(3), brand(3)],
407
- [brand(4), brand(4)],
408
- [brand(5), brand(4)],
341
+ [
342
+ brand(EditManagerFormatVersion.v1),
343
+ brand(1),
344
+ ],
345
+ [
346
+ brand(EditManagerFormatVersion.v2),
347
+ brand(2),
348
+ ],
349
+ [
350
+ brand(EditManagerFormatVersion.v3),
351
+ brand(3),
352
+ ],
353
+ [
354
+ brand(EditManagerFormatVersion.v4),
355
+ brand(4),
356
+ ],
357
+ [
358
+ brand(EditManagerFormatVersion.v5),
359
+ brand(4),
360
+ ],
409
361
  ]);
410
362
  /**
411
363
  * Defines for each MessageFormatVersion the SharedTreeChangeFormatVersion to use.
@@ -414,53 +366,52 @@ export const changeFormatVersionForEditManager = DependentFormatVersion.fromPair
414
366
  * This is because the format for SharedTree changes are not explicitly versioned.
415
367
  */
416
368
  export const changeFormatVersionForMessage = DependentFormatVersion.fromPairs([
417
- [brand(undefined), brand(1)],
418
- [brand(1), brand(1)],
419
- [brand(2), brand(2)],
420
- [brand(3), brand(3)],
421
- [brand(4), brand(4)],
422
- [brand(5), brand(4)],
369
+ [
370
+ brand(MessageFormatVersion.undefined),
371
+ brand(1),
372
+ ],
373
+ [
374
+ brand(MessageFormatVersion.v1),
375
+ brand(1),
376
+ ],
377
+ [
378
+ brand(MessageFormatVersion.v2),
379
+ brand(2),
380
+ ],
381
+ [
382
+ brand(MessageFormatVersion.v3),
383
+ brand(3),
384
+ ],
385
+ [
386
+ brand(MessageFormatVersion.v4),
387
+ brand(4),
388
+ ],
389
+ [
390
+ brand(MessageFormatVersion.v5),
391
+ brand(4),
392
+ ],
423
393
  ]);
424
- function getCodecTreeForEditManagerFormat(version) {
425
- const change = changeFormatVersionForEditManager.lookup(version);
426
- const changeCodecTree = getCodecTreeForChangeFormat(change);
427
- return getCodecTreeForEditManagerFormatWithChange(version, changeCodecTree);
394
+ function getCodecTreeForEditManagerFormat(clientVersion) {
395
+ const change = changeFormatVersionForEditManager.lookup(clientVersionToEditManagerFormatVersion(clientVersion));
396
+ const changeCodecTree = getCodecTreeForChangeFormat(change, clientVersion);
397
+ return getCodecTreeForEditManagerFormatWithChange(clientVersion, changeCodecTree);
428
398
  }
429
- function getCodecTreeForMessageFormat(version) {
430
- const change = changeFormatVersionForMessage.lookup(version);
431
- const changeCodecTree = getCodecTreeForChangeFormat(change);
432
- return getCodecTreeForMessageFormatWithChange(version, changeCodecTree);
399
+ function getCodecTreeForMessageFormat(clientVersion) {
400
+ const change = changeFormatVersionForMessage.lookup(clientVersionToMessageFormatVersion(clientVersion));
401
+ const changeCodecTree = getCodecTreeForChangeFormat(change, clientVersion);
402
+ return getCodecTreeForMessageFormatWithChange(clientVersion, changeCodecTree);
433
403
  }
434
- export function getCodecTreeForSharedTreeFormat(version) {
404
+ export function getCodecTreeForSharedTreeFormat(clientVersion) {
435
405
  const children = [];
436
- const childCodecs = getCodecVersions(version);
437
- for (const name of Object.keys(childCodecs)) {
438
- switch (name) {
439
- case "editManager":
440
- children.push(getCodecTreeForEditManagerFormat(childCodecs.editManager));
441
- break;
442
- case "message":
443
- children.push(getCodecTreeForMessageFormat(childCodecs.message));
444
- break;
445
- case "forest":
446
- children.push(getCodecTreeForForestFormat(childCodecs.forest));
447
- break;
448
- case "schema":
449
- children.push(getCodecTreeForSchemaFormat(childCodecs.schema));
450
- break;
451
- case "detachedFieldIndex":
452
- children.push(getCodecTreeForDetachedFieldIndexFormat(childCodecs.detachedFieldIndex));
453
- break;
454
- case "fieldBatch":
455
- children.push(getCodecTreeForFieldBatchFormat(childCodecs.fieldBatch));
456
- break;
457
- default:
458
- unreachableCase(name);
459
- }
460
- }
406
+ children.push(getCodecTreeForForestFormat(clientVersion));
407
+ children.push(getCodecTreeForSchemaFormat(clientVersion));
408
+ children.push(getCodecTreeForDetachedFieldIndexFormat(clientVersion));
409
+ children.push(getCodecTreeForEditManagerFormat(clientVersion));
410
+ children.push(getCodecTreeForMessageFormat(clientVersion));
411
+ children.push(getCodecTreeForFieldBatchFormat(clientVersion));
461
412
  return {
462
413
  name: "SharedTree",
463
- version,
414
+ version: undefined, // SharedTree does not have a version of its own.
464
415
  children,
465
416
  };
466
417
  }
@@ -507,9 +458,10 @@ export const defaultSharedTreeOptions = {
507
458
  minVersionForCollab: FluidClientVersion.v2_0,
508
459
  forest: ForestTypeReference,
509
460
  treeEncodeType: TreeCompressionStrategy.Compressed,
510
- formatVersion: SharedTreeFormatVersion.v3,
511
461
  disposeForksAfterTransaction: true,
512
462
  shouldEncodeIncrementally: defaultIncrementalEncodingPolicy,
463
+ editManagerFormatSelector: clientVersionToEditManagerFormatVersion,
464
+ messageFormatSelector: clientVersionToMessageFormatVersion,
513
465
  };
514
466
  /**
515
467
  * Build the allowed types for a Stored Schema.
@@ -556,6 +508,8 @@ function exportSimpleFieldSchemaStored(schema) {
556
508
  * Export a {@link SimpleNodeSchema} from a {@link TreeNodeStoredSchema}.
557
509
  * @privateRemarks
558
510
  * TODO: Persist node metadata once schema FormatV2 is supported.
511
+ * Note on SimpleNodeSchema construction: In the persisted format `persistedMetadata` is just called `metadata` whereas the `metadata`
512
+ * field on SimpleNodeSchema is not persisted.
559
513
  */
560
514
  function exportSimpleNodeSchemaStored(schema) {
561
515
  const arrayTypes = tryStoredSchemaAsArray(schema);
@@ -572,7 +526,13 @@ function exportSimpleNodeSchemaStored(schema) {
572
526
  for (const [storedKey, field] of schema.objectNodeFields) {
573
527
  fields.set(storedKey, { ...exportSimpleFieldSchemaStored(field), storedKey });
574
528
  }
575
- return { kind: NodeKind.Object, fields, metadata: {}, persistedMetadata: schema.metadata };
529
+ return {
530
+ kind: NodeKind.Object,
531
+ fields,
532
+ allowUnknownOptionalFields: undefined,
533
+ metadata: {},
534
+ persistedMetadata: schema.metadata,
535
+ };
576
536
  }
577
537
  if (schema instanceof MapNodeStoredSchema) {
578
538
  assert(schema.mapFields.kind === FieldKinds.optional.identifier, 0xa95 /* Invalid map schema */);
@@ -1 +1 @@
1
- {"version":3,"file":"sharedTree.js","sourceRoot":"","sources":["../../src/shared-tree/sharedTree.ts"],"names":[],"mappings":"AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGH,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAQpF,OAAO,EACN,UAAU,GAEV,MAAM,0CAA0C,CAAC;AAElD,OAAO,EAGN,sBAAsB,EACtB,kBAAkB,EAClB,mBAAmB,GAEnB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAMN,oBAAoB,EACpB,mBAAmB,EACnB,sBAAsB,EACtB,gBAAgB,EAEhB,aAAa,EAIb,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,IAAI,MAAM,CAAC,gBAAgB,EAAE,CAAC;YAC1D,MAAM,CAAC,GAAG,CAAC,SAAS,EAAE,EAAE,GAAG,6BAA6B,CAAC,KAAK,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC;QAC/E,CAAC;QACD,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,iBAAiB,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC;IAC5F,CAAC;IACD,IAAI,MAAM,YAAY,mBAAmB,EAAE,CAAC;QAC3C,MAAM,CACL,MAAM,CAAC,SAAS,CAAC,IAAI,KAAK,UAAU,CAAC,QAAQ,CAAC,UAAU,EACxD,KAAK,CAAC,wBAAwB,CAC9B,CAAC;QACF,OAAO;YACN,IAAI,EAAE,QAAQ,CAAC,GAAG;YAClB,kBAAkB,EAAE,+CAA+C,CAClE,MAAM,CAAC,SAAS,CAAC,KAAK,CACtB;YACD,QAAQ,EAAE,EAAE;YACZ,iBAAiB,EAAE,MAAM,CAAC,QAAQ;SAClC,CAAC;IACH,CAAC;IACD,IAAI,MAAM,YAAY,oBAAoB,EAAE,CAAC;QAC5C,OAAO;YACN,IAAI,EAAE,QAAQ,CAAC,IAAI;YACnB,QAAQ,EAAE,MAAM,CAAC,SAAS;YAC1B,QAAQ,EAAE,EAAE;YACZ,iBAAiB,EAAE,MAAM,CAAC,QAAQ;SAClC,CAAC;IACH,CAAC;IACD,IAAI,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC;AACvC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ErasedType, IFluidLoadable } from \"@fluidframework/core-interfaces/internal\";\nimport { assert, fail, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport type { IChannelStorageService } from \"@fluidframework/datastore-definitions/internal\";\nimport type { IIdCompressor, StableId } from \"@fluidframework/id-compressor\";\nimport type {\n\tIChannelView,\n\tIFluidSerializer,\n\tSharedKernel,\n} from \"@fluidframework/shared-object-base/internal\";\nimport {\n\tUsageError,\n\ttype ITelemetryLoggerExt,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\ttype CodecTree,\n\ttype CodecWriteOptions,\n\tDependentFormatVersion,\n\tFluidClientVersion,\n\tFormatValidatorNoOp,\n\ttype ICodecOptions,\n} from \"../codec/index.js\";\nimport {\n\ttype DetachedFieldIndexFormatVersion,\n\ttype FieldKey,\n\ttype GraphCommit,\n\ttype IEditableForest,\n\ttype JsonableTree,\n\tLeafNodeStoredSchema,\n\tMapNodeStoredSchema,\n\tObjectNodeStoredSchema,\n\tRevisionTagCodec,\n\ttype SchemaFormatVersion,\n\tSchemaVersion,\n\ttype TreeFieldStoredSchema,\n\ttype TreeNodeStoredSchema,\n\ttype TreeStoredSchema,\n\tTreeStoredSchemaRepository,\n\ttype TreeStoredSchemaSubscription,\n\ttype TreeTypeSet,\n\tgetCodecTreeForDetachedFieldIndexFormat,\n\tmakeDetachedFieldIndex,\n\tmoveToDetachedField,\n} from \"../core/index.js\";\nimport {\n\tDetachedFieldIndexSummarizer,\n\tFieldKinds,\n\tForestSummarizer,\n\tSchemaSummarizer,\n\tTreeCompressionStrategy,\n\tbuildChunkedForest,\n\tbuildForest,\n\tdefaultIncrementalEncodingPolicy,\n\tdefaultSchemaPolicy,\n\tgetCodecTreeForFieldBatchFormat,\n\tgetCodecTreeForForestFormat,\n\tgetCodecTreeForSchemaFormat,\n\tjsonableTreeFromFieldCursor,\n\tmakeFieldBatchCodec,\n\tmakeMitigatedChangeFamily,\n\tmakeSchemaCodec,\n\tmakeTreeChunker,\n\ttype IncrementalEncodingPolicy,\n\ttype FieldBatchFormatVersion,\n\ttype ForestFormatVersion,\n\ttype TreeCompressionStrategyPrivate,\n} from \"../feature-libraries/index.js\";\n// eslint-disable-next-line import/no-internal-modules\nimport type { FormatV1 } from \"../feature-libraries/schema-index/index.js\";\nimport {\n\ttype BranchId,\n\ttype ClonableSchemaAndPolicy,\n\ttype EditManagerFormatVersion,\n\ttype ExplicitCoreCodecVersions,\n\tgetCodecTreeForEditManagerFormatWithChange,\n\tgetCodecTreeForMessageFormatWithChange,\n\ttype MessageFormatVersion,\n\tSharedTreeCore,\n} from \"../shared-tree-core/index.js\";\nimport {\n\ttype ITree,\n\ttype ImplicitFieldSchema,\n\tNodeKind,\n\ttype ReadSchema,\n\ttype SimpleFieldSchema,\n\ttype SimpleTreeSchema,\n\ttype TreeView,\n\ttype TreeViewAlpha,\n\ttype TreeViewConfiguration,\n\ttype UnsafeUnknownSchema,\n\ttype VerboseTree,\n\ttryStoredSchemaAsArray,\n\ttype SimpleNodeSchema,\n\tFieldKind,\n\ttype ITreeAlpha,\n\ttype SimpleObjectFieldSchema,\n\ttype SimpleAllowedTypeAttributes,\n} from \"../simple-tree/index.js\";\n\nimport { SchematizingSimpleTreeView } from \"./schematizingTreeView.js\";\nimport { SharedTreeReadonlyChangeEnricher } from \"./sharedTreeChangeEnricher.js\";\nimport { SharedTreeChangeFamily } from \"./sharedTreeChangeFamily.js\";\nimport type { SharedTreeChange } from \"./sharedTreeChangeTypes.js\";\nimport type { SharedTreeEditBuilder } from \"./sharedTreeEditBuilder.js\";\nimport { type TreeCheckout, type BranchableTree, createTreeCheckout } from \"./treeCheckout.js\";\nimport {\n\tbrand,\n\ttype Breakable,\n\tbreakingClass,\n\ttype JsonCompatible,\n\tthrowIfBroken,\n} from \"../util/index.js\";\nimport {\n\tgetCodecTreeForChangeFormat,\n\ttype SharedTreeChangeFormatVersion,\n} from \"./sharedTreeChangeCodecs.js\";\n\n/**\n * Copy of data from an {@link ITreePrivate} at some point in time.\n * @remarks\n * This is unrelated to Fluids concept of \"snapshots\".\n */\nexport interface SharedTreeContentSnapshot {\n\t/**\n\t * The schema stored in the document.\n\t *\n\t * @remarks\n\t * Edits to the schema can mutate the schema stored of the tree which took this snapshot (but this snapshot will remain the same)\n\t * This is mainly useful for debugging cases where schematize reports an incompatible view schema.\n\t */\n\treadonly schema: TreeStoredSchema;\n\t/**\n\t * All {@link TreeStatus.InDocument} content.\n\t */\n\treadonly tree: JsonableTree[];\n\t/**\n\t * All {@link TreeStatus.Removed} content.\n\t */\n\treadonly removed: [string | number | undefined, number, JsonableTree][];\n}\n\n/**\n * {@link ITree} extended with some non-public APIs.\n * @internal\n */\nexport interface ITreeInternal extends IChannelView, ITreeAlpha {}\n\n/**\n * {@link ITreeInternal} extended with some non-exported APIs.\n * @remarks\n * This allows access to the tree content using the internal data model used at the storage and \"flex\" layers,\n * and should only be needed for testing and debugging this package's internals.\n */\nexport interface ITreePrivate extends ITreeInternal {\n\t/**\n\t * Provides a copy of the current content of the tree.\n\t * This can be useful for inspecting the tree when no suitable view schema is available.\n\t * This is only intended for use in testing and exceptional code paths: it is not performant.\n\t *\n\t * This does not include everything that is included in a tree summary, since information about how to merge future edits is omitted.\n\t */\n\tcontentSnapshot(): SharedTreeContentSnapshot;\n\n\t/**\n\t * Access to internals for testing.\n\t */\n\treadonly kernel: SharedTreeKernel;\n}\n\n/**\n * Has an entry for each codec which writes an explicit version into its data.\n *\n * This is used to map the single API entrypoint controlling the format {@link SharedTreeOptions.formatVersion}\n * to a list of write versions that for each codec that should be used for that format.\n *\n * Note that all explicitly versioned codecs should be using the format version from the data to read encoded data.\n *\n * TODO: Plumb these write versions into forest, schema, detached field index codec creation.\n */\ninterface ExplicitCodecVersions extends ExplicitCoreCodecVersions {\n\tforest: ForestFormatVersion;\n\tschema: SchemaFormatVersion;\n\tdetachedFieldIndex: DetachedFieldIndexFormatVersion;\n\tfieldBatch: FieldBatchFormatVersion;\n}\n\nconst formatVersionToTopLevelCodecVersions = new Map<number, ExplicitCodecVersions>([\n\t[\n\t\t1,\n\t\t{\n\t\t\tforest: brand(1),\n\t\t\tschema: brand(1),\n\t\t\tdetachedFieldIndex: brand(1),\n\t\t\teditManager: brand(1),\n\t\t\tmessage: brand(1),\n\t\t\tfieldBatch: brand(1),\n\t\t},\n\t],\n\t[\n\t\t2,\n\t\t{\n\t\t\tforest: brand(1),\n\t\t\tschema: brand(1),\n\t\t\tdetachedFieldIndex: brand(1),\n\t\t\teditManager: brand(2),\n\t\t\tmessage: brand(2),\n\t\t\tfieldBatch: brand(1),\n\t\t},\n\t],\n\t[\n\t\t3,\n\t\t{\n\t\t\tforest: brand(1),\n\t\t\tschema: brand(1),\n\t\t\tdetachedFieldIndex: brand(1),\n\t\t\teditManager: brand(3),\n\t\t\tmessage: brand(3),\n\t\t\tfieldBatch: brand(1),\n\t\t},\n\t],\n\t[\n\t\t4,\n\t\t{\n\t\t\tforest: brand(1),\n\t\t\tschema: brand(1),\n\t\t\tdetachedFieldIndex: brand(1),\n\t\t\teditManager: brand(4),\n\t\t\tmessage: brand(4),\n\t\t\tfieldBatch: brand(1),\n\t\t},\n\t],\n\t[\n\t\t5,\n\t\t{\n\t\t\tforest: brand(1),\n\t\t\tschema: brand(2),\n\t\t\tdetachedFieldIndex: brand(1),\n\t\t\teditManager: brand(4),\n\t\t\tmessage: brand(4),\n\t\t\tfieldBatch: brand(1),\n\t\t},\n\t],\n\t[\n\t\t100, // SharedTreeFormatVersion.vSharedBranches\n\t\t{\n\t\t\tforest: brand(1),\n\t\t\tschema: brand(2),\n\t\t\tdetachedFieldIndex: brand(1),\n\t\t\teditManager: brand(5),\n\t\t\tmessage: brand(5),\n\t\t\tfieldBatch: brand(1),\n\t\t},\n\t],\n]);\n\nfunction getCodecVersions(formatVersion: number): ExplicitCodecVersions {\n\tconst versions = formatVersionToTopLevelCodecVersions.get(formatVersion);\n\tassert(versions !== undefined, 0x90e /* Unknown format version */);\n\treturn versions;\n}\n\n/**\n * The type SharedTree's kernel's view must implement so what when its merged with the underling SharedObject's API it fully implements the required tree API surface ({@link ITreePrivate }).\n */\nexport type SharedTreeKernelView = Omit<ITreePrivate, keyof (IChannelView & IFluidLoadable)>;\n\n/**\n * SharedTreeCore, configured with a good set of indexes and field kinds which will maintain compatibility over time.\n *\n * TODO: detail compatibility requirements.\n */\n@breakingClass\nexport class SharedTreeKernel\n\textends SharedTreeCore<SharedTreeEditBuilder, SharedTreeChange>\n\timplements SharedKernel\n{\n\tpublic readonly checkout: TreeCheckout;\n\tpublic get storedSchema(): TreeStoredSchemaRepository {\n\t\treturn this.checkout.storedSchema;\n\t}\n\n\tprivate readonly checkouts: Map<BranchId, TreeCheckout> = new Map();\n\n\t/**\n\t * The app-facing API for SharedTree implemented by this Kernel.\n\t * @remarks\n\t * This is the API grafted onto the ISharedObject which apps can access.\n\t * It includes both the APIs used for internal testing, and public facing APIs (both stable and unstable).\n\t * Different users will have access to different subsets of this API, see {@link ITree}, {@link ITreeAlpha} and {@link ITreeInternal} which this {@link ITreePrivate} extends.\n\t */\n\tpublic readonly view: SharedTreeKernelView;\n\n\tpublic constructor(\n\t\tbreaker: Breakable,\n\t\tsharedObject: IChannelView & IFluidLoadable,\n\t\tserializer: IFluidSerializer,\n\t\tsubmitLocalMessage: (content: unknown, localOpMetadata?: unknown) => void,\n\t\tlastSequenceNumber: () => number | undefined,\n\t\tinitialSequenceNumber: number,\n\t\tprivate readonly logger: ITelemetryLoggerExt | undefined,\n\t\tidCompressor: IIdCompressor,\n\t\toptionsParam: SharedTreeOptionsInternal,\n\t) {\n\t\tconst options = { ...defaultSharedTreeOptions, ...optionsParam };\n\t\tconst codecVersions = getCodecVersions(options.formatVersion);\n\t\tconst schema = new TreeStoredSchemaRepository();\n\t\tconst forest = buildConfiguredForest(\n\t\t\tbreaker,\n\t\t\toptions.forest,\n\t\t\tschema,\n\t\t\tidCompressor,\n\t\t\toptions.shouldEncodeIncrementally,\n\t\t);\n\t\tconst revisionTagCodec = new RevisionTagCodec(idCompressor);\n\t\tconst removedRoots = makeDetachedFieldIndex(\n\t\t\t\"repair\",\n\t\t\trevisionTagCodec,\n\t\t\tidCompressor,\n\t\t\toptions,\n\t\t);\n\t\tconst schemaCodec = makeSchemaCodec(options, codecVersions.schema);\n\t\tconst schemaSummarizer = new SchemaSummarizer(\n\t\t\tschema,\n\t\t\t{\n\t\t\t\tgetCurrentSeq: lastSequenceNumber,\n\t\t\t},\n\t\t\tschemaCodec,\n\t\t);\n\t\tconst fieldBatchCodec = makeFieldBatchCodec(options, codecVersions.fieldBatch);\n\n\t\tconst encoderContext = {\n\t\t\tschema: {\n\t\t\t\tschema,\n\t\t\t\tpolicy: defaultSchemaPolicy,\n\t\t\t},\n\t\t\tencodeType: options.treeEncodeType,\n\t\t\toriginatorId: idCompressor.localSessionId,\n\t\t\tidCompressor,\n\t\t};\n\t\tconst forestSummarizer = new ForestSummarizer(\n\t\t\tforest,\n\t\t\trevisionTagCodec,\n\t\t\tfieldBatchCodec,\n\t\t\tencoderContext,\n\t\t\toptions,\n\t\t\tidCompressor,\n\t\t\tinitialSequenceNumber,\n\t\t\toptions.shouldEncodeIncrementally,\n\t\t);\n\t\tconst removedRootsSummarizer = new DetachedFieldIndexSummarizer(removedRoots);\n\t\tconst innerChangeFamily = new SharedTreeChangeFamily(\n\t\t\trevisionTagCodec,\n\t\t\tfieldBatchCodec,\n\t\t\toptions,\n\t\t\toptions.treeEncodeType,\n\t\t\tidCompressor,\n\t\t);\n\t\tconst changeFamily = makeMitigatedChangeFamily(\n\t\t\tinnerChangeFamily,\n\t\t\tSharedTreeChangeFamily.emptyChange,\n\t\t\t(error: unknown) => {\n\t\t\t\t// TODO:6344 Add telemetry for these errors.\n\t\t\t\t// Rethrowing the error has a different effect depending on the context in which the\n\t\t\t\t// ChangeFamily was invoked:\n\t\t\t\t// - If the ChangeFamily was invoked as part of incoming op processing, rethrowing the error\n\t\t\t\t// will cause the runtime to disconnect the client, log a severe error, and not reconnect.\n\t\t\t\t// This will not cause the host application to crash because it is not on the stack at that time.\n\t\t\t\t// TODO: let the host application know that the client is now disconnected.\n\t\t\t\t// - If the ChangeFamily was invoked as part of dealing with a local change, rethrowing the\n\t\t\t\t// error will cause the host application to crash. This is not ideal, but is better than\n\t\t\t\t// letting the application either send an invalid change to the server or allowing the\n\t\t\t\t// application to continue working when its local branches contain edits that cannot be\n\t\t\t\t// reflected in its views.\n\t\t\t\t// The best course of action for a host application in such a state is to restart.\n\t\t\t\t// TODO: let the host application know about this situation and provide a way to\n\t\t\t\t// programmatically reload the SharedTree container.\n\t\t\t\tthrow error;\n\t\t\t},\n\t\t);\n\t\tconst changeEnricher = new SharedTreeReadonlyChangeEnricher(forest, schema, removedRoots);\n\t\tsuper(\n\t\t\tbreaker,\n\t\t\tsharedObject,\n\t\t\tserializer,\n\t\t\tsubmitLocalMessage,\n\t\t\tlogger,\n\t\t\t[schemaSummarizer, forestSummarizer, removedRootsSummarizer],\n\t\t\tchangeFamily,\n\t\t\toptions,\n\t\t\tcodecVersions,\n\t\t\tchangeFormatVersionForEditManager,\n\t\t\tchangeFormatVersionForMessage,\n\t\t\tidCompressor,\n\t\t\tschema,\n\t\t\tdefaultSchemaPolicy,\n\t\t\tundefined,\n\t\t\tchangeEnricher,\n\t\t);\n\n\t\tthis.checkout = createTreeCheckout(idCompressor, this.mintRevisionTag, revisionTagCodec, {\n\t\t\tbranch: this.getLocalBranch(),\n\t\t\tchangeFamily,\n\t\t\tschema,\n\t\t\tforest,\n\t\t\tfieldBatchCodec,\n\t\t\tremovedRoots,\n\t\t\tchunkCompressionStrategy: options.treeEncodeType,\n\t\t\tlogger,\n\t\t\tbreaker: this.breaker,\n\t\t\tdisposeForksAfterTransaction: options.disposeForksAfterTransaction,\n\t\t});\n\n\t\tthis.registerCheckout(\"main\", this.checkout);\n\n\t\tthis.view = {\n\t\t\tcontentSnapshot: () => this.contentSnapshot(),\n\t\t\texportSimpleSchema: () => this.exportSimpleSchema(),\n\t\t\texportVerbose: () => this.exportVerbose(),\n\t\t\tviewWith: this.viewWith.bind(this),\n\t\t\tviewSharedBranchWith: this.viewBranchWith.bind(this),\n\t\t\tcreateSharedBranch: this.createSharedBranch.bind(this),\n\t\t\tgetSharedBranchIds: this.getSharedBranchIds.bind(this),\n\t\t\tkernel: this,\n\t\t};\n\t}\n\n\tprivate registerCheckout(branchId: BranchId, checkout: TreeCheckout): void {\n\t\tthis.checkouts.set(branchId, checkout);\n\t\tconst enricher = this.getCommitEnricher(branchId);\n\t\tcheckout.transaction.events.on(\"started\", () => {\n\t\t\tif (this.sharedObject.isAttached()) {\n\t\t\t\t// It is currently forbidden to attach during a transaction, so transaction state changes can be ignored until after attaching.\n\t\t\t\tenricher.startTransaction();\n\t\t\t}\n\t\t});\n\n\t\tcheckout.transaction.events.on(\"aborting\", () => {\n\t\t\tif (this.sharedObject.isAttached()) {\n\t\t\t\t// It is currently forbidden to attach during a transaction, so transaction state changes can be ignored until after attaching.\n\t\t\t\tenricher.abortTransaction();\n\t\t\t}\n\t\t});\n\t\tcheckout.transaction.events.on(\"committing\", () => {\n\t\t\tif (this.sharedObject.isAttached()) {\n\t\t\t\t// It is currently forbidden to attach during a transaction, so transaction state changes can be ignored until after attaching.\n\t\t\t\tenricher.commitTransaction();\n\t\t\t}\n\t\t});\n\t\tcheckout.events.on(\"beforeBatch\", (event) => {\n\t\t\tif (event.type === \"append\" && this.sharedObject.isAttached()) {\n\t\t\t\tif (checkout.transaction.isInProgress()) {\n\t\t\t\t\tenricher.addTransactionCommits(event.newCommits);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\tpublic exportVerbose(): VerboseTree | undefined {\n\t\treturn this.checkout.exportVerbose();\n\t}\n\n\tpublic exportSimpleSchema(): SimpleTreeSchema {\n\t\treturn exportSimpleSchema(this.storedSchema);\n\t}\n\n\t@throwIfBroken\n\tpublic contentSnapshot(): SharedTreeContentSnapshot {\n\t\tconst cursor = this.checkout.forest.allocateCursor(\"contentSnapshot\");\n\t\ttry {\n\t\t\tmoveToDetachedField(this.checkout.forest, cursor);\n\t\t\treturn {\n\t\t\t\tschema: this.storedSchema.clone(),\n\t\t\t\ttree: jsonableTreeFromFieldCursor(cursor),\n\t\t\t\tremoved: this.checkout.getRemovedRoots(),\n\t\t\t};\n\t\t} finally {\n\t\t\tcursor.free();\n\t\t}\n\t}\n\n\t// For the new TreeViewAlpha API\n\tpublic viewWith<TRoot extends ImplicitFieldSchema | UnsafeUnknownSchema>(\n\t\tconfig: TreeViewConfiguration<ReadSchema<TRoot>>,\n\t): SchematizingSimpleTreeView<TRoot> & TreeView<ReadSchema<TRoot>>;\n\n\t// For the old TreeView API\n\tpublic viewWith<TRoot extends ImplicitFieldSchema>(\n\t\tconfig: TreeViewConfiguration<TRoot>,\n\t): SchematizingSimpleTreeView<TRoot> & TreeView<TRoot>;\n\n\tpublic viewWith<TRoot extends ImplicitFieldSchema | UnsafeUnknownSchema>(\n\t\tconfig: TreeViewConfiguration<ReadSchema<TRoot>>,\n\t): SchematizingSimpleTreeView<TRoot> & TreeView<ReadSchema<TRoot>> {\n\t\treturn this.checkout.viewWith(config) as SchematizingSimpleTreeView<TRoot> &\n\t\t\tTreeView<ReadSchema<TRoot>>;\n\t}\n\n\tpublic viewBranchWith<TRoot extends ImplicitFieldSchema>(\n\t\tbranchId: string,\n\t\tconfig: TreeViewConfiguration<TRoot>,\n\t): TreeView<TRoot>;\n\n\tpublic viewBranchWith<TRoot extends ImplicitFieldSchema | UnsafeUnknownSchema>(\n\t\tbranchId: string,\n\t\tconfig: TreeViewConfiguration<ReadSchema<TRoot>>,\n\t): SchematizingSimpleTreeView<TRoot> & TreeView<ReadSchema<TRoot>> {\n\t\tconst compressedId = this.idCompressor.tryRecompress(branchId as StableId);\n\t\tif (compressedId === undefined) {\n\t\t\tthrow new UsageError(`No branch found with id: ${branchId}`);\n\t\t}\n\t\treturn this.getCheckout(compressedId).viewWith(\n\t\t\tconfig,\n\t\t) as SchematizingSimpleTreeView<TRoot> & TreeView<ReadSchema<TRoot>>;\n\t}\n\n\tprivate getCheckout(branchId: BranchId): TreeCheckout {\n\t\treturn this.checkouts.get(branchId) ?? this.checkoutBranch(branchId);\n\t}\n\n\tprivate checkoutBranch(branchId: BranchId): TreeCheckout {\n\t\tconst checkout = this.checkout.branch();\n\t\tcheckout.switchBranch(this.getSharedBranch(branchId));\n\t\tconst enricher = new SharedTreeReadonlyChangeEnricher(\n\t\t\tcheckout.forest,\n\t\t\tcheckout.storedSchema,\n\t\t\tcheckout.removedRoots,\n\t\t);\n\n\t\tthis.registerSharedBranchForEditing(branchId, enricher);\n\t\tthis.registerCheckout(branchId, checkout);\n\t\treturn checkout;\n\t}\n\n\tpublic override async loadCore(services: IChannelStorageService): Promise<void> {\n\t\tawait super.loadCore(services);\n\t\tthis.checkout.load();\n\t}\n\n\tpublic override didAttach(): void {\n\t\tfor (const checkout of this.checkouts.values()) {\n\t\t\tif (checkout.transaction.isInProgress()) {\n\t\t\t\t// Attaching during a transaction is not currently supported.\n\t\t\t\t// At least part of of the system is known to not handle this case correctly - commit enrichment - and there may be others.\n\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\"Cannot attach while a transaction is in progress. Commit or abort the transaction before attaching.\",\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\tsuper.didAttach();\n\t}\n\n\tpublic override applyStashedOp(\n\t\t...args: Parameters<\n\t\t\tSharedTreeCore<SharedTreeEditBuilder, SharedTreeChange>[\"applyStashedOp\"]\n\t\t>\n\t): void {\n\t\tfor (const checkout of this.checkouts.values()) {\n\t\t\tassert(\n\t\t\t\t!checkout.transaction.isInProgress(),\n\t\t\t\t0x674 /* Unexpected transaction is open while applying stashed ops */,\n\t\t\t);\n\t\t}\n\t\tsuper.applyStashedOp(...args);\n\t}\n\n\tprotected override submitCommit(\n\t\tbranchId: BranchId,\n\t\tcommit: GraphCommit<SharedTreeChange>,\n\t\tschemaAndPolicy: ClonableSchemaAndPolicy,\n\t\tisResubmit: boolean,\n\t): void {\n\t\tconst checkout = this.getCheckout(branchId);\n\t\tassert(\n\t\t\t!checkout.transaction.isInProgress(),\n\t\t\t0xaa6 /* Cannot submit a commit while a transaction is in progress */,\n\t\t);\n\t\tif (isResubmit) {\n\t\t\treturn super.submitCommit(branchId, commit, schemaAndPolicy, isResubmit);\n\t\t}\n\n\t\t// Refrain from submitting new commits until they are validated by the checkout.\n\t\t// This is not a strict requirement for correctness in our system, but in the event that there is a bug when applying commits to the checkout\n\t\t// that causes a crash (e.g. in the forest), this will at least prevent this client from sending the problematic commit to any other clients.\n\t\tcheckout.onCommitValid(commit, () =>\n\t\t\tsuper.submitCommit(branchId, commit, schemaAndPolicy, isResubmit),\n\t\t);\n\t}\n\n\tpublic onDisconnect(): void {}\n}\n\nexport function exportSimpleSchema(storedSchema: TreeStoredSchema): SimpleTreeSchema {\n\treturn {\n\t\troot: exportSimpleFieldSchemaStored(storedSchema.rootFieldSchema),\n\t\tdefinitions: new Map(\n\t\t\t[...storedSchema.nodeSchema].map(([key, schema]) => {\n\t\t\t\treturn [key, exportSimpleNodeSchemaStored(schema)];\n\t\t\t}),\n\t\t),\n\t};\n}\n\n/**\n * A way to parse schema in the persisted format from {@link extractPersistedSchema}.\n * @remarks\n * This behaves identically to {@link ITreeAlpha.exportSimpleSchema},\n * except that it gets the schema from the caller instead of from an existing tree.\n *\n * This can be useful for inspecting the contents of persisted schema,\n * such as those generated by {@link extractPersistedSchema} for use in testing.\n * Since that data format is otherwise unspecified,\n * this provides a way to inspect its contents with documented semantics.\n * @alpha\n */\nexport function persistedToSimpleSchema(\n\tpersisted: JsonCompatible,\n\toptions: ICodecOptions,\n): SimpleTreeSchema {\n\tconst schemaCodec = makeSchemaCodec(options, SchemaVersion.v1);\n\tconst stored = schemaCodec.decode(persisted as FormatV1);\n\treturn exportSimpleSchema(stored);\n}\n\n/**\n * Get a {@link BranchableTree} from a {@link ITree}.\n * @remarks The branch can be used for \"version control\"-style coordination of edits on the tree.\n * @privateRemarks This function will be removed if/when the branching API becomes public,\n * but it (or something like it) is necessary in the meantime to prevent the alpha types from being exposed as public.\n * @alpha\n * @deprecated This API is superseded by {@link TreeBranch}, which should be used instead.\n */\nexport function getBranch(tree: ITree): BranchableTree;\n/**\n * Get a {@link BranchableTree} from a {@link TreeView}.\n * @remarks The branch can be used for \"version control\"-style coordination of edits on the tree.\n * Branches are currently an unstable \"alpha\" API and are subject to change in the future.\n * @privateRemarks This function will be removed if/when the branching API becomes public,\n * but it (or something like it) is necessary in the meantime to prevent the alpha types from being exposed as public.\n * @alpha\n * @deprecated This API is superseded by {@link TreeBranch}, which should be used instead.\n */\nexport function getBranch<T extends ImplicitFieldSchema | UnsafeUnknownSchema>(\n\tview: TreeViewAlpha<T>,\n): BranchableTree;\nexport function getBranch<T extends ImplicitFieldSchema | UnsafeUnknownSchema>(\n\ttreeOrView: ITree | TreeViewAlpha<T>,\n): BranchableTree {\n\tif (treeOrView instanceof SchematizingSimpleTreeView) {\n\t\treturn treeOrView.checkout as unknown as BranchableTree;\n\t}\n\tconst kernel = (treeOrView as ITree as ITreePrivate).kernel;\n\tassert(kernel instanceof SharedTreeKernel, 0xb56 /* Invalid ITree */);\n\t// This cast is safe so long as TreeCheckout supports all the operations on the branch interface.\n\treturn kernel.checkout as unknown as BranchableTree;\n}\n\n/**\n * Format versions supported by SharedTree.\n *\n * Each version documents a required minimum version of the \\@fluidframework/tree package.\n * @alpha\n */\nexport const SharedTreeFormatVersion = {\n\t/**\n\t * Requires \\@fluidframework/tree \\>= 2.0.0.\n\t *\n\t * @deprecated FF does not currently plan on supporting this format long-term.\n\t * Do not write production documents using this format, as they may not be loadable in the future.\n\t */\n\tv1: 1,\n\n\t/**\n\t * Requires \\@fluidframework/tree \\>= 2.0.0.\n\t */\n\tv2: 2,\n\n\t/**\n\t * Requires \\@fluidframework/tree \\>= 2.0.0.\n\t */\n\tv3: 3,\n\n\t/**\n\t * Requires \\@fluidframework/tree \\>= 2.0.0.\n\t */\n\tv5: 5,\n\n\t/**\n\t * For testing purposes only.\n\t */\n\tvSharedBranches: 100,\n} as const;\n\n/**\n * Format versions supported by SharedTree.\n *\n * Each version documents a required minimum version of the \\@fluidframework/tree package.\n * @alpha\n * @privateRemarks\n * See packages/dds/tree/docs/main/compatibility.md for information on how to add support for a new format.\n *\n * TODO: Before this gets promoted past Alpha,\n * a separate abstraction more suited for use in the public API should be adopted rather than reusing the same types used internally.\n * Such an abstraction should probably be in the form of a Fluid-Framework wide compatibility enum.\n */\nexport type SharedTreeFormatVersion = typeof SharedTreeFormatVersion;\n\n/**\n * Defines for each EditManagerFormatVersion the SharedTreeChangeFormatVersion to use.\n * This is an arbitrary mapping that is injected in the EditManger codec.\n * Once an entry is defined and used in production, it cannot be changed.\n * This is because the format for SharedTree changes are not explicitly versioned.\n */\nexport const changeFormatVersionForEditManager = DependentFormatVersion.fromPairs([\n\t[brand<EditManagerFormatVersion>(1), brand<SharedTreeChangeFormatVersion>(1)],\n\t[brand<EditManagerFormatVersion>(2), brand<SharedTreeChangeFormatVersion>(2)],\n\t[brand<EditManagerFormatVersion>(3), brand<SharedTreeChangeFormatVersion>(3)],\n\t[brand<EditManagerFormatVersion>(4), brand<SharedTreeChangeFormatVersion>(4)],\n\t[brand<EditManagerFormatVersion>(5), brand<SharedTreeChangeFormatVersion>(4)],\n]);\n\n/**\n * Defines for each MessageFormatVersion the SharedTreeChangeFormatVersion to use.\n * This is an arbitrary mapping that is injected in the message codec.\n * Once an entry is defined and used in production, it cannot be changed.\n * This is because the format for SharedTree changes are not explicitly versioned.\n */\nexport const changeFormatVersionForMessage = DependentFormatVersion.fromPairs([\n\t[brand<MessageFormatVersion>(undefined), brand<SharedTreeChangeFormatVersion>(1)],\n\t[brand<MessageFormatVersion>(1), brand<SharedTreeChangeFormatVersion>(1)],\n\t[brand<MessageFormatVersion>(2), brand<SharedTreeChangeFormatVersion>(2)],\n\t[brand<MessageFormatVersion>(3), brand<SharedTreeChangeFormatVersion>(3)],\n\t[brand<MessageFormatVersion>(4), brand<SharedTreeChangeFormatVersion>(4)],\n\t[brand<MessageFormatVersion>(5), brand<SharedTreeChangeFormatVersion>(4)],\n]);\n\nfunction getCodecTreeForEditManagerFormat(version: EditManagerFormatVersion): CodecTree {\n\tconst change = changeFormatVersionForEditManager.lookup(version);\n\tconst changeCodecTree = getCodecTreeForChangeFormat(change);\n\treturn getCodecTreeForEditManagerFormatWithChange(version, changeCodecTree);\n}\n\nfunction getCodecTreeForMessageFormat(version: MessageFormatVersion): CodecTree {\n\tconst change = changeFormatVersionForMessage.lookup(version);\n\tconst changeCodecTree = getCodecTreeForChangeFormat(change);\n\treturn getCodecTreeForMessageFormatWithChange(version, changeCodecTree);\n}\n\nexport function getCodecTreeForSharedTreeFormat(\n\tversion: SharedTreeFormatVersion[keyof SharedTreeFormatVersion],\n): CodecTree {\n\tconst children: CodecTree[] = [];\n\tconst childCodecs = getCodecVersions(version);\n\tfor (const name of Object.keys(childCodecs) as (keyof ExplicitCodecVersions)[]) {\n\t\tswitch (name) {\n\t\t\tcase \"editManager\":\n\t\t\t\tchildren.push(getCodecTreeForEditManagerFormat(childCodecs.editManager));\n\t\t\t\tbreak;\n\t\t\tcase \"message\":\n\t\t\t\tchildren.push(getCodecTreeForMessageFormat(childCodecs.message));\n\t\t\t\tbreak;\n\t\t\tcase \"forest\":\n\t\t\t\tchildren.push(getCodecTreeForForestFormat(childCodecs.forest));\n\t\t\t\tbreak;\n\t\t\tcase \"schema\":\n\t\t\t\tchildren.push(getCodecTreeForSchemaFormat(childCodecs.schema));\n\t\t\t\tbreak;\n\t\t\tcase \"detachedFieldIndex\":\n\t\t\t\tchildren.push(getCodecTreeForDetachedFieldIndexFormat(childCodecs.detachedFieldIndex));\n\t\t\t\tbreak;\n\t\t\tcase \"fieldBatch\":\n\t\t\t\tchildren.push(getCodecTreeForFieldBatchFormat(childCodecs.fieldBatch));\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tunreachableCase(name);\n\t\t}\n\t}\n\treturn {\n\t\tname: \"SharedTree\",\n\t\tversion,\n\t\tchildren,\n\t};\n}\n\n/**\n * Configuration options for SharedTree.\n * @beta @input\n */\nexport type SharedTreeOptionsBeta = ForestOptions;\n\n/**\n * Configuration options for SharedTree.\n * @alpha @input\n */\nexport type SharedTreeOptions = Partial<CodecWriteOptions> &\n\tPartial<SharedTreeFormatOptions> &\n\tSharedTreeOptionsBeta;\n\nexport interface SharedTreeOptionsInternal\n\textends Omit<SharedTreeOptions, \"treeEncodeType\">,\n\t\tPartial<SharedTreeFormatOptionsInternal> {\n\tdisposeForksAfterTransaction?: boolean;\n\t/**\n\t * Returns whether a node / field should be incrementally encoded.\n\t * @remarks\n\t * See {@link IncrementalEncodingPolicy}.\n\t */\n\tshouldEncodeIncrementally?: IncrementalEncodingPolicy;\n}\n/**\n * Configuration options for SharedTree's internal tree storage.\n * @beta @input\n */\nexport interface ForestOptions {\n\t/**\n\t * The {@link ForestType} indicating which forest type should be created for the SharedTree.\n\t */\n\treadonly forest?: ForestType;\n}\n\n/**\n * Options for configuring the persisted format SharedTree uses.\n * @alpha @input\n */\nexport interface SharedTreeFormatOptions {\n\t/**\n\t * See {@link TreeCompressionStrategy}.\n\t * default: TreeCompressionStrategy.Compressed\n\t */\n\ttreeEncodeType: TreeCompressionStrategy;\n\t/**\n\t * The format version SharedTree should use to persist documents.\n\t *\n\t * This option has compatibility implications for applications using SharedTree.\n\t * Each version documents a required minimum version of \\@fluidframework/tree.\n\t * If this minimum version fails to be met, the SharedTree may fail to load.\n\t * To be safe, application authors should verify that they have saturated this version\n\t * of \\@fluidframework/tree in their ecosystem before changing the format version.\n\t *\n\t * This option defaults to SharedTreeFormatVersion.v2.\n\t */\n\tformatVersion: SharedTreeFormatVersion[keyof SharedTreeFormatVersion];\n}\n\nexport interface SharedTreeFormatOptionsInternal\n\textends Omit<SharedTreeFormatOptions, \"treeEncodeType\"> {\n\ttreeEncodeType: TreeCompressionStrategyPrivate;\n}\n\n/**\n * Used to distinguish between different forest types.\n * @remarks\n * The \"Forest\" is the internal data structure used to store all the trees (the main tree and any removed ones) for a given view or branch.\n * ForestTypes should all have the same behavior, but may differ in performance and debuggability.\n *\n * Current options are {@link ForestTypeReference}, {@link ForestTypeOptimized} and {@link ForestTypeExpensiveDebug}.\n * @privateRemarks\n * Implement using {@link toForestType}.\n * Consume using {@link buildConfiguredForest}.\n * @sealed @beta\n */\nexport interface ForestType extends ErasedType<\"ForestType\"> {}\n\n/**\n * Reference implementation of forest.\n * @remarks\n * A simple implementation with minimal complexity and moderate debuggability, validation and performance.\n * @privateRemarks\n * The \"ObjectForest\" forest type.\n * @beta\n */\nexport const ForestTypeReference = toForestType(\n\t(breaker: Breakable, schema: TreeStoredSchemaSubscription, idCompressor: IIdCompressor) =>\n\t\tbuildForest(breaker, schema),\n);\n\n/**\n * Optimized implementation of forest.\n * @remarks\n * A complex optimized forest implementation, which has minimal validation and debuggability to optimize for performance.\n * Uses an internal representation optimized for size designed to scale to larger datasets with reduced overhead.\n * @privateRemarks\n * The \"ChunkedForest\" forest type.\n * @beta\n */\nexport const ForestTypeOptimized = toForestType(\n\t(\n\t\tbreaker: Breakable,\n\t\tschema: TreeStoredSchemaSubscription,\n\t\tidCompressor: IIdCompressor,\n\t\tshouldEncodeIncrementally: IncrementalEncodingPolicy,\n\t) =>\n\t\tbuildChunkedForest(\n\t\t\tmakeTreeChunker(schema, defaultSchemaPolicy, shouldEncodeIncrementally),\n\t\t\tundefined,\n\t\t\tidCompressor,\n\t\t),\n);\n\n/**\n * Slow implementation of forest intended only for debugging.\n * @remarks\n * Includes validation with scales poorly.\n * May be asymptotically slower than {@link ForestTypeReference}, and may perform very badly with larger data sizes.\n * @privateRemarks\n * The \"ObjectForest\" forest type with expensive asserts for debugging.\n * @beta\n */\nexport const ForestTypeExpensiveDebug = toForestType(\n\t(breaker: Breakable, schema: TreeStoredSchemaSubscription) =>\n\t\tbuildForest(breaker, schema, undefined, true),\n);\n\ntype ForestFactory = (\n\tbreaker: Breakable,\n\tschema: TreeStoredSchemaSubscription,\n\tidCompressor: IIdCompressor,\n\tshouldEncodeIncrementally: IncrementalEncodingPolicy,\n) => IEditableForest;\n\nfunction toForestType(factory: ForestFactory): ForestType {\n\treturn factory as unknown as ForestType;\n}\n\n/**\n * Build and return a forest of the requested type.\n */\nexport function buildConfiguredForest(\n\tbreaker: Breakable,\n\tfactory: ForestType,\n\tschema: TreeStoredSchemaSubscription,\n\tidCompressor: IIdCompressor,\n\tshouldEncodeIncrementally: IncrementalEncodingPolicy,\n): IEditableForest {\n\treturn (factory as unknown as ForestFactory)(\n\t\tbreaker,\n\t\tschema,\n\t\tidCompressor,\n\t\tshouldEncodeIncrementally,\n\t);\n}\n\nexport const defaultSharedTreeOptions: Required<SharedTreeOptionsInternal> = {\n\tjsonValidator: FormatValidatorNoOp,\n\tminVersionForCollab: FluidClientVersion.v2_0,\n\tforest: ForestTypeReference,\n\ttreeEncodeType: TreeCompressionStrategy.Compressed,\n\tformatVersion: SharedTreeFormatVersion.v3,\n\tdisposeForksAfterTransaction: true,\n\tshouldEncodeIncrementally: defaultIncrementalEncodingPolicy,\n};\n\n/**\n * Build the allowed types for a Stored Schema.\n *\n * @remarks Staged upgrades do not apply to stored schemas, so we omit the {@link SimpleAllowedTypeAttributes.isStaged | staging flag } when building {@link SimpleAllowedTypeAttributes}.\n * @param types - The types to create allowed types for.\n * @returns The allowed types.\n */\nfunction buildSimpleAllowedTypeAttributesForStoredSchema(\n\ttypes: TreeTypeSet,\n): ReadonlyMap<string, SimpleAllowedTypeAttributes> {\n\tconst allowedTypesInfo = new Map<string, SimpleAllowedTypeAttributes>();\n\tfor (const type of types) {\n\t\t// Stored schemas do not have staged upgrades\n\t\tallowedTypesInfo.set(type, { isStaged: undefined });\n\t}\n\treturn allowedTypesInfo;\n}\n\nfunction exportSimpleFieldSchemaStored(schema: TreeFieldStoredSchema): SimpleFieldSchema {\n\tlet kind: FieldKind;\n\tswitch (schema.kind) {\n\t\tcase FieldKinds.identifier.identifier:\n\t\t\tkind = FieldKind.Identifier;\n\t\t\tbreak;\n\t\tcase FieldKinds.optional.identifier:\n\t\t\tkind = FieldKind.Optional;\n\t\t\tbreak;\n\t\tcase FieldKinds.required.identifier:\n\t\t\tkind = FieldKind.Required;\n\t\t\tbreak;\n\t\tcase FieldKinds.forbidden.identifier:\n\t\t\tkind = FieldKind.Optional;\n\t\t\tassert(schema.types.size === 0, 0xa94 /* invalid forbidden field */);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tfail(0xaca /* invalid field kind */);\n\t}\n\treturn {\n\t\tkind,\n\t\tsimpleAllowedTypes: buildSimpleAllowedTypeAttributesForStoredSchema(schema.types),\n\t\tmetadata: {},\n\t\tpersistedMetadata: schema.persistedMetadata,\n\t};\n}\n\n/**\n * Export a {@link SimpleNodeSchema} from a {@link TreeNodeStoredSchema}.\n * @privateRemarks\n * TODO: Persist node metadata once schema FormatV2 is supported.\n */\nfunction exportSimpleNodeSchemaStored(schema: TreeNodeStoredSchema): SimpleNodeSchema {\n\tconst arrayTypes = tryStoredSchemaAsArray(schema);\n\tif (arrayTypes !== undefined) {\n\t\treturn {\n\t\t\tkind: NodeKind.Array,\n\t\t\tsimpleAllowedTypes: buildSimpleAllowedTypeAttributesForStoredSchema(arrayTypes),\n\t\t\tmetadata: {},\n\t\t\tpersistedMetadata: schema.metadata,\n\t\t};\n\t}\n\tif (schema instanceof ObjectNodeStoredSchema) {\n\t\tconst fields = new Map<FieldKey, SimpleObjectFieldSchema>();\n\t\tfor (const [storedKey, field] of schema.objectNodeFields) {\n\t\t\tfields.set(storedKey, { ...exportSimpleFieldSchemaStored(field), storedKey });\n\t\t}\n\t\treturn { kind: NodeKind.Object, fields, metadata: {}, persistedMetadata: schema.metadata };\n\t}\n\tif (schema instanceof MapNodeStoredSchema) {\n\t\tassert(\n\t\t\tschema.mapFields.kind === FieldKinds.optional.identifier,\n\t\t\t0xa95 /* Invalid map schema */,\n\t\t);\n\t\treturn {\n\t\t\tkind: NodeKind.Map,\n\t\t\tsimpleAllowedTypes: buildSimpleAllowedTypeAttributesForStoredSchema(\n\t\t\t\tschema.mapFields.types,\n\t\t\t),\n\t\t\tmetadata: {},\n\t\t\tpersistedMetadata: schema.metadata,\n\t\t};\n\t}\n\tif (schema instanceof LeafNodeStoredSchema) {\n\t\treturn {\n\t\t\tkind: NodeKind.Leaf,\n\t\t\tleafKind: schema.leafValue,\n\t\t\tmetadata: {},\n\t\t\tpersistedMetadata: schema.metadata,\n\t\t};\n\t}\n\tfail(0xacb /* invalid schema kind */);\n}\n"]}
1
+ {"version":3,"file":"sharedTree.js","sourceRoot":"","sources":["../../src/shared-tree/sharedTree.ts"],"names":[],"mappings":"AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGH,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,qCAAqC,CAAC;AASnE,OAAO,EACN,UAAU,GAEV,MAAM,0CAA0C,CAAC;AAElD,OAAO,EAGN,sBAAsB,EACtB,kBAAkB,EAClB,mBAAmB,GAEnB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAKN,oBAAoB,EACpB,mBAAmB,EACnB,sBAAsB,EACtB,gBAAgB,EAIhB,0BAA0B,EAG1B,uCAAuC,EACvC,sBAAsB,EACtB,mBAAmB,GACnB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACN,4BAA4B,EAC5B,UAAU,EACV,gBAAgB,EAChB,gBAAgB,EAChB,uBAAuB,EACvB,kBAAkB,EAClB,WAAW,EACX,gCAAgC,EAChC,mBAAmB,EACnB,+BAA+B,EAC/B,2BAA2B,EAC3B,2BAA2B,EAC3B,2BAA2B,EAC3B,mBAAmB,EACnB,yBAAyB,EACzB,eAAe,EACf,eAAe,GAGf,MAAM,+BAA+B,CAAC;AAGvC,OAAO,EAEN,uCAAuC,EACvC,mCAAmC,EAEnC,0CAA0C,EAC1C,sCAAsC,EAEtC,oBAAoB,EACpB,cAAc,EACd,wBAAwB,GACxB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAGN,QAAQ,EASR,sBAAsB,EAEtB,SAAS,GAIT,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,EAAE,gCAAgC,EAAE,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H,CAAC;IACD,IAAI,MAAM,YAAY,mBAAmB,EAAE,CAAC;QAC3C,MAAM,CACL,MAAM,CAAC,SAAS,CAAC,IAAI,KAAK,UAAU,CAAC,QAAQ,CAAC,UAAU,EACxD,KAAK,CAAC,wBAAwB,CAC9B,CAAC;QACF,OAAO;YACN,IAAI,EAAE,QAAQ,CAAC,GAAG;YAClB,kBAAkB,EAAE,+CAA+C,CAClE,MAAM,CAAC,SAAS,CAAC,KAAK,CACtB;YACD,QAAQ,EAAE,EAAE;YACZ,iBAAiB,EAAE,MAAM,CAAC,QAAQ;SAClC,CAAC;IACH,CAAC;IACD,IAAI,MAAM,YAAY,oBAAoB,EAAE,CAAC;QAC5C,OAAO;YACN,IAAI,EAAE,QAAQ,CAAC,IAAI;YACnB,QAAQ,EAAE,MAAM,CAAC,SAAS;YAC1B,QAAQ,EAAE,EAAE;YACZ,iBAAiB,EAAE,MAAM,CAAC,QAAQ;SAClC,CAAC;IACH,CAAC;IACD,IAAI,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC;AACvC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ErasedType, IFluidLoadable } from \"@fluidframework/core-interfaces/internal\";\nimport { assert, fail } from \"@fluidframework/core-utils/internal\";\nimport type { IChannelStorageService } from \"@fluidframework/datastore-definitions/internal\";\nimport type { IIdCompressor, StableId } from \"@fluidframework/id-compressor\";\nimport type { MinimumVersionForCollab } from \"@fluidframework/runtime-definitions/internal\";\nimport type {\n\tIChannelView,\n\tIFluidSerializer,\n\tSharedKernel,\n} from \"@fluidframework/shared-object-base/internal\";\nimport {\n\tUsageError,\n\ttype ITelemetryLoggerExt,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\ttype CodecTree,\n\ttype CodecWriteOptions,\n\tDependentFormatVersion,\n\tFluidClientVersion,\n\tFormatValidatorNoOp,\n\ttype ICodecOptions,\n} from \"../codec/index.js\";\nimport {\n\ttype FieldKey,\n\ttype GraphCommit,\n\ttype IEditableForest,\n\ttype JsonableTree,\n\tLeafNodeStoredSchema,\n\tMapNodeStoredSchema,\n\tObjectNodeStoredSchema,\n\tRevisionTagCodec,\n\ttype TreeFieldStoredSchema,\n\ttype TreeNodeStoredSchema,\n\ttype TreeStoredSchema,\n\tTreeStoredSchemaRepository,\n\ttype TreeStoredSchemaSubscription,\n\ttype TreeTypeSet,\n\tgetCodecTreeForDetachedFieldIndexFormat,\n\tmakeDetachedFieldIndex,\n\tmoveToDetachedField,\n} from \"../core/index.js\";\nimport {\n\tDetachedFieldIndexSummarizer,\n\tFieldKinds,\n\tForestSummarizer,\n\tSchemaSummarizer,\n\tTreeCompressionStrategy,\n\tbuildChunkedForest,\n\tbuildForest,\n\tdefaultIncrementalEncodingPolicy,\n\tdefaultSchemaPolicy,\n\tgetCodecTreeForFieldBatchFormat,\n\tgetCodecTreeForForestFormat,\n\tgetCodecTreeForSchemaFormat,\n\tjsonableTreeFromFieldCursor,\n\tmakeFieldBatchCodec,\n\tmakeMitigatedChangeFamily,\n\tmakeSchemaCodec,\n\tmakeTreeChunker,\n\ttype IncrementalEncodingPolicy,\n\ttype TreeCompressionStrategyPrivate,\n} from \"../feature-libraries/index.js\";\n// eslint-disable-next-line import-x/no-internal-modules\nimport type { FormatV1 } from \"../feature-libraries/schema-index/index.js\";\nimport {\n\ttype BranchId,\n\tclientVersionToEditManagerFormatVersion,\n\tclientVersionToMessageFormatVersion,\n\ttype ClonableSchemaAndPolicy,\n\tgetCodecTreeForEditManagerFormatWithChange,\n\tgetCodecTreeForMessageFormatWithChange,\n\ttype SharedTreCoreOptionsInternal,\n\tMessageFormatVersion,\n\tSharedTreeCore,\n\tEditManagerFormatVersion,\n} from \"../shared-tree-core/index.js\";\nimport {\n\ttype ITree,\n\ttype ImplicitFieldSchema,\n\tNodeKind,\n\ttype ReadSchema,\n\ttype SimpleFieldSchema,\n\ttype SimpleTreeSchema,\n\ttype TreeView,\n\ttype TreeViewAlpha,\n\ttype TreeViewConfiguration,\n\ttype UnsafeUnknownSchema,\n\ttype VerboseTree,\n\ttryStoredSchemaAsArray,\n\ttype SimpleNodeSchema,\n\tFieldKind,\n\ttype ITreeAlpha,\n\ttype SimpleObjectFieldSchema,\n\ttype SimpleAllowedTypeAttributes,\n} from \"../simple-tree/index.js\";\n\nimport { SchematizingSimpleTreeView } from \"./schematizingTreeView.js\";\nimport { SharedTreeReadonlyChangeEnricher } from \"./sharedTreeChangeEnricher.js\";\nimport { SharedTreeChangeFamily } from \"./sharedTreeChangeFamily.js\";\nimport type { SharedTreeChange } from \"./sharedTreeChangeTypes.js\";\nimport type { SharedTreeEditBuilder } from \"./sharedTreeEditBuilder.js\";\nimport { type TreeCheckout, type BranchableTree, createTreeCheckout } from \"./treeCheckout.js\";\nimport {\n\tbrand,\n\ttype Breakable,\n\tbreakingClass,\n\ttype JsonCompatible,\n\tthrowIfBroken,\n} from \"../util/index.js\";\nimport {\n\tgetCodecTreeForChangeFormat,\n\ttype SharedTreeChangeFormatVersion,\n} from \"./sharedTreeChangeCodecs.js\";\n\n/**\n * Copy of data from an {@link ITreePrivate} at some point in time.\n * @remarks\n * This is unrelated to Fluids concept of \"snapshots\".\n */\nexport interface SharedTreeContentSnapshot {\n\t/**\n\t * The schema stored in the document.\n\t *\n\t * @remarks\n\t * Edits to the schema can mutate the schema stored of the tree which took this snapshot (but this snapshot will remain the same)\n\t * This is mainly useful for debugging cases where schematize reports an incompatible view schema.\n\t */\n\treadonly schema: TreeStoredSchema;\n\t/**\n\t * All {@link TreeStatus.InDocument} content.\n\t */\n\treadonly tree: JsonableTree[];\n\t/**\n\t * All {@link TreeStatus.Removed} content.\n\t */\n\treadonly removed: [string | number | undefined, number, JsonableTree][];\n}\n\n/**\n * {@link ITree} extended with some non-public APIs.\n * @internal\n */\nexport interface ITreeInternal extends IChannelView, ITreeAlpha {}\n\n/**\n * {@link ITreeInternal} extended with some non-exported APIs.\n * @remarks\n * This allows access to the tree content using the internal data model used at the storage and \"flex\" layers,\n * and should only be needed for testing and debugging this package's internals.\n */\nexport interface ITreePrivate extends ITreeInternal {\n\t/**\n\t * Provides a copy of the current content of the tree.\n\t * This can be useful for inspecting the tree when no suitable view schema is available.\n\t * This is only intended for use in testing and exceptional code paths: it is not performant.\n\t *\n\t * This does not include everything that is included in a tree summary, since information about how to merge future edits is omitted.\n\t */\n\tcontentSnapshot(): SharedTreeContentSnapshot;\n\n\t/**\n\t * Access to internals for testing.\n\t */\n\treadonly kernel: SharedTreeKernel;\n}\n\n/**\n * The type SharedTree's kernel's view must implement so what when its merged with the underling SharedObject's API it fully implements the required tree API surface ({@link ITreePrivate }).\n */\nexport type SharedTreeKernelView = Omit<ITreePrivate, keyof (IChannelView & IFluidLoadable)>;\n\n/**\n * SharedTreeCore, configured with a good set of indexes and field kinds which will maintain compatibility over time.\n *\n * TODO: detail compatibility requirements.\n */\n@breakingClass\nexport class SharedTreeKernel\n\textends SharedTreeCore<SharedTreeEditBuilder, SharedTreeChange>\n\timplements SharedKernel\n{\n\tpublic readonly checkout: TreeCheckout;\n\tpublic get storedSchema(): TreeStoredSchemaRepository {\n\t\treturn this.checkout.storedSchema;\n\t}\n\n\tprivate readonly checkouts: Map<BranchId, TreeCheckout> = new Map();\n\n\t/**\n\t * The app-facing API for SharedTree implemented by this Kernel.\n\t * @remarks\n\t * This is the API grafted onto the ISharedObject which apps can access.\n\t * It includes both the APIs used for internal testing, and public facing APIs (both stable and unstable).\n\t * Different users will have access to different subsets of this API, see {@link ITree}, {@link ITreeAlpha} and {@link ITreeInternal} which this {@link ITreePrivate} extends.\n\t */\n\tpublic readonly view: SharedTreeKernelView;\n\n\tpublic constructor(\n\t\tbreaker: Breakable,\n\t\tsharedObject: IChannelView & IFluidLoadable,\n\t\tserializer: IFluidSerializer,\n\t\tsubmitLocalMessage: (content: unknown, localOpMetadata?: unknown) => void,\n\t\tlastSequenceNumber: () => number | undefined,\n\t\tinitialSequenceNumber: number,\n\t\tprivate readonly logger: ITelemetryLoggerExt | undefined,\n\t\tidCompressor: IIdCompressor,\n\t\toptionsParam: SharedTreeOptionsInternal,\n\t) {\n\t\tconst options: Required<SharedTreeOptionsInternal> = {\n\t\t\t...defaultSharedTreeOptions,\n\t\t\t...optionsParam,\n\t\t};\n\t\tif (options.minVersionForCollab < FluidClientVersion.v2_0) {\n\t\t\tthrow new UsageError(\"SharedTree requires minVersionForCollab of at least 2.0.0\");\n\t\t}\n\t\tconst schema = new TreeStoredSchemaRepository();\n\t\tconst forest = buildConfiguredForest(\n\t\t\tbreaker,\n\t\t\toptions.forest,\n\t\t\tschema,\n\t\t\tidCompressor,\n\t\t\toptions.shouldEncodeIncrementally,\n\t\t);\n\t\tconst revisionTagCodec = new RevisionTagCodec(idCompressor);\n\t\tconst removedRoots = makeDetachedFieldIndex(\n\t\t\t\"repair\",\n\t\t\trevisionTagCodec,\n\t\t\tidCompressor,\n\t\t\toptions,\n\t\t);\n\t\tconst schemaCodec = makeSchemaCodec(options);\n\t\tconst schemaSummarizer = new SchemaSummarizer(\n\t\t\tschema,\n\t\t\t{\n\t\t\t\tgetCurrentSeq: lastSequenceNumber,\n\t\t\t},\n\t\t\tschemaCodec,\n\t\t);\n\t\tconst fieldBatchCodec = makeFieldBatchCodec(options);\n\n\t\tconst encoderContext = {\n\t\t\tschema: {\n\t\t\t\tschema,\n\t\t\t\tpolicy: defaultSchemaPolicy,\n\t\t\t},\n\t\t\tencodeType: options.treeEncodeType,\n\t\t\toriginatorId: idCompressor.localSessionId,\n\t\t\tidCompressor,\n\t\t};\n\t\tconst forestSummarizer = new ForestSummarizer(\n\t\t\tforest,\n\t\t\trevisionTagCodec,\n\t\t\tfieldBatchCodec,\n\t\t\tencoderContext,\n\t\t\toptions,\n\t\t\tidCompressor,\n\t\t\tinitialSequenceNumber,\n\t\t\toptions.shouldEncodeIncrementally,\n\t\t);\n\t\tconst removedRootsSummarizer = new DetachedFieldIndexSummarizer(removedRoots);\n\t\tconst innerChangeFamily = new SharedTreeChangeFamily(\n\t\t\trevisionTagCodec,\n\t\t\tfieldBatchCodec,\n\t\t\toptions,\n\t\t\toptions.treeEncodeType,\n\t\t\tidCompressor,\n\t\t);\n\t\tconst changeFamily = makeMitigatedChangeFamily(\n\t\t\tinnerChangeFamily,\n\t\t\tSharedTreeChangeFamily.emptyChange,\n\t\t\t(error: unknown) => {\n\t\t\t\t// TODO:6344 Add telemetry for these errors.\n\t\t\t\t// Rethrowing the error has a different effect depending on the context in which the\n\t\t\t\t// ChangeFamily was invoked:\n\t\t\t\t// - If the ChangeFamily was invoked as part of incoming op processing, rethrowing the error\n\t\t\t\t// will cause the runtime to disconnect the client, log a severe error, and not reconnect.\n\t\t\t\t// This will not cause the host application to crash because it is not on the stack at that time.\n\t\t\t\t// TODO: let the host application know that the client is now disconnected.\n\t\t\t\t// - If the ChangeFamily was invoked as part of dealing with a local change, rethrowing the\n\t\t\t\t// error will cause the host application to crash. This is not ideal, but is better than\n\t\t\t\t// letting the application either send an invalid change to the server or allowing the\n\t\t\t\t// application to continue working when its local branches contain edits that cannot be\n\t\t\t\t// reflected in its views.\n\t\t\t\t// The best course of action for a host application in such a state is to restart.\n\t\t\t\t// TODO: let the host application know about this situation and provide a way to\n\t\t\t\t// programmatically reload the SharedTree container.\n\t\t\t\tthrow error;\n\t\t\t},\n\t\t);\n\t\tconst changeEnricher = new SharedTreeReadonlyChangeEnricher(forest, schema, removedRoots);\n\t\tsuper(\n\t\t\tbreaker,\n\t\t\tsharedObject,\n\t\t\tserializer,\n\t\t\tsubmitLocalMessage,\n\t\t\tlogger,\n\t\t\t[schemaSummarizer, forestSummarizer, removedRootsSummarizer],\n\t\t\tchangeFamily,\n\t\t\toptions,\n\t\t\tchangeFormatVersionForEditManager,\n\t\t\tchangeFormatVersionForMessage,\n\t\t\tidCompressor,\n\t\t\tschema,\n\t\t\tdefaultSchemaPolicy,\n\t\t\tundefined,\n\t\t\tchangeEnricher,\n\t\t);\n\n\t\tthis.checkout = createTreeCheckout(idCompressor, this.mintRevisionTag, revisionTagCodec, {\n\t\t\tbranch: this.getLocalBranch(),\n\t\t\tchangeFamily,\n\t\t\tschema,\n\t\t\tforest,\n\t\t\tfieldBatchCodec,\n\t\t\tremovedRoots,\n\t\t\tchunkCompressionStrategy: options.treeEncodeType,\n\t\t\tlogger,\n\t\t\tbreaker: this.breaker,\n\t\t\tdisposeForksAfterTransaction: options.disposeForksAfterTransaction,\n\t\t});\n\n\t\tthis.registerCheckout(\"main\", this.checkout);\n\n\t\tthis.view = {\n\t\t\tcontentSnapshot: () => this.contentSnapshot(),\n\t\t\texportSimpleSchema: () => this.exportSimpleSchema(),\n\t\t\texportVerbose: () => this.exportVerbose(),\n\t\t\tviewWith: this.viewWith.bind(this),\n\t\t\tviewSharedBranchWith: this.viewBranchWith.bind(this),\n\t\t\tcreateSharedBranch: this.createSharedBranch.bind(this),\n\t\t\tgetSharedBranchIds: this.getSharedBranchIds.bind(this),\n\t\t\tkernel: this,\n\t\t};\n\t}\n\n\tprivate registerCheckout(branchId: BranchId, checkout: TreeCheckout): void {\n\t\tthis.checkouts.set(branchId, checkout);\n\t\tconst enricher = this.getCommitEnricher(branchId);\n\t\tcheckout.transaction.events.on(\"started\", () => {\n\t\t\tif (this.sharedObject.isAttached()) {\n\t\t\t\t// It is currently forbidden to attach during a transaction, so transaction state changes can be ignored until after attaching.\n\t\t\t\tenricher.startTransaction();\n\t\t\t}\n\t\t});\n\n\t\tcheckout.transaction.events.on(\"aborting\", () => {\n\t\t\tif (this.sharedObject.isAttached()) {\n\t\t\t\t// It is currently forbidden to attach during a transaction, so transaction state changes can be ignored until after attaching.\n\t\t\t\tenricher.abortTransaction();\n\t\t\t}\n\t\t});\n\t\tcheckout.transaction.events.on(\"committing\", () => {\n\t\t\tif (this.sharedObject.isAttached()) {\n\t\t\t\t// It is currently forbidden to attach during a transaction, so transaction state changes can be ignored until after attaching.\n\t\t\t\tenricher.commitTransaction();\n\t\t\t}\n\t\t});\n\t\tcheckout.events.on(\"beforeBatch\", (event) => {\n\t\t\tif (event.type === \"append\" && this.sharedObject.isAttached()) {\n\t\t\t\tif (checkout.transaction.isInProgress()) {\n\t\t\t\t\tenricher.addTransactionCommits(event.newCommits);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\tpublic exportVerbose(): VerboseTree | undefined {\n\t\treturn this.checkout.exportVerbose();\n\t}\n\n\tpublic exportSimpleSchema(): SimpleTreeSchema {\n\t\treturn exportSimpleSchema(this.storedSchema);\n\t}\n\n\t@throwIfBroken\n\tpublic contentSnapshot(): SharedTreeContentSnapshot {\n\t\tconst cursor = this.checkout.forest.allocateCursor(\"contentSnapshot\");\n\t\ttry {\n\t\t\tmoveToDetachedField(this.checkout.forest, cursor);\n\t\t\treturn {\n\t\t\t\tschema: this.storedSchema.clone(),\n\t\t\t\ttree: jsonableTreeFromFieldCursor(cursor),\n\t\t\t\tremoved: this.checkout.getRemovedRoots(),\n\t\t\t};\n\t\t} finally {\n\t\t\tcursor.free();\n\t\t}\n\t}\n\n\t// For the new TreeViewAlpha API\n\tpublic viewWith<TRoot extends ImplicitFieldSchema | UnsafeUnknownSchema>(\n\t\tconfig: TreeViewConfiguration<ReadSchema<TRoot>>,\n\t): SchematizingSimpleTreeView<TRoot> & TreeView<ReadSchema<TRoot>>;\n\n\t// For the old TreeView API\n\tpublic viewWith<TRoot extends ImplicitFieldSchema>(\n\t\tconfig: TreeViewConfiguration<TRoot>,\n\t): SchematizingSimpleTreeView<TRoot> & TreeView<TRoot>;\n\n\tpublic viewWith<TRoot extends ImplicitFieldSchema | UnsafeUnknownSchema>(\n\t\tconfig: TreeViewConfiguration<ReadSchema<TRoot>>,\n\t): SchematizingSimpleTreeView<TRoot> & TreeView<ReadSchema<TRoot>> {\n\t\treturn this.checkout.viewWith(config) as SchematizingSimpleTreeView<TRoot> &\n\t\t\tTreeView<ReadSchema<TRoot>>;\n\t}\n\n\tpublic viewBranchWith<TRoot extends ImplicitFieldSchema>(\n\t\tbranchId: string,\n\t\tconfig: TreeViewConfiguration<TRoot>,\n\t): TreeView<TRoot>;\n\n\tpublic viewBranchWith<TRoot extends ImplicitFieldSchema | UnsafeUnknownSchema>(\n\t\tbranchId: string,\n\t\tconfig: TreeViewConfiguration<ReadSchema<TRoot>>,\n\t): SchematizingSimpleTreeView<TRoot> & TreeView<ReadSchema<TRoot>> {\n\t\tconst compressedId = this.idCompressor.tryRecompress(branchId as StableId);\n\t\tif (compressedId === undefined) {\n\t\t\tthrow new UsageError(`No branch found with id: ${branchId}`);\n\t\t}\n\t\treturn this.getCheckout(compressedId).viewWith(\n\t\t\tconfig,\n\t\t) as SchematizingSimpleTreeView<TRoot> & TreeView<ReadSchema<TRoot>>;\n\t}\n\n\tprivate getCheckout(branchId: BranchId): TreeCheckout {\n\t\treturn this.checkouts.get(branchId) ?? this.checkoutBranch(branchId);\n\t}\n\n\tprivate checkoutBranch(branchId: BranchId): TreeCheckout {\n\t\tconst checkout = this.checkout.branch();\n\t\tcheckout.switchBranch(this.getSharedBranch(branchId));\n\t\tconst enricher = new SharedTreeReadonlyChangeEnricher(\n\t\t\tcheckout.forest,\n\t\t\tcheckout.storedSchema,\n\t\t\tcheckout.removedRoots,\n\t\t);\n\n\t\tthis.registerSharedBranchForEditing(branchId, enricher);\n\t\tthis.registerCheckout(branchId, checkout);\n\t\treturn checkout;\n\t}\n\n\tpublic override async loadCore(services: IChannelStorageService): Promise<void> {\n\t\tawait super.loadCore(services);\n\t\tthis.checkout.load();\n\t}\n\n\tpublic override didAttach(): void {\n\t\tfor (const checkout of this.checkouts.values()) {\n\t\t\tif (checkout.transaction.isInProgress()) {\n\t\t\t\t// Attaching during a transaction is not currently supported.\n\t\t\t\t// At least part of of the system is known to not handle this case correctly - commit enrichment - and there may be others.\n\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\"Cannot attach while a transaction is in progress. Commit or abort the transaction before attaching.\",\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\tsuper.didAttach();\n\t}\n\n\tpublic override applyStashedOp(\n\t\t...args: Parameters<\n\t\t\tSharedTreeCore<SharedTreeEditBuilder, SharedTreeChange>[\"applyStashedOp\"]\n\t\t>\n\t): void {\n\t\tfor (const checkout of this.checkouts.values()) {\n\t\t\tassert(\n\t\t\t\t!checkout.transaction.isInProgress(),\n\t\t\t\t0x674 /* Unexpected transaction is open while applying stashed ops */,\n\t\t\t);\n\t\t}\n\t\tsuper.applyStashedOp(...args);\n\t}\n\n\tprotected override submitCommit(\n\t\tbranchId: BranchId,\n\t\tcommit: GraphCommit<SharedTreeChange>,\n\t\tschemaAndPolicy: ClonableSchemaAndPolicy,\n\t\tisResubmit: boolean,\n\t): void {\n\t\tconst checkout = this.getCheckout(branchId);\n\t\tassert(\n\t\t\t!checkout.transaction.isInProgress(),\n\t\t\t0xaa6 /* Cannot submit a commit while a transaction is in progress */,\n\t\t);\n\t\tif (isResubmit) {\n\t\t\treturn super.submitCommit(branchId, commit, schemaAndPolicy, isResubmit);\n\t\t}\n\n\t\t// Refrain from submitting new commits until they are validated by the checkout.\n\t\t// This is not a strict requirement for correctness in our system, but in the event that there is a bug when applying commits to the checkout\n\t\t// that causes a crash (e.g. in the forest), this will at least prevent this client from sending the problematic commit to any other clients.\n\t\tcheckout.onCommitValid(commit, () =>\n\t\t\tsuper.submitCommit(branchId, commit, schemaAndPolicy, isResubmit),\n\t\t);\n\t}\n\n\tpublic onDisconnect(): void {}\n}\n\nexport function exportSimpleSchema(storedSchema: TreeStoredSchema): SimpleTreeSchema {\n\treturn {\n\t\troot: exportSimpleFieldSchemaStored(storedSchema.rootFieldSchema),\n\t\tdefinitions: new Map(\n\t\t\t[...storedSchema.nodeSchema].map(([key, schema]) => {\n\t\t\t\treturn [key, exportSimpleNodeSchemaStored(schema)];\n\t\t\t}),\n\t\t),\n\t};\n}\n\n/**\n * A way to parse schema in the persisted format from {@link extractPersistedSchema}.\n * @remarks\n * This behaves identically to {@link ITreeAlpha.exportSimpleSchema},\n * except that it gets the schema from the caller instead of from an existing tree.\n *\n * This can be useful for inspecting the contents of persisted schema,\n * such as those generated by {@link extractPersistedSchema} for use in testing.\n * Since that data format is otherwise unspecified,\n * this provides a way to inspect its contents with documented semantics.\n * @alpha\n */\nexport function persistedToSimpleSchema(\n\tpersisted: JsonCompatible,\n\toptions: ICodecOptions,\n): SimpleTreeSchema {\n\t// Any version can be passed down to makeSchemaCodec here.\n\t// We only use the decode part, which always dispatches to the correct codec based on the version in the data, not the version passed to `makeSchemaCodec`.\n\tconst schemaCodec = makeSchemaCodec({\n\t\t...options,\n\t\tminVersionForCollab: FluidClientVersion.v2_0,\n\t});\n\tconst stored = schemaCodec.decode(persisted as FormatV1);\n\treturn exportSimpleSchema(stored);\n}\n\n/**\n * Get a {@link BranchableTree} from a {@link ITree}.\n * @remarks The branch can be used for \"version control\"-style coordination of edits on the tree.\n * @privateRemarks This function will be removed if/when the branching API becomes public,\n * but it (or something like it) is necessary in the meantime to prevent the alpha types from being exposed as public.\n * @alpha\n * @deprecated This API is superseded by {@link TreeBranch}, which should be used instead.\n */\nexport function getBranch(tree: ITree): BranchableTree;\n/**\n * Get a {@link BranchableTree} from a {@link TreeView}.\n * @remarks The branch can be used for \"version control\"-style coordination of edits on the tree.\n * Branches are currently an unstable \"alpha\" API and are subject to change in the future.\n * @privateRemarks This function will be removed if/when the branching API becomes public,\n * but it (or something like it) is necessary in the meantime to prevent the alpha types from being exposed as public.\n * @alpha\n * @deprecated This API is superseded by {@link TreeBranch}, which should be used instead.\n */\nexport function getBranch<T extends ImplicitFieldSchema | UnsafeUnknownSchema>(\n\tview: TreeViewAlpha<T>,\n): BranchableTree;\nexport function getBranch<T extends ImplicitFieldSchema | UnsafeUnknownSchema>(\n\ttreeOrView: ITree | TreeViewAlpha<T>,\n): BranchableTree {\n\tif (treeOrView instanceof SchematizingSimpleTreeView) {\n\t\treturn treeOrView.checkout as unknown as BranchableTree;\n\t}\n\tconst kernel = (treeOrView as ITree as ITreePrivate).kernel;\n\tassert(kernel instanceof SharedTreeKernel, 0xb56 /* Invalid ITree */);\n\t// This cast is safe so long as TreeCheckout supports all the operations on the branch interface.\n\treturn kernel.checkout as unknown as BranchableTree;\n}\n\n/**\n * Format versions supported by SharedTree.\n *\n * Each version documents a required minimum version of the \\@fluidframework/tree package.\n * @alpha\n */\nexport const SharedTreeFormatVersion = {\n\t/**\n\t * Requires \\@fluidframework/tree \\>= 2.0.0.\n\t *\n\t * @deprecated FF does not currently plan on supporting this format long-term.\n\t * Do not write production documents using this format, as they may not be loadable in the future.\n\t */\n\tv1: 1,\n\n\t/**\n\t * Requires \\@fluidframework/tree \\>= 2.0.0.\n\t */\n\tv2: 2,\n\n\t/**\n\t * Requires \\@fluidframework/tree \\>= 2.0.0.\n\t */\n\tv3: 3,\n\n\t/**\n\t * Requires \\@fluidframework/tree \\>= 2.0.0.\n\t */\n\tv5: 5,\n\n\t/**\n\t * For testing purposes only.\n\t */\n\tvSharedBranches: 100,\n} as const;\n\n/**\n * Format versions supported by SharedTree.\n *\n * Each version documents a required minimum version of the \\@fluidframework/tree package.\n * @alpha\n * @privateRemarks\n * See packages/dds/tree/docs/main/compatibility.md for information on how to add support for a new format.\n *\n * TODO: Before this gets promoted past Alpha,\n * a separate abstraction more suited for use in the public API should be adopted rather than reusing the same types used internally.\n * Such an abstraction should probably be in the form of a Fluid-Framework wide compatibility enum.\n */\nexport type SharedTreeFormatVersion = typeof SharedTreeFormatVersion;\n\n/**\n * Defines for each EditManagerFormatVersion the SharedTreeChangeFormatVersion to use.\n * This is an arbitrary mapping that is injected in the EditManger codec.\n * Once an entry is defined and used in production, it cannot be changed.\n * This is because the format for SharedTree changes are not explicitly versioned.\n */\nexport const changeFormatVersionForEditManager = DependentFormatVersion.fromPairs([\n\t[\n\t\tbrand<EditManagerFormatVersion>(EditManagerFormatVersion.v1),\n\t\tbrand<SharedTreeChangeFormatVersion>(1),\n\t],\n\t[\n\t\tbrand<EditManagerFormatVersion>(EditManagerFormatVersion.v2),\n\t\tbrand<SharedTreeChangeFormatVersion>(2),\n\t],\n\t[\n\t\tbrand<EditManagerFormatVersion>(EditManagerFormatVersion.v3),\n\t\tbrand<SharedTreeChangeFormatVersion>(3),\n\t],\n\t[\n\t\tbrand<EditManagerFormatVersion>(EditManagerFormatVersion.v4),\n\t\tbrand<SharedTreeChangeFormatVersion>(4),\n\t],\n\t[\n\t\tbrand<EditManagerFormatVersion>(EditManagerFormatVersion.v5),\n\t\tbrand<SharedTreeChangeFormatVersion>(4),\n\t],\n]);\n\n/**\n * Defines for each MessageFormatVersion the SharedTreeChangeFormatVersion to use.\n * This is an arbitrary mapping that is injected in the message codec.\n * Once an entry is defined and used in production, it cannot be changed.\n * This is because the format for SharedTree changes are not explicitly versioned.\n */\nexport const changeFormatVersionForMessage = DependentFormatVersion.fromPairs([\n\t[\n\t\tbrand<MessageFormatVersion>(MessageFormatVersion.undefined),\n\t\tbrand<SharedTreeChangeFormatVersion>(1),\n\t],\n\t[\n\t\tbrand<MessageFormatVersion>(MessageFormatVersion.v1),\n\t\tbrand<SharedTreeChangeFormatVersion>(1),\n\t],\n\t[\n\t\tbrand<MessageFormatVersion>(MessageFormatVersion.v2),\n\t\tbrand<SharedTreeChangeFormatVersion>(2),\n\t],\n\t[\n\t\tbrand<MessageFormatVersion>(MessageFormatVersion.v3),\n\t\tbrand<SharedTreeChangeFormatVersion>(3),\n\t],\n\t[\n\t\tbrand<MessageFormatVersion>(MessageFormatVersion.v4),\n\t\tbrand<SharedTreeChangeFormatVersion>(4),\n\t],\n\t[\n\t\tbrand<MessageFormatVersion>(MessageFormatVersion.v5),\n\t\tbrand<SharedTreeChangeFormatVersion>(4),\n\t],\n]);\n\nfunction getCodecTreeForEditManagerFormat(clientVersion: MinimumVersionForCollab): CodecTree {\n\tconst change = changeFormatVersionForEditManager.lookup(\n\t\tclientVersionToEditManagerFormatVersion(clientVersion),\n\t);\n\tconst changeCodecTree = getCodecTreeForChangeFormat(change, clientVersion);\n\treturn getCodecTreeForEditManagerFormatWithChange(clientVersion, changeCodecTree);\n}\n\nfunction getCodecTreeForMessageFormat(clientVersion: MinimumVersionForCollab): CodecTree {\n\tconst change = changeFormatVersionForMessage.lookup(\n\t\tclientVersionToMessageFormatVersion(clientVersion),\n\t);\n\tconst changeCodecTree = getCodecTreeForChangeFormat(change, clientVersion);\n\treturn getCodecTreeForMessageFormatWithChange(clientVersion, changeCodecTree);\n}\n\nexport function getCodecTreeForSharedTreeFormat(\n\tclientVersion: MinimumVersionForCollab,\n): CodecTree {\n\tconst children: CodecTree[] = [];\n\tchildren.push(getCodecTreeForForestFormat(clientVersion));\n\tchildren.push(getCodecTreeForSchemaFormat(clientVersion));\n\tchildren.push(getCodecTreeForDetachedFieldIndexFormat(clientVersion));\n\tchildren.push(getCodecTreeForEditManagerFormat(clientVersion));\n\tchildren.push(getCodecTreeForMessageFormat(clientVersion));\n\tchildren.push(getCodecTreeForFieldBatchFormat(clientVersion));\n\treturn {\n\t\tname: \"SharedTree\",\n\t\tversion: undefined, // SharedTree does not have a version of its own.\n\t\tchildren,\n\t};\n}\n\n/**\n * Configuration options for SharedTree.\n * @beta @input\n */\nexport type SharedTreeOptionsBeta = ForestOptions;\n\n/**\n * Configuration options for SharedTree.\n * @alpha @input\n */\nexport interface SharedTreeOptions\n\textends Partial<CodecWriteOptions>,\n\t\tPartial<SharedTreeFormatOptions>,\n\t\tSharedTreeOptionsBeta {\n\t/**\n\t * Experimental feature flag to enable shared branches.\n\t * This feature is not yet complete and should not be used in production.\n\t * Defaults to false.\n\t */\n\treadonly enableSharedBranches?: boolean;\n}\n\nexport interface SharedTreeOptionsInternal\n\textends Partial<SharedTreCoreOptionsInternal>,\n\t\tPartial<ForestOptions>,\n\t\tPartial<SharedTreeFormatOptionsInternal> {\n\tdisposeForksAfterTransaction?: boolean;\n\t/**\n\t * Returns whether a node / field should be incrementally encoded.\n\t * @remarks\n\t * See {@link IncrementalEncodingPolicy}.\n\t */\n\tshouldEncodeIncrementally?: IncrementalEncodingPolicy;\n}\n\n/**\n * Configuration options for SharedTree's internal tree storage.\n * @beta @input\n */\nexport interface ForestOptions {\n\t/**\n\t * The {@link ForestType} indicating which forest type should be created for the SharedTree.\n\t */\n\treadonly forest?: ForestType;\n}\n\n/**\n * Options for configuring the persisted format SharedTree uses.\n * @alpha @input\n */\nexport interface SharedTreeFormatOptions {\n\t/**\n\t * See {@link TreeCompressionStrategy}.\n\t * default: TreeCompressionStrategy.Compressed\n\t */\n\ttreeEncodeType: TreeCompressionStrategy;\n}\n\nexport interface SharedTreeFormatOptionsInternal\n\textends Omit<SharedTreeFormatOptions, \"treeEncodeType\"> {\n\ttreeEncodeType: TreeCompressionStrategyPrivate;\n}\n\n/**\n * Used to distinguish between different forest types.\n * @remarks\n * The \"Forest\" is the internal data structure used to store all the trees (the main tree and any removed ones) for a given view or branch.\n * ForestTypes should all have the same behavior, but may differ in performance and debuggability.\n *\n * Current options are {@link ForestTypeReference}, {@link ForestTypeOptimized} and {@link ForestTypeExpensiveDebug}.\n * @privateRemarks\n * Implement using {@link toForestType}.\n * Consume using {@link buildConfiguredForest}.\n * @sealed @beta\n */\nexport interface ForestType extends ErasedType<\"ForestType\"> {}\n\n/**\n * Reference implementation of forest.\n * @remarks\n * A simple implementation with minimal complexity and moderate debuggability, validation and performance.\n * @privateRemarks\n * The \"ObjectForest\" forest type.\n * @beta\n */\nexport const ForestTypeReference = toForestType(\n\t(breaker: Breakable, schema: TreeStoredSchemaSubscription, idCompressor: IIdCompressor) =>\n\t\tbuildForest(breaker, schema),\n);\n\n/**\n * Optimized implementation of forest.\n * @remarks\n * A complex optimized forest implementation, which has minimal validation and debuggability to optimize for performance.\n * Uses an internal representation optimized for size designed to scale to larger datasets with reduced overhead.\n * @privateRemarks\n * The \"ChunkedForest\" forest type.\n * @beta\n */\nexport const ForestTypeOptimized = toForestType(\n\t(\n\t\tbreaker: Breakable,\n\t\tschema: TreeStoredSchemaSubscription,\n\t\tidCompressor: IIdCompressor,\n\t\tshouldEncodeIncrementally: IncrementalEncodingPolicy,\n\t) =>\n\t\tbuildChunkedForest(\n\t\t\tmakeTreeChunker(schema, defaultSchemaPolicy, shouldEncodeIncrementally),\n\t\t\tundefined,\n\t\t\tidCompressor,\n\t\t),\n);\n\n/**\n * Slow implementation of forest intended only for debugging.\n * @remarks\n * Includes validation with scales poorly.\n * May be asymptotically slower than {@link ForestTypeReference}, and may perform very badly with larger data sizes.\n * @privateRemarks\n * The \"ObjectForest\" forest type with expensive asserts for debugging.\n * @beta\n */\nexport const ForestTypeExpensiveDebug = toForestType(\n\t(breaker: Breakable, schema: TreeStoredSchemaSubscription) =>\n\t\tbuildForest(breaker, schema, undefined, true),\n);\n\ntype ForestFactory = (\n\tbreaker: Breakable,\n\tschema: TreeStoredSchemaSubscription,\n\tidCompressor: IIdCompressor,\n\tshouldEncodeIncrementally: IncrementalEncodingPolicy,\n) => IEditableForest;\n\nfunction toForestType(factory: ForestFactory): ForestType {\n\treturn factory as unknown as ForestType;\n}\n\n/**\n * Build and return a forest of the requested type.\n */\nexport function buildConfiguredForest(\n\tbreaker: Breakable,\n\tfactory: ForestType,\n\tschema: TreeStoredSchemaSubscription,\n\tidCompressor: IIdCompressor,\n\tshouldEncodeIncrementally: IncrementalEncodingPolicy,\n): IEditableForest {\n\treturn (factory as unknown as ForestFactory)(\n\t\tbreaker,\n\t\tschema,\n\t\tidCompressor,\n\t\tshouldEncodeIncrementally,\n\t);\n}\n\nexport const defaultSharedTreeOptions: Required<SharedTreeOptionsInternal> = {\n\tjsonValidator: FormatValidatorNoOp,\n\tminVersionForCollab: FluidClientVersion.v2_0,\n\tforest: ForestTypeReference,\n\ttreeEncodeType: TreeCompressionStrategy.Compressed,\n\tdisposeForksAfterTransaction: true,\n\tshouldEncodeIncrementally: defaultIncrementalEncodingPolicy,\n\teditManagerFormatSelector: clientVersionToEditManagerFormatVersion,\n\tmessageFormatSelector: clientVersionToMessageFormatVersion,\n};\n\n/**\n * Build the allowed types for a Stored Schema.\n *\n * @remarks Staged upgrades do not apply to stored schemas, so we omit the {@link SimpleAllowedTypeAttributes.isStaged | staging flag } when building {@link SimpleAllowedTypeAttributes}.\n * @param types - The types to create allowed types for.\n * @returns The allowed types.\n */\nfunction buildSimpleAllowedTypeAttributesForStoredSchema(\n\ttypes: TreeTypeSet,\n): ReadonlyMap<string, SimpleAllowedTypeAttributes> {\n\tconst allowedTypesInfo = new Map<string, SimpleAllowedTypeAttributes>();\n\tfor (const type of types) {\n\t\t// Stored schemas do not have staged upgrades\n\t\tallowedTypesInfo.set(type, { isStaged: undefined });\n\t}\n\treturn allowedTypesInfo;\n}\n\nfunction exportSimpleFieldSchemaStored(schema: TreeFieldStoredSchema): SimpleFieldSchema {\n\tlet kind: FieldKind;\n\tswitch (schema.kind) {\n\t\tcase FieldKinds.identifier.identifier:\n\t\t\tkind = FieldKind.Identifier;\n\t\t\tbreak;\n\t\tcase FieldKinds.optional.identifier:\n\t\t\tkind = FieldKind.Optional;\n\t\t\tbreak;\n\t\tcase FieldKinds.required.identifier:\n\t\t\tkind = FieldKind.Required;\n\t\t\tbreak;\n\t\tcase FieldKinds.forbidden.identifier:\n\t\t\tkind = FieldKind.Optional;\n\t\t\tassert(schema.types.size === 0, 0xa94 /* invalid forbidden field */);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tfail(0xaca /* invalid field kind */);\n\t}\n\treturn {\n\t\tkind,\n\t\tsimpleAllowedTypes: buildSimpleAllowedTypeAttributesForStoredSchema(schema.types),\n\t\tmetadata: {},\n\t\tpersistedMetadata: schema.persistedMetadata,\n\t};\n}\n\n/**\n * Export a {@link SimpleNodeSchema} from a {@link TreeNodeStoredSchema}.\n * @privateRemarks\n * TODO: Persist node metadata once schema FormatV2 is supported.\n * Note on SimpleNodeSchema construction: In the persisted format `persistedMetadata` is just called `metadata` whereas the `metadata`\n * field on SimpleNodeSchema is not persisted.\n */\nfunction exportSimpleNodeSchemaStored(schema: TreeNodeStoredSchema): SimpleNodeSchema {\n\tconst arrayTypes = tryStoredSchemaAsArray(schema);\n\tif (arrayTypes !== undefined) {\n\t\treturn {\n\t\t\tkind: NodeKind.Array,\n\t\t\tsimpleAllowedTypes: buildSimpleAllowedTypeAttributesForStoredSchema(arrayTypes),\n\t\t\tmetadata: {},\n\t\t\tpersistedMetadata: schema.metadata,\n\t\t};\n\t}\n\tif (schema instanceof ObjectNodeStoredSchema) {\n\t\tconst fields = new Map<FieldKey, SimpleObjectFieldSchema>();\n\t\tfor (const [storedKey, field] of schema.objectNodeFields) {\n\t\t\tfields.set(storedKey, { ...exportSimpleFieldSchemaStored(field), storedKey });\n\t\t}\n\t\treturn {\n\t\t\tkind: NodeKind.Object,\n\t\t\tfields,\n\t\t\tallowUnknownOptionalFields: undefined,\n\t\t\tmetadata: {},\n\t\t\tpersistedMetadata: schema.metadata,\n\t\t};\n\t}\n\tif (schema instanceof MapNodeStoredSchema) {\n\t\tassert(\n\t\t\tschema.mapFields.kind === FieldKinds.optional.identifier,\n\t\t\t0xa95 /* Invalid map schema */,\n\t\t);\n\t\treturn {\n\t\t\tkind: NodeKind.Map,\n\t\t\tsimpleAllowedTypes: buildSimpleAllowedTypeAttributesForStoredSchema(\n\t\t\t\tschema.mapFields.types,\n\t\t\t),\n\t\t\tmetadata: {},\n\t\t\tpersistedMetadata: schema.metadata,\n\t\t};\n\t}\n\tif (schema instanceof LeafNodeStoredSchema) {\n\t\treturn {\n\t\t\tkind: NodeKind.Leaf,\n\t\t\tleafKind: schema.leafValue,\n\t\t\tmetadata: {},\n\t\t\tpersistedMetadata: schema.metadata,\n\t\t};\n\t}\n\tfail(0xacb /* invalid schema kind */);\n}\n"]}
@@ -2,15 +2,16 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { type CodecTree, type ICodecFamily, type ICodecOptions } from "../codec/index.js";
6
- import type { ChangeEncodingContext } from "../core/index.js";
7
- import { type ModularChangeFormatVersion, type ModularChangeset, type SchemaChangeFormatVersion } from "../feature-libraries/index.js";
5
+ import type { MinimumVersionForCollab } from "@fluidframework/runtime-definitions/internal";
6
+ import { type CodecTree, type CodecWriteOptions, type ICodecFamily } from "../codec/index.js";
7
+ import { type ChangeEncodingContext, SchemaFormatVersion } from "../core/index.js";
8
+ import { type ModularChangeFormatVersion, type ModularChangeset } from "../feature-libraries/index.js";
8
9
  import { type Brand } from "../util/index.js";
9
10
  import type { SharedTreeChange } from "./sharedTreeChangeTypes.js";
10
- export declare function makeSharedTreeChangeCodecFamily(modularChangeCodecFamily: ICodecFamily<ModularChangeset, ChangeEncodingContext>, options: ICodecOptions): ICodecFamily<SharedTreeChange, ChangeEncodingContext>;
11
+ export declare function makeSharedTreeChangeCodecFamily(modularChangeCodecFamily: ICodecFamily<ModularChangeset, ChangeEncodingContext>, options: CodecWriteOptions): ICodecFamily<SharedTreeChange, ChangeEncodingContext>;
11
12
  interface ChangeFormatDependencies {
12
13
  readonly modularChange: ModularChangeFormatVersion;
13
- readonly schemaChange: SchemaChangeFormatVersion;
14
+ readonly schemaChange: SchemaFormatVersion;
14
15
  }
15
16
  export type SharedTreeChangeFormatVersion = Brand<1 | 2 | 3 | 4, "SharedTreeChangeFormatVersion">;
16
17
  /**
@@ -20,6 +21,6 @@ export type SharedTreeChangeFormatVersion = Brand<1 | 2 | 3 | 4, "SharedTreeChan
20
21
  * This is because the format for the dependent formats are not explicitly versioned.
21
22
  */
22
23
  export declare const dependenciesForChangeFormat: Map<SharedTreeChangeFormatVersion, ChangeFormatDependencies>;
23
- export declare function getCodecTreeForChangeFormat(version: SharedTreeChangeFormatVersion): CodecTree;
24
+ export declare function getCodecTreeForChangeFormat(version: SharedTreeChangeFormatVersion, clientVersion: MinimumVersionForCollab): CodecTree;
24
25
  export {};
25
26
  //# sourceMappingURL=sharedTreeChangeCodecs.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sharedTreeChangeCodecs.d.ts","sourceRoot":"","sources":["../../src/shared-tree/sharedTreeChangeCodecs.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mB,CAAC;AAC3B,OAAO,EACN,KAAK,qBAAqB,EAC1B,mBAAmB,EAEnB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACN,KAAK,0BAA0B,EAC/B,KAAK,gBAAgB,EAMrB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAEN,KAAK,KAAK,EAGV,MAAM,kBAAkB,CAAC;AAM1B,OAAO,KAAK,EAAE,gBAAgB,EAAyB,MAAM,4BAA4B,CAAC;AAE1F,wBAAgB,+BAA+B,CAC9C,wBAAwB,EAAE,YAAY,CAAC,gBAAgB,EAAE,qBAAqB,CAAC,EAC/E,OAAO,EAAE,iBAAiB,GACxB,YAAY,CAAC,gBAAgB,EAAE,qBAAqB,CAAC,CAqBvD;AAED,UAAU,wBAAwB;IACjC,QAAQ,CAAC,aAAa,EAAE,0BAA0B,CAAC;IACnD,QAAQ,CAAC,YAAY,EAAE,mBAAmB,CAAC;CAC3C;AAED,MAAM,MAAM,6BAA6B,GAAG,KAAK,CAChD,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,EACb,+BAA+B,CAC/B,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,EAAE,GAAG,CAC5C,6BAA6B,EAC7B,wBAAwB,CAMvB,CAAC;AAEH,wBAAgB,2BAA2B,CAC1C,OAAO,EAAE,6BAA6B,EACtC,aAAa,EAAE,uBAAuB,GACpC,SAAS,CAWX"}
@@ -4,6 +4,7 @@
4
4
  */
5
5
  import { fail } from "@fluidframework/core-utils/internal";
6
6
  import { DiscriminatedUnionDispatcher, makeCodecFamily, withSchemaValidation, } from "../codec/index.js";
7
+ import { SchemaFormatVersion, } from "../core/index.js";
7
8
  import { defaultSchemaPolicy, getCodecTreeForModularChangeFormat, getCodecTreeForSchemaChangeFormat, makeSchemaChangeCodecs, } from "../feature-libraries/index.js";
8
9
  import { brand, } from "../util/index.js";
9
10
  import { EncodedSharedTreeChange, } from "./sharedTreeChangeFormat.js";
@@ -22,19 +23,19 @@ export function makeSharedTreeChangeCodecFamily(modularChangeCodecFamily, option
22
23
  * This is because the format for the dependent formats are not explicitly versioned.
23
24
  */
24
25
  export const dependenciesForChangeFormat = new Map([
25
- [brand(1), { modularChange: brand(1), schemaChange: brand(1) }],
26
- [brand(2), { modularChange: brand(2), schemaChange: brand(1) }],
27
- [brand(3), { modularChange: brand(3), schemaChange: brand(1) }],
28
- [brand(4), { modularChange: brand(4), schemaChange: brand(1) }],
26
+ [brand(1), { modularChange: brand(1), schemaChange: brand(SchemaFormatVersion.v1) }],
27
+ [brand(2), { modularChange: brand(2), schemaChange: brand(SchemaFormatVersion.v1) }],
28
+ [brand(3), { modularChange: brand(3), schemaChange: brand(SchemaFormatVersion.v1) }],
29
+ [brand(4), { modularChange: brand(4), schemaChange: brand(SchemaFormatVersion.v1) }],
29
30
  ]);
30
- export function getCodecTreeForChangeFormat(version) {
31
+ export function getCodecTreeForChangeFormat(version, clientVersion) {
31
32
  const { modularChange, schemaChange } = dependenciesForChangeFormat.get(version) ?? fail(0xc78 /* Unknown change format */);
32
33
  return {
33
34
  name: "SharedTreeChange",
34
35
  version,
35
36
  children: [
36
37
  getCodecTreeForModularChangeFormat(modularChange),
37
- getCodecTreeForSchemaChangeFormat(schemaChange),
38
+ getCodecTreeForSchemaChangeFormat(schemaChange, clientVersion),
38
39
  ],
39
40
  };
40
41
  }