@fluidframework/tree 2.71.0 → 2.73.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (941) hide show
  1. package/CHANGELOG.md +125 -40
  2. package/api-report/tree.alpha.api.md +44 -48
  3. package/api-report/tree.beta.api.md +42 -0
  4. package/api-report/tree.legacy.beta.api.md +42 -0
  5. package/dist/alpha.d.ts +12 -8
  6. package/dist/api.d.ts +6 -2
  7. package/dist/api.d.ts.map +1 -1
  8. package/dist/api.js +2 -11
  9. package/dist/api.js.map +1 -1
  10. package/dist/beta.d.ts +7 -0
  11. package/dist/codec/codec.d.ts +23 -1
  12. package/dist/codec/codec.d.ts.map +1 -1
  13. package/dist/codec/codec.js +23 -3
  14. package/dist/codec/codec.js.map +1 -1
  15. package/dist/codec/index.d.ts +1 -1
  16. package/dist/codec/index.d.ts.map +1 -1
  17. package/dist/codec/index.js +2 -1
  18. package/dist/codec/index.js.map +1 -1
  19. package/dist/codec/versioned/codec.d.ts +7 -2
  20. package/dist/codec/versioned/codec.d.ts.map +1 -1
  21. package/dist/codec/versioned/codec.js +24 -1
  22. package/dist/codec/versioned/codec.js.map +1 -1
  23. package/dist/codec/versioned/index.d.ts +1 -1
  24. package/dist/codec/versioned/index.d.ts.map +1 -1
  25. package/dist/codec/versioned/index.js +2 -1
  26. package/dist/codec/versioned/index.js.map +1 -1
  27. package/dist/core/index.d.ts +1 -1
  28. package/dist/core/index.d.ts.map +1 -1
  29. package/dist/core/index.js +2 -2
  30. package/dist/core/index.js.map +1 -1
  31. package/dist/core/schema-stored/index.d.ts +1 -1
  32. package/dist/core/schema-stored/index.d.ts.map +1 -1
  33. package/dist/core/schema-stored/index.js +2 -2
  34. package/dist/core/schema-stored/index.js.map +1 -1
  35. package/dist/core/schema-stored/schema.d.ts +18 -7
  36. package/dist/core/schema-stored/schema.d.ts.map +1 -1
  37. package/dist/core/schema-stored/schema.js +6 -7
  38. package/dist/core/schema-stored/schema.js.map +1 -1
  39. package/dist/core/tree/detachedFieldIndexCodecCommon.d.ts +2 -1
  40. package/dist/core/tree/detachedFieldIndexCodecCommon.d.ts.map +1 -1
  41. package/dist/core/tree/detachedFieldIndexCodecCommon.js.map +1 -1
  42. package/dist/core/tree/detachedFieldIndexCodecV1.d.ts +1 -1
  43. package/dist/core/tree/detachedFieldIndexCodecV1.d.ts.map +1 -1
  44. package/dist/core/tree/detachedFieldIndexCodecV1.js +3 -2
  45. package/dist/core/tree/detachedFieldIndexCodecV1.js.map +1 -1
  46. package/dist/core/tree/detachedFieldIndexCodecV2.d.ts.map +1 -1
  47. package/dist/core/tree/detachedFieldIndexCodecV2.js +3 -1
  48. package/dist/core/tree/detachedFieldIndexCodecV2.js.map +1 -1
  49. package/dist/core/tree/detachedFieldIndexCodecs.d.ts +2 -3
  50. package/dist/core/tree/detachedFieldIndexCodecs.d.ts.map +1 -1
  51. package/dist/core/tree/detachedFieldIndexCodecs.js +31 -8
  52. package/dist/core/tree/detachedFieldIndexCodecs.js.map +1 -1
  53. package/dist/core/tree/detachedFieldIndexFormatCommon.d.ts +10 -1
  54. package/dist/core/tree/detachedFieldIndexFormatCommon.d.ts.map +1 -1
  55. package/dist/core/tree/detachedFieldIndexFormatCommon.js +8 -1
  56. package/dist/core/tree/detachedFieldIndexFormatCommon.js.map +1 -1
  57. package/dist/core/tree/detachedFieldIndexFormatV1.d.ts +2 -2
  58. package/dist/core/tree/detachedFieldIndexFormatV1.d.ts.map +1 -1
  59. package/dist/core/tree/detachedFieldIndexFormatV1.js +3 -3
  60. package/dist/core/tree/detachedFieldIndexFormatV1.js.map +1 -1
  61. package/dist/core/tree/detachedFieldIndexFormatV2.d.ts +2 -2
  62. package/dist/core/tree/detachedFieldIndexFormatV2.d.ts.map +1 -1
  63. package/dist/core/tree/detachedFieldIndexFormatV2.js +3 -3
  64. package/dist/core/tree/detachedFieldIndexFormatV2.js.map +1 -1
  65. package/dist/core/tree/index.d.ts +2 -1
  66. package/dist/core/tree/index.d.ts.map +1 -1
  67. package/dist/core/tree/index.js.map +1 -1
  68. package/dist/external-utilities/typeboxValidator.js +1 -1
  69. package/dist/external-utilities/typeboxValidator.js.map +1 -1
  70. package/dist/feature-libraries/chunked-forest/chunkTree.d.ts +4 -5
  71. package/dist/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  72. package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  73. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  74. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js +1 -0
  75. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  76. package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts +2 -1
  77. package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts.map +1 -1
  78. package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
  79. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts +4 -10
  80. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  81. package/dist/feature-libraries/chunked-forest/codec/codecs.js +39 -21
  82. package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  83. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +6 -6
  84. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
  85. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +4 -2
  86. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  87. package/dist/feature-libraries/chunked-forest/codec/format.d.ts +163 -6
  88. package/dist/feature-libraries/chunked-forest/codec/format.d.ts.map +1 -1
  89. package/dist/feature-libraries/chunked-forest/codec/format.js +13 -4
  90. package/dist/feature-libraries/chunked-forest/codec/format.js.map +1 -1
  91. package/dist/feature-libraries/chunked-forest/codec/formatGeneric.d.ts +8 -3
  92. package/dist/feature-libraries/chunked-forest/codec/formatGeneric.d.ts.map +1 -1
  93. package/dist/feature-libraries/chunked-forest/codec/formatGeneric.js +4 -1
  94. package/dist/feature-libraries/chunked-forest/codec/formatGeneric.js.map +1 -1
  95. package/dist/feature-libraries/chunked-forest/codec/index.d.ts +2 -2
  96. package/dist/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
  97. package/dist/feature-libraries/chunked-forest/codec/index.js +2 -2
  98. package/dist/feature-libraries/chunked-forest/codec/index.js.map +1 -1
  99. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts +13 -13
  100. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -1
  101. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +23 -6
  102. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
  103. package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.d.ts +9 -8
  104. package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.d.ts.map +1 -1
  105. package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.js +20 -4
  106. package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.js.map +1 -1
  107. package/dist/feature-libraries/chunked-forest/index.d.ts +1 -1
  108. package/dist/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  109. package/dist/feature-libraries/chunked-forest/index.js +2 -2
  110. package/dist/feature-libraries/chunked-forest/index.js.map +1 -1
  111. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts +35 -25
  112. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  113. package/dist/feature-libraries/default-schema/defaultFieldKinds.js +54 -74
  114. package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  115. package/dist/feature-libraries/default-schema/index.d.ts +1 -3
  116. package/dist/feature-libraries/default-schema/index.d.ts.map +1 -1
  117. package/dist/feature-libraries/default-schema/index.js +2 -8
  118. package/dist/feature-libraries/default-schema/index.js.map +1 -1
  119. package/dist/feature-libraries/forest-summary/codec.d.ts +4 -5
  120. package/dist/feature-libraries/forest-summary/codec.d.ts.map +1 -1
  121. package/dist/feature-libraries/forest-summary/codec.js +15 -4
  122. package/dist/feature-libraries/forest-summary/codec.js.map +1 -1
  123. package/dist/feature-libraries/forest-summary/forestSummarizer.js +1 -1
  124. package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  125. package/dist/feature-libraries/forest-summary/format.d.ts +9 -2
  126. package/dist/feature-libraries/forest-summary/format.d.ts.map +1 -1
  127. package/dist/feature-libraries/forest-summary/format.js +11 -4
  128. package/dist/feature-libraries/forest-summary/format.js.map +1 -1
  129. package/dist/feature-libraries/forest-summary/index.d.ts +2 -1
  130. package/dist/feature-libraries/forest-summary/index.d.ts.map +1 -1
  131. package/dist/feature-libraries/forest-summary/index.js +3 -1
  132. package/dist/feature-libraries/forest-summary/index.js.map +1 -1
  133. package/dist/feature-libraries/index.d.ts +6 -5
  134. package/dist/feature-libraries/index.d.ts.map +1 -1
  135. package/dist/feature-libraries/index.js +9 -8
  136. package/dist/feature-libraries/index.js.map +1 -1
  137. package/dist/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
  138. package/dist/feature-libraries/modular-schema/comparison.js +1 -2
  139. package/dist/feature-libraries/modular-schema/comparison.js.map +1 -1
  140. package/dist/feature-libraries/modular-schema/fieldKind.d.ts +38 -12
  141. package/dist/feature-libraries/modular-schema/fieldKind.d.ts.map +1 -1
  142. package/dist/feature-libraries/modular-schema/fieldKind.js +29 -11
  143. package/dist/feature-libraries/modular-schema/fieldKind.js.map +1 -1
  144. package/dist/feature-libraries/modular-schema/fieldKindConfiguration.d.ts +2 -2
  145. package/dist/feature-libraries/modular-schema/fieldKindConfiguration.d.ts.map +1 -1
  146. package/dist/feature-libraries/modular-schema/fieldKindConfiguration.js.map +1 -1
  147. package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts +2 -2
  148. package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  149. package/dist/feature-libraries/modular-schema/genericFieldKind.js +3 -2
  150. package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  151. package/dist/feature-libraries/modular-schema/index.d.ts +0 -1
  152. package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
  153. package/dist/feature-libraries/modular-schema/index.js +1 -3
  154. package/dist/feature-libraries/modular-schema/index.js.map +1 -1
  155. package/dist/feature-libraries/modular-schema/isNeverTree.d.ts +5 -6
  156. package/dist/feature-libraries/modular-schema/isNeverTree.d.ts.map +1 -1
  157. package/dist/feature-libraries/modular-schema/isNeverTree.js.map +1 -1
  158. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +8 -8
  159. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  160. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +1 -2
  161. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  162. package/dist/feature-libraries/modular-schema/modularChangeFormat.d.ts +66 -9
  163. package/dist/feature-libraries/modular-schema/modularChangeFormat.d.ts.map +1 -1
  164. package/dist/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  165. package/dist/feature-libraries/object-forest/objectForest.js +3 -2
  166. package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
  167. package/dist/feature-libraries/optional-field/index.d.ts +1 -1
  168. package/dist/feature-libraries/optional-field/index.d.ts.map +1 -1
  169. package/dist/feature-libraries/optional-field/index.js.map +1 -1
  170. package/dist/feature-libraries/optional-field/optionalFieldCodecs.d.ts.map +1 -1
  171. package/dist/feature-libraries/optional-field/optionalFieldCodecs.js +1 -5
  172. package/dist/feature-libraries/optional-field/optionalFieldCodecs.js.map +1 -1
  173. package/dist/feature-libraries/schema-edits/index.d.ts +1 -1
  174. package/dist/feature-libraries/schema-edits/index.d.ts.map +1 -1
  175. package/dist/feature-libraries/schema-edits/index.js.map +1 -1
  176. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.d.ts +6 -7
  177. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
  178. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js +5 -4
  179. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
  180. package/dist/feature-libraries/schema-index/codec.d.ts +10 -10
  181. package/dist/feature-libraries/schema-index/codec.d.ts.map +1 -1
  182. package/dist/feature-libraries/schema-index/codec.js +24 -18
  183. package/dist/feature-libraries/schema-index/codec.js.map +1 -1
  184. package/dist/feature-libraries/schema-index/formatV1.d.ts +2 -2
  185. package/dist/feature-libraries/schema-index/formatV1.d.ts.map +1 -1
  186. package/dist/feature-libraries/schema-index/formatV1.js +1 -1
  187. package/dist/feature-libraries/schema-index/formatV1.js.map +1 -1
  188. package/dist/feature-libraries/schema-index/formatV2.d.ts +1 -2
  189. package/dist/feature-libraries/schema-index/formatV2.d.ts.map +1 -1
  190. package/dist/feature-libraries/schema-index/formatV2.js +1 -1
  191. package/dist/feature-libraries/schema-index/formatV2.js.map +1 -1
  192. package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts +2 -2
  193. package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
  194. package/dist/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
  195. package/dist/feature-libraries/{default-schema/schemaChecker.d.ts → schemaChecker.d.ts} +2 -2
  196. package/dist/feature-libraries/schemaChecker.d.ts.map +1 -0
  197. package/dist/feature-libraries/{default-schema/schemaChecker.js → schemaChecker.js} +3 -3
  198. package/dist/feature-libraries/schemaChecker.js.map +1 -0
  199. package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts.map +1 -1
  200. package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.js +0 -2
  201. package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.js.map +1 -1
  202. package/dist/index.d.ts +2 -2
  203. package/dist/index.d.ts.map +1 -1
  204. package/dist/index.js +7 -3
  205. package/dist/index.js.map +1 -1
  206. package/dist/legacy.d.ts +7 -0
  207. package/dist/packageVersion.d.ts +1 -1
  208. package/dist/packageVersion.js +1 -1
  209. package/dist/packageVersion.js.map +1 -1
  210. package/dist/shared-tree/independentView.d.ts +1 -1
  211. package/dist/shared-tree/independentView.d.ts.map +1 -1
  212. package/dist/shared-tree/independentView.js +22 -15
  213. package/dist/shared-tree/independentView.js.map +1 -1
  214. package/dist/shared-tree/index.d.ts +1 -1
  215. package/dist/shared-tree/index.d.ts.map +1 -1
  216. package/dist/shared-tree/index.js +1 -2
  217. package/dist/shared-tree/index.js.map +1 -1
  218. package/dist/shared-tree/sharedTree.d.ts +12 -60
  219. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  220. package/dist/shared-tree/sharedTree.js +68 -159
  221. package/dist/shared-tree/sharedTree.js.map +1 -1
  222. package/dist/shared-tree/sharedTreeChangeCodecs.d.ts +8 -7
  223. package/dist/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  224. package/dist/shared-tree/sharedTreeChangeCodecs.js +10 -11
  225. package/dist/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  226. package/dist/shared-tree/sharedTreeChangeFamily.d.ts +2 -2
  227. package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  228. package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  229. package/dist/shared-tree/treeAlpha.d.ts +1 -1
  230. package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
  231. package/dist/shared-tree/treeAlpha.js +4 -2
  232. package/dist/shared-tree/treeAlpha.js.map +1 -1
  233. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  234. package/dist/shared-tree/treeCheckout.js +1 -3
  235. package/dist/shared-tree/treeCheckout.js.map +1 -1
  236. package/dist/shared-tree-core/editManagerCodecs.d.ts +19 -6
  237. package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  238. package/dist/shared-tree-core/editManagerCodecs.js +42 -18
  239. package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
  240. package/dist/shared-tree-core/editManagerFormatCommons.d.ts +36 -0
  241. package/dist/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
  242. package/dist/shared-tree-core/editManagerFormatCommons.js +40 -1
  243. package/dist/shared-tree-core/editManagerFormatCommons.js.map +1 -1
  244. package/dist/shared-tree-core/editManagerFormatV1toV4.d.ts +2 -2
  245. package/dist/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -1
  246. package/dist/shared-tree-core/editManagerFormatV1toV4.js +4 -4
  247. package/dist/shared-tree-core/editManagerFormatV1toV4.js.map +1 -1
  248. package/dist/shared-tree-core/editManagerFormatV5.d.ts +2 -2
  249. package/dist/shared-tree-core/editManagerFormatV5.d.ts.map +1 -1
  250. package/dist/shared-tree-core/editManagerFormatV5.js +1 -1
  251. package/dist/shared-tree-core/editManagerFormatV5.js.map +1 -1
  252. package/dist/shared-tree-core/index.d.ts +5 -3
  253. package/dist/shared-tree-core/index.d.ts.map +1 -1
  254. package/dist/shared-tree-core/index.js +12 -3
  255. package/dist/shared-tree-core/index.js.map +1 -1
  256. package/dist/shared-tree-core/messageCodecV1ToV4.d.ts +2 -1
  257. package/dist/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
  258. package/dist/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
  259. package/dist/shared-tree-core/messageCodecV5.d.ts +2 -1
  260. package/dist/shared-tree-core/messageCodecV5.d.ts.map +1 -1
  261. package/dist/shared-tree-core/messageCodecV5.js.map +1 -1
  262. package/dist/shared-tree-core/messageCodecs.d.ts +19 -6
  263. package/dist/shared-tree-core/messageCodecs.d.ts.map +1 -1
  264. package/dist/shared-tree-core/messageCodecs.js +49 -21
  265. package/dist/shared-tree-core/messageCodecs.js.map +1 -1
  266. package/dist/shared-tree-core/messageFormat.d.ts +48 -0
  267. package/dist/shared-tree-core/messageFormat.d.ts.map +1 -0
  268. package/dist/shared-tree-core/messageFormat.js +53 -0
  269. package/dist/shared-tree-core/messageFormat.js.map +1 -0
  270. package/dist/shared-tree-core/sharedTreeCore.d.ts +8 -8
  271. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  272. package/dist/shared-tree-core/sharedTreeCore.js +3 -3
  273. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  274. package/dist/simple-tree/api/configuration.d.ts +2 -0
  275. package/dist/simple-tree/api/configuration.d.ts.map +1 -1
  276. package/dist/simple-tree/api/configuration.js +10 -0
  277. package/dist/simple-tree/api/configuration.js.map +1 -1
  278. package/dist/simple-tree/api/discrepancies.d.ts +2 -2
  279. package/dist/simple-tree/api/discrepancies.js.map +1 -1
  280. package/dist/simple-tree/api/incrementalAllowedTypes.d.ts +1 -1
  281. package/dist/simple-tree/api/incrementalAllowedTypes.js +1 -1
  282. package/dist/simple-tree/api/incrementalAllowedTypes.js.map +1 -1
  283. package/dist/simple-tree/api/index.d.ts +4 -2
  284. package/dist/simple-tree/api/index.d.ts.map +1 -1
  285. package/dist/simple-tree/api/index.js +8 -1
  286. package/dist/simple-tree/api/index.js.map +1 -1
  287. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +2 -98
  288. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  289. package/dist/simple-tree/api/schemaFactoryAlpha.js +1 -52
  290. package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  291. package/dist/simple-tree/api/schemaFactoryBeta.d.ts +98 -2
  292. package/dist/simple-tree/api/schemaFactoryBeta.d.ts.map +1 -1
  293. package/dist/simple-tree/api/schemaFactoryBeta.js +61 -7
  294. package/dist/simple-tree/api/schemaFactoryBeta.js.map +1 -1
  295. package/dist/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
  296. package/dist/simple-tree/api/schemaFromSimple.js +13 -4
  297. package/dist/simple-tree/api/schemaFromSimple.js.map +1 -1
  298. package/dist/simple-tree/api/simpleSchemaCodec.d.ts +28 -0
  299. package/dist/simple-tree/api/simpleSchemaCodec.d.ts.map +1 -0
  300. package/dist/simple-tree/api/simpleSchemaCodec.js +290 -0
  301. package/dist/simple-tree/api/simpleSchemaCodec.js.map +1 -0
  302. package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts +103 -0
  303. package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -0
  304. package/dist/simple-tree/api/snapshotCompatibilityChecker.js +128 -0
  305. package/dist/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -0
  306. package/dist/simple-tree/api/storedSchema.d.ts +2 -2
  307. package/dist/simple-tree/api/storedSchema.d.ts.map +1 -1
  308. package/dist/simple-tree/api/storedSchema.js +8 -6
  309. package/dist/simple-tree/api/storedSchema.js.map +1 -1
  310. package/dist/simple-tree/api/tree.d.ts +3 -3
  311. package/dist/simple-tree/api/tree.js +1 -1
  312. package/dist/simple-tree/api/tree.js.map +1 -1
  313. package/dist/simple-tree/api/typesUnsafe.d.ts +6 -6
  314. package/dist/simple-tree/api/typesUnsafe.js.map +1 -1
  315. package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts +18 -3
  316. package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
  317. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js +78 -35
  318. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
  319. package/dist/simple-tree/core/allowedTypes.d.ts +3 -3
  320. package/dist/simple-tree/core/allowedTypes.js +2 -2
  321. package/dist/simple-tree/core/allowedTypes.js.map +1 -1
  322. package/dist/simple-tree/core/index.d.ts +3 -3
  323. package/dist/simple-tree/core/index.d.ts.map +1 -1
  324. package/dist/simple-tree/core/index.js +3 -1
  325. package/dist/simple-tree/core/index.js.map +1 -1
  326. package/dist/simple-tree/core/toStored.d.ts +12 -5
  327. package/dist/simple-tree/core/toStored.d.ts.map +1 -1
  328. package/dist/simple-tree/core/toStored.js +26 -10
  329. package/dist/simple-tree/core/toStored.js.map +1 -1
  330. package/dist/simple-tree/core/treeNode.js +1 -1
  331. package/dist/simple-tree/core/treeNode.js.map +1 -1
  332. package/dist/simple-tree/core/treeNodeSchema.d.ts +1 -6
  333. package/dist/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  334. package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
  335. package/dist/simple-tree/core/treeNodeValid.d.ts +1 -1
  336. package/dist/simple-tree/core/treeNodeValid.d.ts.map +1 -1
  337. package/dist/simple-tree/core/treeNodeValid.js +1 -2
  338. package/dist/simple-tree/core/treeNodeValid.js.map +1 -1
  339. package/dist/simple-tree/fieldSchema.d.ts.map +1 -1
  340. package/dist/simple-tree/fieldSchema.js +1 -8
  341. package/dist/simple-tree/fieldSchema.js.map +1 -1
  342. package/dist/simple-tree/index.d.ts +3 -2
  343. package/dist/simple-tree/index.d.ts.map +1 -1
  344. package/dist/simple-tree/index.js +12 -2
  345. package/dist/simple-tree/index.js.map +1 -1
  346. package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
  347. package/dist/simple-tree/leafNodeSchema.js +0 -1
  348. package/dist/simple-tree/leafNodeSchema.js.map +1 -1
  349. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  350. package/dist/simple-tree/node-kinds/array/arrayNode.js +14 -50
  351. package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  352. package/dist/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
  353. package/dist/simple-tree/node-kinds/map/mapNode.js +2 -6
  354. package/dist/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  355. package/dist/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  356. package/dist/simple-tree/node-kinds/object/objectNode.js +4 -12
  357. package/dist/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  358. package/dist/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
  359. package/dist/simple-tree/node-kinds/record/recordNode.js +3 -7
  360. package/dist/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  361. package/dist/simple-tree/simpleSchema.d.ts +25 -5
  362. package/dist/simple-tree/simpleSchema.d.ts.map +1 -1
  363. package/dist/simple-tree/simpleSchema.js.map +1 -1
  364. package/dist/simple-tree/simpleSchemaFormatV1.d.ts +249 -0
  365. package/dist/simple-tree/simpleSchemaFormatV1.d.ts.map +1 -0
  366. package/dist/simple-tree/simpleSchemaFormatV1.js +115 -0
  367. package/dist/simple-tree/simpleSchemaFormatV1.js.map +1 -0
  368. package/dist/simple-tree/toStoredSchema.d.ts +20 -8
  369. package/dist/simple-tree/toStoredSchema.d.ts.map +1 -1
  370. package/dist/simple-tree/toStoredSchema.js +27 -22
  371. package/dist/simple-tree/toStoredSchema.js.map +1 -1
  372. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
  373. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js +18 -15
  374. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
  375. package/dist/tableSchema.d.ts +22 -52
  376. package/dist/tableSchema.d.ts.map +1 -1
  377. package/dist/tableSchema.js +141 -277
  378. package/dist/tableSchema.js.map +1 -1
  379. package/dist/treeFactory.d.ts +3 -1
  380. package/dist/treeFactory.d.ts.map +1 -1
  381. package/dist/treeFactory.js +26 -2
  382. package/dist/treeFactory.js.map +1 -1
  383. package/dist/util/arrayUtilities.d.ts +45 -0
  384. package/dist/util/arrayUtilities.d.ts.map +1 -0
  385. package/dist/util/arrayUtilities.js +76 -0
  386. package/dist/util/arrayUtilities.js.map +1 -0
  387. package/dist/util/brand.d.ts +31 -2
  388. package/dist/util/brand.d.ts.map +1 -1
  389. package/dist/util/brand.js +28 -2
  390. package/dist/util/brand.js.map +1 -1
  391. package/dist/util/brandedMap.d.ts +3 -1
  392. package/dist/util/brandedMap.d.ts.map +1 -1
  393. package/dist/util/brandedMap.js.map +1 -1
  394. package/dist/util/index.d.ts +2 -1
  395. package/dist/util/index.d.ts.map +1 -1
  396. package/dist/util/index.js +8 -2
  397. package/dist/util/index.js.map +1 -1
  398. package/lib/alpha.d.ts +12 -8
  399. package/lib/api.d.ts +6 -2
  400. package/lib/api.d.ts.map +1 -1
  401. package/lib/api.js +2 -13
  402. package/lib/api.js.map +1 -1
  403. package/lib/beta.d.ts +7 -0
  404. package/lib/codec/codec.d.ts +23 -1
  405. package/lib/codec/codec.d.ts.map +1 -1
  406. package/lib/codec/codec.js +23 -3
  407. package/lib/codec/codec.js.map +1 -1
  408. package/lib/codec/index.d.ts +1 -1
  409. package/lib/codec/index.d.ts.map +1 -1
  410. package/lib/codec/index.js +1 -1
  411. package/lib/codec/index.js.map +1 -1
  412. package/lib/codec/versioned/codec.d.ts +7 -2
  413. package/lib/codec/versioned/codec.d.ts.map +1 -1
  414. package/lib/codec/versioned/codec.js +22 -0
  415. package/lib/codec/versioned/codec.js.map +1 -1
  416. package/lib/codec/versioned/index.d.ts +1 -1
  417. package/lib/codec/versioned/index.d.ts.map +1 -1
  418. package/lib/codec/versioned/index.js +1 -1
  419. package/lib/codec/versioned/index.js.map +1 -1
  420. package/lib/core/index.d.ts +1 -1
  421. package/lib/core/index.d.ts.map +1 -1
  422. package/lib/core/index.js +1 -1
  423. package/lib/core/index.js.map +1 -1
  424. package/lib/core/schema-stored/index.d.ts +1 -1
  425. package/lib/core/schema-stored/index.d.ts.map +1 -1
  426. package/lib/core/schema-stored/index.js +1 -1
  427. package/lib/core/schema-stored/index.js.map +1 -1
  428. package/lib/core/schema-stored/schema.d.ts +18 -7
  429. package/lib/core/schema-stored/schema.d.ts.map +1 -1
  430. package/lib/core/schema-stored/schema.js +6 -7
  431. package/lib/core/schema-stored/schema.js.map +1 -1
  432. package/lib/core/tree/detachedFieldIndexCodecCommon.d.ts +2 -1
  433. package/lib/core/tree/detachedFieldIndexCodecCommon.d.ts.map +1 -1
  434. package/lib/core/tree/detachedFieldIndexCodecCommon.js.map +1 -1
  435. package/lib/core/tree/detachedFieldIndexCodecV1.d.ts +1 -1
  436. package/lib/core/tree/detachedFieldIndexCodecV1.d.ts.map +1 -1
  437. package/lib/core/tree/detachedFieldIndexCodecV1.js +3 -2
  438. package/lib/core/tree/detachedFieldIndexCodecV1.js.map +1 -1
  439. package/lib/core/tree/detachedFieldIndexCodecV2.d.ts.map +1 -1
  440. package/lib/core/tree/detachedFieldIndexCodecV2.js +4 -2
  441. package/lib/core/tree/detachedFieldIndexCodecV2.js.map +1 -1
  442. package/lib/core/tree/detachedFieldIndexCodecs.d.ts +2 -3
  443. package/lib/core/tree/detachedFieldIndexCodecs.d.ts.map +1 -1
  444. package/lib/core/tree/detachedFieldIndexCodecs.js +31 -8
  445. package/lib/core/tree/detachedFieldIndexCodecs.js.map +1 -1
  446. package/lib/core/tree/detachedFieldIndexFormatCommon.d.ts +10 -1
  447. package/lib/core/tree/detachedFieldIndexFormatCommon.d.ts.map +1 -1
  448. package/lib/core/tree/detachedFieldIndexFormatCommon.js +7 -0
  449. package/lib/core/tree/detachedFieldIndexFormatCommon.js.map +1 -1
  450. package/lib/core/tree/detachedFieldIndexFormatV1.d.ts +2 -2
  451. package/lib/core/tree/detachedFieldIndexFormatV1.d.ts.map +1 -1
  452. package/lib/core/tree/detachedFieldIndexFormatV1.js +3 -3
  453. package/lib/core/tree/detachedFieldIndexFormatV1.js.map +1 -1
  454. package/lib/core/tree/detachedFieldIndexFormatV2.d.ts +2 -2
  455. package/lib/core/tree/detachedFieldIndexFormatV2.d.ts.map +1 -1
  456. package/lib/core/tree/detachedFieldIndexFormatV2.js +3 -3
  457. package/lib/core/tree/detachedFieldIndexFormatV2.js.map +1 -1
  458. package/lib/core/tree/index.d.ts +2 -1
  459. package/lib/core/tree/index.d.ts.map +1 -1
  460. package/lib/core/tree/index.js +1 -1
  461. package/lib/core/tree/index.js.map +1 -1
  462. package/lib/external-utilities/typeboxValidator.js +1 -1
  463. package/lib/external-utilities/typeboxValidator.js.map +1 -1
  464. package/lib/feature-libraries/chunked-forest/chunkTree.d.ts +4 -5
  465. package/lib/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  466. package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  467. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  468. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js +2 -1
  469. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  470. package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts +2 -1
  471. package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts.map +1 -1
  472. package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
  473. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts +4 -10
  474. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  475. package/lib/feature-libraries/chunked-forest/codec/codecs.js +42 -23
  476. package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  477. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +6 -6
  478. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
  479. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +5 -3
  480. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  481. package/lib/feature-libraries/chunked-forest/codec/format.d.ts +163 -6
  482. package/lib/feature-libraries/chunked-forest/codec/format.d.ts.map +1 -1
  483. package/lib/feature-libraries/chunked-forest/codec/format.js +12 -3
  484. package/lib/feature-libraries/chunked-forest/codec/format.js.map +1 -1
  485. package/lib/feature-libraries/chunked-forest/codec/formatGeneric.d.ts +8 -3
  486. package/lib/feature-libraries/chunked-forest/codec/formatGeneric.d.ts.map +1 -1
  487. package/lib/feature-libraries/chunked-forest/codec/formatGeneric.js +4 -1
  488. package/lib/feature-libraries/chunked-forest/codec/formatGeneric.js.map +1 -1
  489. package/lib/feature-libraries/chunked-forest/codec/index.d.ts +2 -2
  490. package/lib/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
  491. package/lib/feature-libraries/chunked-forest/codec/index.js +2 -2
  492. package/lib/feature-libraries/chunked-forest/codec/index.js.map +1 -1
  493. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts +13 -13
  494. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -1
  495. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +22 -6
  496. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
  497. package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.d.ts +9 -8
  498. package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.d.ts.map +1 -1
  499. package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.js +17 -2
  500. package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.js.map +1 -1
  501. package/lib/feature-libraries/chunked-forest/index.d.ts +1 -1
  502. package/lib/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  503. package/lib/feature-libraries/chunked-forest/index.js +1 -1
  504. package/lib/feature-libraries/chunked-forest/index.js.map +1 -1
  505. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts +35 -25
  506. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  507. package/lib/feature-libraries/default-schema/defaultFieldKinds.js +56 -76
  508. package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  509. package/lib/feature-libraries/default-schema/index.d.ts +1 -3
  510. package/lib/feature-libraries/default-schema/index.d.ts.map +1 -1
  511. package/lib/feature-libraries/default-schema/index.js +1 -3
  512. package/lib/feature-libraries/default-schema/index.js.map +1 -1
  513. package/lib/feature-libraries/forest-summary/codec.d.ts +4 -5
  514. package/lib/feature-libraries/forest-summary/codec.d.ts.map +1 -1
  515. package/lib/feature-libraries/forest-summary/codec.js +16 -5
  516. package/lib/feature-libraries/forest-summary/codec.js.map +1 -1
  517. package/lib/feature-libraries/forest-summary/forestSummarizer.js +1 -1
  518. package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  519. package/lib/feature-libraries/forest-summary/format.d.ts +9 -2
  520. package/lib/feature-libraries/forest-summary/format.d.ts.map +1 -1
  521. package/lib/feature-libraries/forest-summary/format.js +9 -2
  522. package/lib/feature-libraries/forest-summary/format.js.map +1 -1
  523. package/lib/feature-libraries/forest-summary/index.d.ts +2 -1
  524. package/lib/feature-libraries/forest-summary/index.d.ts.map +1 -1
  525. package/lib/feature-libraries/forest-summary/index.js +1 -0
  526. package/lib/feature-libraries/forest-summary/index.js.map +1 -1
  527. package/lib/feature-libraries/index.d.ts +6 -5
  528. package/lib/feature-libraries/index.d.ts.map +1 -1
  529. package/lib/feature-libraries/index.js +5 -4
  530. package/lib/feature-libraries/index.js.map +1 -1
  531. package/lib/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
  532. package/lib/feature-libraries/modular-schema/comparison.js +1 -2
  533. package/lib/feature-libraries/modular-schema/comparison.js.map +1 -1
  534. package/lib/feature-libraries/modular-schema/fieldKind.d.ts +38 -12
  535. package/lib/feature-libraries/modular-schema/fieldKind.d.ts.map +1 -1
  536. package/lib/feature-libraries/modular-schema/fieldKind.js +29 -11
  537. package/lib/feature-libraries/modular-schema/fieldKind.js.map +1 -1
  538. package/lib/feature-libraries/modular-schema/fieldKindConfiguration.d.ts +2 -2
  539. package/lib/feature-libraries/modular-schema/fieldKindConfiguration.d.ts.map +1 -1
  540. package/lib/feature-libraries/modular-schema/fieldKindConfiguration.js.map +1 -1
  541. package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts +2 -2
  542. package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  543. package/lib/feature-libraries/modular-schema/genericFieldKind.js +3 -2
  544. package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  545. package/lib/feature-libraries/modular-schema/index.d.ts +0 -1
  546. package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
  547. package/lib/feature-libraries/modular-schema/index.js +0 -1
  548. package/lib/feature-libraries/modular-schema/index.js.map +1 -1
  549. package/lib/feature-libraries/modular-schema/isNeverTree.d.ts +5 -6
  550. package/lib/feature-libraries/modular-schema/isNeverTree.d.ts.map +1 -1
  551. package/lib/feature-libraries/modular-schema/isNeverTree.js.map +1 -1
  552. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +8 -8
  553. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  554. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +1 -2
  555. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  556. package/lib/feature-libraries/modular-schema/modularChangeFormat.d.ts +66 -9
  557. package/lib/feature-libraries/modular-schema/modularChangeFormat.d.ts.map +1 -1
  558. package/lib/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  559. package/lib/feature-libraries/object-forest/objectForest.js +2 -1
  560. package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
  561. package/lib/feature-libraries/optional-field/index.d.ts +1 -1
  562. package/lib/feature-libraries/optional-field/index.d.ts.map +1 -1
  563. package/lib/feature-libraries/optional-field/index.js.map +1 -1
  564. package/lib/feature-libraries/optional-field/optionalFieldCodecs.d.ts.map +1 -1
  565. package/lib/feature-libraries/optional-field/optionalFieldCodecs.js +1 -5
  566. package/lib/feature-libraries/optional-field/optionalFieldCodecs.js.map +1 -1
  567. package/lib/feature-libraries/schema-edits/index.d.ts +1 -1
  568. package/lib/feature-libraries/schema-edits/index.d.ts.map +1 -1
  569. package/lib/feature-libraries/schema-edits/index.js.map +1 -1
  570. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.d.ts +6 -7
  571. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
  572. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js +6 -5
  573. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
  574. package/lib/feature-libraries/schema-index/codec.d.ts +10 -10
  575. package/lib/feature-libraries/schema-index/codec.d.ts.map +1 -1
  576. package/lib/feature-libraries/schema-index/codec.js +26 -20
  577. package/lib/feature-libraries/schema-index/codec.js.map +1 -1
  578. package/lib/feature-libraries/schema-index/formatV1.d.ts +2 -2
  579. package/lib/feature-libraries/schema-index/formatV1.d.ts.map +1 -1
  580. package/lib/feature-libraries/schema-index/formatV1.js +2 -2
  581. package/lib/feature-libraries/schema-index/formatV1.js.map +1 -1
  582. package/lib/feature-libraries/schema-index/formatV2.d.ts +1 -2
  583. package/lib/feature-libraries/schema-index/formatV2.d.ts.map +1 -1
  584. package/lib/feature-libraries/schema-index/formatV2.js +2 -2
  585. package/lib/feature-libraries/schema-index/formatV2.js.map +1 -1
  586. package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts +2 -2
  587. package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
  588. package/lib/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
  589. package/lib/feature-libraries/{default-schema/schemaChecker.d.ts → schemaChecker.d.ts} +2 -2
  590. package/lib/feature-libraries/schemaChecker.d.ts.map +1 -0
  591. package/lib/feature-libraries/{default-schema/schemaChecker.js → schemaChecker.js} +3 -3
  592. package/lib/feature-libraries/schemaChecker.js.map +1 -0
  593. package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts.map +1 -1
  594. package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.js +0 -2
  595. package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.js.map +1 -1
  596. package/lib/index.d.ts +2 -2
  597. package/lib/index.d.ts.map +1 -1
  598. package/lib/index.js +2 -2
  599. package/lib/index.js.map +1 -1
  600. package/lib/legacy.d.ts +7 -0
  601. package/lib/packageVersion.d.ts +1 -1
  602. package/lib/packageVersion.js +1 -1
  603. package/lib/packageVersion.js.map +1 -1
  604. package/lib/shared-tree/independentView.d.ts +1 -1
  605. package/lib/shared-tree/independentView.d.ts.map +1 -1
  606. package/lib/shared-tree/independentView.js +11 -4
  607. package/lib/shared-tree/independentView.js.map +1 -1
  608. package/lib/shared-tree/index.d.ts +1 -1
  609. package/lib/shared-tree/index.d.ts.map +1 -1
  610. package/lib/shared-tree/index.js +1 -1
  611. package/lib/shared-tree/index.js.map +1 -1
  612. package/lib/shared-tree/sharedTree.d.ts +12 -60
  613. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  614. package/lib/shared-tree/sharedTree.js +70 -161
  615. package/lib/shared-tree/sharedTree.js.map +1 -1
  616. package/lib/shared-tree/sharedTreeChangeCodecs.d.ts +8 -7
  617. package/lib/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  618. package/lib/shared-tree/sharedTreeChangeCodecs.js +5 -6
  619. package/lib/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  620. package/lib/shared-tree/sharedTreeChangeFamily.d.ts +2 -2
  621. package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  622. package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  623. package/lib/shared-tree/treeAlpha.d.ts +1 -1
  624. package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
  625. package/lib/shared-tree/treeAlpha.js +5 -3
  626. package/lib/shared-tree/treeAlpha.js.map +1 -1
  627. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  628. package/lib/shared-tree/treeCheckout.js +1 -3
  629. package/lib/shared-tree/treeCheckout.js.map +1 -1
  630. package/lib/shared-tree-core/editManagerCodecs.d.ts +19 -6
  631. package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  632. package/lib/shared-tree-core/editManagerCodecs.js +39 -17
  633. package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
  634. package/lib/shared-tree-core/editManagerFormatCommons.d.ts +36 -0
  635. package/lib/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
  636. package/lib/shared-tree-core/editManagerFormatCommons.js +39 -0
  637. package/lib/shared-tree-core/editManagerFormatCommons.js.map +1 -1
  638. package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts +2 -2
  639. package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -1
  640. package/lib/shared-tree-core/editManagerFormatV1toV4.js +5 -5
  641. package/lib/shared-tree-core/editManagerFormatV1toV4.js.map +1 -1
  642. package/lib/shared-tree-core/editManagerFormatV5.d.ts +2 -2
  643. package/lib/shared-tree-core/editManagerFormatV5.d.ts.map +1 -1
  644. package/lib/shared-tree-core/editManagerFormatV5.js +2 -2
  645. package/lib/shared-tree-core/editManagerFormatV5.js.map +1 -1
  646. package/lib/shared-tree-core/index.d.ts +5 -3
  647. package/lib/shared-tree-core/index.d.ts.map +1 -1
  648. package/lib/shared-tree-core/index.js +4 -2
  649. package/lib/shared-tree-core/index.js.map +1 -1
  650. package/lib/shared-tree-core/messageCodecV1ToV4.d.ts +2 -1
  651. package/lib/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
  652. package/lib/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
  653. package/lib/shared-tree-core/messageCodecV5.d.ts +2 -1
  654. package/lib/shared-tree-core/messageCodecV5.d.ts.map +1 -1
  655. package/lib/shared-tree-core/messageCodecV5.js.map +1 -1
  656. package/lib/shared-tree-core/messageCodecs.d.ts +19 -6
  657. package/lib/shared-tree-core/messageCodecs.d.ts.map +1 -1
  658. package/lib/shared-tree-core/messageCodecs.js +46 -20
  659. package/lib/shared-tree-core/messageCodecs.js.map +1 -1
  660. package/lib/shared-tree-core/messageFormat.d.ts +48 -0
  661. package/lib/shared-tree-core/messageFormat.d.ts.map +1 -0
  662. package/lib/shared-tree-core/messageFormat.js +50 -0
  663. package/lib/shared-tree-core/messageFormat.js.map +1 -0
  664. package/lib/shared-tree-core/sharedTreeCore.d.ts +8 -8
  665. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  666. package/lib/shared-tree-core/sharedTreeCore.js +3 -3
  667. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  668. package/lib/simple-tree/api/configuration.d.ts +2 -0
  669. package/lib/simple-tree/api/configuration.d.ts.map +1 -1
  670. package/lib/simple-tree/api/configuration.js +10 -0
  671. package/lib/simple-tree/api/configuration.js.map +1 -1
  672. package/lib/simple-tree/api/discrepancies.d.ts +2 -2
  673. package/lib/simple-tree/api/discrepancies.js.map +1 -1
  674. package/lib/simple-tree/api/incrementalAllowedTypes.d.ts +1 -1
  675. package/lib/simple-tree/api/incrementalAllowedTypes.js +1 -1
  676. package/lib/simple-tree/api/incrementalAllowedTypes.js.map +1 -1
  677. package/lib/simple-tree/api/index.d.ts +4 -2
  678. package/lib/simple-tree/api/index.d.ts.map +1 -1
  679. package/lib/simple-tree/api/index.js +2 -0
  680. package/lib/simple-tree/api/index.js.map +1 -1
  681. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +2 -98
  682. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  683. package/lib/simple-tree/api/schemaFactoryAlpha.js +1 -52
  684. package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  685. package/lib/simple-tree/api/schemaFactoryBeta.d.ts +98 -2
  686. package/lib/simple-tree/api/schemaFactoryBeta.d.ts.map +1 -1
  687. package/lib/simple-tree/api/schemaFactoryBeta.js +58 -4
  688. package/lib/simple-tree/api/schemaFactoryBeta.js.map +1 -1
  689. package/lib/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
  690. package/lib/simple-tree/api/schemaFromSimple.js +14 -5
  691. package/lib/simple-tree/api/schemaFromSimple.js.map +1 -1
  692. package/lib/simple-tree/api/simpleSchemaCodec.d.ts +28 -0
  693. package/lib/simple-tree/api/simpleSchemaCodec.d.ts.map +1 -0
  694. package/lib/simple-tree/api/simpleSchemaCodec.js +262 -0
  695. package/lib/simple-tree/api/simpleSchemaCodec.js.map +1 -0
  696. package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts +103 -0
  697. package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -0
  698. package/lib/simple-tree/api/snapshotCompatibilityChecker.js +122 -0
  699. package/lib/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -0
  700. package/lib/simple-tree/api/storedSchema.d.ts +2 -2
  701. package/lib/simple-tree/api/storedSchema.d.ts.map +1 -1
  702. package/lib/simple-tree/api/storedSchema.js +5 -3
  703. package/lib/simple-tree/api/storedSchema.js.map +1 -1
  704. package/lib/simple-tree/api/tree.d.ts +3 -3
  705. package/lib/simple-tree/api/tree.js +1 -1
  706. package/lib/simple-tree/api/tree.js.map +1 -1
  707. package/lib/simple-tree/api/typesUnsafe.d.ts +6 -6
  708. package/lib/simple-tree/api/typesUnsafe.js.map +1 -1
  709. package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts +18 -3
  710. package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
  711. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js +75 -34
  712. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
  713. package/lib/simple-tree/core/allowedTypes.d.ts +3 -3
  714. package/lib/simple-tree/core/allowedTypes.js +2 -2
  715. package/lib/simple-tree/core/allowedTypes.js.map +1 -1
  716. package/lib/simple-tree/core/index.d.ts +3 -3
  717. package/lib/simple-tree/core/index.d.ts.map +1 -1
  718. package/lib/simple-tree/core/index.js +2 -2
  719. package/lib/simple-tree/core/index.js.map +1 -1
  720. package/lib/simple-tree/core/toStored.d.ts +12 -5
  721. package/lib/simple-tree/core/toStored.d.ts.map +1 -1
  722. package/lib/simple-tree/core/toStored.js +25 -9
  723. package/lib/simple-tree/core/toStored.js.map +1 -1
  724. package/lib/simple-tree/core/treeNode.js +1 -1
  725. package/lib/simple-tree/core/treeNode.js.map +1 -1
  726. package/lib/simple-tree/core/treeNodeSchema.d.ts +1 -6
  727. package/lib/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  728. package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
  729. package/lib/simple-tree/core/treeNodeValid.d.ts +1 -1
  730. package/lib/simple-tree/core/treeNodeValid.d.ts.map +1 -1
  731. package/lib/simple-tree/core/treeNodeValid.js +1 -2
  732. package/lib/simple-tree/core/treeNodeValid.js.map +1 -1
  733. package/lib/simple-tree/fieldSchema.d.ts.map +1 -1
  734. package/lib/simple-tree/fieldSchema.js +2 -9
  735. package/lib/simple-tree/fieldSchema.js.map +1 -1
  736. package/lib/simple-tree/index.d.ts +3 -2
  737. package/lib/simple-tree/index.d.ts.map +1 -1
  738. package/lib/simple-tree/index.js +2 -1
  739. package/lib/simple-tree/index.js.map +1 -1
  740. package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
  741. package/lib/simple-tree/leafNodeSchema.js +1 -2
  742. package/lib/simple-tree/leafNodeSchema.js.map +1 -1
  743. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  744. package/lib/simple-tree/node-kinds/array/arrayNode.js +17 -53
  745. package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  746. package/lib/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
  747. package/lib/simple-tree/node-kinds/map/mapNode.js +5 -9
  748. package/lib/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  749. package/lib/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  750. package/lib/simple-tree/node-kinds/object/objectNode.js +6 -14
  751. package/lib/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  752. package/lib/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
  753. package/lib/simple-tree/node-kinds/record/recordNode.js +6 -10
  754. package/lib/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  755. package/lib/simple-tree/simpleSchema.d.ts +25 -5
  756. package/lib/simple-tree/simpleSchema.d.ts.map +1 -1
  757. package/lib/simple-tree/simpleSchema.js.map +1 -1
  758. package/lib/simple-tree/simpleSchemaFormatV1.d.ts +249 -0
  759. package/lib/simple-tree/simpleSchemaFormatV1.d.ts.map +1 -0
  760. package/lib/simple-tree/simpleSchemaFormatV1.js +112 -0
  761. package/lib/simple-tree/simpleSchemaFormatV1.js.map +1 -0
  762. package/lib/simple-tree/toStoredSchema.d.ts +20 -8
  763. package/lib/simple-tree/toStoredSchema.d.ts.map +1 -1
  764. package/lib/simple-tree/toStoredSchema.js +28 -24
  765. package/lib/simple-tree/toStoredSchema.js.map +1 -1
  766. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
  767. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js +20 -17
  768. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
  769. package/lib/tableSchema.d.ts +22 -52
  770. package/lib/tableSchema.d.ts.map +1 -1
  771. package/lib/tableSchema.js +143 -279
  772. package/lib/tableSchema.js.map +1 -1
  773. package/lib/treeFactory.d.ts +3 -1
  774. package/lib/treeFactory.d.ts.map +1 -1
  775. package/lib/treeFactory.js +23 -1
  776. package/lib/treeFactory.js.map +1 -1
  777. package/lib/util/arrayUtilities.d.ts +45 -0
  778. package/lib/util/arrayUtilities.d.ts.map +1 -0
  779. package/lib/util/arrayUtilities.js +69 -0
  780. package/lib/util/arrayUtilities.js.map +1 -0
  781. package/lib/util/brand.d.ts +31 -2
  782. package/lib/util/brand.d.ts.map +1 -1
  783. package/lib/util/brand.js +26 -1
  784. package/lib/util/brand.js.map +1 -1
  785. package/lib/util/brandedMap.d.ts +3 -1
  786. package/lib/util/brandedMap.d.ts.map +1 -1
  787. package/lib/util/brandedMap.js.map +1 -1
  788. package/lib/util/index.d.ts +2 -1
  789. package/lib/util/index.d.ts.map +1 -1
  790. package/lib/util/index.js +2 -1
  791. package/lib/util/index.js.map +1 -1
  792. package/package.json +24 -24
  793. package/src/api.ts +22 -11
  794. package/src/codec/codec.ts +25 -3
  795. package/src/codec/index.ts +1 -0
  796. package/src/codec/versioned/codec.ts +40 -2
  797. package/src/codec/versioned/index.ts +1 -0
  798. package/src/core/index.ts +1 -2
  799. package/src/core/schema-stored/index.ts +1 -2
  800. package/src/core/schema-stored/schema.ts +22 -8
  801. package/src/core/tree/detachedFieldIndexCodecCommon.ts +2 -1
  802. package/src/core/tree/detachedFieldIndexCodecV1.ts +4 -2
  803. package/src/core/tree/detachedFieldIndexCodecV2.ts +4 -6
  804. package/src/core/tree/detachedFieldIndexCodecs.ts +40 -11
  805. package/src/core/tree/detachedFieldIndexFormatCommon.ts +17 -2
  806. package/src/core/tree/detachedFieldIndexFormatV1.ts +6 -4
  807. package/src/core/tree/detachedFieldIndexFormatV2.ts +6 -4
  808. package/src/core/tree/index.ts +2 -4
  809. package/src/external-utilities/typeboxValidator.ts +1 -1
  810. package/src/feature-libraries/README.md +1 -1
  811. package/src/feature-libraries/chunked-forest/chunkTree.ts +3 -3
  812. package/src/feature-libraries/chunked-forest/codec/chunkDecoding.ts +5 -0
  813. package/src/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.ts +2 -1
  814. package/src/feature-libraries/chunked-forest/codec/codecs.ts +65 -27
  815. package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +9 -4
  816. package/src/feature-libraries/chunked-forest/codec/format.ts +26 -5
  817. package/src/feature-libraries/chunked-forest/codec/formatGeneric.ts +7 -2
  818. package/src/feature-libraries/chunked-forest/codec/index.ts +1 -2
  819. package/src/feature-libraries/chunked-forest/codec/schemaBasedEncode.ts +62 -9
  820. package/src/feature-libraries/chunked-forest/codec/uncompressedEncode.ts +24 -2
  821. package/src/feature-libraries/chunked-forest/index.ts +1 -2
  822. package/src/feature-libraries/default-schema/defaultFieldKinds.ts +88 -103
  823. package/src/feature-libraries/default-schema/index.ts +1 -9
  824. package/src/feature-libraries/forest-summary/codec.ts +24 -9
  825. package/src/feature-libraries/forest-summary/forestSummarizer.ts +1 -1
  826. package/src/feature-libraries/forest-summary/format.ts +25 -9
  827. package/src/feature-libraries/forest-summary/index.ts +2 -1
  828. package/src/feature-libraries/index.ts +8 -7
  829. package/src/feature-libraries/modular-schema/comparison.ts +2 -3
  830. package/src/feature-libraries/modular-schema/fieldKind.ts +90 -13
  831. package/src/feature-libraries/modular-schema/fieldKindConfiguration.ts +2 -3
  832. package/src/feature-libraries/modular-schema/genericFieldKind.ts +6 -6
  833. package/src/feature-libraries/modular-schema/index.ts +0 -1
  834. package/src/feature-libraries/modular-schema/isNeverTree.ts +7 -8
  835. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +13 -13
  836. package/src/feature-libraries/object-forest/objectForest.ts +2 -6
  837. package/src/feature-libraries/optional-field/index.ts +1 -0
  838. package/src/feature-libraries/optional-field/optionalFieldCodecs.ts +1 -5
  839. package/src/feature-libraries/schema-edits/index.ts +0 -1
  840. package/src/feature-libraries/schema-edits/schemaChangeCodecs.ts +16 -16
  841. package/src/feature-libraries/schema-index/codec.ts +41 -22
  842. package/src/feature-libraries/schema-index/formatV1.ts +2 -2
  843. package/src/feature-libraries/schema-index/formatV2.ts +2 -2
  844. package/src/feature-libraries/schema-index/schemaSummarizer.ts +2 -1
  845. package/src/feature-libraries/{default-schema/schemaChecker.ts → schemaChecker.ts} +4 -4
  846. package/src/feature-libraries/sequence-field/sequenceFieldCodecs.ts +0 -2
  847. package/src/index.ts +6 -2
  848. package/src/packageVersion.ts +1 -1
  849. package/src/shared-tree/independentView.ts +16 -5
  850. package/src/shared-tree/index.ts +0 -1
  851. package/src/shared-tree/sharedTree.ts +92 -222
  852. package/src/shared-tree/sharedTreeChangeCodecs.ts +14 -13
  853. package/src/shared-tree/sharedTreeChangeFamily.ts +2 -2
  854. package/src/shared-tree/treeAlpha.ts +6 -5
  855. package/src/shared-tree/treeCheckout.ts +1 -3
  856. package/src/shared-tree-core/editManagerCodecs.ts +69 -20
  857. package/src/shared-tree-core/editManagerFormatCommons.ts +46 -0
  858. package/src/shared-tree-core/editManagerFormatV1toV4.ts +10 -5
  859. package/src/shared-tree-core/editManagerFormatV5.ts +3 -3
  860. package/src/shared-tree-core/index.ts +15 -5
  861. package/src/shared-tree-core/messageCodecV1ToV4.ts +6 -1
  862. package/src/shared-tree-core/messageCodecV5.ts +2 -1
  863. package/src/shared-tree-core/messageCodecs.ts +77 -28
  864. package/src/shared-tree-core/messageFormat.ts +58 -0
  865. package/src/shared-tree-core/sharedTreeCore.ts +11 -13
  866. package/src/simple-tree/api/configuration.ts +17 -4
  867. package/src/simple-tree/api/discrepancies.ts +2 -2
  868. package/src/simple-tree/api/incrementalAllowedTypes.ts +1 -1
  869. package/src/simple-tree/api/index.ts +11 -2
  870. package/src/simple-tree/api/schemaFactoryAlpha.ts +2 -168
  871. package/src/simple-tree/api/schemaFactoryBeta.ts +180 -14
  872. package/src/simple-tree/api/schemaFromSimple.ts +20 -9
  873. package/src/simple-tree/api/simpleSchemaCodec.ts +361 -0
  874. package/src/simple-tree/api/snapshotCompatibilityChecker.ts +135 -0
  875. package/src/simple-tree/api/storedSchema.ts +8 -5
  876. package/src/simple-tree/api/tree.ts +3 -3
  877. package/src/simple-tree/api/typesUnsafe.ts +6 -6
  878. package/src/simple-tree/api/viewSchemaToSimpleSchema.ts +80 -47
  879. package/src/simple-tree/core/allowedTypes.ts +4 -4
  880. package/src/simple-tree/core/index.ts +3 -1
  881. package/src/simple-tree/core/toStored.ts +42 -18
  882. package/src/simple-tree/core/treeNode.ts +2 -2
  883. package/src/simple-tree/core/treeNodeSchema.ts +1 -7
  884. package/src/simple-tree/core/treeNodeValid.ts +0 -2
  885. package/src/simple-tree/fieldSchema.ts +2 -11
  886. package/src/simple-tree/index.ts +11 -2
  887. package/src/simple-tree/leafNodeSchema.ts +1 -2
  888. package/src/simple-tree/node-kinds/array/arrayNode.ts +28 -77
  889. package/src/simple-tree/node-kinds/map/mapNode.ts +3 -17
  890. package/src/simple-tree/node-kinds/object/objectNode.ts +5 -20
  891. package/src/simple-tree/node-kinds/record/recordNode.ts +4 -18
  892. package/src/simple-tree/simpleSchema.ts +27 -5
  893. package/src/simple-tree/simpleSchemaFormatV1.ts +179 -0
  894. package/src/simple-tree/toStoredSchema.ts +54 -38
  895. package/src/simple-tree/unhydratedFlexTreeFromInsertable.ts +22 -17
  896. package/src/tableSchema.ts +110 -331
  897. package/src/treeFactory.ts +33 -1
  898. package/src/util/arrayUtilities.ts +88 -0
  899. package/src/util/brand.ts +40 -2
  900. package/src/util/brandedMap.ts +3 -1
  901. package/src/util/index.ts +7 -0
  902. package/dist/feature-libraries/default-schema/defaultSchema.d.ts +0 -10
  903. package/dist/feature-libraries/default-schema/defaultSchema.d.ts.map +0 -1
  904. package/dist/feature-libraries/default-schema/defaultSchema.js +0 -15
  905. package/dist/feature-libraries/default-schema/defaultSchema.js.map +0 -1
  906. package/dist/feature-libraries/default-schema/schemaChecker.d.ts.map +0 -1
  907. package/dist/feature-libraries/default-schema/schemaChecker.js.map +0 -1
  908. package/dist/feature-libraries/modular-schema/fieldKindWithEditor.d.ts +0 -50
  909. package/dist/feature-libraries/modular-schema/fieldKindWithEditor.d.ts.map +0 -1
  910. package/dist/feature-libraries/modular-schema/fieldKindWithEditor.js +0 -76
  911. package/dist/feature-libraries/modular-schema/fieldKindWithEditor.js.map +0 -1
  912. package/dist/feature-libraries/optional-field/optionalFieldCodecV1.d.ts +0 -12
  913. package/dist/feature-libraries/optional-field/optionalFieldCodecV1.d.ts.map +0 -1
  914. package/dist/feature-libraries/optional-field/optionalFieldCodecV1.js +0 -158
  915. package/dist/feature-libraries/optional-field/optionalFieldCodecV1.js.map +0 -1
  916. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts +0 -11
  917. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts.map +0 -1
  918. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js +0 -245
  919. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +0 -1
  920. package/lib/feature-libraries/default-schema/defaultSchema.d.ts +0 -10
  921. package/lib/feature-libraries/default-schema/defaultSchema.d.ts.map +0 -1
  922. package/lib/feature-libraries/default-schema/defaultSchema.js +0 -12
  923. package/lib/feature-libraries/default-schema/defaultSchema.js.map +0 -1
  924. package/lib/feature-libraries/default-schema/schemaChecker.d.ts.map +0 -1
  925. package/lib/feature-libraries/default-schema/schemaChecker.js.map +0 -1
  926. package/lib/feature-libraries/modular-schema/fieldKindWithEditor.d.ts +0 -50
  927. package/lib/feature-libraries/modular-schema/fieldKindWithEditor.d.ts.map +0 -1
  928. package/lib/feature-libraries/modular-schema/fieldKindWithEditor.js +0 -71
  929. package/lib/feature-libraries/modular-schema/fieldKindWithEditor.js.map +0 -1
  930. package/lib/feature-libraries/optional-field/optionalFieldCodecV1.d.ts +0 -12
  931. package/lib/feature-libraries/optional-field/optionalFieldCodecV1.d.ts.map +0 -1
  932. package/lib/feature-libraries/optional-field/optionalFieldCodecV1.js +0 -154
  933. package/lib/feature-libraries/optional-field/optionalFieldCodecV1.js.map +0 -1
  934. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts +0 -11
  935. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts.map +0 -1
  936. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js +0 -241
  937. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +0 -1
  938. package/src/feature-libraries/default-schema/defaultSchema.ts +0 -15
  939. package/src/feature-libraries/modular-schema/fieldKindWithEditor.ts +0 -108
  940. package/src/feature-libraries/optional-field/optionalFieldCodecV1.ts +0 -208
  941. package/src/feature-libraries/sequence-field/sequenceFieldCodecV1.ts +0 -344
