@fluidframework/tree 2.70.0 → 2.72.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 (684) hide show
  1. package/CHANGELOG.md +84 -40
  2. package/api-report/tree.alpha.api.md +52 -22
  3. package/api-report/tree.beta.api.md +45 -0
  4. package/api-report/tree.legacy.beta.api.md +45 -0
  5. package/dist/alpha.d.ts +12 -7
  6. package/dist/api.js +1 -1
  7. package/dist/api.js.map +1 -1
  8. package/dist/beta.d.ts +8 -0
  9. package/dist/codec/codec.d.ts +16 -1
  10. package/dist/codec/codec.d.ts.map +1 -1
  11. package/dist/codec/codec.js +16 -3
  12. package/dist/codec/codec.js.map +1 -1
  13. package/dist/codec/discriminatedUnions.d.ts +1 -1
  14. package/dist/codec/discriminatedUnions.js +1 -1
  15. package/dist/codec/discriminatedUnions.js.map +1 -1
  16. package/dist/core/index.d.ts +1 -1
  17. package/dist/core/index.d.ts.map +1 -1
  18. package/dist/core/index.js +2 -2
  19. package/dist/core/index.js.map +1 -1
  20. package/dist/core/schema-stored/index.d.ts +1 -1
  21. package/dist/core/schema-stored/index.d.ts.map +1 -1
  22. package/dist/core/schema-stored/index.js +2 -2
  23. package/dist/core/schema-stored/index.js.map +1 -1
  24. package/dist/core/schema-stored/schema.d.ts +6 -6
  25. package/dist/core/schema-stored/schema.d.ts.map +1 -1
  26. package/dist/core/schema-stored/schema.js +6 -7
  27. package/dist/core/schema-stored/schema.js.map +1 -1
  28. package/dist/core/tree/detachedFieldIndexCodecCommon.d.ts +2 -1
  29. package/dist/core/tree/detachedFieldIndexCodecCommon.d.ts.map +1 -1
  30. package/dist/core/tree/detachedFieldIndexCodecCommon.js.map +1 -1
  31. package/dist/core/tree/detachedFieldIndexCodecV1.d.ts +1 -1
  32. package/dist/core/tree/detachedFieldIndexCodecV1.d.ts.map +1 -1
  33. package/dist/core/tree/detachedFieldIndexCodecV1.js +3 -2
  34. package/dist/core/tree/detachedFieldIndexCodecV1.js.map +1 -1
  35. package/dist/core/tree/detachedFieldIndexCodecV2.d.ts.map +1 -1
  36. package/dist/core/tree/detachedFieldIndexCodecV2.js +3 -1
  37. package/dist/core/tree/detachedFieldIndexCodecV2.js.map +1 -1
  38. package/dist/core/tree/detachedFieldIndexCodecs.d.ts +2 -3
  39. package/dist/core/tree/detachedFieldIndexCodecs.d.ts.map +1 -1
  40. package/dist/core/tree/detachedFieldIndexCodecs.js +29 -8
  41. package/dist/core/tree/detachedFieldIndexCodecs.js.map +1 -1
  42. package/dist/core/tree/detachedFieldIndexFormatCommon.d.ts +10 -1
  43. package/dist/core/tree/detachedFieldIndexFormatCommon.d.ts.map +1 -1
  44. package/dist/core/tree/detachedFieldIndexFormatCommon.js +8 -1
  45. package/dist/core/tree/detachedFieldIndexFormatCommon.js.map +1 -1
  46. package/dist/core/tree/detachedFieldIndexFormatV1.d.ts +2 -2
  47. package/dist/core/tree/detachedFieldIndexFormatV1.d.ts.map +1 -1
  48. package/dist/core/tree/detachedFieldIndexFormatV1.js +3 -3
  49. package/dist/core/tree/detachedFieldIndexFormatV1.js.map +1 -1
  50. package/dist/core/tree/detachedFieldIndexFormatV2.d.ts +2 -2
  51. package/dist/core/tree/detachedFieldIndexFormatV2.d.ts.map +1 -1
  52. package/dist/core/tree/detachedFieldIndexFormatV2.js +3 -3
  53. package/dist/core/tree/detachedFieldIndexFormatV2.js.map +1 -1
  54. package/dist/core/tree/index.d.ts +2 -1
  55. package/dist/core/tree/index.d.ts.map +1 -1
  56. package/dist/core/tree/index.js.map +1 -1
  57. package/dist/external-utilities/typeboxValidator.js +1 -1
  58. package/dist/external-utilities/typeboxValidator.js.map +1 -1
  59. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts +4 -10
  60. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  61. package/dist/feature-libraries/chunked-forest/codec/codecs.js +12 -8
  62. package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  63. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +1 -1
  64. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  65. package/dist/feature-libraries/chunked-forest/codec/format.d.ts +8 -3
  66. package/dist/feature-libraries/chunked-forest/codec/format.d.ts.map +1 -1
  67. package/dist/feature-libraries/chunked-forest/codec/format.js +9 -4
  68. package/dist/feature-libraries/chunked-forest/codec/format.js.map +1 -1
  69. package/dist/feature-libraries/chunked-forest/codec/index.d.ts +2 -2
  70. package/dist/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
  71. package/dist/feature-libraries/chunked-forest/codec/index.js +1 -2
  72. package/dist/feature-libraries/chunked-forest/codec/index.js.map +1 -1
  73. package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.d.ts.map +1 -1
  74. package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.js +1 -1
  75. package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.js.map +1 -1
  76. package/dist/feature-libraries/chunked-forest/index.d.ts +1 -1
  77. package/dist/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  78. package/dist/feature-libraries/chunked-forest/index.js +1 -2
  79. package/dist/feature-libraries/chunked-forest/index.js.map +1 -1
  80. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts +1 -9
  81. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  82. package/dist/feature-libraries/default-schema/defaultFieldKinds.js +3 -21
  83. package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  84. package/dist/feature-libraries/forest-summary/codec.d.ts +4 -5
  85. package/dist/feature-libraries/forest-summary/codec.d.ts.map +1 -1
  86. package/dist/feature-libraries/forest-summary/codec.js +15 -4
  87. package/dist/feature-libraries/forest-summary/codec.js.map +1 -1
  88. package/dist/feature-libraries/forest-summary/forestSummarizer.js +1 -1
  89. package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  90. package/dist/feature-libraries/forest-summary/format.d.ts +8 -1
  91. package/dist/feature-libraries/forest-summary/format.d.ts.map +1 -1
  92. package/dist/feature-libraries/forest-summary/format.js +8 -3
  93. package/dist/feature-libraries/forest-summary/format.js.map +1 -1
  94. package/dist/feature-libraries/forest-summary/index.d.ts +2 -1
  95. package/dist/feature-libraries/forest-summary/index.d.ts.map +1 -1
  96. package/dist/feature-libraries/forest-summary/index.js +3 -1
  97. package/dist/feature-libraries/forest-summary/index.js.map +1 -1
  98. package/dist/feature-libraries/index.d.ts +3 -3
  99. package/dist/feature-libraries/index.d.ts.map +1 -1
  100. package/dist/feature-libraries/index.js +2 -2
  101. package/dist/feature-libraries/index.js.map +1 -1
  102. package/dist/feature-libraries/schema-edits/index.d.ts +1 -1
  103. package/dist/feature-libraries/schema-edits/index.d.ts.map +1 -1
  104. package/dist/feature-libraries/schema-edits/index.js.map +1 -1
  105. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.d.ts +6 -7
  106. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
  107. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js +5 -4
  108. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
  109. package/dist/feature-libraries/schema-index/codec.d.ts +10 -10
  110. package/dist/feature-libraries/schema-index/codec.d.ts.map +1 -1
  111. package/dist/feature-libraries/schema-index/codec.js +22 -18
  112. package/dist/feature-libraries/schema-index/codec.js.map +1 -1
  113. package/dist/feature-libraries/schema-index/formatV1.d.ts +2 -2
  114. package/dist/feature-libraries/schema-index/formatV1.d.ts.map +1 -1
  115. package/dist/feature-libraries/schema-index/formatV1.js +1 -1
  116. package/dist/feature-libraries/schema-index/formatV1.js.map +1 -1
  117. package/dist/feature-libraries/schema-index/formatV2.d.ts +1 -2
  118. package/dist/feature-libraries/schema-index/formatV2.d.ts.map +1 -1
  119. package/dist/feature-libraries/schema-index/formatV2.js +1 -1
  120. package/dist/feature-libraries/schema-index/formatV2.js.map +1 -1
  121. package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts +2 -2
  122. package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
  123. package/dist/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
  124. package/dist/index.d.ts +2 -2
  125. package/dist/index.d.ts.map +1 -1
  126. package/dist/index.js +6 -2
  127. package/dist/index.js.map +1 -1
  128. package/dist/legacy.d.ts +8 -0
  129. package/dist/packageVersion.d.ts +1 -1
  130. package/dist/packageVersion.js +1 -1
  131. package/dist/packageVersion.js.map +1 -1
  132. package/dist/shared-tree/independentView.d.ts +75 -6
  133. package/dist/shared-tree/independentView.d.ts.map +1 -1
  134. package/dist/shared-tree/independentView.js +116 -43
  135. package/dist/shared-tree/independentView.js.map +1 -1
  136. package/dist/shared-tree/index.d.ts +2 -1
  137. package/dist/shared-tree/index.d.ts.map +1 -1
  138. package/dist/shared-tree/index.js +6 -1
  139. package/dist/shared-tree/index.js.map +1 -1
  140. package/dist/shared-tree/sharedTree.d.ts +12 -16
  141. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  142. package/dist/shared-tree/sharedTree.js +105 -130
  143. package/dist/shared-tree/sharedTree.js.map +1 -1
  144. package/dist/shared-tree/sharedTreeChangeCodecs.d.ts +7 -6
  145. package/dist/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  146. package/dist/shared-tree/sharedTreeChangeCodecs.js +12 -11
  147. package/dist/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  148. package/dist/shared-tree/sharedTreeChangeFamily.d.ts +2 -2
  149. package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  150. package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  151. package/dist/shared-tree/treeAlpha.d.ts +1 -1
  152. package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
  153. package/dist/shared-tree/treeAlpha.js +4 -2
  154. package/dist/shared-tree/treeAlpha.js.map +1 -1
  155. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  156. package/dist/shared-tree/treeCheckout.js +1 -3
  157. package/dist/shared-tree/treeCheckout.js.map +1 -1
  158. package/dist/shared-tree-core/editManagerCodecs.d.ts +19 -6
  159. package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  160. package/dist/shared-tree-core/editManagerCodecs.js +35 -17
  161. package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
  162. package/dist/shared-tree-core/editManagerFormatCommons.d.ts +37 -0
  163. package/dist/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
  164. package/dist/shared-tree-core/editManagerFormatCommons.js +43 -1
  165. package/dist/shared-tree-core/editManagerFormatCommons.js.map +1 -1
  166. package/dist/shared-tree-core/editManagerFormatV1toV4.d.ts +2 -2
  167. package/dist/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -1
  168. package/dist/shared-tree-core/editManagerFormatV1toV4.js +4 -4
  169. package/dist/shared-tree-core/editManagerFormatV1toV4.js.map +1 -1
  170. package/dist/shared-tree-core/editManagerFormatV5.d.ts +2 -2
  171. package/dist/shared-tree-core/editManagerFormatV5.d.ts.map +1 -1
  172. package/dist/shared-tree-core/editManagerFormatV5.js +1 -1
  173. package/dist/shared-tree-core/editManagerFormatV5.js.map +1 -1
  174. package/dist/shared-tree-core/index.d.ts +5 -3
  175. package/dist/shared-tree-core/index.d.ts.map +1 -1
  176. package/dist/shared-tree-core/index.js +11 -3
  177. package/dist/shared-tree-core/index.js.map +1 -1
  178. package/dist/shared-tree-core/messageCodecV1ToV4.d.ts +2 -1
  179. package/dist/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
  180. package/dist/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
  181. package/dist/shared-tree-core/messageCodecV5.d.ts +2 -1
  182. package/dist/shared-tree-core/messageCodecV5.d.ts.map +1 -1
  183. package/dist/shared-tree-core/messageCodecV5.js.map +1 -1
  184. package/dist/shared-tree-core/messageCodecs.d.ts +19 -6
  185. package/dist/shared-tree-core/messageCodecs.d.ts.map +1 -1
  186. package/dist/shared-tree-core/messageCodecs.js +38 -21
  187. package/dist/shared-tree-core/messageCodecs.js.map +1 -1
  188. package/dist/shared-tree-core/messageFormat.d.ts +50 -0
  189. package/dist/shared-tree-core/messageFormat.d.ts.map +1 -0
  190. package/dist/shared-tree-core/messageFormat.js +51 -0
  191. package/dist/shared-tree-core/messageFormat.js.map +1 -0
  192. package/dist/shared-tree-core/sharedTreeCore.d.ts +8 -8
  193. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  194. package/dist/shared-tree-core/sharedTreeCore.js +3 -3
  195. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  196. package/dist/simple-tree/api/discrepancies.d.ts +2 -2
  197. package/dist/simple-tree/api/discrepancies.js.map +1 -1
  198. package/dist/simple-tree/api/incrementalAllowedTypes.d.ts +1 -1
  199. package/dist/simple-tree/api/incrementalAllowedTypes.js +1 -1
  200. package/dist/simple-tree/api/incrementalAllowedTypes.js.map +1 -1
  201. package/dist/simple-tree/api/index.d.ts +3 -2
  202. package/dist/simple-tree/api/index.d.ts.map +1 -1
  203. package/dist/simple-tree/api/index.js +4 -1
  204. package/dist/simple-tree/api/index.js.map +1 -1
  205. package/dist/simple-tree/api/schemaFactory.d.ts +2 -2
  206. package/dist/simple-tree/api/schemaFactory.js +2 -2
  207. package/dist/simple-tree/api/schemaFactory.js.map +1 -1
  208. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +2 -98
  209. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  210. package/dist/simple-tree/api/schemaFactoryAlpha.js +1 -52
  211. package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  212. package/dist/simple-tree/api/schemaFactoryBeta.d.ts +98 -2
  213. package/dist/simple-tree/api/schemaFactoryBeta.d.ts.map +1 -1
  214. package/dist/simple-tree/api/schemaFactoryBeta.js +61 -7
  215. package/dist/simple-tree/api/schemaFactoryBeta.js.map +1 -1
  216. package/dist/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
  217. package/dist/simple-tree/api/schemaFactoryRecursive.js +1 -0
  218. package/dist/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
  219. package/dist/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
  220. package/dist/simple-tree/api/schemaFromSimple.js +15 -8
  221. package/dist/simple-tree/api/schemaFromSimple.js.map +1 -1
  222. package/dist/simple-tree/api/simpleSchemaCodec.d.ts +28 -0
  223. package/dist/simple-tree/api/simpleSchemaCodec.d.ts.map +1 -0
  224. package/dist/simple-tree/api/simpleSchemaCodec.js +292 -0
  225. package/dist/simple-tree/api/simpleSchemaCodec.js.map +1 -0
  226. package/dist/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -1
  227. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js +4 -2
  228. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  229. package/dist/simple-tree/api/storedSchema.d.ts +2 -2
  230. package/dist/simple-tree/api/storedSchema.d.ts.map +1 -1
  231. package/dist/simple-tree/api/storedSchema.js +8 -6
  232. package/dist/simple-tree/api/storedSchema.js.map +1 -1
  233. package/dist/simple-tree/api/tree.d.ts +2 -2
  234. package/dist/simple-tree/api/tree.js.map +1 -1
  235. package/dist/simple-tree/api/typesUnsafe.d.ts +6 -6
  236. package/dist/simple-tree/api/typesUnsafe.js.map +1 -1
  237. package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts +17 -1
  238. package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
  239. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js +71 -7
  240. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
  241. package/dist/simple-tree/core/allowedTypes.d.ts +12 -7
  242. package/dist/simple-tree/core/allowedTypes.d.ts.map +1 -1
  243. package/dist/simple-tree/core/allowedTypes.js +18 -5
  244. package/dist/simple-tree/core/allowedTypes.js.map +1 -1
  245. package/dist/simple-tree/core/treeNode.js +1 -1
  246. package/dist/simple-tree/core/treeNode.js.map +1 -1
  247. package/dist/simple-tree/fieldSchema.d.ts +2 -1
  248. package/dist/simple-tree/fieldSchema.d.ts.map +1 -1
  249. package/dist/simple-tree/fieldSchema.js +10 -0
  250. package/dist/simple-tree/fieldSchema.js.map +1 -1
  251. package/dist/simple-tree/index.d.ts +3 -2
  252. package/dist/simple-tree/index.d.ts.map +1 -1
  253. package/dist/simple-tree/index.js +4 -0
  254. package/dist/simple-tree/index.js.map +1 -1
  255. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  256. package/dist/simple-tree/node-kinds/array/arrayNode.js +7 -1
  257. package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  258. package/dist/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
  259. package/dist/simple-tree/node-kinds/map/mapNode.js +7 -1
  260. package/dist/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  261. package/dist/simple-tree/node-kinds/object/objectNode.d.ts +17 -0
  262. package/dist/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  263. package/dist/simple-tree/node-kinds/object/objectNode.js +21 -8
  264. package/dist/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  265. package/dist/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
  266. package/dist/simple-tree/node-kinds/record/recordNode.js +8 -2
  267. package/dist/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  268. package/dist/simple-tree/node-kinds/record/recordNodeTypes.d.ts +16 -0
  269. package/dist/simple-tree/node-kinds/record/recordNodeTypes.d.ts.map +1 -1
  270. package/dist/simple-tree/node-kinds/record/recordNodeTypes.js.map +1 -1
  271. package/dist/simple-tree/simpleSchema.d.ts +30 -6
  272. package/dist/simple-tree/simpleSchema.d.ts.map +1 -1
  273. package/dist/simple-tree/simpleSchema.js.map +1 -1
  274. package/dist/simple-tree/simpleSchemaFormatV1.d.ts +249 -0
  275. package/dist/simple-tree/simpleSchemaFormatV1.d.ts.map +1 -0
  276. package/dist/simple-tree/simpleSchemaFormatV1.js +115 -0
  277. package/dist/simple-tree/simpleSchemaFormatV1.js.map +1 -0
  278. package/dist/simple-tree/toStoredSchema.d.ts.map +1 -1
  279. package/dist/simple-tree/toStoredSchema.js +6 -3
  280. package/dist/simple-tree/toStoredSchema.js.map +1 -1
  281. package/dist/tableSchema.d.ts.map +1 -1
  282. package/dist/tableSchema.js +1 -1
  283. package/dist/tableSchema.js.map +1 -1
  284. package/dist/treeFactory.d.ts +3 -1
  285. package/dist/treeFactory.d.ts.map +1 -1
  286. package/dist/treeFactory.js +26 -2
  287. package/dist/treeFactory.js.map +1 -1
  288. package/dist/util/brand.d.ts +31 -2
  289. package/dist/util/brand.d.ts.map +1 -1
  290. package/dist/util/brand.js +28 -2
  291. package/dist/util/brand.js.map +1 -1
  292. package/dist/util/brandedMap.d.ts +3 -1
  293. package/dist/util/brandedMap.d.ts.map +1 -1
  294. package/dist/util/brandedMap.js.map +1 -1
  295. package/dist/util/index.d.ts +1 -1
  296. package/dist/util/index.d.ts.map +1 -1
  297. package/dist/util/index.js +3 -2
  298. package/dist/util/index.js.map +1 -1
  299. package/dist/util/referenceCounting.d.ts.map +1 -1
  300. package/dist/util/referenceCounting.js +1 -0
  301. package/dist/util/referenceCounting.js.map +1 -1
  302. package/lib/alpha.d.ts +12 -7
  303. package/lib/api.js +2 -2
  304. package/lib/api.js.map +1 -1
  305. package/lib/beta.d.ts +8 -0
  306. package/lib/codec/codec.d.ts +16 -1
  307. package/lib/codec/codec.d.ts.map +1 -1
  308. package/lib/codec/codec.js +16 -3
  309. package/lib/codec/codec.js.map +1 -1
  310. package/lib/codec/discriminatedUnions.d.ts +1 -1
  311. package/lib/codec/discriminatedUnions.js +1 -1
  312. package/lib/codec/discriminatedUnions.js.map +1 -1
  313. package/lib/core/index.d.ts +1 -1
  314. package/lib/core/index.d.ts.map +1 -1
  315. package/lib/core/index.js +1 -1
  316. package/lib/core/index.js.map +1 -1
  317. package/lib/core/schema-stored/index.d.ts +1 -1
  318. package/lib/core/schema-stored/index.d.ts.map +1 -1
  319. package/lib/core/schema-stored/index.js +1 -1
  320. package/lib/core/schema-stored/index.js.map +1 -1
  321. package/lib/core/schema-stored/schema.d.ts +6 -6
  322. package/lib/core/schema-stored/schema.d.ts.map +1 -1
  323. package/lib/core/schema-stored/schema.js +6 -7
  324. package/lib/core/schema-stored/schema.js.map +1 -1
  325. package/lib/core/tree/detachedFieldIndexCodecCommon.d.ts +2 -1
  326. package/lib/core/tree/detachedFieldIndexCodecCommon.d.ts.map +1 -1
  327. package/lib/core/tree/detachedFieldIndexCodecCommon.js.map +1 -1
  328. package/lib/core/tree/detachedFieldIndexCodecV1.d.ts +1 -1
  329. package/lib/core/tree/detachedFieldIndexCodecV1.d.ts.map +1 -1
  330. package/lib/core/tree/detachedFieldIndexCodecV1.js +3 -2
  331. package/lib/core/tree/detachedFieldIndexCodecV1.js.map +1 -1
  332. package/lib/core/tree/detachedFieldIndexCodecV2.d.ts.map +1 -1
  333. package/lib/core/tree/detachedFieldIndexCodecV2.js +4 -2
  334. package/lib/core/tree/detachedFieldIndexCodecV2.js.map +1 -1
  335. package/lib/core/tree/detachedFieldIndexCodecs.d.ts +2 -3
  336. package/lib/core/tree/detachedFieldIndexCodecs.d.ts.map +1 -1
  337. package/lib/core/tree/detachedFieldIndexCodecs.js +29 -8
  338. package/lib/core/tree/detachedFieldIndexCodecs.js.map +1 -1
  339. package/lib/core/tree/detachedFieldIndexFormatCommon.d.ts +10 -1
  340. package/lib/core/tree/detachedFieldIndexFormatCommon.d.ts.map +1 -1
  341. package/lib/core/tree/detachedFieldIndexFormatCommon.js +7 -0
  342. package/lib/core/tree/detachedFieldIndexFormatCommon.js.map +1 -1
  343. package/lib/core/tree/detachedFieldIndexFormatV1.d.ts +2 -2
  344. package/lib/core/tree/detachedFieldIndexFormatV1.d.ts.map +1 -1
  345. package/lib/core/tree/detachedFieldIndexFormatV1.js +3 -3
  346. package/lib/core/tree/detachedFieldIndexFormatV1.js.map +1 -1
  347. package/lib/core/tree/detachedFieldIndexFormatV2.d.ts +2 -2
  348. package/lib/core/tree/detachedFieldIndexFormatV2.d.ts.map +1 -1
  349. package/lib/core/tree/detachedFieldIndexFormatV2.js +3 -3
  350. package/lib/core/tree/detachedFieldIndexFormatV2.js.map +1 -1
  351. package/lib/core/tree/index.d.ts +2 -1
  352. package/lib/core/tree/index.d.ts.map +1 -1
  353. package/lib/core/tree/index.js +1 -1
  354. package/lib/core/tree/index.js.map +1 -1
  355. package/lib/external-utilities/typeboxValidator.js +1 -1
  356. package/lib/external-utilities/typeboxValidator.js.map +1 -1
  357. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts +4 -10
  358. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  359. package/lib/feature-libraries/chunked-forest/codec/codecs.js +13 -8
  360. package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  361. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +2 -2
  362. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  363. package/lib/feature-libraries/chunked-forest/codec/format.d.ts +8 -3
  364. package/lib/feature-libraries/chunked-forest/codec/format.d.ts.map +1 -1
  365. package/lib/feature-libraries/chunked-forest/codec/format.js +8 -3
  366. package/lib/feature-libraries/chunked-forest/codec/format.js.map +1 -1
  367. package/lib/feature-libraries/chunked-forest/codec/index.d.ts +2 -2
  368. package/lib/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
  369. package/lib/feature-libraries/chunked-forest/codec/index.js +2 -2
  370. package/lib/feature-libraries/chunked-forest/codec/index.js.map +1 -1
  371. package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.d.ts.map +1 -1
  372. package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.js +2 -2
  373. package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.js.map +1 -1
  374. package/lib/feature-libraries/chunked-forest/index.d.ts +1 -1
  375. package/lib/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  376. package/lib/feature-libraries/chunked-forest/index.js +1 -1
  377. package/lib/feature-libraries/chunked-forest/index.js.map +1 -1
  378. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts +1 -9
  379. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  380. package/lib/feature-libraries/default-schema/defaultFieldKinds.js +2 -20
  381. package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  382. package/lib/feature-libraries/forest-summary/codec.d.ts +4 -5
  383. package/lib/feature-libraries/forest-summary/codec.d.ts.map +1 -1
  384. package/lib/feature-libraries/forest-summary/codec.js +16 -5
  385. package/lib/feature-libraries/forest-summary/codec.js.map +1 -1
  386. package/lib/feature-libraries/forest-summary/forestSummarizer.js +1 -1
  387. package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  388. package/lib/feature-libraries/forest-summary/format.d.ts +8 -1
  389. package/lib/feature-libraries/forest-summary/format.d.ts.map +1 -1
  390. package/lib/feature-libraries/forest-summary/format.js +7 -2
  391. package/lib/feature-libraries/forest-summary/format.js.map +1 -1
  392. package/lib/feature-libraries/forest-summary/index.d.ts +2 -1
  393. package/lib/feature-libraries/forest-summary/index.d.ts.map +1 -1
  394. package/lib/feature-libraries/forest-summary/index.js +1 -0
  395. package/lib/feature-libraries/forest-summary/index.js.map +1 -1
  396. package/lib/feature-libraries/index.d.ts +3 -3
  397. package/lib/feature-libraries/index.d.ts.map +1 -1
  398. package/lib/feature-libraries/index.js +2 -2
  399. package/lib/feature-libraries/index.js.map +1 -1
  400. package/lib/feature-libraries/schema-edits/index.d.ts +1 -1
  401. package/lib/feature-libraries/schema-edits/index.d.ts.map +1 -1
  402. package/lib/feature-libraries/schema-edits/index.js.map +1 -1
  403. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.d.ts +6 -7
  404. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
  405. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js +6 -5
  406. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
  407. package/lib/feature-libraries/schema-index/codec.d.ts +10 -10
  408. package/lib/feature-libraries/schema-index/codec.d.ts.map +1 -1
  409. package/lib/feature-libraries/schema-index/codec.js +24 -20
  410. package/lib/feature-libraries/schema-index/codec.js.map +1 -1
  411. package/lib/feature-libraries/schema-index/formatV1.d.ts +2 -2
  412. package/lib/feature-libraries/schema-index/formatV1.d.ts.map +1 -1
  413. package/lib/feature-libraries/schema-index/formatV1.js +2 -2
  414. package/lib/feature-libraries/schema-index/formatV1.js.map +1 -1
  415. package/lib/feature-libraries/schema-index/formatV2.d.ts +1 -2
  416. package/lib/feature-libraries/schema-index/formatV2.d.ts.map +1 -1
  417. package/lib/feature-libraries/schema-index/formatV2.js +2 -2
  418. package/lib/feature-libraries/schema-index/formatV2.js.map +1 -1
  419. package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts +2 -2
  420. package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
  421. package/lib/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
  422. package/lib/index.d.ts +2 -2
  423. package/lib/index.d.ts.map +1 -1
  424. package/lib/index.js +2 -2
  425. package/lib/index.js.map +1 -1
  426. package/lib/legacy.d.ts +8 -0
  427. package/lib/packageVersion.d.ts +1 -1
  428. package/lib/packageVersion.js +1 -1
  429. package/lib/packageVersion.js.map +1 -1
  430. package/lib/shared-tree/independentView.d.ts +75 -6
  431. package/lib/shared-tree/independentView.d.ts.map +1 -1
  432. package/lib/shared-tree/independentView.js +111 -39
  433. package/lib/shared-tree/independentView.js.map +1 -1
  434. package/lib/shared-tree/index.d.ts +2 -1
  435. package/lib/shared-tree/index.d.ts.map +1 -1
  436. package/lib/shared-tree/index.js +2 -1
  437. package/lib/shared-tree/index.js.map +1 -1
  438. package/lib/shared-tree/sharedTree.d.ts +12 -16
  439. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  440. package/lib/shared-tree/sharedTree.js +108 -133
  441. package/lib/shared-tree/sharedTree.js.map +1 -1
  442. package/lib/shared-tree/sharedTreeChangeCodecs.d.ts +7 -6
  443. package/lib/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  444. package/lib/shared-tree/sharedTreeChangeCodecs.js +7 -6
  445. package/lib/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  446. package/lib/shared-tree/sharedTreeChangeFamily.d.ts +2 -2
  447. package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  448. package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  449. package/lib/shared-tree/treeAlpha.d.ts +1 -1
  450. package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
  451. package/lib/shared-tree/treeAlpha.js +5 -3
  452. package/lib/shared-tree/treeAlpha.js.map +1 -1
  453. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  454. package/lib/shared-tree/treeCheckout.js +1 -3
  455. package/lib/shared-tree/treeCheckout.js.map +1 -1
  456. package/lib/shared-tree-core/editManagerCodecs.d.ts +19 -6
  457. package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  458. package/lib/shared-tree-core/editManagerCodecs.js +32 -16
  459. package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
  460. package/lib/shared-tree-core/editManagerFormatCommons.d.ts +37 -0
  461. package/lib/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
  462. package/lib/shared-tree-core/editManagerFormatCommons.js +42 -0
  463. package/lib/shared-tree-core/editManagerFormatCommons.js.map +1 -1
  464. package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts +2 -2
  465. package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -1
  466. package/lib/shared-tree-core/editManagerFormatV1toV4.js +5 -5
  467. package/lib/shared-tree-core/editManagerFormatV1toV4.js.map +1 -1
  468. package/lib/shared-tree-core/editManagerFormatV5.d.ts +2 -2
  469. package/lib/shared-tree-core/editManagerFormatV5.d.ts.map +1 -1
  470. package/lib/shared-tree-core/editManagerFormatV5.js +2 -2
  471. package/lib/shared-tree-core/editManagerFormatV5.js.map +1 -1
  472. package/lib/shared-tree-core/index.d.ts +5 -3
  473. package/lib/shared-tree-core/index.d.ts.map +1 -1
  474. package/lib/shared-tree-core/index.js +4 -2
  475. package/lib/shared-tree-core/index.js.map +1 -1
  476. package/lib/shared-tree-core/messageCodecV1ToV4.d.ts +2 -1
  477. package/lib/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
  478. package/lib/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
  479. package/lib/shared-tree-core/messageCodecV5.d.ts +2 -1
  480. package/lib/shared-tree-core/messageCodecV5.d.ts.map +1 -1
  481. package/lib/shared-tree-core/messageCodecV5.js.map +1 -1
  482. package/lib/shared-tree-core/messageCodecs.d.ts +19 -6
  483. package/lib/shared-tree-core/messageCodecs.d.ts.map +1 -1
  484. package/lib/shared-tree-core/messageCodecs.js +35 -20
  485. package/lib/shared-tree-core/messageCodecs.js.map +1 -1
  486. package/lib/shared-tree-core/messageFormat.d.ts +50 -0
  487. package/lib/shared-tree-core/messageFormat.d.ts.map +1 -0
  488. package/lib/shared-tree-core/messageFormat.js +48 -0
  489. package/lib/shared-tree-core/messageFormat.js.map +1 -0
  490. package/lib/shared-tree-core/sharedTreeCore.d.ts +8 -8
  491. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  492. package/lib/shared-tree-core/sharedTreeCore.js +3 -3
  493. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  494. package/lib/simple-tree/api/discrepancies.d.ts +2 -2
  495. package/lib/simple-tree/api/discrepancies.js.map +1 -1
  496. package/lib/simple-tree/api/incrementalAllowedTypes.d.ts +1 -1
  497. package/lib/simple-tree/api/incrementalAllowedTypes.js +1 -1
  498. package/lib/simple-tree/api/incrementalAllowedTypes.js.map +1 -1
  499. package/lib/simple-tree/api/index.d.ts +3 -2
  500. package/lib/simple-tree/api/index.d.ts.map +1 -1
  501. package/lib/simple-tree/api/index.js +1 -0
  502. package/lib/simple-tree/api/index.js.map +1 -1
  503. package/lib/simple-tree/api/schemaFactory.d.ts +2 -2
  504. package/lib/simple-tree/api/schemaFactory.js +2 -2
  505. package/lib/simple-tree/api/schemaFactory.js.map +1 -1
  506. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +2 -98
  507. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  508. package/lib/simple-tree/api/schemaFactoryAlpha.js +1 -52
  509. package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  510. package/lib/simple-tree/api/schemaFactoryBeta.d.ts +98 -2
  511. package/lib/simple-tree/api/schemaFactoryBeta.d.ts.map +1 -1
  512. package/lib/simple-tree/api/schemaFactoryBeta.js +58 -4
  513. package/lib/simple-tree/api/schemaFactoryBeta.js.map +1 -1
  514. package/lib/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
  515. package/lib/simple-tree/api/schemaFactoryRecursive.js +1 -0
  516. package/lib/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
  517. package/lib/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
  518. package/lib/simple-tree/api/schemaFromSimple.js +15 -8
  519. package/lib/simple-tree/api/schemaFromSimple.js.map +1 -1
  520. package/lib/simple-tree/api/simpleSchemaCodec.d.ts +28 -0
  521. package/lib/simple-tree/api/simpleSchemaCodec.d.ts.map +1 -0
  522. package/lib/simple-tree/api/simpleSchemaCodec.js +264 -0
  523. package/lib/simple-tree/api/simpleSchemaCodec.js.map +1 -0
  524. package/lib/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -1
  525. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js +4 -2
  526. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  527. package/lib/simple-tree/api/storedSchema.d.ts +2 -2
  528. package/lib/simple-tree/api/storedSchema.d.ts.map +1 -1
  529. package/lib/simple-tree/api/storedSchema.js +5 -3
  530. package/lib/simple-tree/api/storedSchema.js.map +1 -1
  531. package/lib/simple-tree/api/tree.d.ts +2 -2
  532. package/lib/simple-tree/api/tree.js.map +1 -1
  533. package/lib/simple-tree/api/typesUnsafe.d.ts +6 -6
  534. package/lib/simple-tree/api/typesUnsafe.js.map +1 -1
  535. package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts +17 -1
  536. package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
  537. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js +69 -7
  538. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
  539. package/lib/simple-tree/core/allowedTypes.d.ts +12 -7
  540. package/lib/simple-tree/core/allowedTypes.d.ts.map +1 -1
  541. package/lib/simple-tree/core/allowedTypes.js +19 -6
  542. package/lib/simple-tree/core/allowedTypes.js.map +1 -1
  543. package/lib/simple-tree/core/treeNode.js +1 -1
  544. package/lib/simple-tree/core/treeNode.js.map +1 -1
  545. package/lib/simple-tree/fieldSchema.d.ts +2 -1
  546. package/lib/simple-tree/fieldSchema.d.ts.map +1 -1
  547. package/lib/simple-tree/fieldSchema.js +10 -0
  548. package/lib/simple-tree/fieldSchema.js.map +1 -1
  549. package/lib/simple-tree/index.d.ts +3 -2
  550. package/lib/simple-tree/index.d.ts.map +1 -1
  551. package/lib/simple-tree/index.js +1 -0
  552. package/lib/simple-tree/index.js.map +1 -1
  553. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  554. package/lib/simple-tree/node-kinds/array/arrayNode.js +9 -3
  555. package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  556. package/lib/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
  557. package/lib/simple-tree/node-kinds/map/mapNode.js +9 -3
  558. package/lib/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  559. package/lib/simple-tree/node-kinds/object/objectNode.d.ts +17 -0
  560. package/lib/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  561. package/lib/simple-tree/node-kinds/object/objectNode.js +22 -9
  562. package/lib/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  563. package/lib/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
  564. package/lib/simple-tree/node-kinds/record/recordNode.js +10 -4
  565. package/lib/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  566. package/lib/simple-tree/node-kinds/record/recordNodeTypes.d.ts +16 -0
  567. package/lib/simple-tree/node-kinds/record/recordNodeTypes.d.ts.map +1 -1
  568. package/lib/simple-tree/node-kinds/record/recordNodeTypes.js.map +1 -1
  569. package/lib/simple-tree/simpleSchema.d.ts +30 -6
  570. package/lib/simple-tree/simpleSchema.d.ts.map +1 -1
  571. package/lib/simple-tree/simpleSchema.js.map +1 -1
  572. package/lib/simple-tree/simpleSchemaFormatV1.d.ts +249 -0
  573. package/lib/simple-tree/simpleSchemaFormatV1.d.ts.map +1 -0
  574. package/lib/simple-tree/simpleSchemaFormatV1.js +112 -0
  575. package/lib/simple-tree/simpleSchemaFormatV1.js.map +1 -0
  576. package/lib/simple-tree/toStoredSchema.d.ts.map +1 -1
  577. package/lib/simple-tree/toStoredSchema.js +6 -3
  578. package/lib/simple-tree/toStoredSchema.js.map +1 -1
  579. package/lib/tableSchema.d.ts.map +1 -1
  580. package/lib/tableSchema.js +1 -1
  581. package/lib/tableSchema.js.map +1 -1
  582. package/lib/treeFactory.d.ts +3 -1
  583. package/lib/treeFactory.d.ts.map +1 -1
  584. package/lib/treeFactory.js +23 -1
  585. package/lib/treeFactory.js.map +1 -1
  586. package/lib/util/brand.d.ts +31 -2
  587. package/lib/util/brand.d.ts.map +1 -1
  588. package/lib/util/brand.js +26 -1
  589. package/lib/util/brand.js.map +1 -1
  590. package/lib/util/brandedMap.d.ts +3 -1
  591. package/lib/util/brandedMap.d.ts.map +1 -1
  592. package/lib/util/brandedMap.js.map +1 -1
  593. package/lib/util/index.d.ts +1 -1
  594. package/lib/util/index.d.ts.map +1 -1
  595. package/lib/util/index.js +1 -1
  596. package/lib/util/index.js.map +1 -1
  597. package/lib/util/referenceCounting.d.ts.map +1 -1
  598. package/lib/util/referenceCounting.js +1 -0
  599. package/lib/util/referenceCounting.js.map +1 -1
  600. package/package.json +26 -26
  601. package/src/api.ts +2 -2
  602. package/src/codec/codec.ts +17 -3
  603. package/src/codec/discriminatedUnions.ts +1 -1
  604. package/src/core/index.ts +1 -2
  605. package/src/core/schema-stored/index.ts +1 -2
  606. package/src/core/schema-stored/schema.ts +10 -7
  607. package/src/core/tree/detachedFieldIndexCodecCommon.ts +2 -1
  608. package/src/core/tree/detachedFieldIndexCodecV1.ts +4 -2
  609. package/src/core/tree/detachedFieldIndexCodecV2.ts +4 -6
  610. package/src/core/tree/detachedFieldIndexCodecs.ts +33 -11
  611. package/src/core/tree/detachedFieldIndexFormatCommon.ts +17 -2
  612. package/src/core/tree/detachedFieldIndexFormatV1.ts +6 -4
  613. package/src/core/tree/detachedFieldIndexFormatV2.ts +6 -4
  614. package/src/core/tree/index.ts +2 -4
  615. package/src/external-utilities/typeboxValidator.ts +1 -1
  616. package/src/feature-libraries/chunked-forest/codec/codecs.ts +18 -13
  617. package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +2 -2
  618. package/src/feature-libraries/chunked-forest/codec/format.ts +15 -4
  619. package/src/feature-libraries/chunked-forest/codec/index.ts +4 -2
  620. package/src/feature-libraries/chunked-forest/codec/uncompressedEncode.ts +2 -2
  621. package/src/feature-libraries/chunked-forest/index.ts +0 -1
  622. package/src/feature-libraries/default-schema/defaultFieldKinds.ts +2 -29
  623. package/src/feature-libraries/forest-summary/codec.ts +24 -9
  624. package/src/feature-libraries/forest-summary/forestSummarizer.ts +1 -1
  625. package/src/feature-libraries/forest-summary/format.ts +12 -2
  626. package/src/feature-libraries/forest-summary/index.ts +2 -1
  627. package/src/feature-libraries/index.ts +1 -2
  628. package/src/feature-libraries/schema-edits/index.ts +0 -1
  629. package/src/feature-libraries/schema-edits/schemaChangeCodecs.ts +16 -16
  630. package/src/feature-libraries/schema-index/codec.ts +34 -22
  631. package/src/feature-libraries/schema-index/formatV1.ts +2 -2
  632. package/src/feature-libraries/schema-index/formatV2.ts +2 -2
  633. package/src/feature-libraries/schema-index/schemaSummarizer.ts +2 -1
  634. package/src/index.ts +6 -1
  635. package/src/packageVersion.ts +1 -1
  636. package/src/shared-tree/independentView.ts +161 -75
  637. package/src/shared-tree/index.ts +4 -0
  638. package/src/shared-tree/sharedTree.ts +137 -175
  639. package/src/shared-tree/sharedTreeChangeCodecs.ts +15 -9
  640. package/src/shared-tree/sharedTreeChangeFamily.ts +2 -2
  641. package/src/shared-tree/treeAlpha.ts +6 -5
  642. package/src/shared-tree/treeCheckout.ts +1 -3
  643. package/src/shared-tree-core/editManagerCodecs.ts +56 -19
  644. package/src/shared-tree-core/editManagerFormatCommons.ts +47 -0
  645. package/src/shared-tree-core/editManagerFormatV1toV4.ts +10 -5
  646. package/src/shared-tree-core/editManagerFormatV5.ts +3 -3
  647. package/src/shared-tree-core/index.ts +11 -5
  648. package/src/shared-tree-core/messageCodecV1ToV4.ts +6 -1
  649. package/src/shared-tree-core/messageCodecV5.ts +2 -1
  650. package/src/shared-tree-core/messageCodecs.ts +60 -26
  651. package/src/shared-tree-core/messageFormat.ts +56 -0
  652. package/src/shared-tree-core/sharedTreeCore.ts +11 -13
  653. package/src/simple-tree/api/discrepancies.ts +2 -2
  654. package/src/simple-tree/api/incrementalAllowedTypes.ts +1 -1
  655. package/src/simple-tree/api/index.ts +6 -2
  656. package/src/simple-tree/api/schemaFactory.ts +2 -2
  657. package/src/simple-tree/api/schemaFactoryAlpha.ts +2 -168
  658. package/src/simple-tree/api/schemaFactoryBeta.ts +180 -14
  659. package/src/simple-tree/api/schemaFactoryRecursive.ts +2 -0
  660. package/src/simple-tree/api/schemaFromSimple.ts +23 -17
  661. package/src/simple-tree/api/simpleSchemaCodec.ts +360 -0
  662. package/src/simple-tree/api/simpleSchemaToJsonSchema.ts +8 -2
  663. package/src/simple-tree/api/storedSchema.ts +8 -5
  664. package/src/simple-tree/api/tree.ts +2 -2
  665. package/src/simple-tree/api/typesUnsafe.ts +6 -6
  666. package/src/simple-tree/api/viewSchemaToSimpleSchema.ts +76 -7
  667. package/src/simple-tree/core/allowedTypes.ts +29 -16
  668. package/src/simple-tree/core/treeNode.ts +2 -2
  669. package/src/simple-tree/fieldSchema.ts +14 -1
  670. package/src/simple-tree/index.ts +6 -1
  671. package/src/simple-tree/node-kinds/array/arrayNode.ts +11 -2
  672. package/src/simple-tree/node-kinds/map/mapNode.ts +11 -2
  673. package/src/simple-tree/node-kinds/object/objectNode.ts +57 -21
  674. package/src/simple-tree/node-kinds/record/recordNode.ts +12 -3
  675. package/src/simple-tree/node-kinds/record/recordNodeTypes.ts +16 -0
  676. package/src/simple-tree/simpleSchema.ts +32 -6
  677. package/src/simple-tree/simpleSchemaFormatV1.ts +179 -0
  678. package/src/simple-tree/toStoredSchema.ts +12 -3
  679. package/src/tableSchema.ts +5 -2
  680. package/src/treeFactory.ts +33 -1
  681. package/src/util/brand.ts +40 -2
  682. package/src/util/brandedMap.ts +3 -1
  683. package/src/util/index.ts +1 -0
  684. package/src/util/referenceCounting.ts +1 -0
