@fluidframework/tree 2.72.0 → 2.74.0-365691

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 (696) hide show
  1. package/CHANGELOG.md +99 -0
  2. package/api-report/tree.alpha.api.md +32 -31
  3. package/dist/alpha.d.ts +7 -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 +3 -3
  40. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  41. package/dist/feature-libraries/chunked-forest/codec/codecs.js +32 -18
  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/incrementalEncodingPolicy.d.ts +2 -2
  56. package/dist/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.d.ts.map +1 -1
  57. package/dist/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.js.map +1 -1
  58. package/dist/feature-libraries/chunked-forest/codec/index.d.ts +1 -1
  59. package/dist/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
  60. package/dist/feature-libraries/chunked-forest/codec/index.js +2 -1
  61. package/dist/feature-libraries/chunked-forest/codec/index.js.map +1 -1
  62. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts +13 -13
  63. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -1
  64. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +23 -6
  65. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
  66. package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.d.ts +9 -8
  67. package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.d.ts.map +1 -1
  68. package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.js +20 -4
  69. package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.js.map +1 -1
  70. package/dist/feature-libraries/chunked-forest/index.d.ts +1 -1
  71. package/dist/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  72. package/dist/feature-libraries/chunked-forest/index.js +2 -1
  73. package/dist/feature-libraries/chunked-forest/index.js.map +1 -1
  74. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts +35 -17
  75. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  76. package/dist/feature-libraries/default-schema/defaultFieldKinds.js +53 -55
  77. package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  78. package/dist/feature-libraries/default-schema/index.d.ts +1 -3
  79. package/dist/feature-libraries/default-schema/index.d.ts.map +1 -1
  80. package/dist/feature-libraries/default-schema/index.js +2 -8
  81. package/dist/feature-libraries/default-schema/index.js.map +1 -1
  82. package/dist/feature-libraries/forest-summary/forestSummarizer.js +1 -1
  83. package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  84. package/dist/feature-libraries/forest-summary/format.d.ts +2 -2
  85. package/dist/feature-libraries/forest-summary/format.d.ts.map +1 -1
  86. package/dist/feature-libraries/forest-summary/format.js +4 -2
  87. package/dist/feature-libraries/forest-summary/format.js.map +1 -1
  88. package/dist/feature-libraries/index.d.ts +5 -4
  89. package/dist/feature-libraries/index.d.ts.map +1 -1
  90. package/dist/feature-libraries/index.js +8 -8
  91. package/dist/feature-libraries/index.js.map +1 -1
  92. package/dist/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
  93. package/dist/feature-libraries/modular-schema/comparison.js +1 -2
  94. package/dist/feature-libraries/modular-schema/comparison.js.map +1 -1
  95. package/dist/feature-libraries/modular-schema/fieldKind.d.ts +38 -12
  96. package/dist/feature-libraries/modular-schema/fieldKind.d.ts.map +1 -1
  97. package/dist/feature-libraries/modular-schema/fieldKind.js +29 -11
  98. package/dist/feature-libraries/modular-schema/fieldKind.js.map +1 -1
  99. package/dist/feature-libraries/modular-schema/fieldKindConfiguration.d.ts +2 -2
  100. package/dist/feature-libraries/modular-schema/fieldKindConfiguration.d.ts.map +1 -1
  101. package/dist/feature-libraries/modular-schema/fieldKindConfiguration.js.map +1 -1
  102. package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts +2 -2
  103. package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  104. package/dist/feature-libraries/modular-schema/genericFieldKind.js +3 -2
  105. package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  106. package/dist/feature-libraries/modular-schema/index.d.ts +0 -1
  107. package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
  108. package/dist/feature-libraries/modular-schema/index.js +1 -3
  109. package/dist/feature-libraries/modular-schema/index.js.map +1 -1
  110. package/dist/feature-libraries/modular-schema/isNeverTree.d.ts +5 -6
  111. package/dist/feature-libraries/modular-schema/isNeverTree.d.ts.map +1 -1
  112. package/dist/feature-libraries/modular-schema/isNeverTree.js.map +1 -1
  113. package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts +2 -2
  114. package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  115. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  116. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +8 -8
  117. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  118. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +1 -2
  119. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  120. package/dist/feature-libraries/modular-schema/modularChangeFormat.d.ts +66 -9
  121. package/dist/feature-libraries/modular-schema/modularChangeFormat.d.ts.map +1 -1
  122. package/dist/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  123. package/dist/feature-libraries/object-forest/objectForest.js +3 -2
  124. package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
  125. package/dist/feature-libraries/optional-field/index.d.ts +1 -1
  126. package/dist/feature-libraries/optional-field/index.d.ts.map +1 -1
  127. package/dist/feature-libraries/optional-field/index.js.map +1 -1
  128. package/dist/feature-libraries/optional-field/optionalFieldCodecs.d.ts.map +1 -1
  129. package/dist/feature-libraries/optional-field/optionalFieldCodecs.js +1 -5
  130. package/dist/feature-libraries/optional-field/optionalFieldCodecs.js.map +1 -1
  131. package/dist/feature-libraries/schema-index/codec.d.ts.map +1 -1
  132. package/dist/feature-libraries/schema-index/codec.js +5 -3
  133. package/dist/feature-libraries/schema-index/codec.js.map +1 -1
  134. package/dist/feature-libraries/{default-schema/schemaChecker.d.ts → schemaChecker.d.ts} +2 -2
  135. package/dist/feature-libraries/schemaChecker.d.ts.map +1 -0
  136. package/dist/feature-libraries/{default-schema/schemaChecker.js → schemaChecker.js} +3 -3
  137. package/dist/feature-libraries/schemaChecker.js.map +1 -0
  138. package/dist/feature-libraries/sequence-field/formatV2.d.ts.map +1 -1
  139. package/dist/feature-libraries/sequence-field/formatV2.js +1 -0
  140. package/dist/feature-libraries/sequence-field/formatV2.js.map +1 -1
  141. package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts.map +1 -1
  142. package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.js +0 -2
  143. package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.js.map +1 -1
  144. package/dist/feature-libraries/treeCompressionUtils.d.ts +2 -12
  145. package/dist/feature-libraries/treeCompressionUtils.d.ts.map +1 -1
  146. package/dist/feature-libraries/treeCompressionUtils.js +4 -14
  147. package/dist/feature-libraries/treeCompressionUtils.js.map +1 -1
  148. package/dist/index.d.ts +4 -4
  149. package/dist/index.d.ts.map +1 -1
  150. package/dist/index.js +8 -3
  151. package/dist/index.js.map +1 -1
  152. package/dist/packageVersion.d.ts +1 -1
  153. package/dist/packageVersion.d.ts.map +1 -1
  154. package/dist/packageVersion.js +1 -1
  155. package/dist/packageVersion.js.map +1 -1
  156. package/dist/shared-tree/index.d.ts +1 -1
  157. package/dist/shared-tree/index.d.ts.map +1 -1
  158. package/dist/shared-tree/index.js +1 -2
  159. package/dist/shared-tree/index.js.map +1 -1
  160. package/dist/shared-tree/sharedTree.d.ts +7 -54
  161. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  162. package/dist/shared-tree/sharedTree.js +2 -52
  163. package/dist/shared-tree/sharedTree.js.map +1 -1
  164. package/dist/shared-tree/sharedTreeChangeCodecs.d.ts +1 -1
  165. package/dist/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  166. package/dist/shared-tree/sharedTreeChangeCodecs.js +0 -2
  167. package/dist/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  168. package/dist/shared-tree/sharedTreeChangeFamily.d.ts +2 -2
  169. package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  170. package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  171. package/dist/shared-tree/treeCheckout.d.ts +2 -2
  172. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  173. package/dist/shared-tree/treeCheckout.js.map +1 -1
  174. package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  175. package/dist/shared-tree-core/editManagerCodecs.js +12 -6
  176. package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
  177. package/dist/shared-tree-core/editManagerFormatCommons.d.ts +3 -4
  178. package/dist/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
  179. package/dist/shared-tree-core/editManagerFormatCommons.js +5 -8
  180. package/dist/shared-tree-core/editManagerFormatCommons.js.map +1 -1
  181. package/dist/shared-tree-core/index.d.ts +3 -3
  182. package/dist/shared-tree-core/index.d.ts.map +1 -1
  183. package/dist/shared-tree-core/index.js +3 -2
  184. package/dist/shared-tree-core/index.js.map +1 -1
  185. package/dist/shared-tree-core/messageCodecs.d.ts.map +1 -1
  186. package/dist/shared-tree-core/messageCodecs.js +20 -9
  187. package/dist/shared-tree-core/messageCodecs.js.map +1 -1
  188. package/dist/shared-tree-core/messageFormat.d.ts +4 -6
  189. package/dist/shared-tree-core/messageFormat.d.ts.map +1 -1
  190. package/dist/shared-tree-core/messageFormat.js +9 -7
  191. package/dist/shared-tree-core/messageFormat.js.map +1 -1
  192. package/dist/simple-tree/api/configuration.d.ts +2 -0
  193. package/dist/simple-tree/api/configuration.d.ts.map +1 -1
  194. package/dist/simple-tree/api/configuration.js +10 -0
  195. package/dist/simple-tree/api/configuration.js.map +1 -1
  196. package/dist/simple-tree/api/incrementalAllowedTypes.d.ts +15 -12
  197. package/dist/simple-tree/api/incrementalAllowedTypes.d.ts.map +1 -1
  198. package/dist/simple-tree/api/incrementalAllowedTypes.js +17 -14
  199. package/dist/simple-tree/api/incrementalAllowedTypes.js.map +1 -1
  200. package/dist/simple-tree/api/index.d.ts +2 -1
  201. package/dist/simple-tree/api/index.d.ts.map +1 -1
  202. package/dist/simple-tree/api/index.js +6 -2
  203. package/dist/simple-tree/api/index.js.map +1 -1
  204. package/dist/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
  205. package/dist/simple-tree/api/schemaFromSimple.js +7 -1
  206. package/dist/simple-tree/api/schemaFromSimple.js.map +1 -1
  207. package/dist/simple-tree/api/simpleSchemaCodec.js +4 -6
  208. package/dist/simple-tree/api/simpleSchemaCodec.js.map +1 -1
  209. package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts +103 -0
  210. package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -0
  211. package/dist/simple-tree/api/snapshotCompatibilityChecker.js +128 -0
  212. package/dist/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -0
  213. package/dist/simple-tree/api/tree.d.ts +2 -2
  214. package/dist/simple-tree/api/tree.js +1 -1
  215. package/dist/simple-tree/api/tree.js.map +1 -1
  216. package/dist/simple-tree/core/allowedTypes.js +1 -1
  217. package/dist/simple-tree/core/allowedTypes.js.map +1 -1
  218. package/dist/simple-tree/core/index.d.ts +3 -3
  219. package/dist/simple-tree/core/index.d.ts.map +1 -1
  220. package/dist/simple-tree/core/index.js +3 -1
  221. package/dist/simple-tree/core/index.js.map +1 -1
  222. package/dist/simple-tree/core/toStored.d.ts +12 -5
  223. package/dist/simple-tree/core/toStored.d.ts.map +1 -1
  224. package/dist/simple-tree/core/toStored.js +26 -10
  225. package/dist/simple-tree/core/toStored.js.map +1 -1
  226. package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  227. package/dist/simple-tree/core/treeNodeKernel.js +1 -0
  228. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
  229. package/dist/simple-tree/core/treeNodeSchema.d.ts +1 -6
  230. package/dist/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  231. package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
  232. package/dist/simple-tree/core/treeNodeValid.d.ts +1 -1
  233. package/dist/simple-tree/core/treeNodeValid.d.ts.map +1 -1
  234. package/dist/simple-tree/core/treeNodeValid.js +1 -2
  235. package/dist/simple-tree/core/treeNodeValid.js.map +1 -1
  236. package/dist/simple-tree/fieldSchema.d.ts.map +1 -1
  237. package/dist/simple-tree/fieldSchema.js +1 -8
  238. package/dist/simple-tree/fieldSchema.js.map +1 -1
  239. package/dist/simple-tree/index.d.ts +3 -3
  240. package/dist/simple-tree/index.d.ts.map +1 -1
  241. package/dist/simple-tree/index.js +10 -4
  242. package/dist/simple-tree/index.js.map +1 -1
  243. package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
  244. package/dist/simple-tree/leafNodeSchema.js +0 -1
  245. package/dist/simple-tree/leafNodeSchema.js.map +1 -1
  246. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  247. package/dist/simple-tree/node-kinds/array/arrayNode.js +14 -49
  248. package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  249. package/dist/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
  250. package/dist/simple-tree/node-kinds/map/mapNode.js +1 -5
  251. package/dist/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  252. package/dist/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  253. package/dist/simple-tree/node-kinds/object/objectNode.js +3 -10
  254. package/dist/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  255. package/dist/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
  256. package/dist/simple-tree/node-kinds/record/recordNode.js +1 -5
  257. package/dist/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  258. package/dist/simple-tree/simpleSchema.d.ts +15 -3
  259. package/dist/simple-tree/simpleSchema.d.ts.map +1 -1
  260. package/dist/simple-tree/simpleSchema.js.map +1 -1
  261. package/dist/simple-tree/toStoredSchema.d.ts +20 -8
  262. package/dist/simple-tree/toStoredSchema.d.ts.map +1 -1
  263. package/dist/simple-tree/toStoredSchema.js +27 -22
  264. package/dist/simple-tree/toStoredSchema.js.map +1 -1
  265. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
  266. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js +18 -15
  267. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
  268. package/dist/tableSchema.d.ts +22 -52
  269. package/dist/tableSchema.d.ts.map +1 -1
  270. package/dist/tableSchema.js +141 -277
  271. package/dist/tableSchema.js.map +1 -1
  272. package/dist/treeFactory.d.ts +5 -0
  273. package/dist/treeFactory.d.ts.map +1 -1
  274. package/dist/treeFactory.js +12 -5
  275. package/dist/treeFactory.js.map +1 -1
  276. package/dist/util/arrayUtilities.d.ts +45 -0
  277. package/dist/util/arrayUtilities.d.ts.map +1 -0
  278. package/dist/util/arrayUtilities.js +76 -0
  279. package/dist/util/arrayUtilities.js.map +1 -0
  280. package/dist/util/breakable.js +3 -3
  281. package/dist/util/breakable.js.map +1 -1
  282. package/dist/util/index.d.ts +1 -0
  283. package/dist/util/index.d.ts.map +1 -1
  284. package/dist/util/index.js +7 -2
  285. package/dist/util/index.js.map +1 -1
  286. package/dist/util/typeCheckTests.d.ts.map +1 -1
  287. package/dist/util/typeCheckTests.js.map +1 -1
  288. package/lib/alpha.d.ts +7 -1
  289. package/lib/api.d.ts +6 -2
  290. package/lib/api.d.ts.map +1 -1
  291. package/lib/api.js +2 -13
  292. package/lib/api.js.map +1 -1
  293. package/lib/codec/codec.d.ts +9 -2
  294. package/lib/codec/codec.d.ts.map +1 -1
  295. package/lib/codec/codec.js +9 -2
  296. package/lib/codec/codec.js.map +1 -1
  297. package/lib/codec/index.d.ts +1 -1
  298. package/lib/codec/index.d.ts.map +1 -1
  299. package/lib/codec/index.js +1 -1
  300. package/lib/codec/index.js.map +1 -1
  301. package/lib/codec/versioned/codec.d.ts +7 -2
  302. package/lib/codec/versioned/codec.d.ts.map +1 -1
  303. package/lib/codec/versioned/codec.js +22 -0
  304. package/lib/codec/versioned/codec.js.map +1 -1
  305. package/lib/codec/versioned/index.d.ts +1 -1
  306. package/lib/codec/versioned/index.d.ts.map +1 -1
  307. package/lib/codec/versioned/index.js +1 -1
  308. package/lib/codec/versioned/index.js.map +1 -1
  309. package/lib/core/schema-stored/schema.d.ts +12 -1
  310. package/lib/core/schema-stored/schema.d.ts.map +1 -1
  311. package/lib/core/schema-stored/schema.js.map +1 -1
  312. package/lib/core/tree/detachedFieldIndexCodecs.d.ts.map +1 -1
  313. package/lib/core/tree/detachedFieldIndexCodecs.js +5 -3
  314. package/lib/core/tree/detachedFieldIndexCodecs.js.map +1 -1
  315. package/lib/feature-libraries/chunked-forest/chunkTree.d.ts +4 -5
  316. package/lib/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  317. package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  318. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  319. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js +2 -1
  320. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  321. package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts +2 -1
  322. package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts.map +1 -1
  323. package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
  324. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts +3 -3
  325. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  326. package/lib/feature-libraries/chunked-forest/codec/codecs.js +36 -22
  327. package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  328. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +6 -6
  329. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
  330. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +4 -2
  331. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  332. package/lib/feature-libraries/chunked-forest/codec/format.d.ts +156 -4
  333. package/lib/feature-libraries/chunked-forest/codec/format.d.ts.map +1 -1
  334. package/lib/feature-libraries/chunked-forest/codec/format.js +6 -2
  335. package/lib/feature-libraries/chunked-forest/codec/format.js.map +1 -1
  336. package/lib/feature-libraries/chunked-forest/codec/formatGeneric.d.ts +8 -3
  337. package/lib/feature-libraries/chunked-forest/codec/formatGeneric.d.ts.map +1 -1
  338. package/lib/feature-libraries/chunked-forest/codec/formatGeneric.js +4 -1
  339. package/lib/feature-libraries/chunked-forest/codec/formatGeneric.js.map +1 -1
  340. package/lib/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.d.ts +2 -2
  341. package/lib/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.d.ts.map +1 -1
  342. package/lib/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.js.map +1 -1
  343. package/lib/feature-libraries/chunked-forest/codec/index.d.ts +1 -1
  344. package/lib/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
  345. package/lib/feature-libraries/chunked-forest/codec/index.js +1 -1
  346. package/lib/feature-libraries/chunked-forest/codec/index.js.map +1 -1
  347. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts +13 -13
  348. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -1
  349. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +22 -6
  350. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
  351. package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.d.ts +9 -8
  352. package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.d.ts.map +1 -1
  353. package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.js +17 -2
  354. package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.js.map +1 -1
  355. package/lib/feature-libraries/chunked-forest/index.d.ts +1 -1
  356. package/lib/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  357. package/lib/feature-libraries/chunked-forest/index.js +1 -1
  358. package/lib/feature-libraries/chunked-forest/index.js.map +1 -1
  359. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts +35 -17
  360. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  361. package/lib/feature-libraries/default-schema/defaultFieldKinds.js +55 -57
  362. package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  363. package/lib/feature-libraries/default-schema/index.d.ts +1 -3
  364. package/lib/feature-libraries/default-schema/index.d.ts.map +1 -1
  365. package/lib/feature-libraries/default-schema/index.js +1 -3
  366. package/lib/feature-libraries/default-schema/index.js.map +1 -1
  367. package/lib/feature-libraries/forest-summary/forestSummarizer.js +2 -2
  368. package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  369. package/lib/feature-libraries/forest-summary/format.d.ts +2 -2
  370. package/lib/feature-libraries/forest-summary/format.d.ts.map +1 -1
  371. package/lib/feature-libraries/forest-summary/format.js +4 -2
  372. package/lib/feature-libraries/forest-summary/format.js.map +1 -1
  373. package/lib/feature-libraries/index.d.ts +5 -4
  374. package/lib/feature-libraries/index.d.ts.map +1 -1
  375. package/lib/feature-libraries/index.js +5 -4
  376. package/lib/feature-libraries/index.js.map +1 -1
  377. package/lib/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
  378. package/lib/feature-libraries/modular-schema/comparison.js +1 -2
  379. package/lib/feature-libraries/modular-schema/comparison.js.map +1 -1
  380. package/lib/feature-libraries/modular-schema/fieldKind.d.ts +38 -12
  381. package/lib/feature-libraries/modular-schema/fieldKind.d.ts.map +1 -1
  382. package/lib/feature-libraries/modular-schema/fieldKind.js +29 -11
  383. package/lib/feature-libraries/modular-schema/fieldKind.js.map +1 -1
  384. package/lib/feature-libraries/modular-schema/fieldKindConfiguration.d.ts +2 -2
  385. package/lib/feature-libraries/modular-schema/fieldKindConfiguration.d.ts.map +1 -1
  386. package/lib/feature-libraries/modular-schema/fieldKindConfiguration.js.map +1 -1
  387. package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts +2 -2
  388. package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  389. package/lib/feature-libraries/modular-schema/genericFieldKind.js +3 -2
  390. package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  391. package/lib/feature-libraries/modular-schema/index.d.ts +0 -1
  392. package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
  393. package/lib/feature-libraries/modular-schema/index.js +0 -1
  394. package/lib/feature-libraries/modular-schema/index.js.map +1 -1
  395. package/lib/feature-libraries/modular-schema/isNeverTree.d.ts +5 -6
  396. package/lib/feature-libraries/modular-schema/isNeverTree.d.ts.map +1 -1
  397. package/lib/feature-libraries/modular-schema/isNeverTree.js.map +1 -1
  398. package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts +2 -2
  399. package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  400. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js +1 -1
  401. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  402. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +8 -8
  403. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  404. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +1 -2
  405. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  406. package/lib/feature-libraries/modular-schema/modularChangeFormat.d.ts +66 -9
  407. package/lib/feature-libraries/modular-schema/modularChangeFormat.d.ts.map +1 -1
  408. package/lib/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  409. package/lib/feature-libraries/object-forest/objectForest.js +2 -1
  410. package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
  411. package/lib/feature-libraries/optional-field/index.d.ts +1 -1
  412. package/lib/feature-libraries/optional-field/index.d.ts.map +1 -1
  413. package/lib/feature-libraries/optional-field/index.js.map +1 -1
  414. package/lib/feature-libraries/optional-field/optionalFieldCodecs.d.ts.map +1 -1
  415. package/lib/feature-libraries/optional-field/optionalFieldCodecs.js +1 -5
  416. package/lib/feature-libraries/optional-field/optionalFieldCodecs.js.map +1 -1
  417. package/lib/feature-libraries/schema-index/codec.d.ts.map +1 -1
  418. package/lib/feature-libraries/schema-index/codec.js +5 -3
  419. package/lib/feature-libraries/schema-index/codec.js.map +1 -1
  420. package/lib/feature-libraries/{default-schema/schemaChecker.d.ts → schemaChecker.d.ts} +2 -2
  421. package/lib/feature-libraries/schemaChecker.d.ts.map +1 -0
  422. package/lib/feature-libraries/{default-schema/schemaChecker.js → schemaChecker.js} +3 -3
  423. package/lib/feature-libraries/schemaChecker.js.map +1 -0
  424. package/lib/feature-libraries/sequence-field/formatV2.d.ts.map +1 -1
  425. package/lib/feature-libraries/sequence-field/formatV2.js +1 -0
  426. package/lib/feature-libraries/sequence-field/formatV2.js.map +1 -1
  427. package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts.map +1 -1
  428. package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.js +0 -2
  429. package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.js.map +1 -1
  430. package/lib/feature-libraries/treeCompressionUtils.d.ts +2 -12
  431. package/lib/feature-libraries/treeCompressionUtils.d.ts.map +1 -1
  432. package/lib/feature-libraries/treeCompressionUtils.js +3 -13
  433. package/lib/feature-libraries/treeCompressionUtils.js.map +1 -1
  434. package/lib/index.d.ts +4 -4
  435. package/lib/index.d.ts.map +1 -1
  436. package/lib/index.js +3 -3
  437. package/lib/index.js.map +1 -1
  438. package/lib/packageVersion.d.ts +1 -1
  439. package/lib/packageVersion.d.ts.map +1 -1
  440. package/lib/packageVersion.js +1 -1
  441. package/lib/packageVersion.js.map +1 -1
  442. package/lib/shared-tree/index.d.ts +1 -1
  443. package/lib/shared-tree/index.d.ts.map +1 -1
  444. package/lib/shared-tree/index.js +1 -1
  445. package/lib/shared-tree/index.js.map +1 -1
  446. package/lib/shared-tree/sharedTree.d.ts +7 -54
  447. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  448. package/lib/shared-tree/sharedTree.js +1 -51
  449. package/lib/shared-tree/sharedTree.js.map +1 -1
  450. package/lib/shared-tree/sharedTreeChangeCodecs.d.ts +1 -1
  451. package/lib/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  452. package/lib/shared-tree/sharedTreeChangeCodecs.js +0 -2
  453. package/lib/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  454. package/lib/shared-tree/sharedTreeChangeFamily.d.ts +2 -2
  455. package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  456. package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  457. package/lib/shared-tree/treeCheckout.d.ts +2 -2
  458. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  459. package/lib/shared-tree/treeCheckout.js.map +1 -1
  460. package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  461. package/lib/shared-tree-core/editManagerCodecs.js +13 -7
  462. package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
  463. package/lib/shared-tree-core/editManagerFormatCommons.d.ts +3 -4
  464. package/lib/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
  465. package/lib/shared-tree-core/editManagerFormatCommons.js +4 -7
  466. package/lib/shared-tree-core/editManagerFormatCommons.js.map +1 -1
  467. package/lib/shared-tree-core/index.d.ts +3 -3
  468. package/lib/shared-tree-core/index.d.ts.map +1 -1
  469. package/lib/shared-tree-core/index.js +2 -2
  470. package/lib/shared-tree-core/index.js.map +1 -1
  471. package/lib/shared-tree-core/messageCodecs.d.ts.map +1 -1
  472. package/lib/shared-tree-core/messageCodecs.js +21 -10
  473. package/lib/shared-tree-core/messageCodecs.js.map +1 -1
  474. package/lib/shared-tree-core/messageFormat.d.ts +4 -6
  475. package/lib/shared-tree-core/messageFormat.d.ts.map +1 -1
  476. package/lib/shared-tree-core/messageFormat.js +8 -6
  477. package/lib/shared-tree-core/messageFormat.js.map +1 -1
  478. package/lib/simple-tree/api/configuration.d.ts +2 -0
  479. package/lib/simple-tree/api/configuration.d.ts.map +1 -1
  480. package/lib/simple-tree/api/configuration.js +10 -0
  481. package/lib/simple-tree/api/configuration.js.map +1 -1
  482. package/lib/simple-tree/api/incrementalAllowedTypes.d.ts +15 -12
  483. package/lib/simple-tree/api/incrementalAllowedTypes.d.ts.map +1 -1
  484. package/lib/simple-tree/api/incrementalAllowedTypes.js +15 -12
  485. package/lib/simple-tree/api/incrementalAllowedTypes.js.map +1 -1
  486. package/lib/simple-tree/api/index.d.ts +2 -1
  487. package/lib/simple-tree/api/index.d.ts.map +1 -1
  488. package/lib/simple-tree/api/index.js +2 -1
  489. package/lib/simple-tree/api/index.js.map +1 -1
  490. package/lib/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
  491. package/lib/simple-tree/api/schemaFromSimple.js +8 -2
  492. package/lib/simple-tree/api/schemaFromSimple.js.map +1 -1
  493. package/lib/simple-tree/api/simpleSchemaCodec.js +5 -7
  494. package/lib/simple-tree/api/simpleSchemaCodec.js.map +1 -1
  495. package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts +103 -0
  496. package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -0
  497. package/lib/simple-tree/api/snapshotCompatibilityChecker.js +122 -0
  498. package/lib/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -0
  499. package/lib/simple-tree/api/tree.d.ts +2 -2
  500. package/lib/simple-tree/api/tree.js +1 -1
  501. package/lib/simple-tree/api/tree.js.map +1 -1
  502. package/lib/simple-tree/core/allowedTypes.js +1 -1
  503. package/lib/simple-tree/core/allowedTypes.js.map +1 -1
  504. package/lib/simple-tree/core/index.d.ts +3 -3
  505. package/lib/simple-tree/core/index.d.ts.map +1 -1
  506. package/lib/simple-tree/core/index.js +2 -2
  507. package/lib/simple-tree/core/index.js.map +1 -1
  508. package/lib/simple-tree/core/toStored.d.ts +12 -5
  509. package/lib/simple-tree/core/toStored.d.ts.map +1 -1
  510. package/lib/simple-tree/core/toStored.js +25 -9
  511. package/lib/simple-tree/core/toStored.js.map +1 -1
  512. package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  513. package/lib/simple-tree/core/treeNodeKernel.js +1 -0
  514. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
  515. package/lib/simple-tree/core/treeNodeSchema.d.ts +1 -6
  516. package/lib/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  517. package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
  518. package/lib/simple-tree/core/treeNodeValid.d.ts +1 -1
  519. package/lib/simple-tree/core/treeNodeValid.d.ts.map +1 -1
  520. package/lib/simple-tree/core/treeNodeValid.js +1 -2
  521. package/lib/simple-tree/core/treeNodeValid.js.map +1 -1
  522. package/lib/simple-tree/fieldSchema.d.ts.map +1 -1
  523. package/lib/simple-tree/fieldSchema.js +2 -9
  524. package/lib/simple-tree/fieldSchema.js.map +1 -1
  525. package/lib/simple-tree/index.d.ts +3 -3
  526. package/lib/simple-tree/index.d.ts.map +1 -1
  527. package/lib/simple-tree/index.js +3 -3
  528. package/lib/simple-tree/index.js.map +1 -1
  529. package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
  530. package/lib/simple-tree/leafNodeSchema.js +1 -2
  531. package/lib/simple-tree/leafNodeSchema.js.map +1 -1
  532. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  533. package/lib/simple-tree/node-kinds/array/arrayNode.js +16 -51
  534. package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  535. package/lib/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
  536. package/lib/simple-tree/node-kinds/map/mapNode.js +3 -7
  537. package/lib/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  538. package/lib/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  539. package/lib/simple-tree/node-kinds/object/objectNode.js +4 -11
  540. package/lib/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  541. package/lib/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
  542. package/lib/simple-tree/node-kinds/record/recordNode.js +3 -7
  543. package/lib/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  544. package/lib/simple-tree/simpleSchema.d.ts +15 -3
  545. package/lib/simple-tree/simpleSchema.d.ts.map +1 -1
  546. package/lib/simple-tree/simpleSchema.js.map +1 -1
  547. package/lib/simple-tree/toStoredSchema.d.ts +20 -8
  548. package/lib/simple-tree/toStoredSchema.d.ts.map +1 -1
  549. package/lib/simple-tree/toStoredSchema.js +28 -24
  550. package/lib/simple-tree/toStoredSchema.js.map +1 -1
  551. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
  552. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js +20 -17
  553. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
  554. package/lib/tableSchema.d.ts +22 -52
  555. package/lib/tableSchema.d.ts.map +1 -1
  556. package/lib/tableSchema.js +143 -279
  557. package/lib/tableSchema.js.map +1 -1
  558. package/lib/treeFactory.d.ts +5 -0
  559. package/lib/treeFactory.d.ts.map +1 -1
  560. package/lib/treeFactory.js +10 -4
  561. package/lib/treeFactory.js.map +1 -1
  562. package/lib/util/arrayUtilities.d.ts +45 -0
  563. package/lib/util/arrayUtilities.d.ts.map +1 -0
  564. package/lib/util/arrayUtilities.js +69 -0
  565. package/lib/util/arrayUtilities.js.map +1 -0
  566. package/lib/util/breakable.js +3 -3
  567. package/lib/util/breakable.js.map +1 -1
  568. package/lib/util/index.d.ts +1 -0
  569. package/lib/util/index.d.ts.map +1 -1
  570. package/lib/util/index.js +1 -0
  571. package/lib/util/index.js.map +1 -1
  572. package/lib/util/typeCheckTests.d.ts.map +1 -1
  573. package/lib/util/typeCheckTests.js.map +1 -1
  574. package/package.json +22 -22
  575. package/src/api.ts +22 -11
  576. package/src/codec/codec.ts +10 -2
  577. package/src/codec/index.ts +1 -0
  578. package/src/codec/versioned/codec.ts +40 -2
  579. package/src/codec/versioned/index.ts +1 -0
  580. package/src/core/schema-stored/schema.ts +12 -1
  581. package/src/core/tree/detachedFieldIndexCodecs.ts +10 -3
  582. package/src/feature-libraries/README.md +1 -1
  583. package/src/feature-libraries/chunked-forest/chunkTree.ts +3 -3
  584. package/src/feature-libraries/chunked-forest/codec/chunkDecoding.ts +5 -0
  585. package/src/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.ts +2 -1
  586. package/src/feature-libraries/chunked-forest/codec/codecs.ts +55 -26
  587. package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +8 -3
  588. package/src/feature-libraries/chunked-forest/codec/format.ts +14 -4
  589. package/src/feature-libraries/chunked-forest/codec/formatGeneric.ts +7 -2
  590. package/src/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.ts +5 -6
  591. package/src/feature-libraries/chunked-forest/codec/index.ts +1 -4
  592. package/src/feature-libraries/chunked-forest/codec/schemaBasedEncode.ts +62 -9
  593. package/src/feature-libraries/chunked-forest/codec/uncompressedEncode.ts +24 -2
  594. package/src/feature-libraries/chunked-forest/index.ts +1 -1
  595. package/src/feature-libraries/default-schema/defaultFieldKinds.ts +86 -74
  596. package/src/feature-libraries/default-schema/index.ts +1 -9
  597. package/src/feature-libraries/forest-summary/forestSummarizer.ts +2 -2
  598. package/src/feature-libraries/forest-summary/format.ts +15 -9
  599. package/src/feature-libraries/index.ts +8 -10
  600. package/src/feature-libraries/modular-schema/comparison.ts +2 -3
  601. package/src/feature-libraries/modular-schema/fieldKind.ts +90 -13
  602. package/src/feature-libraries/modular-schema/fieldKindConfiguration.ts +2 -3
  603. package/src/feature-libraries/modular-schema/genericFieldKind.ts +6 -6
  604. package/src/feature-libraries/modular-schema/index.ts +0 -1
  605. package/src/feature-libraries/modular-schema/isNeverTree.ts +7 -8
  606. package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +3 -6
  607. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +13 -13
  608. package/src/feature-libraries/object-forest/objectForest.ts +2 -6
  609. package/src/feature-libraries/optional-field/index.ts +1 -0
  610. package/src/feature-libraries/optional-field/optionalFieldCodecs.ts +1 -5
  611. package/src/feature-libraries/schema-index/codec.ts +10 -3
  612. package/src/feature-libraries/{default-schema/schemaChecker.ts → schemaChecker.ts} +4 -4
  613. package/src/feature-libraries/sequence-field/formatV2.ts +1 -0
  614. package/src/feature-libraries/sequence-field/sequenceFieldCodecs.ts +0 -2
  615. package/src/feature-libraries/treeCompressionUtils.ts +1 -15
  616. package/src/index.ts +7 -1
  617. package/src/packageVersion.ts +1 -1
  618. package/src/shared-tree/index.ts +0 -1
  619. package/src/shared-tree/sharedTree.ts +12 -88
  620. package/src/shared-tree/sharedTreeChangeCodecs.ts +1 -6
  621. package/src/shared-tree/sharedTreeChangeFamily.ts +2 -2
  622. package/src/shared-tree/treeCheckout.ts +2 -2
  623. package/src/shared-tree-core/editManagerCodecs.ts +19 -7
  624. package/src/shared-tree-core/editManagerFormatCommons.ts +11 -12
  625. package/src/shared-tree-core/index.ts +7 -3
  626. package/src/shared-tree-core/messageCodecs.ts +32 -17
  627. package/src/shared-tree-core/messageFormat.ts +8 -6
  628. package/src/simple-tree/api/configuration.ts +17 -4
  629. package/src/simple-tree/api/incrementalAllowedTypes.ts +20 -18
  630. package/src/simple-tree/api/index.ts +6 -1
  631. package/src/simple-tree/api/schemaFromSimple.ts +14 -6
  632. package/src/simple-tree/api/simpleSchemaCodec.ts +10 -9
  633. package/src/simple-tree/api/snapshotCompatibilityChecker.ts +135 -0
  634. package/src/simple-tree/api/tree.ts +2 -2
  635. package/src/simple-tree/core/allowedTypes.ts +1 -1
  636. package/src/simple-tree/core/index.ts +3 -1
  637. package/src/simple-tree/core/toStored.ts +42 -18
  638. package/src/simple-tree/core/treeNodeKernel.ts +1 -0
  639. package/src/simple-tree/core/treeNodeSchema.ts +1 -7
  640. package/src/simple-tree/core/treeNodeValid.ts +0 -2
  641. package/src/simple-tree/fieldSchema.ts +2 -11
  642. package/src/simple-tree/index.ts +7 -2
  643. package/src/simple-tree/leafNodeSchema.ts +1 -2
  644. package/src/simple-tree/node-kinds/array/arrayNode.ts +28 -75
  645. package/src/simple-tree/node-kinds/map/mapNode.ts +1 -15
  646. package/src/simple-tree/node-kinds/object/objectNode.ts +4 -18
  647. package/src/simple-tree/node-kinds/record/recordNode.ts +1 -15
  648. package/src/simple-tree/simpleSchema.ts +16 -3
  649. package/src/simple-tree/toStoredSchema.ts +54 -38
  650. package/src/simple-tree/unhydratedFlexTreeFromInsertable.ts +22 -17
  651. package/src/tableSchema.ts +110 -334
  652. package/src/treeFactory.ts +13 -4
  653. package/src/util/arrayUtilities.ts +88 -0
  654. package/src/util/breakable.ts +4 -4
  655. package/src/util/index.ts +6 -0
  656. package/src/util/typeCheckTests.ts +0 -1
  657. package/dist/feature-libraries/default-schema/defaultSchema.d.ts +0 -10
  658. package/dist/feature-libraries/default-schema/defaultSchema.d.ts.map +0 -1
  659. package/dist/feature-libraries/default-schema/defaultSchema.js +0 -15
  660. package/dist/feature-libraries/default-schema/defaultSchema.js.map +0 -1
  661. package/dist/feature-libraries/default-schema/schemaChecker.d.ts.map +0 -1
  662. package/dist/feature-libraries/default-schema/schemaChecker.js.map +0 -1
  663. package/dist/feature-libraries/modular-schema/fieldKindWithEditor.d.ts +0 -50
  664. package/dist/feature-libraries/modular-schema/fieldKindWithEditor.d.ts.map +0 -1
  665. package/dist/feature-libraries/modular-schema/fieldKindWithEditor.js +0 -76
  666. package/dist/feature-libraries/modular-schema/fieldKindWithEditor.js.map +0 -1
  667. package/dist/feature-libraries/optional-field/optionalFieldCodecV1.d.ts +0 -12
  668. package/dist/feature-libraries/optional-field/optionalFieldCodecV1.d.ts.map +0 -1
  669. package/dist/feature-libraries/optional-field/optionalFieldCodecV1.js +0 -158
  670. package/dist/feature-libraries/optional-field/optionalFieldCodecV1.js.map +0 -1
  671. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts +0 -11
  672. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts.map +0 -1
  673. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js +0 -245
  674. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +0 -1
  675. package/lib/feature-libraries/default-schema/defaultSchema.d.ts +0 -10
  676. package/lib/feature-libraries/default-schema/defaultSchema.d.ts.map +0 -1
  677. package/lib/feature-libraries/default-schema/defaultSchema.js +0 -12
  678. package/lib/feature-libraries/default-schema/defaultSchema.js.map +0 -1
  679. package/lib/feature-libraries/default-schema/schemaChecker.d.ts.map +0 -1
  680. package/lib/feature-libraries/default-schema/schemaChecker.js.map +0 -1
  681. package/lib/feature-libraries/modular-schema/fieldKindWithEditor.d.ts +0 -50
  682. package/lib/feature-libraries/modular-schema/fieldKindWithEditor.d.ts.map +0 -1
  683. package/lib/feature-libraries/modular-schema/fieldKindWithEditor.js +0 -71
  684. package/lib/feature-libraries/modular-schema/fieldKindWithEditor.js.map +0 -1
  685. package/lib/feature-libraries/optional-field/optionalFieldCodecV1.d.ts +0 -12
  686. package/lib/feature-libraries/optional-field/optionalFieldCodecV1.d.ts.map +0 -1
  687. package/lib/feature-libraries/optional-field/optionalFieldCodecV1.js +0 -154
  688. package/lib/feature-libraries/optional-field/optionalFieldCodecV1.js.map +0 -1
  689. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts +0 -11
  690. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts.map +0 -1
  691. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js +0 -241
  692. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +0 -1
  693. package/src/feature-libraries/default-schema/defaultSchema.ts +0 -15
  694. package/src/feature-libraries/modular-schema/fieldKindWithEditor.ts +0 -108
  695. package/src/feature-libraries/optional-field/optionalFieldCodecV1.ts +0 -208
  696. package/src/feature-libraries/sequence-field/sequenceFieldCodecV1.ts +0 -344
