@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
@@ -8,9 +8,9 @@ export { SharedTreeCore, } from "./sharedTreeCore.js";
8
8
  export { DefaultResubmitMachine } from "./defaultResubmitMachine.js";
9
9
  export { NoOpChangeEnricher, } from "./changeEnricher.js";
10
10
  export { makeEditManagerCodec, getCodecTreeForEditManagerFormatWithChange, clientVersionToEditManagerFormatVersion, editManagerFormatVersionSelectorForSharedBranches, } from "./editManagerCodecs.js";
11
- export { EditManagerFormatVersion, editManagerFormatVersions, } from "./editManagerFormatCommons.js";
11
+ export { EditManagerFormatVersion, supportedEditManagerFormatVersions, } from "./editManagerFormatCommons.js";
12
12
  export { EditManagerSummarizer } from "./editManagerSummarizer.js";
13
13
  export { EditManager, minimumPossibleSequenceNumber, } from "./editManager.js";
14
14
  export { getCodecTreeForMessageFormatWithChange, clientVersionToMessageFormatVersion, messageFormatVersionSelectorForSharedBranches, } from "./messageCodecs.js";
15
- export { MessageFormatVersion, messageFormatVersions } from "./messageFormat.js";
15
+ export { MessageFormatVersion, messageFormatVersions, supportedMessageFormatVersions, } from "./messageFormat.js";
16
16
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/shared-tree-core/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,gBAAgB,EAChB,gBAAgB,GAIhB,MAAM,aAAa,CAAC;AAErB,OAAO,EACN,iBAAiB,EAGjB,gBAAgB,EAChB,yBAAyB,GAGzB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACN,cAAc,GAMd,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAErE,OAAO,EAGN,kBAAkB,GAClB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACN,oBAAoB,EACpB,0CAA0C,EAE1C,uCAAuC,EACvC,iDAAiD,GACjD,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACN,wBAAwB,EACxB,yBAAyB,GACzB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EACN,WAAW,EACX,6BAA6B,GAG7B,MAAM,kBAAkB,CAAC;AAS1B,OAAO,EACN,sCAAsC,EACtC,mCAAmC,EACnC,6CAA6C,GAC7C,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\tonForkTransitive,\n\tSharedTreeBranch,\n\ttype SharedTreeBranchChange,\n\ttype SharedTreeBranchEvents,\n\ttype BranchId,\n} from \"./branch.js\";\n\nexport {\n\tTransactionResult,\n\ttype Transactor,\n\ttype TransactionEvents,\n\tTransactionStack,\n\tSquashingTransactionStack,\n\ttype OnPush,\n\ttype OnPop,\n} from \"./transaction.js\";\n\nexport {\n\tSharedTreeCore,\n\ttype Summarizable,\n\ttype SummaryElementParser,\n\ttype SummaryElementStringifier,\n\ttype ClonableSchemaAndPolicy,\n\ttype SharedTreeCoreOptionsInternal as SharedTreCoreOptionsInternal,\n} from \"./sharedTreeCore.js\";\n\nexport type { ResubmitMachine } from \"./resubmitMachine.js\";\nexport { DefaultResubmitMachine } from \"./defaultResubmitMachine.js\";\n\nexport {\n\ttype ChangeEnricherReadonlyCheckout,\n\ttype ChangeEnricherMutableCheckout,\n\tNoOpChangeEnricher,\n} from \"./changeEnricher.js\";\n\nexport {\n\tmakeEditManagerCodec,\n\tgetCodecTreeForEditManagerFormatWithChange,\n\ttype EditManagerCodecOptions,\n\tclientVersionToEditManagerFormatVersion,\n\teditManagerFormatVersionSelectorForSharedBranches,\n} from \"./editManagerCodecs.js\";\nexport {\n\tEditManagerFormatVersion,\n\teditManagerFormatVersions,\n} from \"./editManagerFormatCommons.js\";\nexport { EditManagerSummarizer } from \"./editManagerSummarizer.js\";\nexport {\n\tEditManager,\n\tminimumPossibleSequenceNumber,\n\ttype SummaryData,\n\ttype SharedBranchSummaryData,\n} from \"./editManager.js\";\nexport type {\n\tCommit,\n\tSeqNumber,\n\tSequencedCommit,\n\tSummarySessionBranch,\n\tEncodedCommit,\n} from \"./editManagerFormatCommons.js\";\n\nexport {\n\tgetCodecTreeForMessageFormatWithChange,\n\tclientVersionToMessageFormatVersion,\n\tmessageFormatVersionSelectorForSharedBranches,\n} from \"./messageCodecs.js\";\nexport { MessageFormatVersion, messageFormatVersions } from \"./messageFormat.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/shared-tree-core/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,gBAAgB,EAChB,gBAAgB,GAIhB,MAAM,aAAa,CAAC;AAErB,OAAO,EACN,iBAAiB,EAGjB,gBAAgB,EAChB,yBAAyB,GAGzB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACN,cAAc,GAMd,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAErE,OAAO,EAGN,kBAAkB,GAClB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACN,oBAAoB,EACpB,0CAA0C,EAE1C,uCAAuC,EACvC,iDAAiD,GACjD,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACN,wBAAwB,EACxB,kCAAkC,GAClC,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EACN,WAAW,EACX,6BAA6B,GAG7B,MAAM,kBAAkB,CAAC;AAS1B,OAAO,EACN,sCAAsC,EACtC,mCAAmC,EACnC,6CAA6C,GAC7C,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACN,oBAAoB,EACpB,qBAAqB,EACrB,8BAA8B,GAC9B,MAAM,oBAAoB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\tonForkTransitive,\n\tSharedTreeBranch,\n\ttype SharedTreeBranchChange,\n\ttype SharedTreeBranchEvents,\n\ttype BranchId,\n} from \"./branch.js\";\n\nexport {\n\tTransactionResult,\n\ttype Transactor,\n\ttype TransactionEvents,\n\tTransactionStack,\n\tSquashingTransactionStack,\n\ttype OnPush,\n\ttype OnPop,\n} from \"./transaction.js\";\n\nexport {\n\tSharedTreeCore,\n\ttype Summarizable,\n\ttype SummaryElementParser,\n\ttype SummaryElementStringifier,\n\ttype ClonableSchemaAndPolicy,\n\ttype SharedTreeCoreOptionsInternal,\n} from \"./sharedTreeCore.js\";\n\nexport type { ResubmitMachine } from \"./resubmitMachine.js\";\nexport { DefaultResubmitMachine } from \"./defaultResubmitMachine.js\";\n\nexport {\n\ttype ChangeEnricherReadonlyCheckout,\n\ttype ChangeEnricherMutableCheckout,\n\tNoOpChangeEnricher,\n} from \"./changeEnricher.js\";\n\nexport {\n\tmakeEditManagerCodec,\n\tgetCodecTreeForEditManagerFormatWithChange,\n\ttype EditManagerCodecOptions,\n\tclientVersionToEditManagerFormatVersion,\n\teditManagerFormatVersionSelectorForSharedBranches,\n} from \"./editManagerCodecs.js\";\nexport {\n\tEditManagerFormatVersion,\n\tsupportedEditManagerFormatVersions,\n} from \"./editManagerFormatCommons.js\";\nexport { EditManagerSummarizer } from \"./editManagerSummarizer.js\";\nexport {\n\tEditManager,\n\tminimumPossibleSequenceNumber,\n\ttype SummaryData,\n\ttype SharedBranchSummaryData,\n} from \"./editManager.js\";\nexport type {\n\tCommit,\n\tSeqNumber,\n\tSequencedCommit,\n\tSummarySessionBranch,\n\tEncodedCommit,\n} from \"./editManagerFormatCommons.js\";\n\nexport {\n\tgetCodecTreeForMessageFormatWithChange,\n\tclientVersionToMessageFormatVersion,\n\tmessageFormatVersionSelectorForSharedBranches,\n} from \"./messageCodecs.js\";\nexport {\n\tMessageFormatVersion,\n\tmessageFormatVersions,\n\tsupportedMessageFormatVersions,\n} from \"./messageFormat.js\";\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"messageCodecs.d.ts","sourceRoot":"","sources":["../../src/shared-tree-core/messageCodecs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AAC5F,OAAO,EACN,KAAK,SAAS,EACd,KAAK,iBAAiB,EACtB,KAAK,sBAAs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oB,GACzC,oBAAoB,CAQtB;AAED,MAAM,WAAW,mBAAmB;IACnC,QAAQ,CAAC,qBAAqB,CAAC,EAAE,CAChC,mBAAmB,EAAE,uBAAuB,KACxC,oBAAoB,CAAC;CAC1B;AASD;;GAEG;AACH,wBAAgB,6CAA6C,CAC5D,aAAa,EAAE,uBAAuB,GACpC,oBAAoB,CAEtB;AAED,wBAAgB,gBAAgB,CAAC,UAAU,EAC1C,YAAY,EAAE,YAAY,CAAC,UAAU,EAAE,qBAAqB,CAAC,EAC7D,4BAA4B,EAAE,sBAAsB,CAAC,oBAAoB,CAAC,EAC1E,gBAAgB,EAAE,UAAU,CAC3B,WAAW,EACX,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,CACrB,EACD,OAAO,EAAE,mBAAmB,GAAG,iBAAiB,GAC9C,UAAU,CACZ,cAAc,CAAC,UAAU,CAAC,EAC1B,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,CACtB,CASA;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAC3C,YAAY,EAAE,YAAY,CAAC,UAAU,EAAE,qBAAqB,CAAC,EAC7D,4BAA4B,EAAE,sBAAsB,CAAC,oBAAoB,CAAC,EAC1E,gBAAgB,EAAE,UAAU,CAC3B,WAAW,EACX,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,CACrB,EACD,OAAO,EAAE,aAAa,GACpB,YAAY,CAAC,cAAc,CAAC,UAAU,CAAC,EAAE,sBAAsB,CAAC,CA6ClE;AAED,wBAAgB,sCAAsC,CACrD,aAAa,EAAE,uBAAuB,EACtC,YAAY,EAAE,SAAS,GACrB,SAAS,CAMX"}
@@ -3,7 +3,8 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { unreachableCase } from "@fluidframework/core-utils/internal";
6
- import { FluidClientVersion, makeCodecFamily, makeVersionDispatchingCodec, } from "../codec/index.js";
6
+ import { getConfigForMinVersionForCollab, lowestMinVersionForCollab, } from "@fluidframework/runtime-utils/internal";
7
+ import { FluidClientVersion, makeCodecFamily, makeDiscontinuedCodecVersion, makeVersionDispatchingCodec, } from "../codec/index.js";
7
8
  import { brand } from "../util/index.js";
8
9
  import { makeV1ToV4CodecWithVersion } from "./messageCodecV1ToV4.js";
9
10
  import { makeV5CodecWithVersion } from "./messageCodecV5.js";
@@ -14,9 +15,10 @@ import { MessageFormatVersion, messageFormatVersions } from "./messageFormat.js"
14
15
  * @returns The MessageFormatVersion that corresponds to the provided MinimumVersionForCollab.
15
16
  */
16
17
  export function clientVersionToMessageFormatVersion(clientVersion, writeVersionOverride) {
17
- const compatibleVersion = clientVersion < FluidClientVersion.v2_43
18
- ? brand(MessageFormatVersion.v3)
19
- : brand(MessageFormatVersion.v4);
18
+ const compatibleVersion = brand(getConfigForMinVersionForCollab(clientVersion, {
19
+ [lowestMinVersionForCollab]: MessageFormatVersion.v3,
20
+ [FluidClientVersion.v2_43]: MessageFormatVersion.v4,
21
+ }));
20
22
  return writeVersionOverride ?? compatibleVersion;
21
23
  }