@@ -1 +1 @@
1
- {"version":3,"file":"detachedFieldIndexCodecV1.js","sourceRoot":"","sources":["../../../src/core/tree/detachedFieldIndexCodecV1.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAI7D,OAAO,EAIN,iBAAiB,GACjB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAiB,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAE1E,OAAO,EAAE,yCAAyC,EAAE,MAAM,oCAAoC,CAAC;AAE/F,MAAM,UAAU;IACf,YACkB,gBAAkC,EAClC,OAAsB,EACtB,YAA2B;QAF3B,qBAAgB,GAAhB,gBAAgB,CAAkB;QAClC,YAAO,GAAP,OAAO,CAAe;QACtB,iBAAY,GAAZ,YAAY,CAAe;IAC1C,CAAC;IAEG,MAAM,CAAC,KAAY;QACzB,MAAM,CAAC,KAAK,KAAK,SAAS,EAAE,KAAK,CAAC,mCAAmC,CAAC,CAAC;QACvE,MAAM,EAAE,GAAG,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC/C;;;;;;;;;;;;;;;;WAgBG;QACH,MAAM,CACL,EAAE,KAAK,MAAM,IAAI,EAAE,IAAI,CAAC,EACxB,KAAK,CAAC,kEAAkE,CACxE,CAAC;QACF,OAAO,EAAE,CAAC;IACX,CAAC;IAEM,MAAM,CAAC,KAAyB;QACtC,MAAM,CACL,KAAK,KAAK,MAAM,IAAI,KAAK,IAAI,CAAC,EAC9B,KAAK,CAAC,kEAAkE,CACxE,CAAC;QACF,OAAO,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,KAAK,EAAE;YAC1C,YAAY,EAAE,IAAI,CAAC,gBAAgB,CAAC,cAAc;YAClD,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,QAAQ,EAAE,SAAS;SACnB,CAAC,CAAC;IACJ,CAAC;CACD;AAED,MAAM,UAAU,8BAA8B,CAC7C,gBAAkC,EAClC,OAAsB,EACtB,YAA2B;IAE3B,MAAM,UAAU,GAAG,IAAI,UAAU,CAAC,gBAAgB,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC;IAC3E,OAAO,yCAAyC,CAC/C,OAAO,EACP,UAAU,EACV,QAAQ,EACR,iBAAiB,CACjB,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { IIdCompressor } from \"@fluidframework/id-compressor\";\n\nimport type { ICodecOptions, IJsonCodec } from \"../../codec/index.js\";\nimport {\n\ttype EncodedRevisionTag,\n\ttype RevisionTagCodec,\n\ttype RevisionTag,\n\tRevisionTagSchema,\n} from \"../rebase/index.js\";\n\nimport { type FormatV1, version1 } from \"./detachedFieldIndexFormatV1.js\";\nimport type { DetachedFieldSummaryData, Major } from \"./detachedFieldIndexTypes.js\";\nimport { makeDetachedFieldIndexCodecFromMajorCodec } from \"./detachedFieldIndexCodecCommon.js\";\n\nclass MajorCodec implements IJsonCodec<Major, EncodedRevisionTag> {\n\tpublic constructor(\n\t\tprivate readonly revisionTagCodec: RevisionTagCodec,\n\t\tprivate readonly options: ICodecOptions,\n\t\tprivate readonly idCompressor: IIdCompressor,\n\t) {}\n\n\tpublic encode(major: Major): EncodedRevisionTag {\n\t\tassert(major !== undefined, 0x88e /* Unexpected undefined revision */);\n\t\tconst id = this.revisionTagCodec.encode(major);\n\t\t/**\n\t\t * Preface: this codec is only used at summarization time (not for ops).\n\t\t * Note that the decode path must provide a session id in which to interpret the revision tag.\n\t\t * The revision associated with a detached root generally comes from the session which detaches that subtree,\n\t\t * which isn't generally the local session (nor is it available at decode time with the layering of the tree\n\t\t * package), despite decode using the local session id.\n\t\t *\n\t\t * This is made OK by enforcing that all ids on encode/decode are non-local, since local ids won't be interpretable\n\t\t * at decode time.\n\t\t * This assert is valid because the revision for an acked edit will have already been finalized, and a revision\n\t\t * for a local-only edit will be finalizable at summarization time (local edits can only occur on a summarizing client\n\t\t * if they're created while detached, and local ids made while detached are finalized before generating the attach summary).\n\t\t *\n\t\t * WARNING: the above is true when the whole container transitions from detached to attached,\n\t\t * but not when the container is already attached and it's just the shared-tree that is attaching.\n\t\t * The assert below will fail in such a scenario. This is addressed in the v2 codec.\n\t\t */\n\t\tassert(\n\t\t\tid === \"root\" || id >= 0,\n\t\t\t0x88f /* Expected final id on encode of detached field index revision */,\n\t\t);\n\t\treturn id;\n\t}\n\n\tpublic decode(major: EncodedRevisionTag): RevisionTag {\n\t\tassert(\n\t\t\tmajor === \"root\" || major >= 0,\n\t\t\t0x890 /* Expected final id on decode of detached field index revision */,\n\t\t);\n\t\treturn this.revisionTagCodec.decode(major, {\n\t\t\toriginatorId: this.revisionTagCodec.localSessionId,\n\t\t\tidCompressor: this.idCompressor,\n\t\t\trevision: undefined,\n\t\t});\n\t}\n}\n\nexport function makeDetachedNodeToFieldCodecV1(\n\trevisionTagCodec: RevisionTagCodec,\n\toptions: ICodecOptions,\n\tidCompressor: IIdCompressor,\n): IJsonCodec<DetachedFieldSummaryData, FormatV1> {\n\tconst majorCodec = new MajorCodec(revisionTagCodec, options, idCompressor);\n\treturn makeDetachedFieldIndexCodecFromMajorCodec(\n\t\toptions,\n\t\tmajorCodec,\n\t\tversion1,\n\t\tRevisionTagSchema,\n\t);\n}\n"]}
1
+ {"version":3,"file":"detachedFieldIndexCodecV1.js","sourceRoot":"","sources":["../../../src/core/tree/detachedFieldIndexCodecV1.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAI7D,OAAO,EAIN,iBAAiB,GACjB,MAAM,oBAAoB,CAAC;AAI5B,OAAO,EAAE,yCAAyC,EAAE,MAAM,oCAAoC,CAAC;AAC/F,OAAO,EAAE,+BAA+B,EAAE,MAAM,qCAAqC,CAAC;AACtF,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,MAAM,UAAU;IACf,YACkB,gBAAkC,EAClC,OAAsB,EACtB,YAA2B;QAF3B,qBAAgB,GAAhB,gBAAgB,CAAkB;QAClC,YAAO,GAAP,OAAO,CAAe;QACtB,iBAAY,GAAZ,YAAY,CAAe;IAC1C,CAAC;IAEG,MAAM,CAAC,KAAY;QACzB,MAAM,CAAC,KAAK,KAAK,SAAS,EAAE,KAAK,CAAC,mCAAmC,CAAC,CAAC;QACvE,MAAM,EAAE,GAAG,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC/C;;;;;;;;;;;;;;;;WAgBG;QACH,MAAM,CACL,EAAE,KAAK,MAAM,IAAI,EAAE,IAAI,CAAC,EACxB,KAAK,CAAC,kEAAkE,CACxE,CAAC;QACF,OAAO,EAAE,CAAC;IACX,CAAC;IAEM,MAAM,CAAC,KAAyB;QACtC,MAAM,CACL,KAAK,KAAK,MAAM,IAAI,KAAK,IAAI,CAAC,EAC9B,KAAK,CAAC,kEAAkE,CACxE,CAAC;QACF,OAAO,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,KAAK,EAAE;YAC1C,YAAY,EAAE,IAAI,CAAC,gBAAgB,CAAC,cAAc;YAClD,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,QAAQ,EAAE,SAAS;SACnB,CAAC,CAAC;IACJ,CAAC;CACD;AAED,MAAM,UAAU,8BAA8B,CAC7C,gBAAkC,EAClC,OAAsB,EACtB,YAA2B;IAE3B,MAAM,UAAU,GAAG,IAAI,UAAU,CAAC,gBAAgB,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC;IAC3E,OAAO,yCAAyC,CAC/C,OAAO,EACP,UAAU,EACV,KAAK,CAAC,+BAA+B,CAAC,EAAE,CAAC,EACzC,iBAAiB,CACjB,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { IIdCompressor } from \"@fluidframework/id-compressor\";\n\nimport type { ICodecOptions, IJsonCodec } from \"../../codec/index.js\";\nimport {\n\ttype EncodedRevisionTag,\n\ttype RevisionTagCodec,\n\ttype RevisionTag,\n\tRevisionTagSchema,\n} from \"../rebase/index.js\";\n\nimport type { FormatV1 } from \"./detachedFieldIndexFormatV1.js\";\nimport type { DetachedFieldSummaryData, Major } from \"./detachedFieldIndexTypes.js\";\nimport { makeDetachedFieldIndexCodecFromMajorCodec } from \"./detachedFieldIndexCodecCommon.js\";\nimport { DetachedFieldIndexFormatVersion } from \"./detachedFieldIndexFormatCommon.js\";\nimport { brand } from \"../../util/index.js\";\n\nclass MajorCodec implements IJsonCodec<Major, EncodedRevisionTag> {\n\tpublic constructor(\n\t\tprivate readonly revisionTagCodec: RevisionTagCodec,\n\t\tprivate readonly options: ICodecOptions,\n\t\tprivate readonly idCompressor: IIdCompressor,\n\t) {}\n\n\tpublic encode(major: Major): EncodedRevisionTag {\n\t\tassert(major !== undefined, 0x88e /* Unexpected undefined revision */);\n\t\tconst id = this.revisionTagCodec.encode(major);\n\t\t/**\n\t\t * Preface: this codec is only used at summarization time (not for ops).\n\t\t * Note that the decode path must provide a session id in which to interpret the revision tag.\n\t\t * The revision associated with a detached root generally comes from the session which detaches that subtree,\n\t\t * which isn't generally the local session (nor is it available at decode time with the layering of the tree\n\t\t * package), despite decode using the local session id.\n\t\t *\n\t\t * This is made OK by enforcing that all ids on encode/decode are non-local, since local ids won't be interpretable\n\t\t * at decode time.\n\t\t * This assert is valid because the revision for an acked edit will have already been finalized, and a revision\n\t\t * for a local-only edit will be finalizable at summarization time (local edits can only occur on a summarizing client\n\t\t * if they're created while detached, and local ids made while detached are finalized before generating the attach summary).\n\t\t *\n\t\t * WARNING: the above is true when the whole container transitions from detached to attached,\n\t\t * but not when the container is already attached and it's just the shared-tree that is attaching.\n\t\t * The assert below will fail in such a scenario. This is addressed in the v2 codec.\n\t\t */\n\t\tassert(\n\t\t\tid === \"root\" || id >= 0,\n\t\t\t0x88f /* Expected final id on encode of detached field index revision */,\n\t\t);\n\t\treturn id;\n\t}\n\n\tpublic decode(major: EncodedRevisionTag): RevisionTag {\n\t\tassert(\n\t\t\tmajor === \"root\" || major >= 0,\n\t\t\t0x890 /* Expected final id on decode of detached field index revision */,\n\t\t);\n\t\treturn this.revisionTagCodec.decode(major, {\n\t\t\toriginatorId: this.revisionTagCodec.localSessionId,\n\t\t\tidCompressor: this.idCompressor,\n\t\t\trevision: undefined,\n\t\t});\n\t}\n}\n\nexport function makeDetachedNodeToFieldCodecV1(\n\trevisionTagCodec: RevisionTagCodec,\n\toptions: ICodecOptions,\n\tidCompressor: IIdCompressor,\n): IJsonCodec<DetachedFieldSummaryData, FormatV1> {\n\tconst majorCodec = new MajorCodec(revisionTagCodec, options, idCompressor);\n\treturn makeDetachedFieldIndexCodecFromMajorCodec(\n\t\toptions,\n\t\tmajorCodec,\n\t\tbrand(DetachedFieldIndexFormatVersion.v1),\n\t\tRevisionTagSchema,\n\t);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"detachedFieldIndexCodecV2.d.ts","sourceRoot":"","sources":["../../../src/core/tree/detachedFieldIndexCodecV2.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAY,MAAM,+BAA+B,CAAC;AAE7E,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,KAAK,EAAsB,gBAAgB,EAAe,MAAM,oBAAoB,CAAC;AAE5F,OAAO,EACN,KAAK,QAAQ,EAGb,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,wBAAwB,EAAS,MAAM,8BAA8B,CAAC;AA2CpF,wBAAgB,8BAA8B,CAC7C,gBAAgB,EAAE,gBAAgB,EAClC,OAAO,EAAE,aAAa,EACtB,YAAY,EAAE,aAAa,GACzB,UAAU,CAAC,wBAAwB,EAAE,QAAQ,CAAC,CAQhD"}
1
+ {"version":3,"file":"detachedFieldIndexCodecV2.d.ts","sourceRoot":"","sources":["../../../src/core/tree/detachedFieldIndexCodecV2.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAY,MAAM,+BAA+B,CAAC;AAE7E,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,KAAK,EAAsB,gBAAgB,EAAe,MAAM,oBAAoB,CAAC;AAE5F,OAAO,EAAE,KAAK,QAAQ,EAA4B,MAAM,iCAAiC,CAAC;AAC1F,OAAO,KAAK,EAAE,wBAAwB,EAAS,MAAM,8BAA8B,CAAC;AA6CpF,wBAAgB,8BAA8B,CAC7C,gBAAgB,EAAE,gBAAgB,EAClC,OAAO,EAAE,aAAa,EACtB,YAAY,EAAE,aAAa,GACzB,UAAU,CAAC,wBAAwB,EAAE,QAAQ,CAAC,CAQhD"}
@@ -3,9 +3,11 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { assert } from "@fluidframework/core-utils/internal";
6
- import { StableOrFinalRevisionTag, version2, } from "./detachedFieldIndexFormatV2.js";
6
+ import { StableOrFinalRevisionTag } from "./detachedFieldIndexFormatV2.js";
7
7
  import { makeDetachedFieldIndexCodecFromMajorCodec } from "./detachedFieldIndexCodecCommon.js";
8
8
  import { isStableId } from "@fluidframework/id-compressor/internal";
9
+ import { DetachedFieldIndexFormatVersion } from "./detachedFieldIndexFormatCommon.js";
10
+ import { brand } from "../../util/index.js";
9
11
  class MajorCodec {
10
12
  constructor(revisionTagCodec, options, idCompressor) {
11
13
  this.revisionTagCodec = revisionTagCodec;
@@ -40,6 +42,6 @@ class MajorCodec {
40
42
  }
41
43
  export function makeDetachedNodeToFieldCodecV2(revisionTagCodec, options, idCompressor) {
42
44
  const majorCodec = new MajorCodec(revisionTagCodec, options, idCompressor);
43
- return makeDetachedFieldIndexCodecFromMajorCodec(options, majorCodec, version2, StableOrFinalRevisionTag);
45
+ return makeDetachedFieldIndexCodecFromMajorCodec(options, majorCodec, brand(DetachedFieldIndexFormatVersion.v2), StableOrFinalRevisionTag);
44
46
  }
45
47
  //# sourceMappingURL=detachedFieldIndexCodecV2.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"detachedFieldIndexCodecV2.js","sourceRoot":"","sources":["../../../src/core/tree/detachedFieldIndexCodecV2.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAM7D,OAAO,EAEN,wBAAwB,EACxB,QAAQ,GACR,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAE,yCAAyC,EA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C,YAAY;YAC/B,QAAQ,EAAE,SAAS;SACnB,CAAC,CAAC;IACJ,CAAC;CACD;AAED,MAAM,UAAU,8BAA8B,CAC7C,gBAAkC,EAClC,OAAsB,EACtB,YAA2B;IAE3B,MAAM,UAAU,GAAG,IAAI,UAAU,CAAC,gBAAgB,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC;IAC3E,OAAO,yCAAyC,CAC/C,OAAO,EACP,UAAU,EACV,QAAQ,EACR,wBAAwB,CACxB,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { IIdCompressor, StableId } from \"@fluidframework/id-compressor\";\n\nimport type { ICodecOptions, IJsonCodec } from \"../../codec/index.js\";\nimport type { EncodedRevisionTag, RevisionTagCodec, RevisionTag } from \"../rebase/index.js\";\n\nimport {\n\ttype FormatV2,\n\tStableOrFinalRevisionTag,\n\tversion2,\n} from \"./detachedFieldIndexFormatV2.js\";\nimport type { DetachedFieldSummaryData, Major } from \"./detachedFieldIndexTypes.js\";\nimport { makeDetachedFieldIndexCodecFromMajorCodec } from \"./detachedFieldIndexCodecCommon.js\";\nimport { isStableId } from \"@fluidframework/id-compressor/internal\";\n\nclass MajorCodec implements IJsonCodec<Major> {\n\tpublic constructor(\n\t\tprivate readonly revisionTagCodec: RevisionTagCodec,\n\t\tprivate readonly options: ICodecOptions,\n\t\tprivate readonly idCompressor: IIdCompressor,\n\t) {}\n\n\tpublic encode(major: Major): EncodedRevisionTag | StableId {\n\t\tassert(major !== undefined, 0xbfb /* Unexpected undefined revision */);\n\t\tconst id = this.revisionTagCodec.encode(major);\n\n\t\tif (id !== \"root\" && id < 0) {\n\t\t\t/**\n\t\t\t * This code path handles the case where the major revision is not finalized.\n\t\t\t * This can happen the SharedTree is being attached to an already attached container.\n\t\t\t */\n\t\t\tassert(major !== \"root\", 0xbfc /* Major revision cannot be 'root' */);\n\t\t\tconst long = this.idCompressor.decompress(major);\n\t\t\treturn long;\n\t\t}\n\t\treturn id;\n\t}\n\n\tpublic decode(major: EncodedRevisionTag | StableId): RevisionTag {\n\t\tassert(\n\t\t\tmajor === \"root\" || (typeof major === \"string\" && isStableId(major)) || major >= 0,\n\t\t\t0xbfd /* Expected root, stable, or final compressed id */,\n\t\t);\n\t\tif (typeof major === \"string\" && isStableId(major)) {\n\t\t\treturn this.idCompressor.recompress(major);\n\t\t}\n\t\treturn this.revisionTagCodec.decode(major, {\n\t\t\toriginatorId: this.revisionTagCodec.localSessionId,\n\t\t\tidCompressor: this.idCompressor,\n\t\t\trevision: undefined,\n\t\t});\n\t}\n}\n\nexport function makeDetachedNodeToFieldCodecV2(\n\trevisionTagCodec: RevisionTagCodec,\n\toptions: ICodecOptions,\n\tidCompressor: IIdCompressor,\n): IJsonCodec<DetachedFieldSummaryData, FormatV2> {\n\tconst majorCodec = new MajorCodec(revisionTagCodec, options, idCompressor);\n\treturn makeDetachedFieldIndexCodecFromMajorCodec(\n\t\toptions,\n\t\tmajorCodec,\n\t\tversion2,\n\t\tStableOrFinalRevisionTag,\n\t);\n}\n"]}
1
+ {"version":3,"file":"detachedFieldIndexCodecV2.js","sourceRoot":"","sources":["../../../src/core/tree/detachedFieldIndexCodecV2.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAM7D,OAAO,EAAiB,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAE1F,OAAO,EAAE,yCAAyC,EAAE,MAAM,oCAAoC,CAAC;AAC/F,OAAO,EAAE,UAAU,EAAE,MAAM,wCAAwC,CAAC;AACpE,OAAO,EAAE,+BAA+B,EAAE,MAAM,qCAAqC,CAAC;AACtF,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,MAAM,UAAU;IACf,YACkB,gBAAkC,EAClC,OAAsB,EACtB,YAA2B;QAF3B,qBAA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AU,GAAG,IAAI,UAAU,CAAC,gBAAgB,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC;IAC3E,OAAO,yCAAyC,CAC/C,OAAO,EACP,UAAU,EACV,KAAK,CAAC,+BAA+B,CAAC,EAAE,CAAC,EACzC,wBAAwB,CACxB,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { IIdCompressor, StableId } from \"@fluidframework/id-compressor\";\n\nimport type { ICodecOptions, IJsonCodec } from \"../../codec/index.js\";\nimport type { EncodedRevisionTag, RevisionTagCodec, RevisionTag } from \"../rebase/index.js\";\n\nimport { type FormatV2, StableOrFinalRevisionTag } from \"./detachedFieldIndexFormatV2.js\";\nimport type { DetachedFieldSummaryData, Major } from \"./detachedFieldIndexTypes.js\";\nimport { makeDetachedFieldIndexCodecFromMajorCodec } from \"./detachedFieldIndexCodecCommon.js\";\nimport { isStableId } from \"@fluidframework/id-compressor/internal\";\nimport { DetachedFieldIndexFormatVersion } from \"./detachedFieldIndexFormatCommon.js\";\nimport { brand } from \"../../util/index.js\";\n\nclass MajorCodec implements IJsonCodec<Major> {\n\tpublic constructor(\n\t\tprivate readonly revisionTagCodec: RevisionTagCodec,\n\t\tprivate readonly options: ICodecOptions,\n\t\tprivate readonly idCompressor: IIdCompressor,\n\t) {}\n\n\tpublic encode(major: Major): EncodedRevisionTag | StableId {\n\t\tassert(major !== undefined, 0xbfb /* Unexpected undefined revision */);\n\t\tconst id = this.revisionTagCodec.encode(major);\n\n\t\tif (id !== \"root\" && id < 0) {\n\t\t\t/**\n\t\t\t * This code path handles the case where the major revision is not finalized.\n\t\t\t * This can happen the SharedTree is being attached to an already attached container.\n\t\t\t */\n\t\t\tassert(major !== \"root\", 0xbfc /* Major revision cannot be 'root' */);\n\t\t\tconst long = this.idCompressor.decompress(major);\n\t\t\treturn long;\n\t\t}\n\t\treturn id;\n\t}\n\n\tpublic decode(major: EncodedRevisionTag | StableId): RevisionTag {\n\t\tassert(\n\t\t\tmajor === \"root\" || (typeof major === \"string\" && isStableId(major)) || major >= 0,\n\t\t\t0xbfd /* Expected root, stable, or final compressed id */,\n\t\t);\n\t\tif (typeof major === \"string\" && isStableId(major)) {\n\t\t\treturn this.idCompressor.recompress(major);\n\t\t}\n\t\treturn this.revisionTagCodec.decode(major, {\n\t\t\toriginatorId: this.revisionTagCodec.localSessionId,\n\t\t\tidCompressor: this.idCompressor,\n\t\t\trevision: undefined,\n\t\t});\n\t}\n}\n\nexport function makeDetachedNodeToFieldCodecV2(\n\trevisionTagCodec: RevisionTagCodec,\n\toptions: ICodecOptions,\n\tidCompressor: IIdCompressor,\n): IJsonCodec<DetachedFieldSummaryData, FormatV2> {\n\tconst majorCodec = new MajorCodec(revisionTagCodec, options, idCompressor);\n\treturn makeDetachedFieldIndexCodecFromMajorCodec(\n\t\toptions,\n\t\tmajorCodec,\n\t\tbrand(DetachedFieldIndexFormatVersion.v2),\n\t\tStableOrFinalRevisionTag,\n\t);\n}\n"]}
@@ -3,12 +3,11 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import type { IIdCompressor } from "@fluidframework/id-compressor";
6
+ import type { MinimumVersionForCollab } from "@fluidframework/runtime-definitions/internal";
6
7
  import { type CodecTree, type CodecWriteOptions, type ICodecFamily, type IJsonCodec } from "../../codec/index.js";
7
8
  import type { RevisionTagCodec } from "../rebase/index.js";
8
9
  import type { DetachedFieldSummaryData } from "./detachedFieldIndexTypes.js";
9
- import type { Brand } from "../../util/index.js";
10
10
  export declare function makeDetachedFieldIndexCodec(revisionTagCodec: RevisionTagCodec, options: CodecWriteOptions, idCompressor: IIdCompressor): IJsonCodec<DetachedFieldSummaryData>;
11
11
  export declare function makeDetachedFieldIndexCodecFamily(revisionTagCodec: RevisionTagCodec, options: CodecWriteOptions, idCompressor: IIdCompressor): ICodecFamily<DetachedFieldSummaryData>;
12
- export type DetachedFieldIndexFormatVersion = Brand<1 | 2, "DetachedFieldIndexFormatVersion">;
13
- export declare function getCodecTreeForDetachedFieldIndexFormat(version: DetachedFieldIndexFormatVersion): CodecTree;
12
+ export declare function getCodecTreeForDetachedFieldIndexFormat(clientVersion: MinimumVersionForCollab): CodecTree;
14
13
  //# sourceMappingURL=detachedFieldIndexCodecs.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"detachedFieldIndexCodecs.d.ts","sourceRoot":"","sources":["../../../src/core/tree/detachedFieldIndexCodecs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAEnE,OAAO,EACN,KAAK,SAAS,EACd,KAAK,iBAAiB,EAEtB,KAAK,YAAY,EACjB,KAAK,UAAU,EAGf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAM3D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AAC7E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAEjD,wBAAgB,2BAA2B,CAC1C,gBAAgB,EAAE,gBAAgB,EAClC,OAAO,EAAE,iBAAiB,EAC1B,YAAY,EAAE,aAAa,GACzB,UAAU,CAAC,wBAAwB,CAAC,CAKtC;AAED,wBAAgB,iCAAiC,CAChD,gBAAgB,EAAE,gBAAgB,EAClC,OAAO,EAAE,iBAAiB,EAC1B,YAAY,EAAE,aAAa,GACzB,YAAY,CAAC,wBAAwB,CAAC,CAKxC;AAED,MAAM,MAAM,+BAA+B,GAAG,KAAK,CAAC,CAAC,GAAG,CAAC,EAAE,iCAAiC,CAAC,CAAC;AAC9F,wBAAgB,uCAAuC,CACtD,OAAO,EAAE,+BAA+B,GACtC,SAAS,CAEX"}
1
+ {"version":3,"file":"detachedFieldIndexCodecs.d.ts","sourceRoot":"","sources":["../../../src/core/tree/detachedFieldIndexCodecs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AAE5F,OAAO,EACN,KAAK,SAAS,EACd,KAAK,iBAAiB,EAEtB,KAAK,YAAY,EACjB,KAAK,UAAU,EAGf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAI3D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AAiB7E,wBAAgB,2BAA2B,CAC1C,gBAAgB,EAAE,gBAAgB,EAClC,OAAO,EAAE,iBAAiB,EAC1B,YAAY,EAAE,aAAa,GACzB,UAAU,CAAC,wBAAwB,CAAC,CAMtC;AAED,wBAAgB,iCAAiC,CAChD,gBAAgB,EAAE,gBAAgB,EAClC,OAAO,EAAE,iBAAiB,EAC1B,YAAY,EAAE,aAAa,GACzB,YAAY,CAAC,wBAAwB,CAAC,CAWxC;AAED,wBAAgB,uCAAuC,CACtD,aAAa,EAAE,uBAAuB,GACpC,SAAS,CAKX"}
@@ -3,22 +3,43 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { FluidClientVersion, makeCodecFamily, makeVersionDispatchingCodec, } from "../../codec/index.js";
6
- import { version1 } from "./detachedFieldIndexFormatV1.js";
7
- import { version2 } from "./detachedFieldIndexFormatV2.js";
8
6
  import { makeDetachedNodeToFieldCodecV1 } from "./detachedFieldIndexCodecV1.js";
9
7
  import { makeDetachedNodeToFieldCodecV2 } from "./detachedFieldIndexCodecV2.js";
8
+ import { DetachedFieldIndexFormatVersion } from "./detachedFieldIndexFormatCommon.js";
9
+ import { brand } from "../../util/index.js";
10
+ /**
11
+ * Convert a MinimumVersionForCollab to a version for detached field codecs.
12
+ * @param clientVersion - The MinimumVersionForCollab to convert.
13
+ * @returns The detached field codec version that corresponds to the provided MinimumVersionForCollab.
14
+ */
15
+ function clientVersionToDetachedFieldVersion(clientVersion) {
16
+ return clientVersion < FluidClientVersion.v2_52
17
+ ? brand(DetachedFieldIndexFormatVersion.v1)
18
+ : brand(DetachedFieldIndexFormatVersion.v2);
19
+ }
10
20
  export function makeDetachedFieldIndexCodec(revisionTagCodec, options, idCompressor) {
11
21
  const family = makeDetachedFieldIndexCodecFamily(revisionTagCodec, options, idCompressor);
12
- const writeVersion = options.minVersionForCollab < FluidClientVersion.v2_52 ? version1 : version2;
13
- return makeVersionDispatchingCodec(family, { ...options, writeVersion });
22
+ return makeVersionDispatchingCodec(family, {
23
+ ...options,
24
+ writeVersion: clientVersionToDetachedFieldVersion(options.minVersionForCollab),
25
+ });
14
26
  }
15
27
  export function makeDetachedFieldIndexCodecFamily(revisionTagCodec, options, idCompressor) {
16
28
  return makeCodecFamily([
17
- [version1, makeDetachedNodeToFieldCodecV1(revisionTagCodec, options, idCompressor)],
18
- [version2, makeDetachedNodeToFieldCodecV2(revisionTagCodec, options, idCompressor)],
29
+ [
30
+ DetachedFieldIndexFormatVersion.v1,
31
+ makeDetachedNodeToFieldCodecV1(revisionTagCodec, options, idCompressor),
32
+ ],
33
+ [
34
+ DetachedFieldIndexFormatVersion.v2,
35
+ makeDetachedNodeToFieldCodecV2(revisionTagCodec, options, idCompressor),
36
+ ],
19
37
  ]);
20
38
  }
21
- export function getCodecTreeForDetachedFieldIndexFormat(version) {
22
- return { name: "DetachedFieldIndex", version };
39
+ export function getCodecTreeForDetachedFieldIndexFormat(clientVersion) {
40
+ return {
41
+ name: "DetachedFieldIndex",
42
+ version: clientVersionToDetachedFieldVersion(clientVersion),
43
+ };
23
44
  }
24
45
  //# sourceMappingURL=detachedFieldIndexCodecs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"detachedFieldIndexCodecs.js","sourceRoot":"","sources":["../../../src/core/tree/detachedFieldIndexCodecs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAGN,kBAAkB,EAGlB,eAAe,EACf,2BAA2B,GAC3B,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAAE,8BAA8B,EAAE,MAAM,gCAAgC,CAAC;AAChF,OAAO,EAAE,8BAA8B,EAAE,MAAM,gCAAgC,CAAC;AAIhF,MAAM,UAAU,2BAA2B,CAC1C,gBAAkC,EAClC,OAA0B,EAC1B,YAA2B;IAE3B,MAAM,MAAM,GAAG,iCAAiC,CAAC,gBAAgB,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC;IAC1F,MAAM,YAAY,GACjB,OAAO,CAAC,mBAAmB,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC;IAC9E,OAAO,2BAA2B,CAAC,MAAM,EAAE,EAAE,GAAG,OAAO,EAAE,YAAY,EAAE,CAAC,CAAC;AAC1E,CAAC;AAED,MAAM,UAAU,iCAAiC,CAChD,gBAAkC,EAClC,OAA0B,EAC1B,YAA2B;IAE3B,OAAO,eAAe,CAAC;QACtB,CAAC,QAAQ,EAAE,8BAA8B,CAAC,gBAAgB,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC;QACnF,CAAC,QAAQ,EAAE,8BAA8B,CAAC,gBAAgB,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC;KACnF,CAAC,CAAC;AACJ,CAAC;AAGD,MAAM,UAAU,uCAAuC,CACtD,OAAwC;IAExC,OAAO,EAAE,IAAI,EAAE,oBAAoB,EAAE,OAAO,EAAE,CAAC;AAChD,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IIdCompressor } from \"@fluidframework/id-compressor\";\n\nimport {\n\ttype CodecTree,\n\ttype CodecWriteOptions,\n\tFluidClientVersion,\n\ttype ICodecFamily,\n\ttype IJsonCodec,\n\tmakeCodecFamily,\n\tmakeVersionDispatchingCodec,\n} from \"../../codec/index.js\";\nimport type { RevisionTagCodec } from \"../rebase/index.js\";\n\nimport { version1 } from \"./detachedFieldIndexFormatV1.js\";\nimport { version2 } from \"./detachedFieldIndexFormatV2.js\";\nimport { makeDetachedNodeToFieldCodecV1 } from \"./detachedFieldIndexCodecV1.js\";\nimport { makeDetachedNodeToFieldCodecV2 } from \"./detachedFieldIndexCodecV2.js\";\nimport type { DetachedFieldSummaryData } from \"./detachedFieldIndexTypes.js\";\nimport type { Brand } from \"../../util/index.js\";\n\nexport function makeDetachedFieldIndexCodec(\n\trevisionTagCodec: RevisionTagCodec,\n\toptions: CodecWriteOptions,\n\tidCompressor: IIdCompressor,\n): IJsonCodec<DetachedFieldSummaryData> {\n\tconst family = makeDetachedFieldIndexCodecFamily(revisionTagCodec, options, idCompressor);\n\tconst writeVersion =\n\t\toptions.minVersionForCollab < FluidClientVersion.v2_52 ? version1 : version2;\n\treturn makeVersionDispatchingCodec(family, { ...options, writeVersion });\n}\n\nexport function makeDetachedFieldIndexCodecFamily(\n\trevisionTagCodec: RevisionTagCodec,\n\toptions: CodecWriteOptions,\n\tidCompressor: IIdCompressor,\n): ICodecFamily<DetachedFieldSummaryData> {\n\treturn makeCodecFamily([\n\t\t[version1, makeDetachedNodeToFieldCodecV1(revisionTagCodec, options, idCompressor)],\n\t\t[version2, makeDetachedNodeToFieldCodecV2(revisionTagCodec, options, idCompressor)],\n\t]);\n}\n\nexport type DetachedFieldIndexFormatVersion = Brand<1 | 2, \"DetachedFieldIndexFormatVersion\">;\nexport function getCodecTreeForDetachedFieldIndexFormat(\n\tversion: DetachedFieldIndexFormatVersion,\n): CodecTree {\n\treturn { name: \"DetachedFieldIndex\", version };\n}\n"]}
1
+ {"version":3,"file":"detachedFieldIndexCodecs.js","sourceRoot":"","sources":["../../../src/core/tree/detachedFieldIndexCodecs.ts"],"names":[],"mappings":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C1B,OAAO,EAAE,mCAAmC,CAAC,aAAa,CAAC;KAC3D,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IIdCompressor } from \"@fluidframework/id-compressor\";\nimport type { MinimumVersionForCollab } from \"@fluidframework/runtime-definitions/internal\";\n\nimport {\n\ttype CodecTree,\n\ttype CodecWriteOptions,\n\tFluidClientVersion,\n\ttype ICodecFamily,\n\ttype IJsonCodec,\n\tmakeCodecFamily,\n\tmakeVersionDispatchingCodec,\n} from \"../../codec/index.js\";\nimport type { RevisionTagCodec } from \"../rebase/index.js\";\n\nimport { makeDetachedNodeToFieldCodecV1 } from \"./detachedFieldIndexCodecV1.js\";\nimport { makeDetachedNodeToFieldCodecV2 } from \"./detachedFieldIndexCodecV2.js\";\nimport type { DetachedFieldSummaryData } from \"./detachedFieldIndexTypes.js\";\nimport { DetachedFieldIndexFormatVersion } from \"./detachedFieldIndexFormatCommon.js\";\nimport { brand } from \"../../util/index.js\";\n\n/**\n * Convert a MinimumVersionForCollab to a version for detached field codecs.\n * @param clientVersion - The MinimumVersionForCollab to convert.\n * @returns The detached field codec version that corresponds to the provided MinimumVersionForCollab.\n */\nfunction clientVersionToDetachedFieldVersion(\n\tclientVersion: MinimumVersionForCollab,\n): DetachedFieldIndexFormatVersion {\n\treturn clientVersion < FluidClientVersion.v2_52\n\t\t? brand(DetachedFieldIndexFormatVersion.v1)\n\t\t: brand(DetachedFieldIndexFormatVersion.v2);\n}\n\nexport function makeDetachedFieldIndexCodec(\n\trevisionTagCodec: RevisionTagCodec,\n\toptions: CodecWriteOptions,\n\tidCompressor: IIdCompressor,\n): IJsonCodec<DetachedFieldSummaryData> {\n\tconst family = makeDetachedFieldIndexCodecFamily(revisionTagCodec, options, idCompressor);\n\treturn makeVersionDispatchingCodec(family, {\n\t\t...options,\n\t\twriteVersion: clientVersionToDetachedFieldVersion(options.minVersionForCollab),\n\t});\n}\n\nexport function makeDetachedFieldIndexCodecFamily(\n\trevisionTagCodec: RevisionTagCodec,\n\toptions: CodecWriteOptions,\n\tidCompressor: IIdCompressor,\n): ICodecFamily<DetachedFieldSummaryData> {\n\treturn makeCodecFamily([\n\t\t[\n\t\t\tDetachedFieldIndexFormatVersion.v1,\n\t\t\tmakeDetachedNodeToFieldCodecV1(revisionTagCodec, options, idCompressor),\n\t\t],\n\t\t[\n\t\t\tDetachedFieldIndexFormatVersion.v2,\n\t\t\tmakeDetachedNodeToFieldCodecV2(revisionTagCodec, options, idCompressor),\n\t\t],\n\t]);\n}\n\nexport function getCodecTreeForDetachedFieldIndexFormat(\n\tclientVersion: MinimumVersionForCollab,\n): CodecTree {\n\treturn {\n\t\tname: \"DetachedFieldIndex\",\n\t\tversion: clientVersionToDetachedFieldVersion(clientVersion),\n\t};\n}\n"]}
@@ -3,7 +3,16 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { type Static, type TSchema } from "@sinclair/typebox";
6
+ import { type Brand } from "../../util/index.js";
6
7
  import type { ForestRootId } from "./detachedFieldIndexTypes.js";
8
+ /**
9
+ * The format version for the detached field index.
10
+ */
11
+ export declare const DetachedFieldIndexFormatVersion: {
12
+ readonly v1: 1;
13
+ readonly v2: 2;
14
+ };
15
+ export type DetachedFieldIndexFormatVersion = Brand<(typeof DetachedFieldIndexFormatVersion)[keyof typeof DetachedFieldIndexFormatVersion], "DetachedFieldIndexFormatVersion">;
7
16
  /**
8
17
  * The ID of a detached node. Is not globally unique on.
9
18
  * A `RevisionTag` + `DetachId` pair is globally unique and eventually consistent across clients.
@@ -28,7 +37,7 @@ export type RootRanges = Static<typeof RootRanges>;
28
37
  */
29
38
  export declare const EncodedRootsForRevision: <Schema extends TSchema>(tRevisionTag: Schema) => import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTuple<[Schema, import("@sinclair/typebox").TArray<import("@sinclair/typebox").TTuple<[import("@sinclair/typebox").TNumber, import("@sinclair/typebox").TUnsafe<ForestRootId>]>>]>, import("@sinclair/typebox").TTuple<[Schema, import("@sinclair/typebox").TNumber, import("@sinclair/typebox").TUnsafe<ForestRootId>]>]>;
30
39
  export type EncodedRootsForRevision = Static<ReturnType<typeof EncodedRootsForRevision>>;
31
- export declare const Format: <TVersion extends number, TRevisionTagSchema extends TSchema>(tVersion: TVersion, tRevisionTag: TRevisionTagSchema) => import("@sinclair/typebox").TObject<{
40
+ export declare const Format: <TVersion extends DetachedFieldIndexFormatVersion, TRevisionTagSchema extends TSchema>(tVersion: TVersion, tRevisionTag: TRevisionTagSchema) => import("@sinclair/typebox").TObject<{
32
41
  version: import("@sinclair/typebox").TLiteral<TVersion>;
33
42
  data: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTuple<[TRevisionTagSchema, import("@sinclair/typebox").TArray<import("@sinclair/typebox").TTuple<[import("@sinclair/typebox").TNumber, import("@sinclair/typebox").TUnsafe<ForestRootId>]>>]>, import("@sinclair/typebox").TTuple<[TRevisionTagSchema, import("@sinclair/typebox").TNumber, import("@sinclair/typebox").TUnsafe<ForestRootId>]>]>>;
34
43
  maxId: import("@sinclair/typebox").TUnsafe<ForestRootId>;
@@ -1 +1 @@
1
- {"version":3,"file":"detachedFieldIndexFormatCommon.d.ts","sourceRoot":"","sources":["../../../src/core/tree/detachedFieldIndexFormatCommon.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,OAAO,EAAQ,MAAM,mBAAmB,CAAC;AAIpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAEjE;;;GAGG;AACH,eAAO,MAAM,QAAQ,qCAAiC,CAAC;AAEvD;;;GAGG;AACH,eAAO,MAAM,kBAAkB,mDAG7B,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,SAAS,8HAKpB,CAAC;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,SAAS,CAAC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AC,OAAO,UAAU,CAAC,CAAC;AAEnD;;GAEG;AAGH,eAAO,MAAM,uBAAuB,yCAA0C,MAAM,+XAMjF,CAAC;AACJ,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAAC,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAC,CAAC;AAEzF,eAAO,MAAM,MAAM,mGAIR,QAAQ,gBACJ,kBAAkB;;;;EAW/B,CAAC;AAEH,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC,CAAC"}
@@ -4,6 +4,13 @@
4
4
  */
5
5
  import { Type } from "@sinclair/typebox";
6
6
  import { brandedNumberType } from "../../util/index.js";
7
+ /**
8
+ * The format version for the detached field index.
9
+ */
10
+ export const DetachedFieldIndexFormatVersion = {
11
+ v1: 1,
12
+ v2: 2,
13
+ };
7
14
  /**
8
15
  * The ID of a detached node. Is not globally unique on.
9
16
  * A `RevisionTag` + `DetachId` pair is globally unique and eventually consistent across clients.
@@ -1 +1 @@
1
- {"version":3,"file":"detachedFieldIndexFormatCommon.js","sourceRoot":"","sources":["../../../src/core/tree/detachedFieldIndexFormatCommon.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAA6B,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAIxD;;;GAGG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC,CAAC;AAEvD;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,iBAAiB,CAAe;IACjE,OAAO,EAAE,CAAC,CAAC;IACX,UAAU,EAAE,CAAC;CACb,CAAC,CAAC;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC;IACnC,iCAAiC;IACjC,QAAQ;IACR,6BAA6B;IAC7B,kBAAkB;CAClB,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;AAGhD;;GAEG;AACH,wCAAwC;AACxC,4EAA4E;AAC5E,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAyB,YAAoB,EAAE,EAAE,CACvF,IAAI,CAAC,KAAK,CAAC;IACV,yEAAyE;IACzE,IAAI,CAAC,KAAK,CAAC,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;IACtC,mEAAmE;IACnE,IAAI,CAAC,KAAK,CAAC,CAAC,YAAY,EAAE,QAAQ,EAAE,kBAAkB,CAAC,CAAC;CACxD,CAAC,CAAC;AAGJ,MAAM,CAAC,MAAM,MAAM,GAAG,CACrB,QAAkB,EAClB,YAAgC,EAG/B,EAAE,CACH,IAAI,CAAC,MAAM,CACV;IACC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC;IAC/B,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,uBAAuB,CAAC,YAAY,CAAC,CAAC;IACvD,KAAK,EAAE,kBAAkB;CACzB,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 TSchema, Type } from \"@sinclair/typebox\";\n\nimport { brandedNumberType } from \"../../util/index.js\";\n\nimport type { ForestRootId } from \"./detachedFieldIndexTypes.js\";\n\n/**\n * The ID of a detached node. Is not globally unique on.\n * A `RevisionTag` + `DetachId` pair is globally unique and eventually consistent across clients.\n */\nexport const DetachId = Type.Number({ multipleOf: 1 });\n\n/**\n * The ID of a root node in the forest associated with the owning checkout. Is unique for that forest.\n * Is not consistent across clients.\n */\nexport const ForestRootIdSchema = brandedNumberType<ForestRootId>({\n\tminimum: -1,\n\tmultipleOf: 1,\n});\n\n/**\n * A mapping from a range of the detached node IDs the corresponding range root IDs.\n * The detached node IDs need to be qualified with a revision (stored in the containing `EncodedRootsForRevision`).\n * Note: the length of the range (currently always 1) can be looked up in the forest.\n */\nexport const RootRange = Type.Tuple([\n\t// ID for the first detached node\n\tDetachId,\n\t// ID for the first root node\n\tForestRootIdSchema,\n]);\nexport type RootRange = Static<typeof RootRange>;\n\nexport const RootRanges = Type.Array(RootRange);\nexport type RootRanges = Static<typeof RootRanges>;\n\n/**\n * For all the roots detached in a revision, represents a mapping from the detached node ID to corresponding root ID.\n */\n// Return type is intentionally derived.\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nexport const EncodedRootsForRevision = <Schema extends TSchema>(tRevisionTag: Schema) =>\n\tType.Union([\n\t\t// Used to represent a revision in which more than one node were detached\n\t\tType.Tuple([tRevisionTag, RootRanges]),\n\t\t// Used to represent a revision in which a single node was detached\n\t\tType.Tuple([tRevisionTag, DetachId, ForestRootIdSchema]),\n\t]);\nexport type EncodedRootsForRevision = Static<ReturnType<typeof EncodedRootsForRevision>>;\n\nexport const Format = <TVersion extends number, TRevisionTagSchema extends TSchema>(\n\ttVersion: TVersion,\n\ttRevisionTag: TRevisionTagSchema,\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(tVersion),\n\t\t\tdata: Type.Array(EncodedRootsForRevision(tRevisionTag)),\n\t\t\tmaxId: ForestRootIdSchema,\n\t\t},\n\t\t{ additionalProperties: false },\n\t);\n\nexport type Format = Static<ReturnType<typeof Format>>;\n"]}
1
+ {"version":3,"file":"detachedFieldIndexFormatCommon.js","sourceRoot":"","sources":["../../../src/core/tree/detachedFieldIndexFormatCommon.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAA6B,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEpE,OAAO,EAAE,iBAAiB,EAAc,MAAM,qBAAqB,CAAC;AAIpE;;GAEG;AACH,MAAM,CAAC,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right (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { type Static, type TSchema, Type } from \"@sinclair/typebox\";\n\nimport { brandedNumberType, type Brand } from \"../../util/index.js\";\n\nimport type { ForestRootId } from \"./detachedFieldIndexTypes.js\";\n\n/**\n * The format version for the detached field index.\n */\nexport const DetachedFieldIndexFormatVersion = {\n\tv1: 1,\n\tv2: 2,\n} as const;\nexport type DetachedFieldIndexFormatVersion = Brand<\n\t(typeof DetachedFieldIndexFormatVersion)[keyof typeof DetachedFieldIndexFormatVersion],\n\t\"DetachedFieldIndexFormatVersion\"\n>;\n\n/**\n * The ID of a detached node. Is not globally unique on.\n * A `RevisionTag` + `DetachId` pair is globally unique and eventually consistent across clients.\n */\nexport const DetachId = Type.Number({ multipleOf: 1 });\n\n/**\n * The ID of a root node in the forest associated with the owning checkout. Is unique for that forest.\n * Is not consistent across clients.\n */\nexport const ForestRootIdSchema = brandedNumberType<ForestRootId>({\n\tminimum: -1,\n\tmultipleOf: 1,\n});\n\n/**\n * A mapping from a range of the detached node IDs the corresponding range root IDs.\n * The detached node IDs need to be qualified with a revision (stored in the containing `EncodedRootsForRevision`).\n * Note: the length of the range (currently always 1) can be looked up in the forest.\n */\nexport const RootRange = Type.Tuple([\n\t// ID for the first detached node\n\tDetachId,\n\t// ID for the first root node\n\tForestRootIdSchema,\n]);\nexport type RootRange = Static<typeof RootRange>;\n\nexport const RootRanges = Type.Array(RootRange);\nexport type RootRanges = Static<typeof RootRanges>;\n\n/**\n * For all the roots detached in a revision, represents a mapping from the detached node ID to corresponding root ID.\n */\n// Return type is intentionally derived.\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nexport const EncodedRootsForRevision = <Schema extends TSchema>(tRevisionTag: Schema) =>\n\tType.Union([\n\t\t// Used to represent a revision in which more than one node were detached\n\t\tType.Tuple([tRevisionTag, RootRanges]),\n\t\t// Used to represent a revision in which a single node was detached\n\t\tType.Tuple([tRevisionTag, DetachId, ForestRootIdSchema]),\n\t]);\nexport type EncodedRootsForRevision = Static<ReturnType<typeof EncodedRootsForRevision>>;\n\nexport const Format = <\n\tTVersion extends DetachedFieldIndexFormatVersion,\n\tTRevisionTagSchema extends TSchema,\n>(\n\ttVersion: TVersion,\n\ttRevisionTag: TRevisionTagSchema,\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(tVersion),\n\t\t\tdata: Type.Array(EncodedRootsForRevision(tRevisionTag)),\n\t\t\tmaxId: ForestRootIdSchema,\n\t\t},\n\t\t{ additionalProperties: false },\n\t);\n\nexport type Format = Static<ReturnType<typeof Format>>;\n"]}
@@ -3,9 +3,9 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import type { Static } from "@sinclair/typebox";
6
- export declare const version1 = 1;
6
+ import { DetachedFieldIndexFormatVersion } from "./detachedFieldIndexFormatCommon.js";
7
7
  export declare const FormatV1: import("@sinclair/typebox").TObject<{
8
- version: import("@sinclair/typebox").TLiteral<1>;
8
+ version: import("@sinclair/typebox").TLiteral<DetachedFieldIndexFormatVersion>;
9
9
  data: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTuple<[import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"root">, import("@sinclair/typebox").TUnsafe<import("../../util/brand.js").Brand<import("@fluidframework/id-compressor").OpSpaceCompressedId, "EncodedRevisionTag">>]>, import("@sinclair/typebox").TArray<import("@sinclair/typebox").TTuple<[import("@sinclair/typebox").TNumber, import("@sinclair/typebox").TUnsafe<import("./detachedFieldIndexTypes.js").ForestRootId>]>>]>, import("@sinclair/typebox").TTuple<[import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"root">, import("@sinclair/typebox").TUnsafe<import("../../util/brand.js").Brand<import("@fluidframework/id-compressor").OpSpaceCompressedId, "EncodedRevisionTag">>]>, import("@sinclair/typebox").TNumber, import("@sinclair/typebox").TUnsafe<import("./detachedFieldIndexTypes.js").ForestRootId>]>]>>;
10
10
  maxId: import("@sinclair/typebox").TUnsafe<import("./detachedFieldIndexTypes.js").ForestRootId>;
11
11
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"detachedFieldIndexFormatV1.d.ts","sourceRoot":"","sources":["../../../src/core/tree/detachedFieldIndexFormatV1.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAKhD,eAAO,MAAM,QAAQ,IAAM,CAAC;AAE5B,eAAO,MAAM,QAAQ;;;;EAAsC,CAAC;AAE5D,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,QAAQ,CAAC,CAAC"}
1
+ {"version":3,"file":"detachedFieldIndexFormatV1.d.ts","sourceRoot":"","sources":["../../../src/core/tree/detachedFieldIndexFormatV1.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,+BAA+B,EAAU,MAAM,qCAAqC,CAAC;AAI9F,eAAO,MAAM,QAAQ;;;;EAGpB,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,QAAQ,CAAC,CAAC"}
@@ -2,8 +2,8 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { Format } from "./detachedFieldIndexFormatCommon.js";
5
+ import { DetachedFieldIndexFormatVersion, Format } from "./detachedFieldIndexFormatCommon.js";
6
6
  import { RevisionTagSchema } from "../rebase/index.js";
7
- export const version1 = 1.0;
8
- export const FormatV1 = Format(version1, RevisionTagSchema);
7
+ import { brand } from "../../util/index.js";
8
+ export const FormatV1 = Format(brand(DetachedFieldIndexFormatVersion.v1), RevisionTagSchema);
9
9
  //# sourceMappingURL=detachedFieldIndexFormatV1.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"detachedFieldIndexFormatV1.js","sourceRoot":"","sources":["../../../src/core/tree/detachedFieldIndexFormatV1.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAG,CAAC;AAE5B,MAAM,CAAC,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,EAAE,iBAAiB,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { Static } from \"@sinclair/typebox\";\n\nimport { Format } from \"./detachedFieldIndexFormatCommon.js\";\nimport { RevisionTagSchema } from \"../rebase/index.js\";\n\nexport const version1 = 1.0;\n\nexport const FormatV1 = Format(version1, RevisionTagSchema);\n\nexport type FormatV1 = Static<typeof FormatV1>;\n"]}
1
+ {"version":3,"file":"detachedFieldIndexFormatV1.js","sourceRoot":"","sources":["../../../src/core/tree/detachedFieldIndexFormatV1.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,+BAA+B,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAC9F,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,MAAM,CAAC,MAAM,QAAQ,GAAG,MAAM,CAC7B,KAAK,CAAkC,+BAA+B,CAAC,EAAE,CAAC,EAC1E,iBAAiB,CACjB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { Static } from \"@sinclair/typebox\";\n\nimport { DetachedFieldIndexFormatVersion, Format } from \"./detachedFieldIndexFormatCommon.js\";\nimport { RevisionTagSchema } from \"../rebase/index.js\";\nimport { brand } from \"../../util/index.js\";\n\nexport const FormatV1 = Format(\n\tbrand<DetachedFieldIndexFormatVersion>(DetachedFieldIndexFormatVersion.v1),\n\tRevisionTagSchema,\n);\n\nexport type FormatV1 = Static<typeof FormatV1>;\n"]}
@@ -3,10 +3,10 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { type Static } from "@sinclair/typebox";
6
- export declare const version2 = 2;
6
+ import { DetachedFieldIndexFormatVersion } from "./detachedFieldIndexFormatCommon.js";
7
7
  export declare const StableOrFinalRevisionTag: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"root">, import("@sinclair/typebox").TUnsafe<import("../../util/brand.js").Brand<import("@fluidframework/id-compressor").OpSpaceCompressedId, "EncodedRevisionTag">>]>, import("@sinclair/typebox").TString]>;
8
8
  export declare const FormatV2: import("@sinclair/typebox").TObject<{
9
- version: import("@sinclair/typebox").TLiteral<2>;
9
+ version: import("@sinclair/typebox").TLiteral<DetachedFieldIndexFormatVersion>;
10
10
  data: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTuple<[import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"root">, import("@sinclair/typebox").TUnsafe<import("../../util/brand.js").Brand<import("@fluidframework/id-compressor").OpSpaceCompressedId, "EncodedRevisionTag">>]>, import("@sinclair/typebox").TString]>, import("@sinclair/typebox").TArray<import("@sinclair/typebox").TTuple<[import("@sinclair/typebox").TNumber, import("@sinclair/typebox").TUnsafe<import("./detachedFieldIndexTypes.js").ForestRootId>]>>]>, import("@sinclair/typebox").TTuple<[import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"root">, import("@sinclair/typebox").TUnsafe<import("../../util/brand.js").Brand<import("@fluidframework/id-compressor").OpSpaceCompressedId, "EncodedRevisionTag">>]>, import("@sinclair/typebox").TString]>, import("@sinclair/typebox").TNumber, import("@sinclair/typebox").TUnsafe<import("./detachedFieldIndexTypes.js").ForestRootId>]>]>>;
11
11
  maxId: import("@sinclair/typebox").TUnsafe<import("./detachedFieldIndexTypes.js").ForestRootId>;
12
12
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"detachedFieldIndexFormatV2.d.ts","sourceRoot":"","sources":["../../../src/core/tree/detachedFieldIndexFormatV2.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,KAAK,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAKtD,eAAO,MAAM,QAAQ,IAAM,CAAC;AAE5B,eAAO,MAAM,wBAAwB,4TAAkD,CAAC;AAExF,eAAO,MAAM,QAAQ;;;;EAA6C,CAAC;AAEnE,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,QAAQ,CAAC,CAAC"}
1
+ {"version":3,"file":"detachedFieldIndexFormatV2.d.ts","sourceRoot":"","sources":["../../../src/core/tree/detachedFieldIndexFormatV2.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,KAAK,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEtD,OAAO,EAAE,+BAA+B,EAAU,MAAM,qCAAqC,CAAC;AAI9F,eAAO,MAAM,wBAAwB,4TAAkD,CAAC;AAExF,eAAO,MAAM,QAAQ;;;;EAGpB,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,QAAQ,CAAC,CAAC"}
@@ -3,9 +3,9 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { Type } from "@sinclair/typebox";
6
- import { Format } from "./detachedFieldIndexFormatCommon.js";
6
+ import { DetachedFieldIndexFormatVersion, Format } from "./detachedFieldIndexFormatCommon.js";
7
7
  import { RevisionTagSchema, StableIdSchema } from "../rebase/index.js";
8
- export const version2 = 2.0;
8
+ import { brand } from "../../util/index.js";
9
9
  export const StableOrFinalRevisionTag = Type.Union([RevisionTagSchema, StableIdSchema]);
10
- export const FormatV2 = Format(version2, StableOrFinalRevisionTag);
10
+ export const FormatV2 = Format(brand(DetachedFieldIndexFormatVersion.v2), StableOrFinalRevisionTag);
11
11
  //# sourceMappingURL=detachedFieldIndexFormatV2.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"detachedFieldIndexFormatV2.js","sourceRoot":"","sources":["../../../src/core/tree/detachedFieldIndexFormatV2.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAe,MAAM,mBAAmB,CAAC;AAEtD,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEvE,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAG,CAAC;AAE5B,MAAM,CAAC,MAAM,wBAAwB,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,iBAAiB,EAAE,cAAc,CAAC,CAAC,CAAC;AAExF,MAAM,CAAC,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,EAAE,wBAAwB,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { Type, type Static } from \"@sinclair/typebox\";\n\nimport { Format } from \"./detachedFieldIndexFormatCommon.js\";\nimport { RevisionTagSchema, StableIdSchema } from \"../rebase/index.js\";\n\nexport const version2 = 2.0;\n\nexport const StableOrFinalRevisionTag = Type.Union([RevisionTagSchema, StableIdSchema]);\n\nexport const FormatV2 = Format(version2, StableOrFinalRevisionTag);\n\nexport type FormatV2 = Static<typeof FormatV2>;\n"]}
1
+ {"version":3,"file":"detachedFieldIndexFormatV2.js","sourceRoot":"","sources":["../../../src/core/tree/detachedFieldIndexFormatV2.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAe,MAAM,mBAAmB,CAAC;AAEtD,OAAO,EAAE,+BAA+B,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAC9F,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,MAAM,CAAC,MAAM,wBAAwB,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,iBAAiB,EAAE,cAAc,CAAC,CAAC,CAAC;AAExF,MAAM,CAAC,MAAM,QAAQ,GAAG,MAAM,CAC7B,KAAK,CAAkC,+BAA+B,CAAC,EAAE,CAAC,EAC1E,wBAAwB,CACxB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { Type, type Static } from \"@sinclair/typebox\";\n\nimport { DetachedFieldIndexFormatVersion, Format } from \"./detachedFieldIndexFormatCommon.js\";\nimport { RevisionTagSchema, StableIdSchema } from \"../rebase/index.js\";\nimport { brand } from \"../../util/index.js\";\n\nexport const StableOrFinalRevisionTag = Type.Union([RevisionTagSchema, StableIdSchema]);\n\nexport const FormatV2 = Format(\n\tbrand<DetachedFieldIndexFormatVersion>(DetachedFieldIndexFormatVersion.v2),\n\tStableOrFinalRevisionTag,\n);\n\nexport type FormatV2 = Static<typeof FormatV2>;\n"]}
@@ -16,6 +16,7 @@ export { SparseNode, getDescendant } from "./sparseTree.js";
16
16
  export { deltaForRootInitialization, makeDetachedNodeId, offsetDetachId, emptyDelta, } from "./deltaUtil.js";
17
17
  export { type TreeChunk, dummyRoot, cursorChunk, tryGetChunk, type ChunkedCursor, } from "./chunk.js";
18
18
  export { DetachedFieldIndex } from "./detachedFieldIndex.js";
19
- export { type DetachedFieldIndexFormatVersion, getCodecTreeForDetachedFieldIndexFormat, } from "./detachedFieldIndexCodecs.js";
19
+ export { getCodecTreeForDetachedFieldIndexFormat } from "./detachedFieldIndexCodecs.js";
20
+ export { type DetachedFieldIndexFormatVersion } from "./detachedFieldIndexFormatCommon.js";
20
21
  export { type ForestRootId } from "./detachedFieldIndexTypes.js";
21
22
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/tree/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,MAAM,EACX,KAAK,aAAa,EAClB,SAAS,EACT,KAAK,UAAU,EACf,KAAK,UAAU,EACf,UAAU,EACV,KAAK,YAAY,EACjB,KAAK,mBAAmB,GACxB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACN,KAAK,WAAW,EAChB,kBAAkB,EAClB,uBAAuB,EACvB,cAAc,EACd,eAAe,EACf,WAAW,EACX,oBAAoB,EACpB,YAAY,EACZ,kBAAkB,EAClB,KAAK,sBAAsB,EAC3B,KAAK,cAAc,EACnB,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,QAAQ,GACR,MAAM,aAAa,CAAC;AACrB,YAAY,EACX,UAAU,EACV,IAAI,IAAI,SAAS,EACjB,IAAI,IAAI,SAAS,EACjB,cAAc,IAAI,mBAAmB,EACrC,QAAQ,IAAI,aAAa,EACzB,mBAAmB,IAAI,wBAAwB,EAC/C,iBAAiB,IAAI,sBAAsB,EAC3C,uBAAuB,IAAI,4BAA4B,EACvD,kBAAkB,IAAI,uBAAuB,EAC7C,YAAY,IAAI,iBAAiB,GACjC,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,gBAAgB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpF,OAAO,EACN,SAAS,EACT,WAAW,EACX,QAAQ,EACR,KAAK,MAAM,EACX,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,WAAW,EAChB,KAAK,KAAK,EACV,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,SAAS,EACd,cAAc,EACd,mBAAmB,EACnB,oBAAoB,IAAI,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f,KAAK,eAAe,EACpB,mBAAmB,EACnB,KAAK,YAAY,EACjB,mBAAmB,GACnB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EACN,QAAQ,EACR,KAAK,QAAQ,EACb,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,SAAS,EACd,KAAK,KAAK,EACV,KAAK,SAAS,EACd,kBAAkB,EAClB,kBAAkB,EAClB,YAAY,EACZ,KAAK,QAAQ,EACb,SAAS,EACT,oBAAoB,GACpB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,KAAK,YAAY,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EACN,KAAK,gBAAgB,EACrB,aAAa,EACb,UAAU,EACV,sBAAsB,EACtB,eAAe,EACf,sBAAsB,GACtB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAE5D,OAAO,EACN,0BAA0B,EAC1B,kBAAkB,EAClB,cAAc,EACd,UAAU,GACV,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACN,KAAK,SAAS,EACd,SAAS,EACT,WAAW,EACX,WAAW,EACX,KAAK,aAAa,GAClB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,OAAO,EAAE,uCAAuC,EAAE,MAAM,+BAA+B,CAAC;AACxF,OAAO,EAAE,KAAK,+BAA+B,EAAE,MAAM,qCAAqC,CAAC;AAE3F,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,8BAA8B,CAAC"}
@@ -15,5 +15,5 @@ export { SparseNode, getDescendant } from "./sparseTree.js";
15
15
  export { deltaForRootInitialization, makeDetachedNodeId, offsetDetachId, emptyDelta, } from "./deltaUtil.js";
16
16
  export { dummyRoot, cursorChunk, tryGetChunk, } from "./chunk.js";
17
17
  export { DetachedFieldIndex } from "./detachedFieldIndex.js";
18
- export { getCodecTreeForDetachedFieldIndexFormat, } from "./detachedFieldIndexCodecs.js";
18
+ export { getCodecTreeForDetachedFieldIndexFormat } from "./detachedFieldIndexCodecs.js";
19
19
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/tree/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAGN,SAAS,EAGT,UAAU,GAGV,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAEN,kBAAkB,EAClB,uBAAuB,EACvB,cAAc,EACd,eAAe,EACf,WAAW,EACX,oBAAoB,EACpB,YAAY,EACZ,kBAAkB,EAGlB,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,QAAQ,GACR,MAAM,aAAa,CAAC;AAarB,OAAO,EAAuC,eAAe,EAAE,MAAM,cAAc,CAAC;AACpF,OAAO,EACN,SAAS,EACT,WAAW,EACX,QAAQ,EAWR,cAAc,EACd,mBAAmB,EACnB,oBAAoB,IAAI,gBAAgB,EACxC,8BAA8B,GAE9B,MAAM,eAAe,CAAC;AACvB,OAAO,EAGN,wBAAwB,EACxB,eAAe,EAEf,mBAAmB,EAEnB,mBAAmB,GACnB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EACN,QAAQ,EAQR,kBAAkB,EAClB,kBAAkB,EAClB,YAAY,EAEZ,SAAS,EACT,oBAAoB,GACpB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAqB,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAEN,aAAa,EACb,UAAU,EACV,sBAAsB,EACtB,eAAe,EACf,sBAAsB,GACtB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAE5D,OAAO,EACN,0BAA0B,EAC1B,kBAAkB,EAClB,cAAc,EACd,UAAU,GACV,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAEN,SAAS,EACT,WAAW,EACX,WAAW,GAEX,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,OAAO,EAEN,uCAAuC,GACvC,MAAM,+BAA+B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\ttype Anchor,\n\ttype AnchorLocator,\n\tAnchorSet,\n\ttype AnchorSlot,\n\ttype AnchorNode,\n\tanchorSlot,\n\ttype AnchorEvents,\n\ttype AnchorSetRootEvents,\n} from \"./anchorSet.js\";\nexport {\n\ttype ITreeCursor,\n\tCursorLocationType,\n\tcastCursorToSynchronous,\n\tmapCursorField,\n\tmapCursorFields,\n\tforEachNode,\n\tforEachNodeInSubtree,\n\tforEachField,\n\titerateCursorField,\n\ttype ITreeCursorSynchronous,\n\ttype PathRootPrefix,\n\tinCursorField,\n\tinCursorNode,\n\tCursorMarker,\n\tisCursor,\n} from \"./cursor.js\";\nexport type {\n\tProtoNodes,\n\tRoot as DeltaRoot,\n\tMark as DeltaMark,\n\tDetachedNodeId as DeltaDetachedNodeId,\n\tFieldMap as DeltaFieldMap,\n\tDetachedNodeChanges as DeltaDetachedNodeChanges,\n\tDetachedNodeBuild as DeltaDetachedNodeBuild,\n\tDetachedNodeDestruction as DeltaDetachedNodeDestruction,\n\tDetachedNodeRename as DeltaDetachedNodeRename,\n\tFieldChanges as DeltaFieldChanges,\n} from \"./delta.js\";\nexport { type MapTree, type ExclusiveMapTree, deepCopyMapTree } from \"./mapTree.js\";\nexport {\n\tclonePath,\n\ttopDownPath,\n\tgetDepth,\n\ttype UpPath,\n\ttype NormalizedUpPath,\n\ttype INormalizedUpPath,\n\ttype NormalizedFieldUpPath,\n\ttype FieldUpPath,\n\ttype Range,\n\ttype RangeUpPath,\n\ttype PlaceUpPath,\n\ttype PlaceIndex,\n\ttype NodeIndex,\n\tcompareUpPaths,\n\tcompareFieldUpPaths,\n\tisDetachedUpPathRoot as isDetachedUpPath,\n\tgetDetachedFieldContainingPath,\n\ttype UpPathDefault,\n} from \"./pathTree.js\";\nexport {\n\ttype FieldMapObject,\n\ttype GenericFieldsNode,\n\tgenericTreeDeleteIfEmpty,\n\tgenericTreeKeys,\n\ttype GenericTreeNode,\n\tgetGenericTreeField,\n\ttype JsonableTree,\n\tsetGenericTreeField,\n} from \"./treeTextFormat.js\";\nexport { EncodedJsonableTree } from \"./persistedTreeTextFormat.js\";\nexport {\n\tEmptyKey,\n\ttype TreeType,\n\ttype ChildLocation,\n\ttype DetachedField,\n\ttype ChildCollection,\n\ttype RootField,\n\ttype Value,\n\ttype TreeValue,\n\tdetachedFieldAsKey,\n\tkeyAsDetachedField,\n\trootFieldKey,\n\ttype NodeData,\n\trootField,\n\taboveRootPlaceholder,\n} from \"./types.js\";\nexport { type DeltaVisitor, visitDelta } from \"./visitDelta.js\";\nexport {\n\ttype AnnouncedVisitor,\n\tannounceDelta,\n\tapplyDelta,\n\tcreateAnnouncedVisitor,\n\tcombineVisitors,\n\tmakeDetachedFieldIndex,\n} from \"./visitorUtils.js\";\n\nexport { SparseNode, getDescendant } from \"./sparseTree.js\";\n\nexport {\n\tdeltaForRootInitialization,\n\tmakeDetachedNodeId,\n\toffsetDetachId,\n\temptyDelta,\n} from \"./deltaUtil.js\";\n\nexport {\n\ttype TreeChunk,\n\tdummyRoot,\n\tcursorChunk,\n\ttryGetChunk,\n\ttype ChunkedCursor,\n} from \"./chunk.js\";\n\nexport { DetachedFieldIndex } from \"./detachedFieldIndex.js\";\n\nexport {\n\ttype DetachedFieldIndexFormatVersion,\n\tgetCodecTreeForDetachedFieldIndexFormat,\n} from \"./detachedFieldIndexCodecs.js\";\n\nexport { type ForestRootId } from \"./detachedFieldIndexTypes.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources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AC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\ttype Anchor,\n\ttype AnchorLocator,\n\tAnchorSet,\n\ttype AnchorSlot,\n\ttype AnchorNode,\n\tanchorSlot,\n\ttype AnchorEvents,\n\ttype AnchorSetRootEvents,\n} from \"./anchorSet.js\";\nexport {\n\ttype ITreeCursor,\n\tCursorLocationType,\n\tcastCursorToSynchronous,\n\tmapCursorField,\n\tmapCursorFields,\n\tforEachNode,\n\tforEachNodeInSubtree,\n\tforEachField,\n\titerateCursorField,\n\ttype ITreeCursorSynchronous,\n\ttype PathRootPrefix,\n\tinCursorField,\n\tinCursorNode,\n\tCursorMarker,\n\tisCursor,\n} from \"./cursor.js\";\nexport type {\n\tProtoNodes,\n\tRoot as DeltaRoot,\n\tMark as DeltaMark,\n\tDetachedNodeId as DeltaDetachedNodeId,\n\tFieldMap as DeltaFieldMap,\n\tDetachedNodeChanges as DeltaDetachedNodeChanges,\n\tDetachedNodeBuild as DeltaDetachedNodeBuild,\n\tDetachedNodeDestruction as DeltaDetachedNodeDestruction,\n\tDetachedNodeRename as DeltaDetachedNodeRename,\n\tFieldChanges as DeltaFieldChanges,\n} from \"./delta.js\";\nexport { type MapTree, type ExclusiveMapTree, deepCopyMapTree } from \"./mapTree.js\";\nexport {\n\tclonePath,\n\ttopDownPath,\n\tgetDepth,\n\ttype UpPath,\n\ttype NormalizedUpPath,\n\ttype INormalizedUpPath,\n\ttype NormalizedFieldUpPath,\n\ttype FieldUpPath,\n\ttype Range,\n\ttype RangeUpPath,\n\ttype PlaceUpPath,\n\ttype PlaceIndex,\n\ttype NodeIndex,\n\tcompareUpPaths,\n\tcompareFieldUpPaths,\n\tisDetachedUpPathRoot as isDetachedUpPath,\n\tgetDetachedFieldContainingPath,\n\ttype UpPathDefault,\n} from \"./pathTree.js\";\nexport {\n\ttype FieldMapObject,\n\ttype GenericFieldsNode,\n\tgenericTreeDeleteIfEmpty,\n\tgenericTreeKeys,\n\ttype GenericTreeNode,\n\tgetGenericTreeField,\n\ttype JsonableTree,\n\tsetGenericTreeField,\n} from \"./treeTextFormat.js\";\nexport { EncodedJsonableTree } from \"./persistedTreeTextFormat.js\";\nexport {\n\tEmptyKey,\n\ttype TreeType,\n\ttype ChildLocation,\n\ttype DetachedField,\n\ttype ChildCollection,\n\ttype RootField,\n\ttype Value,\n\ttype TreeValue,\n\tdetachedFieldAsKey,\n\tkeyAsDetachedField,\n\trootFieldKey,\n\ttype NodeData,\n\trootField,\n\taboveRootPlaceholder,\n} from \"./types.js\";\nexport { type DeltaVisitor, visitDelta } from \"./visitDelta.js\";\nexport {\n\ttype AnnouncedVisitor,\n\tannounceDelta,\n\tapplyDelta,\n\tcreateAnnouncedVisitor,\n\tcombineVisitors,\n\tmakeDetachedFieldIndex,\n} from \"./visitorUtils.js\";\n\nexport { SparseNode, getDescendant } from \"./sparseTree.js\";\n\nexport {\n\tdeltaForRootInitialization,\n\tmakeDetachedNodeId,\n\toffsetDetachId,\n\temptyDelta,\n} from \"./deltaUtil.js\";\n\nexport {\n\ttype TreeChunk,\n\tdummyRoot,\n\tcursorChunk,\n\ttryGetChunk,\n\ttype ChunkedCursor,\n} from \"./chunk.js\";\n\nexport { DetachedFieldIndex } from \"./detachedFieldIndex.js\";\n\nexport { getCodecTreeForDetachedFieldIndexFormat } from \"./detachedFieldIndexCodecs.js\";\nexport { type DetachedFieldIndexFormatVersion } from \"./detachedFieldIndexFormatCommon.js\";\n\nexport { type ForestRootId } from \"./detachedFieldIndexTypes.js\";\n"]}
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  // This export is documented as supported in typebox's documentation.
6
- // eslint-disable-next-line import/no-internal-modules
6
+ // eslint-disable-next-line import-x/no-internal-modules
7
7
  import { TypeCompiler } from "@sinclair/typebox/compiler";
