@fluidframework/tree 2.72.0 → 2.73.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (609) hide show
  1. package/CHANGELOG.md +99 -0
  2. package/api-report/tree.alpha.api.md +17 -30
  3. package/dist/alpha.d.ts +3 -1
  4. package/dist/api.d.ts +6 -2
  5. package/dist/api.d.ts.map +1 -1
  6. package/dist/api.js +2 -11
  7. package/dist/api.js.map +1 -1
  8. package/dist/codec/codec.d.ts +9 -2
  9. package/dist/codec/codec.d.ts.map +1 -1
  10. package/dist/codec/codec.js +9 -2
  11. package/dist/codec/codec.js.map +1 -1
  12. package/dist/codec/index.d.ts +1 -1
  13. package/dist/codec/index.d.ts.map +1 -1
  14. package/dist/codec/index.js +2 -1
  15. package/dist/codec/index.js.map +1 -1
  16. package/dist/codec/versioned/codec.d.ts +7 -2
  17. package/dist/codec/versioned/codec.d.ts.map +1 -1
  18. package/dist/codec/versioned/codec.js +24 -1
  19. package/dist/codec/versioned/codec.js.map +1 -1
  20. package/dist/codec/versioned/index.d.ts +1 -1
  21. package/dist/codec/versioned/index.d.ts.map +1 -1
  22. package/dist/codec/versioned/index.js +2 -1
  23. package/dist/codec/versioned/index.js.map +1 -1
  24. package/dist/core/schema-stored/schema.d.ts +12 -1
  25. package/dist/core/schema-stored/schema.d.ts.map +1 -1
  26. package/dist/core/schema-stored/schema.js.map +1 -1
  27. package/dist/core/tree/detachedFieldIndexCodecs.d.ts.map +1 -1
  28. package/dist/core/tree/detachedFieldIndexCodecs.js +5 -3
  29. package/dist/core/tree/detachedFieldIndexCodecs.js.map +1 -1
  30. package/dist/feature-libraries/chunked-forest/chunkTree.d.ts +4 -5
  31. package/dist/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  32. package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  33. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  34. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js +1 -0
  35. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  36. package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts +2 -1
  37. package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts.map +1 -1
  38. package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
  39. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts +1 -1
  40. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  41. package/dist/feature-libraries/chunked-forest/codec/codecs.js +31 -17
  42. package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  43. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +6 -6
  44. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
  45. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +4 -2
  46. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  47. package/dist/feature-libraries/chunked-forest/codec/format.d.ts +156 -4
  48. package/dist/feature-libraries/chunked-forest/codec/format.d.ts.map +1 -1
  49. package/dist/feature-libraries/chunked-forest/codec/format.js +7 -3
  50. package/dist/feature-libraries/chunked-forest/codec/format.js.map +1 -1
  51. package/dist/feature-libraries/chunked-forest/codec/formatGeneric.d.ts +8 -3
  52. package/dist/feature-libraries/chunked-forest/codec/formatGeneric.d.ts.map +1 -1
  53. package/dist/feature-libraries/chunked-forest/codec/formatGeneric.js +4 -1
  54. package/dist/feature-libraries/chunked-forest/codec/formatGeneric.js.map +1 -1
  55. package/dist/feature-libraries/chunked-forest/codec/index.d.ts +1 -1
  56. package/dist/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
  57. package/dist/feature-libraries/chunked-forest/codec/index.js +2 -1
  58. package/dist/feature-libraries/chunked-forest/codec/index.js.map +1 -1
  59. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts +13 -13
  60. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -1
  61. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +23 -6
  62. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
  63. package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.d.ts +9 -8
  64. package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.d.ts.map +1 -1
  65. package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.js +20 -4
  66. package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.js.map +1 -1
  67. package/dist/feature-libraries/chunked-forest/index.d.ts +1 -1
  68. package/dist/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  69. package/dist/feature-libraries/chunked-forest/index.js +2 -1
  70. package/dist/feature-libraries/chunked-forest/index.js.map +1 -1
  71. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts +35 -17
  72. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  73. package/dist/feature-libraries/default-schema/defaultFieldKinds.js +53 -55
  74. package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  75. package/dist/feature-libraries/default-schema/index.d.ts +1 -3
  76. package/dist/feature-libraries/default-schema/index.d.ts.map +1 -1
  77. package/dist/feature-libraries/default-schema/index.js +2 -8
  78. package/dist/feature-libraries/default-schema/index.js.map +1 -1
  79. package/dist/feature-libraries/forest-summary/format.d.ts +2 -2
  80. package/dist/feature-libraries/forest-summary/format.d.ts.map +1 -1
  81. package/dist/feature-libraries/forest-summary/format.js +4 -2
  82. package/dist/feature-libraries/forest-summary/format.js.map +1 -1
  83. package/dist/feature-libraries/index.d.ts +4 -3
  84. package/dist/feature-libraries/index.d.ts.map +1 -1
  85. package/dist/feature-libraries/index.js +8 -7
  86. package/dist/feature-libraries/index.js.map +1 -1
  87. package/dist/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
  88. package/dist/feature-libraries/modular-schema/comparison.js +1 -2
  89. package/dist/feature-libraries/modular-schema/comparison.js.map +1 -1
  90. package/dist/feature-libraries/modular-schema/fieldKind.d.ts +38 -12
  91. package/dist/feature-libraries/modular-schema/fieldKind.d.ts.map +1 -1
  92. package/dist/feature-libraries/modular-schema/fieldKind.js +29 -11
  93. package/dist/feature-libraries/modular-schema/fieldKind.js.map +1 -1
  94. package/dist/feature-libraries/modular-schema/fieldKindConfiguration.d.ts +2 -2
  95. package/dist/feature-libraries/modular-schema/fieldKindConfiguration.d.ts.map +1 -1
  96. package/dist/feature-libraries/modular-schema/fieldKindConfiguration.js.map +1 -1
  97. package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts +2 -2
  98. package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  99. package/dist/feature-libraries/modular-schema/genericFieldKind.js +3 -2
  100. package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  101. package/dist/feature-libraries/modular-schema/index.d.ts +0 -1
  102. package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
  103. package/dist/feature-libraries/modular-schema/index.js +1 -3
  104. package/dist/feature-libraries/modular-schema/index.js.map +1 -1
  105. package/dist/feature-libraries/modular-schema/isNeverTree.d.ts +5 -6
  106. package/dist/feature-libraries/modular-schema/isNeverTree.d.ts.map +1 -1
  107. package/dist/feature-libraries/modular-schema/isNeverTree.js.map +1 -1
  108. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +8 -8
  109. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  110. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +1 -2
  111. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  112. package/dist/feature-libraries/modular-schema/modularChangeFormat.d.ts +66 -9
  113. package/dist/feature-libraries/modular-schema/modularChangeFormat.d.ts.map +1 -1
  114. package/dist/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  115. package/dist/feature-libraries/object-forest/objectForest.js +3 -2
  116. package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
  117. package/dist/feature-libraries/optional-field/index.d.ts +1 -1
  118. package/dist/feature-libraries/optional-field/index.d.ts.map +1 -1
  119. package/dist/feature-libraries/optional-field/index.js.map +1 -1
  120. package/dist/feature-libraries/optional-field/optionalFieldCodecs.d.ts.map +1 -1
  121. package/dist/feature-libraries/optional-field/optionalFieldCodecs.js +1 -5
  122. package/dist/feature-libraries/optional-field/optionalFieldCodecs.js.map +1 -1
  123. package/dist/feature-libraries/schema-index/codec.d.ts.map +1 -1
  124. package/dist/feature-libraries/schema-index/codec.js +5 -3
  125. package/dist/feature-libraries/schema-index/codec.js.map +1 -1
  126. package/dist/feature-libraries/{default-schema/schemaChecker.d.ts → schemaChecker.d.ts} +2 -2
  127. package/dist/feature-libraries/schemaChecker.d.ts.map +1 -0
  128. package/dist/feature-libraries/{default-schema/schemaChecker.js → schemaChecker.js} +3 -3
  129. package/dist/feature-libraries/schemaChecker.js.map +1 -0
  130. package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts.map +1 -1
  131. package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.js +0 -2
  132. package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.js.map +1 -1
  133. package/dist/index.d.ts +2 -2
  134. package/dist/index.d.ts.map +1 -1
  135. package/dist/index.js +5 -3
  136. package/dist/index.js.map +1 -1
  137. package/dist/packageVersion.d.ts +1 -1
  138. package/dist/packageVersion.js +1 -1
  139. package/dist/packageVersion.js.map +1 -1
  140. package/dist/shared-tree/index.d.ts +1 -1
  141. package/dist/shared-tree/index.d.ts.map +1 -1
  142. package/dist/shared-tree/index.js +1 -2
  143. package/dist/shared-tree/index.js.map +1 -1
  144. package/dist/shared-tree/sharedTree.d.ts +0 -44
  145. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  146. package/dist/shared-tree/sharedTree.js +1 -52
  147. package/dist/shared-tree/sharedTree.js.map +1 -1
  148. package/dist/shared-tree/sharedTreeChangeCodecs.d.ts +1 -1
  149. package/dist/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  150. package/dist/shared-tree/sharedTreeChangeCodecs.js +0 -2
  151. package/dist/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  152. package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  153. package/dist/shared-tree-core/editManagerCodecs.js +12 -6
  154. package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
  155. package/dist/shared-tree-core/editManagerFormatCommons.d.ts +3 -4
  156. package/dist/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
  157. package/dist/shared-tree-core/editManagerFormatCommons.js +5 -8
  158. package/dist/shared-tree-core/editManagerFormatCommons.js.map +1 -1
  159. package/dist/shared-tree-core/index.d.ts +2 -2
  160. package/dist/shared-tree-core/index.d.ts.map +1 -1
  161. package/dist/shared-tree-core/index.js +3 -2
  162. package/dist/shared-tree-core/index.js.map +1 -1
  163. package/dist/shared-tree-core/messageCodecs.d.ts.map +1 -1
  164. package/dist/shared-tree-core/messageCodecs.js +20 -9
  165. package/dist/shared-tree-core/messageCodecs.js.map +1 -1
  166. package/dist/shared-tree-core/messageFormat.d.ts +4 -6
  167. package/dist/shared-tree-core/messageFormat.d.ts.map +1 -1
  168. package/dist/shared-tree-core/messageFormat.js +9 -7
  169. package/dist/shared-tree-core/messageFormat.js.map +1 -1
  170. package/dist/simple-tree/api/configuration.d.ts +2 -0
  171. package/dist/simple-tree/api/configuration.d.ts.map +1 -1
  172. package/dist/simple-tree/api/configuration.js +10 -0
  173. package/dist/simple-tree/api/configuration.js.map +1 -1
  174. package/dist/simple-tree/api/index.d.ts +1 -0
  175. package/dist/simple-tree/api/index.d.ts.map +1 -1
  176. package/dist/simple-tree/api/index.js +5 -1
  177. package/dist/simple-tree/api/index.js.map +1 -1
  178. package/dist/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
  179. package/dist/simple-tree/api/schemaFromSimple.js +7 -1
  180. package/dist/simple-tree/api/schemaFromSimple.js.map +1 -1
  181. package/dist/simple-tree/api/simpleSchemaCodec.js +4 -6
  182. package/dist/simple-tree/api/simpleSchemaCodec.js.map +1 -1
  183. package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts +103 -0
  184. package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -0
  185. package/dist/simple-tree/api/snapshotCompatibilityChecker.js +128 -0
  186. package/dist/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -0
  187. package/dist/simple-tree/api/tree.d.ts +1 -1
  188. package/dist/simple-tree/api/tree.js +1 -1
  189. package/dist/simple-tree/api/tree.js.map +1 -1
  190. package/dist/simple-tree/core/allowedTypes.js +1 -1
  191. package/dist/simple-tree/core/allowedTypes.js.map +1 -1
  192. package/dist/simple-tree/core/index.d.ts +3 -3
  193. package/dist/simple-tree/core/index.d.ts.map +1 -1
  194. package/dist/simple-tree/core/index.js +3 -1
  195. package/dist/simple-tree/core/index.js.map +1 -1
  196. package/dist/simple-tree/core/toStored.d.ts +12 -5
  197. package/dist/simple-tree/core/toStored.d.ts.map +1 -1
  198. package/dist/simple-tree/core/toStored.js +26 -10
  199. package/dist/simple-tree/core/toStored.js.map +1 -1
  200. package/dist/simple-tree/core/treeNodeSchema.d.ts +1 -6
  201. package/dist/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  202. package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
  203. package/dist/simple-tree/core/treeNodeValid.d.ts +1 -1
  204. package/dist/simple-tree/core/treeNodeValid.d.ts.map +1 -1
  205. package/dist/simple-tree/core/treeNodeValid.js +1 -2
  206. package/dist/simple-tree/core/treeNodeValid.js.map +1 -1
  207. package/dist/simple-tree/fieldSchema.d.ts.map +1 -1
  208. package/dist/simple-tree/fieldSchema.js +1 -8
  209. package/dist/simple-tree/fieldSchema.js.map +1 -1
  210. package/dist/simple-tree/index.d.ts +2 -2
  211. package/dist/simple-tree/index.d.ts.map +1 -1
  212. package/dist/simple-tree/index.js +9 -3
  213. package/dist/simple-tree/index.js.map +1 -1
  214. package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
  215. package/dist/simple-tree/leafNodeSchema.js +0 -1
  216. package/dist/simple-tree/leafNodeSchema.js.map +1 -1
  217. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  218. package/dist/simple-tree/node-kinds/array/arrayNode.js +13 -49
  219. package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  220. package/dist/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
  221. package/dist/simple-tree/node-kinds/map/mapNode.js +1 -5
  222. package/dist/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  223. package/dist/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  224. package/dist/simple-tree/node-kinds/object/objectNode.js +2 -10
  225. package/dist/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  226. package/dist/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
  227. package/dist/simple-tree/node-kinds/record/recordNode.js +1 -5
  228. package/dist/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  229. package/dist/simple-tree/simpleSchema.d.ts +15 -3
  230. package/dist/simple-tree/simpleSchema.d.ts.map +1 -1
  231. package/dist/simple-tree/simpleSchema.js.map +1 -1
  232. package/dist/simple-tree/toStoredSchema.d.ts +20 -8
  233. package/dist/simple-tree/toStoredSchema.d.ts.map +1 -1
  234. package/dist/simple-tree/toStoredSchema.js +27 -22
  235. package/dist/simple-tree/toStoredSchema.js.map +1 -1
  236. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
  237. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js +18 -15
  238. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
  239. package/dist/tableSchema.d.ts +22 -52
  240. package/dist/tableSchema.d.ts.map +1 -1
  241. package/dist/tableSchema.js +141 -277
  242. package/dist/tableSchema.js.map +1 -1
  243. package/dist/util/arrayUtilities.d.ts +45 -0
  244. package/dist/util/arrayUtilities.d.ts.map +1 -0
  245. package/dist/util/arrayUtilities.js +76 -0
  246. package/dist/util/arrayUtilities.js.map +1 -0
  247. package/dist/util/index.d.ts +1 -0
  248. package/dist/util/index.d.ts.map +1 -1
  249. package/dist/util/index.js +7 -2
  250. package/dist/util/index.js.map +1 -1
  251. package/lib/alpha.d.ts +3 -1
  252. package/lib/api.d.ts +6 -2
  253. package/lib/api.d.ts.map +1 -1
  254. package/lib/api.js +2 -13
  255. package/lib/api.js.map +1 -1
  256. package/lib/codec/codec.d.ts +9 -2
  257. package/lib/codec/codec.d.ts.map +1 -1
  258. package/lib/codec/codec.js +9 -2
  259. package/lib/codec/codec.js.map +1 -1
  260. package/lib/codec/index.d.ts +1 -1
  261. package/lib/codec/index.d.ts.map +1 -1
  262. package/lib/codec/index.js +1 -1
  263. package/lib/codec/index.js.map +1 -1
  264. package/lib/codec/versioned/codec.d.ts +7 -2
  265. package/lib/codec/versioned/codec.d.ts.map +1 -1
  266. package/lib/codec/versioned/codec.js +22 -0
  267. package/lib/codec/versioned/codec.js.map +1 -1
  268. package/lib/codec/versioned/index.d.ts +1 -1
  269. package/lib/codec/versioned/index.d.ts.map +1 -1
  270. package/lib/codec/versioned/index.js +1 -1
  271. package/lib/codec/versioned/index.js.map +1 -1
  272. package/lib/core/schema-stored/schema.d.ts +12 -1
  273. package/lib/core/schema-stored/schema.d.ts.map +1 -1
  274. package/lib/core/schema-stored/schema.js.map +1 -1
  275. package/lib/core/tree/detachedFieldIndexCodecs.d.ts.map +1 -1
  276. package/lib/core/tree/detachedFieldIndexCodecs.js +5 -3
  277. package/lib/core/tree/detachedFieldIndexCodecs.js.map +1 -1
  278. package/lib/feature-libraries/chunked-forest/chunkTree.d.ts +4 -5
  279. package/lib/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  280. package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  281. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  282. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js +2 -1
  283. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  284. package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts +2 -1
  285. package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts.map +1 -1
  286. package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
  287. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts +1 -1
  288. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  289. package/lib/feature-libraries/chunked-forest/codec/codecs.js +34 -20
  290. package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  291. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +6 -6
  292. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
  293. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +4 -2
  294. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  295. package/lib/feature-libraries/chunked-forest/codec/format.d.ts +156 -4
  296. package/lib/feature-libraries/chunked-forest/codec/format.d.ts.map +1 -1
  297. package/lib/feature-libraries/chunked-forest/codec/format.js +6 -2
  298. package/lib/feature-libraries/chunked-forest/codec/format.js.map +1 -1
  299. package/lib/feature-libraries/chunked-forest/codec/formatGeneric.d.ts +8 -3
  300. package/lib/feature-libraries/chunked-forest/codec/formatGeneric.d.ts.map +1 -1
  301. package/lib/feature-libraries/chunked-forest/codec/formatGeneric.js +4 -1
  302. package/lib/feature-libraries/chunked-forest/codec/formatGeneric.js.map +1 -1
  303. package/lib/feature-libraries/chunked-forest/codec/index.d.ts +1 -1
  304. package/lib/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
  305. package/lib/feature-libraries/chunked-forest/codec/index.js +1 -1
  306. package/lib/feature-libraries/chunked-forest/codec/index.js.map +1 -1
  307. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts +13 -13
  308. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -1
  309. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +22 -6
  310. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
  311. package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.d.ts +9 -8
  312. package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.d.ts.map +1 -1
  313. package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.js +17 -2
  314. package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.js.map +1 -1
  315. package/lib/feature-libraries/chunked-forest/index.d.ts +1 -1
  316. package/lib/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  317. package/lib/feature-libraries/chunked-forest/index.js +1 -1
  318. package/lib/feature-libraries/chunked-forest/index.js.map +1 -1
  319. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts +35 -17
  320. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  321. package/lib/feature-libraries/default-schema/defaultFieldKinds.js +55 -57
  322. package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  323. package/lib/feature-libraries/default-schema/index.d.ts +1 -3
  324. package/lib/feature-libraries/default-schema/index.d.ts.map +1 -1
  325. package/lib/feature-libraries/default-schema/index.js +1 -3
  326. package/lib/feature-libraries/default-schema/index.js.map +1 -1
  327. package/lib/feature-libraries/forest-summary/format.d.ts +2 -2
  328. package/lib/feature-libraries/forest-summary/format.d.ts.map +1 -1
  329. package/lib/feature-libraries/forest-summary/format.js +4 -2
  330. package/lib/feature-libraries/forest-summary/format.js.map +1 -1
  331. package/lib/feature-libraries/index.d.ts +4 -3
  332. package/lib/feature-libraries/index.d.ts.map +1 -1
  333. package/lib/feature-libraries/index.js +4 -3
  334. package/lib/feature-libraries/index.js.map +1 -1
  335. package/lib/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
  336. package/lib/feature-libraries/modular-schema/comparison.js +1 -2
  337. package/lib/feature-libraries/modular-schema/comparison.js.map +1 -1
  338. package/lib/feature-libraries/modular-schema/fieldKind.d.ts +38 -12
  339. package/lib/feature-libraries/modular-schema/fieldKind.d.ts.map +1 -1
  340. package/lib/feature-libraries/modular-schema/fieldKind.js +29 -11
  341. package/lib/feature-libraries/modular-schema/fieldKind.js.map +1 -1
  342. package/lib/feature-libraries/modular-schema/fieldKindConfiguration.d.ts +2 -2
  343. package/lib/feature-libraries/modular-schema/fieldKindConfiguration.d.ts.map +1 -1
  344. package/lib/feature-libraries/modular-schema/fieldKindConfiguration.js.map +1 -1
  345. package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts +2 -2
  346. package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  347. package/lib/feature-libraries/modular-schema/genericFieldKind.js +3 -2
  348. package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  349. package/lib/feature-libraries/modular-schema/index.d.ts +0 -1
  350. package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
  351. package/lib/feature-libraries/modular-schema/index.js +0 -1
  352. package/lib/feature-libraries/modular-schema/index.js.map +1 -1
  353. package/lib/feature-libraries/modular-schema/isNeverTree.d.ts +5 -6
  354. package/lib/feature-libraries/modular-schema/isNeverTree.d.ts.map +1 -1
  355. package/lib/feature-libraries/modular-schema/isNeverTree.js.map +1 -1
  356. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +8 -8
  357. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  358. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +1 -2
  359. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  360. package/lib/feature-libraries/modular-schema/modularChangeFormat.d.ts +66 -9
  361. package/lib/feature-libraries/modular-schema/modularChangeFormat.d.ts.map +1 -1
  362. package/lib/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  363. package/lib/feature-libraries/object-forest/objectForest.js +2 -1
  364. package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
  365. package/lib/feature-libraries/optional-field/index.d.ts +1 -1
  366. package/lib/feature-libraries/optional-field/index.d.ts.map +1 -1
  367. package/lib/feature-libraries/optional-field/index.js.map +1 -1
  368. package/lib/feature-libraries/optional-field/optionalFieldCodecs.d.ts.map +1 -1
  369. package/lib/feature-libraries/optional-field/optionalFieldCodecs.js +1 -5
  370. package/lib/feature-libraries/optional-field/optionalFieldCodecs.js.map +1 -1
  371. package/lib/feature-libraries/schema-index/codec.d.ts.map +1 -1
  372. package/lib/feature-libraries/schema-index/codec.js +5 -3
  373. package/lib/feature-libraries/schema-index/codec.js.map +1 -1
  374. package/lib/feature-libraries/{default-schema/schemaChecker.d.ts → schemaChecker.d.ts} +2 -2
  375. package/lib/feature-libraries/schemaChecker.d.ts.map +1 -0
  376. package/lib/feature-libraries/{default-schema/schemaChecker.js → schemaChecker.js} +3 -3
  377. package/lib/feature-libraries/schemaChecker.js.map +1 -0
  378. package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts.map +1 -1
  379. package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.js +0 -2
  380. package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.js.map +1 -1
  381. package/lib/index.d.ts +2 -2
  382. package/lib/index.d.ts.map +1 -1
  383. package/lib/index.js +2 -2
  384. package/lib/index.js.map +1 -1
  385. package/lib/packageVersion.d.ts +1 -1
  386. package/lib/packageVersion.js +1 -1
  387. package/lib/packageVersion.js.map +1 -1
  388. package/lib/shared-tree/index.d.ts +1 -1
  389. package/lib/shared-tree/index.d.ts.map +1 -1
  390. package/lib/shared-tree/index.js +1 -1
  391. package/lib/shared-tree/index.js.map +1 -1
  392. package/lib/shared-tree/sharedTree.d.ts +0 -44
  393. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  394. package/lib/shared-tree/sharedTree.js +0 -51
  395. package/lib/shared-tree/sharedTree.js.map +1 -1
  396. package/lib/shared-tree/sharedTreeChangeCodecs.d.ts +1 -1
  397. package/lib/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  398. package/lib/shared-tree/sharedTreeChangeCodecs.js +0 -2
  399. package/lib/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  400. package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  401. package/lib/shared-tree-core/editManagerCodecs.js +13 -7
  402. package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
  403. package/lib/shared-tree-core/editManagerFormatCommons.d.ts +3 -4
  404. package/lib/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
  405. package/lib/shared-tree-core/editManagerFormatCommons.js +4 -7
  406. package/lib/shared-tree-core/editManagerFormatCommons.js.map +1 -1
  407. package/lib/shared-tree-core/index.d.ts +2 -2
  408. package/lib/shared-tree-core/index.d.ts.map +1 -1
  409. package/lib/shared-tree-core/index.js +2 -2
  410. package/lib/shared-tree-core/index.js.map +1 -1
  411. package/lib/shared-tree-core/messageCodecs.d.ts.map +1 -1
  412. package/lib/shared-tree-core/messageCodecs.js +21 -10
  413. package/lib/shared-tree-core/messageCodecs.js.map +1 -1
  414. package/lib/shared-tree-core/messageFormat.d.ts +4 -6
  415. package/lib/shared-tree-core/messageFormat.d.ts.map +1 -1
  416. package/lib/shared-tree-core/messageFormat.js +8 -6
  417. package/lib/shared-tree-core/messageFormat.js.map +1 -1
  418. package/lib/simple-tree/api/configuration.d.ts +2 -0
  419. package/lib/simple-tree/api/configuration.d.ts.map +1 -1
  420. package/lib/simple-tree/api/configuration.js +10 -0
  421. package/lib/simple-tree/api/configuration.js.map +1 -1
  422. package/lib/simple-tree/api/index.d.ts +1 -0
  423. package/lib/simple-tree/api/index.d.ts.map +1 -1
  424. package/lib/simple-tree/api/index.js +1 -0
  425. package/lib/simple-tree/api/index.js.map +1 -1
  426. package/lib/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
  427. package/lib/simple-tree/api/schemaFromSimple.js +8 -2
  428. package/lib/simple-tree/api/schemaFromSimple.js.map +1 -1
  429. package/lib/simple-tree/api/simpleSchemaCodec.js +5 -7
  430. package/lib/simple-tree/api/simpleSchemaCodec.js.map +1 -1
  431. package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts +103 -0
  432. package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -0
  433. package/lib/simple-tree/api/snapshotCompatibilityChecker.js +122 -0
  434. package/lib/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -0
  435. package/lib/simple-tree/api/tree.d.ts +1 -1
  436. package/lib/simple-tree/api/tree.js +1 -1
  437. package/lib/simple-tree/api/tree.js.map +1 -1
  438. package/lib/simple-tree/core/allowedTypes.js +1 -1
  439. package/lib/simple-tree/core/allowedTypes.js.map +1 -1
  440. package/lib/simple-tree/core/index.d.ts +3 -3
  441. package/lib/simple-tree/core/index.d.ts.map +1 -1
  442. package/lib/simple-tree/core/index.js +2 -2
  443. package/lib/simple-tree/core/index.js.map +1 -1
  444. package/lib/simple-tree/core/toStored.d.ts +12 -5
  445. package/lib/simple-tree/core/toStored.d.ts.map +1 -1
  446. package/lib/simple-tree/core/toStored.js +25 -9
  447. package/lib/simple-tree/core/toStored.js.map +1 -1
  448. package/lib/simple-tree/core/treeNodeSchema.d.ts +1 -6
  449. package/lib/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  450. package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
  451. package/lib/simple-tree/core/treeNodeValid.d.ts +1 -1
  452. package/lib/simple-tree/core/treeNodeValid.d.ts.map +1 -1
  453. package/lib/simple-tree/core/treeNodeValid.js +1 -2
  454. package/lib/simple-tree/core/treeNodeValid.js.map +1 -1
  455. package/lib/simple-tree/fieldSchema.d.ts.map +1 -1
  456. package/lib/simple-tree/fieldSchema.js +2 -9
  457. package/lib/simple-tree/fieldSchema.js.map +1 -1
  458. package/lib/simple-tree/index.d.ts +2 -2
  459. package/lib/simple-tree/index.d.ts.map +1 -1
  460. package/lib/simple-tree/index.js +2 -2
  461. package/lib/simple-tree/index.js.map +1 -1
  462. package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
  463. package/lib/simple-tree/leafNodeSchema.js +1 -2
  464. package/lib/simple-tree/leafNodeSchema.js.map +1 -1
  465. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  466. package/lib/simple-tree/node-kinds/array/arrayNode.js +15 -51
  467. package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  468. package/lib/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
  469. package/lib/simple-tree/node-kinds/map/mapNode.js +3 -7
  470. package/lib/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  471. package/lib/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  472. package/lib/simple-tree/node-kinds/object/objectNode.js +3 -11
  473. package/lib/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  474. package/lib/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
  475. package/lib/simple-tree/node-kinds/record/recordNode.js +3 -7
  476. package/lib/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  477. package/lib/simple-tree/simpleSchema.d.ts +15 -3
  478. package/lib/simple-tree/simpleSchema.d.ts.map +1 -1
  479. package/lib/simple-tree/simpleSchema.js.map +1 -1
  480. package/lib/simple-tree/toStoredSchema.d.ts +20 -8
  481. package/lib/simple-tree/toStoredSchema.d.ts.map +1 -1
  482. package/lib/simple-tree/toStoredSchema.js +28 -24
  483. package/lib/simple-tree/toStoredSchema.js.map +1 -1
  484. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
  485. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js +20 -17
  486. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
  487. package/lib/tableSchema.d.ts +22 -52
  488. package/lib/tableSchema.d.ts.map +1 -1
  489. package/lib/tableSchema.js +143 -279
  490. package/lib/tableSchema.js.map +1 -1
  491. package/lib/util/arrayUtilities.d.ts +45 -0
  492. package/lib/util/arrayUtilities.d.ts.map +1 -0
  493. package/lib/util/arrayUtilities.js +69 -0
  494. package/lib/util/arrayUtilities.js.map +1 -0
  495. package/lib/util/index.d.ts +1 -0
  496. package/lib/util/index.d.ts.map +1 -1
  497. package/lib/util/index.js +1 -0
  498. package/lib/util/index.js.map +1 -1
  499. package/package.json +21 -21
  500. package/src/api.ts +22 -11
  501. package/src/codec/codec.ts +10 -2
  502. package/src/codec/index.ts +1 -0
  503. package/src/codec/versioned/codec.ts +40 -2
  504. package/src/codec/versioned/index.ts +1 -0
  505. package/src/core/schema-stored/schema.ts +12 -1
  506. package/src/core/tree/detachedFieldIndexCodecs.ts +10 -3
  507. package/src/feature-libraries/README.md +1 -1
  508. package/src/feature-libraries/chunked-forest/chunkTree.ts +3 -3
  509. package/src/feature-libraries/chunked-forest/codec/chunkDecoding.ts +5 -0
  510. package/src/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.ts +2 -1
  511. package/src/feature-libraries/chunked-forest/codec/codecs.ts +52 -19
  512. package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +8 -3
  513. package/src/feature-libraries/chunked-forest/codec/format.ts +14 -4
  514. package/src/feature-libraries/chunked-forest/codec/formatGeneric.ts +7 -2
  515. package/src/feature-libraries/chunked-forest/codec/index.ts +1 -4
  516. package/src/feature-libraries/chunked-forest/codec/schemaBasedEncode.ts +62 -9
  517. package/src/feature-libraries/chunked-forest/codec/uncompressedEncode.ts +24 -2
  518. package/src/feature-libraries/chunked-forest/index.ts +1 -1
  519. package/src/feature-libraries/default-schema/defaultFieldKinds.ts +86 -74
  520. package/src/feature-libraries/default-schema/index.ts +1 -9
  521. package/src/feature-libraries/forest-summary/format.ts +15 -9
  522. package/src/feature-libraries/index.ts +7 -5
  523. package/src/feature-libraries/modular-schema/comparison.ts +2 -3
  524. package/src/feature-libraries/modular-schema/fieldKind.ts +90 -13
  525. package/src/feature-libraries/modular-schema/fieldKindConfiguration.ts +2 -3
  526. package/src/feature-libraries/modular-schema/genericFieldKind.ts +6 -6
  527. package/src/feature-libraries/modular-schema/index.ts +0 -1
  528. package/src/feature-libraries/modular-schema/isNeverTree.ts +7 -8
  529. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +13 -13
  530. package/src/feature-libraries/object-forest/objectForest.ts +2 -6
  531. package/src/feature-libraries/optional-field/index.ts +1 -0
  532. package/src/feature-libraries/optional-field/optionalFieldCodecs.ts +1 -5
  533. package/src/feature-libraries/schema-index/codec.ts +10 -3
  534. package/src/feature-libraries/{default-schema/schemaChecker.ts → schemaChecker.ts} +4 -4
  535. package/src/feature-libraries/sequence-field/sequenceFieldCodecs.ts +0 -2
  536. package/src/index.ts +3 -1
  537. package/src/packageVersion.ts +1 -1
  538. package/src/shared-tree/index.ts +0 -1
  539. package/src/shared-tree/sharedTree.ts +0 -70
  540. package/src/shared-tree/sharedTreeChangeCodecs.ts +1 -6
  541. package/src/shared-tree-core/editManagerCodecs.ts +19 -7
  542. package/src/shared-tree-core/editManagerFormatCommons.ts +11 -12
  543. package/src/shared-tree-core/index.ts +6 -2
  544. package/src/shared-tree-core/messageCodecs.ts +32 -17
  545. package/src/shared-tree-core/messageFormat.ts +8 -6
  546. package/src/simple-tree/api/configuration.ts +17 -4
  547. package/src/simple-tree/api/index.ts +5 -0
  548. package/src/simple-tree/api/schemaFromSimple.ts +14 -6
  549. package/src/simple-tree/api/simpleSchemaCodec.ts +10 -9
  550. package/src/simple-tree/api/snapshotCompatibilityChecker.ts +135 -0
  551. package/src/simple-tree/api/tree.ts +1 -1
  552. package/src/simple-tree/core/allowedTypes.ts +1 -1
  553. package/src/simple-tree/core/index.ts +3 -1
  554. package/src/simple-tree/core/toStored.ts +42 -18
  555. package/src/simple-tree/core/treeNodeSchema.ts +1 -7
  556. package/src/simple-tree/core/treeNodeValid.ts +0 -2
  557. package/src/simple-tree/fieldSchema.ts +2 -11
  558. package/src/simple-tree/index.ts +6 -1
  559. package/src/simple-tree/leafNodeSchema.ts +1 -2
  560. package/src/simple-tree/node-kinds/array/arrayNode.ts +26 -75
  561. package/src/simple-tree/node-kinds/map/mapNode.ts +1 -15
  562. package/src/simple-tree/node-kinds/object/objectNode.ts +2 -17
  563. package/src/simple-tree/node-kinds/record/recordNode.ts +1 -15
  564. package/src/simple-tree/simpleSchema.ts +16 -3
  565. package/src/simple-tree/toStoredSchema.ts +54 -38
  566. package/src/simple-tree/unhydratedFlexTreeFromInsertable.ts +22 -17
  567. package/src/tableSchema.ts +110 -334
  568. package/src/util/arrayUtilities.ts +88 -0
  569. package/src/util/index.ts +6 -0
  570. package/dist/feature-libraries/default-schema/defaultSchema.d.ts +0 -10
  571. package/dist/feature-libraries/default-schema/defaultSchema.d.ts.map +0 -1
  572. package/dist/feature-libraries/default-schema/defaultSchema.js +0 -15
  573. package/dist/feature-libraries/default-schema/defaultSchema.js.map +0 -1
  574. package/dist/feature-libraries/default-schema/schemaChecker.d.ts.map +0 -1
  575. package/dist/feature-libraries/default-schema/schemaChecker.js.map +0 -1
  576. package/dist/feature-libraries/modular-schema/fieldKindWithEditor.d.ts +0 -50
  577. package/dist/feature-libraries/modular-schema/fieldKindWithEditor.d.ts.map +0 -1
  578. package/dist/feature-libraries/modular-schema/fieldKindWithEditor.js +0 -76
  579. package/dist/feature-libraries/modular-schema/fieldKindWithEditor.js.map +0 -1
  580. package/dist/feature-libraries/optional-field/optionalFieldCodecV1.d.ts +0 -12
  581. package/dist/feature-libraries/optional-field/optionalFieldCodecV1.d.ts.map +0 -1
  582. package/dist/feature-libraries/optional-field/optionalFieldCodecV1.js +0 -158
  583. package/dist/feature-libraries/optional-field/optionalFieldCodecV1.js.map +0 -1
  584. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts +0 -11
  585. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts.map +0 -1
  586. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js +0 -245
  587. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +0 -1
  588. package/lib/feature-libraries/default-schema/defaultSchema.d.ts +0 -10
  589. package/lib/feature-libraries/default-schema/defaultSchema.d.ts.map +0 -1
  590. package/lib/feature-libraries/default-schema/defaultSchema.js +0 -12
  591. package/lib/feature-libraries/default-schema/defaultSchema.js.map +0 -1
  592. package/lib/feature-libraries/default-schema/schemaChecker.d.ts.map +0 -1
  593. package/lib/feature-libraries/default-schema/schemaChecker.js.map +0 -1
  594. package/lib/feature-libraries/modular-schema/fieldKindWithEditor.d.ts +0 -50
  595. package/lib/feature-libraries/modular-schema/fieldKindWithEditor.d.ts.map +0 -1
  596. package/lib/feature-libraries/modular-schema/fieldKindWithEditor.js +0 -71
  597. package/lib/feature-libraries/modular-schema/fieldKindWithEditor.js.map +0 -1
  598. package/lib/feature-libraries/optional-field/optionalFieldCodecV1.d.ts +0 -12
  599. package/lib/feature-libraries/optional-field/optionalFieldCodecV1.d.ts.map +0 -1
  600. package/lib/feature-libraries/optional-field/optionalFieldCodecV1.js +0 -154
  601. package/lib/feature-libraries/optional-field/optionalFieldCodecV1.js.map +0 -1
  602. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts +0 -11
  603. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts.map +0 -1
  604. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js +0 -241
  605. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +0 -1
  606. package/src/feature-libraries/default-schema/defaultSchema.ts +0 -15
  607. package/src/feature-libraries/modular-schema/fieldKindWithEditor.ts +0 -108
  608. package/src/feature-libraries/optional-field/optionalFieldCodecV1.ts +0 -208
  609. package/src/feature-libraries/sequence-field/sequenceFieldCodecV1.ts +0 -344
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/tree",
3
- "version": "2.72.0",
3
+ "version": "2.73.0",
4
4
  "description": "Distributed tree",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -101,17 +101,17 @@
