@fluidframework/tree 2.71.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 (603) hide show
  1. package/CHANGELOG.md +26 -40
  2. package/api-report/tree.alpha.api.md +27 -18
  3. package/api-report/tree.beta.api.md +42 -0
  4. package/api-report/tree.legacy.beta.api.md +42 -0
  5. package/dist/alpha.d.ts +9 -7
  6. package/dist/api.js +1 -1
  7. package/dist/api.js.map +1 -1
  8. package/dist/beta.d.ts +7 -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/core/index.d.ts +1 -1
  14. package/dist/core/index.d.ts.map +1 -1
  15. package/dist/core/index.js +2 -2
  16. package/dist/core/index.js.map +1 -1
  17. package/dist/core/schema-stored/index.d.ts +1 -1
  18. package/dist/core/schema-stored/index.d.ts.map +1 -1
  19. package/dist/core/schema-stored/index.js +2 -2
  20. package/dist/core/schema-stored/index.js.map +1 -1
  21. package/dist/core/schema-stored/schema.d.ts +6 -6
  22. package/dist/core/schema-stored/schema.d.ts.map +1 -1
  23. package/dist/core/schema-stored/schema.js +6 -7
  24. package/dist/core/schema-stored/schema.js.map +1 -1
  25. package/dist/core/tree/detachedFieldIndexCodecCommon.d.ts +2 -1
  26. package/dist/core/tree/detachedFieldIndexCodecCommon.d.ts.map +1 -1
  27. package/dist/core/tree/detachedFieldIndexCodecCommon.js.map +1 -1
  28. package/dist/core/tree/detachedFieldIndexCodecV1.d.ts +1 -1
  29. package/dist/core/tree/detachedFieldIndexCodecV1.d.ts.map +1 -1
  30. package/dist/core/tree/detachedFieldIndexCodecV1.js +3 -2
  31. package/dist/core/tree/detachedFieldIndexCodecV1.js.map +1 -1
  32. package/dist/core/tree/detachedFieldIndexCodecV2.d.ts.map +1 -1
  33. package/dist/core/tree/detachedFieldIndexCodecV2.js +3 -1
  34. package/dist/core/tree/detachedFieldIndexCodecV2.js.map +1 -1
  35. package/dist/core/tree/detachedFieldIndexCodecs.d.ts +2 -3
  36. package/dist/core/tree/detachedFieldIndexCodecs.d.ts.map +1 -1
  37. package/dist/core/tree/detachedFieldIndexCodecs.js +29 -8
  38. package/dist/core/tree/detachedFieldIndexCodecs.js.map +1 -1
  39. package/dist/core/tree/detachedFieldIndexFormatCommon.d.ts +10 -1
  40. package/dist/core/tree/detachedFieldIndexFormatCommon.d.ts.map +1 -1
  41. package/dist/core/tree/detachedFieldIndexFormatCommon.js +8 -1
  42. package/dist/core/tree/detachedFieldIndexFormatCommon.js.map +1 -1
  43. package/dist/core/tree/detachedFieldIndexFormatV1.d.ts +2 -2
  44. package/dist/core/tree/detachedFieldIndexFormatV1.d.ts.map +1 -1
  45. package/dist/core/tree/detachedFieldIndexFormatV1.js +3 -3
  46. package/dist/core/tree/detachedFieldIndexFormatV1.js.map +1 -1
  47. package/dist/core/tree/detachedFieldIndexFormatV2.d.ts +2 -2
  48. package/dist/core/tree/detachedFieldIndexFormatV2.d.ts.map +1 -1
  49. package/dist/core/tree/detachedFieldIndexFormatV2.js +3 -3
  50. package/dist/core/tree/detachedFieldIndexFormatV2.js.map +1 -1
  51. package/dist/core/tree/index.d.ts +2 -1
  52. package/dist/core/tree/index.d.ts.map +1 -1
  53. package/dist/core/tree/index.js.map +1 -1
  54. package/dist/external-utilities/typeboxValidator.js +1 -1
  55. package/dist/external-utilities/typeboxValidator.js.map +1 -1
  56. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts +4 -10
  57. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  58. package/dist/feature-libraries/chunked-forest/codec/codecs.js +12 -8
  59. package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  60. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +1 -1
  61. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  62. package/dist/feature-libraries/chunked-forest/codec/format.d.ts +8 -3
  63. package/dist/feature-libraries/chunked-forest/codec/format.d.ts.map +1 -1
  64. package/dist/feature-libraries/chunked-forest/codec/format.js +9 -4
  65. package/dist/feature-libraries/chunked-forest/codec/format.js.map +1 -1
  66. package/dist/feature-libraries/chunked-forest/codec/index.d.ts +2 -2
  67. package/dist/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
  68. package/dist/feature-libraries/chunked-forest/codec/index.js +1 -2
  69. package/dist/feature-libraries/chunked-forest/codec/index.js.map +1 -1
  70. package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.d.ts.map +1 -1
  71. package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.js +1 -1
  72. package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.js.map +1 -1
  73. package/dist/feature-libraries/chunked-forest/index.d.ts +1 -1
  74. package/dist/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  75. package/dist/feature-libraries/chunked-forest/index.js +1 -2
  76. package/dist/feature-libraries/chunked-forest/index.js.map +1 -1
  77. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts +1 -9
  78. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  79. package/dist/feature-libraries/default-schema/defaultFieldKinds.js +3 -21
  80. package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  81. package/dist/feature-libraries/forest-summary/codec.d.ts +4 -5
  82. package/dist/feature-libraries/forest-summary/codec.d.ts.map +1 -1
  83. package/dist/feature-libraries/forest-summary/codec.js +15 -4
  84. package/dist/feature-libraries/forest-summary/codec.js.map +1 -1
  85. package/dist/feature-libraries/forest-summary/forestSummarizer.js +1 -1
  86. package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  87. package/dist/feature-libraries/forest-summary/format.d.ts +8 -1
  88. package/dist/feature-libraries/forest-summary/format.d.ts.map +1 -1
  89. package/dist/feature-libraries/forest-summary/format.js +8 -3
  90. package/dist/feature-libraries/forest-summary/format.js.map +1 -1
  91. package/dist/feature-libraries/forest-summary/index.d.ts +2 -1
  92. package/dist/feature-libraries/forest-summary/index.d.ts.map +1 -1
  93. package/dist/feature-libraries/forest-summary/index.js +3 -1
  94. package/dist/feature-libraries/forest-summary/index.js.map +1 -1
  95. package/dist/feature-libraries/index.d.ts +3 -3
  96. package/dist/feature-libraries/index.d.ts.map +1 -1
  97. package/dist/feature-libraries/index.js +2 -2
  98. package/dist/feature-libraries/index.js.map +1 -1
  99. package/dist/feature-libraries/schema-edits/index.d.ts +1 -1
  100. package/dist/feature-libraries/schema-edits/index.d.ts.map +1 -1
  101. package/dist/feature-libraries/schema-edits/index.js.map +1 -1
  102. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.d.ts +6 -7
  103. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
  104. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js +5 -4
  105. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
  106. package/dist/feature-libraries/schema-index/codec.d.ts +10 -10
  107. package/dist/feature-libraries/schema-index/codec.d.ts.map +1 -1
  108. package/dist/feature-libraries/schema-index/codec.js +22 -18
  109. package/dist/feature-libraries/schema-index/codec.js.map +1 -1
  110. package/dist/feature-libraries/schema-index/formatV1.d.ts +2 -2
  111. package/dist/feature-libraries/schema-index/formatV1.d.ts.map +1 -1
  112. package/dist/feature-libraries/schema-index/formatV1.js +1 -1
  113. package/dist/feature-libraries/schema-index/formatV1.js.map +1 -1
  114. package/dist/feature-libraries/schema-index/formatV2.d.ts +1 -2
  115. package/dist/feature-libraries/schema-index/formatV2.d.ts.map +1 -1
  116. package/dist/feature-libraries/schema-index/formatV2.js +1 -1
  117. package/dist/feature-libraries/schema-index/formatV2.js.map +1 -1
  118. package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts +2 -2
  119. package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
  120. package/dist/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
  121. package/dist/index.d.ts +1 -1
  122. package/dist/index.d.ts.map +1 -1
  123. package/dist/index.js +3 -1
  124. package/dist/index.js.map +1 -1
  125. package/dist/legacy.d.ts +7 -0
  126. package/dist/packageVersion.d.ts +1 -1
  127. package/dist/packageVersion.js +1 -1
  128. package/dist/packageVersion.js.map +1 -1
  129. package/dist/shared-tree/independentView.d.ts +1 -1
  130. package/dist/shared-tree/independentView.d.ts.map +1 -1
  131. package/dist/shared-tree/independentView.js +22 -15
  132. package/dist/shared-tree/independentView.js.map +1 -1
  133. package/dist/shared-tree/sharedTree.d.ts +12 -16
  134. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  135. package/dist/shared-tree/sharedTree.js +87 -127
  136. package/dist/shared-tree/sharedTree.js.map +1 -1
  137. package/dist/shared-tree/sharedTreeChangeCodecs.d.ts +7 -6
  138. package/dist/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  139. package/dist/shared-tree/sharedTreeChangeCodecs.js +12 -11
  140. package/dist/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  141. package/dist/shared-tree/sharedTreeChangeFamily.d.ts +2 -2
  142. package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  143. package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  144. package/dist/shared-tree/treeAlpha.d.ts +1 -1
  145. package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
  146. package/dist/shared-tree/treeAlpha.js +4 -2
  147. package/dist/shared-tree/treeAlpha.js.map +1 -1
  148. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  149. package/dist/shared-tree/treeCheckout.js +1 -3
  150. package/dist/shared-tree/treeCheckout.js.map +1 -1
  151. package/dist/shared-tree-core/editManagerCodecs.d.ts +19 -6
  152. package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  153. package/dist/shared-tree-core/editManagerCodecs.js +35 -17
  154. package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
  155. package/dist/shared-tree-core/editManagerFormatCommons.d.ts +37 -0
  156. package/dist/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
  157. package/dist/shared-tree-core/editManagerFormatCommons.js +43 -1
  158. package/dist/shared-tree-core/editManagerFormatCommons.js.map +1 -1
  159. package/dist/shared-tree-core/editManagerFormatV1toV4.d.ts +2 -2
  160. package/dist/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -1
  161. package/dist/shared-tree-core/editManagerFormatV1toV4.js +4 -4
  162. package/dist/shared-tree-core/editManagerFormatV1toV4.js.map +1 -1
  163. package/dist/shared-tree-core/editManagerFormatV5.d.ts +2 -2
  164. package/dist/shared-tree-core/editManagerFormatV5.d.ts.map +1 -1
  165. package/dist/shared-tree-core/editManagerFormatV5.js +1 -1
  166. package/dist/shared-tree-core/editManagerFormatV5.js.map +1 -1
  167. package/dist/shared-tree-core/index.d.ts +5 -3
  168. package/dist/shared-tree-core/index.d.ts.map +1 -1
  169. package/dist/shared-tree-core/index.js +11 -3
  170. package/dist/shared-tree-core/index.js.map +1 -1
  171. package/dist/shared-tree-core/messageCodecV1ToV4.d.ts +2 -1
  172. package/dist/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
  173. package/dist/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
  174. package/dist/shared-tree-core/messageCodecV5.d.ts +2 -1
  175. package/dist/shared-tree-core/messageCodecV5.d.ts.map +1 -1
  176. package/dist/shared-tree-core/messageCodecV5.js.map +1 -1
  177. package/dist/shared-tree-core/messageCodecs.d.ts +19 -6
  178. package/dist/shared-tree-core/messageCodecs.d.ts.map +1 -1
  179. package/dist/shared-tree-core/messageCodecs.js +38 -21
  180. package/dist/shared-tree-core/messageCodecs.js.map +1 -1
  181. package/dist/shared-tree-core/messageFormat.d.ts +50 -0
  182. package/dist/shared-tree-core/messageFormat.d.ts.map +1 -0
  183. package/dist/shared-tree-core/messageFormat.js +51 -0
  184. package/dist/shared-tree-core/messageFormat.js.map +1 -0
  185. package/dist/shared-tree-core/sharedTreeCore.d.ts +8 -8
  186. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  187. package/dist/shared-tree-core/sharedTreeCore.js +3 -3
  188. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  189. package/dist/simple-tree/api/discrepancies.d.ts +2 -2
  190. package/dist/simple-tree/api/discrepancies.js.map +1 -1
  191. package/dist/simple-tree/api/incrementalAllowedTypes.d.ts +1 -1
  192. package/dist/simple-tree/api/incrementalAllowedTypes.js +1 -1
  193. package/dist/simple-tree/api/incrementalAllowedTypes.js.map +1 -1
  194. package/dist/simple-tree/api/index.d.ts +3 -2
  195. package/dist/simple-tree/api/index.d.ts.map +1 -1
  196. package/dist/simple-tree/api/index.js +4 -1
  197. package/dist/simple-tree/api/index.js.map +1 -1
  198. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +2 -98
  199. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  200. package/dist/simple-tree/api/schemaFactoryAlpha.js +1 -52
  201. package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  202. package/dist/simple-tree/api/schemaFactoryBeta.d.ts +98 -2
  203. package/dist/simple-tree/api/schemaFactoryBeta.d.ts.map +1 -1
  204. package/dist/simple-tree/api/schemaFactoryBeta.js +61 -7
  205. package/dist/simple-tree/api/schemaFactoryBeta.js.map +1 -1
  206. package/dist/simple-tree/api/schemaFromSimple.js +6 -3
  207. package/dist/simple-tree/api/schemaFromSimple.js.map +1 -1
  208. package/dist/simple-tree/api/simpleSchemaCodec.d.ts +28 -0
  209. package/dist/simple-tree/api/simpleSchemaCodec.d.ts.map +1 -0
  210. package/dist/simple-tree/api/simpleSchemaCodec.js +292 -0
  211. package/dist/simple-tree/api/simpleSchemaCodec.js.map +1 -0
  212. package/dist/simple-tree/api/storedSchema.d.ts +2 -2
  213. package/dist/simple-tree/api/storedSchema.d.ts.map +1 -1
  214. package/dist/simple-tree/api/storedSchema.js +8 -6
  215. package/dist/simple-tree/api/storedSchema.js.map +1 -1
  216. package/dist/simple-tree/api/tree.d.ts +2 -2
  217. package/dist/simple-tree/api/tree.js.map +1 -1
  218. package/dist/simple-tree/api/typesUnsafe.d.ts +6 -6
  219. package/dist/simple-tree/api/typesUnsafe.js.map +1 -1
  220. package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts +18 -3
  221. package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
  222. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js +78 -35
  223. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
  224. package/dist/simple-tree/core/allowedTypes.d.ts +3 -3
  225. package/dist/simple-tree/core/allowedTypes.js +1 -1
  226. package/dist/simple-tree/core/allowedTypes.js.map +1 -1
  227. package/dist/simple-tree/core/treeNode.js +1 -1
  228. package/dist/simple-tree/core/treeNode.js.map +1 -1
  229. package/dist/simple-tree/index.d.ts +2 -1
  230. package/dist/simple-tree/index.d.ts.map +1 -1
  231. package/dist/simple-tree/index.js +4 -0
  232. package/dist/simple-tree/index.js.map +1 -1
  233. package/dist/simple-tree/node-kinds/array/arrayNode.js +1 -1
  234. package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  235. package/dist/simple-tree/node-kinds/map/mapNode.js +1 -1
  236. package/dist/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  237. package/dist/simple-tree/node-kinds/object/objectNode.js +2 -2
  238. package/dist/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  239. package/dist/simple-tree/node-kinds/record/recordNode.js +2 -2
  240. package/dist/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  241. package/dist/simple-tree/simpleSchema.d.ts +11 -3
  242. package/dist/simple-tree/simpleSchema.d.ts.map +1 -1
  243. package/dist/simple-tree/simpleSchema.js.map +1 -1
  244. package/dist/simple-tree/simpleSchemaFormatV1.d.ts +249 -0
  245. package/dist/simple-tree/simpleSchemaFormatV1.d.ts.map +1 -0
  246. package/dist/simple-tree/simpleSchemaFormatV1.js +115 -0
  247. package/dist/simple-tree/simpleSchemaFormatV1.js.map +1 -0
  248. package/dist/tableSchema.d.ts.map +1 -1
  249. package/dist/tableSchema.js +1 -1
  250. package/dist/tableSchema.js.map +1 -1
  251. package/dist/treeFactory.d.ts +3 -1
  252. package/dist/treeFactory.d.ts.map +1 -1
  253. package/dist/treeFactory.js +26 -2
  254. package/dist/treeFactory.js.map +1 -1
  255. package/dist/util/brand.d.ts +31 -2
  256. package/dist/util/brand.d.ts.map +1 -1
  257. package/dist/util/brand.js +28 -2
  258. package/dist/util/brand.js.map +1 -1
  259. package/dist/util/brandedMap.d.ts +3 -1
  260. package/dist/util/brandedMap.d.ts.map +1 -1
  261. package/dist/util/brandedMap.js.map +1 -1
  262. package/dist/util/index.d.ts +1 -1
  263. package/dist/util/index.d.ts.map +1 -1
  264. package/dist/util/index.js +3 -2
  265. package/dist/util/index.js.map +1 -1
  266. package/lib/alpha.d.ts +9 -7
  267. package/lib/api.js +2 -2
  268. package/lib/api.js.map +1 -1
  269. package/lib/beta.d.ts +7 -0
  270. package/lib/codec/codec.d.ts +16 -1
  271. package/lib/codec/codec.d.ts.map +1 -1
  272. package/lib/codec/codec.js +16 -3
  273. package/lib/codec/codec.js.map +1 -1
  274. package/lib/core/index.d.ts +1 -1
  275. package/lib/core/index.d.ts.map +1 -1
  276. package/lib/core/index.js +1 -1
  277. package/lib/core/index.js.map +1 -1
  278. package/lib/core/schema-stored/index.d.ts +1 -1
  279. package/lib/core/schema-stored/index.d.ts.map +1 -1
  280. package/lib/core/schema-stored/index.js +1 -1
  281. package/lib/core/schema-stored/index.js.map +1 -1
  282. package/lib/core/schema-stored/schema.d.ts +6 -6
  283. package/lib/core/schema-stored/schema.d.ts.map +1 -1
  284. package/lib/core/schema-stored/schema.js +6 -7
  285. package/lib/core/schema-stored/schema.js.map +1 -1
  286. package/lib/core/tree/detachedFieldIndexCodecCommon.d.ts +2 -1
  287. package/lib/core/tree/detachedFieldIndexCodecCommon.d.ts.map +1 -1
  288. package/lib/core/tree/detachedFieldIndexCodecCommon.js.map +1 -1
  289. package/lib/core/tree/detachedFieldIndexCodecV1.d.ts +1 -1
  290. package/lib/core/tree/detachedFieldIndexCodecV1.d.ts.map +1 -1
  291. package/lib/core/tree/detachedFieldIndexCodecV1.js +3 -2
  292. package/lib/core/tree/detachedFieldIndexCodecV1.js.map +1 -1
  293. package/lib/core/tree/detachedFieldIndexCodecV2.d.ts.map +1 -1
  294. package/lib/core/tree/detachedFieldIndexCodecV2.js +4 -2
  295. package/lib/core/tree/detachedFieldIndexCodecV2.js.map +1 -1
  296. package/lib/core/tree/detachedFieldIndexCodecs.d.ts +2 -3
  297. package/lib/core/tree/detachedFieldIndexCodecs.d.ts.map +1 -1
  298. package/lib/core/tree/detachedFieldIndexCodecs.js +29 -8
  299. package/lib/core/tree/detachedFieldIndexCodecs.js.map +1 -1
  300. package/lib/core/tree/detachedFieldIndexFormatCommon.d.ts +10 -1
  301. package/lib/core/tree/detachedFieldIndexFormatCommon.d.ts.map +1 -1
  302. package/lib/core/tree/detachedFieldIndexFormatCommon.js +7 -0
  303. package/lib/core/tree/detachedFieldIndexFormatCommon.js.map +1 -1
  304. package/lib/core/tree/detachedFieldIndexFormatV1.d.ts +2 -2
  305. package/lib/core/tree/detachedFieldIndexFormatV1.d.ts.map +1 -1
  306. package/lib/core/tree/detachedFieldIndexFormatV1.js +3 -3
  307. package/lib/core/tree/detachedFieldIndexFormatV1.js.map +1 -1
  308. package/lib/core/tree/detachedFieldIndexFormatV2.d.ts +2 -2
  309. package/lib/core/tree/detachedFieldIndexFormatV2.d.ts.map +1 -1
  310. package/lib/core/tree/detachedFieldIndexFormatV2.js +3 -3
  311. package/lib/core/tree/detachedFieldIndexFormatV2.js.map +1 -1
  312. package/lib/core/tree/index.d.ts +2 -1
  313. package/lib/core/tree/index.d.ts.map +1 -1
  314. package/lib/core/tree/index.js +1 -1
  315. package/lib/core/tree/index.js.map +1 -1
  316. package/lib/external-utilities/typeboxValidator.js +1 -1
  317. package/lib/external-utilities/typeboxValidator.js.map +1 -1
  318. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts +4 -10
  319. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  320. package/lib/feature-libraries/chunked-forest/codec/codecs.js +13 -8
  321. package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  322. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +2 -2
  323. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  324. package/lib/feature-libraries/chunked-forest/codec/format.d.ts +8 -3
  325. package/lib/feature-libraries/chunked-forest/codec/format.d.ts.map +1 -1
  326. package/lib/feature-libraries/chunked-forest/codec/format.js +8 -3
  327. package/lib/feature-libraries/chunked-forest/codec/format.js.map +1 -1
  328. package/lib/feature-libraries/chunked-forest/codec/index.d.ts +2 -2
  329. package/lib/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
  330. package/lib/feature-libraries/chunked-forest/codec/index.js +2 -2
  331. package/lib/feature-libraries/chunked-forest/codec/index.js.map +1 -1
  332. package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.d.ts.map +1 -1
  333. package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.js +2 -2
  334. package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.js.map +1 -1
  335. package/lib/feature-libraries/chunked-forest/index.d.ts +1 -1
  336. package/lib/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  337. package/lib/feature-libraries/chunked-forest/index.js +1 -1
  338. package/lib/feature-libraries/chunked-forest/index.js.map +1 -1
  339. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts +1 -9
  340. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  341. package/lib/feature-libraries/default-schema/defaultFieldKinds.js +2 -20
  342. package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  343. package/lib/feature-libraries/forest-summary/codec.d.ts +4 -5
  344. package/lib/feature-libraries/forest-summary/codec.d.ts.map +1 -1
  345. package/lib/feature-libraries/forest-summary/codec.js +16 -5
  346. package/lib/feature-libraries/forest-summary/codec.js.map +1 -1
  347. package/lib/feature-libraries/forest-summary/forestSummarizer.js +1 -1
  348. package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  349. package/lib/feature-libraries/forest-summary/format.d.ts +8 -1
  350. package/lib/feature-libraries/forest-summary/format.d.ts.map +1 -1
  351. package/lib/feature-libraries/forest-summary/format.js +7 -2
  352. package/lib/feature-libraries/forest-summary/format.js.map +1 -1
  353. package/lib/feature-libraries/forest-summary/index.d.ts +2 -1
  354. package/lib/feature-libraries/forest-summary/index.d.ts.map +1 -1
  355. package/lib/feature-libraries/forest-summary/index.js +1 -0
  356. package/lib/feature-libraries/forest-summary/index.js.map +1 -1
  357. package/lib/feature-libraries/index.d.ts +3 -3
  358. package/lib/feature-libraries/index.d.ts.map +1 -1
  359. package/lib/feature-libraries/index.js +2 -2
  360. package/lib/feature-libraries/index.js.map +1 -1
  361. package/lib/feature-libraries/schema-edits/index.d.ts +1 -1
  362. package/lib/feature-libraries/schema-edits/index.d.ts.map +1 -1
  363. package/lib/feature-libraries/schema-edits/index.js.map +1 -1
  364. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.d.ts +6 -7
  365. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
  366. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js +6 -5
  367. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
  368. package/lib/feature-libraries/schema-index/codec.d.ts +10 -10
  369. package/lib/feature-libraries/schema-index/codec.d.ts.map +1 -1
  370. package/lib/feature-libraries/schema-index/codec.js +24 -20
  371. package/lib/feature-libraries/schema-index/codec.js.map +1 -1
  372. package/lib/feature-libraries/schema-index/formatV1.d.ts +2 -2
  373. package/lib/feature-libraries/schema-index/formatV1.d.ts.map +1 -1
  374. package/lib/feature-libraries/schema-index/formatV1.js +2 -2
  375. package/lib/feature-libraries/schema-index/formatV1.js.map +1 -1
  376. package/lib/feature-libraries/schema-index/formatV2.d.ts +1 -2
  377. package/lib/feature-libraries/schema-index/formatV2.d.ts.map +1 -1
  378. package/lib/feature-libraries/schema-index/formatV2.js +2 -2
  379. package/lib/feature-libraries/schema-index/formatV2.js.map +1 -1
  380. package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts +2 -2
  381. package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
  382. package/lib/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
  383. package/lib/index.d.ts +1 -1
  384. package/lib/index.d.ts.map +1 -1
  385. package/lib/index.js +1 -1
  386. package/lib/index.js.map +1 -1
  387. package/lib/legacy.d.ts +7 -0
  388. package/lib/packageVersion.d.ts +1 -1
  389. package/lib/packageVersion.js +1 -1
  390. package/lib/packageVersion.js.map +1 -1
  391. package/lib/shared-tree/independentView.d.ts +1 -1
  392. package/lib/shared-tree/independentView.d.ts.map +1 -1
  393. package/lib/shared-tree/independentView.js +11 -4
  394. package/lib/shared-tree/independentView.js.map +1 -1
  395. package/lib/shared-tree/sharedTree.d.ts +12 -16
  396. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  397. package/lib/shared-tree/sharedTree.js +90 -130
  398. package/lib/shared-tree/sharedTree.js.map +1 -1
  399. package/lib/shared-tree/sharedTreeChangeCodecs.d.ts +7 -6
  400. package/lib/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  401. package/lib/shared-tree/sharedTreeChangeCodecs.js +7 -6
  402. package/lib/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  403. package/lib/shared-tree/sharedTreeChangeFamily.d.ts +2 -2
  404. package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  405. package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  406. package/lib/shared-tree/treeAlpha.d.ts +1 -1
  407. package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
  408. package/lib/shared-tree/treeAlpha.js +5 -3
  409. package/lib/shared-tree/treeAlpha.js.map +1 -1
  410. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  411. package/lib/shared-tree/treeCheckout.js +1 -3
  412. package/lib/shared-tree/treeCheckout.js.map +1 -1
  413. package/lib/shared-tree-core/editManagerCodecs.d.ts +19 -6
  414. package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  415. package/lib/shared-tree-core/editManagerCodecs.js +32 -16
  416. package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
  417. package/lib/shared-tree-core/editManagerFormatCommons.d.ts +37 -0
  418. package/lib/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
  419. package/lib/shared-tree-core/editManagerFormatCommons.js +42 -0
  420. package/lib/shared-tree-core/editManagerFormatCommons.js.map +1 -1
  421. package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts +2 -2
  422. package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -1
  423. package/lib/shared-tree-core/editManagerFormatV1toV4.js +5 -5
  424. package/lib/shared-tree-core/editManagerFormatV1toV4.js.map +1 -1
  425. package/lib/shared-tree-core/editManagerFormatV5.d.ts +2 -2
  426. package/lib/shared-tree-core/editManagerFormatV5.d.ts.map +1 -1
  427. package/lib/shared-tree-core/editManagerFormatV5.js +2 -2
  428. package/lib/shared-tree-core/editManagerFormatV5.js.map +1 -1
  429. package/lib/shared-tree-core/index.d.ts +5 -3
  430. package/lib/shared-tree-core/index.d.ts.map +1 -1
  431. package/lib/shared-tree-core/index.js +4 -2
  432. package/lib/shared-tree-core/index.js.map +1 -1
  433. package/lib/shared-tree-core/messageCodecV1ToV4.d.ts +2 -1
  434. package/lib/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
  435. package/lib/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
  436. package/lib/shared-tree-core/messageCodecV5.d.ts +2 -1
  437. package/lib/shared-tree-core/messageCodecV5.d.ts.map +1 -1
  438. package/lib/shared-tree-core/messageCodecV5.js.map +1 -1
  439. package/lib/shared-tree-core/messageCodecs.d.ts +19 -6
  440. package/lib/shared-tree-core/messageCodecs.d.ts.map +1 -1
  441. package/lib/shared-tree-core/messageCodecs.js +35 -20
  442. package/lib/shared-tree-core/messageCodecs.js.map +1 -1
  443. package/lib/shared-tree-core/messageFormat.d.ts +50 -0
  444. package/lib/shared-tree-core/messageFormat.d.ts.map +1 -0
  445. package/lib/shared-tree-core/messageFormat.js +48 -0
  446. package/lib/shared-tree-core/messageFormat.js.map +1 -0
  447. package/lib/shared-tree-core/sharedTreeCore.d.ts +8 -8
  448. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  449. package/lib/shared-tree-core/sharedTreeCore.js +3 -3
  450. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  451. package/lib/simple-tree/api/discrepancies.d.ts +2 -2
  452. package/lib/simple-tree/api/discrepancies.js.map +1 -1
  453. package/lib/simple-tree/api/incrementalAllowedTypes.d.ts +1 -1
  454. package/lib/simple-tree/api/incrementalAllowedTypes.js +1 -1
  455. package/lib/simple-tree/api/incrementalAllowedTypes.js.map +1 -1
  456. package/lib/simple-tree/api/index.d.ts +3 -2
  457. package/lib/simple-tree/api/index.d.ts.map +1 -1
  458. package/lib/simple-tree/api/index.js +1 -0
  459. package/lib/simple-tree/api/index.js.map +1 -1
  460. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +2 -98
  461. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  462. package/lib/simple-tree/api/schemaFactoryAlpha.js +1 -52
  463. package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  464. package/lib/simple-tree/api/schemaFactoryBeta.d.ts +98 -2
  465. package/lib/simple-tree/api/schemaFactoryBeta.d.ts.map +1 -1
  466. package/lib/simple-tree/api/schemaFactoryBeta.js +58 -4
  467. package/lib/simple-tree/api/schemaFactoryBeta.js.map +1 -1
  468. package/lib/simple-tree/api/schemaFromSimple.js +6 -3
  469. package/lib/simple-tree/api/schemaFromSimple.js.map +1 -1
  470. package/lib/simple-tree/api/simpleSchemaCodec.d.ts +28 -0
  471. package/lib/simple-tree/api/simpleSchemaCodec.d.ts.map +1 -0
  472. package/lib/simple-tree/api/simpleSchemaCodec.js +264 -0
  473. package/lib/simple-tree/api/simpleSchemaCodec.js.map +1 -0
  474. package/lib/simple-tree/api/storedSchema.d.ts +2 -2
  475. package/lib/simple-tree/api/storedSchema.d.ts.map +1 -1
  476. package/lib/simple-tree/api/storedSchema.js +5 -3
  477. package/lib/simple-tree/api/storedSchema.js.map +1 -1
  478. package/lib/simple-tree/api/tree.d.ts +2 -2
  479. package/lib/simple-tree/api/tree.js.map +1 -1
  480. package/lib/simple-tree/api/typesUnsafe.d.ts +6 -6
  481. package/lib/simple-tree/api/typesUnsafe.js.map +1 -1
  482. package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts +18 -3
  483. package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
  484. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js +75 -34
  485. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
  486. package/lib/simple-tree/core/allowedTypes.d.ts +3 -3
  487. package/lib/simple-tree/core/allowedTypes.js +1 -1
  488. package/lib/simple-tree/core/allowedTypes.js.map +1 -1
  489. package/lib/simple-tree/core/treeNode.js +1 -1
  490. package/lib/simple-tree/core/treeNode.js.map +1 -1
  491. package/lib/simple-tree/index.d.ts +2 -1
  492. package/lib/simple-tree/index.d.ts.map +1 -1
  493. package/lib/simple-tree/index.js +1 -0
  494. package/lib/simple-tree/index.js.map +1 -1
  495. package/lib/simple-tree/node-kinds/array/arrayNode.js +2 -2
  496. package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  497. package/lib/simple-tree/node-kinds/map/mapNode.js +2 -2
  498. package/lib/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  499. package/lib/simple-tree/node-kinds/object/objectNode.js +3 -3
  500. package/lib/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  501. package/lib/simple-tree/node-kinds/record/recordNode.js +3 -3
  502. package/lib/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  503. package/lib/simple-tree/simpleSchema.d.ts +11 -3
  504. package/lib/simple-tree/simpleSchema.d.ts.map +1 -1
  505. package/lib/simple-tree/simpleSchema.js.map +1 -1
  506. package/lib/simple-tree/simpleSchemaFormatV1.d.ts +249 -0
  507. package/lib/simple-tree/simpleSchemaFormatV1.d.ts.map +1 -0
  508. package/lib/simple-tree/simpleSchemaFormatV1.js +112 -0
  509. package/lib/simple-tree/simpleSchemaFormatV1.js.map +1 -0
  510. package/lib/tableSchema.d.ts.map +1 -1
  511. package/lib/tableSchema.js +1 -1
  512. package/lib/tableSchema.js.map +1 -1
  513. package/lib/treeFactory.d.ts +3 -1
  514. package/lib/treeFactory.d.ts.map +1 -1
  515. package/lib/treeFactory.js +23 -1
  516. package/lib/treeFactory.js.map +1 -1
  517. package/lib/util/brand.d.ts +31 -2
  518. package/lib/util/brand.d.ts.map +1 -1
  519. package/lib/util/brand.js +26 -1
  520. package/lib/util/brand.js.map +1 -1
  521. package/lib/util/brandedMap.d.ts +3 -1
  522. package/lib/util/brandedMap.d.ts.map +1 -1
  523. package/lib/util/brandedMap.js.map +1 -1
  524. package/lib/util/index.d.ts +1 -1
  525. package/lib/util/index.d.ts.map +1 -1
  526. package/lib/util/index.js +1 -1
  527. package/lib/util/index.js.map +1 -1
  528. package/package.json +24 -24
  529. package/src/api.ts +2 -2
  530. package/src/codec/codec.ts +17 -3
  531. package/src/core/index.ts +1 -2
  532. package/src/core/schema-stored/index.ts +1 -2
  533. package/src/core/schema-stored/schema.ts +10 -7
  534. package/src/core/tree/detachedFieldIndexCodecCommon.ts +2 -1
  535. package/src/core/tree/detachedFieldIndexCodecV1.ts +4 -2
  536. package/src/core/tree/detachedFieldIndexCodecV2.ts +4 -6
  537. package/src/core/tree/detachedFieldIndexCodecs.ts +33 -11
  538. package/src/core/tree/detachedFieldIndexFormatCommon.ts +17 -2
  539. package/src/core/tree/detachedFieldIndexFormatV1.ts +6 -4
  540. package/src/core/tree/detachedFieldIndexFormatV2.ts +6 -4
  541. package/src/core/tree/index.ts +2 -4
  542. package/src/external-utilities/typeboxValidator.ts +1 -1
  543. package/src/feature-libraries/chunked-forest/codec/codecs.ts +18 -13
  544. package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +2 -2
  545. package/src/feature-libraries/chunked-forest/codec/format.ts +15 -4
  546. package/src/feature-libraries/chunked-forest/codec/index.ts +4 -2
  547. package/src/feature-libraries/chunked-forest/codec/uncompressedEncode.ts +2 -2
  548. package/src/feature-libraries/chunked-forest/index.ts +0 -1
  549. package/src/feature-libraries/default-schema/defaultFieldKinds.ts +2 -29
  550. package/src/feature-libraries/forest-summary/codec.ts +24 -9
  551. package/src/feature-libraries/forest-summary/forestSummarizer.ts +1 -1
  552. package/src/feature-libraries/forest-summary/format.ts +12 -2
  553. package/src/feature-libraries/forest-summary/index.ts +2 -1
  554. package/src/feature-libraries/index.ts +1 -2
  555. package/src/feature-libraries/schema-edits/index.ts +0 -1
  556. package/src/feature-libraries/schema-edits/schemaChangeCodecs.ts +16 -16
  557. package/src/feature-libraries/schema-index/codec.ts +34 -22
  558. package/src/feature-libraries/schema-index/formatV1.ts +2 -2
  559. package/src/feature-libraries/schema-index/formatV2.ts +2 -2
  560. package/src/feature-libraries/schema-index/schemaSummarizer.ts +2 -1
  561. package/src/index.ts +3 -1
  562. package/src/packageVersion.ts +1 -1
  563. package/src/shared-tree/independentView.ts +16 -5
  564. package/src/shared-tree/sharedTree.ts +112 -172
  565. package/src/shared-tree/sharedTreeChangeCodecs.ts +15 -9
  566. package/src/shared-tree/sharedTreeChangeFamily.ts +2 -2
  567. package/src/shared-tree/treeAlpha.ts +6 -5
  568. package/src/shared-tree/treeCheckout.ts +1 -3
  569. package/src/shared-tree-core/editManagerCodecs.ts +56 -19
  570. package/src/shared-tree-core/editManagerFormatCommons.ts +47 -0
  571. package/src/shared-tree-core/editManagerFormatV1toV4.ts +10 -5
  572. package/src/shared-tree-core/editManagerFormatV5.ts +3 -3
  573. package/src/shared-tree-core/index.ts +11 -5
  574. package/src/shared-tree-core/messageCodecV1ToV4.ts +6 -1
  575. package/src/shared-tree-core/messageCodecV5.ts +2 -1
  576. package/src/shared-tree-core/messageCodecs.ts +60 -26
  577. package/src/shared-tree-core/messageFormat.ts +56 -0
  578. package/src/shared-tree-core/sharedTreeCore.ts +11 -13
  579. package/src/simple-tree/api/discrepancies.ts +2 -2
  580. package/src/simple-tree/api/incrementalAllowedTypes.ts +1 -1
  581. package/src/simple-tree/api/index.ts +6 -2
  582. package/src/simple-tree/api/schemaFactoryAlpha.ts +2 -168
  583. package/src/simple-tree/api/schemaFactoryBeta.ts +180 -14
  584. package/src/simple-tree/api/schemaFromSimple.ts +6 -3
  585. package/src/simple-tree/api/simpleSchemaCodec.ts +360 -0
  586. package/src/simple-tree/api/storedSchema.ts +8 -5
  587. package/src/simple-tree/api/tree.ts +2 -2
  588. package/src/simple-tree/api/typesUnsafe.ts +6 -6
  589. package/src/simple-tree/api/viewSchemaToSimpleSchema.ts +80 -47
  590. package/src/simple-tree/core/allowedTypes.ts +3 -3
  591. package/src/simple-tree/core/treeNode.ts +2 -2
  592. package/src/simple-tree/index.ts +5 -1
  593. package/src/simple-tree/node-kinds/array/arrayNode.ts +2 -2
  594. package/src/simple-tree/node-kinds/map/mapNode.ts +2 -2
  595. package/src/simple-tree/node-kinds/object/objectNode.ts +3 -3
  596. package/src/simple-tree/node-kinds/record/recordNode.ts +3 -3
  597. package/src/simple-tree/simpleSchema.ts +12 -3
  598. package/src/simple-tree/simpleSchemaFormatV1.ts +179 -0
  599. package/src/tableSchema.ts +5 -2
  600. package/src/treeFactory.ts +33 -1
  601. package/src/util/brand.ts +40 -2
  602. package/src/util/brandedMap.ts +3 -1
  603. package/src/util/index.ts +1 -0