8
8
  import { toFormatValidator } from "../codec/index.js";
9
9
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"typeboxValidator.js","sourceRoot":"","sources":["../../src/external-utilities/typeboxValidator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,qEAAqE;AACrE,sDAAsD;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,EAAE,iBAAiB,EAAsB,MAAM,mBAAmB,CAAC;AAE1E;;;;;;;;GAQG;AACH,MAAM,gBAAgB,GAAkB;IACvC,OAAO,EAAE,CAAyB,MAAc,EAAE,EAAE;QACnD,MAAM,cAAc,GAAG,YAAY,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACpD,OAAO;YACN,KAAK,EAAE,CAAC,IAAI,EAA0B,EAAE,CAAC,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC;SACnE,CAAC;IACH,CAAC;CACD,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,iBAAiB,CAAC,gBAAgB,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { Static, TSchema } from \"@sinclair/typebox\";\n// This export is documented as supported in typebox's documentation.\n// eslint-disable-next-line import/no-internal-modules\nimport { TypeCompiler } from \"@sinclair/typebox/compiler\";\n\nimport { toFormatValidator, type JsonValidator } from \"../codec/index.js\";\n\n/**\n * A {@link JsonValidator} implementation which uses TypeBox's JSON schema validator.\n *\n * @privateRemarks Take care to not reference this validator directly in SharedTree code:\n * the intent of factoring JSON validation into an interface is to make validation more pay-to-play\n * (i.e. a JSON validator is only included in an application's bundle if that application references it).\n *\n * Defining this validator in its own file also helps to ensure it is tree-shakeable.\n */\nconst typeboxValidator: JsonValidator = {\n\tcompile: <Schema extends TSchema>(schema: Schema) => {\n\t\tconst compiledFormat = TypeCompiler.Compile(schema);\n\t\treturn {\n\t\t\tcheck: (data): data is Static<Schema> => compiledFormat.Check(data),\n\t\t};\n\t},\n};\n\n/**\n * A {@link FormatValidator} implementation which uses TypeBox's JSON schema validator.\n * @alpha\n */\nexport const FormatValidatorBasic = toFormatValidator(typeboxValidator);\n"]}
1
+ {"version":3,"file":"typeboxValidator.js","sourceRoot":"","sources":["../../src/external-utilities/typeboxValidator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,qEAAqE;AACrE,wDAAwD;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,EAAE,iBAAiB,EAAsB,MAAM,mBAAmB,CAAC;AAE1E;;;;;;;;GAQG;AACH,MAAM,gBAAgB,GAAkB;IACvC,OAAO,EAAE,CAAyB,MAAc,EAAE,EAAE;QACnD,MAAM,cAAc,GAAG,YAAY,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACpD,OAAO;YACN,KAAK,EAAE,CAAC,IAAI,EAA0B,EAAE,CAAC,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC;SACnE,CAAC;IACH,CAAC;CACD,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,iBAAiB,CAAC,gBAAgB,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { Static, TSchema } from \"@sinclair/typebox\";\n// This export is documented as supported in typebox's documentation.\n// eslint-disable-next-line import-x/no-internal-modules\nimport { TypeCompiler } from \"@sinclair/typebox/compiler\";\n\nimport { toFormatValidator, type JsonValidator } from \"../codec/index.js\";\n\n/**\n * A {@link JsonValidator} implementation which uses TypeBox's JSON schema validator.\n *\n * @privateRemarks Take care to not reference this validator directly in SharedTree code:\n * the intent of factoring JSON validation into an interface is to make validation more pay-to-play\n * (i.e. a JSON validator is only included in an application's bundle if that application references it).\n *\n * Defining this validator in its own file also helps to ensure it is tree-shakeable.\n */\nconst typeboxValidator: JsonValidator = {\n\tcompile: <Schema extends TSchema>(schema: Schema) => {\n\t\tconst compiledFormat = TypeCompiler.Compile(schema);\n\t\treturn {\n\t\t\tcheck: (data): data is Static<Schema> => compiledFormat.Check(data),\n\t\t};\n\t},\n};\n\n/**\n * A {@link FormatValidator} implementation which uses TypeBox's JSON schema validator.\n * @alpha\n */\nexport const FormatValidatorBasic = toFormatValidator(typeboxValidator);\n"]}
@@ -3,12 +3,12 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import type { IIdCompressor, SessionId } from "@fluidframework/id-compressor";
6
- import { type CodecTree, type ICodecOptions, type IJsonCodec } from "../../../codec/index.js";
6
+ import { type CodecTree, type CodecWriteOptions, type IJsonCodec } from "../../../codec/index.js";
7
7
  import { type ITreeCursorSynchronous, type SchemaAndPolicy, type TreeChunk } from "../../../core/index.js";
