@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
@@ -1 +1 @@
1
- {"version":3,"file":"defaultFieldKinds.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/default-schema/defaultFieldKinds.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EACN,KAAK,YAAY,EAEjB,KAAK,mBAAmB,EACxB,4BAA4B,EAC5B,YAAY,EACZ,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAEN,KAAK,kBAAkB,EACvB,KAAK,WAAW,EAChB,KAAK,sBAAsB,EAE3B,mBAAmB,EACnB,KAAK,aAAa,EAIlB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACN,KAAK,iBAAiB,EAGtB,MAAM,4BAA4B,CAAC;AAIpC,OAAO,KAAK,EAA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mBAAmB,EAAE,aAAa,CAEtE,CAAC;AAOF,MAAM,WAAW,QAChB,SAAQ,aAAa,CAAC,mBAAmB,EAAE,OAAO,kBAAkB,EAAE,YAAY,CAAC,MAAM,CAAC;CAAG;AAC9F,MAAM,WAAW,QAChB,SAAQ,aAAa,CACpB,mBAAmB,EACnB,OAAO,kBAAkB,EACzB,YAAY,CAAC,QAAQ,CACrB;CAAG;AACL,MAAM,WAAW,QAChB,SAAQ,aAAa,CACpB,mBAAmB,EACnB,OAAO,kBAAkB,EACzB,YAAY,CAAC,QAAQ,CACrB;CAAG;AACL,MAAM,WAAW,UAChB,SAAQ,aAAa,CACpB,WAAW,CAAC,CAAC,CAAC,EACd,OAAO,yBAAyB,EAChC,YAAY,CAAC,MAAM,CACnB;CAAG;AACL,MAAM,WAAW,SAChB,SAAQ,aAAa,CACpB,WAAW,CAAC,CAAC,CAAC,EACd,OAAO,4BAA4B,EACnC,YAAY,CAAC,SAAS,CACtB;CAAG;AAEL;;GAEG;AACH,eAAO,MAAM,UAAU,EAAE;IAExB,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;CAC4B,CAAC;AAE5D;;GAEG;AACH,eAAO,MAAM,mBAAmB,EAAE,gBAEjC,CAAC"}
@@ -4,11 +4,11 @@
4
4
  */
5
5
  import { fail } from "@fluidframework/core-utils/internal";
6
6
  import { forbiddenFieldKindIdentifier, Multiplicity, } from "../../core/index.js";
7
- import { FieldKindWithEditor, allowsTreeSchemaIdentifierSuperset, referenceFreeFieldChangeRebaser, } from "../modular-schema/index.js";
7
+ import { FlexFieldKind, allowsTreeSchemaIdentifierSuperset, referenceFreeFieldChangeRebaser, } from "../modular-schema/index.js";
8
8
  import { optionalChangeHandler, optionalFieldEditor, } from "../optional-field/index.js";
9
- import { sequenceFieldChangeHandler } from "../sequence-field/index.js";
9
+ import { sequenceFieldChangeHandler, } from "../sequence-field/index.js";
10
10
  import { noChangeCodecFamily } from "./noChangeCodecs.js";
11
- import { brand } from "../../util/index.js";
11
+ import { brand, brandConst } from "../../util/index.js";
12
12
  /**
13
13
  * ChangeHandler that only handles no-op / identity changes.
14
14
  */
@@ -28,67 +28,63 @@ export const noChangeHandler = {
28
28
  createEmpty: () => 0,
29
29
  getCrossFieldKeys: () => [],
30
30
  };
31
- const optionalIdentifier = "Optional";
31
+ const optionalIdentifier = brandConst("Optional")();
32
32
  /**
33
33
  * 0 or 1 items.
34
34
  */