@@ -0,0 +1,50 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ /**
6
+ * The format version for the message.
7
+ */
8
+ export const MessageFormatVersion = {
9
+ /**
10
+ * NOTE: this is written as `undefined` rather than `0` in the wire format.
11
+ * Introduced and retired prior to 2.0.
12
+ * Reading and writing capability removed in 2.73.0.
13
+ */
14
+ undefined: 0,
15
+ /**
16
+ * Introduced and retired prior to 2.0.
17
+ * Reading and writing capability removed in 2.73.0.
18
+ */
19
+ v1: 1,
20
+ /**
21
+ * Introduced and retired prior to 2.0.
22
+ * Reading and writing capability removed in 2.73.0.
23
+ */
24
+ v2: 2,
25
+ /**
26
+ * Introduced prior to 2.0 and used beyond.
27
+ * Reading capability is currently maintained for backwards compatibility, but it could be removed in the future.
28
+ * Writing capability needs to be maintained.
29
+ */
30
+ v3: 3,
31
+ /**
32
+ * Was inadvertently released in 2.43.0 (through usages of configuredSharedTree) and remains available.
33
+ * Reading capability must be maintained for backwards compatibility.
34
+ * Writing capability needs to be maintained.
35
+ * @privateRemarks TODO: stop writing this version.
36
+ */
37
+ v4: 4,
38
+ /**
39
+ * Not yet released.
40
+ * Only used for testing shared branches.
41
+ */
42
+ v5: 5,
43
+ };
44
+ export const supportedMessageFormatVersions = new Set([
45
+ MessageFormatVersion.v3,
46
+ MessageFormatVersion.v4,
47
+ MessageFormatVersion.v5,
48
+ ]);
49
+ export const messageFormatVersions = new Set(Object.values(MessageFormatVersion));
50
+ //# sourceMappingURL=messageFormat.js.map
@@ -0,0 +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;;;;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"]}
@@ -7,22 +7,22 @@ import type { IChannelStorageService } from "@fluidframework/datastore-definitio
7
7
  import type { IIdCompressor } from "@fluidframework/id-compressor";