8
8
  import { type Brand, type JsonCompatibleReadOnly } from "../../../util/index.js";
9
9
  import { type TreeCompressionStrategyPrivate } from "../../treeCompressionUtils.js";
10
10
  import type { FieldBatch } from "./fieldBatch.js";
11
- import { EncodedFieldBatch, type FieldBatchFormatVersion } from "./format.js";
11
+ import { EncodedFieldBatch } from "./format.js";
12
12
  import type { MinimumVersionForCollab } from "@fluidframework/runtime-definitions/internal";
13
13
  import type { IncrementalEncodingPolicy } from "./incrementalEncodingPolicy.js";
14
14
  /**
@@ -77,12 +77,6 @@ export interface FieldBatchEncodingContext {
77
77
  * Fields in this batch currently don't have field schema for the root, which limits optimizations.
78
78
  */
79
79
  export type FieldBatchCodec = IJsonCodec<FieldBatch, EncodedFieldBatch, JsonCompatibleReadOnly, FieldBatchEncodingContext>;
80
- /**
81
- * Get the write version for {@link makeFieldBatchCodec} based on the `minVersionForCollab` version.
82
- * @privateRemarks
83
- * TODO: makeFieldBatchCodec (and makeVersionDispatchingCodec transitively) should bake in this versionToFormat logic and the resulting codec can then support use with FluidClientVersion directly.
84
- */
85
- export declare function fluidVersionToFieldBatchCodecWriteVersion(minVersionForCollab: MinimumVersionForCollab): number;
86
- export declare function makeFieldBatchCodec(options: ICodecOptions, writeVersion: number): FieldBatchCodec;
87
- export declare function getCodecTreeForFieldBatchFormat(version: FieldBatchFormatVersion): CodecTree;
80
+ export declare function makeFieldBatchCodec(options: CodecWriteOptions): FieldBatchCodec;
81
+ export declare function getCodecTreeForFieldBatchFormat(clientVersion: MinimumVersionForCollab): CodecTree;
88
82
  //# sourceMappingURL=codecs.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"codecs.d.ts","sourceRoot":"","sources":["../../../../src/feature-libraries/chunked-forest/codec/codecs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAE9E,OAAO,EACN,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,UAAU,EAEf,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAEN,KAAK,sBAAsB,EAC3B,KAAK,eAAe,EACpB,KAAK,SAAS,EACd,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAEN,KAAK,KAAK,EACV,KAAK,sBAAsB,EAC3B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAGN,KAAK,8BAA8B,EACnC,MAAM,+BAA+B,CAAC;AAGvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAiB,KAAK,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAG7F,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AAC5F,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAEhF;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,MAAM,EAAE,yBAAyB,CAAC,CAAC;AAGxE;;;;;;;;GAQG;AACH,MAAM,WAAW,kBAAkB;IAClC;;;OAGG;IACH,yBAAyB,EAAE,yBAAyB,CAAC;IACrD;;;;;;;OAOG;IACH,sBAAsB,CACrB,MAAM,EAAE,sBAAsB,EAC9B,YAAY,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,iBAAiB,GACnD,gBAAgB,EAAE,CAAC;CACtB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,kBAAkB;IAClC;;;;;OAKG;IACH,sBAAsB,CACrB,WAAW,EAAE,gBAAgB,EAC7B,YAAY,EAAE,CAAC,OAAO,EAAE,iBAAiB,KAAK,SAAS,GACrD,SAAS,CAAC;CACb;AACD;;GAEG;AACH,MAAM,WAAW,yBAA0B,SAAQ,kBAAkB,EAAE,kBAAkB;CAAG;AAE5F,MAAM,WAAW,yBAAyB;IACzC,QAAQ,CAAC,UAAU,EAAE,8BAA8B,CAAC;IACpD,QAAQ,CAAC,YAAY,EAAE,aAAa,CAAC;IACrC,QAAQ,CAAC,YAAY,EAAE,SAAS,CAAC;IACjC,QAAQ,CAAC,MAAM,CAAC,EAAE,eAAe,CAAC;IAClC;;;OAGG;IACH,QAAQ,CAAC,yBAAyB,CAAC,EAAE,yBAAyB,CAAC;CAC/D;AACD;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,UAAU,CACvC,UAAU,EACV,iBAAiB,EACjB,sBAAsB,EACtB,yBAAyB,CACzB,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,yCAAyC,CACxD,mBAAmB,EAAE,uBAAuB,GAC1C,MAAM,CAGR;AAED,wBAAgB,mBAAmB,CAClC,OAAO,EAAE,aAAa,EACtB,YAAY,EAAE,MAAM,GAClB,eAAe,CA+DjB;AAED,wBAAgB,+BAA+B,CAAC,OAAO,EAAE,uBAAuB,GAAG,SAAS,CAE3F"}