@@ -27,7 +27,7 @@ export {
27
27
  type SummaryElementParser,
28
28
  type SummaryElementStringifier,
29
29
  type ClonableSchemaAndPolicy,
30
- type SharedTreeCoreOptionsInternal as SharedTreCoreOptionsInternal,
30
+ type SharedTreeCoreOptionsInternal,
31
31
  } from "./sharedTreeCore.js";
32
32
 
33
33
  export type { ResubmitMachine } from "./resubmitMachine.js";
@@ -48,7 +48,7 @@ export {
48
48
  } from "./editManagerCodecs.js";
49
49
  export {
50
50
  EditManagerFormatVersion,
51
- editManagerFormatVersions,
51
+ supportedEditManagerFormatVersions,
52
52
  } from "./editManagerFormatCommons.js";
53
53
  export { EditManagerSummarizer } from "./editManagerSummarizer.js";
54
54
  export {
@@ -70,4 +70,8 @@ export {
70
70
  clientVersionToMessageFormatVersion,
71
71
  messageFormatVersionSelectorForSharedBranches,
72
72
  } from "./messageCodecs.js";
73
- export { MessageFormatVersion, messageFormatVersions } from "./messageFormat.js";
73
+ export {
74
+ MessageFormatVersion,
75
+ messageFormatVersions,
76
+ supportedMessageFormatVersions,
77
+ } from "./messageFormat.js";
@@ -5,6 +5,11 @@
5
5
 
6
6
  import { unreachableCase } from "@fluidframework/core-utils/internal";
7
7
  import type { MinimumVersionForCollab } from "@fluidframework/runtime-definitions/internal";
8
+ import {
9
+ getConfigForMinVersionForCollab,
10
+ lowestMinVersionForCollab,
11
+ } from "@fluidframework/runtime-utils/internal";
12
+
8
13
  import {
9
14
  type CodecTree,
10
15
  type CodecWriteOptions,
@@ -15,6 +20,7 @@ import {
15
20
  type ICodecOptions,
16
21
  type IJsonCodec,
17
22
  makeCodecFamily,
23
+ makeDiscontinuedCodecVersion,
18
24
  makeVersionDispatchingCodec,
19
25
  } from "../codec/index.js";
20
26
  import type {
@@ -45,10 +51,12 @@ export function clientVersionToMessageFormatVersion(
45
51
  clientVersion: MinimumVersionForCollab,
46
52
  writeVersionOverride?: MessageFormatVersion,
47
53
  ): MessageFormatVersion {
48
- const compatibleVersion: MessageFormatVersion =
49
- clientVersion < FluidClientVersion.v2_43
50
- ? brand(MessageFormatVersion.v3)
51
- : brand(MessageFormatVersion.v4);
54
+ const compatibleVersion: MessageFormatVersion = brand(
55
+ getConfigForMinVersionForCollab(clientVersion, {
56
+ [lowestMinVersionForCollab]: MessageFormatVersion.v3,
57
+ [FluidClientVersion.v2_43]: MessageFormatVersion.v4,
58
+ }),
59
+ );
52
60
  return writeVersionOverride ?? compatibleVersion;
53
61
  }
54
62
 
@@ -123,29 +131,36 @@ export function makeMessageCodecs<TChangeset>(
123
131
  MessageEncodingContext
124
132
  >,
125
133
  ][] = Array.from(messageFormatVersions).map((version) => {
126
- const changeCodec = changeCodecs.resolve(
127
- dependentChangeFormatVersion.lookup(version),
128
- ).json;
129
134
  switch (version) {
130
135
  case MessageFormatVersion.undefined:
131
136
  case MessageFormatVersion.v1:
132
- case MessageFormatVersion.v2:
137
+ case MessageFormatVersion.v2: {
138
+ const versionOrUndefined =
139
+ version === MessageFormatVersion.undefined ? undefined : version;
140
+ return [
141
+ versionOrUndefined,
142
+ makeDiscontinuedCodecVersion(options, versionOrUndefined, "2.73.0"),
143
+ ];
144
+ }
133
145
  case MessageFormatVersion.v3:
134
- case MessageFormatVersion.v4:
146
+ case MessageFormatVersion.v4: {
147
+ const changeCodec = changeCodecs.resolve(
148
+ dependentChangeFormatVersion.lookup(version),
149
+ ).json;
135
150
  return [
136
- version === MessageFormatVersion.undefined ? undefined : version,
137
- makeV1ToV4CodecWithVersion(
138
- changeCodec,
139
- revisionTagCodec,
140
- options,
141
- version === MessageFormatVersion.undefined ? MessageFormatVersion.v1 : version,
142
- ),
151
+ version,
152
+ makeV1ToV4CodecWithVersion(changeCodec, revisionTagCodec, options, version),
143
153
  ];
144
- case MessageFormatVersion.v5:
154
+ }
155
+ case MessageFormatVersion.v5: {
156
+ const changeCodec = changeCodecs.resolve(
157
+ dependentChangeFormatVersion.lookup(version),
158
+ ).json;
145
159
  return [
146
160
  version,
147
161
  makeV5CodecWithVersion(changeCodec, revisionTagCodec, options, version),
148
162
  ];
163
+ }
149
164
  default:
150
165
  unreachableCase(version);
151
166
  }
@@ -12,20 +12,17 @@ export const MessageFormatVersion = {
12
12
  /**
13
13
  * NOTE: this is written as `undefined` rather than `0` in the wire format.
14
14
  * Introduced and retired prior to 2.0.
15
- * Reading capability is currently maintained for backwards compatibility, but it could be removed in the future.
16
- * Writing capability need not be maintained.
15
+ * Reading and writing capability removed in 2.73.0.
17
16
  */
18
17
  undefined: 0,
19
18
  /**
20
19
  * Introduced and retired prior to 2.0.
21
- * Reading capability is currently maintained for backwards compatibility, but it could be removed in the future.
22
- * Writing capability need not be maintained.
20
+ * Reading and writing capability removed in 2.73.0.
23
21
  */
24
22
  v1: 1,
25
23
  /**
26
24
  * Introduced and retired prior to 2.0.
27
- * Reading capability is currently maintained for backwards compatibility, but it could be removed in the future.
28
- * Writing capability need not be maintained.
25
+ * Reading and writing capability removed in 2.73.0.
29
26
  */
30
27
  v2: 2,
31
28
  /**
@@ -51,6 +48,11 @@ export type MessageFormatVersion = Brand<
51
48
  (typeof MessageFormatVersion)[keyof typeof MessageFormatVersion],
52
49
  "MessageFormatVersion"
53
50
  >;
51
+ export const supportedMessageFormatVersions: ReadonlySet<MessageFormatVersion> = new Set([
52
+ MessageFormatVersion.v3,
53
+ MessageFormatVersion.v4,
54
+ MessageFormatVersion.v5,
55
+ ] as MessageFormatVersion[]);
54
56
  export const messageFormatVersions: ReadonlySet<MessageFormatVersion> = new Set(
55
57
  Object.values(MessageFormatVersion) as MessageFormatVersion[],
56
58
  );
@@ -175,22 +175,22 @@ export class TreeViewConfiguration<
175
175
  /**
176
176
  * {@inheritDoc ITreeViewConfiguration.schema}
177
177
  */
178
- public readonly schema: TSchema;
178
+ public readonly schema!: TSchema;
179
179
 
180
180
  /**
181
181
  * {@inheritDoc ITreeConfigurationOptions.enableSchemaValidation}
182
182
  */
183
- public readonly enableSchemaValidation: boolean;
183
+ public readonly enableSchemaValidation!: boolean;
184
184
 
185
185
  /**
186
186
  * {@inheritDoc ITreeConfigurationOptions.preventAmbiguity}
187
187
  */
188
- public readonly preventAmbiguity: boolean;
188
+ public readonly preventAmbiguity!: boolean;
189
189
 
190
190
  /**
191
191
  * {@link TreeSchema.definitions} but with public types.
192
192
  */
193
- protected readonly definitionsInternal: ReadonlyMap<string, TreeNodeSchema>;
193
+ protected readonly definitionsInternal!: ReadonlyMap<string, TreeNodeSchema>;
194
194
 
195
195
  /**
196
196
  * Construct a new {@link TreeViewConfiguration}.
@@ -206,6 +206,17 @@ export class TreeViewConfiguration<
206
206
  * since this would be a cyclic dependency that will cause an error when constructing this configuration.
207
207
  */
208
208
  public constructor(props: ITreeViewConfiguration<TSchema>) {
209
+ if (this.constructor === TreeViewConfiguration) {
210
+ // Ensure all TreeViewConfiguration instances are actually TreeViewConfigurationAlpha, allowing `asAlpha` to work correctly.
211
+ // If everything in TreeViewConfigurationAlpha is stabilized and this is removed, the `!` on the properties above should be removed to restore better type safety.
212
+ return new TreeViewConfigurationAlpha(props);
213
+ }
214
+ assert(
215
+ // The type cast here is needed to avoid this assert narrowing "this" to never, breaking the code below.
216
+ (this.constructor as unknown) === TreeViewConfigurationAlpha,
217
+ 0xc9e /* Invalid configuration class constructed. */,
218
+ );
219
+
209
220
  const config = { ...defaultTreeConfigurationOptions, ...props };
210
221
  this.schema = config.schema;
211
222
  this.enableSchemaValidation = config.enableSchemaValidation;
@@ -252,6 +263,8 @@ export class TreeViewConfiguration<
252
263
 
253
264
  /**
254
265
  * {@link TreeViewConfiguration} extended with some alpha APIs.
266
+ * @remarks
267
+ * See {@link (asAlpha:2)} for an API to downcast from {@link TreeViewConfiguration} to this type.
255
268
  * @sealed @alpha
256
269
  */
257
270
  export class TreeViewConfigurationAlpha<
@@ -3,21 +3,21 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import type { FieldKey, TreeNodeSchemaIdentifier } from "../../core/index.js";
7
6
  import { getTreeNodeSchemaPrivateData, type AllowedTypesFull } from "../core/index.js";
8
7
  import { isObjectNodeSchema } from "../node-kinds/index.js";
9
8
  import type { TreeSchema } from "./configuration.js";
10
9
  import type { IncrementalEncodingPolicy } from "../../feature-libraries/index.js";
11
10
  import { oneFromIterable } from "../../util/index.js";
12
11
  import { assert } from "@fluidframework/core-utils/internal";
12
+ import type { FieldKey } from "../../core/index.js";
13
13
 
14
14
  /**
15
- * A symbol when present in the {@link AnnotatedAllowedTypes.metadata.custom} property as true, opts in the allowed
15
+ * A symbol when present in the {@link AnnotatedAllowedTypes.metadata}'s `custom` property as true, opts in the allowed
16
16
  * types to incremental summary optimization.
17
17
  * These allowed types will be optimized during summary such that if they don't change across summaries,
18
18
  * they will not be encoded and their content will not be included in the summary that is uploaded to the service.
19
19
  * @remarks
20
- * See {@link getShouldIncrementallySummarizeAllowedTypes} for more details.
20
+ * See {@link incrementalEncodingPolicyForAllowedTypes} for more details.
21
21
  *
22
22
  * Use {@link SchemaStaticsBeta.types} to add this metadata to allowed types in a schema.
23
23
  * @example
@@ -29,6 +29,7 @@ import { assert } from "@fluidframework/core-utils/internal";
29
29
  * }),
30
30
  * }) {}
31
31
  * ```
32
+ * @alpha
32
33
  */
33
34
  export const incrementalSummaryHint: unique symbol = Symbol("IncrementalSummaryHint");
34
35
 
@@ -44,31 +45,30 @@ function isIncrementalSummaryHintInAllowedTypes(allowedTypes: AllowedTypesFull):
44
45
  }
45
46
 
46
47
  /**
47
- * This helper function {@link getShouldIncrementallySummarizeAllowedTypes} can be used to generate a callback function
48
- * of type {@link IncrementalEncodingPolicy}.
49
- * This callback can be passed as the value for {@link SharedTreeOptionsInternal.shouldEncodeFieldIncrementally} parameter
48
+ * This helper function {@link incrementalEncodingPolicyForAllowedTypes} can be used to generate a callback function
49
+ * of type {@link IncrementalEncodingPolicy}. It determines if each {@link AllowedTypes} in a schema should be
50
+ * incrementally summarized.
51
+ * This callback can be passed as the value for {@link SharedTreeOptions.shouldEncodeIncrementally} parameter
50
52
  * when creating the tree.
51
- * It will be called for each {@link AllowedTypes} in the schema to determine if it should be incrementally summarized.
52
53
  *
53
54
  * @param rootSchema - The schema for the root of the tree.
54
- * @returns A callback function of type {@link IncrementalEncodingPolicy} which can be used to determine if a field
55
- * should be incrementally summarized based on whether it is an allowed types with the
56
- * {@link incrementalAllowedTypesMetadata} metadata.
55
+ * @returns A callback function of type {@link IncrementalEncodingPolicy} which determines if allowed types should
56
+ * be incrementally summarized based on whether they have opted in via the {@link incrementalSummaryHint} metadata.
57
57
  *
58
58
  * @remarks
59
59
  * This only works for forest type {@link ForestTypeOptimized} and compression strategy
60
- * {@link TreeCompressionStrategyExtended.CompressedIncremental}.
60
+ * {@link TreeCompressionStrategy.CompressedIncremental}.
61
61
  *
62
- * The {@link incrementalAllowedTypesMetadata} will be replaced with a specialized metadata property once the
62
+ * @privateRemarks
63
+ * The {@link incrementalSummaryHint} will be replaced with a specialized metadata property once the
63
64
  * incremental summary feature and APIs are stabilized.
65
+ *
66
+ * @alpha
64
67
  */
65
- export function getShouldIncrementallySummarizeAllowedTypes(
68
+ export function incrementalEncodingPolicyForAllowedTypes(
66
69
  rootSchema: TreeSchema,
67
70
  ): IncrementalEncodingPolicy {
68
- return (
69
- targetNodeIdentifier: TreeNodeSchemaIdentifier | undefined,
70
- targetFieldKey: FieldKey,
71
- ) => {
71
+ return (targetNodeIdentifier: string | undefined, targetFieldKey: string) => {
72
72
  if (targetNodeIdentifier === undefined) {
73
73
  // Root fields cannot be allowed types, so we don't incrementally summarize them.
74
74
  return false;
@@ -85,7 +85,9 @@ export function getShouldIncrementallySummarizeAllowedTypes(
85
85
  }
86
86
 
87
87
  if (isObjectNodeSchema(targetNode)) {
88
- const targetPropertyKey = targetNode.storedKeyToPropertyKey.get(targetFieldKey);
88
+ const targetPropertyKey = targetNode.storedKeyToPropertyKey.get(
89
+ targetFieldKey as FieldKey,
90
+ );
89
91
  if (targetPropertyKey !== undefined) {
90
92
  const fieldSchema = targetNode.fields.get(targetPropertyKey);
91
93
  if (fieldSchema !== undefined) {
@@ -164,10 +164,15 @@ export { generateSchemaFromSimpleSchema } from "./schemaFromSimple.js";
164
164
  export { toSimpleTreeSchema } from "./viewSchemaToSimpleSchema.js";
165
165
  export type { TreeChangeEvents } from "./treeChangeEvents.js";
166
166
  export {
167
- getShouldIncrementallySummarizeAllowedTypes,
167
+ incrementalEncodingPolicyForAllowedTypes,
168
168
  incrementalSummaryHint,
169
169
  } from "./incrementalAllowedTypes.js";
170
170
  export {
171
171
  encodeSimpleSchema,
172
172
  decodeSimpleSchema,
173
173
  } from "./simpleSchemaCodec.js";
174
+ export {
175
+ exportCompatibilitySchemaSnapshot,
176
+ importCompatibilitySchemaSnapshot,
177
+ checkCompatibility,
178
+ } from "./snapshotCompatibilityChecker.js";
@@ -5,7 +5,12 @@
5
5
 
6
6
  import { unreachableCase, fail } from "@fluidframework/core-utils/internal";
7
7
 
8
- import { NodeKind, type TreeNodeSchema, type AllowedTypes } from "../core/index.js";
8
+ import {
9
+ NodeKind,
10
+ type TreeNodeSchema,
11
+ type AllowedTypesFull,
12
+ SchemaUpgrade,
13
+ } from "../core/index.js";
9
14
  import {
10
15
  type FieldSchema,
11
16
  type FieldSchemaAlpha,
@@ -88,11 +93,14 @@ function generateFieldSchema(
88
93
  function generateAllowedTypes(
89
94
  allowed: ReadonlyMap<string, SimpleAllowedTypeAttributes>,
90
95
  context: Context,
91
- ): AllowedTypes {
92
- return Array.from(
93
- allowed.keys(),
94
- (id) => context.get(id) ?? fail(0xb5a /* Missing schema */),
95
- );
96
+ ): AllowedTypesFull {
97
+ const types = Array.from(allowed.entries(), ([id, attributes]) => {
98
+ const schema = context.get(id) ?? fail(0xb5a /* Missing schema */);
99
+ return attributes.isStaged instanceof SchemaUpgrade ? factory.staged(schema) : schema;
100
+ });
101
+ // TODO: AB#53315: `AllowedTypesFullFromMixed` does not correctly handle the `(AnnotatedAllowedType | LazyItem<TreeNodeSchema>)[]` case.
102
+ // We have to cast here in order to produce an allowed types list that can be used in tree node factory methods (e.g., `SchemaFactoryAlpha.objectAlpha`).
103
+ return SchemaFactoryAlpha.types(types) as AllowedTypesFull;
96
104
  }
97
105
 
98
106
  function generateNode(
@@ -17,7 +17,7 @@ import type {
17
17
  SimpleRecordNodeSchema,
18
18
  SimpleTreeSchema,
19
19
  } from "../simpleSchema.js";
20
- import { NodeKind } from "../core/index.js";
20
+ import { createSchemaUpgrade, NodeKind, SchemaUpgrade } from "../core/index.js";
21
21
  import type { FieldKind } from "../fieldSchema.js";
22
22
  import type { ValueSchema } from "../../core/index.js";
23
23
  import { UsageError } from "@fluidframework/telemetry-utils/internal";
@@ -153,9 +153,8 @@ function encodeSimpleAllowedTypes(
153
153
  ): Format.SimpleAllowedTypesFormat {
154
154
  const encodedAllowedTypes: Format.SimpleAllowedTypesFormat = {};
155
155
  for (const [identifier, attributes] of simpleAllowedTypes) {
156
- encodedAllowedTypes[identifier] = {
157
- isStaged: attributes.isStaged,
158
- };
156
+ const isStaged = attributes.isStaged instanceof SchemaUpgrade ? true : attributes.isStaged;
157
+ encodedAllowedTypes[identifier] = { isStaged };
159
158
  }
160
159
  return encodedAllowedTypes;
161
160
  }
@@ -350,11 +349,13 @@ function decodeSimpleAllowedTypes(
350
349
  ): ReadonlyMap<string, SimpleAllowedTypeAttributes> {
351
350
  const untypedMap = objectToMap(encodedAllowedTypes);
352
351
 
353
- const simpleAllowedTypes = transformMapValues(untypedMap, (value) => {
354
- return {
355
- isStaged: value.isStaged,
356
- } satisfies SimpleAllowedTypeAttributes;
357
- });
352
+ const simpleAllowedTypes = transformMapValues(
353
+ untypedMap,
354
+ (value): SimpleAllowedTypeAttributes => {
355
+ const isStaged = value.isStaged === true ? createSchemaUpgrade() : value.isStaged;
356
+ return { isStaged };
357
+ },
358
+ );
358
359
 
359
360
  return simpleAllowedTypes;
360
361
  }
@@ -0,0 +1,135 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ import type { JsonCompatibleReadOnly } from "../../util/index.js";
7
+ import { toStoredSchema } from "../toStoredSchema.js";
8
+ import { TreeViewConfigurationAlpha, TreeViewConfiguration } from "./configuration.js";
9
+ import { SchemaCompatibilityTester } from "./schemaCompatibilityTester.js";
10
+ import { generateSchemaFromSimpleSchema } from "./schemaFromSimple.js";
11
+ import { decodeSimpleSchema, encodeSimpleSchema } from "./simpleSchemaCodec.js";
12
+ import type { SchemaCompatibilityStatus } from "./tree.js";
13
+ import { toSimpleTreeSchema } from "./viewSchemaToSimpleSchema.js";
14
+
15
+ /**
16
+ * Compute the compatibility of using `view` to {@link ViewableTree.viewWith | view a tree} who's {@link ITreeAlpha.exportSimpleSchema | stored schema} could be derived from `viewWhichCreatedStoredSchema` via either {@link TreeView.initialize} or {@link TreeView.upgradeSchema}.
17
+ *
18
+ * @remarks See {@link SchemaCompatibilityStatus} for details on the compatibility results.
19
+ *
20
+ * @example This example demonstrates checking the compatibility of a historical schema against a current schema.
21
+ * In this case, the historical schema is a Point2D object with x and y fields, while the current schema is a Point3D object
22
+ * that adds an optional z field.
23
+ *
24
+ * ```ts
25
+ * // This snapshot is assumed to be the same as Point3D, except missing `z`.
26
+ * const encodedSchema = JSON.parse(fs.readFileSync("PointSchema.json", "utf8"));
27
+ * const oldViewSchema = importCompatibilitySchemaSnapshot(encodedSchema);
28
+ *
29
+ * // Build the current view schema
30
+ * class Point3D extends factory.object("Point", {
31
+ * x: factory.number,
32
+ * y: factory.number,
33
+ *
34
+ * // The current schema has a new optional field that was not present on Point2D
35
+ * z: factory.optional(factory.number),
36
+ * }) {}
37
+ * const currentViewSchema = new TreeViewConfiguration({ schema: Point3D });
38
+ *
39
+ * // Check to see if the document created by the historical view schema can be opened with the current view schema
40
+ * const backwardsCompatibilityStatus = checkCompatibility(oldViewSchema, currentViewSchema);
41
+ *
42
+ * // z is not present in Point2D, so the schema must be upgraded
43
+ * assert.equal(backwardsCompatibilityStatus.canView, false);
44
+ *
45
+ * // The schema can be upgraded to add the new optional field
46
+ * assert.equal(backwardsCompatibilityStatus.canUpgrade, true);
47
+ *
48
+ * // Test what the old version of the application would do with a tree using the new schema:
49
+ * const forwardsCompatibilityStatus = checkCompatibility(currentViewSchema, oldViewSchema);
50
+ *
51
+ * // If the old schema set allowUnknownOptionalFields, this would be true, but since it did not,
52
+ * // this assert will fail, detecting the forwards compatibility break:
53
+ * // this means these two versions of the application cannot collaborate on content using these schema.
54
+ * assert.equal(forwardsCompatibilityStatus.canView, true);
55
+ * ```
56
+ *
57
+ * @param viewWhichCreatedStoredSchema - From which to derive the stored schema, as if it initialized or upgraded a tree via {@link TreeView}.
58
+ * @param view - The view being tested to see if it could view tree created or initialized using `viewWhichCreatedStoredSchema`.
59
+ * @returns The compatibility status.
60
+ *
61
+ * @alpha
62
+ */
63
+ export function checkCompatibility(
64
+ viewWhichCreatedStoredSchema: TreeViewConfiguration,
65
+ view: TreeViewConfiguration,
66
+ ): Omit<SchemaCompatibilityStatus, "canInitialize"> {
67
+ const viewAsAlpha = new TreeViewConfigurationAlpha({ schema: view.schema });
68
+ const stored = toStoredSchema(viewWhichCreatedStoredSchema.schema, {
69
+ includeStaged: () => true,
70
+ });
71
+ const tester = new SchemaCompatibilityTester(viewAsAlpha);
72
+ return tester.checkCompatibility(stored);
73
+ }
74
+
75
+ /**
76
+ * Returns a JSON compatible representation of the tree schema for snapshot compatibility checking.
77
+ *
78
+ * Snapshots can be loaded by the same or newer package versions, but not necessarily older versions.
79
+ *
80
+ * @see {@link importCompatibilitySchemaSnapshot} which loads these snapshots.
81
+ *
82
+ * @param config - The schema to snapshot. Only the schema field of the `TreeViewConfiguration` is used.
83
+ * @returns The JSON representation of the schema.
84
+ *
85
+ * @example This example creates and persists a snapshot of a Point2D schema.
86
+ *
87
+ * ```ts
88
+ * const schemaFactory = new SchemaFactory("test");
89
+ * class Point2D extends schemaFactory.object("Point", {
90
+ * x: factory.number,
91
+ * y: factory.number,
92
+ * }) {}
93
+ * const viewSchema = new TreeViewConfiguration({ schema: Point2D });
94
+ * const encodedSchema = JSON.stringify(exportCompatibilitySchemaSnapshot(viewSchema));
95
+ * fs.writeFileSync("PointSchema.json", encodedSchema);
96
+ * ```
97
+ *
98
+ * @alpha
99
+ */
100
+ export function exportCompatibilitySchemaSnapshot(
101
+ config: Pick<TreeViewConfiguration, "schema">,
102
+ ): JsonCompatibleReadOnly {
103
+ const simpleSchema = toSimpleTreeSchema(config.schema, true);
104
+ return encodeSimpleSchema(simpleSchema);
105
+ }
106
+
107
+ /**
108
+ * Parse the format exported by {@link exportCompatibilitySchemaSnapshot} into a schema.
109
+ *
110
+ * Can load snapshots created by the same or older package versions, but not necessarily newer versions.
111
+ *
112
+ * @see {@link exportCompatibilitySchemaSnapshot} which creates these snapshots.
113
+ *
114
+ * @param config - The JSON representation of the schema.
115
+ * @returns The schema. Only the schema field of the {@link TreeViewConfiguration} is populated.
116
+ * @throws Will throw a usage error if the encoded schema is not in the expected format.
117
+ *
118
+ * @example This example loads and parses a snapshot of a Point2D schema.
119
+ *
120
+ * ```ts;
121
+ * const oldViewSchema = importCompatibilitySchemaSnapshot(fs.readFileSync("PointSchema.json", "utf8"));
122
+ * ```
123
+ *
124
+ * @alpha
125
+ */
126
+ export function importCompatibilitySchemaSnapshot(
127
+ config: JsonCompatibleReadOnly,
128
+ ): TreeViewConfiguration {
129
+ const simpleSchema = decodeSimpleSchema(config);
130
+ const viewSchema = generateSchemaFromSimpleSchema(simpleSchema);
131
+
132
+ // We construct a TreeViewConfiguration here with the default parameters. The default set of validation parameters are fine for
133
+ // a schema produced by `generateSchemaFromSimpleSchema`.
134
+ return new TreeViewConfiguration({ schema: viewSchema.root });
135
+ }
@@ -449,7 +449,7 @@ export interface SchemaCompatibilityStatus {
449
449
  *
450
450
  * In these cases `canUpgrade` and `isEquivalent` will be false.
451
451
  *
452
- * When the documents allowed by the view schema is a strict superset of those by the stored schema,
452
+ * When the set of documents allowed by the view schema is a strict superset of those allowed by the stored schema,
453
453
  * `canView` is false because writes to the document using the view schema could make the document violate its stored schema.
454
454
  * In this case, the stored schema could be updated to match the provided view schema, allowing read-write access to the tree.
455
455
  * See {@link SchemaCompatibilityStatus.canUpgrade}.
@@ -577,7 +577,7 @@ export interface TreeViewEvents {
577
577
  /**
578
578
  * Retrieve the {@link TreeViewAlpha | alpha API} for a {@link TreeView}.
579
579
  * @alpha
580
- * @deprecated Use {@link asAlpha} instead.
580
+ * @deprecated Use {@link (asAlpha:1)} instead.
581
581
  * @privateRemarks Despite being deprecated, this function should be used within the tree package (outside of tests) rather than `asAlpha` in order to avoid circular import dependencies.
582
582
  */
583
583
  export function asTreeViewAlpha<TSchema extends ImplicitFieldSchema>(
@@ -262,7 +262,7 @@ export class AnnotatedAllowedTypesInternal<
262
262
  const simpleAllowedTypes = new Map<string, SimpleAllowedTypeAttributes>();
263
263
  for (const type of annotatedAllowedTypes.evaluate().types) {
264
264
  simpleAllowedTypes.set(type.type.identifier, {
265
- isStaged: type.metadata.stagedSchemaUpgrade !== undefined,
265
+ isStaged: type.metadata.stagedSchemaUpgrade ?? false,
266
266
  });
267
267
  }
268
268
  return simpleAllowedTypes;
@@ -65,6 +65,7 @@ export {
65
65
  createSchemaUpgrade,
66
66
  AnnotatedAllowedTypesInternal,
67
67
  normalizeAllowedTypesInternal,
68
+ SchemaUpgrade,
68
69
  } from "./allowedTypes.js";
69
70
  export type {
70
71
  AnnotatedAllowedType,
@@ -80,7 +81,6 @@ export type {
80
81
  AllowedTypeMetadata,
81
82
  AnnotatedAllowedTypes,
82
83
  AnnotateAllowedTypesList,
83
- SchemaUpgrade,
84
84
  AllowedTypesFullInternal,
85
85
  AllowedTypesFull,
86
86
  AllowedTypesFullFromMixed,
@@ -117,4 +117,6 @@ export {
117
117
  type StoredSchemaGenerationOptions,
118
118
  convertAllowedTypes,
119
119
  allowedTypeFilter,
120
+ type StoredFromViewSchemaGenerationOptions,
121
+ ExpectStored,
120
122
  } from "./toStored.js";