8
8
  import type { IExperimentalIncrementalSummaryContext, IRuntimeMessageCollection, ISummaryTreeWithStats, ITelemetryContext } from "@fluidframework/runtime-definitions/internal";
9
9
  import type { IChannelView, IFluidSerializer } from "@fluidframework/shared-object-base/internal";
10
- import type { DependentFormatVersion, ICodecOptions } from "../codec/index.js";
10
+ import type { CodecWriteOptions, DependentFormatVersion } from "../codec/index.js";
11
11
  import { type ChangeFamily, type ChangeFamilyEditor, type GraphCommit, type RevisionTag, type SchemaAndPolicy, type SchemaPolicy, type TreeStoredSchemaRepository } from "../core/index.js";
12
12
  import { type JsonCompatibleReadOnly, type Breakable, type WithBreakable } from "../util/index.js";
13
13
  import type { BranchId, SharedTreeBranch } from "./branch.js";
14
14
  import { BranchCommitEnricher } from "./branchCommitEnricher.js";
15
15
  import { type ChangeEnricherReadonlyCheckout } from "./changeEnricher.js";
16
- import { type EditManagerFormatVersion } from "./editManagerCodecs.js";
17
- import { type MessageFormatVersion } from "./messageCodecs.js";
16
+ import { type EditManagerCodecOptions } from "./editManagerCodecs.js";
17
+ import type { EditManagerFormatVersion } from "./editManagerFormatCommons.js";
18
+ import { type MessageCodecOptions } from "./messageCodecs.js";
18
19
  import type { ResubmitMachine } from "./resubmitMachine.js";
