@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
@@ -126,14 +126,12 @@ export const EncodedSharedBranch = <ChangeSchema extends TSchema>(tChange: Chang
126
126
  export const EditManagerFormatVersion = {
127
127
  /**
128
128
  * Introduced and retired prior to 2.0.
129
- * Reading capability is currently maintained for backwards compatibility, but it could be removed in the future.
130
- * Writing capability need not be maintained.
129
+ * Reading and writing capability removed in 2.73.0.
131
130
  */
132
131
  v1: 1,
133
132
  /**
134
133
  * Introduced and retired prior to 2.0.
135
- * Reading capability is currently maintained for backwards compatibility, but it could be removed in the future.
136
- * Writing capability need not be maintained.
134
+ * Reading and writing capability removed in 2.73.0.
137
135
  */
138
136
  v2: 2,
139
137
  /**
@@ -159,12 +157,13 @@ export type EditManagerFormatVersion = Brand<
159
157
  (typeof EditManagerFormatVersion)[keyof typeof EditManagerFormatVersion],
160
158
  "EditManagerFormatVersion"
161
159
  >;
162
- export const editManagerFormatVersions: ReadonlySet<EditManagerFormatVersion> = new Set([
163
- EditManagerFormatVersion.v1,
164
- EditManagerFormatVersion.v2,
165
- EditManagerFormatVersion.v3,
166
- EditManagerFormatVersion.v4,
167
- EditManagerFormatVersion.v5,
168
- ] as EditManagerFormatVersion[]);
169
-
160
+ export const supportedEditManagerFormatVersions: ReadonlySet<EditManagerFormatVersion> =
161
+ new Set([
162
+ EditManagerFormatVersion.v3,
163
+ EditManagerFormatVersion.v4,
164
+ EditManagerFormatVersion.v5,
165
+ ] as EditManagerFormatVersion[]);
166
+ export const editManagerFormatVersions: ReadonlySet<EditManagerFormatVersion> = new Set(
167
+ Object.values(EditManagerFormatVersion) as EditManagerFormatVersion[],
168
+ );
170
169
  /* eslint-enable @typescript-eslint/explicit-function-return-type */
@@ -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<
@@ -171,3 +171,8 @@ 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
+ }
@@ -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";
@@ -4,18 +4,15 @@
4
4
  */
5
5
 
6
6
  import { brand } from "../../util/index.js";
7
- import {
8
- normalizeAndEvaluateAnnotatedAllowedTypes,
9
- type AnnotatedAllowedType,
10
- type ImplicitAllowedTypes,
11
- type SchemaUpgrade,
12
- } from "./allowedTypes.js";
7
+ import type { SchemaUpgrade } from "./allowedTypes.js";
13
8
  import type { TreeNodeSchemaIdentifier, TreeTypeSet } from "../../core/index.js";
9
+ import type { SimpleAllowedTypeAttributes, SimpleAllowedTypes } from "../simpleSchema.js";
10
+ import { UsageError } from "@fluidframework/telemetry-utils/internal";
14
11
 
15
12
  /**
16
13
  * Options for generating a {@link TreeStoredSchema} from view schema.
17
14
  */
18
- export interface StoredSchemaGenerationOptions {
15
+ export interface StoredFromViewSchemaGenerationOptions {
19
16
  /**
20
17
  * Determines whether to include staged schema in the resulting stored schema.
21
18
  * @remarks
@@ -24,6 +21,16 @@ export interface StoredSchemaGenerationOptions {
24
21
  includeStaged(upgrade: SchemaUpgrade): boolean;
25
22
  }
26
23
 
24
+ /**
25
+ * Marker type indicating that the input schema is already a stored schema.
26
+ */
27
+ export const ExpectStored = Symbol("ExpectStored");
28
+ export type ExpectStored = typeof ExpectStored;
29
+
30
+ export type StoredSchemaGenerationOptions =
31
+ | StoredFromViewSchemaGenerationOptions
32
+ | ExpectStored;
33
+
27
34
  /**
28
35
  * Filters an allowed type based on the provided options.
29
36
  * @param allowedType - The allowed type to filter.
@@ -31,30 +38,47 @@ export interface StoredSchemaGenerationOptions {
31
38
  * @returns Whether the allowed type passes the filter.
32
39
  */
33
40
  export function allowedTypeFilter(
34
- allowedType: AnnotatedAllowedType,
41
+ data: SimpleAllowedTypeAttributes,
35
42
  options: StoredSchemaGenerationOptions,
36
43
  ): boolean {
44
+ if (options === ExpectStored) {
45
+ if (data.isStaged !== undefined) {
46
+ throw new UsageError(
47
+ "Failed to covert view schema to stored schema. The simple schema provided was indicated to be a stored schema by the use of `ExpectStored`, but view schema specific content was encountered which requires a `StoredFromViewSchemaGenerationOptions` to process.",
48
+ );
49
+ }
50
+ return true;
51
+ }
52
+
53
+ if (data.isStaged === undefined) {
54
+ throw new UsageError(
55
+ "Failed to covert view schema to stored schema. The simple schema provided as the view schema was actually a stored schema. If this was intended, use `ExpectStored` for the `StoredSchemaGenerationOptions` to indicate the input is already a stored schema and only a format conversion is required.",
56
+ );
57
+ }
58
+
37
59
  // If the allowed type is staged, only include it if the options allow it.
38
- if (allowedType.metadata.stagedSchemaUpgrade !== undefined) {
39
- return options.includeStaged(allowedType.metadata.stagedSchemaUpgrade);
60
+ if (data.isStaged === false) {
61
+ return true;
40
62
  }
41
- return true;
63
+
64
+ return options.includeStaged(data.isStaged);
42
65
  }
43
66
 
44
67
  /**
45
- * Converts an ImplicitAllowedTypes to a stored schema.
68
+ * Converts a {@link SimpleAllowedTypes} to a stored schema.
46
69
  * @param schema - The schema to convert.
47
70
  * @param options - The options to use for filtering.
48
71
  * @returns The converted stored schema.
49
72
  */
50
73
  export function convertAllowedTypes(
51
- schema: ImplicitAllowedTypes,
74
+ schema: SimpleAllowedTypes,
52
75
  options: StoredSchemaGenerationOptions,
53
76
  ): TreeTypeSet {
54
- const filtered: TreeNodeSchemaIdentifier[] = normalizeAndEvaluateAnnotatedAllowedTypes(
55
- schema,
56
- )
57
- .types.filter((allowedType) => allowedTypeFilter(allowedType, options))
58
- .map((a) => brand(a.type.identifier));
77
+ const filtered: TreeNodeSchemaIdentifier[] = [];
78
+ for (const [type, data] of schema) {
79
+ if (allowedTypeFilter(data, options)) {
80
+ filtered.push(brand<TreeNodeSchemaIdentifier>(type));
81
+ }
82
+ }
59
83
  return new Set(filtered);
60
84
  }
@@ -12,10 +12,9 @@ import type { InternalTreeNode, Unhydrated } from "./types.js";
12
12
  import type { UnionToIntersection } from "../../util/index.js";
13
13
  import type { AllowedTypesFullEvaluated, AllowedTypesFull } from "./allowedTypes.js";
14
14
  import type { Context } from "./context.js";
15
- import type { FieldKey, NodeData, TreeNodeStoredSchema } from "../../core/index.js";
15
+ import type { FieldKey, NodeData } from "../../core/index.js";
16
16
  import type { UnhydratedFlexTreeField } from "./unhydratedFlexTree.js";
17
17
  import type { FactoryContent } from "../unhydratedFlexTreeFromInsertable.js";
18
- import type { StoredSchemaGenerationOptions } from "./toStored.js";
19
18
 
20
19
  /**
21
20
  * Schema for a {@link TreeNode} or {@link TreeLeafValue}.
@@ -389,11 +388,6 @@ export interface TreeNodeSchemaPrivateData {
389
388
  * Idempotent initialization function that pre-caches data and can dereference lazy schema references.
390
389
  */
391
390
  idempotentInitialize(): TreeNodeSchemaInitializedData;
392
-
393
- /**
394
- * Converts a the schema into a {@link TreeNodeStoredSchema}.
395
- */
396
- toStored(options: StoredSchemaGenerationOptions): TreeNodeStoredSchema;
397
391
  }
398
392
 
399
393
  /**
@@ -260,7 +260,6 @@ export function isClassBasedSchema(
260
260
  export function createTreeNodeSchemaPrivateData(
261
261
  schema: TreeNodeSchemaCore<string, NodeKind, boolean>,
262
262
  childAllowedTypes: readonly AllowedTypesFull[],
263
- toStored: TreeNodeSchemaPrivateData["toStored"],
264
263
  ): TreeNodeSchemaPrivateData {
265
264
  const schemaValid = schemaAsTreeNodeValid(schema);
266
265
  // Since this closes over the schema, ensure this schema is marked as most derived
@@ -270,7 +269,6 @@ export function createTreeNodeSchemaPrivateData(
270
269
  return {
271
270
  idempotentInitialize: () => schemaValid.oneTimeInitialize().oneTimeInitialized,
272
271
  childAllowedTypes,
273
- toStored,
274
272
  };
275
273
  }
276
274
 
@@ -29,7 +29,7 @@ import type {
29
29
  InsertableTreeNodeFromImplicitAllowedTypes,
30
30
  AllowedTypesFull,
31
31
  } from "./core/index.js";
32
- import { normalizeAllowedTypes } from "./core/index.js";
32
+ import { AnnotatedAllowedTypesInternal, normalizeAllowedTypes } from "./core/index.js";
33
33
 
34
34
  import type { SimpleAllowedTypeAttributes, SimpleFieldSchema } from "./simpleSchema.js";
35
35
  import type { UnsafeUnknownSchema } from "./unsafeUnknownSchema.js";
@@ -413,16 +413,7 @@ export class FieldSchemaAlpha<
413
413
  }
414
414
 
415
415
  public get simpleAllowedTypes(): ReadonlyMap<string, SimpleAllowedTypeAttributes> {
416
- const types = this.allowedTypesFull.evaluate().types;
417
- const info = new Map<string, SimpleAllowedTypeAttributes>();
418
-
419
- for (const type of types) {
420
- info.set(type.type.identifier, {
421
- isStaged: type.metadata.stagedSchemaUpgrade !== undefined,
422
- });
423
- }
424
-
425
- return info;
416
+ return AnnotatedAllowedTypesInternal.evaluateSimpleAllowedTypes(this.allowedTypesFull);
426
417
  }
427
418
 
428
419
  protected constructor(