1
+ {"version":3,"file":"codecs.d.ts","sourceRoot":"","sources":["../../../../src/feature-libraries/chunked-forest/codec/codecs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAE9E,OAAO,EACN,KAAK,SAAS,EACd,KAAK,iBAAiB,EACtB,KAAK,UAAU,EAEf,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAEN,K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CAAC;IAClC;;;OAGG;IACH,QAAQ,CAAC,yBAAyB,CAAC,EAAE,yBAAyB,CAAC;CAC/D;AACD;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,UAAU,CACvC,UAAU,EACV,iBAAiB,EACjB,sBAAsB,EACtB,yBAAyB,CACzB,CAAC;AAkBF,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,iBAAiB,GAAG,eAAe,CAgE/E;AAED,wBAAgB,+BAA+B,CAC9C,aAAa,EAAE,uBAAuB,GACpC,SAAS,CAEX"}
@@ -4,10 +4,10 @@
4
4
  */
5
5
  import { assert, unreachableCase } from "@fluidframework/core-utils/internal";
6
6
  import { makeVersionedValidatedCodec, } from "../../../codec/index.js";
7
- import { brandedNumberType, } from "../../../util/index.js";
7
+ import { brand, brandedNumberType, } from "../../../util/index.js";
8
8
  import { TreeCompressionStrategy, TreeCompressionStrategyExtended, } from "../../treeCompressionUtils.js";
9
9
  import { decode } from "./chunkDecoding.js";
10
- import { EncodedFieldBatch, validVersions } from "./format.js";
10
+ import { EncodedFieldBatch, validVersions, FieldBatchFormatVersion } from "./format.js";
11
11
  import { schemaCompressedEncode } from "./schemaBasedEncode.js";
12
12
  import { uncompressedEncode } from "./uncompressedEncode.js";
13
13
  const ChunkReferenceId = brandedNumberType({ multipleOf: 1, minimum: 0 });
@@ -16,11 +16,16 @@ const ChunkReferenceId = brandedNumberType({ multipleOf: 1, minimum: 0 });
16
16
  * @privateRemarks
17
17
  * TODO: makeFieldBatchCodec (and makeVersionDispatchingCodec transitively) should bake in this versionToFormat logic and the resulting codec can then support use with FluidClientVersion directly.
18
18
  */
19
- export function fluidVersionToFieldBatchCodecWriteVersion(minVersionForCollab) {
20
- // There is currently on only 1 version.
21
- return 1;
19
+ /**
20
+ * Convert a MinimumVersionForCollab to write version for {@link FieldBatchCodec}.
21
+ * @param clientVersion - The MinimumVersionForCollab to convert.
22
+ */
23
+ function clientVersionToFieldBatchVersion(clientVersion) {
24
+ // Currently, field batch codec only writes in version 1.
25
+ return brand(FieldBatchFormatVersion.v1);
22
26
  }
23
- export function makeFieldBatchCodec(options, writeVersion) {
27
+ export function makeFieldBatchCodec(options) {
28
+ const writeVersion = clientVersionToFieldBatchVersion(options.minVersionForCollab);
24
29
  // Note: it's important that the decode function is schema-agnostic for this strategy/layering to work, since
25
30
  // the schema that an op was encoded in doesn't necessarily match the current schema for the document (e.g. if
26
31
  // decode is being run on a client that just submitted a schema change, but the op is from another client who has
@@ -67,7 +72,7 @@ export function makeFieldBatchCodec(options, writeVersion) {
67
72
  },
68
73
  });
69
74
  }
70
- export function getCodecTreeForFieldBatchFormat(version) {
71
- return { name: "FieldBatch", version };
75
+ export function getCodecTreeForFieldBatchFormat(clientVersion) {
76
+ return { name: "FieldBatch", version: clientVersionToFieldBatchVersion(clientVersion) };
72
77
  }
73
78
  //# sourceMappingURL=codecs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"codecs.js","sourceRoot":"","sources":["../../../../src/feature-libraries/chunked-forest/codec/codecs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAG9E,OAAO,EAIN,2BAA2B,GAC3B,MAAM,yBAAyB,CAAC;AAOjC,OAAO,EACN,iBAAiB,GAGjB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACN,uBAAuB,EACvB,+BAA+B,GAE/B,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAgC,MAAM,aAAa,CAAC;AAC7F,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAQ7D,MAAM,gBAAgB,GAAG,iBAAiB,CAAmB,EAAE,UAAU,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,CA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,mFAAmF;wBACnF,OAAO,GAAG,kBAAkB,CAAC,IAAI,CAAC,CAAC;oBACpC,CAAC;oBAED,MAAM;gBACP;oBACC,eAAe,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;YACtC,CAAC;YAED,oDAAoD;YACpD,OAAO,OAAO,CAAC;QAChB,CAAC;QACD,MAAM,EAAE,CAAC,IAAuB,EAAE,OAAkC,EAAc,EAAE;YACnF,6CAA6C;YAC7C,OAAO,MAAM,CACZ,IAAI,EACJ;gBACC,YAAY,EAAE,OAAO,CAAC,YAAY;gBAClC,YAAY,EAAE,OAAO,CAAC,YAAY;aAClC,EACD,OAAO,CAAC,yBAAyB,CACjC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;QAClC,CAAC;KACD,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,+BAA+B,CAAC,OAAgC;IAC/E,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,CAAC;AACxC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport type { IIdCompressor, SessionId } from \"@fluidframework/id-compressor\";\n\nimport {\n\ttype CodecTree,\n\ttype ICodecOptions,\n\ttype IJsonCodec,\n\tmakeVersionedValidatedCodec,\n} from \"../../../codec/index.js\";\nimport {\n\tCursorLocationType,\n\ttype ITreeCursorSynchronous,\n\ttype SchemaAndPolicy,\n\ttype TreeChunk,\n} from \"../../../core/index.js\";\nimport {\n\tbrandedNumberType,\n\ttype Brand,\n\ttype JsonCompatibleReadOnly,\n} from \"../../../util/index.js\";\nimport {\n\tTreeCompressionStrategy,\n\tTreeCompressionStrategyExtended,\n\ttype TreeCompressionStrategyPrivate,\n} from \"../../treeCompressionUtils.js\";\n\nimport { decode } from \"./chunkDecoding.js\";\nimport type { FieldBatch } from \"./fieldBatch.js\";\nimport { EncodedFieldBatch, validVersions, type FieldBatchFormatVersion } from \"./format.js\";\nimport { schemaCompressedEncode } from \"./schemaBasedEncode.js\";\nimport { uncompressedEncode } from \"./uncompressedEncode.js\";\nimport type { MinimumVersionForCollab } from \"@fluidframework/runtime-definitions/internal\";\nimport type { IncrementalEncodingPolicy } from \"./incrementalEncodingPolicy.js\";\n\n/**\n * Reference ID for a chunk that is incrementally encoded.\n */\nexport type ChunkReferenceId = Brand<number, \"forest.ChunkReferenceId\">;\nconst ChunkReferenceId = brandedNumberType<ChunkReferenceId>({ multipleOf: 1, minimum: 0 });\n\n/**\n * Properties for incremental encoding.\n * Fields that support incremental encoding will encode their chunks separately by calling `encodeIncrementalField`.\n * @remarks\n * This supports features like incremental summarization where the summary from these fields can be re-used if\n * unchanged between summaries.\n * Note that each of these chunks that are incrementally encoded is fully self-describing (contain its own shapes\n * list and identifier table) and does not rely on context from its parent.\n */\nexport interface IncrementalEncoder {\n\t/**\n\t * Returns whether a node / field should be incrementally encoded.\n\t * @remarks See {@link IncrementalEncodingPolicy}.\n\t */\n\tshouldEncodeIncrementally: IncrementalEncodingPolicy;\n\t/**\n\t * Called to encode an incremental field at the cursor.\n\t * The chunks for this field are encoded separately from the main buffer.\n\t * @param cursor - The cursor pointing to the field to encode.\n\t * @param chunkEncoder - A function that encodes the contents of the passed chunk in the field.\n\t * @returns The reference IDs of the encoded chunks in the field.\n\t * This is used to retrieve the encoded chunks later.\n\t */\n\tencodeIncrementalField(\n\t\tcursor: ITreeCursorSynchronous,\n\t\tchunkEncoder: (chunk: TreeChunk) => EncodedFieldBatch,\n\t): ChunkReferenceId[];\n}\n\n/**\n * Properties for incremental decoding.\n *\n * Fields that had their chunks incrementally encoded will retrieve them by calling `getEncodedIncrementalChunk`.\n * @remarks\n * See {@link IncrementalEncoder} for more details.\n */\nexport interface IncrementalDecoder {\n\t/**\n\t * Called to decode an incremental chunk with the given reference ID.\n\t * @param referenceId - The reference ID of the chunk to decode.\n\t * @param chunkDecoder - A function that decodes the chunk.\n\t * @returns The decoded chunk.\n\t */\n\tdecodeIncrementalChunk(\n\t\treferenceId: ChunkReferenceId,\n\t\tchunkDecoder: (encoded: EncodedFieldBatch) => TreeChunk,\n\t): TreeChunk;\n}\n/**\n * Combines the properties of {@link IncrementalEncoder} and {@link IncrementalDecoder}.\n */\nexport interface IncrementalEncoderDecoder extends IncrementalEncoder, IncrementalDecoder {}\n\nexport interface FieldBatchEncodingContext {\n\treadonly encodeType: TreeCompressionStrategyPrivate;\n\treadonly idCompressor: IIdCompressor;\n\treadonly originatorId: SessionId;\n\treadonly schema?: SchemaAndPolicy;\n\t/**\n\t * An encoder / decoder for encoding and decoding of incremental fields.\n\t * This will be defined if incremental encoding is supported and enabled.\n\t */\n\treadonly incrementalEncoderDecoder?: IncrementalEncoderDecoder;\n}\n/**\n * @remarks\n * Fields in this batch currently don't have field schema for the root, which limits optimizations.\n */\nexport type FieldBatchCodec = IJsonCodec<\n\tFieldBatch,\n\tEncodedFieldBatch,\n\tJsonCompatibleReadOnly,\n\tFieldBatchEncodingContext\n>;\n\n/**\n * Get the write version for {@link makeFieldBatchCodec} based on the `minVersionForCollab` version.\n * @privateRemarks\n * TODO: makeFieldBatchCodec (and makeVersionDispatchingCodec transitively) should bake in this versionToFormat logic and the resulting codec can then support use with FluidClientVersion directly.\n */\nexport function fluidVersionToFieldBatchCodecWriteVersion(\n\tminVersionForCollab: MinimumVersionForCollab,\n): number {\n\t// There is currently on only 1 version.\n\treturn 1;\n}\n\nexport function makeFieldBatchCodec(\n\toptions: ICodecOptions,\n\twriteVersion: number,\n): FieldBatchCodec {\n\t// Note: it's important that the decode function is schema-agnostic for this strategy/layering to work, since\n\t// the schema that an op was encoded in doesn't necessarily match the current schema for the document (e.g. if\n\t// decode is being run on a client that just submitted a schema change, but the op is from another client who has\n\t// yet to receive that change).\n\tassert(\n\t\tvalidVersions.has(writeVersion),\n\t\t0x935 /* Invalid write version for FieldBatch codec */,\n\t);\n\n\t// TODO: use makeVersionDispatchingCodec to support adding more versions in the future.\n\treturn makeVersionedValidatedCodec(options, validVersions, EncodedFieldBatch, {\n\t\tencode: (data: FieldBatch, context: FieldBatchEncodingContext): EncodedFieldBatch => {\n\t\t\tfor (const cursor of data) {\n\t\t\t\tassert(\n\t\t\t\t\tcursor.mode === CursorLocationType.Fields,\n\t\t\t\t\t0x8a3 /* FieldBatch expects fields cursors */,\n\t\t\t\t);\n\t\t\t}\n\t\t\tlet encoded: EncodedFieldBatch;\n\t\t\tswitch (context.encodeType) {\n\t\t\t\tcase TreeCompressionStrategy.Uncompressed:\n\t\t\t\t\tencoded = uncompressedEncode(data);\n\t\t\t\t\tbreak;\n\t\t\t\tcase TreeCompressionStrategyExtended.CompressedIncremental:\n\t\t\t\tcase TreeCompressionStrategy.Compressed:\n\t\t\t\t\t// eslint-disable-next-line unicorn/prefer-ternary\n\t\t\t\t\tif (context.schema !== undefined) {\n\t\t\t\t\t\tencoded = schemaCompressedEncode(\n\t\t\t\t\t\t\tcontext.schema.schema,\n\t\t\t\t\t\t\tcontext.schema.policy,\n\t\t\t\t\t\t\tdata,\n\t\t\t\t\t\t\tcontext.idCompressor,\n\t\t\t\t\t\t\t// Incremental encoding is only supported for CompressedIncremental.\n\t\t\t\t\t\t\tcontext.encodeType === TreeCompressionStrategyExtended.CompressedIncremental\n\t\t\t\t\t\t\t\t? context.incrementalEncoderDecoder\n\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// TODO: consider enabling a somewhat compressed but not schema accelerated encode.\n\t\t\t\t\t\tencoded = uncompressedEncode(data);\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tunreachableCase(context.encodeType);\n\t\t\t}\n\n\t\t\t// TODO: consider checking input data was in schema.\n\t\t\treturn encoded;\n\t\t},\n\t\tdecode: (data: EncodedFieldBatch, context: FieldBatchEncodingContext): FieldBatch => {\n\t\t\t// TODO: consider checking data is in schema.\n\t\t\treturn decode(\n\t\t\t\tdata,\n\t\t\t\t{\n\t\t\t\t\tidCompressor: context.idCompressor,\n\t\t\t\t\toriginatorId: context.originatorId,\n\t\t\t\t},\n\t\t\t\tcontext.incrementalEncoderDecoder,\n\t\t\t).map((chunk) => chunk.cursor());\n\t\t},\n\t});\n}\n\nexport function getCodecTreeForFieldBatchFormat(version: FieldBatchFormatVersion): CodecTree {\n\treturn { name: \"FieldBatch\", version };\n}\n"]}
1
+ {"version":3,"file":"codecs.js","sourceRoot":"","sources":["../../../../src/feature-libraries/chunked-forest/codec/codecs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAG9E,OAAO,EAIN,2BAA2B,GAC3B,MAAM,yBAAyB,CAAC;AAOjC,OAAO,EACN,KAAK,EACL,iBAAiB,GAGjB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACN,uBAAuB,EACvB,+BAA+B,GAE/B,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AACxF,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAQ7D,MAAM,gBAAgB,GAAG,iBAAiB,CAAmB,EAAE,UAAU,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;AA6E5F;;;;GAIG;AACH;;;GAGG;AACH,SAAS,gCAAgC,CACxC,aAAsC;IAEtC,yDAAyD;IACzD,OAAO,KAAK,CAAC,uBAAuB,CAAC,EAAE,CAAC,CAAC;AAC1C,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,OAA0B;IAC7D,MAAM,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AAC,OAAO,CAAC,UAAU,CAAC,CAAC;YACtC,CAAC;YAED,oDAAoD;YACpD,OAAO,OAAO,CAAC;QAChB,CAAC;QACD,MAAM,EAAE,CAAC,IAAuB,EAAE,OAAkC,EAAc,EAAE;YACnF,6CAA6C;YAC7C,OAAO,MAAM,CACZ,IAAI,EACJ;gBACC,YAAY,EAAE,OAAO,CAAC,YAAY;gBAClC,YAAY,EAAE,OAAO,CAAC,YAAY;aAClC,EACD,OAAO,CAAC,yBAAyB,CACjC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;QAClC,CAAC;KACD,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,+BAA+B,CAC9C,aAAsC;IAEtC,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,gCAAgC,CAAC,aAAa,CAAC,EAAE,CAAC;AACzF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport type { IIdCompressor, SessionId } from \"@fluidframework/id-compressor\";\n\nimport {\n\ttype CodecTree,\n\ttype CodecWriteOptions,\n\ttype IJsonCodec,\n\tmakeVersionedValidatedCodec,\n} from \"../../../codec/index.js\";\nimport {\n\tCursorLocationType,\n\ttype ITreeCursorSynchronous,\n\ttype SchemaAndPolicy,\n\ttype TreeChunk,\n} from \"../../../core/index.js\";\nimport {\n\tbrand,\n\tbrandedNumberType,\n\ttype Brand,\n\ttype JsonCompatibleReadOnly,\n} from \"../../../util/index.js\";\nimport {\n\tTreeCompressionStrategy,\n\tTreeCompressionStrategyExtended,\n\ttype TreeCompressionStrategyPrivate,\n} from \"../../treeCompressionUtils.js\";\n\nimport { decode } from \"./chunkDecoding.js\";\nimport type { FieldBatch } from \"./fieldBatch.js\";\nimport { EncodedFieldBatch, validVersions, FieldBatchFormatVersion } from \"./format.js\";\nimport { schemaCompressedEncode } from \"./schemaBasedEncode.js\";\nimport { uncompressedEncode } from \"./uncompressedEncode.js\";\nimport type { MinimumVersionForCollab } from \"@fluidframework/runtime-definitions/internal\";\nimport type { IncrementalEncodingPolicy } from \"./incrementalEncodingPolicy.js\";\n\n/**\n * Reference ID for a chunk that is incrementally encoded.\n */\nexport type ChunkReferenceId = Brand<number, \"forest.ChunkReferenceId\">;\nconst ChunkReferenceId = brandedNumberType<ChunkReferenceId>({ multipleOf: 1, minimum: 0 });\n\n/**\n * Properties for incremental encoding.\n * Fields that support incremental encoding will encode their chunks separately by calling `encodeIncrementalField`.\n * @remarks\n * This supports features like incremental summarization where the summary from these fields can be re-used if\n * unchanged between summaries.\n * Note that each of these chunks that are incrementally encoded is fully self-describing (contain its own shapes\n * list and identifier table) and does not rely on context from its parent.\n */\nexport interface IncrementalEncoder {\n\t/**\n\t * Returns whether a node / field should be incrementally encoded.\n\t * @remarks See {@link IncrementalEncodingPolicy}.\n\t */\n\tshouldEncodeIncrementally: IncrementalEncodingPolicy;\n\t/**\n\t * Called to encode an incremental field at the cursor.\n\t * The chunks for this field are encoded separately from the main buffer.\n\t * @param cursor - The cursor pointing to the field to encode.\n\t * @param chunkEncoder - A function that encodes the contents of the passed chunk in the field.\n\t * @returns The reference IDs of the encoded chunks in the field.\n\t * This is used to retrieve the encoded chunks later.\n\t */\n\tencodeIncrementalField(\n\t\tcursor: ITreeCursorSynchronous,\n\t\tchunkEncoder: (chunk: TreeChunk) => EncodedFieldBatch,\n\t): ChunkReferenceId[];\n}\n\n/**\n * Properties for incremental decoding.\n *\n * Fields that had their chunks incrementally encoded will retrieve them by calling `getEncodedIncrementalChunk`.\n * @remarks\n * See {@link IncrementalEncoder} for more details.\n */\nexport interface IncrementalDecoder {\n\t/**\n\t * Called to decode an incremental chunk with the given reference ID.\n\t * @param referenceId - The reference ID of the chunk to decode.\n\t * @param chunkDecoder - A function that decodes the chunk.\n\t * @returns The decoded chunk.\n\t */\n\tdecodeIncrementalChunk(\n\t\treferenceId: ChunkReferenceId,\n\t\tchunkDecoder: (encoded: EncodedFieldBatch) => TreeChunk,\n\t): TreeChunk;\n}\n/**\n * Combines the properties of {@link IncrementalEncoder} and {@link IncrementalDecoder}.\n */\nexport interface IncrementalEncoderDecoder extends IncrementalEncoder, IncrementalDecoder {}\n\nexport interface FieldBatchEncodingContext {\n\treadonly encodeType: TreeCompressionStrategyPrivate;\n\treadonly idCompressor: IIdCompressor;\n\treadonly originatorId: SessionId;\n\treadonly schema?: SchemaAndPolicy;\n\t/**\n\t * An encoder / decoder for encoding and decoding of incremental fields.\n\t * This will be defined if incremental encoding is supported and enabled.\n\t */\n\treadonly incrementalEncoderDecoder?: IncrementalEncoderDecoder;\n}\n/**\n * @remarks\n * Fields in this batch currently don't have field schema for the root, which limits optimizations.\n */\nexport type FieldBatchCodec = IJsonCodec<\n\tFieldBatch,\n\tEncodedFieldBatch,\n\tJsonCompatibleReadOnly,\n\tFieldBatchEncodingContext\n>;\n\n/**\n * Get the write version for {@link makeFieldBatchCodec} based on the `minVersionForCollab` version.\n * @privateRemarks\n * TODO: makeFieldBatchCodec (and makeVersionDispatchingCodec transitively) should bake in this versionToFormat logic and the resulting codec can then support use with FluidClientVersion directly.\n */\n/**\n * Convert a MinimumVersionForCollab to write version for {@link FieldBatchCodec}.\n * @param clientVersion - The MinimumVersionForCollab to convert.\n */\nfunction clientVersionToFieldBatchVersion(\n\tclientVersion: MinimumVersionForCollab,\n): FieldBatchFormatVersion {\n\t// Currently, field batch codec only writes in version 1.\n\treturn brand(FieldBatchFormatVersion.v1);\n}\n\nexport function makeFieldBatchCodec(options: CodecWriteOptions): FieldBatchCodec {\n\tconst writeVersion = clientVersionToFieldBatchVersion(options.minVersionForCollab);\n\t// Note: it's important that the decode function is schema-agnostic for this strategy/layering to work, since\n\t// the schema that an op was encoded in doesn't necessarily match the current schema for the document (e.g. if\n\t// decode is being run on a client that just submitted a schema change, but the op is from another client who has\n\t// yet to receive that change).\n\tassert(\n\t\tvalidVersions.has(writeVersion),\n\t\t0x935 /* Invalid write version for FieldBatch codec */,\n\t);\n\n\t// TODO: use makeVersionDispatchingCodec to support adding more versions in the future.\n\treturn makeVersionedValidatedCodec(options, validVersions, EncodedFieldBatch, {\n\t\tencode: (data: FieldBatch, context: FieldBatchEncodingContext): EncodedFieldBatch => {\n\t\t\tfor (const cursor of data) {\n\t\t\t\tassert(\n\t\t\t\t\tcursor.mode === CursorLocationType.Fields,\n\t\t\t\t\t0x8a3 /* FieldBatch expects fields cursors */,\n\t\t\t\t);\n\t\t\t}\n\t\t\tlet encoded: EncodedFieldBatch;\n\t\t\tswitch (context.encodeType) {\n\t\t\t\tcase TreeCompressionStrategy.Uncompressed:\n\t\t\t\t\tencoded = uncompressedEncode(data);\n\t\t\t\t\tbreak;\n\t\t\t\tcase TreeCompressionStrategyExtended.CompressedIncremental:\n\t\t\t\tcase TreeCompressionStrategy.Compressed:\n\t\t\t\t\t// eslint-disable-next-line unicorn/prefer-ternary\n\t\t\t\t\tif (context.schema !== undefined) {\n\t\t\t\t\t\tencoded = schemaCompressedEncode(\n\t\t\t\t\t\t\tcontext.schema.schema,\n\t\t\t\t\t\t\tcontext.schema.policy,\n\t\t\t\t\t\t\tdata,\n\t\t\t\t\t\t\tcontext.idCompressor,\n\t\t\t\t\t\t\t// Incremental encoding is only supported for CompressedIncremental.\n\t\t\t\t\t\t\tcontext.encodeType === TreeCompressionStrategyExtended.CompressedIncremental\n\t\t\t\t\t\t\t\t? context.incrementalEncoderDecoder\n\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// TODO: consider enabling a somewhat compressed but not schema accelerated encode.\n\t\t\t\t\t\tencoded = uncompressedEncode(data);\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tunreachableCase(context.encodeType);\n\t\t\t}\n\n\t\t\t// TODO: consider checking input data was in schema.\n\t\t\treturn encoded;\n\t\t},\n\t\tdecode: (data: EncodedFieldBatch, context: FieldBatchEncodingContext): FieldBatch => {\n\t\t\t// TODO: consider checking data is in schema.\n\t\t\treturn decode(\n\t\t\t\tdata,\n\t\t\t\t{\n\t\t\t\t\tidCompressor: context.idCompressor,\n\t\t\t\t\toriginatorId: context.originatorId,\n\t\t\t\t},\n\t\t\t\tcontext.incrementalEncoderDecoder,\n\t\t\t).map((chunk) => chunk.cursor());\n\t\t},\n\t});\n}\n\nexport function getCodecTreeForFieldBatchFormat(\n\tclientVersion: MinimumVersionForCollab,\n): CodecTree {\n\treturn { name: \"FieldBatch\", version: clientVersionToFieldBatchVersion(clientVersion) };\n}\n"]}