19
- export interface ExplicitCoreCodecVersions {
20
- editManager: EditManagerFormatVersion;
21
- message: MessageFormatVersion;
22
- }
20
+ import type { MessageFormatVersion } from "./messageFormat.js";
23
21
  export interface ClonableSchemaAndPolicy extends SchemaAndPolicy {
24
22
  schema: TreeStoredSchemaRepository;
25
23
  }
24
+ export interface SharedTreeCoreOptionsInternal extends CodecWriteOptions, EditManagerCodecOptions, MessageCodecOptions {
25
+ }
26
26
  /**
27
27
  * Generic shared tree, which needs to be configured with indexes, field kinds and other configuration.
28
28
  */
@@ -63,7 +63,7 @@ export declare class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>
63
63
  * @param editor - Used to edit the state of the tree. Edits will be immediately applied locally to the tree.
64
64
  * If there is no transaction currently ongoing, then the edits will be submitted to Fluid immediately as well.
65
65
  */
66
- constructor(breaker: Breakable, sharedObject: IChannelView & IFluidLoadable, serializer: IFluidSerializer, submitLocalMessage: (content: unknown, localOpMetadata?: unknown) => void, logger: ITelemetryBaseLogger | undefined, summarizables: readonly Summarizable[], changeFamily: ChangeFamily<TEditor, TChange>, options: ICodecOptions, formatOptions: ExplicitCoreCodecVersions, changeFormatVersionForEditManager: DependentFormatVersion<EditManagerFormatVersion>, changeFormatVersionForMessage: DependentFormatVersion<MessageFormatVersion>, idCompressor: IIdCompressor, schema: TreeStoredSchemaRepository, schemaPolicy: SchemaPolicy, resubmitMachine?: ResubmitMachine<TChange>, enricher?: ChangeEnricherReadonlyCheckout<TChange>, getEditor?: () => TEditor);
66
+ constructor(breaker: Breakable, sharedObject: IChannelView & IFluidLoadable, serializer: IFluidSerializer, submitLocalMessage: (content: unknown, localOpMetadata?: unknown) => void, logger: ITelemetryBaseLogger | undefined, summarizables: readonly Summarizable[], changeFamily: ChangeFamily<TEditor, TChange>, options: SharedTreeCoreOptionsInternal, changeFormatVersionForEditManager: DependentFormatVersion<EditManagerFormatVersion>, changeFormatVersionForMessage: DependentFormatVersion<MessageFormatVersion>, idCompressor: IIdCompressor, schema: TreeStoredSchemaRepository, schemaPolicy: SchemaPolicy, resubmitMachine?: ResubmitMachine<TChange>, enricher?: ChangeEnricherReadonlyCheckout<TChange>, getEditor?: () => TEditor);
67
67
  summarizeCore(serializer: IFluidSerializer, telemetryContext?: ITelemetryContext, incrementalSummaryContext?: IExperimentalIncrementalSummaryContext, fullTree?: boolean): ISummaryTreeWithStats;
68
68
  loadCore(services: IChannelStorageService): Promise<void>;
69
69
  private registerSharedBranch;