@@ -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,CAAC;AAEjD,eAAO,MAAM,UAAU,kKAAwB,CAAC;AAChD,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,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,0EACR,QAAQ,gBACJ,kBAAkB;;;;EAW/B,CAAC;AAEH,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC,CAAC"}
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;AAEpE,OAAO,EAAqB,KAAK,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAEpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAEjE;;GAEG;AACH,eAAO,MAAM,+BAA+B;;;CAGlC,CAAC;AACX,MAAM,MAAM,+BAA+B,GAAG,KAAK,CAClD,CAAC,OAAO,+BAA+B,CAAC,CAAC,MAAM,OAAO,+BAA+B,CAAC,EACtF,iCAAiC,CACjC,CAAC;AAEF;;;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,CAAC;AAEjD,eAAO,MAAM,UAAU,kKAAwB,CAAC;AAChD,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,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,MAAM,+BAA+B,GAAG;IAC9C,EAAE,EAAE,CAAC;IACL,EAAE,EAAE,CAAC;CACI,CAAC;AAMX;;;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,CAIrB,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, 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,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BAAoB,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,EACN,KAAK,+BAA+B,EACpC,uCAAuC,GACvC,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,8BAA8B,CAAC"}
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,EACj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ACb,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":["../../../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,EAAE,uCAAuC,EAAE,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 { 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,e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AClC;;;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,KAAK,sBAAsB,EAC3B,KAAK,eAAe,EACpB,KAAK,SAAS,EACd,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAGN,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,EAA0C,MAAM,aAAa,CAAC;AAGxF,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;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,CAAC;AA6E5F;;;;GAIG;AACH,MAAM,UAAU,yCAAyC,CACxD,mBAA4C;IAE5C,wCAAwC;IACxC,OAAO,CAAC,CAAC;AACV,CAAC;AAED,MAAM,UAAU,mBAAmB,CAClC,OAAsB,EACtB,YAAoB;IAEpB,6GAA6G;IAC7G,8GAA8G;IAC9G,iHAAiH;IACjH,+BAA+B;IAC/B,MAAM,CACL,aAAa,CAAC,GAAG,CAAC,YAAY,CAAC,EAC/B,KAAK,CAAC,gDAAgD,CACtD,CAAC;IAEF,uFAAuF;IACvF,OAAO,2BAA2B,CAAC,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE;QAC7E,MAAM,EAAE,CAAC,IAAgB,EAAE,OAAkC,EAAqB,EAAE;YACnF,KAAK,MAAM,MAAM,IAAI,IAAI,EAAE,CAAC;gBA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,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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,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"]}
@@ -6,7 +6,7 @@ import { assert, unreachableCase, fail } from "@fluidframework/core-utils/intern
6
6
  import { forEachNode, } from "../../../core/index.js";
7
7
  import { getOrCreate } from "../../../util/index.js";
8
8
  import { Shape as ShapeGeneric, updateShapesAndIdentifiersEncoding, } from "./chunkEncodingGeneric.js";
9
- import { SpecialField, version, } from "./format.js";
9
+ import { FieldBatchFormatVersion, SpecialField, } from "./format.js";
10
10
  /**
11
11
  * Encode data from `FieldBatch` into an `EncodedFieldBatch`.
12
12
  *
@@ -22,7 +22,7 @@ export function compressedEncode(fieldBatch, context) {
22
22
  anyFieldEncoder.encodeField(cursor, context, buffer);
23
23
  batchBuffer.push(buffer);
24
24
  }
25
- return updateShapesAndIdentifiersEncoding(version, batchBuffer);
25
+ return updateShapesAndIdentifiersEncoding(FieldBatchFormatVersion.v1, batchBuffer);
26
26
  }
27
27
  /**
28
28
  * Makes a {@link FieldEncoder} which runs `encoder` on every node in the field.
@@ -1 +1 @@
1
- {"version":3,"file":"compressedEncode.js","sourceRoot":"","sources":["../../../../src/feature-libraries/chunked-forest/codec/compressedEncode.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,qCAAqC,CAAC;AAGpF,OAAO,EASN,WAAW,GACX,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAIrD,OAAO,EAEN,KAAK,IAAI,YAAY,EACrB,kCAAkC,GAClC,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAMN,YAAY,EACZ,OAAO,GACP,MAAM,aAAa,CAAC;AAGrB;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAC/B,UAAsB,EACtB,OAAuB;IAEvB,MAAM,WAAW,GAAmB,EAAE,CAAC;IAEvC,6DAA6D;IAC7D,KAAK,MAAM,MAAM,IAAI,UAAU,EAAE,CAAC;QACjC,MAAM,MAAM,GAAiB,EAAE,CAAC;QAChC,eAAe,CAAC,WAAW,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM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KAAkB;QAC3C,OAAO,WAAW,CAAC,IAAI,CAAC,mBAAmB,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,IAAI,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC;IAC1F,CAAC;CACD;AA0BD,MAAM,gBAAgB;IAGrB,YACiB,WAA8B,EAC9B,WAAkC,EACjC,sBAA0C;QAF3C,gBAAW,GAAX,WAAW,CAAmB;QAC9B,gBAAW,GAAX,WAAW,CAAuB;QACjC,2BAAsB,GAAtB,sBAAsB,CAAoB;IACzD,CAAC;IACG,WAAW,CACjB,MAA8B,EAC9B,OAAuB,EACvB,YAA0B;QAE1B,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,MAAM,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC;IACzD,CAAC;IAED,IAAY,OAAO;QAClB,IAAI,IAAI,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;YACpC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QACpF,CAAC;QACD,OAAO,IAAI,CAAC,WAAW,CAAC;IACzB,CAAC;IAED,IAAW,KAAK;QACf,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;IAC3B,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, unreachableCase, fail } from \"@fluidframework/core-utils/internal\";\nimport type { IIdCompressor } from \"@fluidframework/id-compressor\";\n\nimport {\n\tCursorLocationType,\n\ttype FieldKey,\n\ttype FieldKindIdentifier,\n\ttype ITreeCursorSynchronous,\n\ttype TreeChunk,\n\ttype TreeFieldStoredSchema,\n\ttype TreeNodeSchemaIdentifier,\n\ttype Value,\n\tforEachNode,\n} from \"../../../core/index.js\";\nimport { getOrCreate } from \"../../../util/index.js\";\nimport type { FlexFieldKind } from \"../../modular-schema/index.js\";\n\nimport type { Counter, DeduplicationTable } from \"./chunkCodecUtilities.js\";\nimport {\n\ttype BufferFormat as BufferFormatGeneric,\n\tShape as ShapeGeneric,\n\tupdateShapesAndIdentifiersEncoding,\n} from \"./chunkEncodingGeneric.js\";\nimport type { FieldBatch } from \"./fieldBatch.js\";\nimport {\n\ttype EncodedAnyShape,\n\ttype EncodedChunkShape,\n\ttype EncodedFieldBatch,\n\ttype EncodedNestedArrayShape,\n\ttype EncodedValueShape,\n\tSpecialField,\n\tversion,\n} from \"./format.js\";\nimport type { IncrementalEncoder } from \"./codecs.js\";\n\n/**\n * Encode data from `FieldBatch` into an `EncodedFieldBatch`.\n *\n * Optimized for encoded size and encoding performance.\n *\n * Most of the compression strategy comes from the policy provided via `context`.\n */\nexport function compressedEncode(\n\tfieldBatch: FieldBatch,\n\tcontext: EncoderContext,\n): EncodedFieldBatch {\n\tconst batchBuffer: BufferFormat[] = [];\n\n\t// Populate buffer, including shape and identifier references\n\tfor (const cursor of fieldBatch) {\n\t\tconst buffer: BufferFormat = [];\n\t\tanyFieldEncoder.encodeField(cursor, context, buffer);\n\t\tbatchBuffer.push(buffer);\n\t}\n\treturn updateShapesAndIdentifiersEncoding(version, batchBuffer);\n}\n\nexport type BufferFormat = BufferFormatGeneric<EncodedChunkShape>;\nexport type Shape = ShapeGeneric<EncodedChunkShape>;\n\n/**\n * Like {@link FieldEncoder}, except data will be prefixed with the key.\n */\nexport interface KeyedFieldEncoder {\n\treadonly key: FieldKey;\n\treadonly encoder: FieldEncoder;\n}\n\n/**\n * An encoder with an associated shape.\n */\nexport interface Encoder {\n\t/**\n\t * The shape which describes how the encoded data is laid out.\n\t * Used by decoders to interpret the output of `encodeNode`.\n\t */\n\treadonly shape: Shape;\n}\n\n/**\n * An encoder for a specific shape of node.\n *\n * Can only be used with compatible nodes.\n */\nexport interface NodeEncoder extends Encoder {\n\t/**\n\t * @param cursor - in Nodes mode. Does not move cursor.\n\t */\n\tencodeNode(\n\t\tcursor: ITreeCursorSynchronous,\n\t\tcontext: EncoderContext,\n\t\toutputBuffer: BufferFormat,\n\t): void;\n}\n\n/**\n * Like {@link NodeEncoder}, except encodes a run of nodes.\n */\nexport interface NodesEncoder extends Encoder {\n\t/**\n\t * @param cursor - in Nodes mode. Moves cursor however many nodes it encodes.\n\t */\n\tencodeNodes(\n\t\tcursor: ITreeCursorSynchronous,\n\t\tcontext: EncoderContext,\n\t\toutputBuffer: BufferFormat,\n\t): void;\n}\n\n/**\n * Like {@link NodeEncoder}, except encodes a field.\n */\nexport interface FieldEncoder extends Encoder {\n\t/**\n\t * @param cursor - in Fields mode. Encodes entire field.\n\t */\n\tencodeField(\n\t\tcursor: ITreeCursorSynchronous,\n\t\tcontext: EncoderContext,\n\t\toutputBuffer: BufferFormat,\n\t): void;\n}\n\n/**\n * Makes a {@link FieldEncoder} which runs `encoder` on every node in the field.\n * This does not encode the number nodes: the user of this may need to encode that elsewhere.\n */\nexport function asFieldEncoder(encoder: NodeEncoder): FieldEncoder {\n\treturn {\n\t\tencodeField(\n\t\t\tcursor: ITreeCursorSynchronous,\n\t\t\tcontext: EncoderContext,\n\t\t\toutputBuffer: BufferFormat,\n\t\t): void {\n\t\t\tforEachNode(cursor, () => encoder.encodeNode(cursor, context, outputBuffer));\n\t\t},\n\t\tshape: encoder.shape,\n\t};\n}\n\n/**\n * Adapt a {@link NodeEncoder} to a {@link NodesEncoder} which invokes `encoder` once.\n */\nexport function asNodesEncoder(encoder: NodeEncoder): NodesEncoder {\n\treturn {\n\t\tencodeNodes(\n\t\t\tcursor: ITreeCursorSynchronous,\n\t\t\tcontext: EncoderContext,\n\t\t\toutputBuffer: BufferFormat,\n\t\t): void {\n\t\t\tencoder.encodeNode(cursor, context, outputBuffer);\n\t\t\tcursor.nextNode();\n\t\t},\n\t\tshape: encoder.shape,\n\t};\n}\n\n/**\n * Encodes a chunk with {@link EncodedAnyShape} by prefixing the data with its shape.\n */\nexport class AnyShape extends ShapeGeneric<EncodedChunkShape> {\n\tprivate constructor() {\n\t\tsuper();\n\t}\n\tpublic static readonly instance = new AnyShape();\n\n\tpublic encodeShape(\n\t\tidentifiers: DeduplicationTable<string>,\n\t\tshapes: DeduplicationTable<Shape>,\n\t): EncodedChunkShape {\n\t\tconst encodedAnyShape: EncodedAnyShape = 0;\n\t\treturn { d: encodedAnyShape };\n\t}\n\n\tpublic countReferencedShapesAndIdentifiers(\n\t\tidentifiers: Counter<string>,\n\t\tshapeDiscovered: (shape: Shape) => void,\n\t): void {}\n\n\tpublic static encodeField(\n\t\tcursor: ITreeCursorSynchronous,\n\t\tcontext: EncoderContext,\n\t\toutputBuffer: BufferFormat,\n\t\tencoder: FieldEncoder,\n\t): void {\n\t\toutputBuffer.push(encoder.shape);\n\t\tencoder.encodeField(cursor, context, outputBuffer);\n\t}\n\n\tpublic static encodeNode(\n\t\tcursor: ITreeCursorSynchronous,\n\t\tcontext: EncoderContext,\n\t\toutputBuffer: BufferFormat,\n\t\tencoder: NodeEncoder,\n\t): void {\n\t\toutputBuffer.push(encoder.shape);\n\t\tencoder.encodeNode(cursor, context, outputBuffer);\n\t}\n\n\tpublic static encodeNodes(\n\t\tcursor: ITreeCursorSynchronous,\n\t\tcontext: EncoderContext,\n\t\toutputBuffer: BufferFormat,\n\t\tencoder: NodesEncoder,\n\t): void {\n\t\toutputBuffer.push(encoder.shape);\n\t\tencoder.encodeNodes(cursor, context, outputBuffer);\n\t}\n}\n\n/**\n * Encodes a single node polymorphically.\n */\nexport const anyNodeEncoder: NodeEncoder = {\n\tencodeNode(\n\t\tcursor: ITreeCursorSynchronous,\n\t\tcontext: EncoderContext,\n\t\toutputBuffer: BufferFormat,\n\t): void {\n\t\t// TODO: Fast path uniform chunk content.\n\t\tconst nodeEncoder = context.nodeEncoderFromSchema(cursor.type);\n\t\tAnyShape.encodeNode(cursor, context, outputBuffer, nodeEncoder);\n\t},\n\n\tshape: AnyShape.instance,\n};\n\n/**\n * Encodes a field polymorphically.\n */\nexport const anyFieldEncoder: FieldEncoder = {\n\tencodeField(\n\t\tcursor: ITreeCursorSynchronous,\n\t\tcontext: EncoderContext,\n\t\toutputBuffer: BufferFormat,\n\t): void {\n\t\t// TODO: Fast path uniform chunks.\n\n\t\tif (cursor.getFieldLength() === 0) {\n\t\t\tconst shape = InlineArrayEncoder.empty;\n\t\t\tAnyShape.encodeField(cursor, context, outputBuffer, shape);\n\t\t} else if (cursor.getFieldLength() === 1) {\n\t\t\t// Fast path chunk of size one size one at least: skip nested array.\n\t\t\tcursor.enterNode(0);\n\t\t\tanyNodeEncoder.encodeNode(cursor, context, outputBuffer);\n\t\t\tcursor.exitNode();\n\t\t} else {\n\t\t\t// TODO: more efficient encoding for common cases.\n\t\t\t// Could try to find more specific shape compatible with all children than `anyNodeEncoder`.\n\n\t\t\tconst shape = context.nestedArrayEncoder(anyNodeEncoder);\n\t\t\tAnyShape.encodeField(cursor, context, outputBuffer, shape);\n\t\t}\n\t},\n\n\tshape: AnyShape.instance,\n};\n\n/**\n * Encodes a chunk using {@link EncodedInlineArrayShape}.\n * @remarks\n * The fact this is also a Shape is an implementation detail of the encoder: that allows the shape it uses to be itself,\n * which is an easy way to keep all the related code together without extra objects.\n */\nexport class InlineArrayEncoder\n\textends ShapeGeneric<EncodedChunkShape>\n\timplements NodesEncoder, FieldEncoder\n{\n\tpublic static readonly empty: InlineArrayEncoder = new InlineArrayEncoder(0, {\n\t\tget shape() {\n\t\t\t// Not actually used, makes count work without adding an additional shape.\n\t\t\treturn InlineArrayEncoder.empty;\n\t\t},\n\t\tencodeNodes(\n\t\t\tcursor: ITreeCursorSynchronous,\n\t\t\tcontext: EncoderContext,\n\t\t\toutputBuffer: BufferFormat,\n\t\t): void {\n\t\t\tfail(0xb4d /* Empty array should not encode any nodes */);\n\t\t},\n\t});\n\n\t/**\n\t * @param length - number of invocations of `inner`.\n\t */\n\tpublic constructor(\n\t\tpublic readonly length: number,\n\t\tpublic readonly inner: NodesEncoder,\n\t) {\n\t\tsuper();\n\t}\n\n\tpublic encodeNodes(\n\t\tcursor: ITreeCursorSynchronous,\n\t\tcontext: EncoderContext,\n\t\toutputBuffer: BufferFormat,\n\t): void {\n\t\t// Linter is wrong about this loop being for-of compatible.\n\t\t// eslint-disable-next-line @typescript-eslint/prefer-for-of\n\t\tfor (let index = 0; index < this.length; index++) {\n\t\t\tthis.inner.encodeNodes(cursor, context, outputBuffer);\n\t\t}\n\t}\n\n\tpublic encodeField(\n\t\tcursor: ITreeCursorSynchronous,\n\t\tcontext: EncoderContext,\n\t\toutputBuffer: BufferFormat,\n\t): void {\n\t\t// Its possible individual items from this array encode multiple nodes, so don't assume === here.\n\t\tassert(\n\t\t\tcursor.getFieldLength() >= this.length,\n\t\t\t0x73c /* unexpected length for fixed length array */,\n\t\t);\n\t\tcursor.firstNode();\n\t\tthis.encodeNodes(cursor, context, outputBuffer);\n\t\tassert(\n\t\t\tcursor.mode === CursorLocationType.Fields,\n\t\t\t0x73d /* should return to fields mode when finished encoding */,\n\t\t);\n\t}\n\n\tpublic encodeShape(\n\t\tidentifiers: DeduplicationTable<string>,\n\t\tshapes: DeduplicationTable<Shape>,\n\t): EncodedChunkShape {\n\t\treturn {\n\t\t\tb: {\n\t\t\t\tlength: this.length,\n\t\t\t\tshape: shapes.valueToIndex.get(this.inner.shape) ?? fail(0xb4e /* missing shape */),\n\t\t\t},\n\t\t};\n\t}\n\n\tpublic countReferencedShapesAndIdentifiers(\n\t\tidentifiers: Counter<string>,\n\t\tshapeDiscovered: (shape: Shape) => void,\n\t): void {\n\t\tshapeDiscovered(this.inner.shape);\n\t}\n\n\tpublic get shape(): this {\n\t\treturn this;\n\t}\n}\n\n/**\n * Encodes the shape for a nested array as {@link EncodedNestedArrayShape} shape.\n */\nexport class NestedArrayShape extends ShapeGeneric<EncodedChunkShape> {\n\t/**\n\t * @param innerShape - The shape of each item in this nested array.\n\t */\n\tpublic constructor(public readonly innerShape: Shape) {\n\t\tsuper();\n\t}\n\n\tpublic encodeShape(\n\t\tidentifiers: DeduplicationTable<string>,\n\t\tshapes: DeduplicationTable<Shape>,\n\t): EncodedChunkShape {\n\t\tconst shape: EncodedNestedArrayShape =\n\t\t\tshapes.valueToIndex.get(this.innerShape) ??\n\t\t\tfail(0xb4f /* index for shape not found in table */);\n\t\treturn {\n\t\t\ta: shape,\n\t\t};\n\t}\n\n\tpublic countReferencedShapesAndIdentifiers(\n\t\tidentifiers: Counter<string>,\n\t\tshapeDiscovered: (shape: Shape) => void,\n\t): void {\n\t\tshapeDiscovered(this.innerShape);\n\t}\n}\n\n/**\n * Encodes a field as a nested array with the {@link EncodedNestedArrayShape} shape.\n * @remarks\n * The fact this is also exposes a Shape is an implementation detail: it allows the shape it uses to be itself\n * which is an easy way to keep all the related code together without extra objects.\n */\nexport class NestedArrayEncoder implements FieldEncoder {\n\tpublic constructor(\n\t\tpublic readonly innerEncoder: NodeEncoder,\n\t\tpublic readonly shape: NestedArrayShape = new NestedArrayShape(innerEncoder.shape),\n\t) {}\n\n\tpublic encodeField(\n\t\tcursor: ITreeCursorSynchronous,\n\t\tcontext: EncoderContext,\n\t\toutputBuffer: BufferFormat,\n\t): void {\n\t\tconst buffer: BufferFormat = [];\n\t\tlet allNonZeroSize = true;\n\t\tconst length = cursor.getFieldLength();\n\t\tforEachNode(cursor, () => {\n\t\t\tconst before = buffer.length;\n\t\t\tthis.innerEncoder.encodeNode(cursor, context, buffer);\n\t\t\tallNonZeroSize &&= buffer.length - before !== 0;\n\t\t});\n\t\tif (buffer.length === 0) {\n\t\t\t// This relies on the number of inner chunks being the same as the number of nodes.\n\t\t\t// If making inner a `NodesEncoder`, this code will have to be adjusted accordingly.\n\t\t\toutputBuffer.push(length);\n\t\t} else {\n\t\t\tassert(\n\t\t\t\tallNonZeroSize,\n\t\t\t\t0x73e /* either all or none of the members of a nested array must be 0 sized, or there is no way the decoder could process the content correctly. */,\n\t\t\t);\n\t\t\toutputBuffer.push(buffer);\n\t\t}\n\t}\n}\n\n/**\n * Encodes the shape for an incremental chunk as {@link EncodedIncrementalChunkShape} shape.\n */\nexport class IncrementalChunkShape extends ShapeGeneric<EncodedChunkShape> {\n\tpublic encodeShape(\n\t\tidentifiers: DeduplicationTable<string>,\n\t\tshapes: DeduplicationTable<Shape>,\n\t): EncodedChunkShape {\n\t\treturn {\n\t\t\te: 0 /* EncodedIncrementalChunkShape */,\n\t\t};\n\t}\n\n\tpublic countReferencedShapesAndIdentifiers(\n\t\tidentifiers: Counter<string>,\n\t\tshapeDiscovered: (shape: Shape) => void,\n\t): void {}\n\n\tpublic get shape(): this {\n\t\treturn this;\n\t}\n}\n\n/**\n * Encodes an incremental field whose tree chunks are encoded separately and referenced by their {@link ChunkReferenceId}.\n * The shape of the content of this field is {@link NestedArrayShape}.\n * The inner items of the array have shape {@link IncrementalChunkShape} and are {@link ChunkReferenceId}s\n * of the encoded chunks.\n */\nexport const incrementalFieldEncoder: FieldEncoder = {\n\tencodeField(\n\t\tcursor: ITreeCursorSynchronous,\n\t\tcontext: EncoderContext,\n\t\toutputBuffer: BufferFormat,\n\t): void {\n\t\tassert(\n\t\t\tcontext.incrementalEncoder !== undefined,\n\t\t\t0xc88 /* incremental encoder must be defined to use incrementalFieldEncoder */,\n\t\t);\n\n\t\tconst chunkReferenceIds = context.incrementalEncoder.encodeIncrementalField(\n\t\t\tcursor,\n\t\t\t(chunk: TreeChunk) => compressedEncode([chunk.cursor()], context),\n\t\t);\n\t\toutputBuffer.push(chunkReferenceIds);\n\t},\n\n\tshape: new NestedArrayShape(new IncrementalChunkShape() /* innerShape */),\n};\n\n/**\n * Encode `value` with `shape` into `outputBuffer`.\n *\n * Requires that `value` is compatible with `shape`.\n */\nexport function encodeValue(\n\tvalue: Value,\n\tshape: EncodedValueShape,\n\toutputBuffer: BufferFormat,\n): void {\n\tif (shape === undefined) {\n\t\tif (value !== undefined) {\n\t\t\toutputBuffer.push(true, value);\n\t\t} else {\n\t\t\toutputBuffer.push(false);\n\t\t}\n\t} else {\n\t\tif (shape === true) {\n\t\t\tassert(value !== undefined, 0x78d /* required value must not be missing */);\n\t\t\toutputBuffer.push(value);\n\t\t} else if (shape === false) {\n\t\t\tassert(value === undefined, 0x73f /* incompatible value shape: expected no value */);\n\t\t} else if (Array.isArray(shape)) {\n\t\t\tassert(shape.length === 1, 0x740 /* expected a single constant for value */);\n\t\t} else if (shape === SpecialField.Identifier) {\n\t\t\t// This case is a special case handling the encoding of identifier fields.\n\t\t\tassert(value !== undefined, 0x998 /* required value must not be missing */);\n\t\t\toutputBuffer.push(value);\n\t\t} else {\n\t\t\t// EncodedCounter case:\n\t\t\tunreachableCase(shape, \"Encoding values as deltas is not yet supported\");\n\t\t}\n\t}\n}\n\n/**\n * Provides common contextual information during encoding, like schema and policy settings.\n * Also, provides a cache to avoid duplicating equivalent shapes during a batch of encode operations.\n * @remarks\n * To avoid Shape duplication, any Shapes used in the encoding should either be:\n * - Singletons defined in a static scope.\n * - Cached in this object for future reuse such that all equivalent Shapes are deduplicated.\n */\nexport class EncoderContext implements NodeEncodeBuilder, FieldEncodeBuilder {\n\tprivate readonly nodeEncodersFromSchema: Map<TreeNodeSchemaIdentifier, NodeEncoder> =\n\t\tnew Map();\n\tprivate readonly nestedArrayEncoders: Map<NodeEncoder, NestedArrayEncoder> = new Map();\n\tpublic constructor(\n\t\tprivate readonly nodeEncoderFromPolicy: NodeEncoderPolicy,\n\t\tprivate readonly fieldEncoderFromPolicy: FieldEncoderPolicy,\n\t\tpublic readonly fieldShapes: ReadonlyMap<FieldKindIdentifier, FlexFieldKind>,\n\t\tpublic readonly idCompressor: IIdCompressor,\n\t\t/**\n\t\t * To be used to encode incremental chunks, if any.\n\t\t * @remarks\n\t\t * See {@link IncrementalEncoder} for more information.\n\t\t */\n\t\tpublic readonly incrementalEncoder: IncrementalEncoder | undefined,\n\t) {}\n\n\tpublic nodeEncoderFromSchema(schemaName: TreeNodeSchemaIdentifier): NodeEncoder {\n\t\treturn getOrCreate(this.nodeEncodersFromSchema, schemaName, () =>\n\t\t\tthis.nodeEncoderFromPolicy(this, schemaName),\n\t\t);\n\t}\n\n\tpublic fieldEncoderFromSchema(fieldSchema: TreeFieldStoredSchema): FieldEncoder {\n\t\treturn new LazyFieldEncoder(this, fieldSchema, this.fieldEncoderFromPolicy);\n\t}\n\n\tpublic nestedArrayEncoder(inner: NodeEncoder): NestedArrayEncoder {\n\t\treturn getOrCreate(this.nestedArrayEncoders, inner, () => new NestedArrayEncoder(inner));\n\t}\n}\n\nexport interface NodeEncodeBuilder {\n\tnodeEncoderFromSchema(schemaName: TreeNodeSchemaIdentifier): NodeEncoder;\n}\n\nexport interface FieldEncodeBuilder {\n\tfieldEncoderFromSchema(schema: TreeFieldStoredSchema): FieldEncoder;\n}\n\n/**\n * The policy for building a {@link FieldEncoder} for a field.\n */\nexport type FieldEncoderPolicy = (\n\tnodeBuilder: NodeEncodeBuilder,\n\tschema: TreeFieldStoredSchema,\n) => FieldEncoder;\n\n/**\n * The policy for building a {@link NodeEncoder} for a node.\n */\nexport type NodeEncoderPolicy = (\n\tfieldBuilder: FieldEncodeBuilder,\n\tschemaName: TreeNodeSchemaIdentifier,\n) => NodeEncoder;\n\nclass LazyFieldEncoder implements FieldEncoder {\n\tprivate encoderLazy: FieldEncoder | undefined;\n\n\tpublic constructor(\n\t\tpublic readonly nodeBuilder: NodeEncodeBuilder,\n\t\tpublic readonly fieldSchema: TreeFieldStoredSchema,\n\t\tprivate readonly fieldEncoderFromPolicy: FieldEncoderPolicy,\n\t) {}\n\tpublic encodeField(\n\t\tcursor: ITreeCursorSynchronous,\n\t\tcontext: EncoderContext,\n\t\toutputBuffer: BufferFormat,\n\t): void {\n\t\tthis.encoder.encodeField(cursor, context, outputBuffer);\n\t}\n\n\tprivate get encoder(): FieldEncoder {\n\t\tif (this.encoderLazy === undefined) {\n\t\t\tthis.encoderLazy = this.fieldEncoderFromPolicy(this.nodeBuilder, this.fieldSchema);\n\t\t}\n\t\treturn this.encoderLazy;\n\t}\n\n\tpublic get shape(): Shape {\n\t\treturn this.encoder.shape;\n\t}\n}\n"]}
1
+ {"version":3,"file":"compressedEncode.js","sourceRoot":"","sources":["../../../../src/feature-libraries/chunked-forest/codec/compressedEncode.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,qCAAqC,CAAC;AAGpF,OAAO,EASN,WAAW,GACX,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAIrD,OAAO,EAEN,KAAK,IAAI,YAAY,EACrB,kCAAkC,GAClC,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAMN,uBAAuB,EACvB,YAAY,GACZ,MAAM,aAAa,CAAC;AAGrB;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAC/B,UAAsB,EACtB,OAAuB;IAEvB,MAAM,WAAW,GAAmB,EAAE,CAAC;IAEvC,6DAA6D;IAC7D,KAAK,MAAM,MAAM,IAAI,UAAU,EAAE,CAAC;QACjC,MAAM,MAAM,GAAiB,EAAE,CAAC;QAChC,eAAe,CAAC,WAAW,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;QACrD,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC1B,CAAC;IACD,OAAO,kCAAkC,CAAC,uBAAuB,CAAC,EAAE,EAAE,WAAW,CAAC,CAAC;AACpF,CAAC;AAoED;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,OAAoB;IAClD,OAAO;QACN,WAAW,CACV,MAA8B,EAC9B,OAAuB,EACvB,YAA0B;YAE1B,WAAW,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,MAAM,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC;QAC9E,CAAC;QACD,KAAK,EAAE,OAAO,CAAC,KAAK;KACpB,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,OAAoB;IAClD,OAAO;QACN,W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AI,IAAI,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;YACpC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QACpF,CAAC;QACD,OAAO,IAAI,CAAC,WAAW,CAAC;IACzB,CAAC;IAED,IAAW,KAAK;QACf,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;IAC3B,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, unreachableCase, fail } from \"@fluidframework/core-utils/internal\";\nimport type { IIdCompressor } from \"@fluidframework/id-compressor\";\n\nimport {\n\tCursorLocationType,\n\ttype FieldKey,\n\ttype FieldKindIdentifier,\n\ttype ITreeCursorSynchronous,\n\ttype TreeChunk,\n\ttype TreeFieldStoredSchema,\n\ttype TreeNodeSchemaIdentifier,\n\ttype Value,\n\tforEachNode,\n} from \"../../../core/index.js\";\nimport { getOrCreate } from \"../../../util/index.js\";\nimport type { FlexFieldKind } from \"../../modular-schema/index.js\";\n\nimport type { Counter, DeduplicationTable } from \"./chunkCodecUtilities.js\";\nimport {\n\ttype BufferFormat as BufferFormatGeneric,\n\tShape as ShapeGeneric,\n\tupdateShapesAndIdentifiersEncoding,\n} from \"./chunkEncodingGeneric.js\";\nimport type { FieldBatch } from \"./fieldBatch.js\";\nimport {\n\ttype EncodedAnyShape,\n\ttype EncodedChunkShape,\n\ttype EncodedFieldBatch,\n\ttype EncodedNestedArrayShape,\n\ttype EncodedValueShape,\n\tFieldBatchFormatVersion,\n\tSpecialField,\n} from \"./format.js\";\nimport type { IncrementalEncoder } from \"./codecs.js\";\n\n/**\n * Encode data from `FieldBatch` into an `EncodedFieldBatch`.\n *\n * Optimized for encoded size and encoding performance.\n *\n * Most of the compression strategy comes from the policy provided via `context`.\n */\nexport function compressedEncode(\n\tfieldBatch: FieldBatch,\n\tcontext: EncoderContext,\n): EncodedFieldBatch {\n\tconst batchBuffer: BufferFormat[] = [];\n\n\t// Populate buffer, including shape and identifier references\n\tfor (const cursor of fieldBatch) {\n\t\tconst buffer: BufferFormat = [];\n\t\tanyFieldEncoder.encodeField(cursor, context, buffer);\n\t\tbatchBuffer.push(buffer);\n\t}\n\treturn updateShapesAndIdentifiersEncoding(FieldBatchFormatVersion.v1, batchBuffer);\n}\n\nexport type BufferFormat = BufferFormatGeneric<EncodedChunkShape>;\nexport type Shape = ShapeGeneric<EncodedChunkShape>;\n\n/**\n * Like {@link FieldEncoder}, except data will be prefixed with the key.\n */\nexport interface KeyedFieldEncoder {\n\treadonly key: FieldKey;\n\treadonly encoder: FieldEncoder;\n}\n\n/**\n * An encoder with an associated shape.\n */\nexport interface Encoder {\n\t/**\n\t * The shape which describes how the encoded data is laid out.\n\t * Used by decoders to interpret the output of `encodeNode`.\n\t */\n\treadonly shape: Shape;\n}\n\n/**\n * An encoder for a specific shape of node.\n *\n * Can only be used with compatible nodes.\n */\nexport interface NodeEncoder extends Encoder {\n\t/**\n\t * @param cursor - in Nodes mode. Does not move cursor.\n\t */\n\tencodeNode(\n\t\tcursor: ITreeCursorSynchronous,\n\t\tcontext: EncoderContext,\n\t\toutputBuffer: BufferFormat,\n\t): void;\n}\n\n/**\n * Like {@link NodeEncoder}, except encodes a run of nodes.\n */\nexport interface NodesEncoder extends Encoder {\n\t/**\n\t * @param cursor - in Nodes mode. Moves cursor however many nodes it encodes.\n\t */\n\tencodeNodes(\n\t\tcursor: ITreeCursorSynchronous,\n\t\tcontext: EncoderContext,\n\t\toutputBuffer: BufferFormat,\n\t): void;\n}\n\n/**\n * Like {@link NodeEncoder}, except encodes a field.\n */\nexport interface FieldEncoder extends Encoder {\n\t/**\n\t * @param cursor - in Fields mode. Encodes entire field.\n\t */\n\tencodeField(\n\t\tcursor: ITreeCursorSynchronous,\n\t\tcontext: EncoderContext,\n\t\toutputBuffer: BufferFormat,\n\t): void;\n}\n\n/**\n * Makes a {@link FieldEncoder} which runs `encoder` on every node in the field.\n * This does not encode the number nodes: the user of this may need to encode that elsewhere.\n */\nexport function asFieldEncoder(encoder: NodeEncoder): FieldEncoder {\n\treturn {\n\t\tencodeField(\n\t\t\tcursor: ITreeCursorSynchronous,\n\t\t\tcontext: EncoderContext,\n\t\t\toutputBuffer: BufferFormat,\n\t\t): void {\n\t\t\tforEachNode(cursor, () => encoder.encodeNode(cursor, context, outputBuffer));\n\t\t},\n\t\tshape: encoder.shape,\n\t};\n}\n\n/**\n * Adapt a {@link NodeEncoder} to a {@link NodesEncoder} which invokes `encoder` once.\n */\nexport function asNodesEncoder(encoder: NodeEncoder): NodesEncoder {\n\treturn {\n\t\tencodeNodes(\n\t\t\tcursor: ITreeCursorSynchronous,\n\t\t\tcontext: EncoderContext,\n\t\t\toutputBuffer: BufferFormat,\n\t\t): void {\n\t\t\tencoder.encodeNode(cursor, context, outputBuffer);\n\t\t\tcursor.nextNode();\n\t\t},\n\t\tshape: encoder.shape,\n\t};\n}\n\n/**\n * Encodes a chunk with {@link EncodedAnyShape} by prefixing the data with its shape.\n */\nexport class AnyShape extends ShapeGeneric<EncodedChunkShape> {\n\tprivate constructor() {\n\t\tsuper();\n\t}\n\tpublic static readonly instance = new AnyShape();\n\n\tpublic encodeShape(\n\t\tidentifiers: DeduplicationTable<string>,\n\t\tshapes: DeduplicationTable<Shape>,\n\t): EncodedChunkShape {\n\t\tconst encodedAnyShape: EncodedAnyShape = 0;\n\t\treturn { d: encodedAnyShape };\n\t}\n\n\tpublic countReferencedShapesAndIdentifiers(\n\t\tidentifiers: Counter<string>,\n\t\tshapeDiscovered: (shape: Shape) => void,\n\t): void {}\n\n\tpublic static encodeField(\n\t\tcursor: ITreeCursorSynchronous,\n\t\tcontext: EncoderContext,\n\t\toutputBuffer: BufferFormat,\n\t\tencoder: FieldEncoder,\n\t): void {\n\t\toutputBuffer.push(encoder.shape);\n\t\tencoder.encodeField(cursor, context, outputBuffer);\n\t}\n\n\tpublic static encodeNode(\n\t\tcursor: ITreeCursorSynchronous,\n\t\tcontext: EncoderContext,\n\t\toutputBuffer: BufferFormat,\n\t\tencoder: NodeEncoder,\n\t): void {\n\t\toutputBuffer.push(encoder.shape);\n\t\tencoder.encodeNode(cursor, context, outputBuffer);\n\t}\n\n\tpublic static encodeNodes(\n\t\tcursor: ITreeCursorSynchronous,\n\t\tcontext: EncoderContext,\n\t\toutputBuffer: BufferFormat,\n\t\tencoder: NodesEncoder,\n\t): void {\n\t\toutputBuffer.push(encoder.shape);\n\t\tencoder.encodeNodes(cursor, context, outputBuffer);\n\t}\n}\n\n/**\n * Encodes a single node polymorphically.\n */\nexport const anyNodeEncoder: NodeEncoder = {\n\tencodeNode(\n\t\tcursor: ITreeCursorSynchronous,\n\t\tcontext: EncoderContext,\n\t\toutputBuffer: BufferFormat,\n\t): void {\n\t\t// TODO: Fast path uniform chunk content.\n\t\tconst nodeEncoder = context.nodeEncoderFromSchema(cursor.type);\n\t\tAnyShape.encodeNode(cursor, context, outputBuffer, nodeEncoder);\n\t},\n\n\tshape: AnyShape.instance,\n};\n\n/**\n * Encodes a field polymorphically.\n */\nexport const anyFieldEncoder: FieldEncoder = {\n\tencodeField(\n\t\tcursor: ITreeCursorSynchronous,\n\t\tcontext: EncoderContext,\n\t\toutputBuffer: BufferFormat,\n\t): void {\n\t\t// TODO: Fast path uniform chunks.\n\n\t\tif (cursor.getFieldLength() === 0) {\n\t\t\tconst shape = InlineArrayEncoder.empty;\n\t\t\tAnyShape.encodeField(cursor, context, outputBuffer, shape);\n\t\t} else if (cursor.getFieldLength() === 1) {\n\t\t\t// Fast path chunk of size one size one at least: skip nested array.\n\t\t\tcursor.enterNode(0);\n\t\t\tanyNodeEncoder.encodeNode(cursor, context, outputBuffer);\n\t\t\tcursor.exitNode();\n\t\t} else {\n\t\t\t// TODO: more efficient encoding for common cases.\n\t\t\t// Could try to find more specific shape compatible with all children than `anyNodeEncoder`.\n\n\t\t\tconst shape = context.nestedArrayEncoder(anyNodeEncoder);\n\t\t\tAnyShape.encodeField(cursor, context, outputBuffer, shape);\n\t\t}\n\t},\n\n\tshape: AnyShape.instance,\n};\n\n/**\n * Encodes a chunk using {@link EncodedInlineArrayShape}.\n * @remarks\n * The fact this is also a Shape is an implementation detail of the encoder: that allows the shape it uses to be itself,\n * which is an easy way to keep all the related code together without extra objects.\n */\nexport class InlineArrayEncoder\n\textends ShapeGeneric<EncodedChunkShape>\n\timplements NodesEncoder, FieldEncoder\n{\n\tpublic static readonly empty: InlineArrayEncoder = new InlineArrayEncoder(0, {\n\t\tget shape() {\n\t\t\t// Not actually used, makes count work without adding an additional shape.\n\t\t\treturn InlineArrayEncoder.empty;\n\t\t},\n\t\tencodeNodes(\n\t\t\tcursor: ITreeCursorSynchronous,\n\t\t\tcontext: EncoderContext,\n\t\t\toutputBuffer: BufferFormat,\n\t\t): void {\n\t\t\tfail(0xb4d /* Empty array should not encode any nodes */);\n\t\t},\n\t});\n\n\t/**\n\t * @param length - number of invocations of `inner`.\n\t */\n\tpublic constructor(\n\t\tpublic readonly length: number,\n\t\tpublic readonly inner: NodesEncoder,\n\t) {\n\t\tsuper();\n\t}\n\n\tpublic encodeNodes(\n\t\tcursor: ITreeCursorSynchronous,\n\t\tcontext: EncoderContext,\n\t\toutputBuffer: BufferFormat,\n\t): void {\n\t\t// Linter is wrong about this loop being for-of compatible.\n\t\t// eslint-disable-next-line @typescript-eslint/prefer-for-of\n\t\tfor (let index = 0; index < this.length; index++) {\n\t\t\tthis.inner.encodeNodes(cursor, context, outputBuffer);\n\t\t}\n\t}\n\n\tpublic encodeField(\n\t\tcursor: ITreeCursorSynchronous,\n\t\tcontext: EncoderContext,\n\t\toutputBuffer: BufferFormat,\n\t): void {\n\t\t// Its possible individual items from this array encode multiple nodes, so don't assume === here.\n\t\tassert(\n\t\t\tcursor.getFieldLength() >= this.length,\n\t\t\t0x73c /* unexpected length for fixed length array */,\n\t\t);\n\t\tcursor.firstNode();\n\t\tthis.encodeNodes(cursor, context, outputBuffer);\n\t\tassert(\n\t\t\tcursor.mode === CursorLocationType.Fields,\n\t\t\t0x73d /* should return to fields mode when finished encoding */,\n\t\t);\n\t}\n\n\tpublic encodeShape(\n\t\tidentifiers: DeduplicationTable<string>,\n\t\tshapes: DeduplicationTable<Shape>,\n\t): EncodedChunkShape {\n\t\treturn {\n\t\t\tb: {\n\t\t\t\tlength: this.length,\n\t\t\t\tshape: shapes.valueToIndex.get(this.inner.shape) ?? fail(0xb4e /* missing shape */),\n\t\t\t},\n\t\t};\n\t}\n\n\tpublic countReferencedShapesAndIdentifiers(\n\t\tidentifiers: Counter<string>,\n\t\tshapeDiscovered: (shape: Shape) => void,\n\t): void {\n\t\tshapeDiscovered(this.inner.shape);\n\t}\n\n\tpublic get shape(): this {\n\t\treturn this;\n\t}\n}\n\n/**\n * Encodes the shape for a nested array as {@link EncodedNestedArrayShape} shape.\n */\nexport class NestedArrayShape extends ShapeGeneric<EncodedChunkShape> {\n\t/**\n\t * @param innerShape - The shape of each item in this nested array.\n\t */\n\tpublic constructor(public readonly innerShape: Shape) {\n\t\tsuper();\n\t}\n\n\tpublic encodeShape(\n\t\tidentifiers: DeduplicationTable<string>,\n\t\tshapes: DeduplicationTable<Shape>,\n\t): EncodedChunkShape {\n\t\tconst shape: EncodedNestedArrayShape =\n\t\t\tshapes.valueToIndex.get(this.innerShape) ??\n\t\t\tfail(0xb4f /* index for shape not found in table */);\n\t\treturn {\n\t\t\ta: shape,\n\t\t};\n\t}\n\n\tpublic countReferencedShapesAndIdentifiers(\n\t\tidentifiers: Counter<string>,\n\t\tshapeDiscovered: (shape: Shape) => void,\n\t): void {\n\t\tshapeDiscovered(this.innerShape);\n\t}\n}\n\n/**\n * Encodes a field as a nested array with the {@link EncodedNestedArrayShape} shape.\n * @remarks\n * The fact this is also exposes a Shape is an implementation detail: it allows the shape it uses to be itself\n * which is an easy way to keep all the related code together without extra objects.\n */\nexport class NestedArrayEncoder implements FieldEncoder {\n\tpublic constructor(\n\t\tpublic readonly innerEncoder: NodeEncoder,\n\t\tpublic readonly shape: NestedArrayShape = new NestedArrayShape(innerEncoder.shape),\n\t) {}\n\n\tpublic encodeField(\n\t\tcursor: ITreeCursorSynchronous,\n\t\tcontext: EncoderContext,\n\t\toutputBuffer: BufferFormat,\n\t): void {\n\t\tconst buffer: BufferFormat = [];\n\t\tlet allNonZeroSize = true;\n\t\tconst length = cursor.getFieldLength();\n\t\tforEachNode(cursor, () => {\n\t\t\tconst before = buffer.length;\n\t\t\tthis.innerEncoder.encodeNode(cursor, context, buffer);\n\t\t\tallNonZeroSize &&= buffer.length - before !== 0;\n\t\t});\n\t\tif (buffer.length === 0) {\n\t\t\t// This relies on the number of inner chunks being the same as the number of nodes.\n\t\t\t// If making inner a `NodesEncoder`, this code will have to be adjusted accordingly.\n\t\t\toutputBuffer.push(length);\n\t\t} else {\n\t\t\tassert(\n\t\t\t\tallNonZeroSize,\n\t\t\t\t0x73e /* either all or none of the members of a nested array must be 0 sized, or there is no way the decoder could process the content correctly. */,\n\t\t\t);\n\t\t\toutputBuffer.push(buffer);\n\t\t}\n\t}\n}\n\n/**\n * Encodes the shape for an incremental chunk as {@link EncodedIncrementalChunkShape} shape.\n */\nexport class IncrementalChunkShape extends ShapeGeneric<EncodedChunkShape> {\n\tpublic encodeShape(\n\t\tidentifiers: DeduplicationTable<string>,\n\t\tshapes: DeduplicationTable<Shape>,\n\t): EncodedChunkShape {\n\t\treturn {\n\t\t\te: 0 /* EncodedIncrementalChunkShape */,\n\t\t};\n\t}\n\n\tpublic countReferencedShapesAndIdentifiers(\n\t\tidentifiers: Counter<string>,\n\t\tshapeDiscovered: (shape: Shape) => void,\n\t): void {}\n\n\tpublic get shape(): this {\n\t\treturn this;\n\t}\n}\n\n/**\n * Encodes an incremental field whose tree chunks are encoded separately and referenced by their {@link ChunkReferenceId}.\n * The shape of the content of this field is {@link NestedArrayShape}.\n * The inner items of the array have shape {@link IncrementalChunkShape} and are {@link ChunkReferenceId}s\n * of the encoded chunks.\n */\nexport const incrementalFieldEncoder: FieldEncoder = {\n\tencodeField(\n\t\tcursor: ITreeCursorSynchronous,\n\t\tcontext: EncoderContext,\n\t\toutputBuffer: BufferFormat,\n\t): void {\n\t\tassert(\n\t\t\tcontext.incrementalEncoder !== undefined,\n\t\t\t0xc88 /* incremental encoder must be defined to use incrementalFieldEncoder */,\n\t\t);\n\n\t\tconst chunkReferenceIds = context.incrementalEncoder.encodeIncrementalField(\n\t\t\tcursor,\n\t\t\t(chunk: TreeChunk) => compressedEncode([chunk.cursor()], context),\n\t\t);\n\t\toutputBuffer.push(chunkReferenceIds);\n\t},\n\n\tshape: new NestedArrayShape(new IncrementalChunkShape() /* innerShape */),\n};\n\n/**\n * Encode `value` with `shape` into `outputBuffer`.\n *\n * Requires that `value` is compatible with `shape`.\n */\nexport function encodeValue(\n\tvalue: Value,\n\tshape: EncodedValueShape,\n\toutputBuffer: BufferFormat,\n): void {\n\tif (shape === undefined) {\n\t\tif (value !== undefined) {\n\t\t\toutputBuffer.push(true, value);\n\t\t} else {\n\t\t\toutputBuffer.push(false);\n\t\t}\n\t} else {\n\t\tif (shape === true) {\n\t\t\tassert(value !== undefined, 0x78d /* required value must not be missing */);\n\t\t\toutputBuffer.push(value);\n\t\t} else if (shape === false) {\n\t\t\tassert(value === undefined, 0x73f /* incompatible value shape: expected no value */);\n\t\t} else if (Array.isArray(shape)) {\n\t\t\tassert(shape.length === 1, 0x740 /* expected a single constant for value */);\n\t\t} else if (shape === SpecialField.Identifier) {\n\t\t\t// This case is a special case handling the encoding of identifier fields.\n\t\t\tassert(value !== undefined, 0x998 /* required value must not be missing */);\n\t\t\toutputBuffer.push(value);\n\t\t} else {\n\t\t\t// EncodedCounter case:\n\t\t\tunreachableCase(shape, \"Encoding values as deltas is not yet supported\");\n\t\t}\n\t}\n}\n\n/**\n * Provides common contextual information during encoding, like schema and policy settings.\n * Also, provides a cache to avoid duplicating equivalent shapes during a batch of encode operations.\n * @remarks\n * To avoid Shape duplication, any Shapes used in the encoding should either be:\n * - Singletons defined in a static scope.\n * - Cached in this object for future reuse such that all equivalent Shapes are deduplicated.\n */\nexport class EncoderContext implements NodeEncodeBuilder, FieldEncodeBuilder {\n\tprivate readonly nodeEncodersFromSchema: Map<TreeNodeSchemaIdentifier, NodeEncoder> =\n\t\tnew Map();\n\tprivate readonly nestedArrayEncoders: Map<NodeEncoder, NestedArrayEncoder> = new Map();\n\tpublic constructor(\n\t\tprivate readonly nodeEncoderFromPolicy: NodeEncoderPolicy,\n\t\tprivate readonly fieldEncoderFromPolicy: FieldEncoderPolicy,\n\t\tpublic readonly fieldShapes: ReadonlyMap<FieldKindIdentifier, FlexFieldKind>,\n\t\tpublic readonly idCompressor: IIdCompressor,\n\t\t/**\n\t\t * To be used to encode incremental chunks, if any.\n\t\t * @remarks\n\t\t * See {@link IncrementalEncoder} for more information.\n\t\t */\n\t\tpublic readonly incrementalEncoder: IncrementalEncoder | undefined,\n\t) {}\n\n\tpublic nodeEncoderFromSchema(schemaName: TreeNodeSchemaIdentifier): NodeEncoder {\n\t\treturn getOrCreate(this.nodeEncodersFromSchema, schemaName, () =>\n\t\t\tthis.nodeEncoderFromPolicy(this, schemaName),\n\t\t);\n\t}\n\n\tpublic fieldEncoderFromSchema(fieldSchema: TreeFieldStoredSchema): FieldEncoder {\n\t\treturn new LazyFieldEncoder(this, fieldSchema, this.fieldEncoderFromPolicy);\n\t}\n\n\tpublic nestedArrayEncoder(inner: NodeEncoder): NestedArrayEncoder {\n\t\treturn getOrCreate(this.nestedArrayEncoders, inner, () => new NestedArrayEncoder(inner));\n\t}\n}\n\nexport interface NodeEncodeBuilder {\n\tnodeEncoderFromSchema(schemaName: TreeNodeSchemaIdentifier): NodeEncoder;\n}\n\nexport interface FieldEncodeBuilder {\n\tfieldEncoderFromSchema(schema: TreeFieldStoredSchema): FieldEncoder;\n}\n\n/**\n * The policy for building a {@link FieldEncoder} for a field.\n */\nexport type FieldEncoderPolicy = (\n\tnodeBuilder: NodeEncodeBuilder,\n\tschema: TreeFieldStoredSchema,\n) => FieldEncoder;\n\n/**\n * The policy for building a {@link NodeEncoder} for a node.\n */\nexport type NodeEncoderPolicy = (\n\tfieldBuilder: FieldEncodeBuilder,\n\tschemaName: TreeNodeSchemaIdentifier,\n) => NodeEncoder;\n\nclass LazyFieldEncoder implements FieldEncoder {\n\tprivate encoderLazy: FieldEncoder | undefined;\n\n\tpublic constructor(\n\t\tpublic readonly nodeBuilder: NodeEncodeBuilder,\n\t\tpublic readonly fieldSchema: TreeFieldStoredSchema,\n\t\tprivate readonly fieldEncoderFromPolicy: FieldEncoderPolicy,\n\t) {}\n\tpublic encodeField(\n\t\tcursor: ITreeCursorSynchronous,\n\t\tcontext: EncoderContext,\n\t\toutputBuffer: BufferFormat,\n\t): void {\n\t\tthis.encoder.encodeField(cursor, context, outputBuffer);\n\t}\n\n\tprivate get encoder(): FieldEncoder {\n\t\tif (this.encoderLazy === undefined) {\n\t\t\tthis.encoderLazy = this.fieldEncoderFromPolicy(this.nodeBuilder, this.fieldSchema);\n\t\t}\n\t\treturn this.encoderLazy;\n\t}\n\n\tpublic get shape(): Shape {\n\t\treturn this.encoder.shape;\n\t}\n}\n"]}
@@ -4,9 +4,14 @@
4
4
  */
5
5
  import { type Static } from "@sinclair/typebox";
6
6
  import type { Brand } from "../../../util/index.js";
7
- export declare const version = 1;
8
- export type FieldBatchFormatVersion = Brand<1, "FieldBatchFormatVersion">;
9
- export declare const validVersions: Set<number>;
7
+ /**
8
+ * The format version for the field batch.
9
+ */
10
+ export declare const FieldBatchFormatVersion: {
11
+ readonly v1: 1;
12
+ };
13
+ export type FieldBatchFormatVersion = Brand<(typeof FieldBatchFormatVersion)[keyof typeof FieldBatchFormatVersion], "FieldBatchFormatVersion">;
14
+ export declare const validVersions: Set<1>;
10
15
  /**
11
16
  * Top level length is implied from length of data array.
12
17
  * All content are of this shape.
@@ -1 +1 @@
1
- {"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../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