101
101
  "temp-directory": "nyc/.nyc_output"
102
102
  },
103
103
  "dependencies": {
104
- "@fluid-internal/client-utils": "~2.72.0",
105
- "@fluidframework/container-runtime": "~2.72.0",
106
- "@fluidframework/core-interfaces": "~2.72.0",
107
- "@fluidframework/core-utils": "~2.72.0",
108
- "@fluidframework/datastore-definitions": "~2.72.0",
109
- "@fluidframework/driver-definitions": "~2.72.0",
110
- "@fluidframework/id-compressor": "~2.72.0",
111
- "@fluidframework/runtime-definitions": "~2.72.0",
112
- "@fluidframework/runtime-utils": "~2.72.0",
113
- "@fluidframework/shared-object-base": "~2.72.0",
114
- "@fluidframework/telemetry-utils": "~2.72.0",
104
+ "@fluid-internal/client-utils": "~2.73.0",
105
+ "@fluidframework/container-runtime": "~2.73.0",
106
+ "@fluidframework/core-interfaces": "~2.73.0",
107
+ "@fluidframework/core-utils": "~2.73.0",
108
+ "@fluidframework/datastore-definitions": "~2.73.0",
109
+ "@fluidframework/driver-definitions": "~2.73.0",
110
+ "@fluidframework/id-compressor": "~2.73.0",
111
+ "@fluidframework/runtime-definitions": "~2.73.0",
112
+ "@fluidframework/runtime-utils": "~2.73.0",
113
+ "@fluidframework/shared-object-base": "~2.73.0",
114
+ "@fluidframework/telemetry-utils": "~2.73.0",
115
115
  "@sinclair/typebox": "^0.34.13",
116
116
  "@tylerbu/sorted-btree-es6": "^1.8.0",
117
117
  "@types/ungap__structured-clone": "^1.2.0",
@@ -122,19 +122,19 @@
122
122
  "devDependencies": {
123
123
  "@arethetypeswrong/cli": "^0.17.1",
124
124
  "@biomejs/biome": "~1.9.3",
125
- "@fluid-internal/mocha-test-setup": "~2.72.0",
126
- "@fluid-private/stochastic-test-utils": "~2.72.0",
127
- "@fluid-private/test-dds-utils": "~2.72.0",
128
- "@fluid-private/test-drivers": "~2.72.0",
125
+ "@fluid-internal/mocha-test-setup": "~2.73.0",
126
+ "@fluid-private/stochastic-test-utils": "~2.73.0",
127
+ "@fluid-private/test-dds-utils": "~2.73.0",
128
+ "@fluid-private/test-drivers": "~2.73.0",
129
129
  "@fluid-tools/benchmark": "^0.51.0",
130
130
  "@fluid-tools/build-cli": "^0.60.0",
131
131
  "@fluidframework/build-common": "^2.0.3",
132
132
  "@fluidframework/build-tools": "^0.60.0",
133
- "@fluidframework/container-definitions": "~2.72.0",
134
- "@fluidframework/container-loader": "~2.72.0",
135
- "@fluidframework/eslint-config-fluid": "~2.72.0",
136
- "@fluidframework/test-runtime-utils": "~2.72.0",
137
- "@fluidframework/test-utils": "~2.72.0",
133
+ "@fluidframework/container-definitions": "~2.73.0",
134
+ "@fluidframework/container-loader": "~2.73.0",
135
+ "@fluidframework/eslint-config-fluid": "~2.73.0",
136
+ "@fluidframework/test-runtime-utils": "~2.73.0",
137
+ "@fluidframework/test-utils": "~2.73.0",
138
138
  "@fluidframework/tree-previous": "npm:@fluidframework/tree@2.71.0",
139
139
  "@microsoft/api-extractor": "7.52.11",
140
140
  "@types/diff": "^3.5.1",
package/src/api.ts CHANGED
@@ -3,19 +3,18 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import {
7
- type TreeView,
8
- type TreeViewAlpha,
9
- type TreeViewBeta,
10
- type ImplicitFieldSchema,
11
- // eslint-disable-next-line import-x/no-deprecated
12
- asTreeViewAlpha,
6
+ import type {
7
+ TreeView,
8
+ TreeViewAlpha,
9
+ TreeViewBeta,
10
+ ImplicitFieldSchema,
11
+ TreeViewConfiguration,
12
+ TreeViewConfigurationAlpha,
13
13
  } from "./simple-tree/index.js";
14
14
 
15
15
  /**
16
16
  * Module entry points for retrieving alternate (alpha/beta) versions of tree APIs.
17
17
  * For each API (usually a class) that has an alpha/beta version, add overloads to the function(s) below.
18
- * In the future, `asBeta` may be added here too.
19
18
  * These functions should only be used by external consumers, not referenced internally within the tree package, to avoid circular import dependencies.
20
19
  */
21
20
 
@@ -25,9 +24,21 @@ import {
25
24
  */
26
25
  export function asAlpha<TSchema extends ImplicitFieldSchema>(
27
26
  view: TreeView<TSchema>,
28
- ): TreeViewAlpha<TSchema> {
29
- // eslint-disable-next-line import-x/no-deprecated
30
- return asTreeViewAlpha(view);
27
+ ): TreeViewAlpha<TSchema>;
28
+
29
+ /**
30
+ * Retrieve the {@link TreeViewConfigurationAlpha | alpha API} for a {@link TreeViewConfiguration}.
31
+ * @alpha
32
+ */
33
+ export function asAlpha<TSchema extends ImplicitFieldSchema>(
34
+ view: TreeViewConfiguration<TSchema>,
35
+ ): TreeViewConfigurationAlpha<TSchema>;
36
+
37
+ /**
38
+ * Implementation of overloads for {@link asAlpha}.
39
+ */
40
+ export function asAlpha(view: unknown): unknown {
41
+ return view;
31
42
  }
32
43
 
33
44
  /**
@@ -501,7 +501,7 @@ export const FluidClientVersion = {
501
501
 
502
502
  /**
503
503
  * Fluid Framework Client 2.43 and newer.
504
- *
504
+ * @remarks
505
505
  * New formats introduced in 2.43:
506
506
  * - SchemaFormatVersion.v2
507
507
  * - MessageFormatVersion.v4
@@ -512,11 +512,19 @@ export const FluidClientVersion = {
512
512
 
513
513
  /**
514
514
  * Fluid Framework Client 2.52 and newer.
515
- *
515
+ * @remarks
516
516
  * New formats introduced in 2.52:
517
517
  * - DetachedFieldIndexFormatVersion.v2
518
518
  */
519
519
  v2_52: "2.52.0",
520
+
521
+ /**
522
+ * Fluid Framework Client 2.73 and newer.
523
+ * @remarks
524
+ * New formats introduced in 2.73:
525
+ * - FieldBatchFormatVersion v2
526
+ */
527
+ v2_73: "2.73.0",
520
528
  } as const satisfies Record<string, MinimumVersionForCollab>;
521
529
 
522
530
  /**
@@ -39,4 +39,5 @@ export {
39
39
  makeVersionedCodec,
40
40
  makeVersionedValidatedCodec,
41
41
  makeVersionDispatchingCodec,
42
+ makeDiscontinuedCodecVersion,
42
43
  } from "./versioned/index.js";
@@ -5,7 +5,8 @@
5
5
 
6
6
  import { assert } from "@fluidframework/core-utils/internal";
7
7
  import { UsageError } from "@fluidframework/telemetry-utils/internal";
8
- import type { TSchema } from "@sinclair/typebox";
8
+ import type { SemanticVersion } from "@fluidframework/runtime-utils/internal";
9
+ import { Type, type TSchema } from "@sinclair/typebox";
9
10
 
10
11
  import type { JsonCompatibleReadOnly } from "../../util/index.js";
11
12
  import {
@@ -66,7 +67,7 @@ export function makeVersionedValidatedCodec<
66
67
  TContext = void,
67
68
  >(
68
69
  options: ICodecOptions,
69
- supportedVersions: Set<number>,
70
+ supportedVersions: Set<FormatVersion>,
70
71
  schema: EncodedSchema,
71
72
  codec: IJsonCodec<TDecoded, TEncoded, TValidate, TContext>,
72
73
  ): IJsonCodec<TDecoded, TEncoded, TValidate, TContext> {
@@ -77,6 +78,43 @@ export function makeVersionedValidatedCodec<
77
78
  );
78
79
  }
79
80
 
81
+ /**
82
+ * Creates a codec which always throws a UsageError when encoding or decoding, indicating that the format version is discontinued.
83
+ */
84
+ export function makeDiscontinuedCodecVersion<
85
+ TDecoded,
86
+ TEncoded extends Versioned = JsonCompatibleReadOnly & Versioned,
87
+ TContext = unknown,
88
+ >(
89
+ options: ICodecOptions,
90
+ discontinuedVersion: FormatVersion,
91
+ discontinuedSince: SemanticVersion,
92
+ ): IJsonCodec<TDecoded, TEncoded, TEncoded, TContext> {
93
+ const schema = Type.Object(
94
+ {
95
+ version:
96
+ discontinuedVersion === undefined
97
+ ? Type.Undefined()
98
+ : Type.Literal(discontinuedVersion),
99
+ },
100
+ // Using `additionalProperties: true` allows this schema to be used when loading data encoded by older versions even though they contain additional properties.
101
+ { additionalProperties: true },
102
+ );
103
+ const codec: IJsonCodec<TDecoded, TEncoded, TEncoded, TContext> = {
104
+ encode: (_: TDecoded): TEncoded => {
105
+ throw new UsageError(
106
+ `Cannot encode data to format ${discontinuedVersion}. The codec was discontinued in FF version ${discontinuedSince}.`,
107
+ );
108
+ },
109
+ decode: (data: TEncoded): TDecoded => {
110
+ throw new UsageError(
111
+ `Cannot decode data to format ${data.version}. The codec was discontinued in FF version ${discontinuedSince}.`,
112
+ );
113
+ },
114
+ };
115
+ return makeVersionedValidatedCodec(options, new Set([discontinuedVersion]), schema, codec);
116
+ }
117
+
80
118
  /**
81
119
  * Creates a codec which dispatches to the appropriate member of a codec family based on the version of
82
120
  * data it encounters.
@@ -8,4 +8,5 @@ export {
8
8
  makeVersionedCodec,
9
9
  makeVersionedValidatedCodec,
10
10
  makeVersionDispatchingCodec,
11
+ makeDiscontinuedCodecVersion,
11
12
  } from "./codec.js";
@@ -91,13 +91,24 @@ export enum ValueSchema {
91
91
  export type TreeTypeSet = ReadonlySet<TreeNodeSchemaIdentifier>;
92
92
 
93
93
  /**
94
- * Declarative portion of a Field Kind.
94
+ * Declarative portion of a {@link FlexFieldKind}.
95
95
  *
96
96
  * @remarks
97
97
  * Enough info about a field kind to know if a given tree is is schema.
98
+ *
99
+ * Note that compatibility between trees and schema is not sufficient to evaluate if a schema upgrade should be allowed.
100
+ * Currently schema upgrades are restricted to field kind changes which can not be cyclic (like version upgrades but not down grades).
101
+ * See {@link FlexFieldKind.allowsFieldSuperset} for more details.
98
102
  */
99
103
  export interface FieldKindData {
104
+ /**
105
+ * Globally scoped identifier.
106
+ */
100
107
  readonly identifier: FieldKindIdentifier;
108
+ /**
109
+ * Bound on the number of children that fields of this kind may have.
110
+ * TODO: consider replacing this with numeric upper and lower bounds.
111
+ */
101
112
  readonly multiplicity: Multiplicity;
102
113
  }
103
114
 
@@ -5,6 +5,10 @@
5
5
 
6
6
  import type { IIdCompressor } from "@fluidframework/id-compressor";
7
7
  import type { MinimumVersionForCollab } from "@fluidframework/runtime-definitions/internal";
8
+ import {
9
+ getConfigForMinVersionForCollab,
10
+ lowestMinVersionForCollab,
11
+ } from "@fluidframework/runtime-utils/internal";
8
12
 
9
13
  import {
10
14
  type CodecTree,
@@ -31,9 +35,12 @@ import { brand } from "../../util/index.js";
31
35
  function clientVersionToDetachedFieldVersion(
32
36
  clientVersion: MinimumVersionForCollab,
33
37
  ): DetachedFieldIndexFormatVersion {
34
- return clientVersion < FluidClientVersion.v2_52
35
- ? brand(DetachedFieldIndexFormatVersion.v1)
36
- : brand(DetachedFieldIndexFormatVersion.v2);
38
+ return brand(
39
+ getConfigForMinVersionForCollab(clientVersion, {
40
+ [lowestMinVersionForCollab]: DetachedFieldIndexFormatVersion.v1,
41
+ [FluidClientVersion.v2_52]: DetachedFieldIndexFormatVersion.v2,
42
+ }),
43
+ );
37
44
  }
38
45
 
39
46
  export function makeDetachedFieldIndexCodec(
@@ -2,7 +2,7 @@
2
2
 
3
3
  Libraries which plug into the [Core Libraries](../core/README.md) to provide specializations, either for performance, or compatibility with specific tools or use-cases.
4
4
 
5
- This includes concrete implementations of abstractions used to parameterize `SharedTreeCore` (Like `Index` and `ChangeFamily`), or any other entry points to the `core` libraries] package (like `Forest`).
5
+ This includes concrete implementations of abstractions used to parameterize `SharedTreeCore` (Like `Index` and `ChangeFamily`), or any other entry points to the `core` libraries package (like `Forest`).
6
6
 
7
7
  `SharedTreeCore` should be usable with alternative versions of anything within this library.
8
8
 
@@ -23,9 +23,9 @@ import {
23
23
  type TreeChunk,
24
24
  tryGetChunk,
25
25
  type SchemaAndPolicy,
26
+ type SchemaPolicy,
26
27
  } from "../../core/index.js";
27
28
  import { getOrCreate } from "../../util/index.js";
28
- import type { FullSchemaPolicy } from "../modular-schema/index.js";
29
29
  import { isStableNodeIdentifier } from "../node-identifier/index.js";
30
30
 
31
31
  import { BasicChunk } from "./basicChunk.js";
@@ -44,7 +44,7 @@ export interface Disposable {
44
44
  */
45
45
  export function makeTreeChunker(
46
46
  schema: TreeStoredSchemaSubscription,
47
- policy: FullSchemaPolicy,
47
+ policy: SchemaPolicy,
48
48
  shouldEncodeIncrementally: IncrementalEncodingPolicy,
49
49
  ): IChunker {
50
50
  return new Chunker(
@@ -113,7 +113,7 @@ export class Chunker implements IChunker {
113
113
 
114
114
  public constructor(
115
115
  public readonly schema: TreeStoredSchemaSubscription,
116
- public readonly policy: FullSchemaPolicy,
116
+ public readonly policy: SchemaPolicy,
117
117
  public readonly sequenceChunkSplitThreshold: number,
118
118
  public readonly sequenceChunkInlineThreshold: number,
119
119
  public readonly uniformChunkNodeCount: number,
@@ -46,6 +46,7 @@ import {
46
46
  type EncodedNestedArrayShape,
47
47
  type EncodedNodeShape,
48
48
  type EncodedValueShape,
49
+ FieldBatchFormatVersion,
49
50
  SpecialField,
50
51
  } from "./format.js";
51
52
  import type { IncrementalDecoder } from "./codecs.js";
@@ -246,6 +247,10 @@ export class IncrementalChunkDecoder implements ChunkDecoder {
246
247
  );
247
248
 
248
249
  const chunkDecoder = (batch: EncodedFieldBatch): TreeChunk => {
250
+ assert(
251
+ batch.version >= FieldBatchFormatVersion.v2,
252
+ 0xc9f /* Unsupported FieldBatchFormatVersion for incremental chunks; must be v2 or higher */,
253
+ );
249
254
  const context = new DecoderContext(
250
255
  batch.identifiers,
251
256
  batch.shapes,
@@ -15,6 +15,7 @@ import {
15
15
  jsonMinimizingFilter,
16
16
  } from "./chunkCodecUtilities.js";
17
17
  import type { EncodedFieldBatchGeneric } from "./formatGeneric.js";
18
+ import type { FieldBatchFormatVersion } from "./format.js";
18
19
 
19
20
  /**
20
21
  * An identifier which can be compressed using {@link Counter}.
@@ -51,7 +52,7 @@ export type BufferFormat<TEncodedShape> = (
51
52
  * Note that this modifies `buffer` to avoid having to copy it.
52
53
  */
53
54
  export function updateShapesAndIdentifiersEncoding<TEncodedShape>(
54
- version: number,
55
+ version: FieldBatchFormatVersion,
55
56
  buffer: BufferFormat<TEncodedShape>[],
56
57
  identifierFilter: CounterFilter<string> = jsonMinimizingFilter,
57
58
  ): EncodedFieldBatchGeneric<TEncodedShape> {
@@ -5,10 +5,15 @@
5
5
 
6
6
  import { assert, unreachableCase } from "@fluidframework/core-utils/internal";
7
7
  import type { IIdCompressor, SessionId } from "@fluidframework/id-compressor";
8
+ import {
9
+ getConfigForMinVersionForCollab,
10
+ lowestMinVersionForCollab,
11
+ } from "@fluidframework/runtime-utils/internal";
8
12
 
9
13
  import {
10
14
  type CodecTree,
11
15
  type CodecWriteOptions,
16
+ FluidClientVersion,
12
17
  type IJsonCodec,
13
18
  makeVersionedValidatedCodec,
14
19
  } from "../../../codec/index.js";
@@ -32,11 +37,17 @@ import {
32
37
 
33
38
  import { decode } from "./chunkDecoding.js";
34
39
  import type { FieldBatch } from "./fieldBatch.js";
35
- import { EncodedFieldBatch, validVersions, FieldBatchFormatVersion } from "./format.js";
36
- import { schemaCompressedEncode } from "./schemaBasedEncode.js";
37
- import { uncompressedEncode } from "./uncompressedEncode.js";
40
+ import {
41
+ type EncodedFieldBatch,
42
+ validVersions,
43
+ FieldBatchFormatVersion,
44
+ EncodedFieldBatchV1,
45
+ EncodedFieldBatchV2,
46
+ } from "./format.js";
38
47
  import type { MinimumVersionForCollab } from "@fluidframework/runtime-definitions/internal";
39
48
  import type { IncrementalEncodingPolicy } from "./incrementalEncodingPolicy.js";
49
+ import { uncompressedEncodeV1, uncompressedEncodeV2 } from "./uncompressedEncode.js";
50
+ import { schemaCompressedEncodeV1, schemaCompressedEncodeV2 } from "./schemaBasedEncode.js";
40
51
 
41
52
  /**
42
53
  * Reference ID for a chunk that is incrementally encoded.
@@ -119,11 +130,6 @@ export type FieldBatchCodec = IJsonCodec<
119
130
  FieldBatchEncodingContext
120
131
  >;
121
132
 
122
- /**
123
- * Get the write version for {@link makeFieldBatchCodec} based on the `minVersionForCollab` version.
124
- * @privateRemarks
125
- * TODO: makeFieldBatchCodec (and makeVersionDispatchingCodec transitively) should bake in this versionToFormat logic and the resulting codec can then support use with FluidClientVersion directly.
126
- */
127
133
  /**
128
134
  * Convert a MinimumVersionForCollab to write version for {@link FieldBatchCodec}.
129
135
  * @param clientVersion - The MinimumVersionForCollab to convert.
@@ -131,8 +137,12 @@ export type FieldBatchCodec = IJsonCodec<
131
137
  function clientVersionToFieldBatchVersion(
132
138
  clientVersion: MinimumVersionForCollab,
133
139
  ): FieldBatchFormatVersion {
134
- // Currently, field batch codec only writes in version 1.
135
- return brand(FieldBatchFormatVersion.v1);
140
+ return brand(
141
+ getConfigForMinVersionForCollab(clientVersion, {
142
+ [lowestMinVersionForCollab]: FieldBatchFormatVersion.v1,
143
+ [FluidClientVersion.v2_73]: FieldBatchFormatVersion.v2,
144
+ }),
145
+ );
136
146
  }
137
147
 
138
148
  export function makeFieldBatchCodec(options: CodecWriteOptions): FieldBatchCodec {
@@ -146,8 +156,27 @@ export function makeFieldBatchCodec(options: CodecWriteOptions): FieldBatchCodec
146
156
  0x935 /* Invalid write version for FieldBatch codec */,
147
157
  );
148
158
 
149
- // TODO: use makeVersionDispatchingCodec to support adding more versions in the future.
150
- return makeVersionedValidatedCodec(options, validVersions, EncodedFieldBatch, {
159
+ let uncompressedEncodeFn: typeof uncompressedEncodeV1 | typeof uncompressedEncodeV2;
160
+ let schemaCompressedEncodeFn:
161
+ | typeof schemaCompressedEncodeV1
162
+ | typeof schemaCompressedEncodeV2;
163
+ let encodedFieldBatchType: typeof EncodedFieldBatchV1 | typeof EncodedFieldBatchV2;
164
+ switch (writeVersion) {
165
+ case FieldBatchFormatVersion.v1:
166
+ uncompressedEncodeFn = uncompressedEncodeV1;
167
+ schemaCompressedEncodeFn = schemaCompressedEncodeV1;
168
+ encodedFieldBatchType = EncodedFieldBatchV1;
169
+ break;
170
+ case FieldBatchFormatVersion.v2:
171
+ uncompressedEncodeFn = uncompressedEncodeV2;
172
+ schemaCompressedEncodeFn = schemaCompressedEncodeV2;
173
+ encodedFieldBatchType = EncodedFieldBatchV2;
174
+ break;
175
+ default:
176
+ unreachableCase(writeVersion);
177
+ }
178
+
179
+ return makeVersionedValidatedCodec(options, validVersions, encodedFieldBatchType, {
151
180
  encode: (data: FieldBatch, context: FieldBatchEncodingContext): EncodedFieldBatch => {
152
181
  for (const cursor of data) {
153
182
  assert(
@@ -156,27 +185,31 @@ export function makeFieldBatchCodec(options: CodecWriteOptions): FieldBatchCodec
156
185
  );
157
186
  }
158
187
  let encoded: EncodedFieldBatch;
188
+ let incrementalEncoder: IncrementalEncoder | undefined;
159
189
  switch (context.encodeType) {
160
190
  case TreeCompressionStrategy.Uncompressed:
161
- encoded = uncompressedEncode(data);
191
+ encoded = uncompressedEncodeFn(data);
162
192
  break;
163
193
  case TreeCompressionStrategyExtended.CompressedIncremental:
194
+ assert(
195
+ writeVersion >= FieldBatchFormatVersion.v2,
196
+ 0xca0 /* Unsupported FieldBatchFormatVersion for incremental encoding; must be v2 or higher */,
197
+ );
198
+ // Incremental encoding is only supported for CompressedIncremental.
199
+ incrementalEncoder = context.incrementalEncoderDecoder;
164
200
  case TreeCompressionStrategy.Compressed:
165
201
  // eslint-disable-next-line unicorn/prefer-ternary
166
202
  if (context.schema !== undefined) {
167
- encoded = schemaCompressedEncode(
203
+ encoded = schemaCompressedEncodeFn(
168
204
  context.schema.schema,
169
205
  context.schema.policy,
170
206
  data,
171
207
  context.idCompressor,
172
- // Incremental encoding is only supported for CompressedIncremental.
173
- context.encodeType === TreeCompressionStrategyExtended.CompressedIncremental
174
- ? context.incrementalEncoderDecoder
175
- : undefined,
208
+ incrementalEncoder,
176
209
  );
177
210
  } else {
178
211
  // TODO: consider enabling a somewhat compressed but not schema accelerated encode.
179
- encoded = uncompressedEncode(data);
212
+ encoded = uncompressedEncodeFn(data);
180
213
  }
181
214
 
182
215
  break;
@@ -9,6 +9,7 @@ import type { IIdCompressor } from "@fluidframework/id-compressor";
9
9
  import {
10
10
  CursorLocationType,
11
11
  type FieldKey,
12
+ type FieldKindData,
12
13
  type FieldKindIdentifier,
13
14
  type ITreeCursorSynchronous,
14
15
  type TreeChunk,
@@ -18,7 +19,6 @@ import {
18
19
  forEachNode,
19
20
  } from "../../../core/index.js";
20
21
  import { getOrCreate } from "../../../util/index.js";
21
- import type { FlexFieldKind } from "../../modular-schema/index.js";
22
22
 
23
23
  import type { Counter, DeduplicationTable } from "./chunkCodecUtilities.js";
24
24
  import {
@@ -57,7 +57,7 @@ export function compressedEncode(
57
57
  anyFieldEncoder.encodeField(cursor, context, buffer);
58
58
  batchBuffer.push(buffer);
59
59
  }
60
- return updateShapesAndIdentifiersEncoding(FieldBatchFormatVersion.v1, batchBuffer);
60
+ return updateShapesAndIdentifiersEncoding(context.version, batchBuffer);
61
61
  }
62
62
 
63
63
  export type BufferFormat = BufferFormatGeneric<EncodedChunkShape>;
@@ -458,6 +458,10 @@ export const incrementalFieldEncoder: FieldEncoder = {
458
458
  context.incrementalEncoder !== undefined,
459
459
  0xc88 /* incremental encoder must be defined to use incrementalFieldEncoder */,
460
460
  );
461
+ assert(
462
+ context.version >= FieldBatchFormatVersion.v2,
463
+ 0xca1 /* Unsupported FieldBatchFormatVersion for incremental encoding; must be v2 or higher */,
464
+ );
461
465
 
462
466
  const chunkReferenceIds = context.incrementalEncoder.encodeIncrementalField(
463
467
  cursor,
@@ -519,7 +523,7 @@ export class EncoderContext implements NodeEncodeBuilder, FieldEncodeBuilder {
519
523
  public constructor(
520
524
  private readonly nodeEncoderFromPolicy: NodeEncoderPolicy,
521
525
  private readonly fieldEncoderFromPolicy: FieldEncoderPolicy,
522
- public readonly fieldShapes: ReadonlyMap<FieldKindIdentifier, FlexFieldKind>,
526
+ public readonly fieldShapes: ReadonlyMap<FieldKindIdentifier, FieldKindData>,
523
527
  public readonly idCompressor: IIdCompressor,
524
528
  /**
525
529
  * To be used to encode incremental chunks, if any.
@@ -527,6 +531,7 @@ export class EncoderContext implements NodeEncodeBuilder, FieldEncodeBuilder {
527
531
  * See {@link IncrementalEncoder} for more information.
528
532
  */
529
533
  public readonly incrementalEncoder: IncrementalEncoder | undefined,
534
+ public readonly version: FieldBatchFormatVersion,
530
535
  ) {}
531
536
 
532
537
  public nodeEncoderFromSchema(schemaName: TreeNodeSchemaIdentifier): NodeEncoder {
@@ -13,13 +13,14 @@ import {
13
13
  IdentifierOrIndex,
14
14
  ShapeIndex,
15
15
  } from "./formatGeneric.js";
16
- import type { Brand } from "../../../util/index.js";
16
+ import { brand, type Brand } from "../../../util/index.js";
17
17
 
18
18
  /**
19
19
  * The format version for the field batch.
20
20
  */
21
21
  export const FieldBatchFormatVersion = {
22
22
  v1: 1,
23
+ v2: 2,
23
24
  } as const;
24
25
  export type FieldBatchFormatVersion = Brand<
25
26
  (typeof FieldBatchFormatVersion)[keyof typeof FieldBatchFormatVersion],
@@ -28,7 +29,7 @@ export type FieldBatchFormatVersion = Brand<
28
29
 
29
30
  // Compatible versions used for format/version validation.
30
31
  // TODO: A proper version update policy will need to be documented.
31
- export const validVersions = new Set([FieldBatchFormatVersion.v1]);
32
+ export const validVersions = new Set([...Object.values(FieldBatchFormatVersion)]);
32
33
 
33
34
  /**
34
35
  * Top level length is implied from length of data array.
@@ -217,8 +218,17 @@ export type EncodedNodeShape = Static<typeof EncodedNodeShape>;
217
218
  export type EncodedAnyShape = Static<typeof EncodedAnyShape>;
218
219
  export type EncodedIncrementalChunkShape = Static<typeof EncodedIncrementalChunkShape>;
219
220
 
220
- export const EncodedFieldBatch = EncodedFieldBatchGeneric(
221
- FieldBatchFormatVersion.v1,
221
+ export const EncodedFieldBatchV1 = EncodedFieldBatchGeneric(
222
+ brand<FieldBatchFormatVersion>(FieldBatchFormatVersion.v1),
222
223
  EncodedChunkShape,
223
224
  );
225
+ export type EncodedFieldBatchV1 = Static<typeof EncodedFieldBatchV1>;
226
+
227
+ export const EncodedFieldBatchV2 = EncodedFieldBatchGeneric(
228
+ brand<FieldBatchFormatVersion>(FieldBatchFormatVersion.v2),
229
+ EncodedChunkShape,
230
+ );
231
+ export type EncodedFieldBatchV2 = Static<typeof EncodedFieldBatchV2>;
232
+
233
+ export const EncodedFieldBatch = Type.Union([EncodedFieldBatchV1, EncodedFieldBatchV2]);
224
234
  export type EncodedFieldBatch = Static<typeof EncodedFieldBatch>;
@@ -4,6 +4,7 @@
4
4
  */
5
5
 
6
6
  import { type Static, type TSchema, Type } from "@sinclair/typebox";
7
+ import type { FieldBatchFormatVersion } from "./format.js";
7
8
 
8
9
  /**
9
10
  * Identifier OR Index of an identifier in the identifier list.
@@ -39,11 +40,14 @@ const EncodedFieldBatchBase = Type.Object(
39
40
 
40
41
  /**
41
42
  * Format for encoding a tree chunk.
42
- * @param version - format version. Must be changed if there is any change to the generic schema, or the `shape` schema.
43
+ * @param version - format version.
44
+ * Must be changed if the previously existing decode logic will not correctly handle the new encoding.
45
+ * If adding a new encoding version which does not use this format,
46
+ * this parameter should be retyped to be a union of the subset of FieldBatchFormatVersion values which this supports.
43
47
  * @param shape - schema for union of shape format, see {@link DiscriminatedUnionDispatcher}.
44
48
  */
45
49
  export const EncodedFieldBatchGeneric = <TShapeSchema extends TSchema>(
46
- version: number,
50
+ version: FieldBatchFormatVersion,
47
51
  shape: TShapeSchema,
48
52
  // Return type is intentionally derived.
49
53
  // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
@@ -62,4 +66,5 @@ export const EncodedFieldBatchGeneric = <TShapeSchema extends TSchema>(
62
66
  export interface EncodedFieldBatchGeneric<TEncodedShape>
63
67
  extends Static<typeof EncodedFieldBatchBase> {
64
68
  shapes: TEncodedShape[];
69
+ version: FieldBatchFormatVersion;
65
70
  }
@@ -3,10 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- export {
7
- EncodedFieldBatch,
8
- type FieldBatchFormatVersion,
9
- } from "./format.js";
6
+ export { EncodedFieldBatch, FieldBatchFormatVersion } from "./format.js";
10
7
  export type { FieldBatch } from "./fieldBatch.js";
11
8
  export {
12
9
  type FieldBatchCodec,