35
- export const optional = new FieldKindWithEditor(optionalIdentifier, Multiplicity.Optional, optionalChangeHandler, (types, other) => (other.kind === sequence.identifier || other.kind === optionalIdentifier) &&
36
- allowsTreeSchemaIdentifierSuperset(types, other.types), new Set([]));
37
- export const valueFieldEditor = {
35
+ export const optional = new FlexFieldKind(optionalIdentifier, Multiplicity.Optional, {
36
+ changeHandler: optionalChangeHandler,
37
+ allowsTreeSupersetOf: (types, other) => (other.kind === sequence.identifier || other.kind === optionalIdentifier) &&
38
+ allowsTreeSchemaIdentifierSuperset(types, other.types),
39
+ });
40
+ export const requiredFieldEditor = {
38
41
  ...optionalFieldEditor,
39
42
  set: (ids) => optionalFieldEditor.set(false, ids),
40
43
  };
41
- export const valueChangeHandler = {
42
- ...optional.changeHandler,
43
- editor: valueFieldEditor,
44
+ export const requiredFieldChangeHandler = {
45
+ ...optionalChangeHandler,
46
+ editor: requiredFieldEditor,
44
47
  };
45
- const requiredIdentifier = "Value";
48
+ const requiredIdentifier = brandConst("Value")();
46
49
  /**
47
50
  * Exactly one item.
48
51
  */
49
- export const required = new FieldKindWithEditor(requiredIdentifier, Multiplicity.Single, valueChangeHandler, (types, other) =>
50
- // By omitting Identifier here,
51
- // this is making a policy choice that a schema upgrade cannot be done from required to identifier.
52
- // Since an identifier can be upgraded into a required field,
53
- // preventing the inverse helps ensure that schema upgrades are monotonic.
54
- // Which direction is allowed is a subjective policy choice.
55
- (other.kind === sequence.identifier ||
56
- other.kind === requiredIdentifier ||
57
- other.kind === optional.identifier ||
58
- other.kind === nodeKey.identifier) &&
59
- allowsTreeSchemaIdentifierSuperset(types, other.types), new Set());
60
- const sequenceIdentifier = "Sequence";
52
+ export const required = new FlexFieldKind(requiredIdentifier, Multiplicity.Single, {
53
+ changeHandler: requiredFieldChangeHandler,
54
+ allowsTreeSupersetOf: (types, other) =>
55
+ // By omitting Identifier here,
56
+ // this is making a policy choice that a schema upgrade cannot be done from required to identifier.
57
+ // Since an identifier can be upgraded into a required field,
58
+ // preventing the inverse helps ensure that schema upgrades are monotonic.
59
+ // Which direction is allowed is a subjective policy choice.
60
+ (other.kind === sequence.identifier ||
61
+ other.kind === requiredIdentifier ||
62
+ other.kind === optional.identifier) &&
63
+ allowsTreeSchemaIdentifierSuperset(types, other.types),
64
+ });
65
+ const sequenceIdentifier = brandConst("Sequence")();
61
66
  /**
62
67
  * 0 or more items.
63
68
  */
64
- export const sequence = new FieldKindWithEditor(sequenceIdentifier, Multiplicity.Sequence, sequenceFieldChangeHandler, (types, other) => other.kind === sequenceIdentifier &&
65
- allowsTreeSchemaIdentifierSuperset(types, other.types),
66
- // TODO: add normalizer/importers for handling ops from other kinds.
67
- new Set([]));
68
- const nodeKeyIdentifier = "NodeKey";
69
- /**
70
- * Exactly one identifier.
71
- *
72
- * TODO: this is almost the same as identifier, but apparently unused.
73
- * Confirm if this is truly unused since before the document format was stabilized, and remove if possible.
74
- * @deprecated Superseded by {@link identifier}.
75
- */
76
- export const nodeKey = new FieldKindWithEditor(nodeKeyIdentifier, Multiplicity.Single, noChangeHandler, (types, other) => (other.kind === sequence.identifier ||
77
- other.kind === requiredIdentifier ||
78
- other.kind === optional.identifier ||
79
- other.kind === nodeKeyIdentifier) &&
80
- allowsTreeSchemaIdentifierSuperset(types, other.types), new Set());
81
- const identifierFieldIdentifier = "Identifier";
69
+ export const sequence = new FlexFieldKind(sequenceIdentifier, Multiplicity.Sequence, {
70
+ changeHandler: sequenceFieldChangeHandler,
71
+ allowsTreeSupersetOf: (types, other) => other.kind === sequenceIdentifier &&
72
+ allowsTreeSchemaIdentifierSuperset(types, other.types),
73
+ });
74
+ const identifierFieldIdentifier = brandConst("Identifier")();
82
75
  /**
83
76
  * Exactly one identifier.
84
77
  */
85
- export const identifier = new FieldKindWithEditor(identifierFieldIdentifier, Multiplicity.Single, noChangeHandler, (types, other) =>
86
- // Allows upgrading from identifier to required: which way this upgrade is allowed to go is a subjective policy choice.
87
- (other.kind === sequence.identifier ||
88
- other.kind === requiredIdentifier ||
89
- other.kind === optional.identifier ||
90
- other.kind === identifierFieldIdentifier) &&
91
- allowsTreeSchemaIdentifierSuperset(types, other.types), new Set());
78
+ export const identifier = new FlexFieldKind(identifierFieldIdentifier, Multiplicity.Single, {
79
+ changeHandler: noChangeHandler,
80
+ allowsTreeSupersetOf: (types, other) =>
81
+ // Allows upgrading from identifier to required: which way this upgrade is allowed to go is a subjective policy choice.
82
+ (other.kind === sequence.identifier ||
83
+ other.kind === requiredIdentifier ||
84
+ other.kind === optional.identifier ||
85
+ other.kind === identifierFieldIdentifier) &&
86
+ allowsTreeSchemaIdentifierSuperset(types, other.types),
87
+ });
92
88
  /**
93
89
  * Exactly 0 items.
94
90
  *
@@ -117,36 +113,15 @@ export const identifier = new FieldKindWithEditor(identifierFieldIdentifier, Mul
117
113
  *
118
114
  * See {@link emptyField} for a constant, reusable field using Forbidden.
119
115
  */
120
- export const forbidden = new FieldKindWithEditor(forbiddenFieldKindIdentifier, Multiplicity.Forbidden, noChangeHandler,
121
- // All multiplicities other than Value support empty.
122
- (types, other) => fieldKinds.get(other.kind)?.multiplicity !== Multiplicity.Single, new Set());
116
+ export const forbidden = new FlexFieldKind(forbiddenFieldKindIdentifier, Multiplicity.Forbidden, {
117
+ changeHandler: noChangeHandler,
118
+ // All multiplicities other than Value support empty.
119
+ allowsTreeSupersetOf: (types, other) => fieldKinds.get(other.kind)?.multiplicity !== Multiplicity.Single,
120
+ });
123
121
  export const fieldKindConfigurations = new Map([
124
- [
125
- brand(1),
126
- new Map([
127
- [nodeKey.identifier, { kind: nodeKey, formatVersion: 1 }],
128
- [required.identifier, { kind: required, formatVersion: 1 }],
129
- [optional.identifier, { kind: optional, formatVersion: 1 }],
130
- [sequence.identifier, { kind: sequence, formatVersion: 1 }],
131
- [forbidden.identifier, { kind: forbidden, formatVersion: 1 }],
132
- [identifier.identifier, { kind: identifier, formatVersion: 1 }],
133
- ]),
134
- ],
135
- [
136
- brand(2),
137
- new Map([
138
- [nodeKey.identifier, { kind: nodeKey, formatVersion: 1 }],
139
- [required.identifier, { kind: required, formatVersion: 2 }],
140
- [optional.identifier, { kind: optional, formatVersion: 2 }],
141
- [sequence.identifier, { kind: sequence, formatVersion: 1 }],
142
- [forbidden.identifier, { kind: forbidden, formatVersion: 1 }],
143
- [identifier.identifier, { kind: identifier, formatVersion: 1 }],
144
- ]),
145
- ],
146
122
  [
147
123
  brand(3),
148
124
  new Map([
149
- [nodeKey.identifier, { kind: nodeKey, formatVersion: 1 }],
150
125
  [required.identifier, { kind: required, formatVersion: 2 }],
151
126
  [optional.identifier, { kind: optional, formatVersion: 2 }],
152
127
  [sequence.identifier, { kind: sequence, formatVersion: 2 }],
@@ -157,7 +132,6 @@ export const fieldKindConfigurations = new Map([
157
132
  [
158
133
  brand(4),
159
134
  new Map([
160
- [nodeKey.identifier, { kind: nodeKey, formatVersion: 1 }],
161
135
  [required.identifier, { kind: required, formatVersion: 2 }],
162
136
  [optional.identifier, { kind: optional, formatVersion: 2 }],
163
137
  [sequence.identifier, { kind: sequence, formatVersion: 3 }],
@@ -185,9 +159,15 @@ export function getCodecTreeForModularChangeFormat(version) {
185
159
  * Before making a SharedTree format change which impacts which set of field kinds are allowed,
186
160
  * code which uses this should be audited for compatibility considerations.
187
161
  */
188
- export const fieldKinds = new Map([required, optional, sequence, nodeKey, identifier, forbidden].map((s) => [s.identifier, s]));
162
+ export const fieldKinds = new Map([required, optional, sequence, identifier, forbidden].map((s) => [s.identifier, s]));
189
163
  /**
190
164
  * Default FieldKinds with their editor types erased.
191
165
  */
192
166
  export const FieldKinds = { required, optional, sequence, identifier, forbidden };
167
+ /**
168
+ * FullSchemaPolicy with the default field kinds.
169
+ */
170
+ export const defaultSchemaPolicy = {
171
+ fieldKinds,
172
+ };
193
173
  //# sourceMappingURL=defaultFieldKinds.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"defaultFieldKinds.js","sourceRoot":"","sources":["../../../src/feature-libraries/default-schema/defaultFieldKinds.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,qCAAqC,CAAC;AAE3D,OAAO,EAIN,4BAA4B,EAC5B,YAAY,GACZ,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAMN,mBAAmB,EAGnB,kCAAkC,EAClC,+BAA+B,GAC/B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAEN,qBAAqB,EACrB,mBAAmB,GACnB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AAExE,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE1D,OAAO,EAAE,KAAK,EAAc,MAAM,qBAAqB,CAAC;AAExD;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAA0B;IACrD,OAAO,EAAE,+BAA+B,CAAC;QACxC,OAAO,EAAE,CAAC,OAAU,EAAE,OAAU,EAAE,EAAE,CAAC,CAAC;QACtC,MAAM,EAAE,CAAC,OAAU,EAAE,EAAE,CAAC,CAAC;QACzB,MAAM,EAAE,CAAC,MAAS,EAAE,IAAO,EAAE,EAAE,CAAC,CAAC;QACjC,IAAI,EAAE,CAAC,OAAU,EAAE,EAAE,CAAC,CAAC;KACvB,CAAC;IACF,aAAa,EAAE,GAA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C,MAAM,YAAY,GACjB,uBAAuB,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,mCAAmC,CAAC,CAAC;IACzF,MAAM,QAAQ,GAAgB,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC,CAAC,GAAG,CACnE,CAAC,CAAC,GAAG,EAAE,EAAE,aAAa,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;QAC9B,IAAI,EAAE,aAAa,GAAG,EAAE;QACxB,OAAO,EAAE,aAAa;KACtB,CAAC,CACF,CAAC;IACF,OAAO;QACN,IAAI,EAAE,eAAe;QACrB,OAAO;QACP,QAAQ;KACR,CAAC;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,UAAU,GAA0D,IAAI,GAAG,CACvF,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,CAC5F,CAAC;AAcF;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAOnB,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { fail } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\ttype ChangeAtomId,\n\ttype DeltaDetachedNodeId,\n\ttype FieldKindIdentifier,\n\tforbiddenFieldKindIdentifier,\n\tMultiplicity,\n} from \"../../core/index.js\";\nimport {\n\ttype FieldChangeDelta,\n\ttype FieldChangeHandler,\n\ttype FieldEditor,\n\ttype FieldKindConfiguration,\n\ttype FieldKindConfigurationEntry,\n\tFieldKindWithEditor,\n\ttype FlexFieldKind,\n\ttype ToDelta,\n\tallowsTreeSchemaIdentifierSuperset,\n\treferenceFreeFieldChangeRebaser,\n} from \"../modular-schema/index.js\";\nimport {\n\ttype OptionalChangeset,\n\toptionalChangeHandler,\n\toptionalFieldEditor,\n} from \"../optional-field/index.js\";\nimport { sequenceFieldChangeHandler } from \"../sequence-field/index.js\";\n\nimport { noChangeCodecFamily } from \"./noChangeCodecs.js\";\nimport type { CodecTree } from \"../../codec/index.js\";\nimport { brand, type Brand } from \"../../util/index.js\";\n\n/**\n * ChangeHandler that only handles no-op / identity changes.\n */\nexport const noChangeHandler: FieldChangeHandler<0> = {\n\trebaser: referenceFreeFieldChangeRebaser({\n\t\tcompose: (change1: 0, change2: 0) => 0,\n\t\tinvert: (changes: 0) => 0,\n\t\trebase: (change: 0, over: 0) => 0,\n\t\tmute: (changes: 0) => 0,\n\t}),\n\tcodecsFactory: () => noChangeCodecFamily,\n\teditor: { buildChildChanges: () => fail(0xb0d /* Child changes not supported */) },\n\tintoDelta: (change, deltaFromChild: ToDelta): FieldChangeDelta => ({}),\n\trelevantRemovedRoots: (change): Iterable<DeltaDetachedNodeId> => [],\n\tisEmpty: (change: 0) => true,\n\tgetNestedChanges: (change: 0) => [],\n\tcreateEmpty: () => 0,\n\tgetCrossFieldKeys: () => [],\n};\n\nexport interface ValueFieldEditor extends FieldEditor<OptionalChangeset> {\n\t/**\n\t * Creates a change which replaces the current value of the field with `newValue`.\n\t * @param ids - The ids for the fill and detach fields.\n\t */\n\tset(ids: { fill: ChangeAtomId; detach: ChangeAtomId }): OptionalChangeset;\n}\n\nconst optionalIdentifier = \"Optional\";\n/**\n * 0 or 1 items.\n */\nexport const optional = new FieldKindWithEditor(\n\toptionalIdentifier,\n\tMultiplicity.Optional,\n\toptionalChangeHandler,\n\t(types, other) =>\n\t\t(other.kind === sequence.identifier || other.kind === optionalIdentifier) &&\n\t\tallowsTreeSchemaIdentifierSuperset(types, other.types),\n\tnew Set([]),\n);\n\nexport const valueFieldEditor: ValueFieldEditor = {\n\t...optionalFieldEditor,\n\tset: (ids: {\n\t\tfill: ChangeAtomId;\n\t\tdetach: ChangeAtomId;\n\t}): OptionalChangeset => optionalFieldEditor.set(false, ids),\n};\n\nexport const valueChangeHandler: FieldChangeHandler<OptionalChangeset, ValueFieldEditor> = {\n\t...optional.changeHandler,\n\teditor: valueFieldEditor,\n};\n\nconst requiredIdentifier = \"Value\";\n\n/**\n * Exactly one item.\n */\nexport const required = new FieldKindWithEditor(\n\trequiredIdentifier,\n\tMultiplicity.Single,\n\tvalueChangeHandler,\n\t(types, other) =>\n\t\t// By omitting Identifier here,\n\t\t// this is making a policy choice that a schema upgrade cannot be done from required to identifier.\n\t\t// Since an identifier can be upgraded into a required field,\n\t\t// preventing the inverse helps ensure that schema upgrades are monotonic.\n\t\t// Which direction is allowed is a subjective policy choice.\n\t\t(other.kind === sequence.identifier ||\n\t\t\tother.kind === requiredIdentifier ||\n\t\t\tother.kind === optional.identifier ||\n\t\t\tother.kind === nodeKey.identifier) &&\n\t\tallowsTreeSchemaIdentifierSuperset(types, other.types),\n\tnew Set(),\n);\n\nconst sequenceIdentifier = \"Sequence\";\n\n/**\n * 0 or more items.\n */\nexport const sequence = new FieldKindWithEditor(\n\tsequenceIdentifier,\n\tMultiplicity.Sequence,\n\tsequenceFieldChangeHandler,\n\t(types, other) =>\n\t\tother.kind === sequenceIdentifier &&\n\t\tallowsTreeSchemaIdentifierSuperset(types, other.types),\n\t// TODO: add normalizer/importers for handling ops from other kinds.\n\tnew Set([]),\n);\n\nconst nodeKeyIdentifier = \"NodeKey\";\n\n/**\n * Exactly one identifier.\n *\n * TODO: this is almost the same as identifier, but apparently unused.\n * Confirm if this is truly unused since before the document format was stabilized, and remove if possible.\n * @deprecated Superseded by {@link identifier}.\n */\nexport const nodeKey = new FieldKindWithEditor(\n\tnodeKeyIdentifier,\n\tMultiplicity.Single,\n\tnoChangeHandler,\n\t(types, other) =>\n\t\t(other.kind === sequence.identifier ||\n\t\t\tother.kind === requiredIdentifier ||\n\t\t\tother.kind === optional.identifier ||\n\t\t\tother.kind === nodeKeyIdentifier) &&\n\t\tallowsTreeSchemaIdentifierSuperset(types, other.types),\n\tnew Set(),\n);\n\nconst identifierFieldIdentifier = \"Identifier\";\n\n/**\n * Exactly one identifier.\n */\nexport const identifier = new FieldKindWithEditor(\n\tidentifierFieldIdentifier,\n\tMultiplicity.Single,\n\tnoChangeHandler,\n\t(types, other) =>\n\t\t// Allows upgrading from identifier to required: which way this upgrade is allowed to go is a subjective policy choice.\n\t\t(other.kind === sequence.identifier ||\n\t\t\tother.kind === requiredIdentifier ||\n\t\t\tother.kind === optional.identifier ||\n\t\t\tother.kind === identifierFieldIdentifier) &&\n\t\tallowsTreeSchemaIdentifierSuperset(types, other.types),\n\tnew Set(),\n);\n\n/**\n * Exactly 0 items.\n *\n * Using Forbidden makes what types are listed for allowed in a field irrelevant\n * since the field will never have values in it.\n *\n * Using Forbidden is equivalent to picking a kind that permits empty (like sequence or optional)\n * and having no allowed types (or only never types).\n * Because of this, its possible to express everything constraint wise without Forbidden,\n * but using Forbidden can be more semantically clear than optional with no allowed types.\n *\n * For view schema, this can be useful if you need to:\n * - run a specific out of schema handler when a field is present,\n * but otherwise are ignoring or tolerating (ex: via extra fields) unmentioned fields.\n * - prevent a specific field from being used as an extra field\n * (perhaps for some past of future compatibility reason)\n * - keep a field in a schema for metadata purposes\n * (ex: for improved error messaging, error handling or documentation)\n * that is not used in this specific version of the schema (ex: to document what it was or will be used for).\n *\n * For stored schema, this can be useful if you need to:\n * - have a field which can have its schema updated to Optional or Sequence of any type.\n * - to exclude a field from extra fields\n * - for the schema system to use as a default for fields which aren't declared\n * (ex: when updating a field that did not exist into one that does)\n *\n * See {@link emptyField} for a constant, reusable field using Forbidden.\n */\nexport const forbidden = new FieldKindWithEditor(\n\tforbiddenFieldKindIdentifier,\n\tMultiplicity.Forbidden,\n\tnoChangeHandler,\n\t// All multiplicities other than Value support empty.\n\t(types, other) => fieldKinds.get(other.kind)?.multiplicity !== Multiplicity.Single,\n\tnew Set(),\n);\n\nexport const fieldKindConfigurations: ReadonlyMap<\n\tModularChangeFormatVersion,\n\tFieldKindConfiguration\n> = new Map([\n\t[\n\t\tbrand(1),\n\t\tnew Map<FieldKindIdentifier, FieldKindConfigurationEntry>([\n\t\t\t[nodeKey.identifier, { kind: nodeKey, formatVersion: 1 }],\n\t\t\t[required.identifier, { kind: required, formatVersion: 1 }],\n\t\t\t[optional.identifier, { kind: optional, formatVersion: 1 }],\n\t\t\t[sequence.identifier, { kind: sequence, formatVersion: 1 }],\n\t\t\t[forbidden.identifier, { kind: forbidden, formatVersion: 1 }],\n\t\t\t[identifier.identifier, { kind: identifier, formatVersion: 1 }],\n\t\t]),\n\t],\n\t[\n\t\tbrand(2),\n\t\tnew Map<FieldKindIdentifier, FieldKindConfigurationEntry>([\n\t\t\t[nodeKey.identifier, { kind: nodeKey, formatVersion: 1 }],\n\t\t\t[required.identifier, { kind: required, formatVersion: 2 }],\n\t\t\t[optional.identifier, { kind: optional, formatVersion: 2 }],\n\t\t\t[sequence.identifier, { kind: sequence, formatVersion: 1 }],\n\t\t\t[forbidden.identifier, { kind: forbidden, formatVersion: 1 }],\n\t\t\t[identifier.identifier, { kind: identifier, formatVersion: 1 }],\n\t\t]),\n\t],\n\t[\n\t\tbrand(3),\n\t\tnew Map<FieldKindIdentifier, FieldKindConfigurationEntry>([\n\t\t\t[nodeKey.identifier, { kind: nodeKey, formatVersion: 1 }],\n\t\t\t[required.identifier, { kind: required, formatVersion: 2 }],\n\t\t\t[optional.identifier, { kind: optional, formatVersion: 2 }],\n\t\t\t[sequence.identifier, { kind: sequence, formatVersion: 2 }],\n\t\t\t[forbidden.identifier, { kind: forbidden, formatVersion: 1 }],\n\t\t\t[identifier.identifier, { kind: identifier, formatVersion: 1 }],\n\t\t]),\n\t],\n\t[\n\t\tbrand(4),\n\t\tnew Map<FieldKindIdentifier, FieldKindConfigurationEntry>([\n\t\t\t[nodeKey.identifier, { kind: nodeKey, formatVersion: 1 }],\n\t\t\t[required.identifier, { kind: required, formatVersion: 2 }],\n\t\t\t[optional.identifier, { kind: optional, formatVersion: 2 }],\n\t\t\t[sequence.identifier, { kind: sequence, formatVersion: 3 }],\n\t\t\t[forbidden.identifier, { kind: forbidden, formatVersion: 1 }],\n\t\t\t[identifier.identifier, { kind: identifier, formatVersion: 1 }],\n\t\t]),\n\t],\n]);\n\nexport type ModularChangeFormatVersion = Brand<1 | 2 | 3 | 4, \"ModularChangeFormatVersion\">;\nexport function getCodecTreeForModularChangeFormat(\n\tversion: ModularChangeFormatVersion,\n): CodecTree {\n\tconst dependencies =\n\t\tfieldKindConfigurations.get(version) ?? fail(0xc7c /* Unknown modular change format */);\n\tconst children: CodecTree[] = Array.from(dependencies.entries()).map(\n\t\t([key, { formatVersion }]) => ({\n\t\t\tname: `FieldKind:${key}`,\n\t\t\tversion: formatVersion,\n\t\t}),\n\t);\n\treturn {\n\t\tname: \"ModularChange\",\n\t\tversion,\n\t\tchildren,\n\t};\n}\n\n/**\n * All supported field kinds.\n *\n * @privateRemarks\n * Before making a SharedTree format change which impacts which set of field kinds are allowed,\n * code which uses this should be audited for compatibility considerations.\n */\nexport const fieldKinds: ReadonlyMap<FieldKindIdentifier, FieldKindWithEditor> = new Map(\n\t[required, optional, sequence, nodeKey, identifier, forbidden].map((s) => [s.identifier, s]),\n);\n\n// Create named Aliases for nicer intellisense.\n\n// TODO: Find a way to make docs like {@inheritDoc required} work in vscode.\n// TODO: ensure thy work in generated docs.\n// TODO: add these comments to the rest of the cases below.\nexport interface Required extends FlexFieldKind<\"Value\", Multiplicity.Single> {}\nexport interface Optional extends FlexFieldKind<\"Optional\", Multiplicity.Optional> {}\nexport interface Sequence extends FlexFieldKind<\"Sequence\", Multiplicity.Sequence> {}\nexport interface Identifier extends FlexFieldKind<\"Identifier\", Multiplicity.Single> {}\nexport interface Forbidden\n\textends FlexFieldKind<typeof forbiddenFieldKindIdentifier, Multiplicity.Forbidden> {}\n\n/**\n * Default FieldKinds with their editor types erased.\n */\nexport const FieldKinds: {\n\t// TODO: inheritDoc for these somehow\n\treadonly required: Required;\n\treadonly optional: Optional;\n\treadonly sequence: Sequence;\n\treadonly identifier: Identifier;\n\treadonly forbidden: Forbidden;\n} = { required, optional, sequence, identifier, forbidden };\n"]}
1
+ {"version":3,"file":"defaultFieldKinds.js","sourceRoot":"","sources":["../../../src/feature-libraries/default-schema/defaultFieldKinds.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,qCAAqC,CAAC;AAE3D,OAAO,EAIN,4BAA4B,EAC5B,YAAY,GACZ,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAMN,aAAa,EAGb,kCAAkC,EAClC,+BAA+B,GAC/B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAGN,qBAAqB,EACrB,mBAAmB,GACnB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACN,0BAA0B,GAE1B,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE1D,OAAO,EAAE,KAAK,EAAE,UAAU,EAAc,MAAM,qBAAqB,CAAC;AAEpE;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAA0B;IACrD,OAAO,EAAE,+BAA+B,CAAC;QACxC,OAAO,EAAE,CAAC,OAAU,EAAE,OAAU,EAAE,EAAE,CAAC,CAAC;QACtC,MAAM,EAAE,CAAC,OAAU,EAAE,EAAE,CAAC,CAAC;QACzB,MAAM,EAAE,CAAC,MAAS,EAAE,IAAO,EAAE,EAAE,CAAC,CAAC;QACjC,IAAI,EAAE,CAAC,OAAU,EAAE,EAAE,CAAC,CAAC;KACvB,CAAC;IACF,aAAa,EAAE,GAAG,EAAE,CAAC,mBAAmB;IACxC,MAAM,EAAE,EAAE,iBAAiB,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,iCAAiC,CAAC,EAAE;IAClF,SAAS,EAAE,CAAC,MAAM,EAA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AmB,GAAqB;IACpD,UAAU;CACV,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { fail } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\ttype ChangeAtomId,\n\ttype DeltaDetachedNodeId,\n\ttype FieldKindIdentifier,\n\tforbiddenFieldKindIdentifier,\n\tMultiplicity,\n} from \"../../core/index.js\";\nimport {\n\ttype FieldChangeDelta,\n\ttype FieldChangeHandler,\n\ttype FieldEditor,\n\ttype FieldKindConfiguration,\n\ttype FieldKindConfigurationEntry,\n\tFlexFieldKind,\n\ttype FullSchemaPolicy,\n\ttype ToDelta,\n\tallowsTreeSchemaIdentifierSuperset,\n\treferenceFreeFieldChangeRebaser,\n} from \"../modular-schema/index.js\";\nimport {\n\ttype OptionalChangeset,\n\ttype OptionalFieldEditor,\n\toptionalChangeHandler,\n\toptionalFieldEditor,\n} from \"../optional-field/index.js\";\nimport {\n\tsequenceFieldChangeHandler,\n\ttype SequenceFieldEditor,\n} from \"../sequence-field/index.js\";\n\nimport { noChangeCodecFamily } from \"./noChangeCodecs.js\";\nimport type { CodecTree } from \"../../codec/index.js\";\nimport { brand, brandConst, type Brand } from \"../../util/index.js\";\n\n/**\n * ChangeHandler that only handles no-op / identity changes.\n */\nexport const noChangeHandler: FieldChangeHandler<0> = {\n\trebaser: referenceFreeFieldChangeRebaser({\n\t\tcompose: (change1: 0, change2: 0) => 0,\n\t\tinvert: (changes: 0) => 0,\n\t\trebase: (change: 0, over: 0) => 0,\n\t\tmute: (changes: 0) => 0,\n\t}),\n\tcodecsFactory: () => noChangeCodecFamily,\n\teditor: { buildChildChanges: () => fail(0xb0d /* Child changes not supported */) },\n\tintoDelta: (change, deltaFromChild: ToDelta): FieldChangeDelta => ({}),\n\trelevantRemovedRoots: (change): Iterable<DeltaDetachedNodeId> => [],\n\tisEmpty: (change: 0) => true,\n\tgetNestedChanges: (change: 0) => [],\n\tcreateEmpty: () => 0,\n\tgetCrossFieldKeys: () => [],\n};\n\n/**\n * {@link FieldEditor} for required fields (always contain exactly 1 child).\n * @remarks\n * This shares code with optional fields, since they are the same edit wise except setting to empty is not allowed,\n * and the content is always assumed to not be empty.\n * This means the actual edits implemented for optional fields are sufficient to support required fields\n * which is why this is defined and implemented in terms of optional fields.\n */\nexport interface RequiredFieldEditor extends FieldEditor<OptionalChangeset> {\n\t/**\n\t * Creates a change which replaces the current value of the field with `newValue`.\n\t * @param ids - The ids for the fill and detach fields.\n\t */\n\tset(ids: { fill: ChangeAtomId; detach: ChangeAtomId }): OptionalChangeset;\n}\n\nconst optionalIdentifier = brandConst(\"Optional\")<FieldKindIdentifier>();\n\n/**\n * 0 or 1 items.\n */\nexport const optional = new FlexFieldKind(optionalIdentifier, Multiplicity.Optional, {\n\tchangeHandler: optionalChangeHandler,\n\tallowsTreeSupersetOf: (types, other) =>\n\t\t(other.kind === sequence.identifier || other.kind === optionalIdentifier) &&\n\t\tallowsTreeSchemaIdentifierSuperset(types, other.types),\n});\n\nexport const requiredFieldEditor: RequiredFieldEditor = {\n\t...optionalFieldEditor,\n\tset: (ids: {\n\t\tfill: ChangeAtomId;\n\t\tdetach: ChangeAtomId;\n\t}): OptionalChangeset => optionalFieldEditor.set(false, ids),\n};\n\nexport const requiredFieldChangeHandler: FieldChangeHandler<\n\tOptionalChangeset,\n\tRequiredFieldEditor\n> = {\n\t...optionalChangeHandler,\n\teditor: requiredFieldEditor,\n};\n\nconst requiredIdentifier = brandConst(\"Value\")<FieldKindIdentifier>();\n\n/**\n * Exactly one item.\n */\nexport const required = new FlexFieldKind(requiredIdentifier, Multiplicity.Single, {\n\tchangeHandler: requiredFieldChangeHandler,\n\tallowsTreeSupersetOf: (types, other) =>\n\t\t// By omitting Identifier here,\n\t\t// this is making a policy choice that a schema upgrade cannot be done from required to identifier.\n\t\t// Since an identifier can be upgraded into a required field,\n\t\t// preventing the inverse helps ensure that schema upgrades are monotonic.\n\t\t// Which direction is allowed is a subjective policy choice.\n\t\t(other.kind === sequence.identifier ||\n\t\t\tother.kind === requiredIdentifier ||\n\t\t\tother.kind === optional.identifier) &&\n\t\tallowsTreeSchemaIdentifierSuperset(types, other.types),\n});\n\nconst sequenceIdentifier = brandConst(\"Sequence\")<FieldKindIdentifier>();\n\n/**\n * 0 or more items.\n */\nexport const sequence = new FlexFieldKind(sequenceIdentifier, Multiplicity.Sequence, {\n\tchangeHandler: sequenceFieldChangeHandler,\n\tallowsTreeSupersetOf: (types, other) =>\n\t\tother.kind === sequenceIdentifier &&\n\t\tallowsTreeSchemaIdentifierSuperset(types, other.types),\n});\n\nconst identifierFieldIdentifier = brandConst(\"Identifier\")<FieldKindIdentifier>();\n\n/**\n * Exactly one identifier.\n */\nexport const identifier = new FlexFieldKind(identifierFieldIdentifier, Multiplicity.Single, {\n\tchangeHandler: noChangeHandler,\n\tallowsTreeSupersetOf: (types, other) =>\n\t\t// Allows upgrading from identifier to required: which way this upgrade is allowed to go is a subjective policy choice.\n\t\t(other.kind === sequence.identifier ||\n\t\t\tother.kind === requiredIdentifier ||\n\t\t\tother.kind === optional.identifier ||\n\t\t\tother.kind === identifierFieldIdentifier) &&\n\t\tallowsTreeSchemaIdentifierSuperset(types, other.types),\n});\n\n/**\n * Exactly 0 items.\n *\n * Using Forbidden makes what types are listed for allowed in a field irrelevant\n * since the field will never have values in it.\n *\n * Using Forbidden is equivalent to picking a kind that permits empty (like sequence or optional)\n * and having no allowed types (or only never types).\n * Because of this, its possible to express everything constraint wise without Forbidden,\n * but using Forbidden can be more semantically clear than optional with no allowed types.\n *\n * For view schema, this can be useful if you need to:\n * - run a specific out of schema handler when a field is present,\n * but otherwise are ignoring or tolerating (ex: via extra fields) unmentioned fields.\n * - prevent a specific field from being used as an extra field\n * (perhaps for some past of future compatibility reason)\n * - keep a field in a schema for metadata purposes\n * (ex: for improved error messaging, error handling or documentation)\n * that is not used in this specific version of the schema (ex: to document what it was or will be used for).\n *\n * For stored schema, this can be useful if you need to:\n * - have a field which can have its schema updated to Optional or Sequence of any type.\n * - to exclude a field from extra fields\n * - for the schema system to use as a default for fields which aren't declared\n * (ex: when updating a field that did not exist into one that does)\n *\n * See {@link emptyField} for a constant, reusable field using Forbidden.\n */\nexport const forbidden = new FlexFieldKind(\n\tforbiddenFieldKindIdentifier,\n\tMultiplicity.Forbidden,\n\t{\n\t\tchangeHandler: noChangeHandler,\n\t\t// All multiplicities other than Value support empty.\n\t\tallowsTreeSupersetOf: (types, other) =>\n\t\t\tfieldKinds.get(other.kind)?.multiplicity !== Multiplicity.Single,\n\t},\n);\n\nexport const fieldKindConfigurations: ReadonlyMap<\n\tModularChangeFormatVersion,\n\tFieldKindConfiguration\n> = new Map([\n\t[\n\t\tbrand(3),\n\t\tnew Map<FieldKindIdentifier, FieldKindConfigurationEntry>([\n\t\t\t[required.identifier, { kind: required, formatVersion: 2 }],\n\t\t\t[optional.identifier, { kind: optional, formatVersion: 2 }],\n\t\t\t[sequence.identifier, { kind: sequence, formatVersion: 2 }],\n\t\t\t[forbidden.identifier, { kind: forbidden, formatVersion: 1 }],\n\t\t\t[identifier.identifier, { kind: identifier, formatVersion: 1 }],\n\t\t]),\n\t],\n\t[\n\t\tbrand(4),\n\t\tnew Map<FieldKindIdentifier, FieldKindConfigurationEntry>([\n\t\t\t[required.identifier, { kind: required, formatVersion: 2 }],\n\t\t\t[optional.identifier, { kind: optional, formatVersion: 2 }],\n\t\t\t[sequence.identifier, { kind: sequence, formatVersion: 3 }],\n\t\t\t[forbidden.identifier, { kind: forbidden, formatVersion: 1 }],\n\t\t\t[identifier.identifier, { kind: identifier, formatVersion: 1 }],\n\t\t]),\n\t],\n]);\n\nexport type ModularChangeFormatVersion = Brand<3 | 4, \"ModularChangeFormatVersion\">;\nexport function getCodecTreeForModularChangeFormat(\n\tversion: ModularChangeFormatVersion,\n): CodecTree {\n\tconst dependencies =\n\t\tfieldKindConfigurations.get(version) ?? fail(0xc7c /* Unknown modular change format */);\n\tconst children: CodecTree[] = Array.from(dependencies.entries()).map(\n\t\t([key, { formatVersion }]) => ({\n\t\t\tname: `FieldKind:${key}`,\n\t\t\tversion: formatVersion,\n\t\t}),\n\t);\n\treturn {\n\t\tname: \"ModularChange\",\n\t\tversion,\n\t\tchildren,\n\t};\n}\n\n/**\n * All supported field kinds.\n *\n * @privateRemarks\n * Before making a SharedTree format change which impacts which set of field kinds are allowed,\n * code which uses this should be audited for compatibility considerations.\n */\nexport const fieldKinds: ReadonlyMap<FieldKindIdentifier, FlexFieldKind> = new Map(\n\t[required, optional, sequence, identifier, forbidden].map((s) => [s.identifier, s]),\n);\n\n// Create named Aliases for nicer intellisense.\n\n// TODO: Find a way to make docs like {@inheritDoc required} work in vscode.\n// TODO: ensure thy work in generated docs.\n// TODO: add these comments to the rest of the cases below.\nexport interface Required\n\textends FlexFieldKind<RequiredFieldEditor, typeof requiredIdentifier, Multiplicity.Single> {}\nexport interface Optional\n\textends FlexFieldKind<\n\t\tOptionalFieldEditor,\n\t\ttypeof optionalIdentifier,\n\t\tMultiplicity.Optional\n\t> {}\nexport interface Sequence\n\textends FlexFieldKind<\n\t\tSequenceFieldEditor,\n\t\ttypeof sequenceIdentifier,\n\t\tMultiplicity.Sequence\n\t> {}\nexport interface Identifier\n\textends FlexFieldKind<\n\t\tFieldEditor<0>,\n\t\ttypeof identifierFieldIdentifier,\n\t\tMultiplicity.Single\n\t> {}\nexport interface Forbidden\n\textends FlexFieldKind<\n\t\tFieldEditor<0>,\n\t\ttypeof forbiddenFieldKindIdentifier,\n\t\tMultiplicity.Forbidden\n\t> {}\n\n/**\n * Default FieldKinds with their editor types erased.\n */\nexport const FieldKinds: {\n\t// TODO: inheritDoc for these somehow\n\treadonly required: Required;\n\treadonly optional: Optional;\n\treadonly sequence: Sequence;\n\treadonly identifier: Identifier;\n\treadonly forbidden: Forbidden;\n} = { required, optional, sequence, identifier, forbidden };\n\n/**\n * FullSchemaPolicy with the default field kinds.\n */\nexport const defaultSchemaPolicy: FullSchemaPolicy = {\n\tfieldKinds,\n};\n"]}
@@ -2,9 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- export { FieldKinds, type Required, type Optional, type Sequence, type Identifier, type Forbidden, fieldKinds, fieldKindConfigurations, getCodecTreeForModularChangeFormat, type ModularChangeFormatVersion, } from "./defaultFieldKinds.js";
5
+ export { FieldKinds, type Required, type Optional, type Sequence, type Identifier, type Forbidden, fieldKinds, fieldKindConfigurations, getCodecTreeForModularChangeFormat, type ModularChangeFormatVersion, defaultSchemaPolicy, } from "./defaultFieldKinds.js";
6
6
  export { type DefaultChangeset, DefaultChangeFamily, DefaultEditBuilder, type IDefaultEditBuilder, type ValueFieldEditBuilder, type OptionalFieldEditBuilder, type SequenceFieldEditBuilder, intoDelta, relevantRemovedRoots, } from "./defaultEditBuilder.js";
7
- export { SchemaValidationError, isNodeInSchema, isFieldInSchema, throwOutOfSchema, } from "./schemaChecker.js";
8
- export { defaultSchemaPolicy } from "./defaultSchema.js";
9
7
  export { MappedEditBuilder } from "./mappedEditBuilder.js";
10
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/default-schema/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,UAAU,EACV,KAAK,QAAQ,EACb,KAAK,QAAQ,EACb,KAAK,QAAQ,EACb,KAAK,UAAU,EACf,KAAK,SAAS,EACd,UAAU,EACV,uBAAuB,EACvB,kCAAkC,EAClC,KAAK,0BAA0B,GAC/B,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACN,KAAK,gBAAgB,EACrB,mBAAmB,EACnB,kBAAkB,EAClB,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAC7B,SAAS,EACT,oBAAoB,GACpB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACN,qBAAqB,EACrB,cAAc,EACd,eAAe,EACf,gBAAgB,GAChB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAEzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/default-schema/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,UAAU,EACV,KAAK,QAAQ,EACb,KAAK,QAAQ,EACb,KAAK,QAAQ,EACb,KAAK,UAAU,EACf,KAAK,SAAS,EACd,UAAU,EACV,uBAAuB,EACvB,kCAAkC,EAClC,KAAK,0BAA0B,EAC/B,mBAAmB,GACnB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACN,KAAK,gBAAgB,EACrB,mBAAmB,EACnB,kBAAkB,EAClB,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAC7B,SAAS,EACT,oBAAoB,GACpB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC"}
@@ -2,9 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- export { FieldKinds, fieldKinds, fieldKindConfigurations, getCodecTreeForModularChangeFormat, } from "./defaultFieldKinds.js";
5
+ export { FieldKinds, fieldKinds, fieldKindConfigurations, getCodecTreeForModularChangeFormat, defaultSchemaPolicy, } from "./defaultFieldKinds.js";
6
6
  export { DefaultChangeFamily, DefaultEditBuilder, intoDelta, relevantRemovedRoots, } from "./defaultEditBuilder.js";
7
- export { SchemaValidationError, isNodeInSchema, isFieldInSchema, throwOutOfSchema, } from "./schemaChecker.js";
8
- export { defaultSchemaPolicy } from "./defaultSchema.js";
9
7
  export { MappedEditBuilder } from "./mappedEditBuilder.js";
10
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/feature-libraries/default-schema/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,UAAU,EAMV,UAAU,EACV,uBAAuB,EACvB,kCAAkC,GAElC,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAEN,mBAAmB,EACnB,kBAAkB,EAKlB,SAAS,EACT,oBAAoB,GACpB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACN,qBAAqB,EACrB,cAAc,EACd,eAAe,EACf,gBAAgB,GAChB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAEzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\tFieldKinds,\n\ttype Required,\n\ttype Optional,\n\ttype Sequence,\n\ttype Identifier,\n\ttype Forbidden,\n\tfieldKinds,\n\tfieldKindConfigurations,\n\tgetCodecTreeForModularChangeFormat,\n\ttype ModularChangeFormatVersion,\n} from \"./defaultFieldKinds.js\";\n\nexport {\n\ttype DefaultChangeset,\n\tDefaultChangeFamily,\n\tDefaultEditBuilder,\n\ttype IDefaultEditBuilder,\n\ttype ValueFieldEditBuilder,\n\ttype OptionalFieldEditBuilder,\n\ttype SequenceFieldEditBuilder,\n\tintoDelta,\n\trelevantRemovedRoots,\n} from \"./defaultEditBuilder.js\";\n\nexport {\n\tSchemaValidationError,\n\tisNodeInSchema,\n\tisFieldInSchema,\n\tthrowOutOfSchema,\n} from \"./schemaChecker.js\";\n\nexport { defaultSchemaPolicy } from \"./defaultSchema.js\";\n\nexport { MappedEditBuilder } from \"./mappedEditBuilder.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/feature-libraries/default-schema/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,UAAU,EAMV,UAAU,EACV,uBAAuB,EACvB,kCAAkC,EAElC,mBAAmB,GACnB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAEN,mBAAmB,EACnB,kBAAkB,EAKlB,SAAS,EACT,oBAAoB,GACpB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\tFieldKinds,\n\ttype Required,\n\ttype Optional,\n\ttype Sequence,\n\ttype Identifier,\n\ttype Forbidden,\n\tfieldKinds,\n\tfieldKindConfigurations,\n\tgetCodecTreeForModularChangeFormat,\n\ttype ModularChangeFormatVersion,\n\tdefaultSchemaPolicy,\n} from \"./defaultFieldKinds.js\";\n\nexport {\n\ttype DefaultChangeset,\n\tDefaultChangeFamily,\n\tDefaultEditBuilder,\n\ttype IDefaultEditBuilder,\n\ttype ValueFieldEditBuilder,\n\ttype OptionalFieldEditBuilder,\n\ttype SequenceFieldEditBuilder,\n\tintoDelta,\n\trelevantRemovedRoots,\n} from \"./defaultEditBuilder.js\";\n\nexport { MappedEditBuilder } from \"./mappedEditBuilder.js\";\n"]}
@@ -2,17 +2,16 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { type CodecTree, type ICodecOptions, type IJsonCodec } from "../../codec/index.js";
5
+ import type { MinimumVersionForCollab } from "@fluidframework/runtime-definitions/internal";
6
+ import { type CodecTree, type CodecWriteOptions, type IJsonCodec } from "../../codec/index.js";
6
7
  import type { FieldKey, ITreeCursorSynchronous } from "../../core/index.js";
7
8
  import type { FieldBatchCodec, FieldBatchEncodingContext } from "../chunked-forest/index.js";
8
9
  import { Format } from "./format.js";
9
- import type { Brand } from "../../util/index.js";
10
10
  /**
11
11
  * Uses field cursors
12
12
  */
13
13
  export type FieldSet = ReadonlyMap<FieldKey, ITreeCursorSynchronous>;
14
14
  export type ForestCodec = IJsonCodec<FieldSet, Format, Format, FieldBatchEncodingContext>;
15
- export declare function makeForestSummarizerCodec(options: ICodecOptions, fieldBatchCodec: FieldBatchCodec): ForestCodec;
16
- export type ForestFormatVersion = Brand<1, "ForestFormatVersion">;
17
- export declare function getCodecTreeForForestFormat(version: ForestFormatVersion): CodecTree;
15
+ export declare function makeForestSummarizerCodec(options: CodecWriteOptions, fieldBatchCodec: FieldBatchCodec): ForestCodec;
16
+ export declare function getCodecTreeForForestFormat(clientVersion: MinimumVersionForCollab): CodecTree;
18
17
  //# sourceMappingURL=codec.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"codec.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/forest-summary/codec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EACN,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,UAAU,EAEf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,QAAQ,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC5E,OAAO,KAAK,EAAE,eAAe,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AAE7F,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAEjD;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,WAAW,CAAC,QAAQ,EAAE,sBAAsB,CAAC,CAAC;AACrE,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,yBAAyB,CAAC,CAAC;AAE1F,wBAAgB,yBAAyB,CACxC,OAAO,EAAE,aAAa,EACtB,eAAe,EAAE,eAAe,GAC9B,WAAW,CAyBb;AAED,MAAM,MAAM,mBAAmB,GAAG,KAAK,CAAC,CAAC,EAAE,qBAAqB,CAAC,CAAC;AAClE,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,mBAAmB,GAAG,SAAS,CAEnF"}
1
+ {"version":3,"file":"codec.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/forest-summary/codec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AAE5F,OAAO,EACN,KAAK,SAAS,EACd,KAAK,iBAAiB,EACtB,KAAK,UAAU,EAEf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,QAAQ,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC5E,OAAO,KAAK,EAAE,eAAe,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AAE7F,OAAO,EAAE,MAAM,EAAuB,MAAM,aAAa,CAAC;AAG1D;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,WAAW,CAAC,QAAQ,EAAE,sBAAsB,CAAC,CAAC;AACrE,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,yBAAyB,CAAC,CAAC;AAc1F,wBAAgB,yBAAyB,CACxC,OAAO,EAAE,iBAAiB,EAC1B,eAAe,EAAE,eAAe,GAC9B,WAAW,CA0Bb;AAED,wBAAgB,2BAA2B,CAC1C,aAAa,EAAE,uBAAuB,GACpC,SAAS,CAEX"}
@@ -4,13 +4,24 @@
4
4
  */
5
5
  import { assert, oob } from "@fluidframework/core-utils/internal";
6
6
  import { makeVersionedValidatedCodec, } from "../../codec/index.js";
7
- import { Format } from "./format.js";
7
+ import { Format, ForestFormatVersion } from "./format.js";
8
+ import { brand } from "../../util/index.js";
9
+ /**
10
+ * Convert a MinimumVersionForCollab to a ForestFormatVersion.
11
+ * @param clientVersion - The MinimumVersionForCollab to convert.
12
+ * @returns The ForestFormatVersion that corresponds to the provided MinimumVersionForCollab.
13
+ */
14
+ function clientVersionToForestSummaryVersion(clientVersion) {
15
+ // Currently, forest summary codec only writes in version 1.
16
+ return brand(ForestFormatVersion.v1);
17
+ }
8
18
  export function makeForestSummarizerCodec(options, fieldBatchCodec) {
9
19
  const inner = fieldBatchCodec;
10
20
  // TODO: AB#41865
11
21
  // This needs to be updated to support multiple versions.
12
22
  // The second version will be used to enable incremental summarization.
13
- return makeVersionedValidatedCodec(options, new Set([1]), Format, {
23
+ const writeVersion = clientVersionToForestSummaryVersion(options.minVersionForCollab);
24
+ return makeVersionedValidatedCodec(options, new Set([ForestFormatVersion.v1]), Format, {
14
25
  encode: (data, context) => {
15
26
  const keys = [];
16
27
  const fields = [];
@@ -18,7 +29,7 @@ export function makeForestSummarizerCodec(options, fieldBatchCodec) {
18
29
  keys.push(key);
19
30
  fields.push(value);
20
31
  }
21
- return { keys, fields: inner.encode(fields, context), version: 1 };
32
+ return { keys, fields: inner.encode(fields, context), version: writeVersion };
22
33
  },
23
34
  decode: (data, context) => {
24
35
  const out = new Map();
@@ -31,7 +42,7 @@ export function makeForestSummarizerCodec(options, fieldBatchCodec) {
31
42
  },
32
43
  });
33
44
  }
34
- export function getCodecTreeForForestFormat(version) {
35
- return { name: "Forest", version };
45
+ export function getCodecTreeForForestFormat(clientVersion) {
46
+ return { name: "Forest", version: clientVersionToForestSummaryVersion(clientVersion) };
36
47
  }
37
48
  //# sourceMappingURL=codec.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"codec.js","sourceRoot":"","sources":["../../../src/feature-libraries/forest-summary/codec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,qCAAqC,CAAC;AAElE,OAAO,EAIN,2BAA2B,GAC3B,MAAM,sBAAsB,CAAC;AAI9B,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AASrC,MAAM,UAAU,yBAAyB,CACxC,OAAsB,EACtB,eAAgC;IAEhC,MAAM,KAAK,GAAG,eAAe,CAAC;IA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,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;AACpC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, oob } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\ttype CodecTree,\n\ttype ICodecOptions,\n\ttype IJsonCodec,\n\tmakeVersionedValidatedCodec,\n} from \"../../codec/index.js\";\nimport type { FieldKey, ITreeCursorSynchronous } from \"../../core/index.js\";\nimport type { FieldBatchCodec, FieldBatchEncodingContext } from \"../chunked-forest/index.js\";\n\nimport { Format } from \"./format.js\";\nimport type { Brand } from \"../../util/index.js\";\n\n/**\n * Uses field cursors\n */\nexport type FieldSet = ReadonlyMap<FieldKey, ITreeCursorSynchronous>;\nexport type ForestCodec = IJsonCodec<FieldSet, Format, Format, FieldBatchEncodingContext>;\n\nexport function makeForestSummarizerCodec(\n\toptions: ICodecOptions,\n\tfieldBatchCodec: FieldBatchCodec,\n): ForestCodec {\n\tconst inner = fieldBatchCodec;\n\t// TODO: AB#41865\n\t// This needs to be updated to support multiple versions.\n\t// The second version will be used to enable incremental summarization.\n\treturn makeVersionedValidatedCodec(options, new Set([1]), Format, {\n\t\tencode: (data: FieldSet, context: FieldBatchEncodingContext): Format => {\n\t\t\tconst keys: FieldKey[] = [];\n\t\t\tconst fields: ITreeCursorSynchronous[] = [];\n\t\t\tfor (const [key, value] of data) {\n\t\t\t\tkeys.push(key);\n\t\t\t\tfields.push(value);\n\t\t\t}\n\t\t\treturn { keys, fields: inner.encode(fields, context), version: 1 };\n\t\t},\n\t\tdecode: (data: Format, context: FieldBatchEncodingContext): FieldSet => {\n\t\t\tconst out: Map<FieldKey, ITreeCursorSynchronous> = new Map();\n\t\t\tconst fields = inner.decode(data.fields, context);\n\t\t\tassert(data.keys.length === fields.length, 0x891 /* mismatched lengths */);\n\t\t\tfor (const [index, field] of fields.entries()) {\n\t\t\t\tout.set(data.keys[index] ?? oob(), field);\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\t});\n}\n\nexport type ForestFormatVersion = Brand<1, \"ForestFormatVersion\">;\nexport function getCodecTreeForForestFormat(version: ForestFormatVersion): CodecTree {\n\treturn { name: \"Forest\", version };\n}\n"]}
1
+ {"version":3,"file":"codec.js","sourceRoot":"","sources":["../../../src/feature-libraries/forest-summary/codec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,qCAAqC,CAAC;AAGlE,OAAO,EAIN,2BAA2B,GAC3B,MAAM,sBAAsB,CAAC;AAI9B,OAAO,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAQ5C;;;;GAIG;AACH,SAAS,mCAAmC,CAC3C,aAAsC;IAEtC,4DAA4D;IAC5D,OAAO,KAAK,CAAC,mBAAmB,CAAC,EAAE,CAAC,CAAC;AACtC,CAAC;AAED,MAAM,UAAU,yBAAyB,CACxC,OAA0B,EAC1B,eAAgC;IAEhC,MAAM,KAAK,GAAG,eAAe,CAAC;IAC9B,iBAAiB;IACjB,yDAAyD;IACzD,uEAAuE;IACvE,MAAM,YAAY,GAAG,mCAAmC,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC;IACtF,OAAO,2BAA2B,CAAC,OAAO,EAAE,IAAI,GAAG,CAAC,CAAC,mBAAmB,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE;QACtF,MAAM,EAAE,CAAC,IAAc,EAAE,OAAkC,EAAU,EAAE;YACtE,MAAM,IAAI,GAAe,EAAE,CAAC;YAC5B,MAAM,MAAM,GAA6B,EAAE,CAAC;YAC5C,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,IAAI,EAAE,CAAC;gBACjC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;gBACf,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACpB,CAAC;YACD,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC;QAC/E,CAAC;QACD,MAAM,EAAE,CAAC,IAAY,EAAE,OAAkC,EAAY,EAAE;YACtE,MAAM,GAAG,GAA0C,IAAI,GAAG,EAAE,CAAC;YAC7D,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YAClD,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,wBAAwB,CAAC,CAAC;YAC3E,KAAK,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,EAAE,EAAE,CAAC;gBAC/C,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,EAAE,EAAE,KAAK,CAAC,CAAC;YAC3C,CAAC;YACD,OAAO,GAAG,CAAC;QACZ,CAAC;KACD,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,2BAA2B,CAC1C,aAAsC;IAEtC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,mCAAmC,CAAC,aAAa,CAAC,EAAE,CAAC;AACxF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, oob } from \"@fluidframework/core-utils/internal\";\nimport type { MinimumVersionForCollab } from \"@fluidframework/runtime-definitions/internal\";\n\nimport {\n\ttype CodecTree,\n\ttype CodecWriteOptions,\n\ttype IJsonCodec,\n\tmakeVersionedValidatedCodec,\n} from \"../../codec/index.js\";\nimport type { FieldKey, ITreeCursorSynchronous } from \"../../core/index.js\";\nimport type { FieldBatchCodec, FieldBatchEncodingContext } from \"../chunked-forest/index.js\";\n\nimport { Format, ForestFormatVersion } from \"./format.js\";\nimport { brand } from \"../../util/index.js\";\n\n/**\n * Uses field cursors\n */\nexport type FieldSet = ReadonlyMap<FieldKey, ITreeCursorSynchronous>;\nexport type ForestCodec = IJsonCodec<FieldSet, Format, Format, FieldBatchEncodingContext>;\n\n/**\n * Convert a MinimumVersionForCollab to a ForestFormatVersion.\n * @param clientVersion - The MinimumVersionForCollab to convert.\n * @returns The ForestFormatVersion that corresponds to the provided MinimumVersionForCollab.\n */\nfunction clientVersionToForestSummaryVersion(\n\tclientVersion: MinimumVersionForCollab,\n): ForestFormatVersion {\n\t// Currently, forest summary codec only writes in version 1.\n\treturn brand(ForestFormatVersion.v1);\n}\n\nexport function makeForestSummarizerCodec(\n\toptions: CodecWriteOptions,\n\tfieldBatchCodec: FieldBatchCodec,\n): ForestCodec {\n\tconst inner = fieldBatchCodec;\n\t// TODO: AB#41865\n\t// This needs to be updated to support multiple versions.\n\t// The second version will be used to enable incremental summarization.\n\tconst writeVersion = clientVersionToForestSummaryVersion(options.minVersionForCollab);\n\treturn makeVersionedValidatedCodec(options, new Set([ForestFormatVersion.v1]), Format, {\n\t\tencode: (data: FieldSet, context: FieldBatchEncodingContext): Format => {\n\t\t\tconst keys: FieldKey[] = [];\n\t\t\tconst fields: ITreeCursorSynchronous[] = [];\n\t\t\tfor (const [key, value] of data) {\n\t\t\t\tkeys.push(key);\n\t\t\t\tfields.push(value);\n\t\t\t}\n\t\t\treturn { keys, fields: inner.encode(fields, context), version: writeVersion };\n\t\t},\n\t\tdecode: (data: Format, context: FieldBatchEncodingContext): FieldSet => {\n\t\t\tconst out: Map<FieldKey, ITreeCursorSynchronous> = new Map();\n\t\t\tconst fields = inner.decode(data.fields, context);\n\t\t\tassert(data.keys.length === fields.length, 0x891 /* mismatched lengths */);\n\t\t\tfor (const [index, field] of fields.entries()) {\n\t\t\t\tout.set(data.keys[index] ?? oob(), field);\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\t});\n}\n\nexport function getCodecTreeForForestFormat(\n\tclientVersion: MinimumVersionForCollab,\n): CodecTree {\n\treturn { name: \"Forest\", version: clientVersionToForestSummaryVersion(clientVersion) };\n}\n"]}
@@ -6,7 +6,7 @@ import { bufferToString } from "@fluid-internal/client-utils";
6
6
  import { assert } from "@fluidframework/core-utils/internal";
7
7
  import { applyDelta, forEachField, makeDetachedFieldIndex, } from "../../core/index.js";
8
8
  import { idAllocatorFromMaxId } from "../../util/index.js";
9
- // eslint-disable-next-line import/no-internal-modules
9
+ // eslint-disable-next-line import-x/no-internal-modules
10
10
  import { chunkFieldSingle, defaultChunkPolicy } from "../chunked-forest/chunkTree.js";
11
11
  import { defaultIncrementalEncodingPolicy, } from "../chunked-forest/index.js";
12
12
  import { makeForestSummarizerCodec } from "./codec.js";
@@ -1 +1 @@
1
- {"version":3,"file":"forestSummarizer.js","sourceRoot":"","sources":["../../../src/feature-libraries/forest-summary/forestSummarizer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAU7D,OAAO,EASN,UAAU,EACV,YAAY,EACZ,sBAAsB,GACtB,MAAM,qBAAqB,CAAC;AAM7B,OAAO,EAAE,oBAAoB,EAAuB,MAAM,qBAAqB,CAAC;AAChF,sDAAsD;AACtD,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACtF,OAAO,EACN,gCAAgC,GAIhC,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAoB,yBAAyB,EAAE,MAAM,YAAY,CAAC;AACzE,OAAO,EACN,gCAAgC,EAChC,+BAA+B,EAC/B,uBAAuB,GACvB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,+BAA+B,EAAE,MAAM,4BAA4B,CAAC;AAG7E;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAA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AAC;QAC9D,UAAU,CACT,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,GAAG,CAAC,YAAY,CAAC,EAAE,EACxC,SAAS,EACT,IAAI,CAAC,MAAM,EACX,sBAAsB,CAAC,MAAM,EAAE,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC,YAAY,CAAC,CACxE,CAAC;IACH,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { bufferToString } from \"@fluid-internal/client-utils\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { IChannelStorageService } from \"@fluidframework/datastore-definitions/internal\";\nimport type { IIdCompressor } from \"@fluidframework/id-compressor\";\nimport type {\n\tIExperimentalIncrementalSummaryContext,\n\tISummaryTreeWithStats,\n\tITelemetryContext,\n} from \"@fluidframework/runtime-definitions/internal\";\n\nimport type { CodecWriteOptions } from \"../../codec/index.js\";\nimport {\n\ttype DeltaDetachedNodeBuild,\n\ttype DeltaFieldChanges,\n\ttype FieldKey,\n\ttype IEditableForest,\n\ttype ITreeCursorSynchronous,\n\ttype ITreeSubscriptionCursor,\n\ttype RevisionTagCodec,\n\tTreeNavigationResult,\n\tapplyDelta,\n\tforEachField,\n\tmakeDetachedFieldIndex,\n} from \"../../core/index.js\";\nimport type {\n\tSummarizable,\n\tSummaryElementParser,\n\tSummaryElementStringifier,\n} from \"../../shared-tree-core/index.js\";\nimport { idAllocatorFromMaxId, type JsonCompatible } from \"../../util/index.js\";\n// eslint-disable-next-line import/no-internal-modules\nimport { chunkFieldSingle, defaultChunkPolicy } from \"../chunked-forest/chunkTree.js\";\nimport {\n\tdefaultIncrementalEncodingPolicy,\n\ttype FieldBatchCodec,\n\ttype FieldBatchEncodingContext,\n\ttype IncrementalEncodingPolicy,\n} from \"../chunked-forest/index.js\";\n\nimport { type ForestCodec, makeForestSummarizerCodec } from \"./codec.js\";\nimport {\n\tForestIncrementalSummaryBehavior,\n\tForestIncrementalSummaryBuilder,\n\tforestSummaryContentKey,\n} from \"./incrementalSummaryBuilder.js\";\nimport { TreeCompressionStrategyExtended } from \"../treeCompressionUtils.js\";\nimport type { IFluidHandle } from \"@fluidframework/core-interfaces\";\n\n/**\n * The key for the tree that contains the overall forest's summary tree.\n * This tree is added by the parent of the forest summarizer.\n * See {@link ForestIncrementalSummaryBuilder} for details on the summary structure.\n */\nexport const forestSummaryKey = \"Forest\";\n\n/**\n * Provides methods for summarizing and loading a forest.\n */\nexport class ForestSummarizer implements Summarizable {\n\tpublic readonly key = forestSummaryKey;\n\n\tprivate readonly codec: ForestCodec;\n\n\tprivate readonly incrementalSummaryBuilder: ForestIncrementalSummaryBuilder;\n\n\t/**\n\t * @param encoderContext - The schema if provided here must be mutated by the caller to keep it up to date.\n\t */\n\tpublic constructor(\n\t\tprivate readonly forest: IEditableForest,\n\t\tprivate readonly revisionTagCodec: RevisionTagCodec,\n\t\tfieldBatchCodec: FieldBatchCodec,\n\t\tprivate readonly encoderContext: FieldBatchEncodingContext,\n\t\toptions: CodecWriteOptions,\n\t\tprivate readonly idCompressor: IIdCompressor,\n\t\tinitialSequenceNumber: number,\n\t\tshouldEncodeIncrementally: IncrementalEncodingPolicy = defaultIncrementalEncodingPolicy,\n\t) {\n\t\t// TODO: this should take in CodecWriteOptions, and use it to pick the write version.\n\t\tthis.codec = makeForestSummarizerCodec(options, fieldBatchCodec);\n\t\tthis.incrementalSummaryBuilder = new ForestIncrementalSummaryBuilder(\n\t\t\tencoderContext.encodeType ===\n\t\t\t\tTreeCompressionStrategyExtended.CompressedIncremental /* enableIncrementalSummary */,\n\t\t\t(cursor: ITreeCursorSynchronous) => this.forest.chunkField(cursor),\n\t\t\tshouldEncodeIncrementally,\n\t\t\tinitialSequenceNumber,\n\t\t);\n\t}\n\n\t/**\n\t * Summarization of the forest's tree content.\n\t * @returns a summary tree containing the forest's tree content.\n\t * @remarks\n\t * If incremental summary is disabled, all the content will be added to a single summary blob.\n\t * If incremental summary is enabled, the summary will be a tree.\n\t * See {@link ForestIncrementalSummaryBuilder} for details of what this tree looks like.\n\t *\n\t * TODO: when perf matters, this should be replaced with a chunked async version using a binary format.\n\t */\n\tpublic summarize(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\t\tconst { stringify, fullTree = false, incrementalSummaryContext } = props;\n\n\t\tconst rootCursor = this.forest.getCursorAboveDetachedFields();\n\t\tconst fieldMap: Map<FieldKey, ITreeCursorSynchronous & ITreeSubscriptionCursor> =\n\t\t\tnew Map();\n\t\t// TODO: Encode all detached fields in one operation for better performance and compression\n\t\tforEachField(rootCursor, (cursor) => {\n\t\t\tconst key = cursor.getFieldKey();\n\t\t\tconst innerCursor = this.forest.allocateCursor(\"getTreeString\");\n\t\t\tassert(\n\t\t\t\tthis.forest.tryMoveCursorToField({ fieldKey: key, parent: undefined }, innerCursor) ===\n\t\t\t\t\tTreeNavigationResult.Ok,\n\t\t\t\t0x892 /* failed to navigate to field */,\n\t\t\t);\n\t\t\tfieldMap.set(key, innerCursor as ITreeCursorSynchronous & ITreeSubscriptionCursor);\n\t\t});\n\n\t\t// Let the incremental summary builder know that we are starting a new summary.\n\t\t// It returns whether incremental encoding is enabled.\n\t\tconst incrementalSummaryBehavior = this.incrementalSummaryBuilder.startSummary({\n\t\t\tfullTree,\n\t\t\tincrementalSummaryContext,\n\t\t\tstringify,\n\t\t});\n\t\tconst encoderContext: FieldBatchEncodingContext = {\n\t\t\t...this.encoderContext,\n\t\t\tincrementalEncoderDecoder:\n\t\t\t\tincrementalSummaryBehavior === ForestIncrementalSummaryBehavior.Incremental\n\t\t\t\t\t? this.incrementalSummaryBuilder\n\t\t\t\t\t: undefined,\n\t\t};\n\t\tconst encoded = this.codec.encode(fieldMap, encoderContext);\n\t\tfieldMap.forEach((value) => value.free());\n\n\t\treturn this.incrementalSummaryBuilder.completeSummary({\n\t\t\tincrementalSummaryContext,\n\t\t\tforestSummaryContent: stringify(encoded),\n\t\t});\n\t}\n\n\tpublic async load(\n\t\tservices: IChannelStorageService,\n\t\tparse: SummaryElementParser,\n\t): Promise<void> {\n\t\t// The contents of the top-level forest must be present under a summary blob named `forestSummaryContentKey`.\n\t\t// If the summary was generated as `ForestIncrementalSummaryBehavior.SingleBlob`, this blob will contain all\n\t\t// of forest's contents.\n\t\t// If the summary was generated as `ForestIncrementalSummaryBehavior.Incremental`, this blob will contain only\n\t\t// the top-level forest node's contents.\n\t\t// The contents of the incremental chunks will be in separate tree nodes and will be read later during decoding.\n\t\tassert(\n\t\t\tawait services.contains(forestSummaryContentKey),\n\t\t\t0xc21 /* Forest summary content missing in snapshot */,\n\t\t);\n\n\t\tconst readAndParseBlob = async <T extends JsonCompatible<IFluidHandle>>(\n\t\t\tid: string,\n\t\t): Promise<T> => {\n\t\t\tconst treeBuffer = await services.readBlob(id);\n\t\t\tconst treeBufferString = bufferToString(treeBuffer, \"utf8\");\n\t\t\treturn parse(treeBufferString) as T;\n\t\t};\n\n\t\t// Load the incremental summary builder so that it can download any incremental chunks in the\n\t\t// snapshot.\n\t\tawait this.incrementalSummaryBuilder.load(services, readAndParseBlob);\n\n\t\t// TODO: this code is parsing data without an optional validator, this should be defined in a typebox schema as part of the\n\t\t// forest summary format.\n\t\tconst fields = this.codec.decode(await readAndParseBlob(forestSummaryContentKey), {\n\t\t\t...this.encoderContext,\n\t\t\tincrementalEncoderDecoder: this.incrementalSummaryBuilder,\n\t\t});\n\t\tconst allocator = idAllocatorFromMaxId();\n\t\tconst fieldChanges: [FieldKey, DeltaFieldChanges][] = [];\n\t\tconst build: DeltaDetachedNodeBuild[] = [];\n\t\tfor (const [fieldKey, field] of fields) {\n\t\t\tconst chunked = chunkFieldSingle(field, {\n\t\t\t\tpolicy: defaultChunkPolicy,\n\t\t\t\tidCompressor: this.idCompressor,\n\t\t\t});\n\t\t\tconst buildId = { minor: allocator.allocate(chunked.topLevelLength) };\n\t\t\tbuild.push({\n\t\t\t\tid: buildId,\n\t\t\t\ttrees: chunked,\n\t\t\t});\n\t\t\tfieldChanges.push([fieldKey, [{ count: chunked.topLevelLength, attach: buildId }]]);\n\t\t}\n\n\t\tassert(this.forest.isEmpty, 0x797 /* forest must be empty */);\n\t\tapplyDelta(\n\t\t\t{ build, fields: new Map(fieldChanges) },\n\t\t\tundefined,\n\t\t\tthis.forest,\n\t\t\tmakeDetachedFieldIndex(\"init\", this.revisionTagCodec, this.idCompressor),\n\t\t);\n\t}\n}\n"]}
1
+ {"version":3,"file":"forestSummarizer.js","sourceRoot":"","sources":["../../../src/feature-libraries/forest-summary/forestSummarizer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAU7D,OAAO,EASN,UAAU,EACV,YAAY,EACZ,sBAAsB,GACtB,MAAM,qBAAqB,CAAC;AAM7B,OAAO,EAAE,oBAAoB,EAAuB,MAAM,qBAAqB,CAAC;AAChF,wDAAwD;AACxD,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACtF,OAAO,EACN,gCAAgC,GAIhC,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAoB,yBAAyB,EAAE,MAAM,YAAY,CAAC;AACzE,OAAO,EACN,gCAAgC,EAChC,+BAA+B,EAC/B,uBAAuB,GACvB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,+BAA+B,EAAE,MAAM,4BAA4B,CAAC;AAG7E;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,QAAQ,CAAC;AAEzC;;GAEG;AACH,MAAM,OAAO,gBAAgB;IAO5B;;OAEG;IACH,YACkB,MAAuB,EACvB,gBAAkC,EACnD,eAAgC,EACf,c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sBAAsB,CAAC,MAAM,EAAE,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC,YAAY,CAAC,CACxE,CAAC;IACH,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { bufferToString } from \"@fluid-internal/client-utils\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { IChannelStorageService } from \"@fluidframework/datastore-definitions/internal\";\nimport type { IIdCompressor } from \"@fluidframework/id-compressor\";\nimport type {\n\tIExperimentalIncrementalSummaryContext,\n\tISummaryTreeWithStats,\n\tITelemetryContext,\n} from \"@fluidframework/runtime-definitions/internal\";\n\nimport type { CodecWriteOptions } from \"../../codec/index.js\";\nimport {\n\ttype DeltaDetachedNodeBuild,\n\ttype DeltaFieldChanges,\n\ttype FieldKey,\n\ttype IEditableForest,\n\ttype ITreeCursorSynchronous,\n\ttype ITreeSubscriptionCursor,\n\ttype RevisionTagCodec,\n\tTreeNavigationResult,\n\tapplyDelta,\n\tforEachField,\n\tmakeDetachedFieldIndex,\n} from \"../../core/index.js\";\nimport type {\n\tSummarizable,\n\tSummaryElementParser,\n\tSummaryElementStringifier,\n} from \"../../shared-tree-core/index.js\";\nimport { idAllocatorFromMaxId, type JsonCompatible } from \"../../util/index.js\";\n// eslint-disable-next-line import-x/no-internal-modules\nimport { chunkFieldSingle, defaultChunkPolicy } from \"../chunked-forest/chunkTree.js\";\nimport {\n\tdefaultIncrementalEncodingPolicy,\n\ttype FieldBatchCodec,\n\ttype FieldBatchEncodingContext,\n\ttype IncrementalEncodingPolicy,\n} from \"../chunked-forest/index.js\";\n\nimport { type ForestCodec, makeForestSummarizerCodec } from \"./codec.js\";\nimport {\n\tForestIncrementalSummaryBehavior,\n\tForestIncrementalSummaryBuilder,\n\tforestSummaryContentKey,\n} from \"./incrementalSummaryBuilder.js\";\nimport { TreeCompressionStrategyExtended } from \"../treeCompressionUtils.js\";\nimport type { IFluidHandle } from \"@fluidframework/core-interfaces\";\n\n/**\n * The key for the tree that contains the overall forest's summary tree.\n * This tree is added by the parent of the forest summarizer.\n * See {@link ForestIncrementalSummaryBuilder} for details on the summary structure.\n */\nexport const forestSummaryKey = \"Forest\";\n\n/**\n * Provides methods for summarizing and loading a forest.\n */\nexport class ForestSummarizer implements Summarizable {\n\tpublic readonly key = forestSummaryKey;\n\n\tprivate readonly codec: ForestCodec;\n\n\tprivate readonly incrementalSummaryBuilder: ForestIncrementalSummaryBuilder;\n\n\t/**\n\t * @param encoderContext - The schema if provided here must be mutated by the caller to keep it up to date.\n\t */\n\tpublic constructor(\n\t\tprivate readonly forest: IEditableForest,\n\t\tprivate readonly revisionTagCodec: RevisionTagCodec,\n\t\tfieldBatchCodec: FieldBatchCodec,\n\t\tprivate readonly encoderContext: FieldBatchEncodingContext,\n\t\toptions: CodecWriteOptions,\n\t\tprivate readonly idCompressor: IIdCompressor,\n\t\tinitialSequenceNumber: number,\n\t\tshouldEncodeIncrementally: IncrementalEncodingPolicy = defaultIncrementalEncodingPolicy,\n\t) {\n\t\t// TODO: this should take in CodecWriteOptions, and use it to pick the write version.\n\t\tthis.codec = makeForestSummarizerCodec(options, fieldBatchCodec);\n\t\tthis.incrementalSummaryBuilder = new ForestIncrementalSummaryBuilder(\n\t\t\tencoderContext.encodeType ===\n\t\t\t\tTreeCompressionStrategyExtended.CompressedIncremental /* enableIncrementalSummary */,\n\t\t\t(cursor: ITreeCursorSynchronous) => this.forest.chunkField(cursor),\n\t\t\tshouldEncodeIncrementally,\n\t\t\tinitialSequenceNumber,\n\t\t);\n\t}\n\n\t/**\n\t * Summarization of the forest's tree content.\n\t * @returns a summary tree containing the forest's tree content.\n\t * @remarks\n\t * If incremental summary is disabled, all the content will be added to a single summary blob.\n\t * If incremental summary is enabled, the summary will be a tree.\n\t * See {@link ForestIncrementalSummaryBuilder} for details of what this tree looks like.\n\t *\n\t * TODO: when perf matters, this should be replaced with a chunked async version using a binary format.\n\t */\n\tpublic summarize(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\t\tconst { stringify, fullTree = false, incrementalSummaryContext } = props;\n\n\t\tconst rootCursor = this.forest.getCursorAboveDetachedFields();\n\t\tconst fieldMap: Map<FieldKey, ITreeCursorSynchronous & ITreeSubscriptionCursor> =\n\t\t\tnew Map();\n\t\t// TODO: Encode all detached fields in one operation for better performance and compression\n\t\tforEachField(rootCursor, (cursor) => {\n\t\t\tconst key = cursor.getFieldKey();\n\t\t\tconst innerCursor = this.forest.allocateCursor(\"getTreeString\");\n\t\t\tassert(\n\t\t\t\tthis.forest.tryMoveCursorToField({ fieldKey: key, parent: undefined }, innerCursor) ===\n\t\t\t\t\tTreeNavigationResult.Ok,\n\t\t\t\t0x892 /* failed to navigate to field */,\n\t\t\t);\n\t\t\tfieldMap.set(key, innerCursor as ITreeCursorSynchronous & ITreeSubscriptionCursor);\n\t\t});\n\n\t\t// Let the incremental summary builder know that we are starting a new summary.\n\t\t// It returns whether incremental encoding is enabled.\n\t\tconst incrementalSummaryBehavior = this.incrementalSummaryBuilder.startSummary({\n\t\t\tfullTree,\n\t\t\tincrementalSummaryContext,\n\t\t\tstringify,\n\t\t});\n\t\tconst encoderContext: FieldBatchEncodingContext = {\n\t\t\t...this.encoderContext,\n\t\t\tincrementalEncoderDecoder:\n\t\t\t\tincrementalSummaryBehavior === ForestIncrementalSummaryBehavior.Incremental\n\t\t\t\t\t? this.incrementalSummaryBuilder\n\t\t\t\t\t: undefined,\n\t\t};\n\t\tconst encoded = this.codec.encode(fieldMap, encoderContext);\n\t\tfieldMap.forEach((value) => value.free());\n\n\t\treturn this.incrementalSummaryBuilder.completeSummary({\n\t\t\tincrementalSummaryContext,\n\t\t\tforestSummaryContent: stringify(encoded),\n\t\t});\n\t}\n\n\tpublic async load(\n\t\tservices: IChannelStorageService,\n\t\tparse: SummaryElementParser,\n\t): Promise<void> {\n\t\t// The contents of the top-level forest must be present under a summary blob named `forestSummaryContentKey`.\n\t\t// If the summary was generated as `ForestIncrementalSummaryBehavior.SingleBlob`, this blob will contain all\n\t\t// of forest's contents.\n\t\t// If the summary was generated as `ForestIncrementalSummaryBehavior.Incremental`, this blob will contain only\n\t\t// the top-level forest node's contents.\n\t\t// The contents of the incremental chunks will be in separate tree nodes and will be read later during decoding.\n\t\tassert(\n\t\t\tawait services.contains(forestSummaryContentKey),\n\t\t\t0xc21 /* Forest summary content missing in snapshot */,\n\t\t);\n\n\t\tconst readAndParseBlob = async <T extends JsonCompatible<IFluidHandle>>(\n\t\t\tid: string,\n\t\t): Promise<T> => {\n\t\t\tconst treeBuffer = await services.readBlob(id);\n\t\t\tconst treeBufferString = bufferToString(treeBuffer, \"utf8\");\n\t\t\treturn parse(treeBufferString) as T;\n\t\t};\n\n\t\t// Load the incremental summary builder so that it can download any incremental chunks in the\n\t\t// snapshot.\n\t\tawait this.incrementalSummaryBuilder.load(services, readAndParseBlob);\n\n\t\t// TODO: this code is parsing data without an optional validator, this should be defined in a typebox schema as part of the\n\t\t// forest summary format.\n\t\tconst fields = this.codec.decode(await readAndParseBlob(forestSummaryContentKey), {\n\t\t\t...this.encoderContext,\n\t\t\tincrementalEncoderDecoder: this.incrementalSummaryBuilder,\n\t\t});\n\t\tconst allocator = idAllocatorFromMaxId();\n\t\tconst fieldChanges: [FieldKey, DeltaFieldChanges][] = [];\n\t\tconst build: DeltaDetachedNodeBuild[] = [];\n\t\tfor (const [fieldKey, field] of fields) {\n\t\t\tconst chunked = chunkFieldSingle(field, {\n\t\t\t\tpolicy: defaultChunkPolicy,\n\t\t\t\tidCompressor: this.idCompressor,\n\t\t\t});\n\t\t\tconst buildId = { minor: allocator.allocate(chunked.topLevelLength) };\n\t\t\tbuild.push({\n\t\t\t\tid: buildId,\n\t\t\t\ttrees: chunked,\n\t\t\t});\n\t\t\tfieldChanges.push([fieldKey, [{ count: chunked.topLevelLength, attach: buildId }]]);\n\t\t}\n\n\t\tassert(this.forest.isEmpty, 0x797 /* forest must be empty */);\n\t\tapplyDelta(\n\t\t\t{ build, fields: new Map(fieldChanges) },\n\t\t\tundefined,\n\t\t\tthis.forest,\n\t\t\tmakeDetachedFieldIndex(\"init\", this.revisionTagCodec, this.idCompressor),\n\t\t);\n\t}\n}\n"]}
@@ -4,9 +4,16 @@
4
4
  */
5
5
  import { type Static } from "@sinclair/typebox";
6
6
  import { schemaFormatV1 } from "../../core/index.js";
7
- export declare const version = 1;
7
+ import { type Brand } from "../../util/index.js";
8
+ /**
9
+ * The format version for the forest.
10
+ */
11
+ export declare const ForestFormatVersion: {
12
+ readonly v1: 1;
13
+ };
14
+ export type ForestFormatVersion = Brand<(typeof ForestFormatVersion)[keyof typeof ForestFormatVersion], "ForestFormatVersion">;
8
15
  export declare const Format: import("@sinclair/typebox").TObject<{
9
- version: import("@sinclair/typebox").TLiteral<1>;
16
+ version: import("@sinclair/typebox").TLiteral<ForestFormatVersion>;
10
17
  keys: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnsafe<schemaFormatV1.FieldKey>>;
11
18
  fields: import("@sinclair/typebox").TObject<{
12
19
  version: import("@sinclair/typebox").TNumber;
@@ -1 +1 @@
1
- {"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/forest-summary/format.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,MAAM,EAAQ,MAAM,mBAAmB,CAAC;AAGtD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,eAAO,MAAM,OAAO,IAAM,CAAC;AAE3B,eAAO,MAAM,MAAM;;;;;;EAOlB,CAAC;AAEF,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,MAAM,CAAC,CAAC"}
1
+ {"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/forest-summary/format.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,MAAM,EAAQ,MAAM,mBAAmB,CAAC;AAGtD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAS,KAAK,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAExD;;GAEG;AACH,eAAO,MAAM,mBAAmB;;CAEtB,CAAC;AACX,MAAM,MAAM,mBAAmB,GAAG,KAAK,CACtC,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,OAAO,mBAAmB,CAAC,EAC9D,qBAAqB,CACrB,CAAC;AAgBF,eAAO,MAAM,MAAM;;;;;;EAAoE,CAAC;AACxF,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,MAAM,CAAC,CAAC"}
@@ -5,10 +5,17 @@
5
5
  import { Type } from "@sinclair/typebox";
6
6
  import { Versioned } from "../../codec/index.js";
7
7
  import { schemaFormatV1 } from "../../core/index.js";
8
- export const version = 1.0;
9
- export const Format = Type.Object({
8
+ import { brand } from "../../util/index.js";
9
+ /**
10
+ * The format version for the forest.
11
+ */
12
+ export const ForestFormatVersion = {
13
+ v1: 1,
14
+ };
15
+ const FormatGeneric = (version) => Type.Object({
10
16
  version: Type.Literal(version),
11
17
  keys: Type.Array(schemaFormatV1.FieldKeySchema),
12
18
  fields: Versioned,
13
19
  }, { additionalProperties: false });
20
+ export const Format = FormatGeneric(brand(ForestFormatVersion.v1));
14
21
  //# sourceMappingURL=format.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"format.js","sourceRoot":"","sources":["../../../src/feature-libraries/forest-summary/format.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAe,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEtD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,MAAM,CAAC,MAAM,OAAO,GAAG,GAAG,CAAC;AAE3B,MAAM,CAAC,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAChC;IACC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;IAC9B,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IAC/C,MAAM,EAAE,SAAS;CACjB,EACD,EAAE,oBAAoB,EAAE,KAAK,EAAE,CAC/B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { type Static, Type } from \"@sinclair/typebox\";\n\nimport { Versioned } from \"../../codec/index.js\";\nimport { schemaFormatV1 } from \"../../core/index.js\";\n\nexport const version = 1.0;\n\nexport const Format = Type.Object(\n\t{\n\t\tversion: Type.Literal(version),\n\t\tkeys: Type.Array(schemaFormatV1.FieldKeySchema),\n\t\tfields: Versioned,\n\t},\n\t{ additionalProperties: false },\n);\n\nexport type Format = Static<typeof Format>;\n"]}
1
+ {"version":3,"file":"format.js","sourceRoot":"","sources":["../../../src/feature-libraries/forest-summary/format.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAe,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEtD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,KAAK,EAAc,MAAM,qBAAqB,CAAC;AAExD;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;IAClC,EAAE,EAAE,CAAC;CACI,CAAC;AAMX,MAAM,aAAa,GAAG,CACrB,OAA4B,EAG3B,EAAE,CACH,IAAI,CAAC,MAAM,CACV;IACC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;IAC9B,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IAC/C,MAAM,EAAE,SAAS;CACjB,EACD,EAAE,oBAAoB,EAAE,KAAK,EAAE,CAC/B,CAAC;AAEH,MAAM,CAAC,MAAM,MAAM,GAAG,aAAa,CAAC,KAAK,CAAsB,mBAAmB,CAAC,EAAE,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { type Static, Type } from \"@sinclair/typebox\";\n\nimport { Versioned } from \"../../codec/index.js\";\nimport { schemaFormatV1 } from \"../../core/index.js\";\nimport { brand, type Brand } from \"../../util/index.js\";\n\n/**\n * The format version for the forest.\n */\nexport const ForestFormatVersion = {\n\tv1: 1,\n} as const;\nexport type ForestFormatVersion = Brand<\n\t(typeof ForestFormatVersion)[keyof typeof ForestFormatVersion],\n\t\"ForestFormatVersion\"\n>;\n\nconst FormatGeneric = (\n\tversion: ForestFormatVersion,\n\t// Return type is intentionally derived.\n\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n) =>\n\tType.Object(\n\t\t{\n\t\t\tversion: Type.Literal(version),\n\t\t\tkeys: Type.Array(schemaFormatV1.FieldKeySchema),\n\t\t\tfields: Versioned,\n\t\t},\n\t\t{ additionalProperties: false },\n\t);\n\nexport const Format = FormatGeneric(brand<ForestFormatVersion>(ForestFormatVersion.v1));\nexport type Format = Static<typeof Format>;\n"]}
@@ -3,5 +3,6 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  export { forestSummaryKey, ForestSummarizer } from "./forestSummarizer.js";
6
- export { getCodecTreeForForestFormat, type ForestFormatVersion } from "./codec.js";
6
+ export { getCodecTreeForForestFormat } from "./codec.js";
7
+ export { ForestFormatVersion } from "./format.js";
7
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/forest-summary/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC3E,OAAO,EAAE,2BAA2B,EAAE,KAAK,mBAAmB,EAAE,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/forest-summary/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC3E,OAAO,EAAE,2BAA2B,EAAE,MAAM,YAAY,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC"}
@@ -4,4 +4,5 @@
4
4
  */
5
5
  export { forestSummaryKey, ForestSummarizer } from "./forestSummarizer.js";
6
6
  export { getCodecTreeForForestFormat } from "./codec.js";
7
+ export { ForestFormatVersion } from "./format.js";
7
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/feature-libraries/forest-summary/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC3E,OAAO,EAAE,2BAA2B,EAA4B,MAAM,YAAY,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { forestSummaryKey, ForestSummarizer } from \"./forestSummarizer.js\";\nexport { getCodecTreeForForestFormat, type ForestFormatVersion } from \"./codec.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/feature-libraries/forest-summary/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC3E,OAAO,EAAE,2BAA2B,EAAE,MAAM,YAAY,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { forestSummaryKey, ForestSummarizer } from \"./forestSummarizer.js\";\nexport { getCodecTreeForForestFormat } from \"./codec.js\";\nexport { ForestFormatVersion } from \"./format.js\";\n"]}