22
24
  function messageFormatVersionFromOptions(options) {
@@ -39,22 +41,31 @@ export function makeMessageCodec(changeCodecs, dependentChangeFormatVersion, rev
39
41
  */
40
42
  export function makeMessageCodecs(changeCodecs, dependentChangeFormatVersion, revisionTagCodec, options) {
41
43
  const registry = Array.from(messageFormatVersions).map((version) => {
42
- const changeCodec = changeCodecs.resolve(dependentChangeFormatVersion.lookup(version)).json;
43
44
  switch (version) {
44
45
  case MessageFormatVersion.undefined:
45
46
  case MessageFormatVersion.v1:
46
- case MessageFormatVersion.v2:
47
+ case MessageFormatVersion.v2: {
48
+ const versionOrUndefined = version === MessageFormatVersion.undefined ? undefined : version;
49
+ return [
50
+ versionOrUndefined,
51
+ makeDiscontinuedCodecVersion(options, versionOrUndefined, "2.73.0"),
52
+ ];
53
+ }
47
54
  case MessageFormatVersion.v3:
48
- case MessageFormatVersion.v4:
55
+ case MessageFormatVersion.v4: {
56
+ const changeCodec = changeCodecs.resolve(dependentChangeFormatVersion.lookup(version)).json;
49
57
  return [
50
- version === MessageFormatVersion.undefined ? undefined : version,
51
- makeV1ToV4CodecWithVersion(changeCodec, revisionTagCodec, options, version === MessageFormatVersion.undefined ? MessageFormatVersion.v1 : version),
58
+ version,
59
+ makeV1ToV4CodecWithVersion(changeCodec, revisionTagCodec, options, version),
52
60
  ];
53
- case MessageFormatVersion.v5:
61
+ }
62
+ case MessageFormatVersion.v5: {
63
+ const changeCodec = changeCodecs.resolve(dependentChangeFormatVersion.lookup(version)).json;
54
64
  return [
55
65
  version,
56
66
  makeV5CodecWithVersion(changeCodec, revisionTagCodec, options, version),
57
67
  ];
68
+ }
58
69
  default:
59
70
  unreachableCase(version);
60
71
  }
@@ -1 +1 @@
1
- {"version":3,"file":"messageCodecs.js","sourceRoot":"","sources":["../../src/shared-tree-core/messageCodecs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAEtE,OAAO,EAIN,kBAAkB,EAKlB,eAAe,EACf,2BAA2B,GAC3B,MAAM,mBAAmB,CAAC;AAO3B,OAAO,EAAE,KAAK,EAA+B,MAAM,kBAAkB,CAAC;AAItE,OAAO,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAOjF;;;;GAIG;AACH,MAAM,UAAU,mCAAmC,CAClD,aAAsC,EACtC,oBAA2C;IAE3C,MAAM,iBAAiB,GACtB,aAAa,GAAG,kBAAkB,CAAC,KAAK;QACvC,CAAC,CAAC,KAAK,CAAC,oBAAoB,CAAC,EAAE,CAAC;QAChC,CAAC,CAAC,KAAK,CAAC,oBAAoB,CAAC,EAAE,CAAC,CAAC;IACnC,OAAO,oBAAoB,IAAI,iBAAiB,CAAC;AAClD,CAAC;AAQD,SAAS,+BAA+B,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CAAC,OAAO;oBAChE,0BAA0B,CACzB,WAAW,EACX,gBAAgB,EAChB,OAAO,EACP,OAAO,KAAK,oBAAoB,CAAC,SAAS,CAAC,CAAC,CAAC,oBAAoB,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAC9E;iBACD,CAAC;YACH,KAAK,oBAAoB,CAAC,EAAE;gBAC3B,OAAO;oBACN,OAAO;oBACP,sBAAsB,CAAC,WAAW,EAAE,gBAAgB,EAAE,OAAO,EAAE,OAAO,CAAC;iBACvE,CAAC;YACH;gBACC,eAAe,CAAC,OAAO,CAAC,CAAC;QAC3B,CAAC;IACF,CAAC,CAAC,CAAC;IACH,OAAO,eAAe,CAAC,QAAQ,CAAC,CAAC;AAClC,CAAC;AAED,MAAM,UAAU,sCAAsC,CACrD,aAAsC,EACtC,YAAuB;IAEvB,OAAO;QACN,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,mCAAmC,CAAC,aAAa,CAAC;QAC3D,QAAQ,EAAE,CAAC,YAAY,CAAC;KACxB,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport type { MinimumVersionForCollab } from \"@fluidframework/runtime-definitions/internal\";\nimport {\n\ttype CodecTree,\n\ttype CodecWriteOptions,\n\ttype DependentFormatVersion,\n\tFluidClientVersion,\n\ttype FormatVersion,\n\ttype ICodecFamily,\n\ttype ICodecOptions,\n\ttype IJsonCodec,\n\tmakeCodecFamily,\n\tmakeVersionDispatchingCodec,\n} from \"../codec/index.js\";\nimport type {\n\tChangeEncodingContext,\n\tEncodedRevisionTag,\n\tRevisionTag,\n\tSchemaAndPolicy,\n} from \"../core/index.js\";\nimport { brand, type JsonCompatibleReadOnly } from \"../util/index.js\";\n\nimport type { DecodedMessage } from \"./messageTypes.js\";\nimport type { IIdCompressor } from \"@fluidframework/id-compressor\";\nimport { makeV1ToV4CodecWithVersion } from \"./messageCodecV1ToV4.js\";\nimport { makeV5CodecWithVersion } from \"./messageCodecV5.js\";\nimport { MessageFormatVersion, messageFormatVersions } from \"./messageFormat.js\";\n\nexport interface MessageEncodingContext {\n\tidCompressor: IIdCompressor;\n\tschema?: SchemaAndPolicy;\n}\n\n/**\n * Convert a MinimumVersionForCollab to a MessageFormatVersion.\n * @param clientVersion - The MinimumVersionForCollab to convert.\n * @returns The MessageFormatVersion that corresponds to the provided MinimumVersionForCollab.\n */\nexport function clientVersionToMessageFormatVersion(\n\tclientVersion: MinimumVersionForCollab,\n\twriteVersionOverride?: MessageFormatVersion,\n): MessageFormatVersion {\n\tconst compatibleVersion: MessageFormatVersion =\n\t\tclientVersion < FluidClientVersion.v2_43\n\t\t\t? brand(MessageFormatVersion.v3)\n\t\t\t: brand(MessageFormatVersion.v4);\n\treturn writeVersionOverride ?? compatibleVersion;\n}\n\nexport interface MessageCodecOptions {\n\treadonly messageFormatSelector?: (\n\t\tminVersionForCollab: MinimumVersionForCollab,\n\t) => MessageFormatVersion;\n}\n\nfunction messageFormatVersionFromOptions(\n\toptions: MessageCodecOptions & CodecWriteOptions,\n): MessageFormatVersion {\n\tconst selector = options.messageFormatSelector ?? clientVersionToMessageFormatVersion;\n\treturn selector(options.minVersionForCollab);\n}\n\n/**\n * Returns the version that should be used for testing shared branches.\n */\nexport function messageFormatVersionSelectorForSharedBranches(\n\tclientVersion: MinimumVersionForCollab,\n): MessageFormatVersion {\n\treturn brand(MessageFormatVersion.v5);\n}\n\nexport function makeMessageCodec<TChangeset>(\n\tchangeCodecs: ICodecFamily<TChangeset, ChangeEncodingContext>,\n\tdependentChangeFormatVersion: DependentFormatVersion<MessageFormatVersion>,\n\trevisionTagCodec: IJsonCodec<\n\t\tRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tChangeEncodingContext\n\t>,\n\toptions: MessageCodecOptions & CodecWriteOptions,\n): IJsonCodec<\n\tDecodedMessage<TChangeset>,\n\tJsonCompatibleReadOnly,\n\tJsonCompatibleReadOnly,\n\tMessageEncodingContext\n> {\n\tconst family = makeMessageCodecs(\n\t\tchangeCodecs,\n\t\tdependentChangeFormatVersion,\n\t\trevisionTagCodec,\n\t\toptions,\n\t);\n\tconst writeVersion = messageFormatVersionFromOptions(options);\n\treturn makeVersionDispatchingCodec(family, { ...options, writeVersion });\n}\n\n/**\n * @privateRemarks Exported for testing.\n */\nexport function makeMessageCodecs<TChangeset>(\n\tchangeCodecs: ICodecFamily<TChangeset, ChangeEncodingContext>,\n\tdependentChangeFormatVersion: DependentFormatVersion<MessageFormatVersion>,\n\trevisionTagCodec: IJsonCodec<\n\t\tRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tChangeEncodingContext\n\t>,\n\toptions: ICodecOptions,\n): ICodecFamily<DecodedMessage<TChangeset>, MessageEncodingContext> {\n\tconst registry: [\n\t\tFormatVersion,\n\t\tIJsonCodec<\n\t\t\tDecodedMessage<TChangeset>,\n\t\t\tJsonCompatibleReadOnly,\n\t\t\tJsonCompatibleReadOnly,\n\t\t\tMessageEncodingContext\n\t\t>,\n\t][] = Array.from(messageFormatVersions).map((version) => {\n\t\tconst changeCodec = changeCodecs.resolve(\n\t\t\tdependentChangeFormatVersion.lookup(version),\n\t\t).json;\n\t\tswitch (version) {\n\t\t\tcase MessageFormatVersion.undefined:\n\t\t\tcase MessageFormatVersion.v1:\n\t\t\tcase MessageFormatVersion.v2:\n\t\t\tcase MessageFormatVersion.v3:\n\t\t\tcase MessageFormatVersion.v4:\n\t\t\t\treturn [\n\t\t\t\t\tversion === MessageFormatVersion.undefined ? undefined : version,\n\t\t\t\t\tmakeV1ToV4CodecWithVersion(\n\t\t\t\t\t\tchangeCodec,\n\t\t\t\t\t\trevisionTagCodec,\n\t\t\t\t\t\toptions,\n\t\t\t\t\t\tversion === MessageFormatVersion.undefined ? MessageFormatVersion.v1 : version,\n\t\t\t\t\t),\n\t\t\t\t];\n\t\t\tcase MessageFormatVersion.v5:\n\t\t\t\treturn [\n\t\t\t\t\tversion,\n\t\t\t\t\tmakeV5CodecWithVersion(changeCodec, revisionTagCodec, options, version),\n\t\t\t\t];\n\t\t\tdefault:\n\t\t\t\tunreachableCase(version);\n\t\t}\n\t});\n\treturn makeCodecFamily(registry);\n}\n\nexport function getCodecTreeForMessageFormatWithChange(\n\tclientVersion: MinimumVersionForCollab,\n\tchangeFormat: CodecTree,\n): CodecTree {\n\treturn {\n\t\tname: \"Message\",\n\t\tversion: clientVersionToMessageFormatVersion(clientVersion),\n\t\tchildren: [changeFormat],\n\t};\n}\n"]}
1
+ {"version":3,"file":"messageCodecs.js","sourceRoot":"","sources":["../../src/shared-tree-core/messageCodecs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAEtE,OAAO,EACN,+BAA+B,EAC/B,yBAAyB,GACzB,MAAM,wCAAwC,CAAC;AAEhD,OAAO,EAIN,kBAAkB,EAKlB,eAAe,EACf,4BAA4B,EAC5B,2BAA2B,GAC3B,MAAM,mBAAmB,CAAC;AAO3B,OAAO,EAAE,KAAK,EAA+B,MAAM,kBAAkB,CAAC;AAItE,OAAO,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAOjF;;;;GAIG;AACH,MAAM,UAAU,mCAAmC,CAClD,aAAsC,EACtC,oBAA2C;IAE3C,MAAM,iBAAiB,GAAyB,KAAK,CACpD,+BAA+B,CAAC,aAAa,EAAE;QAC9C,CAAC,yBAAyB,CAAC,EAAE,oBAAoB,CAAC,EAAE;QACpD,CAAC,kBAAkB,CAAC,KAAK,CAAC,EAAE,oBAAoB,CAAC,EAAE;KACnD,CAAC,CACF,CAAC;IACF,OAAO,oBAAoB,I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E,CAAC;YACH,CAAC;YACD,KAAK,oBAAoB,CAAC,EAAE,CAAC;YAC7B,KAAK,oBAAoB,CAAC,EAAE,CAAC,CAAC,CAAC;gBAC9B,MAAM,WAAW,GAAG,YAAY,CAAC,OAAO,CACvC,4BAA4B,CAAC,MAAM,CAAC,OAAO,CAAC,CAC5C,CAAC,IAAI,CAAC;gBACP,OAAO;oBACN,OAAO;oBACP,0BAA0B,CAAC,WAAW,EAAE,gBAAgB,EAAE,OAAO,EAAE,OAAO,CAAC;iBAC3E,CAAC;YACH,CAAC;YACD,KAAK,oBAAoB,CAAC,EAAE,CAAC,CAAC,CAAC;gBAC9B,MAAM,WAAW,GAAG,YAAY,CAAC,OAAO,CACvC,4BAA4B,CAAC,MAAM,CAAC,OAAO,CAAC,CAC5C,CAAC,IAAI,CAAC;gBACP,OAAO;oBACN,OAAO;oBACP,sBAAsB,CAAC,WAAW,EAAE,gBAAgB,EAAE,OAAO,EAAE,OAAO,CAAC;iBACvE,CAAC;YACH,CAAC;YACD;gBACC,eAAe,CAAC,OAAO,CAAC,CAAC;QAC3B,CAAC;IACF,CAAC,CAAC,CAAC;IACH,OAAO,eAAe,CAAC,QAAQ,CAAC,CAAC;AAClC,CAAC;AAED,MAAM,UAAU,sCAAsC,CACrD,aAAsC,EACtC,YAAuB;IAEvB,OAAO;QACN,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,mCAAmC,CAAC,aAAa,CAAC;QAC3D,QAAQ,EAAE,CAAC,YAAY,CAAC;KACxB,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport type { MinimumVersionForCollab } from \"@fluidframework/runtime-definitions/internal\";\nimport {\n\tgetConfigForMinVersionForCollab,\n\tlowestMinVersionForCollab,\n} from \"@fluidframework/runtime-utils/internal\";\n\nimport {\n\ttype CodecTree,\n\ttype CodecWriteOptions,\n\ttype DependentFormatVersion,\n\tFluidClientVersion,\n\ttype FormatVersion,\n\ttype ICodecFamily,\n\ttype ICodecOptions,\n\ttype IJsonCodec,\n\tmakeCodecFamily,\n\tmakeDiscontinuedCodecVersion,\n\tmakeVersionDispatchingCodec,\n} from \"../codec/index.js\";\nimport type {\n\tChangeEncodingContext,\n\tEncodedRevisionTag,\n\tRevisionTag,\n\tSchemaAndPolicy,\n} from \"../core/index.js\";\nimport { brand, type JsonCompatibleReadOnly } from \"../util/index.js\";\n\nimport type { DecodedMessage } from \"./messageTypes.js\";\nimport type { IIdCompressor } from \"@fluidframework/id-compressor\";\nimport { makeV1ToV4CodecWithVersion } from \"./messageCodecV1ToV4.js\";\nimport { makeV5CodecWithVersion } from \"./messageCodecV5.js\";\nimport { MessageFormatVersion, messageFormatVersions } from \"./messageFormat.js\";\n\nexport interface MessageEncodingContext {\n\tidCompressor: IIdCompressor;\n\tschema?: SchemaAndPolicy;\n}\n\n/**\n * Convert a MinimumVersionForCollab to a MessageFormatVersion.\n * @param clientVersion - The MinimumVersionForCollab to convert.\n * @returns The MessageFormatVersion that corresponds to the provided MinimumVersionForCollab.\n */\nexport function clientVersionToMessageFormatVersion(\n\tclientVersion: MinimumVersionForCollab,\n\twriteVersionOverride?: MessageFormatVersion,\n): MessageFormatVersion {\n\tconst compatibleVersion: MessageFormatVersion = brand(\n\t\tgetConfigForMinVersionForCollab(clientVersion, {\n\t\t\t[lowestMinVersionForCollab]: MessageFormatVersion.v3,\n\t\t\t[FluidClientVersion.v2_43]: MessageFormatVersion.v4,\n\t\t}),\n\t);\n\treturn writeVersionOverride ?? compatibleVersion;\n}\n\nexport interface MessageCodecOptions {\n\treadonly messageFormatSelector?: (\n\t\tminVersionForCollab: MinimumVersionForCollab,\n\t) => MessageFormatVersion;\n}\n\nfunction messageFormatVersionFromOptions(\n\toptions: MessageCodecOptions & CodecWriteOptions,\n): MessageFormatVersion {\n\tconst selector = options.messageFormatSelector ?? clientVersionToMessageFormatVersion;\n\treturn selector(options.minVersionForCollab);\n}\n\n/**\n * Returns the version that should be used for testing shared branches.\n */\nexport function messageFormatVersionSelectorForSharedBranches(\n\tclientVersion: MinimumVersionForCollab,\n): MessageFormatVersion {\n\treturn brand(MessageFormatVersion.v5);\n}\n\nexport function makeMessageCodec<TChangeset>(\n\tchangeCodecs: ICodecFamily<TChangeset, ChangeEncodingContext>,\n\tdependentChangeFormatVersion: DependentFormatVersion<MessageFormatVersion>,\n\trevisionTagCodec: IJsonCodec<\n\t\tRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tChangeEncodingContext\n\t>,\n\toptions: MessageCodecOptions & CodecWriteOptions,\n): IJsonCodec<\n\tDecodedMessage<TChangeset>,\n\tJsonCompatibleReadOnly,\n\tJsonCompatibleReadOnly,\n\tMessageEncodingContext\n> {\n\tconst family = makeMessageCodecs(\n\t\tchangeCodecs,\n\t\tdependentChangeFormatVersion,\n\t\trevisionTagCodec,\n\t\toptions,\n\t);\n\tconst writeVersion = messageFormatVersionFromOptions(options);\n\treturn makeVersionDispatchingCodec(family, { ...options, writeVersion });\n}\n\n/**\n * @privateRemarks Exported for testing.\n */\nexport function makeMessageCodecs<TChangeset>(\n\tchangeCodecs: ICodecFamily<TChangeset, ChangeEncodingContext>,\n\tdependentChangeFormatVersion: DependentFormatVersion<MessageFormatVersion>,\n\trevisionTagCodec: IJsonCodec<\n\t\tRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tChangeEncodingContext\n\t>,\n\toptions: ICodecOptions,\n): ICodecFamily<DecodedMessage<TChangeset>, MessageEncodingContext> {\n\tconst registry: [\n\t\tFormatVersion,\n\t\tIJsonCodec<\n\t\t\tDecodedMessage<TChangeset>,\n\t\t\tJsonCompatibleReadOnly,\n\t\t\tJsonCompatibleReadOnly,\n\t\t\tMessageEncodingContext\n\t\t>,\n\t][] = Array.from(messageFormatVersions).map((version) => {\n\t\tswitch (version) {\n\t\t\tcase MessageFormatVersion.undefined:\n\t\t\tcase MessageFormatVersion.v1:\n\t\t\tcase MessageFormatVersion.v2: {\n\t\t\t\tconst versionOrUndefined =\n\t\t\t\t\tversion === MessageFormatVersion.undefined ? undefined : version;\n\t\t\t\treturn [\n\t\t\t\t\tversionOrUndefined,\n\t\t\t\t\tmakeDiscontinuedCodecVersion(options, versionOrUndefined, \"2.73.0\"),\n\t\t\t\t];\n\t\t\t}\n\t\t\tcase MessageFormatVersion.v3:\n\t\t\tcase MessageFormatVersion.v4: {\n\t\t\t\tconst changeCodec = changeCodecs.resolve(\n\t\t\t\t\tdependentChangeFormatVersion.lookup(version),\n\t\t\t\t).json;\n\t\t\t\treturn [\n\t\t\t\t\tversion,\n\t\t\t\t\tmakeV1ToV4CodecWithVersion(changeCodec, revisionTagCodec, options, version),\n\t\t\t\t];\n\t\t\t}\n\t\t\tcase MessageFormatVersion.v5: {\n\t\t\t\tconst changeCodec = changeCodecs.resolve(\n\t\t\t\t\tdependentChangeFormatVersion.lookup(version),\n\t\t\t\t).json;\n\t\t\t\treturn [\n\t\t\t\t\tversion,\n\t\t\t\t\tmakeV5CodecWithVersion(changeCodec, revisionTagCodec, options, version),\n\t\t\t\t];\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tunreachableCase(version);\n\t\t}\n\t});\n\treturn makeCodecFamily(registry);\n}\n\nexport function getCodecTreeForMessageFormatWithChange(\n\tclientVersion: MinimumVersionForCollab,\n\tchangeFormat: CodecTree,\n): CodecTree {\n\treturn {\n\t\tname: \"Message\",\n\t\tversion: clientVersionToMessageFormatVersion(clientVersion),\n\t\tchildren: [changeFormat],\n\t};\n}\n"]}
@@ -10,20 +10,17 @@ export declare const MessageFormatVersion: {
10
10
  /**
11
11
  * NOTE: this is written as `undefined` rather than `0` in the wire format.
12
12
  * Introduced and retired prior to 2.0.
13
- * Reading capability is currently maintained for backwards compatibility, but it could be removed in the future.
14
- * Writing capability need not be maintained.
13
+ * Reading and writing capability removed in 2.73.0.
15
14
  */
16
15
  readonly undefined: 0;
17
16
  /**
18
17
  * Introduced and retired prior to 2.0.
19
- * Reading capability is currently maintained for backwards compatibility, but it could be removed in the future.
20
- * Writing capability need not be maintained.
18
+ * Reading and writing capability removed in 2.73.0.
21
19
  */
22
20
  readonly v1: 1;
23
21
  /**
24
22
  * Introduced and retired prior to 2.0.
25
- * Reading capability is currently maintained for backwards compatibility, but it could be removed in the future.
26
- * Writing capability need not be maintained.
23
+ * Reading and writing capability removed in 2.73.0.
27
24
  */
28
25
  readonly v2: 2;
29
26
  /**
@@ -46,5 +43,6 @@ export declare const MessageFormatVersion: {
46
43
  readonly v5: 5;
47
44
  };
48
45
  export type MessageFormatVersion = Brand<(typeof MessageFormatVersion)[keyof typeof MessageFormatVersion], "MessageFormatVersion">;
46
+ export declare const supportedMessageFormatVersions: ReadonlySet<MessageFormatVersion>;
49
47
  export declare const messageFormatVersions: ReadonlySet<MessageFormatVersion>;
50
48
  //# sourceMappingURL=messageFormat.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"messageFormat.d.ts","sourceRoot":"","sources":["../../src/shared-tree-core/messageFormat.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAE9C;;GAEG;AACH,eAAO,MAAM,oBAAoB;IAChC;;;;;OAKG;;IAEH;;;;OAIG;;IAEH;;;;OAIG;;IAEH;;;;OAIG;;IAEH;;;;;OAKG;;IAEH;;;OAGG;;CAEM,CAAC;AACX,MAAM,MAAM,oBAAoB,GAAG,KAAK,CACvC,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,OAAO,oBAAoB,CAAC,EAChE,sBAAsB,CACtB,CAAC;AACF,eAAO,MAAM,qBAAqB,EAAE,WAAW,CAAC,oBAAoB,CAEnE,CAAC"}
1
+ {"version":3,"file":"messageFormat.d.ts","sourceRoot":"","sources":["../../src/shared-tree-core/messageFormat.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAE9C;;GAEG;AACH,eAAO,MAAM,oBAAoB;IAChC;;;;OAIG;;IAEH;;;OAGG;;IAEH;;;OAGG;;IAEH;;;;OAIG;;IAEH;;;;;OAKG;;IAEH;;;OAGG;;CAEM,CAAC;AACX,MAAM,MAAM,oBAAoB,GAAG,KAAK,CACvC,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,OAAO,oBAAoB,CAAC,EAChE,sBAAsB,CACtB,CAAC;AACF,eAAO,MAAM,8BAA8B,EAAE,WAAW,CAAC,oBAAoB,CAIjD,CAAC;AAC7B,eAAO,MAAM,qBAAqB,EAAE,WAAW,CAAC,oBAAoB,CAEnE,CAAC"}
@@ -9,20 +9,17 @@ export const MessageFormatVersion = {
9
9
  /**
10
10
  * NOTE: this is written as `undefined` rather than `0` in the wire format.
11
11
  * Introduced and retired prior to 2.0.
12
- * Reading capability is currently maintained for backwards compatibility, but it could be removed in the future.
13
- * Writing capability need not be maintained.
12
+ * Reading and writing capability removed in 2.73.0.
14
13
  */
15
14
  undefined: 0,
16
15
  /**
17
16
  * Introduced and retired prior to 2.0.
18
- * Reading capability is currently maintained for backwards compatibility, but it could be removed in the future.
19
- * Writing capability need not be maintained.
17
+ * Reading and writing capability removed in 2.73.0.
20
18
  */
21
19
  v1: 1,
22
20
  /**
23
21
  * Introduced and retired prior to 2.0.
24
- * Reading capability is currently maintained for backwards compatibility, but it could be removed in the future.
25
- * Writing capability need not be maintained.
22
+ * Reading and writing capability removed in 2.73.0.
26
23
  */
27
24
  v2: 2,
28
25
  /**
@@ -44,5 +41,10 @@ export const MessageFormatVersion = {
44
41
  */
45
42
  v5: 5,
46
43
  };
44
+ export const supportedMessageFormatVersions = new Set([
45
+ MessageFormatVersion.v3,
46
+ MessageFormatVersion.v4,
47
+ MessageFormatVersion.v5,
48
+ ]);
47
49
  export const messageFormatVersions = new Set(Object.values(MessageFormatVersion));
48
50
  //# sourceMappingURL=messageFormat.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"messageFormat.js","sourceRoot":"","sources":["../../src/shared-tree-core/messageFormat.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG;IACnC;;;;;OAKG;IACH,SAAS,EAAE,CAAC;IACZ;;;;OAIG;IACH,EAAE,EAAE,CAAC;IACL;;;;OAIG;IACH,EAAE,EAAE,CAAC;IACL;;;;OAIG;IACH,EAAE,EAAE,CAAC;IACL;;;;;OAKG;IACH,EAAE,EAAE,CAAC;IACL;;;OAGG;IACH,EAAE,EAAE,CAAC;CACI,CAAC;AAKX,MAAM,CAAC,MAAM,qBAAqB,GAAsC,IAAI,GAAG,CAC9E,MAAM,CAAC,MAAM,CAAC,oBAAoB,CAA2B,CAC7D,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { Brand } from \"../util/index.js\";\n\n/**\n * The format version for the message.\n */\nexport const MessageFormatVersion = {\n\t/**\n\t * NOTE: this is written as `undefined` rather than `0` in the wire format.\n\t * Introduced and retired prior to 2.0.\n\t * Reading capability is currently maintained for backwards compatibility, but it could be removed in the future.\n\t * Writing capability need not be maintained.\n\t */\n\tundefined: 0,\n\t/**\n\t * Introduced and retired prior to 2.0.\n\t * Reading capability is currently maintained for backwards compatibility, but it could be removed in the future.\n\t * Writing capability need not be maintained.\n\t */\n\tv1: 1,\n\t/**\n\t * Introduced and retired prior to 2.0.\n\t * Reading capability is currently maintained for backwards compatibility, but it could be removed in the future.\n\t * Writing capability need not be maintained.\n\t */\n\tv2: 2,\n\t/**\n\t * Introduced prior to 2.0 and used beyond.\n\t * Reading capability is currently maintained for backwards compatibility, but it could be removed in the future.\n\t * Writing capability needs to be maintained.\n\t */\n\tv3: 3,\n\t/**\n\t * Was inadvertently released in 2.43.0 (through usages of configuredSharedTree) and remains available.\n\t * Reading capability must be maintained for backwards compatibility.\n\t * Writing capability needs to be maintained.\n\t * @privateRemarks TODO: stop writing this version.\n\t */\n\tv4: 4,\n\t/**\n\t * Not yet released.\n\t * Only used for testing shared branches.\n\t */\n\tv5: 5,\n} as const;\nexport type MessageFormatVersion = Brand<\n\t(typeof MessageFormatVersion)[keyof typeof MessageFormatVersion],\n\t\"MessageFormatVersion\"\n>;\nexport const messageFormatVersions: ReadonlySet<MessageFormatVersion> = new Set(\n\tObject.values(MessageFormatVersion) as MessageFormatVersion[],\n);\n"]}
1
+ {"version":3,"file":"messageFormat.js","sourceRoot":"","sources":["../../src/shared-tree-core/messageFormat.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG;IACnC;;;;OAIG;IACH,SAAS,EAAE,CAAC;IACZ;;;OAGG;IACH,EAAE,EAAE,CAAC;IACL;;;OAGG;IACH,EAAE,EAAE,CAAC;IACL;;;;OAIG;IACH,EAAE,EAAE,CAAC;IACL;;;;;OAKG;IACH,EAAE,EAAE,CAAC;IACL;;;OAGG;IACH,EAAE,EAAE,CAAC;CACI,CAAC;AAKX,MAAM,CAAC,MAAM,8BAA8B,GAAsC,IAAI,GAAG,CAAC;IACxF,oBAAoB,CAAC,EAAE;IACvB,oBAAoB,CAAC,EAAE;IACvB,oBAAoB,CAAC,EAAE;CACG,CAAC,CAAC;AAC7B,MAAM,CAAC,MAAM,qBAAqB,GAAsC,IAAI,GAAG,CAC9E,MAAM,CAAC,MAAM,CAAC,oBAAoB,CAA2B,CAC7D,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { Brand } from \"../util/index.js\";\n\n/**\n * The format version for the message.\n */\nexport const MessageFormatVersion = {\n\t/**\n\t * NOTE: this is written as `undefined` rather than `0` in the wire format.\n\t * Introduced and retired prior to 2.0.\n\t * Reading and writing capability removed in 2.73.0.\n\t */\n\tundefined: 0,\n\t/**\n\t * Introduced and retired prior to 2.0.\n\t * Reading and writing capability removed in 2.73.0.\n\t */\n\tv1: 1,\n\t/**\n\t * Introduced and retired prior to 2.0.\n\t * Reading and writing capability removed in 2.73.0.\n\t */\n\tv2: 2,\n\t/**\n\t * Introduced prior to 2.0 and used beyond.\n\t * Reading capability is currently maintained for backwards compatibility, but it could be removed in the future.\n\t * Writing capability needs to be maintained.\n\t */\n\tv3: 3,\n\t/**\n\t * Was inadvertently released in 2.43.0 (through usages of configuredSharedTree) and remains available.\n\t * Reading capability must be maintained for backwards compatibility.\n\t * Writing capability needs to be maintained.\n\t * @privateRemarks TODO: stop writing this version.\n\t */\n\tv4: 4,\n\t/**\n\t * Not yet released.\n\t * Only used for testing shared branches.\n\t */\n\tv5: 5,\n} as const;\nexport type MessageFormatVersion = Brand<\n\t(typeof MessageFormatVersion)[keyof typeof MessageFormatVersion],\n\t\"MessageFormatVersion\"\n>;\nexport const supportedMessageFormatVersions: ReadonlySet<MessageFormatVersion> = new Set([\n\tMessageFormatVersion.v3,\n\tMessageFormatVersion.v4,\n\tMessageFormatVersion.v5,\n] as MessageFormatVersion[]);\nexport const messageFormatVersions: ReadonlySet<MessageFormatVersion> = new Set(\n\tObject.values(MessageFormatVersion) as MessageFormatVersion[],\n);\n"]}
@@ -153,6 +153,8 @@ export declare class TreeViewConfiguration<const TSchema extends ImplicitFieldSc
153
153
  }
154
154
  /**
155
155
  * {@link TreeViewConfiguration} extended with some alpha APIs.
156
+ * @remarks
157
+ * See {@link (asAlpha:2)} for an API to downcast from {@link TreeViewConfiguration} to this type.
156
158
  * @sealed @alpha
157
159
  */
158
160
  export declare class TreeViewConfigurationAlpha<const TSchema extends ImplicitFieldSchema = ImplicitFieldSchema> extends TreeViewConfiguration<TSchema> implements TreeSchema {
@@ -1 +1 @@
1
- {"version":3,"file":"configuration.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/configuration.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAWH,OAA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AE,gBAAgB,CAAC;IAEhC;;OAEG;IACH,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC,MAAM,EAAE,gBAAgB,GAAG,cAAc,CAAC,CAAC;CAC7E;AAWD;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CACzB,KAAK,EAAE,QAAQ,CAAC,cAAc,CAAC,EAC/B,gBAAgB,EAAE,OAAO,EACzB,eAAe,EAAE,MAAM,EAAE,GACvB,IAAI,CAmIN"}
@@ -33,6 +33,14 @@ export class TreeViewConfiguration {
33
33
  * since this would be a cyclic dependency that will cause an error when constructing this configuration.
34
34
  */
35
35
  constructor(props) {
36
+ if (this.constructor === TreeViewConfiguration) {
37
+ // Ensure all TreeViewConfiguration instances are actually TreeViewConfigurationAlpha, allowing `asAlpha` to work correctly.
38
+ // If everything in TreeViewConfigurationAlpha is stabilized and this is removed, the `!` on the properties above should be removed to restore better type safety.
39
+ return new TreeViewConfigurationAlpha(props);
40
+ }
41
+ assert(
42
+ // The type cast here is needed to avoid this assert narrowing "this" to never, breaking the code below.
43
+ this.constructor === TreeViewConfigurationAlpha, 0xc9e /* Invalid configuration class constructed. */);
36
44
  const config = { ...defaultTreeConfigurationOptions, ...props };
37
45
  this.schema = config.schema;
38
46
  this.enableSchemaValidation = config.enableSchemaValidation;
@@ -67,6 +75,8 @@ export class TreeViewConfiguration {
67
75
  }
68
76
  /**
69
77
  * {@link TreeViewConfiguration} extended with some alpha APIs.
78
+ * @remarks
79
+ * See {@link (asAlpha:2)} for an API to downcast from {@link TreeViewConfiguration} to this type.
70
80
  * @sealed @alpha
71
81
  */
72
82
  export class TreeViewConfigurationAlpha extends TreeViewConfiguration {
@@ -1 +1 @@
1
- {"version":3,"file":"configuration.js","sourceRoot":"","sources":["../../../src/simple-tree/api/configuration.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,MAAM,EACN,WAAW,EACX,IAAI,EACJ,GAAG,EACH,eAAe,GACf,MAAM,qCAAqC,CAAC;AAC7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L,CAAC;IACH,CAAC;IAED,yCAAyC;IACzC,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC9B,6DAA6D;QAC7D,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC;QAE3C,0CAA0C;QAC1C,iBAAiB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAEjC,6FAA6F;QAC7F,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;YAC1C,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS,CAAC,QAAQ,EAAE,CAAC;gBACvC,MAAM,OAAO,GAAG,aAAa,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;gBAC3E,KAAK,MAAM,SAAS,IAAI,iBAAiB,EAAE,CAAC;oBAC3C,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;wBAC7B,iBAAiB,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;oBACrC,CAAC;gBACF,CAAC;YACF,CAAC;QACF,CAAC;QAED,IAAI,iBAAiB,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC;YAChC,yCAAyC;YACzC,8EAA8E;YAC9E,kJAAkJ;YAClJ,4MAA4M;YAC5M,mJAAmJ;YAEnJ,eAAe,CAAC,IAAI,CACnB,0BAA0B,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,UAAU,CAAC,mEAAmE,WAAW,CAAC,iBAAiB,CAAC,oIAAoI,CAChS,CAAC;QACH,CAAC;IACF,CAAC;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tassert,\n\tdebugAssert,\n\tfail,\n\toob,\n\tunreachableCase,\n} from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\ttype FieldSchemaAlpha,\n\ttype ImplicitFieldSchema,\n\tFieldKind,\n\tnormalizeFieldSchema,\n} from \"../fieldSchema.js\";\nimport {\n\ttype AllowedTypesFullEvaluated,\n\tNodeKind,\n\ttype TreeNodeSchema,\n\tmarkSchemaMostDerived,\n} from \"../core/index.js\";\nimport {\n\tpermissiveStoredSchemaGenerationOptions,\n\trestrictiveStoredSchemaGenerationOptions,\n\ttoStoredSchema,\n} from \"../toStoredSchema.js\";\nimport {\n\tisArrayNodeSchema,\n\tisMapNodeSchema,\n\tisObjectNodeSchema,\n\tisRecordNodeSchema,\n\ttype ArrayNodeSchema,\n\ttype MapNodeSchema,\n\ttype ObjectNodeSchema,\n\ttype RecordNodeSchema,\n} from \"../node-kinds/index.js\";\nimport { getOrCreate } from \"../../util/index.js\";\nimport type { MakeNominal } from \"../../util/index.js\";\nimport { walkFieldSchema } from \"../walkFieldSchema.js\";\nimport type { SimpleNodeSchema, SimpleTreeSchema } from \"../simpleSchema.js\";\n\n/**\n * Options when constructing a tree view.\n * @public\n */\nexport interface ITreeConfigurationOptions {\n\t/**\n\t * If `true`, the tree will perform additional validation of content against its stored schema\n\t * and throw an error if the new content doesn't match the expected schema.\n\t *\n\t * @defaultValue `false`.\n\t *\n\t * @remarks\n\t * Currently most cases already have some schema validation, so this is mainly for additional validation which may be useful when debugging issues,\n\t * working with untyped APIs, or when the small performance overhead is a non-issue.\n\t *\n\t * Enabling schema validation has a performance penalty when inserting new content into the tree because\n\t * additional checks are done. Enable this option only in scenarios where you are ok with that operation being a\n\t * bit slower.\n\t *\n\t * For additional validation in more cases, see {@link ForestTypeExpensiveDebug}.\n\t */\n\tenableSchemaValidation?: boolean;\n\n\t/**\n\t * A flag used to opt into strict rules ensuring that the schema avoids cases which can make the type of nodes ambiguous when importing or exporting data.\n\t * @defaultValue `false`.\n\t *\n\t * @remarks\n\t * When this is true, it ensures that the compile time type safety for data when constructing nodes is sufficient to ensure that the runtime behavior will not give node data ambiguity errors.\n\t *\n\t * This ensures that the canonical JSON-like representation of all unions in the tree are lossless and unambiguous.\n\t * This canonical JSON-like representation consists of arrays, plain old JavaScript objects with string keys, booleans, numbers (excluding NaN, -0 and infinities), strings, null and {@link @fluidframework/core-interfaces#IFluidHandle}s.\n\t * It is compatible with the node creation APIs (such as schema class constructors) and is also compatible with JSON assuming any IFluidHandles get special handling (since they are not JSON compatible).\n\t * Currently these cases can cause ambiguity in a union:\n\t *\n\t * - More than one ArrayNode type: it's impossible to tell which array type is intended in the case of empty arrays (`[]`).\n\t *\n\t * - More than one MapNode type: it's impossible to tell which map type is intended in the case of an empty map (`{}`).\n\t *\n\t * - Both a MapNode and an ArrayNode: this case is not a problem for the canonical JSON representation, but is an issue when constructing from an Iterable, which is supported for both MapNode and ArrayNode.\n\t *\n\t * - Both a MapNode and an ObjectNode: when the input is valid for the ObjectNode, the current parser always considers it ambiguous with being a MapNode.\n\t *\n\t * - ObjectNodes which have fields (required or optional) which include all required fields of another ObjectNode: currently each ObjectNode is differentiated by the presence of its required fields.\n\t *\n\t * This check is conservative: some complex cases may error if the current simple algorithm cannot show no ambiguity is possible.\n\t * This check may become more permissive over time.\n\t *\n\t * @example Ambiguous schema (with `preventAmbiguity: false`), and how to disambiguate it using {@link Unhydrated} nodes:\n\t * ```typescript\n\t * const schemaFactory = new SchemaFactory(\"com.example\");\n\t * class Feet extends schemaFactory.object(\"Feet\", { length: schemaFactory.number }) {}\n\t * class Meters extends schemaFactory.object(\"Meters\", { length: schemaFactory.number }) {}\n\t * const config = new TreeViewConfiguration({\n\t * \t// This combination of schema can lead to ambiguous cases and will error if `preventAmbiguity` is true.\n\t * \tschema: [Feet, Meters],\n\t * \tpreventAmbiguity: false,\n\t * });\n\t * const view = tree.viewWith(config);\n\t * // This is invalid since it is ambiguous which type of node is being constructed:\n\t * // view.initialize({ length: 5 });\n\t * // To work, an explicit type can be provided by using an {@link Unhydrated} Node:\n\t * view.initialize(new Meters({ length: 5 }));\n\t * ```\n\t *\n\t * @example Schema disambiguated by adjusting field names, validated with `preventAmbiguity: true:`\n\t * ```typescript\n\t * const schemaFactory = new SchemaFactory(\"com.example\");\n\t * class Feet extends schemaFactory.object(\"Feet\", { length: schemaFactory.number }) {}\n\t * class Meters extends schemaFactory.object(\"Meters\", {\n\t * \t// To avoid ambiguity when parsing unions of Feet and Meters, this renames the length field to \"meters\".\n\t * \t// To preserve compatibility with existing data from the ambiguous case,\n\t * \t// `{ key: \"length\" }` is set, so when persisted in the tree \"length\" is used as the field name.\n\t * \tmeters: schemaFactory.required(schemaFactory.number, { key: \"length\" }),\n\t * }) {}\n\t * const config = new TreeViewConfiguration({\n\t * \t// This combination of schema is not ambiguous because `Feet` and `Meters` have different required keys.\n\t * \tschema: [Feet, Meters],\n\t * \tpreventAmbiguity: true,\n\t * });\n\t * const view = tree.viewWith(config);\n\t * // This now works, since the field is sufficient to determine this is a `Meters` node.\n\t * view.initialize({ meters: 5 });\n\t * ```\n\t *\n\t * @privateRemarks\n\t * In the future, we can support lossless round tripping via the canonical JSON-like representation above when unambiguous.\n\t * This could be done via methods added to `Tree` to export and import such objects, which would give us a place to explicitly define the type of this representation.\n\t *\n\t * To make this more permissive in the future we can:\n\t *\n\t * - Make unhydratedFlexTreeFromInsertable more permissive (ex: allow disambiguation based on leaf type)\n\t * - Update this check to more tightly match unhydratedFlexTreeFromInsertable\n\t * - Add options to help schema authors disambiguate their types, such as \"constant fields\" which are not persisted, and always have a constant value.\n\t *\n\t * The above examples exist in executable form in this files tests, and should be updated there then copied back here.\n\t */\n\treadonly preventAmbiguity?: boolean;\n}\n\nconst defaultTreeConfigurationOptions: Required<ITreeConfigurationOptions> = {\n\tenableSchemaValidation: false,\n\tpreventAmbiguity: false,\n};\n\n/**\n * Property-bag configuration for {@link TreeViewConfiguration} construction.\n * @public\n */\nexport interface ITreeViewConfiguration<\n\tTSchema extends ImplicitFieldSchema = ImplicitFieldSchema,\n> extends ITreeConfigurationOptions {\n\t/**\n\t * The schema which the application wants to view the tree with.\n\t */\n\treadonly schema: TSchema;\n}\n\n/**\n * Configuration for {@link ViewableTree.viewWith}.\n * @sealed @public\n */\nexport class TreeViewConfiguration<\n\tconst TSchema extends ImplicitFieldSchema = ImplicitFieldSchema,\n> implements Required<ITreeViewConfiguration<TSchema>>\n{\n\tprotected _typeCheck!: MakeNominal;\n\n\t/**\n\t * {@inheritDoc ITreeViewConfiguration.schema}\n\t */\n\tpublic readonly schema: TSchema;\n\n\t/**\n\t * {@inheritDoc ITreeConfigurationOptions.enableSchemaValidation}\n\t */\n\tpublic readonly enableSchemaValidation: boolean;\n\n\t/**\n\t * {@inheritDoc ITreeConfigurationOptions.preventAmbiguity}\n\t */\n\tpublic readonly preventAmbiguity: boolean;\n\n\t/**\n\t * {@link TreeSchema.definitions} but with public types.\n\t */\n\tprotected readonly definitionsInternal: ReadonlyMap<string, TreeNodeSchema>;\n\n\t/**\n\t * Construct a new {@link TreeViewConfiguration}.\n\t *\n\t * @param props - Property bag of configuration options.\n\t *\n\t * @remarks\n\t * Performing this construction deeply validates the provided schema.\n\t * This means that when this constructor is called, all {@link LazyItem} {@link TreeNodeSchema} references will be evaluated (using {@link evaluateLazySchema}).\n\t * This means that the declarations for all transitively reachable {@link TreeNodeSchema} must be available at this time.\n\t *\n\t * For example, a schema reachable from this configuration cannot reference this configuration during its declaration,\n\t * since this would be a cyclic dependency that will cause an error when constructing this configuration.\n\t */\n\tpublic constructor(props: ITreeViewConfiguration<TSchema>) {\n\t\tconst config = { ...defaultTreeConfigurationOptions, ...props };\n\t\tthis.schema = config.schema;\n\t\tthis.enableSchemaValidation = config.enableSchemaValidation;\n\t\tthis.preventAmbiguity = config.preventAmbiguity;\n\n\t\t// Ambiguity errors are lower priority to report than invalid schema errors, so collect these in an array and report them all at once.\n\t\tconst ambiguityErrors: string[] = [];\n\n\t\t// Eagerly perform this conversion to surface errors sooner.\n\t\t// Includes detection of duplicate schema identifiers.\n\t\ttoStoredSchema(config.schema, restrictiveStoredSchemaGenerationOptions);\n\t\ttoStoredSchema(config.schema, permissiveStoredSchemaGenerationOptions);\n\n\t\tconst definitions = new Map<string, SimpleNodeSchema & TreeNodeSchema>();\n\n\t\twalkFieldSchema(config.schema, {\n\t\t\tnode: (schema) => {\n\t\t\t\t// Ensure all reachable schema are marked as most derived.\n\t\t\t\t// This ensures if multiple schema extending the same schema factory generated class are present (or have had instances of them constructed, or get instances of them constructed in the future),\n\t\t\t\t// an error is reported.\n\t\t\t\tmarkSchemaMostDerived(schema, true);\n\n\t\t\t\tdebugAssert(() => !definitions.has(schema.identifier));\n\t\t\t\tdefinitions.set(schema.identifier, schema as SimpleNodeSchema & TreeNodeSchema);\n\t\t\t},\n\t\t\tallowedTypes({ types }: AllowedTypesFullEvaluated): void {\n\t\t\t\tcheckUnion(\n\t\t\t\t\ttypes.map((t) => t.type),\n\t\t\t\t\tconfig.preventAmbiguity,\n\t\t\t\t\tambiguityErrors,\n\t\t\t\t);\n\t\t\t},\n\t\t});\n\n\t\tthis.definitionsInternal = definitions;\n\n\t\tif (ambiguityErrors.length !== 0) {\n\t\t\t// Duplicate errors are common since when two types conflict, both orders error:\n\t\t\tconst deduplicated = new Set(ambiguityErrors);\n\t\t\tthrow new UsageError(`Ambiguous schema found:\\n${[...deduplicated].join(\"\\n\")}`);\n\t\t}\n\t}\n}\n\n/**\n * {@link TreeViewConfiguration} extended with some alpha APIs.\n * @sealed @alpha\n */\nexport class TreeViewConfigurationAlpha<\n\t\tconst TSchema extends ImplicitFieldSchema = ImplicitFieldSchema,\n\t>\n\textends TreeViewConfiguration<TSchema>\n\timplements TreeSchema\n{\n\t/**\n\t * {@inheritDoc TreeSchema.root}\n\t */\n\tpublic readonly root: FieldSchemaAlpha;\n\n\t/**\n\t * {@inheritDoc TreeSchema.definitions}\n\t */\n\tpublic get definitions(): ReadonlyMap<string, SimpleNodeSchema & TreeNodeSchema> {\n\t\treturn this.definitionsInternal as ReadonlyMap<string, SimpleNodeSchema & TreeNodeSchema>;\n\t}\n\n\tpublic constructor(props: ITreeViewConfiguration<TSchema>) {\n\t\tsuper(props);\n\t\tthis.root = normalizeFieldSchema(props.schema);\n\t}\n}\n\n/**\n * {@link TreeViewConfigurationAlpha}\n * @sealed @alpha\n */\nexport interface TreeSchema extends SimpleTreeSchema {\n\t/**\n\t * {@inheritDoc SimpleTreeSchema.root}\n\t */\n\treadonly root: FieldSchemaAlpha;\n\n\t/**\n\t * {@inheritDoc SimpleTreeSchema.definitions}\n\t */\n\treadonly definitions: ReadonlyMap<string, SimpleNodeSchema & TreeNodeSchema>;\n}\n\n/**\n * Pretty print a set of types for use in error messages.\n */\nfunction formatTypes(allowed: Iterable<TreeNodeSchema>): string {\n\t// Use JSON.stringify to quote and escape identifiers.\n\t// Don't just use a single array JSON.stringify since that omits spaces between items\n\treturn `[${Array.from(allowed, (s) => JSON.stringify(s.identifier)).join(\", \")}]`;\n}\n\n/**\n * Check if union contents are valid (shallowly).\n *\n * @param union - The union of {@link TreeNodeSchema} to check.\n * @param preventAmbiguity - If true, detect cases documented in {@link ITreeConfigurationOptions.preventAmbiguity}, reporting them to `ambiguityErrors`.\n * @param ambiguityErrors - An array into which this function inserts any ambiguity errors, see {@link ITreeConfigurationOptions.preventAmbiguity}.\n *\n * @remarks\n * Includes checks for non-ambiguity errors as well: such as duplicate schemas in the union.\n * Any non-ambiguity errors are thrown as exceptions: `UsageError`s if causable by incorrect API use, and asserts if violating internal invariants.\n */\nexport function checkUnion(\n\tunion: Iterable<TreeNodeSchema>,\n\tpreventAmbiguity: boolean,\n\tambiguityErrors: string[],\n): void {\n\tconst checked: Set<TreeNodeSchema> = new Set();\n\tconst maps: MapNodeSchema[] = [];\n\tconst arrays: ArrayNodeSchema[] = [];\n\tconst records: RecordNodeSchema[] = [];\n\tconst objects: ObjectNodeSchema[] = [];\n\n\t// Map from key to schema using that key\n\tconst allObjectKeys: Map<string, Set<TreeNodeSchema>> = new Map();\n\n\tfor (const schema of union) {\n\t\tif (checked.has(schema)) {\n\t\t\tthrow new UsageError(`Duplicate schema in allowed types: ${schema.identifier}`);\n\t\t}\n\t\tchecked.add(schema);\n\n\t\tswitch (schema.kind) {\n\t\t\tcase NodeKind.Leaf: {\n\t\t\t\t// nothing to do\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase NodeKind.Object: {\n\t\t\t\tassert(isObjectNodeSchema(schema), 0xbde /* Expected object schema. */);\n\t\t\t\tobjects.push(schema);\n\t\t\t\tfor (const key of schema.fields.keys()) {\n\t\t\t\t\tgetOrCreate(allObjectKeys, key, () => new Set()).add(schema);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase NodeKind.Array: {\n\t\t\t\tassert(isArrayNodeSchema(schema), 0xbdf /* Expected array schema. */);\n\t\t\t\tarrays.push(schema);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase NodeKind.Map: {\n\t\t\t\tassert(isMapNodeSchema(schema), 0xbe0 /* Expected map schema. */);\n\t\t\t\tmaps.push(schema);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase NodeKind.Record: {\n\t\t\t\tassert(isRecordNodeSchema(schema), 0xbe1 /* Expected record schema. */);\n\t\t\t\trecords.push(schema);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tunreachableCase(schema.kind);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (!preventAmbiguity) {\n\t\t// All remaining checks are for the preventAmbiguity case, so skip them if not enabled.\n\t\treturn;\n\t}\n\n\tif (arrays.length > 1) {\n\t\tambiguityErrors.push(\n\t\t\t`More than one kind of array allowed within union (${formatTypes(arrays)}). This would require type disambiguation which is not supported by arrays during import or export.`,\n\t\t);\n\t}\n\n\tif (maps.length > 1) {\n\t\tambiguityErrors.push(\n\t\t\t`More than one kind of map allowed within union (${formatTypes(maps)}). This would require type disambiguation which is not supported by maps during import or export.`,\n\t\t);\n\t}\n\n\tif (records.length > 1) {\n\t\tambiguityErrors.push(\n\t\t\t`More than one kind of record allowed within union (${formatTypes(records)}). This would require type disambiguation which is not supported by records during import or export.`,\n\t\t);\n\t}\n\n\tif (maps.length > 0 && arrays.length > 0) {\n\t\tambiguityErrors.push(\n\t\t\t`Both a map and an array allowed within union (${formatTypes([...arrays, ...maps])}). Both can be implicitly constructed from iterables like arrays, which are ambiguous when the array is empty.`,\n\t\t);\n\t}\n\n\tconst nodeKindListEntries = [];\n\tif (objects.length > 0) {\n\t\tnodeKindListEntries.push(\"objects\");\n\t}\n\tif (maps.length > 0) {\n\t\tnodeKindListEntries.push(\"maps\");\n\t}\n\tif (records.length > 0) {\n\t\tnodeKindListEntries.push(\"records\");\n\t}\n\tif (nodeKindListEntries.length > 1) {\n\t\tconst nodeKindListString =\n\t\t\tnodeKindListEntries.length === 2\n\t\t\t\t? `${nodeKindListEntries[0] ?? oob()} and ${nodeKindListEntries[1] ?? oob()}`\n\t\t\t\t: `${nodeKindListEntries.slice(0, -1).join(\", \")}, and ${nodeKindListEntries[nodeKindListEntries.length - 1]}`;\n\t\tambiguityErrors.push(\n\t\t\t`A combination of ${nodeKindListString} is allowed within union (${formatTypes([...objects, ...maps, ...records])}). These can be constructed from objects and can be ambiguous.`,\n\t\t);\n\t}\n\n\t// Check for objects which fully overlap:\n\tfor (const schema of objects) {\n\t\t// All objects which might be ambiguous relative to `schema`.\n\t\tconst possiblyAmbiguous = new Set(objects);\n\n\t\t// A schema can't be ambiguous with itself\n\t\tpossiblyAmbiguous.delete(schema);\n\n\t\t// For each field of schema, remove schema from possiblyAmbiguous that do not have that field\n\t\tfor (const [key, field] of schema.fields) {\n\t\t\tif (field.kind === FieldKind.Required) {\n\t\t\t\tconst withKey = allObjectKeys.get(key) ?? fail(0xb35 /* missing schema */);\n\t\t\t\tfor (const candidate of possiblyAmbiguous) {\n\t\t\t\t\tif (!withKey.has(candidate)) {\n\t\t\t\t\t\tpossiblyAmbiguous.delete(candidate);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (possiblyAmbiguous.size > 0) {\n\t\t\t// TODO: make this check more permissive.\n\t\t\t// Allow using the type of the field to disambiguate, at least for leaf types.\n\t\t\t// Add \"constant\" fields which can be used to disambiguate even more cases without adding persisted data: maybe make them optional in constructor?\n\t\t\t// Consider separating unambiguous implicit construction format from constructor arguments at type level, allowing constructor to superset the implicit construction options (ex: optional constant fields).\n\t\t\t// The policy here however must remain at least as conservative as shallowCompatibilityTest in src/simple-tree/unhydratedFlexTreeFromInsertable.ts.\n\n\t\t\tambiguityErrors.push(\n\t\t\t\t`The required fields of ${JSON.stringify(schema.identifier)} are insufficient to differentiate it from the following types: ${formatTypes(possiblyAmbiguous)}. For objects to be considered unambiguous, each must have required fields that do not all occur on any other object in the union.`,\n\t\t\t);\n\t\t}\n\t}\n}\n"]}
1
+ {"version":3,"file":"configuration.js","sourceRoot":"","sources":["../../../src/simple-tree/api/configuration.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,MAAM,EACN,WAAW,EACX,IAAI,EACJ,GAAG,EACH,eAAe,GACf,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAEtE,OAAO,EAGN,SAAS,EACT,oBAAoB,GACpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAEN,QAAQ,EAER,qBAAqB,GACrB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACN,uCAAuC,EACvC,wCAAwC,EACxC,cAAc,GACd,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACN,iBAAiB,EACjB,eAAe,EACf,kBAAkB,EAClB,kBAAkB,GAKlB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAuGxD,MAAM,+BAA+B,GAAwC;IAC5E,sBAAsB,EAAE,KAAK;IAC7B,gBAAgB,EAAE,KAAK;CACvB,CAAC;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IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;YAC1C,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS,CAAC,QAAQ,EAAE,CAAC;gBACvC,MAAM,OAAO,GAAG,aAAa,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;gBAC3E,KAAK,MAAM,SAAS,IAAI,iBAAiB,EAAE,CAAC;oBAC3C,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;wBAC7B,iBAAiB,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;oBACrC,CAAC;gBACF,CAAC;YACF,CAAC;QACF,CAAC;QAED,IAAI,iBAAiB,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC;YAChC,yCAAyC;YACzC,8EAA8E;YAC9E,kJAAkJ;YAClJ,4MAA4M;YAC5M,mJAAmJ;YAEnJ,eAAe,CAAC,IAAI,CACnB,0BAA0B,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,UAAU,CAAC,mEAAmE,WAAW,CAAC,iBAAiB,CAAC,oIAAoI,CAChS,CAAC;QACH,CAAC;IACF,CAAC;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tassert,\n\tdebugAssert,\n\tfail,\n\toob,\n\tunreachableCase,\n} from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\ttype FieldSchemaAlpha,\n\ttype ImplicitFieldSchema,\n\tFieldKind,\n\tnormalizeFieldSchema,\n} from \"../fieldSchema.js\";\nimport {\n\ttype AllowedTypesFullEvaluated,\n\tNodeKind,\n\ttype TreeNodeSchema,\n\tmarkSchemaMostDerived,\n} from \"../core/index.js\";\nimport {\n\tpermissiveStoredSchemaGenerationOptions,\n\trestrictiveStoredSchemaGenerationOptions,\n\ttoStoredSchema,\n} from \"../toStoredSchema.js\";\nimport {\n\tisArrayNodeSchema,\n\tisMapNodeSchema,\n\tisObjectNodeSchema,\n\tisRecordNodeSchema,\n\ttype ArrayNodeSchema,\n\ttype MapNodeSchema,\n\ttype ObjectNodeSchema,\n\ttype RecordNodeSchema,\n} from \"../node-kinds/index.js\";\nimport { getOrCreate } from \"../../util/index.js\";\nimport type { MakeNominal } from \"../../util/index.js\";\nimport { walkFieldSchema } from \"../walkFieldSchema.js\";\nimport type { SimpleNodeSchema, SimpleTreeSchema } from \"../simpleSchema.js\";\n\n/**\n * Options when constructing a tree view.\n * @public\n */\nexport interface ITreeConfigurationOptions {\n\t/**\n\t * If `true`, the tree will perform additional validation of content against its stored schema\n\t * and throw an error if the new content doesn't match the expected schema.\n\t *\n\t * @defaultValue `false`.\n\t *\n\t * @remarks\n\t * Currently most cases already have some schema validation, so this is mainly for additional validation which may be useful when debugging issues,\n\t * working with untyped APIs, or when the small performance overhead is a non-issue.\n\t *\n\t * Enabling schema validation has a performance penalty when inserting new content into the tree because\n\t * additional checks are done. Enable this option only in scenarios where you are ok with that operation being a\n\t * bit slower.\n\t *\n\t * For additional validation in more cases, see {@link ForestTypeExpensiveDebug}.\n\t */\n\tenableSchemaValidation?: boolean;\n\n\t/**\n\t * A flag used to opt into strict rules ensuring that the schema avoids cases which can make the type of nodes ambiguous when importing or exporting data.\n\t * @defaultValue `false`.\n\t *\n\t * @remarks\n\t * When this is true, it ensures that the compile time type safety for data when constructing nodes is sufficient to ensure that the runtime behavior will not give node data ambiguity errors.\n\t *\n\t * This ensures that the canonical JSON-like representation of all unions in the tree are lossless and unambiguous.\n\t * This canonical JSON-like representation consists of arrays, plain old JavaScript objects with string keys, booleans, numbers (excluding NaN, -0 and infinities), strings, null and {@link @fluidframework/core-interfaces#IFluidHandle}s.\n\t * It is compatible with the node creation APIs (such as schema class constructors) and is also compatible with JSON assuming any IFluidHandles get special handling (since they are not JSON compatible).\n\t * Currently these cases can cause ambiguity in a union:\n\t *\n\t * - More than one ArrayNode type: it's impossible to tell which array type is intended in the case of empty arrays (`[]`).\n\t *\n\t * - More than one MapNode type: it's impossible to tell which map type is intended in the case of an empty map (`{}`).\n\t *\n\t * - Both a MapNode and an ArrayNode: this case is not a problem for the canonical JSON representation, but is an issue when constructing from an Iterable, which is supported for both MapNode and ArrayNode.\n\t *\n\t * - Both a MapNode and an ObjectNode: when the input is valid for the ObjectNode, the current parser always considers it ambiguous with being a MapNode.\n\t *\n\t * - ObjectNodes which have fields (required or optional) which include all required fields of another ObjectNode: currently each ObjectNode is differentiated by the presence of its required fields.\n\t *\n\t * This check is conservative: some complex cases may error if the current simple algorithm cannot show no ambiguity is possible.\n\t * This check may become more permissive over time.\n\t *\n\t * @example Ambiguous schema (with `preventAmbiguity: false`), and how to disambiguate it using {@link Unhydrated} nodes:\n\t * ```typescript\n\t * const schemaFactory = new SchemaFactory(\"com.example\");\n\t * class Feet extends schemaFactory.object(\"Feet\", { length: schemaFactory.number }) {}\n\t * class Meters extends schemaFactory.object(\"Meters\", { length: schemaFactory.number }) {}\n\t * const config = new TreeViewConfiguration({\n\t * \t// This combination of schema can lead to ambiguous cases and will error if `preventAmbiguity` is true.\n\t * \tschema: [Feet, Meters],\n\t * \tpreventAmbiguity: false,\n\t * });\n\t * const view = tree.viewWith(config);\n\t * // This is invalid since it is ambiguous which type of node is being constructed:\n\t * // view.initialize({ length: 5 });\n\t * // To work, an explicit type can be provided by using an {@link Unhydrated} Node:\n\t * view.initialize(new Meters({ length: 5 }));\n\t * ```\n\t *\n\t * @example Schema disambiguated by adjusting field names, validated with `preventAmbiguity: true:`\n\t * ```typescript\n\t * const schemaFactory = new SchemaFactory(\"com.example\");\n\t * class Feet extends schemaFactory.object(\"Feet\", { length: schemaFactory.number }) {}\n\t * class Meters extends schemaFactory.object(\"Meters\", {\n\t * \t// To avoid ambiguity when parsing unions of Feet and Meters, this renames the length field to \"meters\".\n\t * \t// To preserve compatibility with existing data from the ambiguous case,\n\t * \t// `{ key: \"length\" }` is set, so when persisted in the tree \"length\" is used as the field name.\n\t * \tmeters: schemaFactory.required(schemaFactory.number, { key: \"length\" }),\n\t * }) {}\n\t * const config = new TreeViewConfiguration({\n\t * \t// This combination of schema is not ambiguous because `Feet` and `Meters` have different required keys.\n\t * \tschema: [Feet, Meters],\n\t * \tpreventAmbiguity: true,\n\t * });\n\t * const view = tree.viewWith(config);\n\t * // This now works, since the field is sufficient to determine this is a `Meters` node.\n\t * view.initialize({ meters: 5 });\n\t * ```\n\t *\n\t * @privateRemarks\n\t * In the future, we can support lossless round tripping via the canonical JSON-like representation above when unambiguous.\n\t * This could be done via methods added to `Tree` to export and import such objects, which would give us a place to explicitly define the type of this representation.\n\t *\n\t * To make this more permissive in the future we can:\n\t *\n\t * - Make unhydratedFlexTreeFromInsertable more permissive (ex: allow disambiguation based on leaf type)\n\t * - Update this check to more tightly match unhydratedFlexTreeFromInsertable\n\t * - Add options to help schema authors disambiguate their types, such as \"constant fields\" which are not persisted, and always have a constant value.\n\t *\n\t * The above examples exist in executable form in this files tests, and should be updated there then copied back here.\n\t */\n\treadonly preventAmbiguity?: boolean;\n}\n\nconst defaultTreeConfigurationOptions: Required<ITreeConfigurationOptions> = {\n\tenableSchemaValidation: false,\n\tpreventAmbiguity: false,\n};\n\n/**\n * Property-bag configuration for {@link TreeViewConfiguration} construction.\n * @public\n */\nexport interface ITreeViewConfiguration<\n\tTSchema extends ImplicitFieldSchema = ImplicitFieldSchema,\n> extends ITreeConfigurationOptions {\n\t/**\n\t * The schema which the application wants to view the tree with.\n\t */\n\treadonly schema: TSchema;\n}\n\n/**\n * Configuration for {@link ViewableTree.viewWith}.\n * @sealed @public\n */\nexport class TreeViewConfiguration<\n\tconst TSchema extends ImplicitFieldSchema = ImplicitFieldSchema,\n> implements Required<ITreeViewConfiguration<TSchema>>\n{\n\tprotected _typeCheck!: MakeNominal;\n\n\t/**\n\t * {@inheritDoc ITreeViewConfiguration.schema}\n\t */\n\tpublic readonly schema!: TSchema;\n\n\t/**\n\t * {@inheritDoc ITreeConfigurationOptions.enableSchemaValidation}\n\t */\n\tpublic readonly enableSchemaValidation!: boolean;\n\n\t/**\n\t * {@inheritDoc ITreeConfigurationOptions.preventAmbiguity}\n\t */\n\tpublic readonly preventAmbiguity!: boolean;\n\n\t/**\n\t * {@link TreeSchema.definitions} but with public types.\n\t */\n\tprotected readonly definitionsInternal!: ReadonlyMap<string, TreeNodeSchema>;\n\n\t/**\n\t * Construct a new {@link TreeViewConfiguration}.\n\t *\n\t * @param props - Property bag of configuration options.\n\t *\n\t * @remarks\n\t * Performing this construction deeply validates the provided schema.\n\t * This means that when this constructor is called, all {@link LazyItem} {@link TreeNodeSchema} references will be evaluated (using {@link evaluateLazySchema}).\n\t * This means that the declarations for all transitively reachable {@link TreeNodeSchema} must be available at this time.\n\t *\n\t * For example, a schema reachable from this configuration cannot reference this configuration during its declaration,\n\t * since this would be a cyclic dependency that will cause an error when constructing this configuration.\n\t */\n\tpublic constructor(props: ITreeViewConfiguration<TSchema>) {\n\t\tif (this.constructor === TreeViewConfiguration) {\n\t\t\t// Ensure all TreeViewConfiguration instances are actually TreeViewConfigurationAlpha, allowing `asAlpha` to work correctly.\n\t\t\t// If everything in TreeViewConfigurationAlpha is stabilized and this is removed, the `!` on the properties above should be removed to restore better type safety.\n\t\t\treturn new TreeViewConfigurationAlpha(props);\n\t\t}\n\t\tassert(\n\t\t\t// The type cast here is needed to avoid this assert narrowing \"this\" to never, breaking the code below.\n\t\t\t(this.constructor as unknown) === TreeViewConfigurationAlpha,\n\t\t\t0xc9e /* Invalid configuration class constructed. */,\n\t\t);\n\n\t\tconst config = { ...defaultTreeConfigurationOptions, ...props };\n\t\tthis.schema = config.schema;\n\t\tthis.enableSchemaValidation = config.enableSchemaValidation;\n\t\tthis.preventAmbiguity = config.preventAmbiguity;\n\n\t\t// Ambiguity errors are lower priority to report than invalid schema errors, so collect these in an array and report them all at once.\n\t\tconst ambiguityErrors: string[] = [];\n\n\t\t// Eagerly perform this conversion to surface errors sooner.\n\t\t// Includes detection of duplicate schema identifiers.\n\t\ttoStoredSchema(config.schema, restrictiveStoredSchemaGenerationOptions);\n\t\ttoStoredSchema(config.schema, permissiveStoredSchemaGenerationOptions);\n\n\t\tconst definitions = new Map<string, SimpleNodeSchema & TreeNodeSchema>();\n\n\t\twalkFieldSchema(config.schema, {\n\t\t\tnode: (schema) => {\n\t\t\t\t// Ensure all reachable schema are marked as most derived.\n\t\t\t\t// This ensures if multiple schema extending the same schema factory generated class are present (or have had instances of them constructed, or get instances of them constructed in the future),\n\t\t\t\t// an error is reported.\n\t\t\t\tmarkSchemaMostDerived(schema, true);\n\n\t\t\t\tdebugAssert(() => !definitions.has(schema.identifier));\n\t\t\t\tdefinitions.set(schema.identifier, schema as SimpleNodeSchema & TreeNodeSchema);\n\t\t\t},\n\t\t\tallowedTypes({ types }: AllowedTypesFullEvaluated): void {\n\t\t\t\tcheckUnion(\n\t\t\t\t\ttypes.map((t) => t.type),\n\t\t\t\t\tconfig.preventAmbiguity,\n\t\t\t\t\tambiguityErrors,\n\t\t\t\t);\n\t\t\t},\n\t\t});\n\n\t\tthis.definitionsInternal = definitions;\n\n\t\tif (ambiguityErrors.length !== 0) {\n\t\t\t// Duplicate errors are common since when two types conflict, both orders error:\n\t\t\tconst deduplicated = new Set(ambiguityErrors);\n\t\t\tthrow new UsageError(`Ambiguous schema found:\\n${[...deduplicated].join(\"\\n\")}`);\n\t\t}\n\t}\n}\n\n/**\n * {@link TreeViewConfiguration} extended with some alpha APIs.\n * @remarks\n * See {@link (asAlpha:2)} for an API to downcast from {@link TreeViewConfiguration} to this type.\n * @sealed @alpha\n */\nexport class TreeViewConfigurationAlpha<\n\t\tconst TSchema extends ImplicitFieldSchema = ImplicitFieldSchema,\n\t>\n\textends TreeViewConfiguration<TSchema>\n\timplements TreeSchema\n{\n\t/**\n\t * {@inheritDoc TreeSchema.root}\n\t */\n\tpublic readonly root: FieldSchemaAlpha;\n\n\t/**\n\t * {@inheritDoc TreeSchema.definitions}\n\t */\n\tpublic get definitions(): ReadonlyMap<string, SimpleNodeSchema & TreeNodeSchema> {\n\t\treturn this.definitionsInternal as ReadonlyMap<string, SimpleNodeSchema & TreeNodeSchema>;\n\t}\n\n\tpublic constructor(props: ITreeViewConfiguration<TSchema>) {\n\t\tsuper(props);\n\t\tthis.root = normalizeFieldSchema(props.schema);\n\t}\n}\n\n/**\n * {@link TreeViewConfigurationAlpha}\n * @sealed @alpha\n */\nexport interface TreeSchema extends SimpleTreeSchema {\n\t/**\n\t * {@inheritDoc SimpleTreeSchema.root}\n\t */\n\treadonly root: FieldSchemaAlpha;\n\n\t/**\n\t * {@inheritDoc SimpleTreeSchema.definitions}\n\t */\n\treadonly definitions: ReadonlyMap<string, SimpleNodeSchema & TreeNodeSchema>;\n}\n\n/**\n * Pretty print a set of types for use in error messages.\n */\nfunction formatTypes(allowed: Iterable<TreeNodeSchema>): string {\n\t// Use JSON.stringify to quote and escape identifiers.\n\t// Don't just use a single array JSON.stringify since that omits spaces between items\n\treturn `[${Array.from(allowed, (s) => JSON.stringify(s.identifier)).join(\", \")}]`;\n}\n\n/**\n * Check if union contents are valid (shallowly).\n *\n * @param union - The union of {@link TreeNodeSchema} to check.\n * @param preventAmbiguity - If true, detect cases documented in {@link ITreeConfigurationOptions.preventAmbiguity}, reporting them to `ambiguityErrors`.\n * @param ambiguityErrors - An array into which this function inserts any ambiguity errors, see {@link ITreeConfigurationOptions.preventAmbiguity}.\n *\n * @remarks\n * Includes checks for non-ambiguity errors as well: such as duplicate schemas in the union.\n * Any non-ambiguity errors are thrown as exceptions: `UsageError`s if causable by incorrect API use, and asserts if violating internal invariants.\n */\nexport function checkUnion(\n\tunion: Iterable<TreeNodeSchema>,\n\tpreventAmbiguity: boolean,\n\tambiguityErrors: string[],\n): void {\n\tconst checked: Set<TreeNodeSchema> = new Set();\n\tconst maps: MapNodeSchema[] = [];\n\tconst arrays: ArrayNodeSchema[] = [];\n\tconst records: RecordNodeSchema[] = [];\n\tconst objects: ObjectNodeSchema[] = [];\n\n\t// Map from key to schema using that key\n\tconst allObjectKeys: Map<string, Set<TreeNodeSchema>> = new Map();\n\n\tfor (const schema of union) {\n\t\tif (checked.has(schema)) {\n\t\t\tthrow new UsageError(`Duplicate schema in allowed types: ${schema.identifier}`);\n\t\t}\n\t\tchecked.add(schema);\n\n\t\tswitch (schema.kind) {\n\t\t\tcase NodeKind.Leaf: {\n\t\t\t\t// nothing to do\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase NodeKind.Object: {\n\t\t\t\tassert(isObjectNodeSchema(schema), 0xbde /* Expected object schema. */);\n\t\t\t\tobjects.push(schema);\n\t\t\t\tfor (const key of schema.fields.keys()) {\n\t\t\t\t\tgetOrCreate(allObjectKeys, key, () => new Set()).add(schema);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase NodeKind.Array: {\n\t\t\t\tassert(isArrayNodeSchema(schema), 0xbdf /* Expected array schema. */);\n\t\t\t\tarrays.push(schema);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase NodeKind.Map: {\n\t\t\t\tassert(isMapNodeSchema(schema), 0xbe0 /* Expected map schema. */);\n\t\t\t\tmaps.push(schema);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase NodeKind.Record: {\n\t\t\t\tassert(isRecordNodeSchema(schema), 0xbe1 /* Expected record schema. */);\n\t\t\t\trecords.push(schema);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tunreachableCase(schema.kind);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (!preventAmbiguity) {\n\t\t// All remaining checks are for the preventAmbiguity case, so skip them if not enabled.\n\t\treturn;\n\t}\n\n\tif (arrays.length > 1) {\n\t\tambiguityErrors.push(\n\t\t\t`More than one kind of array allowed within union (${formatTypes(arrays)}). This would require type disambiguation which is not supported by arrays during import or export.`,\n\t\t);\n\t}\n\n\tif (maps.length > 1) {\n\t\tambiguityErrors.push(\n\t\t\t`More than one kind of map allowed within union (${formatTypes(maps)}). This would require type disambiguation which is not supported by maps during import or export.`,\n\t\t);\n\t}\n\n\tif (records.length > 1) {\n\t\tambiguityErrors.push(\n\t\t\t`More than one kind of record allowed within union (${formatTypes(records)}). This would require type disambiguation which is not supported by records during import or export.`,\n\t\t);\n\t}\n\n\tif (maps.length > 0 && arrays.length > 0) {\n\t\tambiguityErrors.push(\n\t\t\t`Both a map and an array allowed within union (${formatTypes([...arrays, ...maps])}). Both can be implicitly constructed from iterables like arrays, which are ambiguous when the array is empty.`,\n\t\t);\n\t}\n\n\tconst nodeKindListEntries = [];\n\tif (objects.length > 0) {\n\t\tnodeKindListEntries.push(\"objects\");\n\t}\n\tif (maps.length > 0) {\n\t\tnodeKindListEntries.push(\"maps\");\n\t}\n\tif (records.length > 0) {\n\t\tnodeKindListEntries.push(\"records\");\n\t}\n\tif (nodeKindListEntries.length > 1) {\n\t\tconst nodeKindListString =\n\t\t\tnodeKindListEntries.length === 2\n\t\t\t\t? `${nodeKindListEntries[0] ?? oob()} and ${nodeKindListEntries[1] ?? oob()}`\n\t\t\t\t: `${nodeKindListEntries.slice(0, -1).join(\", \")}, and ${nodeKindListEntries[nodeKindListEntries.length - 1]}`;\n\t\tambiguityErrors.push(\n\t\t\t`A combination of ${nodeKindListString} is allowed within union (${formatTypes([...objects, ...maps, ...records])}). These can be constructed from objects and can be ambiguous.`,\n\t\t);\n\t}\n\n\t// Check for objects which fully overlap:\n\tfor (const schema of objects) {\n\t\t// All objects which might be ambiguous relative to `schema`.\n\t\tconst possiblyAmbiguous = new Set(objects);\n\n\t\t// A schema can't be ambiguous with itself\n\t\tpossiblyAmbiguous.delete(schema);\n\n\t\t// For each field of schema, remove schema from possiblyAmbiguous that do not have that field\n\t\tfor (const [key, field] of schema.fields) {\n\t\t\tif (field.kind === FieldKind.Required) {\n\t\t\t\tconst withKey = allObjectKeys.get(key) ?? fail(0xb35 /* missing schema */);\n\t\t\t\tfor (const candidate of possiblyAmbiguous) {\n\t\t\t\t\tif (!withKey.has(candidate)) {\n\t\t\t\t\t\tpossiblyAmbiguous.delete(candidate);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (possiblyAmbiguous.size > 0) {\n\t\t\t// TODO: make this check more permissive.\n\t\t\t// Allow using the type of the field to disambiguate, at least for leaf types.\n\t\t\t// Add \"constant\" fields which can be used to disambiguate even more cases without adding persisted data: maybe make them optional in constructor?\n\t\t\t// Consider separating unambiguous implicit construction format from constructor arguments at type level, allowing constructor to superset the implicit construction options (ex: optional constant fields).\n\t\t\t// The policy here however must remain at least as conservative as shallowCompatibilityTest in src/simple-tree/unhydratedFlexTreeFromInsertable.ts.\n\n\t\t\tambiguityErrors.push(\n\t\t\t\t`The required fields of ${JSON.stringify(schema.identifier)} are insufficient to differentiate it from the following types: ${formatTypes(possiblyAmbiguous)}. For objects to be considered unambiguous, each must have required fields that do not all occur on any other object in the union.`,\n\t\t\t);\n\t\t}\n\t}\n}\n"]}
@@ -5,12 +5,12 @@
5
5
  import type { TreeSchema } from "./configuration.js";
6
6
  import type { IncrementalEncodingPolicy } from "../../feature-libraries/index.js";
7
7
  /**
8
- * A symbol when present in the {@link AnnotatedAllowedTypes.metadata.custom} property as true, opts in the allowed
8
+ * A symbol when present in the {@link AnnotatedAllowedTypes.metadata}'s `custom` property as true, opts in the allowed
9
9
  * types to incremental summary optimization.
10
10
  * These allowed types will be optimized during summary such that if they don't change across summaries,
11
11
  * they will not be encoded and their content will not be included in the summary that is uploaded to the service.
12
12
  * @remarks
13
- * See {@link getShouldIncrementallySummarizeAllowedTypes} for more details.
13
+ * See {@link incrementalEncodingPolicyForAllowedTypes} for more details.
14
14
  *
15
15
  * Use {@link SchemaStaticsBeta.types} to add this metadata to allowed types in a schema.
16
16
  * @example
@@ -22,26 +22,29 @@ import type { IncrementalEncodingPolicy } from "../../feature-libraries/index.js
22
22
  * }),
23
23
  * }) {}
24
24
  * ```
25
+ * @alpha
25
26
  */
26
27
  export declare const incrementalSummaryHint: unique symbol;
27
28
  /**
28
- * This helper function {@link getShouldIncrementallySummarizeAllowedTypes} can be used to generate a callback function
29
- * of type {@link IncrementalEncodingPolicy}.
30
- * This callback can be passed as the value for {@link SharedTreeOptionsInternal.shouldEncodeFieldIncrementally} parameter
29
+ * This helper function {@link incrementalEncodingPolicyForAllowedTypes} can be used to generate a callback function
30
+ * of type {@link IncrementalEncodingPolicy}. It determines if each {@link AllowedTypes} in a schema should be
31
+ * incrementally summarized.
32
+ * This callback can be passed as the value for {@link SharedTreeOptions.shouldEncodeIncrementally} parameter
31
33
  * when creating the tree.
32
- * It will be called for each {@link AllowedTypes} in the schema to determine if it should be incrementally summarized.
33
34
  *
34
35
  * @param rootSchema - The schema for the root of the tree.
35
- * @returns A callback function of type {@link IncrementalEncodingPolicy} which can be used to determine if a field
36
- * should be incrementally summarized based on whether it is an allowed types with the
37
- * {@link incrementalAllowedTypesMetadata} metadata.
36
+ * @returns A callback function of type {@link IncrementalEncodingPolicy} which determines if allowed types should
37
+ * be incrementally summarized based on whether they have opted in via the {@link incrementalSummaryHint} metadata.
38
38
  *
39
39
  * @remarks
40
40
  * This only works for forest type {@link ForestTypeOptimized} and compression strategy
41
- * {@link TreeCompressionStrategyExtended.CompressedIncremental}.
41
+ * {@link TreeCompressionStrategy.CompressedIncremental}.
42
42
  *
43
- * The {@link incrementalAllowedTypesMetadata} will be replaced with a specialized metadata property once the
43
+ * @privateRemarks
44
+ * The {@link incrementalSummaryHint} will be replaced with a specialized metadata property once the
44
45
  * incremental summary feature and APIs are stabilized.
46
+ *
47
+ * @alpha
45
48
  */
46
- export declare function getShouldIncrementallySummarizeAllowedTypes(rootSchema: TreeSchema): IncrementalEncodingPolicy;
49
+ export declare function incrementalEncodingPolicyForAllowedTypes(rootSchema: TreeSchema): IncrementalEncodingPolicy;
47
50
  //# sourceMappingURL=incrementalAllowedTypes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"incrementalAllowedTypes.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/incrementalAllowedTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAIlF;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,sBAAsB,EAAE,OAAO,MAAyC,CAAC;AAatF;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,2CAA2C,CAC1D,UAAU,EAAE,UAAU,GACpB,yBAAyB,CAwC3B"}
1
+ {"version":3,"file":"incrementalAllowedTypes.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/incrementalAllowedTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAKlF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,sBAAsB,EAAE,OAAO,MAAyC,CAAC;AAatF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,wCAAwC,CACvD,UAAU,EAAE,UAAU,GACpB,yBAAyB,CAuC3B"}
@@ -7,12 +7,12 @@ import { isObjectNodeSchema } from "../node-kinds/index.js";
7
7
  import { oneFromIterable } from "../../util/index.js";
8
8
  import { assert } from "@fluidframework/core-utils/internal";
9
9
  /**
10
- * A symbol when present in the {@link AnnotatedAllowedTypes.metadata.custom} property as true, opts in the allowed
10
+ * A symbol when present in the {@link AnnotatedAllowedTypes.metadata}'s `custom` property as true, opts in the allowed
11
11
  * types to incremental summary optimization.
12
12
  * These allowed types will be optimized during summary such that if they don't change across summaries,
13
13
  * they will not be encoded and their content will not be included in the summary that is uploaded to the service.
14
14
  * @remarks
15
- * See {@link getShouldIncrementallySummarizeAllowedTypes} for more details.
15
+ * See {@link incrementalEncodingPolicyForAllowedTypes} for more details.
16
16
  *
17
17
  * Use {@link SchemaStaticsBeta.types} to add this metadata to allowed types in a schema.
18
18
  * @example
@@ -24,6 +24,7 @@ import { assert } from "@fluidframework/core-utils/internal";
24
24
  * }),
25
25
  * }) {}
26
26
  * ```
27
+ * @alpha
27
28
  */
28
29
  export const incrementalSummaryHint = Symbol("IncrementalSummaryHint");
29
30
  /**
@@ -35,25 +36,27 @@ function isIncrementalSummaryHintInAllowedTypes(allowedTypes) {
35
36
  customMetadata[incrementalSummaryHint] === true);
36
37
  }
37
38
  /**
38
- * This helper function {@link getShouldIncrementallySummarizeAllowedTypes} can be used to generate a callback function
39
- * of type {@link IncrementalEncodingPolicy}.
40
- * This callback can be passed as the value for {@link SharedTreeOptionsInternal.shouldEncodeFieldIncrementally} parameter
39
+ * This helper function {@link incrementalEncodingPolicyForAllowedTypes} can be used to generate a callback function
40
+ * of type {@link IncrementalEncodingPolicy}. It determines if each {@link AllowedTypes} in a schema should be
41
+ * incrementally summarized.
42
+ * This callback can be passed as the value for {@link SharedTreeOptions.shouldEncodeIncrementally} parameter
41
43
  * when creating the tree.
42
- * It will be called for each {@link AllowedTypes} in the schema to determine if it should be incrementally summarized.
43
44
  *
44
45
  * @param rootSchema - The schema for the root of the tree.
45
- * @returns A callback function of type {@link IncrementalEncodingPolicy} which can be used to determine if a field
46
- * should be incrementally summarized based on whether it is an allowed types with the
47
- * {@link incrementalAllowedTypesMetadata} metadata.
46
+ * @returns A callback function of type {@link IncrementalEncodingPolicy} which determines if allowed types should
47
+ * be incrementally summarized based on whether they have opted in via the {@link incrementalSummaryHint} metadata.
48
48
  *
49
49
  * @remarks
50
50
  * This only works for forest type {@link ForestTypeOptimized} and compression strategy
51
- * {@link TreeCompressionStrategyExtended.CompressedIncremental}.
51
+ * {@link TreeCompressionStrategy.CompressedIncremental}.
52
52
  *
53
- * The {@link incrementalAllowedTypesMetadata} will be replaced with a specialized metadata property once the
53
+ * @privateRemarks
54
+ * The {@link incrementalSummaryHint} will be replaced with a specialized metadata property once the
54
55
  * incremental summary feature and APIs are stabilized.
56
+ *
57
+ * @alpha
55
58
  */
56
- export function getShouldIncrementallySummarizeAllowedTypes(rootSchema) {
59
+ export function incrementalEncodingPolicyForAllowedTypes(rootSchema) {
57
60
  return (targetNodeIdentifier, targetFieldKey) => {
58
61
  if (targetNodeIdentifier === undefined) {
59
62
  // Root fields cannot be allowed types, so we don't incrementally summarize them.
@@ -1 +1 @@
1
- {"version":3,"file":"incrementalAllowedTypes.js","sourceRoot":"","sources":["../../../src/simple-tree/api/incrementalAllowedTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,4BAA4B,EAAyB,MAAM,kBAAkB,CAAC;AACvF,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAG5D,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAE7D;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAkB,MAAM,CAAC,wBAAwB,CAAC,CAAC;AAEtF;;GAEG;AACH,SAAS,sCAAsC,CAAC,YAA8B;IAC7E,MAAM,cAAc,GAAG,YAAY,CAAC,QAAQ,CAAC,MAAM,CAAC;IACpD,OAAO,CACN,cAAc,KAAK,SAAS;QAC3B,cAA0C,CAAC,sBAAsB,CAAC,KAAK,IAAI,CAC5E,CAAC;AACH,CAAC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,2CAA2C,CAC1D,UAAsB;IAEtB,OAAO,CACN,oBAA0D,EAC1D,cAAwB,EACvB,EAAE;QACH,IAAI,oBAAoB,KAAK,SAAS,EAAE,CAAC;YACxC,iFAAiF;YACjF,OAAO,KAAK,CAAC;QACd,CAAC;QAED,MAAM,UAAU,GAAG,UAAU,CAAC,WAAW,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;QACpE,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;YAC9B,gDAAgD;YAChD,mIAAmI;YACnI,sCAAsC;YACtC,kEAAkE;YAClE,oIAAoI;YACpI,OAAO,KAAK,CAAC;QACd,CAAC;QAED,IAAI,kBAAkB,CAAC,UAAU,CAAC,EAAE,CAAC;YACpC,MAAM,iBAAiB,GAAG,UAAU,CAAC,sBAAsB,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;YAChF,IAAI,iBAAiB,KAAK,SAAS,EAAE,CAAC;gBACrC,MAAM,WAAW,GAAG,UAAU,CAAC,MAAM,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;gBAC7D,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;oBAC/B,OAAO,sCAAsC,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC;gBAC7E,CAAC;YACF,CAAC;YACD,OAAO,KAAK,CAAC;QACd,CAAC;QAED,MAAM,YAAY,GAAG,eAAe,CACnC,4BAA4B,CAAC,UAAU,CAAC,CAAC,iBAAiB,CAC1D,CAAC;QACF,MAAM,CACL,YAAY,KAAK,SAAS,EAC1B,KAAK,CAAC,0EAA0E,CAChF,CAAC;QACF,OAAO,sCAAsC,CAAC,YAAY,CAAC,CAAC;IAC7D,CAAC,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { FieldKey, TreeNodeSchemaIdentifier } from \"../../core/index.js\";\nimport { getTreeNodeSchemaPrivateData, type AllowedTypesFull } from \"../core/index.js\";\nimport { isObjectNodeSchema } from \"../node-kinds/index.js\";\nimport type { TreeSchema } from \"./configuration.js\";\nimport type { IncrementalEncodingPolicy } from \"../../feature-libraries/index.js\";\nimport { oneFromIterable } from \"../../util/index.js\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\n\n/**\n * A symbol when present in the {@link AnnotatedAllowedTypes.metadata.custom} property as true, opts in the allowed\n * types to incremental summary optimization.\n * These allowed types will be optimized during summary such that if they don't change across summaries,\n * they will not be encoded and their content will not be included in the summary that is uploaded to the service.\n * @remarks\n * See {@link getShouldIncrementallySummarizeAllowedTypes} for more details.\n *\n * Use {@link SchemaStaticsBeta.types} to add this metadata to allowed types in a schema.\n * @example\n * ```typescript\n * const sf = new SchemaFactoryAlpha(\"IncrementalSummarization\");\n * class Foo extends sf.objectAlpha(\"foo\", {\n * bar: sf.types([{ type: sf.string, metadata: {} }], {\n * custom: { [incrementalSummaryHint]: true },\n * }),\n * }) {}\n * ```\n */\nexport const incrementalSummaryHint: unique symbol = Symbol(\"IncrementalSummaryHint\");\n\n/**\n * Returns true if the provided allowed types's custom metadata has {@link incrementalSummaryHint} as true.\n */\nfunction isIncrementalSummaryHintInAllowedTypes(allowedTypes: AllowedTypesFull): boolean {\n\tconst customMetadata = allowedTypes.metadata.custom;\n\treturn (\n\t\tcustomMetadata !== undefined &&\n\t\t(customMetadata as Record<symbol, unknown>)[incrementalSummaryHint] === true\n\t);\n}\n\n/**\n * This helper function {@link getShouldIncrementallySummarizeAllowedTypes} can be used to generate a callback function\n * of type {@link IncrementalEncodingPolicy}.\n * This callback can be passed as the value for {@link SharedTreeOptionsInternal.shouldEncodeFieldIncrementally} parameter\n * when creating the tree.\n * It will be called for each {@link AllowedTypes} in the schema to determine if it should be incrementally summarized.\n *\n * @param rootSchema - The schema for the root of the tree.\n * @returns A callback function of type {@link IncrementalEncodingPolicy} which can be used to determine if a field\n * should be incrementally summarized based on whether it is an allowed types with the\n * {@link incrementalAllowedTypesMetadata} metadata.\n *\n * @remarks\n * This only works for forest type {@link ForestTypeOptimized} and compression strategy\n * {@link TreeCompressionStrategyExtended.CompressedIncremental}.\n *\n * The {@link incrementalAllowedTypesMetadata} will be replaced with a specialized metadata property once the\n * incremental summary feature and APIs are stabilized.\n */\nexport function getShouldIncrementallySummarizeAllowedTypes(\n\trootSchema: TreeSchema,\n): IncrementalEncodingPolicy {\n\treturn (\n\t\ttargetNodeIdentifier: TreeNodeSchemaIdentifier | undefined,\n\t\ttargetFieldKey: FieldKey,\n\t) => {\n\t\tif (targetNodeIdentifier === undefined) {\n\t\t\t// Root fields cannot be allowed types, so we don't incrementally summarize them.\n\t\t\treturn false;\n\t\t}\n\n\t\tconst targetNode = rootSchema.definitions.get(targetNodeIdentifier);\n\t\tif (targetNode === undefined) {\n\t\t\t// The requested type is unknown to this schema.\n\t\t\t// In this case we have no hints available from the view schema, and fall back to the default behavior of non-incremental encoding.\n\t\t\t// There are two ways this can happen:\n\t\t\t// 1. The view schema being used does not match the stored schema.\n\t\t\t// 2. The view schema is compatible, but there are unknown optional fields which contain new types not described by the view schema.\n\t\t\treturn false;\n\t\t}\n\n\t\tif (isObjectNodeSchema(targetNode)) {\n\t\t\tconst targetPropertyKey = targetNode.storedKeyToPropertyKey.get(targetFieldKey);\n\t\t\tif (targetPropertyKey !== undefined) {\n\t\t\t\tconst fieldSchema = targetNode.fields.get(targetPropertyKey);\n\t\t\t\tif (fieldSchema !== undefined) {\n\t\t\t\t\treturn isIncrementalSummaryHintInAllowedTypes(fieldSchema.allowedTypesFull);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\n\t\tconst allowedTypes = oneFromIterable(\n\t\t\tgetTreeNodeSchemaPrivateData(targetNode).childAllowedTypes,\n\t\t);\n\t\tassert(\n\t\t\tallowedTypes !== undefined,\n\t\t\t0xc87 /* Non object nodes with fields should only have one allowedTypes entry */,\n\t\t);\n\t\treturn isIncrementalSummaryHintInAllowedTypes(allowedTypes);\n\t};\n}\n"]}
1
+ {"version":3,"file":"incrementalAllowedTypes.js","sourceRoot":"","sources":["../../../src/simple-tree/api/incrementalAllowedTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,4BAA4B,EAAyB,MAAM,kBAAkB,CAAC;AACvF,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAG5D,OAAO,EAAE,eAAe,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YACF,CAAC;YACD,OAAO,KAAK,CAAC;QACd,CAAC;QAED,MAAM,YAAY,GAAG,eAAe,CACnC,4BAA4B,CAAC,UAAU,CAAC,CAAC,iBAAiB,CAC1D,CAAC;QACF,MAAM,CACL,YAAY,KAAK,SAAS,EAC1B,KAAK,CAAC,0EAA0E,CAChF,CAAC;QACF,OAAO,sCAAsC,CAAC,YAAY,CAAC,CAAC;IAC7D,CAAC,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { getTreeNodeSchemaPrivateData, type AllowedTypesFull } from \"../core/index.js\";\nimport { isObjectNodeSchema } from \"../node-kinds/index.js\";\nimport type { TreeSchema } from \"./configuration.js\";\nimport type { IncrementalEncodingPolicy } from \"../../feature-libraries/index.js\";\nimport { oneFromIterable } from \"../../util/index.js\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { FieldKey } from \"../../core/index.js\";\n\n/**\n * A symbol when present in the {@link AnnotatedAllowedTypes.metadata}'s `custom` property as true, opts in the allowed\n * types to incremental summary optimization.\n * These allowed types will be optimized during summary such that if they don't change across summaries,\n * they will not be encoded and their content will not be included in the summary that is uploaded to the service.\n * @remarks\n * See {@link incrementalEncodingPolicyForAllowedTypes} for more details.\n *\n * Use {@link SchemaStaticsBeta.types} to add this metadata to allowed types in a schema.\n * @example\n * ```typescript\n * const sf = new SchemaFactoryAlpha(\"IncrementalSummarization\");\n * class Foo extends sf.objectAlpha(\"foo\", {\n * bar: sf.types([{ type: sf.string, metadata: {} }], {\n * custom: { [incrementalSummaryHint]: true },\n * }),\n * }) {}\n * ```\n * @alpha\n */\nexport const incrementalSummaryHint: unique symbol = Symbol(\"IncrementalSummaryHint\");\n\n/**\n * Returns true if the provided allowed types's custom metadata has {@link incrementalSummaryHint} as true.\n */\nfunction isIncrementalSummaryHintInAllowedTypes(allowedTypes: AllowedTypesFull): boolean {\n\tconst customMetadata = allowedTypes.metadata.custom;\n\treturn (\n\t\tcustomMetadata !== undefined &&\n\t\t(customMetadata as Record<symbol, unknown>)[incrementalSummaryHint] === true\n\t);\n}\n\n/**\n * This helper function {@link incrementalEncodingPolicyForAllowedTypes} can be used to generate a callback function\n * of type {@link IncrementalEncodingPolicy}. It determines if each {@link AllowedTypes} in a schema should be\n * incrementally summarized.\n * This callback can be passed as the value for {@link SharedTreeOptions.shouldEncodeIncrementally} parameter\n * when creating the tree.\n *\n * @param rootSchema - The schema for the root of the tree.\n * @returns A callback function of type {@link IncrementalEncodingPolicy} which determines if allowed types should\n * be incrementally summarized based on whether they have opted in via the {@link incrementalSummaryHint} metadata.\n *\n * @remarks\n * This only works for forest type {@link ForestTypeOptimized} and compression strategy\n * {@link TreeCompressionStrategy.CompressedIncremental}.\n *\n * @privateRemarks\n * The {@link incrementalSummaryHint} will be replaced with a specialized metadata property once the\n * incremental summary feature and APIs are stabilized.\n *\n * @alpha\n */\nexport function incrementalEncodingPolicyForAllowedTypes(\n\trootSchema: TreeSchema,\n): IncrementalEncodingPolicy {\n\treturn (targetNodeIdentifier: string | undefined, targetFieldKey: string) => {\n\t\tif (targetNodeIdentifier === undefined) {\n\t\t\t// Root fields cannot be allowed types, so we don't incrementally summarize them.\n\t\t\treturn false;\n\t\t}\n\n\t\tconst targetNode = rootSchema.definitions.get(targetNodeIdentifier);\n\t\tif (targetNode === undefined) {\n\t\t\t// The requested type is unknown to this schema.\n\t\t\t// In this case we have no hints available from the view schema, and fall back to the default behavior of non-incremental encoding.\n\t\t\t// There are two ways this can happen:\n\t\t\t// 1. The view schema being used does not match the stored schema.\n\t\t\t// 2. The view schema is compatible, but there are unknown optional fields which contain new types not described by the view schema.\n\t\t\treturn false;\n\t\t}\n\n\t\tif (isObjectNodeSchema(targetNode)) {\n\t\t\tconst targetPropertyKey = targetNode.storedKeyToPropertyKey.get(\n\t\t\t\ttargetFieldKey as FieldKey,\n\t\t\t);\n\t\t\tif (targetPropertyKey !== undefined) {\n\t\t\t\tconst fieldSchema = targetNode.fields.get(targetPropertyKey);\n\t\t\t\tif (fieldSchema !== undefined) {\n\t\t\t\t\treturn isIncrementalSummaryHintInAllowedTypes(fieldSchema.allowedTypesFull);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\n\t\tconst allowedTypes = oneFromIterable(\n\t\t\tgetTreeNodeSchemaPrivateData(targetNode).childAllowedTypes,\n\t\t);\n\t\tassert(\n\t\t\tallowedTypes !== undefined,\n\t\t\t0xc87 /* Non object nodes with fields should only have one allowedTypes entry */,\n\t\t);\n\t\treturn isIncrementalSummaryHintInAllowedTypes(allowedTypes);\n\t};\n}\n"]}
@@ -33,6 +33,7 @@ export { type TransactionConstraint, type NodeInDocumentConstraint, type RunTran
33
33
  export { generateSchemaFromSimpleSchema } from "./schemaFromSimple.js";
34
34
  export { toSimpleTreeSchema } from "./viewSchemaToSimpleSchema.js";
35
35
  export type { TreeChangeEvents } from "./treeChangeEvents.js";
36
- export { getShouldIncrementallySummarizeAllowedTypes, incrementalSummaryHint, } from "./incrementalAllowedTypes.js";
36
+ export { incrementalEncodingPolicyForAllowedTypes, incrementalSummaryHint, } from "./incrementalAllowedTypes.js";
37
37
  export { encodeSimpleSchema, decodeSimpleSchema, } from "./simpleSchemaCodec.js";
38
+ export { exportCompatibilitySchemaSnapshot, importCompatibilitySchemaSnapshot, checkCompatibility, } from "./snapshotCompatibilityChecker.js";
38
39
  //# sourceMappingURL=index.d.ts.map