@@ -1 +1 @@
1
- {"version":3,"file":"sharedTreeCore.d.ts","sourceRoot":"","sources":["../../src/shared-tree-core/sharedTreeCore.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAE5F,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gDAAgD,CAAC;AAE7F,OAAO,KAAK,EACX,aAAa,EAGb,MAAM,+BAA+B,CAAC;AACvC,OAA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AAO,EAAE,sBAAsB,GAAG,IAAI;IAyB5D,SAAS,CAAC,8BAA8B,CACvC,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,8BAA8B,CAAC,OAAO,CAAC,EACjD,eAAe,CAAC,EAAE,eAAe,CAAC,OAAO,CAAC,GACxC,IAAI;IAgBP,OAAO,CAAC,kBAAkB;IAI1B,OAAO,CAAC,qBAAqB;IAItB,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,GAAG,oBAAoB,CAAC,OAAO,CAAC;IAI3E,OAAO,CAAC,gBAAgB;IAOxB,OAAO,CAAC,mBAAmB;CAG3B;AAcD;;GAEG;AACH,MAAM,WAAW,YAAY;IAC5B;;OAEG;IACH,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAErB;;;;;;;;;;;;;OAaG;IACH,SAAS,CAAC,KAAK,EAAE;QAChB,SAAS,EAAE,yBAAyB,CAAC;QACrC,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB,gBAAgB,CAAC,EAAE,iBAAiB,CAAC;QACrC,yBAAyB,CAAC,EAAE,sCAAsC,CAAC;KACnE,GAAG,qBAAqB,CAAC;IAE1B;;;;;OAKG;IACH,IAAI,CAAC,OAAO,EAAE,sBAAsB,EAAE,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAClF;AAED;;;GAGG;AACH,MAAM,MAAM,yBAAyB,GAAG,CAAC,QAAQ,EAAE,OAAO,KAAK,MAAM,CAAC;AAEtE;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC"}
@@ -73,7 +73,7 @@ let SharedTreeCore = (() => {
73
73
  * @param editor - Used to edit the state of the tree. Edits will be immediately applied locally to the tree.
74
74
  * If there is no transaction currently ongoing, then the edits will be submitted to Fluid immediately as well.
75
75
  */
76
- constructor(breaker, sharedObject, serializer, submitLocalMessage, logger, summarizables, changeFamily, options, formatOptions, changeFormatVersionForEditManager, changeFormatVersionForMessage, idCompressor, schema, schemaPolicy, resubmitMachine, enricher, getEditor = () => this.getLocalBranch().editor) {
76
+ constructor(breaker, sharedObject, serializer, submitLocalMessage, logger, summarizables, changeFamily, options, changeFormatVersionForEditManager, changeFormatVersionForMessage, idCompressor, schema, schemaPolicy, resubmitMachine, enricher, getEditor = () => this.getLocalBranch().editor) {
77
77
  this.breaker = (__runInitializers(this, _instanceExtraInitializers), breaker);
78
78
  this.sharedObject = sharedObject;
79
79
  this.serializer = serializer;
@@ -106,13 +106,13 @@ let SharedTreeCore = (() => {
106
106
  this.editManager = new EditManager(changeFamily, localSessionId, this.mintRevisionTag, (branchId) => this.registerSharedBranch(branchId), rebaseLogger);
107
107
  this.registerSharedBranch("main");
108
108
  const revisionTagCodec = new RevisionTagCodec(idCompressor);
109
- const editManagerCodec = makeEditManagerCodec(this.editManager.changeFamily.codecs, changeFormatVersionForEditManager, revisionTagCodec, options, formatOptions.editManager);
109
+ const editManagerCodec = makeEditManagerCodec(this.editManager.changeFamily.codecs, changeFormatVersionForEditManager, revisionTagCodec, options);
110
110
  this.summarizables = [
111
111
  new EditManagerSummarizer(this.editManager, editManagerCodec, this.idCompressor, this.schemaAndPolicy),
112
112
  ...summarizables,
113
113
  ];
114
114
  assert(new Set(this.summarizables.map((e) => e.key)).size === this.summarizables.length, 0x350 /* Index summary element keys must be unique */);
115
- this.messageCodec = makeMessageCodec(changeFamily.codecs, changeFormatVersionForMessage, new RevisionTagCodec(idCompressor), options, formatOptions.message);
115
+ this.messageCodec = makeMessageCodec(changeFamily.codecs, changeFormatVersionForMessage, new RevisionTagCodec(idCompressor), options);
116
116
  this.registerSharedBranchForEditing("main", enricher ?? new NoOpChangeEnricher(), resubmitMachine);
117
117
  }
118
118
  // TODO: SharedObject's merging of the two summary methods into summarizeCore is not what we want here:
@@ -1 +1 @@
1
- {"version":3,"file":"sharedTreeCore.js","sourceRoot":"","sources":["../../src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AAG,IAAI,EAAE,CAAC,CAAC;QAC5C,CAAC;QACD,KAAK,CAAC,QAAQ,CAAC,IAAI;YAClB,OAAO,OAAO,CAAC,QAAQ,CAAC,GAAG,KAAK,GAAG,IAAI,EAAE,CAAC,CAAC;QAC5C,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,IAAI;YACd,OAAO,OAAO,CAAC,IAAI,CAAC,GAAG,KAAK,GAAG,IAAI,EAAE,CAAC,CAAC;QACxC,CAAC;QACD,eAAe;YACd,MAAM,YAAY,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;YAC/C,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;gBAChC,OAAO,SAAS,CAAC;YAClB,CAAC;YACD,IAAI,UAAU,GAAG,YAAY,CAAC;YAC9B,KAAK,MAAM,OAAO,IAAI,YAAY,EAAE,CAAC;gBACpC,MAAM,IAAI,GAAG,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;gBACvC,MAAM,CACL,IAAI,KAAK,SAAS,EAClB,KAAK,CAAC,6DAA6D,CACnE,CAAC;gBACF,UAAU,GAAG,IAAI,CAAC;YACnB,CAAC;YACD,OAAO,UAAU,CAAC;QACnB,CAAC;KACD,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IFluidLoadable, ITelemetryBaseLogger } from \"@fluidframework/core-interfaces\";\nimport { assert, fail, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport type { IChannelStorageService } from \"@fluidframework/datastore-definitions/internal\";\nimport type { ISnapshotTree } from \"@fluidframework/driver-definitions/internal\";\nimport type {\n\tIIdCompressor,\n\tSessionId,\n\tSessionSpaceCompressedId,\n} from \"@fluidframework/id-compressor\";\nimport type {\n\tIExperimentalIncrementalSummaryContext,\n\tIRuntimeMessageCollection,\n\tISummaryTreeWithStats,\n\tITelemetryContext,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport { SummaryTreeBuilder } from \"@fluidframework/runtime-utils/internal\";\nimport type {\n\tIChannelView,\n\tIFluidSerializer,\n} from \"@fluidframework/shared-object-base/internal\";\nimport { createChildLogger } from \"@fluidframework/telemetry-utils/internal\";\n\nimport type { DependentFormatVersion, ICodecOptions, IJsonCodec } from \"../codec/index.js\";\nimport {\n\ttype ChangeFamily,\n\ttype ChangeFamilyEditor,\n\ttype GraphCommit,\n\ttype RevisionTag,\n\tRevisionTagCodec,\n\ttype SchemaAndPolicy,\n\ttype SchemaPolicy,\n\ttype TaggedChange,\n\ttype TreeStoredSchemaRepository,\n} from \"../core/index.js\";\nimport {\n\ttype JsonCompatibleReadOnly,\n\tbrand,\n\ttype Breakable,\n\ttype WithBreakable,\n\tthrowIfBroken,\n\tbreakingClass,\n} from \"../util/index.js\";\n\nimport type { BranchId, SharedTreeBranch } from \"./branch.js\";\nimport { BranchCommitEnricher } from \"./branchCommitEnricher.js\";\nimport { type ChangeEnricherReadonlyCheckout, NoOpChangeEnricher } from \"./changeEnricher.js\";\nimport { DefaultResubmitMachine } from \"./defaultResubmitMachine.js\";\nimport { EditManager, minimumPossibleSequenceNumber } from \"./editManager.js\";\nimport { makeEditManagerCodec, type EditManagerFormatVersion } from \"./editManagerCodecs.js\";\nimport type { SeqNumber } from \"./editManagerFormatCommons.js\";\nimport { EditManagerSummarizer } from \"./editManagerSummarizer.js\";\nimport {\n\ttype MessageEncodingContext,\n\ttype MessageFormatVersion,\n\tmakeMessageCodec,\n} from \"./messageCodecs.js\";\nimport type { DecodedMessage } from \"./messageTypes.js\";\nimport type { ResubmitMachine } from \"./resubmitMachine.js\";\n\n// TODO: Organize this to be adjacent to persisted types.\nconst summarizablesTreeKey = \"indexes\";\n\nexport interface ExplicitCoreCodecVersions {\n\teditManager: EditManagerFormatVersion;\n\tmessage: MessageFormatVersion;\n}\n\nexport interface ClonableSchemaAndPolicy extends SchemaAndPolicy {\n\tschema: TreeStoredSchemaRepository;\n}\n\n/**\n * Generic shared tree, which needs to be configured with indexes, field kinds and other configuration.\n */\n@breakingClass\nexport class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>\n\timplements WithBreakable\n{\n\tprivate readonly editManager: EditManager<TEditor, TChange, ChangeFamily<TEditor, TChange>>;\n\tprivate readonly summarizables: readonly [EditManagerSummarizer<TChange>, ...Summarizable[]];\n\t/**\n\t * The sequence number that this instance is at.\n\t * This number is artificial in that it is made up by this instance as opposed to being provided by the runtime.\n\t * Is `undefined` after (and only after) this instance is attached.\n\t */\n\tprivate detachedRevision: SeqNumber | undefined = minimumPossibleSequenceNumber;\n\n\t/**\n\t * Used to encode/decode messages sent to/received from the Fluid runtime.\n\t *\n\t * @remarks Since there is currently only one format, this can just be cached on the class.\n\t * With more write formats active, it may make sense to keep around the \"usual\" format codec\n\t * (the one for the current persisted configuration) and resolve codecs for different versions\n\t * as necessary (e.g. an upgrade op came in, or the configuration changed within the collab window\n\t * and an op needs to be interpreted which isn't written with the current configuration).\n\t */\n\tprivate readonly messageCodec: IJsonCodec<\n\t\tDecodedMessage<TChange>,\n\t\tunknown,\n\t\tunknown,\n\t\tMessageEncodingContext\n\t>;\n\n\tprivate readonly enrichers: Map<BranchId, EnricherState<TChange>> = new Map();\n\n\tpublic readonly mintRevisionTag: () => RevisionTag;\n\n\tprivate readonly schemaAndPolicy: ClonableSchemaAndPolicy;\n\n\t/**\n\t * @param summarizables - Summarizers for all indexes used by this tree\n\t * @param changeFamily - The change family\n\t * @param editManager - The edit manager\n\t * @param runtime - The IFluidDataStoreRuntime which contains the shared object\n\t * @param editor - Used to edit the state of the tree. Edits will be immediately applied locally to the tree.\n\t * If there is no transaction currently ongoing, then the edits will be submitted to Fluid immediately as well.\n\t */\n\tpublic constructor(\n\t\tpublic readonly breaker: Breakable,\n\t\tpublic readonly sharedObject: IChannelView & IFluidLoadable,\n\t\tpublic readonly serializer: IFluidSerializer,\n\t\tpublic readonly submitLocalMessage: (content: unknown, localOpMetadata?: unknown) => void,\n\t\tlogger: ITelemetryBaseLogger | undefined,\n\t\tsummarizables: readonly Summarizable[],\n\t\tprotected readonly changeFamily: ChangeFamily<TEditor, TChange>,\n\t\toptions: ICodecOptions,\n\t\tformatOptions: ExplicitCoreCodecVersions,\n\t\tchangeFormatVersionForEditManager: DependentFormatVersion<EditManagerFormatVersion>,\n\t\tchangeFormatVersionForMessage: DependentFormatVersion<MessageFormatVersion>,\n\t\tprotected readonly idCompressor: IIdCompressor,\n\t\tschema: TreeStoredSchemaRepository,\n\t\tschemaPolicy: SchemaPolicy,\n\t\tresubmitMachine?: ResubmitMachine<TChange>,\n\t\tenricher?: ChangeEnricherReadonlyCheckout<TChange>,\n\t\tpublic readonly getEditor: () => TEditor = () => this.getLocalBranch().editor,\n\t) {\n\t\tthis.schemaAndPolicy = {\n\t\t\tschema,\n\t\t\tpolicy: schemaPolicy,\n\t\t};\n\n\t\tconst rebaseLogger = createChildLogger({\n\t\t\tlogger,\n\t\t\tnamespace: \"Rebase\",\n\t\t});\n\n\t\tthis.mintRevisionTag = () => this.idCompressor.generateCompressedId();\n\t\t/**\n\t\t * A random ID that uniquely identifies this client in the collab session.\n\t\t * This is sent alongside every op to identify which client the op originated from.\n\t\t * This is used rather than the Fluid client ID because the Fluid client ID is not stable across reconnections.\n\t\t */\n\t\tconst localSessionId = idCompressor.localSessionId;\n\t\tthis.editManager = new EditManager(\n\t\t\tchangeFamily,\n\t\t\tlocalSessionId,\n\t\t\tthis.mintRevisionTag,\n\t\t\t(branchId) => this.registerSharedBranch(branchId),\n\t\t\trebaseLogger,\n\t\t);\n\n\t\tthis.registerSharedBranch(\"main\");\n\n\t\tconst revisionTagCodec = new RevisionTagCodec(idCompressor);\n\t\tconst editManagerCodec = makeEditManagerCodec(\n\t\t\tthis.editManager.changeFamily.codecs,\n\t\t\tchangeFormatVersionForEditManager,\n\t\t\trevisionTagCodec,\n\t\t\toptions,\n\t\t\tformatOptions.editManager,\n\t\t);\n\t\tthis.summarizables = [\n\t\t\tnew EditManagerSummarizer(\n\t\t\t\tthis.editManager,\n\t\t\t\teditManagerCodec,\n\t\t\t\tthis.idCompressor,\n\t\t\t\tthis.schemaAndPolicy,\n\t\t\t),\n\t\t\t...summarizables,\n\t\t];\n\t\tassert(\n\t\t\tnew Set(this.summarizables.map((e) => e.key)).size === this.summarizables.length,\n\t\t\t0x350 /* Index summary element keys must be unique */,\n\t\t);\n\n\t\tthis.messageCodec = makeMessageCodec(\n\t\t\tchangeFamily.codecs,\n\t\t\tchangeFormatVersionForMessage,\n\t\t\tnew RevisionTagCodec(idCompressor),\n\t\t\toptions,\n\t\t\tformatOptions.message,\n\t\t);\n\n\t\tthis.registerSharedBranchForEditing(\n\t\t\t\"main\",\n\t\t\tenricher ?? new NoOpChangeEnricher(),\n\t\t\tresubmitMachine,\n\t\t);\n\t}\n\n\t// TODO: SharedObject's merging of the two summary methods into summarizeCore is not what we want here:\n\t// We might want to not subclass it, or override/reimplement most of its functionality.\n\t@throwIfBroken\n\tpublic summarizeCore(\n\t\tserializer: IFluidSerializer,\n\t\ttelemetryContext?: ITelemetryContext,\n\t\tincrementalSummaryContext?: IExperimentalIncrementalSummaryContext,\n\t\tfullTree?: boolean,\n\t): ISummaryTreeWithStats {\n\t\tconst builder = new SummaryTreeBuilder();\n\t\tconst summarizableBuilder = new SummaryTreeBuilder();\n\t\t// Merge the summaries of all summarizables together under a single ISummaryTree\n\t\tfor (const s of this.summarizables) {\n\t\t\t// Add the summarizable's path in the summary tree to the incremental summary context's\n\t\t\t// summary path, so that the summarizable can use it to generate incremental summaries.\n\t\t\tconst childIncrementalSummaryContext =\n\t\t\t\tincrementalSummaryContext === undefined\n\t\t\t\t\t? undefined\n\t\t\t\t\t: {\n\t\t\t\t\t\t\t...incrementalSummaryContext,\n\t\t\t\t\t\t\tsummaryPath: `${incrementalSummaryContext.summaryPath}/${summarizablesTreeKey}/${s.key}`,\n\t\t\t\t\t\t};\n\t\t\tsummarizableBuilder.addWithStats(\n\t\t\t\ts.key,\n\t\t\t\ts.summarize({\n\t\t\t\t\tstringify: (contents: unknown) =>\n\t\t\t\t\t\tserializer.stringify(contents, this.sharedObject.handle),\n\t\t\t\t\tfullTree,\n\t\t\t\t\ttelemetryContext,\n\t\t\t\t\tincrementalSummaryContext: childIncrementalSummaryContext,\n\t\t\t\t}),\n\t\t\t);\n\t\t}\n\n\t\tbuilder.addWithStats(summarizablesTreeKey, summarizableBuilder.getSummaryTree());\n\t\treturn builder.getSummaryTree();\n\t}\n\n\tpublic async loadCore(services: IChannelStorageService): Promise<void> {\n\t\tassert(\n\t\t\tthis.getLocalBranch().getHead() === this.editManager.getTrunkHead(\"main\"),\n\t\t\t0xaaa /* All local changes should be applied to the trunk before loading from summary */,\n\t\t);\n\t\tconst [editManagerSummarizer, ...summarizables] = this.summarizables;\n\t\tconst loadEditManager = this.loadSummarizable(editManagerSummarizer, services);\n\t\tconst loadSummarizables = summarizables.map(async (s) =>\n\t\t\tthis.loadSummarizable(s, services),\n\t\t);\n\n\t\tif (this.detachedRevision !== undefined) {\n\t\t\t// If we are detached but loading from a summary, then we need to update our detached revision to ensure that it is ahead of all detached revisions in the summary.\n\t\t\t// First, finish loading the edit manager so that we can inspect the sequence numbers of the commits on the trunk.\n\t\t\tawait loadEditManager;\n\n\t\t\tconst latestDetachedSequenceNumber = this.editManager.getLatestSequenceNumber();\n\t\t\t// When we load a summary for a tree that was never attached,\n\t\t\t// latestDetachedSequenceNumber is either undefined (no commits in summary) or negative (all commits in summary were made while detached).\n\t\t\t// We only need to update `this.detachedRevision` in the latter case.\n\t\t\tif (latestDetachedSequenceNumber !== undefined && latestDetachedSequenceNumber < 0) {\n\t\t\t\tthis.detachedRevision = latestDetachedSequenceNumber;\n\t\t\t}\n\t\t\tawait Promise.all(loadSummarizables);\n\t\t} else {\n\t\t\tawait Promise.all([loadEditManager, ...loadSummarizables]);\n\t\t}\n\t}\n\n\tprivate registerSharedBranch(branchId: BranchId): void {\n\t\tthis.editManager.getLocalBranch(branchId).events.on(\"beforeChange\", (change) => {\n\t\t\tif (change.type === \"append\") {\n\t\t\t\tif (this.detachedRevision === undefined) {\n\t\t\t\t\t// Commit enrichment is only necessary for changes that will be submitted as ops, and changes issued while detached are not submitted.\n\t\t\t\t\tthis.getCommitEnricher(branchId).processChange(change);\n\t\t\t\t}\n\n\t\t\t\tfor (const commit of change.newCommits) {\n\t\t\t\t\tthis.submitCommit(branchId, commit, this.schemaAndPolicy, false);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\tprivate async loadSummarizable(\n\t\tsummarizable: Summarizable,\n\t\tservices: IChannelStorageService,\n\t): Promise<void> {\n\t\treturn summarizable.load(\n\t\t\tscopeStorageService(services, summarizablesTreeKey, summarizable.key),\n\t\t\t(contents) => this.serializer.parse(contents),\n\t\t);\n\t}\n\n\t/**\n\t * Submits an op to the Fluid runtime containing the given commit\n\t * @param commit - the commit to submit\n\t * @returns the submitted commit. This is undefined if the underlying `SharedObject` is not attached,\n\t * and may differ from `commit` due to enrichments like detached tree refreshers.\n\t */\n\tprotected submitCommit(\n\t\tbranchId: BranchId,\n\t\tcommit: GraphCommit<TChange>,\n\t\tschemaAndPolicy: ClonableSchemaAndPolicy,\n\t\tisResubmit: boolean,\n\t): void {\n\t\tassert(\n\t\t\tthis.sharedObject.isAttached() === (this.detachedRevision === undefined),\n\t\t\t0x95a /* Detached revision should only be set when not attached */,\n\t\t);\n\n\t\tconst enrichedCommit =\n\t\t\tthis.detachedRevision === undefined && !isResubmit\n\t\t\t\t? this.getCommitEnricher(branchId).enrich(commit)\n\t\t\t\t: commit;\n\n\t\t// Edits submitted before the first attach are treated as sequenced because they will be included\n\t\t// in the attach summary that is uploaded to the service.\n\t\t// Until this attach workflow happens, this instance essentially behaves as a centralized data structure.\n\t\tif (this.detachedRevision !== undefined) {\n\t\t\tconst newRevision: SeqNumber = brand((this.detachedRevision as number) + 1);\n\t\t\tthis.detachedRevision = newRevision;\n\t\t\tthis.editManager.addSequencedChanges(\n\t\t\t\t[enrichedCommit],\n\t\t\t\tthis.editManager.localSessionId,\n\t\t\t\tnewRevision,\n\t\t\t\tthis.detachedRevision,\n\t\t\t\tbranchId,\n\t\t\t);\n\t\t\tthis.editManager.advanceMinimumSequenceNumber(newRevision, false);\n\t\t\treturn undefined;\n\t\t}\n\n\t\tthis.submitMessage(\n\t\t\t{\n\t\t\t\ttype: \"commit\",\n\t\t\t\tcommit: enrichedCommit,\n\t\t\t\tsessionId: this.editManager.localSessionId,\n\t\t\t\tbranchId,\n\t\t\t},\n\t\t\tschemaAndPolicy,\n\t\t);\n\n\t\tthis.getResubmitMachine(branchId).onCommitSubmitted(enrichedCommit);\n\t}\n\n\tprotected submitBranchCreation(branchId: BranchId): void {\n\t\tthis.submitMessage(\n\t\t\t{ type: \"branch\", sessionId: this.editManager.localSessionId, branchId },\n\t\t\tthis.schemaAndPolicy,\n\t\t);\n\t}\n\n\tprivate submitMessage(\n\t\tmessage: DecodedMessage<TChange>,\n\t\tschemaAndPolicy: ClonableSchemaAndPolicy,\n\t): void {\n\t\tconst encodedMessage = this.messageCodec.encode(message, {\n\t\t\tidCompressor: this.idCompressor,\n\t\t\tschema: schemaAndPolicy,\n\t\t});\n\t\tthis.submitLocalMessage(encodedMessage, {\n\t\t\t// Clone the schema to ensure that during resubmit the schema has not been mutated by later changes\n\t\t\tschema: schemaAndPolicy.schema.clone(),\n\t\t\tpolicy: schemaAndPolicy.policy,\n\t\t});\n\t}\n\n\t/**\n\t * Process a bunch of messages from the runtime. SharedObject will call this method with a bunch of messages.\n\t */\n\tpublic processMessagesCore(messagesCollection: IRuntimeMessageCollection): void {\n\t\tconst { envelope, local, messagesContent } = messagesCollection;\n\t\tconst commits: GraphCommit<TChange>[] = [];\n\t\tlet messagesSessionId: SessionId | undefined;\n\t\tlet branchId: BranchId | undefined;\n\n\t\tconst processBunch = (branch: BranchId): void => {\n\t\t\tassert(messagesSessionId !== undefined, 0xada /* Messages must have a session ID */);\n\t\t\tthis.processCommits(\n\t\t\t\tmessagesSessionId,\n\t\t\t\tbrand(envelope.sequenceNumber),\n\t\t\t\tbrand(envelope.referenceSequenceNumber),\n\t\t\t\tlocal,\n\t\t\t\tbranch,\n\t\t\t\tcommits,\n\t\t\t);\n\n\t\t\tcommits.length = 0;\n\t\t\tbranchId = undefined;\n\t\t};\n\n\t\t// Get a list of all the commits from the messages.\n\t\tfor (const messageContent of messagesContent) {\n\t\t\t// Empty context object is passed in, as our decode function is schema-agnostic.\n\t\t\tconst message = this.messageCodec.decode(messageContent.contents, {\n\t\t\t\tidCompressor: this.idCompressor,\n\t\t\t});\n\n\t\t\tif (messagesSessionId !== undefined) {\n\t\t\t\tassert(\n\t\t\t\t\tmessagesSessionId === message.sessionId,\n\t\t\t\t\t0xad9 /* All messages in a bunch must have the same session ID */,\n\t\t\t\t);\n\t\t\t}\n\t\t\tmessagesSessionId = message.sessionId;\n\n\t\t\tconst type = message.type;\n\t\t\tswitch (type) {\n\t\t\t\tcase \"commit\": {\n\t\t\t\t\tif (branchId !== undefined && message.branchId !== branchId) {\n\t\t\t\t\t\tprocessBunch(branchId);\n\t\t\t\t\t}\n\n\t\t\t\t\tbranchId = message.branchId;\n\t\t\t\t\tcommits.push(message.commit);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"branch\": {\n\t\t\t\t\tif (branchId !== undefined) {\n\t\t\t\t\t\tprocessBunch(branchId);\n\t\t\t\t\t}\n\t\t\t\t\tthis.editManager.sequenceBranchCreation(\n\t\t\t\t\t\tmessagesSessionId,\n\t\t\t\t\t\tbrand(envelope.referenceSequenceNumber),\n\t\t\t\t\t\tmessage.branchId,\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tunreachableCase(type);\n\t\t\t}\n\t\t}\n\n\t\tif (branchId !== undefined) {\n\t\t\tprocessBunch(branchId);\n\t\t}\n\n\t\tthis.editManager.advanceMinimumSequenceNumber(brand(envelope.minimumSequenceNumber));\n\t}\n\n\tprivate processCommits(\n\t\tsessionId: SessionId,\n\t\tsequenceNumber: SeqNumber,\n\t\treferenceSequenceNumber: SeqNumber,\n\t\tisLocal: boolean,\n\t\tbranchId: BranchId,\n\t\tcommits: readonly GraphCommit<TChange>[],\n\t): void {\n\t\tthis.editManager.addSequencedChanges(\n\t\t\tcommits,\n\t\t\tsessionId,\n\t\t\tsequenceNumber,\n\t\t\treferenceSequenceNumber,\n\t\t\tbranchId,\n\t\t);\n\n\t\t// Update the resubmit machine for each commit applied.\n\t\tfor (const commit of commits) {\n\t\t\tthis.tryGetResubmitMachine(branchId)?.onSequencedCommitApplied(commit.revision, isLocal);\n\t\t}\n\t}\n\n\tpublic getLocalBranch(): SharedTreeBranch<TEditor, TChange> {\n\t\treturn this.editManager.getLocalBranch(\"main\");\n\t}\n\n\tpublic getSharedBranchIds(): string[] {\n\t\treturn this.editManager\n\t\t\t.getSharedBranchIds()\n\t\t\t.filter((id): id is SessionSpaceCompressedId => id !== \"main\")\n\t\t\t.map((id) => this.idCompressor.decompress(id));\n\t}\n\tpublic createSharedBranch(): string {\n\t\tconst branchId = this.idCompressor.generateCompressedId();\n\t\tthis.addBranch(branchId);\n\t\tthis.submitBranchCreation(branchId);\n\t\treturn this.idCompressor.decompress(branchId);\n\t}\n\n\tprotected addBranch(branchId: BranchId): void {\n\t\tthis.editManager.addNewBranch(branchId);\n\t}\n\n\tpublic getSharedBranch(branchId: BranchId): SharedTreeBranch<TEditor, TChange> {\n\t\treturn this.editManager.getLocalBranch(branchId);\n\t}\n\n\tpublic didAttach(): void {\n\t\tthis.detachedRevision = undefined;\n\t}\n\n\tpublic reSubmitCore(content: JsonCompatibleReadOnly, localOpMetadata: unknown): void {\n\t\t// Empty context object is passed in, as our decode function is schema-agnostic.\n\t\tconst message = this.messageCodec.decode(this.serializer.decode(content), {\n\t\t\tidCompressor: this.idCompressor,\n\t\t});\n\n\t\tconst type = message.type;\n\t\tswitch (type) {\n\t\t\tcase \"commit\": {\n\t\t\t\tconst {\n\t\t\t\t\tcommit: { revision },\n\t\t\t\t\tbranchId,\n\t\t\t\t} = message;\n\n\t\t\t\tconst resubmitMachine = this.getResubmitMachine(branchId);\n\n\t\t\t\tconst getLocalCommits = (): GraphCommit<TChange>[] => {\n\t\t\t\t\tconst localCommits = this.editManager.getLocalCommits(branchId);\n\t\t\t\t\tconst revisionIndex = localCommits.findIndex((c) => c.revision === revision);\n\t\t\t\t\tassert(revisionIndex >= 0, 0xbdb /* revision must exist in local commits */);\n\t\t\t\t\treturn localCommits.slice(revisionIndex);\n\t\t\t\t};\n\n\t\t\t\tassert(\n\t\t\t\t\tisClonableSchemaPolicy(localOpMetadata),\n\t\t\t\t\t0x95e /* Local metadata must contain schema and policy. */,\n\t\t\t\t);\n\n\t\t\t\tconst enrichedCommit = resubmitMachine.getEnrichedCommit(revision, getLocalCommits);\n\t\t\t\tif (enrichedCommit !== undefined) {\n\t\t\t\t\tthis.submitCommit(branchId, enrichedCommit, localOpMetadata, true);\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"branch\": {\n\t\t\t\tthis.submitBranchCreation(message.branchId);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tunreachableCase(type);\n\t\t}\n\t}\n\n\tpublic rollback(content: JsonCompatibleReadOnly, localOpMetadata: unknown): void {\n\t\t// Empty context object is passed in, as our decode function is schema-agnostic.\n\t\tconst message = this.messageCodec.decode(this.serializer.decode(content), {\n\t\t\tidCompressor: this.idCompressor,\n\t\t});\n\n\t\tconst type = message.type;\n\t\tswitch (type) {\n\t\t\tcase \"commit\": {\n\t\t\t\tconst {\n\t\t\t\t\tcommit: { revision },\n\t\t\t\t\tbranchId,\n\t\t\t\t} = message;\n\t\t\t\tconst branch = this.editManager.getLocalBranch(branchId);\n\t\t\t\tconst head = branch.getHead();\n\t\t\t\tassert(head.revision === revision, 0xc6b /* Can only rollback latest commit */);\n\t\t\t\tconst newHead = head.parent ?? fail(0xc6c /* must have parent */);\n\t\t\t\tbranch.removeAfter(newHead);\n\t\t\t\tthis.getResubmitMachine(branchId).onCommitRollback(head);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"branch\": {\n\t\t\t\tthis.editManager.removeBranch(message.branchId);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tunreachableCase(type);\n\t\t}\n\t}\n\n\tpublic applyStashedOp(content: JsonCompatibleReadOnly): void {\n\t\t// Empty context object is passed in, as our decode function is schema-agnostic.\n\t\tconst message = this.messageCodec.decode(this.serializer.decode(content), {\n\t\t\tidCompressor: this.idCompressor,\n\t\t});\n\n\t\tconst type = message.type;\n\t\tswitch (type) {\n\t\t\tcase \"commit\": {\n\t\t\t\tconst {\n\t\t\t\t\tcommit: { revision, change },\n\t\t\t\t\tbranchId,\n\t\t\t\t} = message;\n\t\t\t\tthis.editManager.getLocalBranch(branchId).apply({ change, revision });\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"branch\": {\n\t\t\t\tthis.editManager.addNewBranch(message.branchId);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tunreachableCase(type);\n\t\t}\n\t}\n\n\tprotected registerSharedBranchForEditing(\n\t\tbranchId: BranchId,\n\t\tenricher: ChangeEnricherReadonlyCheckout<TChange>,\n\t\tresubmitMachine?: ResubmitMachine<TChange>,\n\t): void {\n\t\tconst changeEnricher = enricher ?? new NoOpChangeEnricher();\n\t\tconst commitEnricher = new BranchCommitEnricher(this.changeFamily.rebaser, changeEnricher);\n\t\tassert(!this.enrichers.has(branchId), 0xc6d /* Branch already registered */);\n\t\tthis.enrichers.set(branchId, {\n\t\t\tenricher: commitEnricher,\n\t\t\tresubmitMachine:\n\t\t\t\tresubmitMachine ??\n\t\t\t\tnew DefaultResubmitMachine(\n\t\t\t\t\t(change: TaggedChange<TChange>) =>\n\t\t\t\t\t\tthis.changeFamily.rebaser.invert(change, true, this.mintRevisionTag()),\n\t\t\t\t\tchangeEnricher,\n\t\t\t\t),\n\t\t});\n\t}\n\n\tprivate getResubmitMachine(branchId: BranchId): ResubmitMachine<TChange> {\n\t\treturn this.getEnricherState(branchId).resubmitMachine;\n\t}\n\n\tprivate tryGetResubmitMachine(branchId: BranchId): ResubmitMachine<TChange> | undefined {\n\t\treturn this.tryGetEnricherState(branchId)?.resubmitMachine;\n\t}\n\n\tpublic getCommitEnricher(branchId: BranchId): BranchCommitEnricher<TChange> {\n\t\treturn this.getEnricherState(branchId).enricher;\n\t}\n\n\tprivate getEnricherState(branchId: BranchId): EnricherState<TChange> {\n\t\treturn (\n\t\t\tthis.tryGetEnricherState(branchId) ??\n\t\t\tfail(0xc6e /* Expected to have a resubmit machine for this branch */)\n\t\t);\n\t}\n\n\tprivate tryGetEnricherState(branchId: BranchId): EnricherState<TChange> | undefined {\n\t\treturn this.enrichers.get(branchId);\n\t}\n}\n\ninterface EnricherState<TChange> {\n\treadonly enricher: BranchCommitEnricher<TChange>;\n\treadonly resubmitMachine: ResubmitMachine<TChange>;\n}\n\nfunction isClonableSchemaPolicy(\n\tmaybeSchemaPolicy: unknown,\n): maybeSchemaPolicy is ClonableSchemaAndPolicy {\n\tconst schemaAndPolicy = maybeSchemaPolicy as ClonableSchemaAndPolicy;\n\treturn schemaAndPolicy.schema !== undefined && schemaAndPolicy.policy !== undefined;\n}\n\n/**\n * Specifies the behavior of a component that puts data in a summary.\n */\nexport interface Summarizable {\n\t/**\n\t * Field name in summary json under which this element stores its data.\n\t */\n\treadonly key: string;\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).summarize}\n\t * @param stringify - Serializes the contents of the component (including {@link (IFluidHandle:interface)}s) for storage.\n\t * @param fullTree - A flag indicating whether the attempt should generate a full\n\t * summary tree without any handles for unchanged subtrees. It should only be set to true when generating\n\t * a summary from the entire container. The default value is false.\n\t * @param trackState - An optimization for tracking state of objects across summaries. If the state\n\t * of an object did not change since last successful summary, an\n\t * {@link @fluidframework/protocol-definitions#ISummaryHandle} can be used\n\t * instead of re-summarizing it. If this is `false`, the expectation is that you should never\n\t * send an `ISummaryHandle`, since you are not expected to track state. The default value is true.\n\t * @param telemetryContext - See {@link @fluidframework/runtime-definitions#ITelemetryContext}.\n\t * @param incrementalSummaryContext - See {@link @fluidframework/runtime-definitions#IExperimentalIncrementalSummaryContext}.\n\t */\n\tsummarize(props: {\n\t\tstringify: SummaryElementStringifier;\n\t\tfullTree?: boolean;\n\t\ttrackState?: boolean;\n\t\ttelemetryContext?: ITelemetryContext;\n\t\tincrementalSummaryContext?: IExperimentalIncrementalSummaryContext;\n\t}): ISummaryTreeWithStats;\n\n\t/**\n\t * Allows the component to perform custom loading. The storage service is scoped to this component and therefore\n\t * paths in this component will not collide with those in other components, even if they are the same string.\n\t * @param service - Storage used by the component\n\t * @param parse - Parses serialized data from storage into runtime objects for the component\n\t */\n\tload(service: IChannelStorageService, parse: SummaryElementParser): Promise<void>;\n}\n\n/**\n * Serializes the given contents into a string acceptable for storing in summaries, i.e. all\n * Fluid handles have been replaced appropriately by an IFluidSerializer\n */\nexport type SummaryElementStringifier = (contents: unknown) => string;\n\n/**\n * Parses a serialized/summarized string into an object, rehydrating any Fluid handles as necessary\n */\nexport type SummaryElementParser = (contents: string) => unknown;\n\n/**\n * Compose an {@link IChannelStorageService} which prefixes all paths before forwarding them to the original service\n */\nfunction scopeStorageService(\n\tservice: IChannelStorageService,\n\t...pathElements: string[]\n): IChannelStorageService {\n\tconst scope = `${pathElements.join(\"/\")}/`;\n\n\treturn {\n\t\tasync readBlob(path: string): Promise<ArrayBufferLike> {\n\t\t\treturn service.readBlob(`${scope}${path}`);\n\t\t},\n\t\tasync contains(path) {\n\t\t\treturn service.contains(`${scope}${path}`);\n\t\t},\n\t\tasync list(path) {\n\t\t\treturn service.list(`${scope}${path}`);\n\t\t},\n\t\tgetSnapshotTree(): ISnapshotTree | undefined {\n\t\t\tconst snapshotTree = service.getSnapshotTree();\n\t\t\tif (snapshotTree === undefined) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tlet scopedTree = snapshotTree;\n\t\t\tfor (const element of pathElements) {\n\t\t\t\tconst tree = scopedTree.trees[element];\n\t\t\t\tassert(\n\t\t\t\t\ttree !== undefined,\n\t\t\t\t\t0xc20 /* snapshot tree not found for one of tree's summarizables */,\n\t\t\t\t);\n\t\t\t\tscopedTree = tree;\n\t\t\t}\n\t\t\treturn scopedTree;\n\t\t},\n\t};\n}\n"]}
1
+ {"version":3,"file":"sharedTreeCore.js","sourceRoot":"","sources":["../../src/shared-tree-core/sharedTreeCore.ts"],"names":[],"mappings":"AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGH,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAcpF,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAK5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAG7E,OAAO,EAKN,gBAAgB,GAKhB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAEN,KAAK,EAGL,aAAa,EACb,aAAa,GACb,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAuC,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC9F,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,6BAA6B,EAAE,MAAM,kBAAkB,CAAC;AAC9E,OAAO,EAAE,oBAAoB,EAAgC,MAAM,wBAAwB,CAAC;AAE5F,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAGN,gBAAgB,GAChB,MAAM,oBAAoB,CAAC;AAK5B,yDAAyD;AACzD,MAAM,oBAAoB,GAAG,SAAS,CAAC;AAWvC;;GAEG;IAEU,cAAc;4BA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M,KAAK,SAAS,CAAC;AACrF,CAAC;AAqDD;;GAEG;AACH,SAAS,mBAAmB,CAC3B,OAA+B,EAC/B,GAAG,YAAsB;IAEzB,MAAM,KAAK,GAAG,GAAG,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;IAE3C,OAAO;QACN,KAAK,CAAC,QAAQ,CAAC,IAAY;YAC1B,OAAO,OAAO,CAAC,QAAQ,CAAC,GAAG,KAAK,GAAG,IAAI,EAAE,CAAC,CAAC;QAC5C,CAAC;QACD,KAAK,CAAC,QAAQ,CAAC,IAAI;YAClB,OAAO,OAAO,CAAC,QAAQ,CAAC,GAAG,KAAK,GAAG,IAAI,EAAE,CAAC,CAAC;QAC5C,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,IAAI;YACd,OAAO,OAAO,CAAC,IAAI,CAAC,GAAG,KAAK,GAAG,IAAI,EAAE,CAAC,CAAC;QACxC,CAAC;QACD,eAAe;YACd,MAAM,YAAY,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;YAC/C,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;gBAChC,OAAO,SAAS,CAAC;YAClB,CAAC;YACD,IAAI,UAAU,GAAG,YAAY,CAAC;YAC9B,KAAK,MAAM,OAAO,IAAI,YAAY,EAAE,CAAC;gBACpC,MAAM,IAAI,GAAG,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;gBACvC,MAAM,CACL,IAAI,KAAK,SAAS,EAClB,KAAK,CAAC,6DAA6D,CACnE,CAAC;gBACF,UAAU,GAAG,IAAI,CAAC;YACnB,CAAC;YACD,OAAO,UAAU,CAAC;QACnB,CAAC;KACD,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IFluidLoadable, ITelemetryBaseLogger } from \"@fluidframework/core-interfaces\";\nimport { assert, fail, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport type { IChannelStorageService } from \"@fluidframework/datastore-definitions/internal\";\nimport type { ISnapshotTree } from \"@fluidframework/driver-definitions/internal\";\nimport type {\n\tIIdCompressor,\n\tSessionId,\n\tSessionSpaceCompressedId,\n} from \"@fluidframework/id-compressor\";\nimport type {\n\tIExperimentalIncrementalSummaryContext,\n\tIRuntimeMessageCollection,\n\tISummaryTreeWithStats,\n\tITelemetryContext,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport { SummaryTreeBuilder } from \"@fluidframework/runtime-utils/internal\";\nimport type {\n\tIChannelView,\n\tIFluidSerializer,\n} from \"@fluidframework/shared-object-base/internal\";\nimport { createChildLogger } from \"@fluidframework/telemetry-utils/internal\";\n\nimport type { CodecWriteOptions, DependentFormatVersion, IJsonCodec } from \"../codec/index.js\";\nimport {\n\ttype ChangeFamily,\n\ttype ChangeFamilyEditor,\n\ttype GraphCommit,\n\ttype RevisionTag,\n\tRevisionTagCodec,\n\ttype SchemaAndPolicy,\n\ttype SchemaPolicy,\n\ttype TaggedChange,\n\ttype TreeStoredSchemaRepository,\n} from \"../core/index.js\";\nimport {\n\ttype JsonCompatibleReadOnly,\n\tbrand,\n\ttype Breakable,\n\ttype WithBreakable,\n\tthrowIfBroken,\n\tbreakingClass,\n} from \"../util/index.js\";\n\nimport type { BranchId, SharedTreeBranch } from \"./branch.js\";\nimport { BranchCommitEnricher } from \"./branchCommitEnricher.js\";\nimport { type ChangeEnricherReadonlyCheckout, NoOpChangeEnricher } from \"./changeEnricher.js\";\nimport { DefaultResubmitMachine } from \"./defaultResubmitMachine.js\";\nimport { EditManager, minimumPossibleSequenceNumber } from \"./editManager.js\";\nimport { makeEditManagerCodec, type EditManagerCodecOptions } from \"./editManagerCodecs.js\";\nimport type { EditManagerFormatVersion, SeqNumber } from \"./editManagerFormatCommons.js\";\nimport { EditManagerSummarizer } from \"./editManagerSummarizer.js\";\nimport {\n\ttype MessageCodecOptions,\n\ttype MessageEncodingContext,\n\tmakeMessageCodec,\n} from \"./messageCodecs.js\";\nimport type { DecodedMessage } from \"./messageTypes.js\";\nimport type { ResubmitMachine } from \"./resubmitMachine.js\";\nimport type { MessageFormatVersion } from \"./messageFormat.js\";\n\n// TODO: Organize this to be adjacent to persisted types.\nconst summarizablesTreeKey = \"indexes\";\n\nexport interface ClonableSchemaAndPolicy extends SchemaAndPolicy {\n\tschema: TreeStoredSchemaRepository;\n}\n\nexport interface SharedTreeCoreOptionsInternal\n\textends CodecWriteOptions,\n\t\tEditManagerCodecOptions,\n\t\tMessageCodecOptions {}\n\n/**\n * Generic shared tree, which needs to be configured with indexes, field kinds and other configuration.\n */\n@breakingClass\nexport class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>\n\timplements WithBreakable\n{\n\tprivate readonly editManager: EditManager<TEditor, TChange, ChangeFamily<TEditor, TChange>>;\n\tprivate readonly summarizables: readonly [EditManagerSummarizer<TChange>, ...Summarizable[]];\n\t/**\n\t * The sequence number that this instance is at.\n\t * This number is artificial in that it is made up by this instance as opposed to being provided by the runtime.\n\t * Is `undefined` after (and only after) this instance is attached.\n\t */\n\tprivate detachedRevision: SeqNumber | undefined = minimumPossibleSequenceNumber;\n\n\t/**\n\t * Used to encode/decode messages sent to/received from the Fluid runtime.\n\t *\n\t * @remarks Since there is currently only one format, this can just be cached on the class.\n\t * With more write formats active, it may make sense to keep around the \"usual\" format codec\n\t * (the one for the current persisted configuration) and resolve codecs for different versions\n\t * as necessary (e.g. an upgrade op came in, or the configuration changed within the collab window\n\t * and an op needs to be interpreted which isn't written with the current configuration).\n\t */\n\tprivate readonly messageCodec: IJsonCodec<\n\t\tDecodedMessage<TChange>,\n\t\tunknown,\n\t\tunknown,\n\t\tMessageEncodingContext\n\t>;\n\n\tprivate readonly enrichers: Map<BranchId, EnricherState<TChange>> = new Map();\n\n\tpublic readonly mintRevisionTag: () => RevisionTag;\n\n\tprivate readonly schemaAndPolicy: ClonableSchemaAndPolicy;\n\n\t/**\n\t * @param summarizables - Summarizers for all indexes used by this tree\n\t * @param changeFamily - The change family\n\t * @param editManager - The edit manager\n\t * @param runtime - The IFluidDataStoreRuntime which contains the shared object\n\t * @param editor - Used to edit the state of the tree. Edits will be immediately applied locally to the tree.\n\t * If there is no transaction currently ongoing, then the edits will be submitted to Fluid immediately as well.\n\t */\n\tpublic constructor(\n\t\tpublic readonly breaker: Breakable,\n\t\tpublic readonly sharedObject: IChannelView & IFluidLoadable,\n\t\tpublic readonly serializer: IFluidSerializer,\n\t\tpublic readonly submitLocalMessage: (content: unknown, localOpMetadata?: unknown) => void,\n\t\tlogger: ITelemetryBaseLogger | undefined,\n\t\tsummarizables: readonly Summarizable[],\n\t\tprotected readonly changeFamily: ChangeFamily<TEditor, TChange>,\n\t\toptions: SharedTreeCoreOptionsInternal,\n\t\tchangeFormatVersionForEditManager: DependentFormatVersion<EditManagerFormatVersion>,\n\t\tchangeFormatVersionForMessage: DependentFormatVersion<MessageFormatVersion>,\n\t\tprotected readonly idCompressor: IIdCompressor,\n\t\tschema: TreeStoredSchemaRepository,\n\t\tschemaPolicy: SchemaPolicy,\n\t\tresubmitMachine?: ResubmitMachine<TChange>,\n\t\tenricher?: ChangeEnricherReadonlyCheckout<TChange>,\n\t\tpublic readonly getEditor: () => TEditor = () => this.getLocalBranch().editor,\n\t) {\n\t\tthis.schemaAndPolicy = {\n\t\t\tschema,\n\t\t\tpolicy: schemaPolicy,\n\t\t};\n\n\t\tconst rebaseLogger = createChildLogger({\n\t\t\tlogger,\n\t\t\tnamespace: \"Rebase\",\n\t\t});\n\n\t\tthis.mintRevisionTag = () => this.idCompressor.generateCompressedId();\n\t\t/**\n\t\t * A random ID that uniquely identifies this client in the collab session.\n\t\t * This is sent alongside every op to identify which client the op originated from.\n\t\t * This is used rather than the Fluid client ID because the Fluid client ID is not stable across reconnections.\n\t\t */\n\t\tconst localSessionId = idCompressor.localSessionId;\n\t\tthis.editManager = new EditManager(\n\t\t\tchangeFamily,\n\t\t\tlocalSessionId,\n\t\t\tthis.mintRevisionTag,\n\t\t\t(branchId) => this.registerSharedBranch(branchId),\n\t\t\trebaseLogger,\n\t\t);\n\n\t\tthis.registerSharedBranch(\"main\");\n\n\t\tconst revisionTagCodec = new RevisionTagCodec(idCompressor);\n\t\tconst editManagerCodec = makeEditManagerCodec(\n\t\t\tthis.editManager.changeFamily.codecs,\n\t\t\tchangeFormatVersionForEditManager,\n\t\t\trevisionTagCodec,\n\t\t\toptions,\n\t\t);\n\t\tthis.summarizables = [\n\t\t\tnew EditManagerSummarizer(\n\t\t\t\tthis.editManager,\n\t\t\t\teditManagerCodec,\n\t\t\t\tthis.idCompressor,\n\t\t\t\tthis.schemaAndPolicy,\n\t\t\t),\n\t\t\t...summarizables,\n\t\t];\n\t\tassert(\n\t\t\tnew Set(this.summarizables.map((e) => e.key)).size === this.summarizables.length,\n\t\t\t0x350 /* Index summary element keys must be unique */,\n\t\t);\n\n\t\tthis.messageCodec = makeMessageCodec(\n\t\t\tchangeFamily.codecs,\n\t\t\tchangeFormatVersionForMessage,\n\t\t\tnew RevisionTagCodec(idCompressor),\n\t\t\toptions,\n\t\t);\n\n\t\tthis.registerSharedBranchForEditing(\n\t\t\t\"main\",\n\t\t\tenricher ?? new NoOpChangeEnricher(),\n\t\t\tresubmitMachine,\n\t\t);\n\t}\n\n\t// TODO: SharedObject's merging of the two summary methods into summarizeCore is not what we want here:\n\t// We might want to not subclass it, or override/reimplement most of its functionality.\n\t@throwIfBroken\n\tpublic summarizeCore(\n\t\tserializer: IFluidSerializer,\n\t\ttelemetryContext?: ITelemetryContext,\n\t\tincrementalSummaryContext?: IExperimentalIncrementalSummaryContext,\n\t\tfullTree?: boolean,\n\t): ISummaryTreeWithStats {\n\t\tconst builder = new SummaryTreeBuilder();\n\t\tconst summarizableBuilder = new SummaryTreeBuilder();\n\t\t// Merge the summaries of all summarizables together under a single ISummaryTree\n\t\tfor (const s of this.summarizables) {\n\t\t\t// Add the summarizable's path in the summary tree to the incremental summary context's\n\t\t\t// summary path, so that the summarizable can use it to generate incremental summaries.\n\t\t\tconst childIncrementalSummaryContext =\n\t\t\t\tincrementalSummaryContext === undefined\n\t\t\t\t\t? undefined\n\t\t\t\t\t: {\n\t\t\t\t\t\t\t...incrementalSummaryContext,\n\t\t\t\t\t\t\tsummaryPath: `${incrementalSummaryContext.summaryPath}/${summarizablesTreeKey}/${s.key}`,\n\t\t\t\t\t\t};\n\t\t\tsummarizableBuilder.addWithStats(\n\t\t\t\ts.key,\n\t\t\t\ts.summarize({\n\t\t\t\t\tstringify: (contents: unknown) =>\n\t\t\t\t\t\tserializer.stringify(contents, this.sharedObject.handle),\n\t\t\t\t\tfullTree,\n\t\t\t\t\ttelemetryContext,\n\t\t\t\t\tincrementalSummaryContext: childIncrementalSummaryContext,\n\t\t\t\t}),\n\t\t\t);\n\t\t}\n\n\t\tbuilder.addWithStats(summarizablesTreeKey, summarizableBuilder.getSummaryTree());\n\t\treturn builder.getSummaryTree();\n\t}\n\n\tpublic async loadCore(services: IChannelStorageService): Promise<void> {\n\t\tassert(\n\t\t\tthis.getLocalBranch().getHead() === this.editManager.getTrunkHead(\"main\"),\n\t\t\t0xaaa /* All local changes should be applied to the trunk before loading from summary */,\n\t\t);\n\t\tconst [editManagerSummarizer, ...summarizables] = this.summarizables;\n\t\tconst loadEditManager = this.loadSummarizable(editManagerSummarizer, services);\n\t\tconst loadSummarizables = summarizables.map(async (s) =>\n\t\t\tthis.loadSummarizable(s, services),\n\t\t);\n\n\t\tif (this.detachedRevision !== undefined) {\n\t\t\t// If we are detached but loading from a summary, then we need to update our detached revision to ensure that it is ahead of all detached revisions in the summary.\n\t\t\t// First, finish loading the edit manager so that we can inspect the sequence numbers of the commits on the trunk.\n\t\t\tawait loadEditManager;\n\n\t\t\tconst latestDetachedSequenceNumber = this.editManager.getLatestSequenceNumber();\n\t\t\t// When we load a summary for a tree that was never attached,\n\t\t\t// latestDetachedSequenceNumber is either undefined (no commits in summary) or negative (all commits in summary were made while detached).\n\t\t\t// We only need to update `this.detachedRevision` in the latter case.\n\t\t\tif (latestDetachedSequenceNumber !== undefined && latestDetachedSequenceNumber < 0) {\n\t\t\t\tthis.detachedRevision = latestDetachedSequenceNumber;\n\t\t\t}\n\t\t\tawait Promise.all(loadSummarizables);\n\t\t} else {\n\t\t\tawait Promise.all([loadEditManager, ...loadSummarizables]);\n\t\t}\n\t}\n\n\tprivate registerSharedBranch(branchId: BranchId): void {\n\t\tthis.editManager.getLocalBranch(branchId).events.on(\"beforeChange\", (change) => {\n\t\t\tif (change.type === \"append\") {\n\t\t\t\tif (this.detachedRevision === undefined) {\n\t\t\t\t\t// Commit enrichment is only necessary for changes that will be submitted as ops, and changes issued while detached are not submitted.\n\t\t\t\t\tthis.getCommitEnricher(branchId).processChange(change);\n\t\t\t\t}\n\n\t\t\t\tfor (const commit of change.newCommits) {\n\t\t\t\t\tthis.submitCommit(branchId, commit, this.schemaAndPolicy, false);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\tprivate async loadSummarizable(\n\t\tsummarizable: Summarizable,\n\t\tservices: IChannelStorageService,\n\t): Promise<void> {\n\t\treturn summarizable.load(\n\t\t\tscopeStorageService(services, summarizablesTreeKey, summarizable.key),\n\t\t\t(contents) => this.serializer.parse(contents),\n\t\t);\n\t}\n\n\t/**\n\t * Submits an op to the Fluid runtime containing the given commit\n\t * @param commit - the commit to submit\n\t * @returns the submitted commit. This is undefined if the underlying `SharedObject` is not attached,\n\t * and may differ from `commit` due to enrichments like detached tree refreshers.\n\t */\n\tprotected submitCommit(\n\t\tbranchId: BranchId,\n\t\tcommit: GraphCommit<TChange>,\n\t\tschemaAndPolicy: ClonableSchemaAndPolicy,\n\t\tisResubmit: boolean,\n\t): void {\n\t\tassert(\n\t\t\tthis.sharedObject.isAttached() === (this.detachedRevision === undefined),\n\t\t\t0x95a /* Detached revision should only be set when not attached */,\n\t\t);\n\n\t\tconst enrichedCommit =\n\t\t\tthis.detachedRevision === undefined && !isResubmit\n\t\t\t\t? this.getCommitEnricher(branchId).enrich(commit)\n\t\t\t\t: commit;\n\n\t\t// Edits submitted before the first attach are treated as sequenced because they will be included\n\t\t// in the attach summary that is uploaded to the service.\n\t\t// Until this attach workflow happens, this instance essentially behaves as a centralized data structure.\n\t\tif (this.detachedRevision !== undefined) {\n\t\t\tconst newRevision: SeqNumber = brand((this.detachedRevision as number) + 1);\n\t\t\tthis.detachedRevision = newRevision;\n\t\t\tthis.editManager.addSequencedChanges(\n\t\t\t\t[enrichedCommit],\n\t\t\t\tthis.editManager.localSessionId,\n\t\t\t\tnewRevision,\n\t\t\t\tthis.detachedRevision,\n\t\t\t\tbranchId,\n\t\t\t);\n\t\t\tthis.editManager.advanceMinimumSequenceNumber(newRevision, false);\n\t\t\treturn undefined;\n\t\t}\n\n\t\tthis.submitMessage(\n\t\t\t{\n\t\t\t\ttype: \"commit\",\n\t\t\t\tcommit: enrichedCommit,\n\t\t\t\tsessionId: this.editManager.localSessionId,\n\t\t\t\tbranchId,\n\t\t\t},\n\t\t\tschemaAndPolicy,\n\t\t);\n\n\t\tthis.getResubmitMachine(branchId).onCommitSubmitted(enrichedCommit);\n\t}\n\n\tprotected submitBranchCreation(branchId: BranchId): void {\n\t\tthis.submitMessage(\n\t\t\t{ type: \"branch\", sessionId: this.editManager.localSessionId, branchId },\n\t\t\tthis.schemaAndPolicy,\n\t\t);\n\t}\n\n\tprivate submitMessage(\n\t\tmessage: DecodedMessage<TChange>,\n\t\tschemaAndPolicy: ClonableSchemaAndPolicy,\n\t): void {\n\t\tconst encodedMessage = this.messageCodec.encode(message, {\n\t\t\tidCompressor: this.idCompressor,\n\t\t\tschema: schemaAndPolicy,\n\t\t});\n\t\tthis.submitLocalMessage(encodedMessage, {\n\t\t\t// Clone the schema to ensure that during resubmit the schema has not been mutated by later changes\n\t\t\tschema: schemaAndPolicy.schema.clone(),\n\t\t\tpolicy: schemaAndPolicy.policy,\n\t\t});\n\t}\n\n\t/**\n\t * Process a bunch of messages from the runtime. SharedObject will call this method with a bunch of messages.\n\t */\n\tpublic processMessagesCore(messagesCollection: IRuntimeMessageCollection): void {\n\t\tconst { envelope, local, messagesContent } = messagesCollection;\n\t\tconst commits: GraphCommit<TChange>[] = [];\n\t\tlet messagesSessionId: SessionId | undefined;\n\t\tlet branchId: BranchId | undefined;\n\n\t\tconst processBunch = (branch: BranchId): void => {\n\t\t\tassert(messagesSessionId !== undefined, 0xada /* Messages must have a session ID */);\n\t\t\tthis.processCommits(\n\t\t\t\tmessagesSessionId,\n\t\t\t\tbrand(envelope.sequenceNumber),\n\t\t\t\tbrand(envelope.referenceSequenceNumber),\n\t\t\t\tlocal,\n\t\t\t\tbranch,\n\t\t\t\tcommits,\n\t\t\t);\n\n\t\t\tcommits.length = 0;\n\t\t\tbranchId = undefined;\n\t\t};\n\n\t\t// Get a list of all the commits from the messages.\n\t\tfor (const messageContent of messagesContent) {\n\t\t\t// Empty context object is passed in, as our decode function is schema-agnostic.\n\t\t\tconst message = this.messageCodec.decode(messageContent.contents, {\n\t\t\t\tidCompressor: this.idCompressor,\n\t\t\t});\n\n\t\t\tif (messagesSessionId !== undefined) {\n\t\t\t\tassert(\n\t\t\t\t\tmessagesSessionId === message.sessionId,\n\t\t\t\t\t0xad9 /* All messages in a bunch must have the same session ID */,\n\t\t\t\t);\n\t\t\t}\n\t\t\tmessagesSessionId = message.sessionId;\n\n\t\t\tconst type = message.type;\n\t\t\tswitch (type) {\n\t\t\t\tcase \"commit\": {\n\t\t\t\t\tif (branchId !== undefined && message.branchId !== branchId) {\n\t\t\t\t\t\tprocessBunch(branchId);\n\t\t\t\t\t}\n\n\t\t\t\t\tbranchId = message.branchId;\n\t\t\t\t\tcommits.push(message.commit);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"branch\": {\n\t\t\t\t\tif (branchId !== undefined) {\n\t\t\t\t\t\tprocessBunch(branchId);\n\t\t\t\t\t}\n\t\t\t\t\tthis.editManager.sequenceBranchCreation(\n\t\t\t\t\t\tmessagesSessionId,\n\t\t\t\t\t\tbrand(envelope.referenceSequenceNumber),\n\t\t\t\t\t\tmessage.branchId,\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tunreachableCase(type);\n\t\t\t}\n\t\t}\n\n\t\tif (branchId !== undefined) {\n\t\t\tprocessBunch(branchId);\n\t\t}\n\n\t\tthis.editManager.advanceMinimumSequenceNumber(brand(envelope.minimumSequenceNumber));\n\t}\n\n\tprivate processCommits(\n\t\tsessionId: SessionId,\n\t\tsequenceNumber: SeqNumber,\n\t\treferenceSequenceNumber: SeqNumber,\n\t\tisLocal: boolean,\n\t\tbranchId: BranchId,\n\t\tcommits: readonly GraphCommit<TChange>[],\n\t): void {\n\t\tthis.editManager.addSequencedChanges(\n\t\t\tcommits,\n\t\t\tsessionId,\n\t\t\tsequenceNumber,\n\t\t\treferenceSequenceNumber,\n\t\t\tbranchId,\n\t\t);\n\n\t\t// Update the resubmit machine for each commit applied.\n\t\tfor (const commit of commits) {\n\t\t\tthis.tryGetResubmitMachine(branchId)?.onSequencedCommitApplied(commit.revision, isLocal);\n\t\t}\n\t}\n\n\tpublic getLocalBranch(): SharedTreeBranch<TEditor, TChange> {\n\t\treturn this.editManager.getLocalBranch(\"main\");\n\t}\n\n\tpublic getSharedBranchIds(): string[] {\n\t\treturn this.editManager\n\t\t\t.getSharedBranchIds()\n\t\t\t.filter((id): id is SessionSpaceCompressedId => id !== \"main\")\n\t\t\t.map((id) => this.idCompressor.decompress(id));\n\t}\n\tpublic createSharedBranch(): string {\n\t\tconst branchId = this.idCompressor.generateCompressedId();\n\t\tthis.addBranch(branchId);\n\t\tthis.submitBranchCreation(branchId);\n\t\treturn this.idCompressor.decompress(branchId);\n\t}\n\n\tprotected addBranch(branchId: BranchId): void {\n\t\tthis.editManager.addNewBranch(branchId);\n\t}\n\n\tpublic getSharedBranch(branchId: BranchId): SharedTreeBranch<TEditor, TChange> {\n\t\treturn this.editManager.getLocalBranch(branchId);\n\t}\n\n\tpublic didAttach(): void {\n\t\tthis.detachedRevision = undefined;\n\t}\n\n\tpublic reSubmitCore(content: JsonCompatibleReadOnly, localOpMetadata: unknown): void {\n\t\t// Empty context object is passed in, as our decode function is schema-agnostic.\n\t\tconst message = this.messageCodec.decode(this.serializer.decode(content), {\n\t\t\tidCompressor: this.idCompressor,\n\t\t});\n\n\t\tconst type = message.type;\n\t\tswitch (type) {\n\t\t\tcase \"commit\": {\n\t\t\t\tconst {\n\t\t\t\t\tcommit: { revision },\n\t\t\t\t\tbranchId,\n\t\t\t\t} = message;\n\n\t\t\t\tconst resubmitMachine = this.getResubmitMachine(branchId);\n\n\t\t\t\tconst getLocalCommits = (): GraphCommit<TChange>[] => {\n\t\t\t\t\tconst localCommits = this.editManager.getLocalCommits(branchId);\n\t\t\t\t\tconst revisionIndex = localCommits.findIndex((c) => c.revision === revision);\n\t\t\t\t\tassert(revisionIndex >= 0, 0xbdb /* revision must exist in local commits */);\n\t\t\t\t\treturn localCommits.slice(revisionIndex);\n\t\t\t\t};\n\n\t\t\t\tassert(\n\t\t\t\t\tisClonableSchemaPolicy(localOpMetadata),\n\t\t\t\t\t0x95e /* Local metadata must contain schema and policy. */,\n\t\t\t\t);\n\n\t\t\t\tconst enrichedCommit = resubmitMachine.getEnrichedCommit(revision, getLocalCommits);\n\t\t\t\tif (enrichedCommit !== undefined) {\n\t\t\t\t\tthis.submitCommit(branchId, enrichedCommit, localOpMetadata, true);\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"branch\": {\n\t\t\t\tthis.submitBranchCreation(message.branchId);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tunreachableCase(type);\n\t\t}\n\t}\n\n\tpublic rollback(content: JsonCompatibleReadOnly, localOpMetadata: unknown): void {\n\t\t// Empty context object is passed in, as our decode function is schema-agnostic.\n\t\tconst message = this.messageCodec.decode(this.serializer.decode(content), {\n\t\t\tidCompressor: this.idCompressor,\n\t\t});\n\n\t\tconst type = message.type;\n\t\tswitch (type) {\n\t\t\tcase \"commit\": {\n\t\t\t\tconst {\n\t\t\t\t\tcommit: { revision },\n\t\t\t\t\tbranchId,\n\t\t\t\t} = message;\n\t\t\t\tconst branch = this.editManager.getLocalBranch(branchId);\n\t\t\t\tconst head = branch.getHead();\n\t\t\t\tassert(head.revision === revision, 0xc6b /* Can only rollback latest commit */);\n\t\t\t\tconst newHead = head.parent ?? fail(0xc6c /* must have parent */);\n\t\t\t\tbranch.removeAfter(newHead);\n\t\t\t\tthis.getResubmitMachine(branchId).onCommitRollback(head);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"branch\": {\n\t\t\t\tthis.editManager.removeBranch(message.branchId);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tunreachableCase(type);\n\t\t}\n\t}\n\n\tpublic applyStashedOp(content: JsonCompatibleReadOnly): void {\n\t\t// Empty context object is passed in, as our decode function is schema-agnostic.\n\t\tconst message = this.messageCodec.decode(this.serializer.decode(content), {\n\t\t\tidCompressor: this.idCompressor,\n\t\t});\n\n\t\tconst type = message.type;\n\t\tswitch (type) {\n\t\t\tcase \"commit\": {\n\t\t\t\tconst {\n\t\t\t\t\tcommit: { revision, change },\n\t\t\t\t\tbranchId,\n\t\t\t\t} = message;\n\t\t\t\tthis.editManager.getLocalBranch(branchId).apply({ change, revision });\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"branch\": {\n\t\t\t\tthis.editManager.addNewBranch(message.branchId);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tunreachableCase(type);\n\t\t}\n\t}\n\n\tprotected registerSharedBranchForEditing(\n\t\tbranchId: BranchId,\n\t\tenricher: ChangeEnricherReadonlyCheckout<TChange>,\n\t\tresubmitMachine?: ResubmitMachine<TChange>,\n\t): void {\n\t\tconst changeEnricher = enricher ?? new NoOpChangeEnricher();\n\t\tconst commitEnricher = new BranchCommitEnricher(this.changeFamily.rebaser, changeEnricher);\n\t\tassert(!this.enrichers.has(branchId), 0xc6d /* Branch already registered */);\n\t\tthis.enrichers.set(branchId, {\n\t\t\tenricher: commitEnricher,\n\t\t\tresubmitMachine:\n\t\t\t\tresubmitMachine ??\n\t\t\t\tnew DefaultResubmitMachine(\n\t\t\t\t\t(change: TaggedChange<TChange>) =>\n\t\t\t\t\t\tthis.changeFamily.rebaser.invert(change, true, this.mintRevisionTag()),\n\t\t\t\t\tchangeEnricher,\n\t\t\t\t),\n\t\t});\n\t}\n\n\tprivate getResubmitMachine(branchId: BranchId): ResubmitMachine<TChange> {\n\t\treturn this.getEnricherState(branchId).resubmitMachine;\n\t}\n\n\tprivate tryGetResubmitMachine(branchId: BranchId): ResubmitMachine<TChange> | undefined {\n\t\treturn this.tryGetEnricherState(branchId)?.resubmitMachine;\n\t}\n\n\tpublic getCommitEnricher(branchId: BranchId): BranchCommitEnricher<TChange> {\n\t\treturn this.getEnricherState(branchId).enricher;\n\t}\n\n\tprivate getEnricherState(branchId: BranchId): EnricherState<TChange> {\n\t\treturn (\n\t\t\tthis.tryGetEnricherState(branchId) ??\n\t\t\tfail(0xc6e /* Expected to have a resubmit machine for this branch */)\n\t\t);\n\t}\n\n\tprivate tryGetEnricherState(branchId: BranchId): EnricherState<TChange> | undefined {\n\t\treturn this.enrichers.get(branchId);\n\t}\n}\n\ninterface EnricherState<TChange> {\n\treadonly enricher: BranchCommitEnricher<TChange>;\n\treadonly resubmitMachine: ResubmitMachine<TChange>;\n}\n\nfunction isClonableSchemaPolicy(\n\tmaybeSchemaPolicy: unknown,\n): maybeSchemaPolicy is ClonableSchemaAndPolicy {\n\tconst schemaAndPolicy = maybeSchemaPolicy as ClonableSchemaAndPolicy;\n\treturn schemaAndPolicy.schema !== undefined && schemaAndPolicy.policy !== undefined;\n}\n\n/**\n * Specifies the behavior of a component that puts data in a summary.\n */\nexport interface Summarizable {\n\t/**\n\t * Field name in summary json under which this element stores its data.\n\t */\n\treadonly key: string;\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).summarize}\n\t * @param stringify - Serializes the contents of the component (including {@link (IFluidHandle:interface)}s) for storage.\n\t * @param fullTree - A flag indicating whether the attempt should generate a full\n\t * summary tree without any handles for unchanged subtrees. It should only be set to true when generating\n\t * a summary from the entire container. The default value is false.\n\t * @param trackState - An optimization for tracking state of objects across summaries. If the state\n\t * of an object did not change since last successful summary, an\n\t * {@link @fluidframework/protocol-definitions#ISummaryHandle} can be used\n\t * instead of re-summarizing it. If this is `false`, the expectation is that you should never\n\t * send an `ISummaryHandle`, since you are not expected to track state. The default value is true.\n\t * @param telemetryContext - See {@link @fluidframework/runtime-definitions#ITelemetryContext}.\n\t * @param incrementalSummaryContext - See {@link @fluidframework/runtime-definitions#IExperimentalIncrementalSummaryContext}.\n\t */\n\tsummarize(props: {\n\t\tstringify: SummaryElementStringifier;\n\t\tfullTree?: boolean;\n\t\ttrackState?: boolean;\n\t\ttelemetryContext?: ITelemetryContext;\n\t\tincrementalSummaryContext?: IExperimentalIncrementalSummaryContext;\n\t}): ISummaryTreeWithStats;\n\n\t/**\n\t * Allows the component to perform custom loading. The storage service is scoped to this component and therefore\n\t * paths in this component will not collide with those in other components, even if they are the same string.\n\t * @param service - Storage used by the component\n\t * @param parse - Parses serialized data from storage into runtime objects for the component\n\t */\n\tload(service: IChannelStorageService, parse: SummaryElementParser): Promise<void>;\n}\n\n/**\n * Serializes the given contents into a string acceptable for storing in summaries, i.e. all\n * Fluid handles have been replaced appropriately by an IFluidSerializer\n */\nexport type SummaryElementStringifier = (contents: unknown) => string;\n\n/**\n * Parses a serialized/summarized string into an object, rehydrating any Fluid handles as necessary\n */\nexport type SummaryElementParser = (contents: string) => unknown;\n\n/**\n * Compose an {@link IChannelStorageService} which prefixes all paths before forwarding them to the original service\n */\nfunction scopeStorageService(\n\tservice: IChannelStorageService,\n\t...pathElements: string[]\n): IChannelStorageService {\n\tconst scope = `${pathElements.join(\"/\")}/`;\n\n\treturn {\n\t\tasync readBlob(path: string): Promise<ArrayBufferLike> {\n\t\t\treturn service.readBlob(`${scope}${path}`);\n\t\t},\n\t\tasync contains(path) {\n\t\t\treturn service.contains(`${scope}${path}`);\n\t\t},\n\t\tasync list(path) {\n\t\t\treturn service.list(`${scope}${path}`);\n\t\t},\n\t\tgetSnapshotTree(): ISnapshotTree | undefined {\n\t\t\tconst snapshotTree = service.getSnapshotTree();\n\t\t\tif (snapshotTree === undefined) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tlet scopedTree = snapshotTree;\n\t\t\tfor (const element of pathElements) {\n\t\t\t\tconst tree = scopedTree.trees[element];\n\t\t\t\tassert(\n\t\t\t\t\ttree !== undefined,\n\t\t\t\t\t0xc20 /* snapshot tree not found for one of tree's summarizables */,\n\t\t\t\t);\n\t\t\t\tscopedTree = tree;\n\t\t\t}\n\t\t\treturn scopedTree;\n\t\t},\n\t};\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,OAAO,EACN,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EAGxB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAGN,KAAK,cAAc,EAEnB,MAAM,kBAAkB,CAAC;AAiB1B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,KAAK,EAAE,gBAAgB,EA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gB,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;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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AC;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;AAeF;;;GAGG;AACH,MAAM,OAAO,qBAAqB;IA0BjC;;;;;;;;;;;;OAYG;IACH,YAAmB,KAAsC;QACxD,IAAI,IAAI,CAAC,WAAW,KAAK,qBAAqB,EAAE,CAAC;YAChD,4HAA4H;YAC5H,kKAAkK;YAClK,OAAO,IAAI,0BAA0B,CAAC,KAAK,CAAC,CAAC;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,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"]}
@@ -42,12 +42,12 @@ export interface AllowedTypeDiscrepancy extends FieldDiscrepancyLocation {
42
42
  readonly mismatch: "allowedTypes";
43
43
  /**
44
44
  * Annotated allowed types in viewed schema
45
- * (excluding {@link SchemaStaticsAlpha.staged | staged} schema) which are not allowed in stored schema.
45
+ * (excluding {@link SchemaStaticsBeta.staged | staged} schema) which are not allowed in stored schema.
46
46
  */
47
47
  readonly view: readonly AnnotatedAllowedType<TreeNodeSchema>[];
48
48
  /**
49
49
  * Allowed type identifiers in stored schema which are not allowed in view schema
50
- * (including the view schema's {@link SchemaStaticsAlpha.staged | staged} schema).
50
+ * (including the view schema's {@link SchemaStaticsBeta.staged | staged} schema).
51
51
  */
52
52
  readonly stored: readonly TreeNodeSchemaIdentifier[];
53
53
  }