@fluidframework/tree 2.62.0 → 2.63.0-359286

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 (352) hide show
  1. package/.eslintrc.cjs +4 -0
  2. package/api-report/tree.alpha.api.md +31 -5
  3. package/api-report/tree.beta.api.md +26 -0
  4. package/api-report/tree.legacy.beta.api.md +26 -0
  5. package/dist/alpha.d.ts +4 -3
  6. package/dist/beta.d.ts +3 -0
  7. package/dist/codec/codec.d.ts +32 -0
  8. package/dist/codec/codec.d.ts.map +1 -1
  9. package/dist/codec/codec.js +32 -1
  10. package/dist/codec/codec.js.map +1 -1
  11. package/dist/codec/index.d.ts +1 -1
  12. package/dist/codec/index.d.ts.map +1 -1
  13. package/dist/codec/index.js +3 -1
  14. package/dist/codec/index.js.map +1 -1
  15. package/dist/core/index.d.ts +2 -2
  16. package/dist/core/index.d.ts.map +1 -1
  17. package/dist/core/index.js +4 -3
  18. package/dist/core/index.js.map +1 -1
  19. package/dist/core/schema-stored/index.d.ts +1 -1
  20. package/dist/core/schema-stored/index.d.ts.map +1 -1
  21. package/dist/core/schema-stored/index.js.map +1 -1
  22. package/dist/core/schema-stored/schema.d.ts +5 -7
  23. package/dist/core/schema-stored/schema.d.ts.map +1 -1
  24. package/dist/core/schema-stored/schema.js +3 -6
  25. package/dist/core/schema-stored/schema.js.map +1 -1
  26. package/dist/core/tree/detachedFieldIndexCodecs.d.ts +4 -1
  27. package/dist/core/tree/detachedFieldIndexCodecs.d.ts.map +1 -1
  28. package/dist/core/tree/detachedFieldIndexCodecs.js +5 -1
  29. package/dist/core/tree/detachedFieldIndexCodecs.js.map +1 -1
  30. package/dist/core/tree/index.d.ts +1 -0
  31. package/dist/core/tree/index.d.ts.map +1 -1
  32. package/dist/core/tree/index.js +3 -1
  33. package/dist/core/tree/index.js.map +1 -1
  34. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts +3 -2
  35. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  36. package/dist/feature-libraries/chunked-forest/codec/codecs.js +5 -1
  37. package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  38. package/dist/feature-libraries/chunked-forest/codec/format.d.ts +2 -0
  39. package/dist/feature-libraries/chunked-forest/codec/format.d.ts.map +1 -1
  40. package/dist/feature-libraries/chunked-forest/codec/format.js.map +1 -1
  41. package/dist/feature-libraries/chunked-forest/codec/index.d.ts +2 -2
  42. package/dist/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
  43. package/dist/feature-libraries/chunked-forest/codec/index.js +2 -1
  44. package/dist/feature-libraries/chunked-forest/codec/index.js.map +1 -1
  45. package/dist/feature-libraries/chunked-forest/index.d.ts +1 -1
  46. package/dist/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  47. package/dist/feature-libraries/chunked-forest/index.js +2 -1
  48. package/dist/feature-libraries/chunked-forest/index.js.map +1 -1
  49. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts +5 -1
  50. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  51. package/dist/feature-libraries/default-schema/defaultFieldKinds.js +19 -5
  52. package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  53. package/dist/feature-libraries/default-schema/index.d.ts +1 -1
  54. package/dist/feature-libraries/default-schema/index.d.ts.map +1 -1
  55. package/dist/feature-libraries/default-schema/index.js +2 -1
  56. package/dist/feature-libraries/default-schema/index.js.map +1 -1
  57. package/dist/feature-libraries/forest-summary/codec.d.ts +4 -1
  58. package/dist/feature-libraries/forest-summary/codec.d.ts.map +1 -1
  59. package/dist/feature-libraries/forest-summary/codec.js +5 -1
  60. package/dist/feature-libraries/forest-summary/codec.js.map +1 -1
  61. package/dist/feature-libraries/forest-summary/index.d.ts +1 -0
  62. package/dist/feature-libraries/forest-summary/index.d.ts.map +1 -1
  63. package/dist/feature-libraries/forest-summary/index.js +3 -1
  64. package/dist/feature-libraries/forest-summary/index.js.map +1 -1
  65. package/dist/feature-libraries/index.d.ts +5 -5
  66. package/dist/feature-libraries/index.d.ts.map +1 -1
  67. package/dist/feature-libraries/index.js +7 -2
  68. package/dist/feature-libraries/index.js.map +1 -1
  69. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +1 -1
  70. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  71. package/dist/feature-libraries/schema-edits/index.d.ts +1 -1
  72. package/dist/feature-libraries/schema-edits/index.d.ts.map +1 -1
  73. package/dist/feature-libraries/schema-edits/index.js +2 -1
  74. package/dist/feature-libraries/schema-edits/index.js.map +1 -1
  75. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.d.ts +4 -1
  76. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
  77. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js +9 -1
  78. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
  79. package/dist/feature-libraries/schema-index/codec.d.ts +2 -1
  80. package/dist/feature-libraries/schema-index/codec.d.ts.map +1 -1
  81. package/dist/feature-libraries/schema-index/codec.js +5 -1
  82. package/dist/feature-libraries/schema-index/codec.js.map +1 -1
  83. package/dist/feature-libraries/schema-index/index.d.ts +1 -1
  84. package/dist/feature-libraries/schema-index/index.d.ts.map +1 -1
  85. package/dist/feature-libraries/schema-index/index.js +2 -1
  86. package/dist/feature-libraries/schema-index/index.js.map +1 -1
  87. package/dist/legacy.d.ts +3 -0
  88. package/dist/packageVersion.d.ts +1 -1
  89. package/dist/packageVersion.d.ts.map +1 -1
  90. package/dist/packageVersion.js +1 -1
  91. package/dist/packageVersion.js.map +1 -1
  92. package/dist/serializableDomainSchema.d.ts +12 -16
  93. package/dist/serializableDomainSchema.d.ts.map +1 -1
  94. package/dist/serializableDomainSchema.js +8 -8
  95. package/dist/serializableDomainSchema.js.map +1 -1
  96. package/dist/shared-tree/index.d.ts +2 -1
  97. package/dist/shared-tree/index.d.ts.map +1 -1
  98. package/dist/shared-tree/index.js +4 -1
  99. package/dist/shared-tree/index.js.map +1 -1
  100. package/dist/shared-tree/sharedTree.d.ts +18 -2
  101. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  102. package/dist/shared-tree/sharedTree.js +122 -8
  103. package/dist/shared-tree/sharedTree.js.map +1 -1
  104. package/dist/shared-tree/sharedTreeChangeCodecs.d.ts +17 -2
  105. package/dist/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  106. package/dist/shared-tree/sharedTreeChangeCodecs.js +31 -18
  107. package/dist/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  108. package/dist/shared-tree/treeCheckout.js.map +1 -1
  109. package/dist/shared-tree-core/defaultResubmitMachine.d.ts +7 -12
  110. package/dist/shared-tree-core/defaultResubmitMachine.d.ts.map +1 -1
  111. package/dist/shared-tree-core/defaultResubmitMachine.js +53 -73
  112. package/dist/shared-tree-core/defaultResubmitMachine.js.map +1 -1
  113. package/dist/shared-tree-core/editManager.js +8 -4
  114. package/dist/shared-tree-core/editManager.js.map +1 -1
  115. package/dist/shared-tree-core/editManagerCodecs.d.ts +7 -4
  116. package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  117. package/dist/shared-tree-core/editManagerCodecs.js +42 -11
  118. package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
  119. package/dist/shared-tree-core/index.d.ts +2 -1
  120. package/dist/shared-tree-core/index.d.ts.map +1 -1
  121. package/dist/shared-tree-core/index.js +6 -1
  122. package/dist/shared-tree-core/index.js.map +1 -1
  123. package/dist/shared-tree-core/messageCodecs.d.ts +7 -4
  124. package/dist/shared-tree-core/messageCodecs.d.ts.map +1 -1
  125. package/dist/shared-tree-core/messageCodecs.js +44 -23
  126. package/dist/shared-tree-core/messageCodecs.js.map +1 -1
  127. package/dist/shared-tree-core/resubmitMachine.d.ts +9 -18
  128. package/dist/shared-tree-core/resubmitMachine.d.ts.map +1 -1
  129. package/dist/shared-tree-core/resubmitMachine.js.map +1 -1
  130. package/dist/shared-tree-core/sharedTreeCore.d.ts +6 -4
  131. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  132. package/dist/shared-tree-core/sharedTreeCore.js +12 -13
  133. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  134. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +7 -166
  135. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  136. package/dist/simple-tree/api/schemaFactoryAlpha.js +11 -44
  137. package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  138. package/dist/simple-tree/api/schemaFactoryBeta.d.ts +90 -1
  139. package/dist/simple-tree/api/schemaFactoryBeta.d.ts.map +1 -1
  140. package/dist/simple-tree/api/schemaFactoryBeta.js +55 -0
  141. package/dist/simple-tree/api/schemaFactoryBeta.js.map +1 -1
  142. package/dist/simple-tree/api/treeBeta.d.ts +12 -2
  143. package/dist/simple-tree/api/treeBeta.d.ts.map +1 -1
  144. package/dist/simple-tree/api/treeBeta.js +6 -0
  145. package/dist/simple-tree/api/treeBeta.js.map +1 -1
  146. package/dist/simple-tree/api/typesUnsafe.d.ts +1 -1
  147. package/dist/simple-tree/api/typesUnsafe.js.map +1 -1
  148. package/dist/simple-tree/core/treeNode.d.ts +3 -2
  149. package/dist/simple-tree/core/treeNode.d.ts.map +1 -1
  150. package/dist/simple-tree/core/treeNode.js +3 -2
  151. package/dist/simple-tree/core/treeNode.js.map +1 -1
  152. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
  153. package/dist/simple-tree/node-kinds/record/recordNodeTypes.d.ts +2 -2
  154. package/dist/simple-tree/node-kinds/record/recordNodeTypes.js.map +1 -1
  155. package/dist/util/brand.d.ts +1 -1
  156. package/dist/util/brand.js.map +1 -1
  157. package/docs/main/compatibility.md +8 -0
  158. package/lib/alpha.d.ts +4 -3
  159. package/lib/beta.d.ts +3 -0
  160. package/lib/codec/codec.d.ts +32 -0
  161. package/lib/codec/codec.d.ts.map +1 -1
  162. package/lib/codec/codec.js +28 -0
  163. package/lib/codec/codec.js.map +1 -1
  164. package/lib/codec/index.d.ts +1 -1
  165. package/lib/codec/index.d.ts.map +1 -1
  166. package/lib/codec/index.js +1 -1
  167. package/lib/codec/index.js.map +1 -1
  168. package/lib/core/index.d.ts +2 -2
  169. package/lib/core/index.d.ts.map +1 -1
  170. package/lib/core/index.js +1 -1
  171. package/lib/core/index.js.map +1 -1
  172. package/lib/core/schema-stored/index.d.ts +1 -1
  173. package/lib/core/schema-stored/index.d.ts.map +1 -1
  174. package/lib/core/schema-stored/index.js.map +1 -1
  175. package/lib/core/schema-stored/schema.d.ts +5 -7
  176. package/lib/core/schema-stored/schema.d.ts.map +1 -1
  177. package/lib/core/schema-stored/schema.js +3 -6
  178. package/lib/core/schema-stored/schema.js.map +1 -1
  179. package/lib/core/tree/detachedFieldIndexCodecs.d.ts +4 -1
  180. package/lib/core/tree/detachedFieldIndexCodecs.d.ts.map +1 -1
  181. package/lib/core/tree/detachedFieldIndexCodecs.js +3 -0
  182. package/lib/core/tree/detachedFieldIndexCodecs.js.map +1 -1
  183. package/lib/core/tree/index.d.ts +1 -0
  184. package/lib/core/tree/index.d.ts.map +1 -1
  185. package/lib/core/tree/index.js +1 -0
  186. package/lib/core/tree/index.js.map +1 -1
  187. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts +3 -2
  188. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  189. package/lib/feature-libraries/chunked-forest/codec/codecs.js +3 -0
  190. package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  191. package/lib/feature-libraries/chunked-forest/codec/format.d.ts +2 -0
  192. package/lib/feature-libraries/chunked-forest/codec/format.d.ts.map +1 -1
  193. package/lib/feature-libraries/chunked-forest/codec/format.js.map +1 -1
  194. package/lib/feature-libraries/chunked-forest/codec/index.d.ts +2 -2
  195. package/lib/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
  196. package/lib/feature-libraries/chunked-forest/codec/index.js +1 -1
  197. package/lib/feature-libraries/chunked-forest/codec/index.js.map +1 -1
  198. package/lib/feature-libraries/chunked-forest/index.d.ts +1 -1
  199. package/lib/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  200. package/lib/feature-libraries/chunked-forest/index.js +1 -1
  201. package/lib/feature-libraries/chunked-forest/index.js.map +1 -1
  202. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts +5 -1
  203. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  204. package/lib/feature-libraries/default-schema/defaultFieldKinds.js +17 -4
  205. package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  206. package/lib/feature-libraries/default-schema/index.d.ts +1 -1
  207. package/lib/feature-libraries/default-schema/index.d.ts.map +1 -1
  208. package/lib/feature-libraries/default-schema/index.js +1 -1
  209. package/lib/feature-libraries/default-schema/index.js.map +1 -1
  210. package/lib/feature-libraries/forest-summary/codec.d.ts +4 -1
  211. package/lib/feature-libraries/forest-summary/codec.d.ts.map +1 -1
  212. package/lib/feature-libraries/forest-summary/codec.js +3 -0
  213. package/lib/feature-libraries/forest-summary/codec.js.map +1 -1
  214. package/lib/feature-libraries/forest-summary/index.d.ts +1 -0
  215. package/lib/feature-libraries/forest-summary/index.d.ts.map +1 -1
  216. package/lib/feature-libraries/forest-summary/index.js +1 -0
  217. package/lib/feature-libraries/forest-summary/index.js.map +1 -1
  218. package/lib/feature-libraries/index.d.ts +5 -5
  219. package/lib/feature-libraries/index.d.ts.map +1 -1
  220. package/lib/feature-libraries/index.js +5 -5
  221. package/lib/feature-libraries/index.js.map +1 -1
  222. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +1 -1
  223. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  224. package/lib/feature-libraries/schema-edits/index.d.ts +1 -1
  225. package/lib/feature-libraries/schema-edits/index.d.ts.map +1 -1
  226. package/lib/feature-libraries/schema-edits/index.js +1 -1
  227. package/lib/feature-libraries/schema-edits/index.js.map +1 -1
  228. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.d.ts +4 -1
  229. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
  230. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js +8 -1
  231. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
  232. package/lib/feature-libraries/schema-index/codec.d.ts +2 -1
  233. package/lib/feature-libraries/schema-index/codec.d.ts.map +1 -1
  234. package/lib/feature-libraries/schema-index/codec.js +3 -0
  235. package/lib/feature-libraries/schema-index/codec.js.map +1 -1
  236. package/lib/feature-libraries/schema-index/index.d.ts +1 -1
  237. package/lib/feature-libraries/schema-index/index.d.ts.map +1 -1
  238. package/lib/feature-libraries/schema-index/index.js +1 -1
  239. package/lib/feature-libraries/schema-index/index.js.map +1 -1
  240. package/lib/legacy.d.ts +3 -0
  241. package/lib/packageVersion.d.ts +1 -1
  242. package/lib/packageVersion.d.ts.map +1 -1
  243. package/lib/packageVersion.js +1 -1
  244. package/lib/packageVersion.js.map +1 -1
  245. package/lib/serializableDomainSchema.d.ts +12 -16
  246. package/lib/serializableDomainSchema.d.ts.map +1 -1
  247. package/lib/serializableDomainSchema.js +9 -9
  248. package/lib/serializableDomainSchema.js.map +1 -1
  249. package/lib/shared-tree/index.d.ts +2 -1
  250. package/lib/shared-tree/index.d.ts.map +1 -1
  251. package/lib/shared-tree/index.js +2 -1
  252. package/lib/shared-tree/index.js.map +1 -1
  253. package/lib/shared-tree/sharedTree.d.ts +18 -2
  254. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  255. package/lib/shared-tree/sharedTree.js +126 -13
  256. package/lib/shared-tree/sharedTree.js.map +1 -1
  257. package/lib/shared-tree/sharedTreeChangeCodecs.d.ts +17 -2
  258. package/lib/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  259. package/lib/shared-tree/sharedTreeChangeCodecs.js +30 -18
  260. package/lib/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  261. package/lib/shared-tree/treeCheckout.js.map +1 -1
  262. package/lib/shared-tree-core/defaultResubmitMachine.d.ts +7 -12
  263. package/lib/shared-tree-core/defaultResubmitMachine.d.ts.map +1 -1
  264. package/lib/shared-tree-core/defaultResubmitMachine.js +55 -75
  265. package/lib/shared-tree-core/defaultResubmitMachine.js.map +1 -1
  266. package/lib/shared-tree-core/editManager.js +8 -4
  267. package/lib/shared-tree-core/editManager.js.map +1 -1
  268. package/lib/shared-tree-core/editManagerCodecs.d.ts +7 -4
  269. package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  270. package/lib/shared-tree-core/editManagerCodecs.js +40 -10
  271. package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
  272. package/lib/shared-tree-core/index.d.ts +2 -1
  273. package/lib/shared-tree-core/index.d.ts.map +1 -1
  274. package/lib/shared-tree-core/index.js +2 -1
  275. package/lib/shared-tree-core/index.js.map +1 -1
  276. package/lib/shared-tree-core/messageCodecs.d.ts +7 -4
  277. package/lib/shared-tree-core/messageCodecs.d.ts.map +1 -1
  278. package/lib/shared-tree-core/messageCodecs.js +42 -22
  279. package/lib/shared-tree-core/messageCodecs.js.map +1 -1
  280. package/lib/shared-tree-core/resubmitMachine.d.ts +9 -18
  281. package/lib/shared-tree-core/resubmitMachine.d.ts.map +1 -1
  282. package/lib/shared-tree-core/resubmitMachine.js.map +1 -1
  283. package/lib/shared-tree-core/sharedTreeCore.d.ts +6 -4
  284. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  285. package/lib/shared-tree-core/sharedTreeCore.js +13 -14
  286. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  287. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +7 -166
  288. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  289. package/lib/simple-tree/api/schemaFactoryAlpha.js +12 -45
  290. package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  291. package/lib/simple-tree/api/schemaFactoryBeta.d.ts +90 -1
  292. package/lib/simple-tree/api/schemaFactoryBeta.d.ts.map +1 -1
  293. package/lib/simple-tree/api/schemaFactoryBeta.js +56 -1
  294. package/lib/simple-tree/api/schemaFactoryBeta.js.map +1 -1
  295. package/lib/simple-tree/api/treeBeta.d.ts +12 -2
  296. package/lib/simple-tree/api/treeBeta.d.ts.map +1 -1
  297. package/lib/simple-tree/api/treeBeta.js +7 -1
  298. package/lib/simple-tree/api/treeBeta.js.map +1 -1
  299. package/lib/simple-tree/api/typesUnsafe.d.ts +1 -1
  300. package/lib/simple-tree/api/typesUnsafe.js.map +1 -1
  301. package/lib/simple-tree/core/treeNode.d.ts +3 -2
  302. package/lib/simple-tree/core/treeNode.d.ts.map +1 -1
  303. package/lib/simple-tree/core/treeNode.js +3 -2
  304. package/lib/simple-tree/core/treeNode.js.map +1 -1
  305. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
  306. package/lib/simple-tree/node-kinds/record/recordNodeTypes.d.ts +2 -2
  307. package/lib/simple-tree/node-kinds/record/recordNodeTypes.js.map +1 -1
  308. package/lib/util/brand.d.ts +1 -1
  309. package/lib/util/brand.js.map +1 -1
  310. package/package.json +21 -21
  311. package/src/codec/codec.ts +60 -0
  312. package/src/codec/index.ts +3 -0
  313. package/src/core/index.ts +3 -0
  314. package/src/core/schema-stored/index.ts +1 -0
  315. package/src/core/schema-stored/schema.ts +5 -6
  316. package/src/core/tree/detachedFieldIndexCodecs.ts +9 -0
  317. package/src/core/tree/index.ts +6 -0
  318. package/src/feature-libraries/chunked-forest/codec/codecs.ts +6 -1
  319. package/src/feature-libraries/chunked-forest/codec/format.ts +2 -0
  320. package/src/feature-libraries/chunked-forest/codec/index.ts +2 -1
  321. package/src/feature-libraries/chunked-forest/index.ts +2 -0
  322. package/src/feature-libraries/default-schema/defaultFieldKinds.ts +29 -5
  323. package/src/feature-libraries/default-schema/index.ts +2 -0
  324. package/src/feature-libraries/forest-summary/codec.ts +7 -0
  325. package/src/feature-libraries/forest-summary/index.ts +1 -0
  326. package/src/feature-libraries/index.ts +12 -1
  327. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +1 -1
  328. package/src/feature-libraries/schema-edits/index.ts +5 -1
  329. package/src/feature-libraries/schema-edits/schemaChangeCodecs.ts +17 -1
  330. package/src/feature-libraries/schema-index/codec.ts +5 -0
  331. package/src/feature-libraries/schema-index/index.ts +1 -0
  332. package/src/packageVersion.ts +1 -1
  333. package/src/serializableDomainSchema.ts +12 -11
  334. package/src/shared-tree/index.ts +6 -0
  335. package/src/shared-tree/sharedTree.ts +151 -11
  336. package/src/shared-tree/sharedTreeChangeCodecs.ts +68 -30
  337. package/src/shared-tree/treeCheckout.ts +1 -1
  338. package/src/shared-tree-core/defaultResubmitMachine.ts +77 -120
  339. package/src/shared-tree-core/editManager.ts +10 -4
  340. package/src/shared-tree-core/editManagerCodecs.ts +62 -9
  341. package/src/shared-tree-core/index.ts +12 -1
  342. package/src/shared-tree-core/messageCodecs.ts +70 -27
  343. package/src/shared-tree-core/resubmitMachine.ts +12 -20
  344. package/src/shared-tree-core/sharedTreeCore.ts +26 -18
  345. package/src/simple-tree/api/schemaFactoryAlpha.ts +16 -296
  346. package/src/simple-tree/api/schemaFactoryBeta.ts +269 -1
  347. package/src/simple-tree/api/treeBeta.ts +36 -1
  348. package/src/simple-tree/api/typesUnsafe.ts +1 -1
  349. package/src/simple-tree/core/treeNode.ts +3 -2
  350. package/src/simple-tree/core/treeNodeKernel.ts +1 -1
  351. package/src/simple-tree/node-kinds/record/recordNodeTypes.ts +2 -2
  352. package/src/util/brand.ts +1 -1
package/.eslintrc.cjs CHANGED
@@ -10,7 +10,11 @@ module.exports = {
10
10
  },
11
11
  rules: {
12
12
  "@typescript-eslint/no-namespace": "off",
13
+
14
+ // This library leverages empty, derived interface definitions to capture concepts
15
+ // in a nicely reusable way.
13
16
  "@typescript-eslint/no-empty-interface": "off",
17
+
14
18
  "@fluid-internal/fluid/no-unchecked-record-access": "warn",
15
19
 
16
20
  // This package is build with noUnusedLocals disabled for a specific use case (see note in tsconfig.json),
@@ -269,6 +269,28 @@ export enum FluidClientVersion {
269
269
  v2_52 = 2.052
270
270
  }
271
271
 
272
+ // @alpha
273
+ export namespace FluidSerializableAsTree {
274
+ // @sealed
275
+ export class Array extends _APIExtractorWorkaroundArrayBase {
276
+ }
277
+ const Tree: readonly [() => typeof FluidSerializableObject, () => typeof Array, LeafSchema_2<"string", string>, LeafSchema_2<"number", number>, LeafSchema_2<"boolean", boolean>, LeafSchema_2<"null", null>, LeafSchema_2<"handle", IFluidHandle<unknown>>];
278
+ export type Data = JsonCompatible<IFluidHandle>;
279
+ const // @system
280
+ _APIExtractorWorkaroundObjectBase: TreeNodeSchemaClass_2<"com.fluidframework.serializable.object", NodeKind_2.Record, TreeRecordNodeUnsafe_2<readonly [() => typeof FluidSerializableObject, () => typeof Array, LeafSchema_2<"string", string>, LeafSchema_2<"number", number>, LeafSchema_2<"boolean", boolean>, LeafSchema_2<"null", null>, LeafSchema_2<"handle", IFluidHandle<unknown>>]> & WithType_2<"com.fluidframework.serializable.object", NodeKind_2.Record, unknown>, {
281
+ readonly [x: string]: string | number | IFluidHandle<unknown> | System_Unsafe_2.InsertableTypedNodeUnsafe<LeafSchema_2<"boolean", boolean>, LeafSchema_2<"boolean", boolean>> | FluidSerializableObject | Array | null;
282
+ }, false, readonly [() => typeof FluidSerializableObject, () => typeof Array, LeafSchema_2<"string", string>, LeafSchema_2<"number", number>, LeafSchema_2<"boolean", boolean>, LeafSchema_2<"null", null>, LeafSchema_2<"handle", IFluidHandle<unknown>>], undefined, unknown>;
283
+ // @sealed
284
+ export class FluidSerializableObject extends _APIExtractorWorkaroundObjectBase {
285
+ }
286
+ // @system
287
+ export type _RecursiveArrayWorkaroundJsonArray = FixRecursiveArraySchema<typeof Array>;
288
+ const // @system
289
+ _APIExtractorWorkaroundArrayBase: ArrayNodeCustomizableSchemaUnsafe_2<"com.fluidframework.serializable.array", readonly [() => typeof FluidSerializableObject, () => typeof Array, LeafSchema_2<"string", string>, LeafSchema_2<"number", number>, LeafSchema_2<"boolean", boolean>, LeafSchema_2<"null", null>, LeafSchema_2<"handle", IFluidHandle<unknown>>], unknown>;
290
+ // (undocumented)
291
+ export type Tree = TreeNodeFromImplicitAllowedTypes<typeof Tree>;
292
+ }
293
+
272
294
  // @beta @input
273
295
  export interface ForestOptions {
274
296
  readonly forest?: ForestType;
@@ -703,7 +725,7 @@ TSchema
703
725
  export interface RecordNodeCustomizableSchema<out TName extends string = string, in out T extends ImplicitAnnotatedAllowedTypes = ImplicitAnnotatedAllowedTypes, out ImplicitlyConstructable extends boolean = true, out TCustomMetadata = unknown> extends TreeNodeSchemaClass<TName, NodeKind.Record, TreeRecordNode<UnannotateImplicitAllowedTypes<T>> & WithType<TName, NodeKind.Record, T>, RecordNodeInsertableData<UnannotateImplicitAllowedTypes<T>>, ImplicitlyConstructable, T, never, TCustomMetadata>, SimpleRecordNodeSchema<TCustomMetadata> {
704
726
  }
705
727
 
706
- // @alpha @system
728
+ // @beta @system
707
729
  export type RecordNodeInsertableData<T extends ImplicitAllowedTypes> = RestrictiveStringRecord<InsertableTreeNodeFromImplicitAllowedTypes<T>>;
708
730
 
709
731
  // @alpha @sealed @system
@@ -849,8 +871,6 @@ export class SchemaFactoryAlpha<out TScope extends string | undefined = string |
849
871
  };
850
872
  static readonly optionalRecursive: <const T extends System_Unsafe.ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldPropsAlpha<TCustomMetadata>, "defaultProvider"> | undefined) => FieldSchemaAlphaUnsafe<FieldKind.Optional, T, TCustomMetadata>;
851
873
  readonly optionalRecursive: <const T extends System_Unsafe.ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldPropsAlpha<TCustomMetadata>, "defaultProvider"> | undefined) => FieldSchemaAlphaUnsafe<FieldKind.Optional, T, TCustomMetadata>;
852
- record<const T extends TreeNodeSchema | readonly TreeNodeSchema[]>(allowedTypes: T): TreeNodeSchemaNonClass<ScopedSchemaName<TScope, `Record<${string}>`>, NodeKind.Record, TreeRecordNode<T> & WithType<ScopedSchemaName<TScope, `Record<${string}>`>, NodeKind.Record>, RecordNodeInsertableData<T>, true, T, undefined>;
853
- record<const Name extends TName, const T extends ImplicitAllowedTypes>(name: Name, allowedTypes: T): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Record, TreeRecordNode<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Record>, RecordNodeInsertableData<T>, true, T, undefined>;
854
874
  recordAlpha<const Name extends TName, const T extends ImplicitAnnotatedAllowedTypes, const TCustomMetadata = unknown>(name: Name, allowedTypes: T, options?: NodeSchemaOptionsAlpha<TCustomMetadata>): RecordNodeCustomizableSchema<ScopedSchemaName<TScope, Name>, T, true, TCustomMetadata>;
855
875
  recordRecursive<Name extends TName, const T extends System_Unsafe.ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(name: Name, allowedTypes: T, options?: NodeSchemaOptionsAlpha<TCustomMetadata>): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Record, TreeRecordNodeUnsafe<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Record, unknown>, {
856
876
  readonly [x: string]: System_Unsafe.InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>;
@@ -872,6 +892,11 @@ export class SchemaFactoryAlpha<out TScope extends string | undefined = string |
872
892
 
873
893
  // @beta
874
894
  export class SchemaFactoryBeta<out TScope extends string | undefined = string | undefined, TName extends number | string = string> extends SchemaFactory<TScope, TName> {
895
+ record<const T extends TreeNodeSchema | readonly TreeNodeSchema[]>(allowedTypes: T): TreeNodeSchemaNonClass<ScopedSchemaName<TScope, `Record<${string}>`>, NodeKind.Record, TreeRecordNode<T> & WithType<ScopedSchemaName<TScope, `Record<${string}>`>, NodeKind.Record>, RecordNodeInsertableData<T>, true, T, undefined>;
896
+ record<const Name extends TName, const T extends ImplicitAllowedTypes>(name: Name, allowedTypes: T): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Record, TreeRecordNode<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Record>, RecordNodeInsertableData<T>, true, T, undefined>;
897
+ recordRecursive<Name extends TName, const T extends System_Unsafe.ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(name: Name, allowedTypes: T, options?: NodeSchemaOptions<TCustomMetadata>): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Record, TreeRecordNodeUnsafe<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Record, unknown>, {
898
+ readonly [x: string]: System_Unsafe.InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>;
899
+ }, false, T, undefined, TCustomMetadata>;
875
900
  scopedFactory<const T extends TName, TNameInner extends number | string = string>(name: T): SchemaFactoryBeta<ScopedSchemaName<TScope, T>, TNameInner>;
876
901
  }
877
902
 
@@ -1336,6 +1361,7 @@ export const TreeArrayNode: {
1336
1361
  // @beta @sealed @system
1337
1362
  export interface TreeBeta {
1338
1363
  clone<const TSchema extends ImplicitFieldSchema>(node: TreeFieldFromImplicitField<TSchema>): TreeFieldFromImplicitField<TSchema>;
1364
+ create<const TSchema extends ImplicitFieldSchema>(schema: TSchema, data: InsertableTreeFieldFromImplicitField<TSchema>): Unhydrated<TreeFieldFromImplicitField<TSchema>>;
1339
1365
  on<K extends keyof TreeChangeEventsBeta<TNode>, TNode extends TreeNode>(node: TNode, eventName: K, listener: NoInfer<TreeChangeEventsBeta<TNode>[K]>): () => void;
1340
1366
  }
1341
1367
 
@@ -1481,7 +1507,7 @@ export type TreeObjectNode<T extends RestrictiveStringRecord<ImplicitFieldSchema
1481
1507
  // @alpha @input
1482
1508
  export type TreeParsingOptions = TreeEncodingOptions<KeyEncodingOptions.usePropertyKeys | KeyEncodingOptions.knownStoredKeys>;
1483
1509
 
1484
- // @alpha
1510
+ // @beta
1485
1511
  export interface TreeRecordNode<TAllowedTypes extends ImplicitAllowedTypes = ImplicitAllowedTypes> extends TreeNode, Record<string, TreeNodeFromImplicitAllowedTypes<TAllowedTypes>> {
1486
1512
  [Symbol.iterator](): IterableIterator<[
1487
1513
  string,
@@ -1489,7 +1515,7 @@ export interface TreeRecordNode<TAllowedTypes extends ImplicitAllowedTypes = Imp
1489
1515
  ]>;
1490
1516
  }
1491
1517
 
1492
- // @alpha @sealed @system
1518
+ // @beta @sealed @system
1493
1519
  export interface TreeRecordNodeUnsafe<TAllowedTypes extends System_Unsafe.ImplicitAllowedTypesUnsafe> extends Record<string, System_Unsafe.TreeNodeFromImplicitAllowedTypesUnsafe<TAllowedTypes>>, TreeNode {
1494
1520
  // (undocumented)
1495
1521
  [Symbol.iterator](): IterableIterator<[
@@ -293,6 +293,9 @@ export type PopUnion<Union, AsOverloadedFunction = UnionToIntersection<Union ext
293
293
  export interface ReadonlyArrayNode<out T = TreeNode | TreeLeafValue> extends ReadonlyArray<T>, Awaited<TreeNode & WithType<string, NodeKind.Array>> {
294
294
  }
295
295
 
296
+ // @beta @system
297
+ export type RecordNodeInsertableData<T extends ImplicitAllowedTypes> = RestrictiveStringRecord<InsertableTreeNodeFromImplicitAllowedTypes<T>>;
298
+
296
299
  // @public @deprecated
297
300
  export type RestrictiveReadonlyRecord<K extends symbol | string, T> = {
298
301
  readonly [P in symbol | string]: P extends K ? T : never;
@@ -381,6 +384,11 @@ export const SchemaFactory_base: SchemaStatics & (new () => SchemaStatics);
381
384
 
382
385
  // @beta
383
386
  export class SchemaFactoryBeta<out TScope extends string | undefined = string | undefined, TName extends number | string = string> extends SchemaFactory<TScope, TName> {
387
+ record<const T extends TreeNodeSchema | readonly TreeNodeSchema[]>(allowedTypes: T): TreeNodeSchemaNonClass<ScopedSchemaName<TScope, `Record<${string}>`>, NodeKind.Record, TreeRecordNode<T> & WithType<ScopedSchemaName<TScope, `Record<${string}>`>, NodeKind.Record>, RecordNodeInsertableData<T>, true, T, undefined>;
388
+ record<const Name extends TName, const T extends ImplicitAllowedTypes>(name: Name, allowedTypes: T): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Record, TreeRecordNode<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Record>, RecordNodeInsertableData<T>, true, T, undefined>;
389
+ recordRecursive<Name extends TName, const T extends System_Unsafe.ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(name: Name, allowedTypes: T, options?: NodeSchemaOptions<TCustomMetadata>): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Record, TreeRecordNodeUnsafe<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Record, unknown>, {
390
+ readonly [x: string]: System_Unsafe.InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>;
391
+ }, false, T, undefined, TCustomMetadata>;
384
392
  scopedFactory<const T extends TName, TNameInner extends number | string = string>(name: T): SchemaFactoryBeta<ScopedSchemaName<TScope, T>, TNameInner>;
385
393
  }
386
394
 
@@ -546,6 +554,7 @@ export const TreeArrayNode: {
546
554
  // @beta @sealed @system
547
555
  export interface TreeBeta {
548
556
  clone<const TSchema extends ImplicitFieldSchema>(node: TreeFieldFromImplicitField<TSchema>): TreeFieldFromImplicitField<TSchema>;
557
+ create<const TSchema extends ImplicitFieldSchema>(schema: TSchema, data: InsertableTreeFieldFromImplicitField<TSchema>): Unhydrated<TreeFieldFromImplicitField<TSchema>>;
549
558
  on<K extends keyof TreeChangeEventsBeta<TNode>, TNode extends TreeNode>(node: TNode, eventName: K, listener: NoInfer<TreeChangeEventsBeta<TNode>[K]>): () => void;
550
559
  }
551
560
 
@@ -634,6 +643,23 @@ export type TreeNodeSchemaNonClass<Name extends string = string, Kind extends No
634
643
  // @public
635
644
  export type TreeObjectNode<T extends RestrictiveStringRecord<ImplicitFieldSchema>, TypeName extends string = string> = TreeNode & ObjectFromSchemaRecord<T> & WithType<TypeName, NodeKind.Object, T>;
636
645
 
646
+ // @beta
647
+ export interface TreeRecordNode<TAllowedTypes extends ImplicitAllowedTypes = ImplicitAllowedTypes> extends TreeNode, Record<string, TreeNodeFromImplicitAllowedTypes<TAllowedTypes>> {
648
+ [Symbol.iterator](): IterableIterator<[
649
+ string,
650
+ TreeNodeFromImplicitAllowedTypes<TAllowedTypes>
651
+ ]>;
652
+ }
653
+
654
+ // @beta @sealed @system
655
+ export interface TreeRecordNodeUnsafe<TAllowedTypes extends System_Unsafe.ImplicitAllowedTypesUnsafe> extends Record<string, System_Unsafe.TreeNodeFromImplicitAllowedTypesUnsafe<TAllowedTypes>>, TreeNode {
656
+ // (undocumented)
657
+ [Symbol.iterator](): IterableIterator<[
658
+ string,
659
+ System_Unsafe.TreeNodeFromImplicitAllowedTypesUnsafe<TAllowedTypes>
660
+ ]>;
661
+ }
662
+
637
663
  // @public
638
664
  export enum TreeStatus {
639
665
  Deleted = 2,
@@ -296,6 +296,9 @@ export type PopUnion<Union, AsOverloadedFunction = UnionToIntersection<Union ext
296
296
  export interface ReadonlyArrayNode<out T = TreeNode | TreeLeafValue> extends ReadonlyArray<T>, Awaited<TreeNode & WithType<string, NodeKind.Array>> {
297
297
  }
298
298
 
299
+ // @beta @system
300
+ export type RecordNodeInsertableData<T extends ImplicitAllowedTypes> = RestrictiveStringRecord<InsertableTreeNodeFromImplicitAllowedTypes<T>>;
301
+
299
302
  // @public @deprecated
300
303
  export type RestrictiveReadonlyRecord<K extends symbol | string, T> = {
301
304
  readonly [P in symbol | string]: P extends K ? T : never;
@@ -384,6 +387,11 @@ export const SchemaFactory_base: SchemaStatics & (new () => SchemaStatics);
384
387
 
385
388
  // @beta
386
389
  export class SchemaFactoryBeta<out TScope extends string | undefined = string | undefined, TName extends number | string = string> extends SchemaFactory<TScope, TName> {
390
+ record<const T extends TreeNodeSchema | readonly TreeNodeSchema[]>(allowedTypes: T): TreeNodeSchemaNonClass<ScopedSchemaName<TScope, `Record<${string}>`>, NodeKind.Record, TreeRecordNode<T> & WithType<ScopedSchemaName<TScope, `Record<${string}>`>, NodeKind.Record>, RecordNodeInsertableData<T>, true, T, undefined>;
391
+ record<const Name extends TName, const T extends ImplicitAllowedTypes>(name: Name, allowedTypes: T): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Record, TreeRecordNode<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Record>, RecordNodeInsertableData<T>, true, T, undefined>;
392
+ recordRecursive<Name extends TName, const T extends System_Unsafe.ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(name: Name, allowedTypes: T, options?: NodeSchemaOptions<TCustomMetadata>): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Record, TreeRecordNodeUnsafe<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Record, unknown>, {
393
+ readonly [x: string]: System_Unsafe.InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>;
394
+ }, false, T, undefined, TCustomMetadata>;
387
395
  scopedFactory<const T extends TName, TNameInner extends number | string = string>(name: T): SchemaFactoryBeta<ScopedSchemaName<TScope, T>, TNameInner>;
388
396
  }
389
397
 
@@ -558,6 +566,7 @@ export const TreeArrayNode: {
558
566
  // @beta @sealed @system
559
567
  export interface TreeBeta {
560
568
  clone<const TSchema extends ImplicitFieldSchema>(node: TreeFieldFromImplicitField<TSchema>): TreeFieldFromImplicitField<TSchema>;
569
+ create<const TSchema extends ImplicitFieldSchema>(schema: TSchema, data: InsertableTreeFieldFromImplicitField<TSchema>): Unhydrated<TreeFieldFromImplicitField<TSchema>>;
561
570
  on<K extends keyof TreeChangeEventsBeta<TNode>, TNode extends TreeNode>(node: TNode, eventName: K, listener: NoInfer<TreeChangeEventsBeta<TNode>[K]>): () => void;
562
571
  }
563
572
 
@@ -646,6 +655,23 @@ export type TreeNodeSchemaNonClass<Name extends string = string, Kind extends No
646
655
  // @public
647
656
  export type TreeObjectNode<T extends RestrictiveStringRecord<ImplicitFieldSchema>, TypeName extends string = string> = TreeNode & ObjectFromSchemaRecord<T> & WithType<TypeName, NodeKind.Object, T>;
648
657
 
658
+ // @beta
659
+ export interface TreeRecordNode<TAllowedTypes extends ImplicitAllowedTypes = ImplicitAllowedTypes> extends TreeNode, Record<string, TreeNodeFromImplicitAllowedTypes<TAllowedTypes>> {
660
+ [Symbol.iterator](): IterableIterator<[
661
+ string,
662
+ TreeNodeFromImplicitAllowedTypes<TAllowedTypes>
663
+ ]>;
664
+ }
665
+
666
+ // @beta @sealed @system
667
+ export interface TreeRecordNodeUnsafe<TAllowedTypes extends System_Unsafe.ImplicitAllowedTypesUnsafe> extends Record<string, System_Unsafe.TreeNodeFromImplicitAllowedTypesUnsafe<TAllowedTypes>>, TreeNode {
668
+ // (undocumented)
669
+ [Symbol.iterator](): IterableIterator<[
670
+ string,
671
+ System_Unsafe.TreeNodeFromImplicitAllowedTypesUnsafe<TAllowedTypes>
672
+ ]>;
673
+ }
674
+
649
675
  // @public
650
676
  export enum TreeStatus {
651
677
  Deleted = 2,
package/dist/alpha.d.ts CHANGED
@@ -99,10 +99,13 @@ export {
99
99
  ForestTypeReference,
100
100
  NodeChangedData,
101
101
  PopUnion,
102
+ RecordNodeInsertableData,
102
103
  SchemaFactoryBeta,
103
104
  SharedTreeOptionsBeta,
104
105
  TreeBeta,
105
106
  TreeChangeEventsBeta,
107
+ TreeRecordNode,
108
+ TreeRecordNodeUnsafe,
106
109
  UnionToTuple,
107
110
  adaptEnum,
108
111
  configuredSharedTreeBeta,
@@ -131,6 +134,7 @@ export {
131
134
  FieldSchemaAlphaUnsafe,
132
135
  FixRecursiveArraySchema,
133
136
  FluidClientVersion,
137
+ FluidSerializableAsTree,
134
138
  FormatValidator,
135
139
  FormatValidatorBasic,
136
140
  FormatValidatorNoOp,
@@ -176,7 +180,6 @@ export {
176
180
  ReadSchema,
177
181
  ReadableField,
178
182
  RecordNodeCustomizableSchema,
179
- RecordNodeInsertableData,
180
183
  RecordNodePojoEmulationSchema,
181
184
  RecordNodeSchema,
182
185
  RevertibleAlpha,
@@ -218,8 +221,6 @@ export {
218
221
  TreeIndexKey,
219
222
  TreeIndexNodes,
220
223
  TreeParsingOptions,
221
- TreeRecordNode,
222
- TreeRecordNodeUnsafe,
223
224
  TreeSchema,
224
225
  TreeSchemaEncodingOptions,
225
226
  TreeViewAlpha,
package/dist/beta.d.ts CHANGED
@@ -99,10 +99,13 @@ export {
99
99
  ForestTypeReference,
100
100
  NodeChangedData,
101
101
  PopUnion,
102
+ RecordNodeInsertableData,
102
103
  SchemaFactoryBeta,
103
104
  SharedTreeOptionsBeta,
104
105
  TreeBeta,
105
106
  TreeChangeEventsBeta,
107
+ TreeRecordNode,
108
+ TreeRecordNodeUnsafe,
106
109
  UnionToTuple,
107
110
  adaptEnum,
108
111
  configuredSharedTreeBeta,
@@ -208,6 +208,32 @@ export interface ICodecFamily<TDecoded, TContext = void> {
208
208
  * Undefined is tolerated to enable the scenario where data was not initially versioned.
209
209
  */
210
210
  export type FormatVersion = number | undefined;
211
+ /**
212
+ * A format version which is dependent on some parent format version.
213
+ */
214
+ export interface DependentFormatVersion<TParentVersion extends FormatVersion = FormatVersion, TChildVersion extends FormatVersion = FormatVersion> {
215
+ /**
216
+ * Looks up the child format version for a given parent format version.
217
+ * @param parent - The parent format version.
218
+ * @returns The corresponding child format version.
219
+ */
220
+ lookup(parent: TParentVersion): TChildVersion;
221
+ }
222
+ export declare class UniqueDependentFormatVersion<TChildVersion extends FormatVersion> implements DependentFormatVersion<FormatVersion, TChildVersion> {
223
+ private readonly child;
224
+ constructor(child: TChildVersion);
225
+ lookup(_parent: FormatVersion): TChildVersion;
226
+ }
227
+ export declare class MappedDependentFormatVersion<TParentVersion extends FormatVersion = FormatVersion, TChildVersion extends FormatVersion = FormatVersion> implements DependentFormatVersion<TParentVersion, TChildVersion> {
228
+ private readonly map;
229
+ constructor(map: ReadonlyMap<TParentVersion, TChildVersion>);
230
+ lookup(parent: TParentVersion): TChildVersion;
231
+ }
232
+ export declare const DependentFormatVersion: {
233
+ fromUnique: <TChildVersion extends FormatVersion>(child: TChildVersion) => UniqueDependentFormatVersion<TChildVersion>;
234
+ fromMap: <TParentVersion extends FormatVersion, TChildVersion_1 extends FormatVersion>(map: ReadonlyMap<TParentVersion, TChildVersion_1>) => MappedDependentFormatVersion<TParentVersion, TChildVersion_1>;
235
+ fromPairs: <TParentVersion_1 extends FormatVersion, TChildVersion_2 extends FormatVersion>(pairs: Iterable<[TParentVersion_1, TChildVersion_2]>) => MappedDependentFormatVersion<TParentVersion_1, TChildVersion_2>;
236
+ };
211
237
  /**
212
238
  * Creates a codec family from a registry of codecs.
213
239
  * Any codec that is not a {@link IMultiFormatCodec} will be wrapped with a default binary encoding.
@@ -309,4 +335,10 @@ export declare enum FluidClientVersion {
309
335
  * TODO: Consider using packageVersion.ts to keep this current.
310
336
  */
311
337
  export declare const currentVersion: FluidClientVersion;
338
+ export interface CodecTree {
339
+ readonly name: string;
340
+ readonly version: FormatVersion;
341
+ readonly children?: readonly CodecTree[];
342
+ }
343
+ export declare function jsonableCodecTree(tree: CodecTree): JsonCompatibleReadOnly;
312
344
  //# sourceMappingURL=codec.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"codec.d.ts","sourceRoot":"","sources":["../../src/codec/codec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAC3E,OAAO,EAAE,SAAS,EAAkB,MAAM,8BAA8B,CAAC;AAEzE,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAErE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAE/D;;;GAGG;AACH,MAAM,WAAW,QAAQ,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ;IACrD;;OAEG;IACH,MAAM,CAAC,GAAG,EAAE,QAAQ,EAAE,O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H,eAAO,MAAM,SAAS,EAAE,iBAAiB,CACxC,CAAC,EACD,sBAAsB,EACtB,sBAAsB,EACtB,OAAO,CAUP,CAAC;AAEF;;;GAGG;AACH,wBAAgB,oBAAoB,CACnC,eAAe,EACf,aAAa,SAAS,OAAO,EAC7B,cAAc,GAAG,sBAAsB,EACvC,SAAS,GAAG,cAAc,EAC1B,QAAQ,GAAG,qBAAqB,EAEhC,MAAM,EAAE,aAAa,EACrB,KAAK,EAAE,UAAU,CAAC,eAAe,EAAE,cAAc,EAAE,SAAS,EAAE,QAAQ,CAAC,EACvE,SAAS,CAAC,EAAE,aAAa,GAAG,eAAe,GACzC,UAAU,CAAC,eAAe,EAAE,cAAc,EAAE,SAAS,EAAE,QAAQ,CAAC,CAqBlE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,oBAAY,kBAAkB;IAC7B;;;;;;OAMG;IAGH,4CAA4C;IAC5C,IAAI,IAAM;IAEV,4CAA4C;IAM5C,6CAA6C;IAG7C,KAAK,QAAQ;IAEb;;;;;;;;OAQG;IACH,sBAAiD;CACjD;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,EAAE,kBAA4C,CAAC;AAE1E,MAAM,WAAW,SAAS;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC;IAChC,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,SAAS,EAAE,CAAC;CACzC;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,SAAS,GAAG,sBAAsB,CAMzE"}
@@ -4,7 +4,7 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.currentVersion = exports.FluidClientVersion = exports.withSchemaValidation = exports.unitCodec = exports.ensureBinaryEncoding = exports.withDefaultBinaryEncoding = exports.makeCodecFamily = exports.extractJsonValidator = exports.toFormatValidator = exports.FormatValidatorNoOp = void 0;
7
+ exports.jsonableCodecTree = exports.currentVersion = exports.FluidClientVersion = exports.withSchemaValidation = exports.unitCodec = exports.ensureBinaryEncoding = exports.withDefaultBinaryEncoding = exports.makeCodecFamily = exports.DependentFormatVersion = exports.MappedDependentFormatVersion = exports.UniqueDependentFormatVersion = exports.extractJsonValidator = exports.toFormatValidator = exports.FormatValidatorNoOp = void 0;
8
8
  const client_utils_1 = require("@fluid-internal/client-utils");
9
9
  const internal_1 = require("@fluidframework/core-utils/internal");
10
10
  /**
@@ -34,6 +34,29 @@ function extractJsonValidator(input) {
34
34
  return input;
35
35
  }
36
36
  exports.extractJsonValidator = extractJsonValidator;
37
+ class UniqueDependentFormatVersion {
38
+ constructor(child) {
39
+ this.child = child;
40
+ }
41
+ lookup(_parent) {
42
+ return this.child;
43
+ }
44
+ }
45
+ exports.UniqueDependentFormatVersion = UniqueDependentFormatVersion;
46
+ class MappedDependentFormatVersion {
47
+ constructor(map) {
48
+ this.map = map;
49
+ }
50
+ lookup(parent) {
51
+ return this.map.get(parent) ?? (0, internal_1.fail)("Unknown parent version");
52
+ }
53
+ }
54
+ exports.MappedDependentFormatVersion = MappedDependentFormatVersion;
55
+ exports.DependentFormatVersion = {
56
+ fromUnique: (child) => new UniqueDependentFormatVersion(child),
57
+ fromMap: (map) => new MappedDependentFormatVersion(map),
58
+ fromPairs: (pairs) => new MappedDependentFormatVersion(new Map(pairs)),
59
+ };
37
60
  /**
38
61
  * Creates a codec family from a registry of codecs.
39
62
  * Any codec that is not a {@link IMultiFormatCodec} will be wrapped with a default binary encoding.
@@ -217,4 +240,12 @@ var FluidClientVersion;
217
240
  * TODO: Consider using packageVersion.ts to keep this current.
218
241
  */
219
242
  exports.currentVersion = FluidClientVersion.v2_0;
243
+ function jsonableCodecTree(tree) {
244
+ return {
245
+ name: tree.name,
246
+ version: tree.version ?? "null",
247
+ children: tree.children?.map(jsonableCodecTree),
248
+ };
249
+ }
250
+ exports.jsonableCodecTree = jsonableCodecTree;
220
251
  //# sourceMappingURL=codec.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"codec.js","sourceRoot":"","sources":["../../src/codec/codec.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,+DAAyE;AACzE,kEAAmE;AA2DnE;;;;GAIG;AACH,MAAM,aAAa,GAAkB;IACpC,OAAO,EAAE,GAA2B,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,IAAI,EAA0B,EAAE,CAAC,IAAI,EAAE,CAAC;CAC1F,CAAC;AAEF;;;GAGG;AACU,QAAA,mBAAmB,GAAG,iBAAiB,CAAC,aAAa,CAAC,CAAC;AAEpE;;GAEG;AACH,SAAgB,iBAAiB,CAAC,OAAsB;IACvD,OAAO,OAAqC,CAAC;AAC9C,CAAC;AAFD,8CAEC;AAED;;GAEG;AACH,SAAgB,oBAAoB,CAAC,KAAsC;IAC1E,OAAO,KAAiC,CAAC;AAC1C,CAAC;AAFD,oDAEC;AAoKD;;;GAGG;AACH,SAAgB,eAAe,CAC9B,QAOC;IAED,MAAM,MAAM,GAGR,IAAI,GAAG,EAAE,CAAC;IACd,KAAK,MAAM,CAAC,aAAa,EAAE,KAAK,CAAC,IAAI,QAAQ,EAAE,CAAC;QAC/C,IAAI,MAAM,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE,CAAC;YAC/B,IAAA,eAAI,EAAC,KAAK,CAAC,iCAAiC,CAAC,CAAC;QAC/C,CAAC;QACD,MAAM,CAAC,GAAG,CAAC,aAAa,EAAE,oBAAoB,CAAC,KAAK,CAAC,CAAC,CAAC;IACxD,CAAC;IAED,OAAO;QACN,OAAO,CACN,aAAqB;YAErB,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;YACxC,IAAA,iBAAM,EAAC,KAAK,KAAK,SAAS,EAAE,KAAK,CAAC,6CAA6C,CAAC,CAAC;YACjF,OAAO,KAAK,CAAC;QACd,CAAC;QACD,mBAAmB;YAClB,OAAO,MA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;;;;OAMG;IACH,gBAAgB;IAEhB,4CAA4C;IAC5C,2DAAU,CAAA;IAEV,4CAA4C;IAC5C,8HAA8H;IAC9H,0GAA0G;IAC1G,sEAAsE;IACtE,eAAe;IAEf,6CAA6C;IAC7C,kCAAkC;IAClC,gCAAgC;IAChC,iEAAa,CAAA;IAEb;;;;;;;;OAQG;IACH,kEAAyB,MAAM,CAAC,iBAAiB,4BAAA,CAAA;AAClD,CAAC,EAlCW,kBAAkB,kCAAlB,kBAAkB,QAkC7B;AAED;;;;;;;;GAQG;AACU,QAAA,cAAc,GAAuB,kBAAkB,CAAC,IAAI,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ErasedType } from \"@fluidframework/core-interfaces/internal\";\nimport { IsoBuffer, bufferToString } from \"@fluid-internal/client-utils\";\nimport { assert, fail } from \"@fluidframework/core-utils/internal\";\nimport type { Static, TAnySchema, TSchema } from \"@sinclair/typebox\";\n\nimport type { ChangeEncodingContext } from \"../core/index.js\";\nimport type { JsonCompatibleReadOnly } from \"../util/index.js\";\n\n/**\n * Translates decoded data to encoded data.\n * @remarks Typically paired with an {@link IEncoder}.\n */\nexport interface IEncoder<TDecoded, TEncoded, TContext> {\n\t/**\n\t * Encodes `obj` into some encoded format.\n\t */\n\tencode(obj: TDecoded, context: TContext): TEncoded;\n}\n\n/**\n * Translates encoded data to decoded data.\n * @remarks Typically paired with an {@link IEncoder}.\n */\nexport interface IDecoder<TDecoded, TEncoded, TContext> {\n\t/**\n\t * Decodes `obj` from some encoded format.\n\t */\n\tdecode(obj: TEncoded, context: TContext): TDecoded;\n}\n\n/**\n * Validates data complies with some particular schema.\n * Implementations are typically created by a {@link JsonValidator}.\n */\nexport interface SchemaValidationFunction<Schema extends TSchema> {\n\t/**\n\t * Returns whether the data matches a schema.\n\t */\n\tcheck(data: unknown): data is Static<Schema>;\n}\n\n/**\n * A kind of validator for SharedTree's internal data formats.\n * @remarks\n * Assuming no data corruption or type confusion, such validation should never fail.\n * Any client version compatibility issues should instead be detected by the data format versioning which Shared Tree does internally independent of data format validation.\n * However, persisted data can sometimes be corrupted, bugs can produce invalid data, or users can mix up which data is compatible with which APIs.\n * In such cases, a format validator can help catch issues.\n *\n * Current options are {@link FormatValidatorNoOp} and {@link FormatValidatorBasic}.\n * @privateRemarks\n * Implement using {@link toFormatValidator}.\n * Consume using {@link extractJsonValidator}.\n *\n * Exposing this as the stable API entry point (instead of {@link JsonValidator}) means that we avoid leaking the reference to TypeBox to the API surface.\n * Additionally, if we adopt non JSON formats, we can just update the validators as needed without breaking the API.\n * This also allows us to avoid stabilizing or documenting how handles interact with JSON validation since that is not exposed through this type.\n * @sealed @alpha\n */\nexport interface FormatValidator extends ErasedType<\"FormatValidator\"> {}\n\n/**\n * A {@link JsonValidator} implementation which performs no validation and accepts all data as valid.\n * @privateRemarks Having this as an option unifies opting out of validation with selection of\n * validators, simplifying code performing validation.\n */\nconst noopValidator: JsonValidator = {\n\tcompile: <Schema extends TSchema>() => ({ check: (data): data is Static<Schema> => true }),\n};\n\n/**\n * A {@link FormatValidator} which does no validation.\n * @alpha\n */\nexport const FormatValidatorNoOp = toFormatValidator(noopValidator);\n\n/**\n * Type erase a {@link JsonValidator} to a {@link FormatValidator}.\n */\nexport function toFormatValidator(factory: JsonValidator): FormatValidator {\n\treturn factory as unknown as FormatValidator;\n}\n\n/**\n * Un-type-erase the {@link FormatValidator}.\n */\nexport function extractJsonValidator(input: FormatValidator | JsonValidator): JsonValidator {\n\treturn input as unknown as JsonValidator;\n}\n\n/**\n * JSON schema validator compliant with draft 6 schema. See https://json-schema.org.\n * @alpha @input\n */\nexport interface JsonValidator {\n\t/**\n\t * Compiles the provided JSON schema into a validator for that schema.\n\t * @param schema - A valid draft 6 JSON schema\n\t * @remarks IFluidHandles--which have circular property references--are used in various places in SharedTree's persisted\n\t * format. Handles should only be contained in sections of data which are validated against the empty schema `{}`\n\t * (see https://datatracker.ietf.org/doc/html/draft-wright-json-schema-01#section-4.4).\n\t *\n\t * Implementations of `JsonValidator` must therefore tolerate these values, despite the input not being valid JSON.\n\t */\n\tcompile<Schema extends TSchema>(schema: Schema): SchemaValidationFunction<Schema>;\n}\n\n/**\n * Options relating to handling of persisted data.\n *\n * @see {@link CodecWriteOptions} for options that are specific to encoding data.\n * @alpha @input\n */\nexport interface ICodecOptions {\n\t/**\n\t * {@link FormatValidator} which SharedTree uses to validate persisted data it reads & writes\n\t * matches the expected encoded format (i.e. the wire format for ops and summaries).\n\t * @remarks\n\t * See {@link FormatValidatorNoOp} and {@link FormatValidatorBasic} for out-of-the-box implementations.\n\t *\n\t * This option is not \"on-by-default\" because JSON schema validation comes with a small but noticeable\n\t * runtime performance cost, and popular schema validation libraries have relatively large bundle size.\n\t *\n\t * SharedTree users are still encouraged to use a non-trivial validator (i.e. not `FormatValidatorNoOp`)\n\t * whenever reasonable: it gives better fail-fast behavior when unexpected encoded data is found,\n\t * which reduces the risk of unrecoverable data corruption.\n\t * @privateRemarks\n\t * This property should probably be renamed to `validator` before stabilizing the API.\n\t */\n\treadonly jsonValidator: FormatValidator;\n}\n\n/**\n * Options relating to encoding of persisted data.\n * @remarks\n * Extends {@link ICodecOptions} with options that are specific to encoding data.\n * @alpha @input\n */\nexport interface CodecWriteOptions extends ICodecOptions {\n\t/**\n\t * The minimum version of the Fluid Framework client output must be encoded to be compatible with.\n\t * @remarks\n\t * This is used to ensure that the the output from this codec can be used with older versions of the Fluid Framework client.\n\t * This includes both concurrent collaboration, and an older version opening the document later.\n\t *\n\t * Note that versions older than this should not result in data corruption if they access the data:\n\t * the data's format should be versioned and if they can't handle the format they should error.\n\t */\n\treadonly oldestCompatibleClient: FluidClientVersion;\n}\n\n/**\n * `TContext` allows passing context to the codec which may configure how data is encoded/decoded.\n * This parameter is typically used for:\n * - Codecs which can pick from multiple encoding options, and imbue the encoded data with information about which option was used.\n * The caller of such a codec can provide context about which encoding choice to make as part of the `encode` call without creating\n * additional codecs. Note that this pattern can always be implemented by having the caller create multiple codecs and selecting the\n * appropriate one, but depending on API layering this might be less ergonomic.\n * - Context for the object currently being encoded, which might enable more efficient encoding. When used in this fashion, the codec author\n * should be careful to include the context somewhere in the encoded data such that decoding can correctly round-trip.\n * For example, a composed set of codecs could implement a form of [dictionary coding](https://en.wikipedia.org/wiki/Dictionary_coder)\n * using a context map which was created by the top-level codec and passed to the inner codecs.\n * This pattern is used:\n * - To avoid repeatedly encoding session ids on commits (only recording it once at the top level)\n * @remarks `TEncoded` should always be valid Json (i.e. not contain functions), but due to TypeScript's handling\n * of index signatures and `JsonCompatibleReadOnly`'s index signature in the Json object case, specifying this as a\n * type-system level constraint makes code that uses this interface more difficult to write.\n *\n * If provided, `TValidate` allows the input type passed to `decode` to be different than `TEncoded`.\n * This is useful when, for example, the type being decoded is `unknown` and must be validated to be a `TEncoded` before being decoded to a `TDecoded`.\n */\nexport interface IJsonCodec<\n\tTDecoded,\n\tTEncoded = JsonCompatibleReadOnly,\n\tTValidate = TEncoded,\n\tTContext = void,\n> extends IEncoder<TDecoded, TEncoded, TContext>,\n\t\tIDecoder<TDecoded, TValidate, TContext> {\n\tencodedSchema?: TAnySchema;\n}\n\n/**\n * @remarks TODO: We might consider using DataView or some kind of writer instead of IsoBuffer.\n */\nexport interface IBinaryCodec<TDecoded, TContext = void>\n\textends IEncoder<TDecoded, IsoBuffer, TContext>,\n\t\tIDecoder<TDecoded, IsoBuffer, TContext> {}\n\n/**\n * Contains knowledge of how to encode some in-memory type into JSON and binary formats,\n * as well as how to decode those representations.\n *\n * @remarks Codecs are typically used in shared-tree to convert data into some persisted format.\n * For this common use case, any format for encoding that was ever actually used needs to\n * be supported for decoding in all future code versions.\n *\n * Using an {@link ICodecFamily} is the recommended strategy for managing this support, keeping in\n * mind evolution of encodings over time.\n */\nexport interface IMultiFormatCodec<\n\tTDecoded,\n\tTJsonEncoded extends JsonCompatibleReadOnly = JsonCompatibleReadOnly,\n\tTJsonValidate = TJsonEncoded,\n\tTContext = void,\n> {\n\tjson: IJsonCodec<TDecoded, TJsonEncoded, TJsonValidate, TContext>;\n\tbinary: IBinaryCodec<TDecoded, TContext>;\n\n\t/** Ensures multi-format codecs cannot also be single-format codecs. */\n\tencode?: never;\n\t/** Ensures multi-format codecs cannot also be single-format codecs. */\n\tdecode?: never;\n}\n\n/**\n * Represents a family of codecs that can be used to encode and decode data in different formats.\n * The family is identified by a format version, which is typically used to select the codec to use.\n *\n * Separating codecs into families rather than having a single codec support multiple versions (i.e. currying\n * the `formatVersion` parameter)\n * allows avoiding some duplicate work at encode/decode time, since the vast majority of document usage will not\n * involve mixed format versions.\n *\n * @privateRemarks - This interface currently assumes all codecs in a family require the same encode/decode context,\n * which isn't necessarily true.\n * This may need to be relaxed in the future.\n */\nexport interface ICodecFamily<TDecoded, TContext = void> {\n\t/**\n\t * @returns a codec that can be used to encode and decode data in the specified format.\n\t * @throws - if the format version is not supported by this family.\n\t * @remarks Implementations should typically emit telemetry (either indirectly by throwing a well-known error with\n\t * logged properties or directly using some logger) when a format version is requested that is not supported.\n\t * This ensures that applications can diagnose compatibility issues.\n\t */\n\tresolve(\n\t\tformatVersion: FormatVersion,\n\t): IMultiFormatCodec<TDecoded, JsonCompatibleReadOnly, JsonCompatibleReadOnly, TContext>;\n\n\t/**\n\t * @returns an iterable of all format versions supported by this family.\n\t */\n\tgetSupportedFormats(): Iterable<FormatVersion>;\n}\n\n/**\n * A version stamp for encoded data.\n *\n * Undefined is tolerated to enable the scenario where data was not initially versioned.\n */\nexport type FormatVersion = number | undefined;\n\n/**\n * Creates a codec family from a registry of codecs.\n * Any codec that is not a {@link IMultiFormatCodec} will be wrapped with a default binary encoding.\n */\nexport function makeCodecFamily<TDecoded, TContext>(\n\tregistry: Iterable<\n\t\t[\n\t\t\tformatVersion: FormatVersion,\n\t\t\tcodec:\n\t\t\t\t| IMultiFormatCodec<TDecoded, JsonCompatibleReadOnly, JsonCompatibleReadOnly, TContext>\n\t\t\t\t| IJsonCodec<TDecoded, JsonCompatibleReadOnly, JsonCompatibleReadOnly, TContext>,\n\t\t]\n\t>,\n): ICodecFamily<TDecoded, TContext> {\n\tconst codecs: Map<\n\t\tFormatVersion,\n\t\tIMultiFormatCodec<TDecoded, JsonCompatibleReadOnly, JsonCompatibleReadOnly, TContext>\n\t> = new Map();\n\tfor (const [formatVersion, codec] of registry) {\n\t\tif (codecs.has(formatVersion)) {\n\t\t\tfail(0xabf /* Duplicate codecs specified. */);\n\t\t}\n\t\tcodecs.set(formatVersion, ensureBinaryEncoding(codec));\n\t}\n\n\treturn {\n\t\tresolve(\n\t\t\tformatVersion: number,\n\t\t): IMultiFormatCodec<TDecoded, JsonCompatibleReadOnly, JsonCompatibleReadOnly, TContext> {\n\t\t\tconst codec = codecs.get(formatVersion);\n\t\t\tassert(codec !== undefined, 0x5e6 /* Requested coded for unsupported format. */);\n\t\t\treturn codec;\n\t\t},\n\t\tgetSupportedFormats(): Iterable<FormatVersion> {\n\t\t\treturn codecs.keys();\n\t\t},\n\t};\n}\n\nclass DefaultBinaryCodec<TDecoded, TContext> implements IBinaryCodec<TDecoded, TContext> {\n\tpublic constructor(\n\t\tprivate readonly jsonCodec: IJsonCodec<TDecoded, unknown, unknown, TContext>,\n\t) {}\n\n\tpublic encode(change: TDecoded, context: TContext): IsoBuffer {\n\t\tconst jsonable = this.jsonCodec.encode(change, context);\n\t\tconst json = JSON.stringify(jsonable);\n\t\treturn IsoBuffer.from(json);\n\t}\n\n\tpublic decode(change: IsoBuffer, context: TContext): TDecoded {\n\t\tconst json = bufferToString(change, \"utf8\");\n\t\tconst jsonable = JSON.parse(json);\n\t\treturn this.jsonCodec.decode(jsonable, context);\n\t}\n}\n\nfunction isJsonCodec<TDecoded, TContext>(\n\tcodec:\n\t\t| IMultiFormatCodec<TDecoded, JsonCompatibleReadOnly, JsonCompatibleReadOnly, TContext>\n\t\t| IJsonCodec<TDecoded, JsonCompatibleReadOnly, JsonCompatibleReadOnly, TContext>,\n): codec is IJsonCodec<TDecoded, JsonCompatibleReadOnly, JsonCompatibleReadOnly, TContext> {\n\treturn typeof codec.encode === \"function\" && typeof codec.decode === \"function\";\n}\n\n/**\n * Constructs a {@link IMultiFormatCodec} from a `IJsonCodec` using a generic binary encoding that simply writes\n * the json representation of the object to a buffer.\n */\nexport function withDefaultBinaryEncoding<TDecoded, TContext>(\n\tjsonCodec: IJsonCodec<TDecoded, JsonCompatibleReadOnly, JsonCompatibleReadOnly, TContext>,\n): IMultiFormatCodec<TDecoded, JsonCompatibleReadOnly, JsonCompatibleReadOnly, TContext> {\n\treturn {\n\t\tjson: jsonCodec,\n\t\tbinary: new DefaultBinaryCodec(jsonCodec),\n\t};\n}\n\n/**\n * Ensures that the provided single or multi-format codec has a binary encoding.\n * Adapts the json encoding using {@link withDefaultBinaryEncoding} if necessary.\n */\nexport function ensureBinaryEncoding<TDecoded, TContext>(\n\tcodec:\n\t\t| IMultiFormatCodec<TDecoded, JsonCompatibleReadOnly, JsonCompatibleReadOnly, TContext>\n\t\t| IJsonCodec<TDecoded, JsonCompatibleReadOnly, JsonCompatibleReadOnly, TContext>,\n): IMultiFormatCodec<TDecoded, JsonCompatibleReadOnly, JsonCompatibleReadOnly, TContext> {\n\treturn isJsonCodec(codec) ? withDefaultBinaryEncoding(codec) : codec;\n}\n\n/**\n * Codec for objects which carry no information.\n */\nexport const unitCodec: IMultiFormatCodec<\n\t0,\n\tJsonCompatibleReadOnly,\n\tJsonCompatibleReadOnly,\n\tunknown\n> = {\n\tjson: {\n\t\tencode: () => 0,\n\t\tdecode: () => 0,\n\t},\n\tbinary: {\n\t\tencode: () => IsoBuffer.from(\"\"),\n\t\tdecode: () => 0,\n\t},\n};\n\n/**\n * Wraps a codec with JSON schema validation for its encoded type.\n * @returns An {@link IJsonCodec} which validates the data it encodes and decodes matches the provided schema.\n */\nexport function withSchemaValidation<\n\tTInMemoryFormat,\n\tEncodedSchema extends TSchema,\n\tTEncodedFormat = JsonCompatibleReadOnly,\n\tTValidate = TEncodedFormat,\n\tTContext = ChangeEncodingContext,\n>(\n\tschema: EncodedSchema,\n\tcodec: IJsonCodec<TInMemoryFormat, TEncodedFormat, TValidate, TContext>,\n\tvalidator?: JsonValidator | FormatValidator,\n): IJsonCodec<TInMemoryFormat, TEncodedFormat, TValidate, TContext> {\n\tif (!validator) {\n\t\treturn codec;\n\t}\n\tconst compiledFormat = extractJsonValidator(validator).compile(schema);\n\treturn {\n\t\tencode: (obj: TInMemoryFormat, context: TContext): TEncodedFormat => {\n\t\t\tconst encoded = codec.encode(obj, context);\n\t\t\tif (!compiledFormat.check(encoded)) {\n\t\t\t\tfail(0xac0 /* Encoded schema should validate */);\n\t\t\t}\n\t\t\treturn encoded;\n\t\t},\n\t\tdecode: (encoded: TValidate, context: TContext): TInMemoryFormat => {\n\t\t\tif (!compiledFormat.check(encoded)) {\n\t\t\t\tfail(0xac1 /* Encoded schema should validate */);\n\t\t\t}\n\t\t\t// TODO: would be nice to provide a more specific validate type to the inner codec than the outer one gets.\n\t\t\treturn codec.decode(encoded, context) as unknown as TInMemoryFormat;\n\t\t},\n\t};\n}\n\n/**\n * Versions of Fluid Framework client packages.\n * @remarks\n * Used to express compatibility requirements by indicating the oldest version with which compatibility must be maintained.\n *\n * When no compatibility-impacting change is made in a given version, the value associated with its enum entry may point to the older version which it's fully compatible with.\n * Note that this can change if a future version of the framework introduces an option to use something which is only supported at a particular version. In which case, the values of the enum may shift,\n * but the semantics of keys in this enum will not change.\n *\n * Do not depend on the value of this enums's entries: only depend on the keys (enum members) themselves.\n *\n * Some release may also be omitted if there is currently no need to express that specific version.\n * If the need arises, they might be added in the future.\n *\n * @privateRemarks\n * Entries in these enums should document the user facing impact of opting into a particular version.\n * For example, document if there is an encoding efficiency improvement of oping into that version or newer.\n * Versions with no notable impact can be omitted.\n *\n * These use numeric values for easy threshold comparisons.\n * Without zero padding, version 2.10 is treated as 2.1, which is numerically less than 2.2.\n * Adding leading zeros to the minor version ensures correct comparisons.\n * For example, version 2.20.0 is encoded as 2.020, and version 2.2.0 is encoded as 2.002.\n * For example FF 2.20.0 is encoded as 2.020 and FF 2.2.0 is encoded as 2.002.\n *\n * Three digits was selected as that will likely be enough, while two digits could easily be too few.\n * If three digits ends up being too few, minor releases of 1000 and higher\n * could still be handled using something like 2.999_00001 without having to change the lower releases.\n *\n * This scheme assumes a single version will always be enough to communicate compatibility.\n * For this to work, compatibility has to be strictly increasing.\n * If this is violated (for example a subset of incompatible features from 3.x that are not in 3.0 are back ported to 2.x),\n * a more complex scheme may be needed to allow safely opting into incompatible features in those cases:\n * such a system can be added if/when its needed since it will be opt in and thus non-breaking.\n *\n * TODO: this should likely be defined higher in the stack and specified when creating the container, possibly as part of its schema.\n * TODO: compatibility requirements for how this enum can and cannot be changed should be clarified when/if it's used across multiple layers in the stack.\n * For example, if needed, would adding more leading zeros to the minor version break things.\n * @alpha\n */\nexport enum FluidClientVersion {\n\t/**\n\t * Fluid Framework Client 1.4 and newer.\n\t * @remarks\n\t * This opts into support for the 1.4 LTS branch.\n\t * @privateRemarks\n\t * As long as this code is in Tree, there is no reason to have this option as SharedTree did not exist in 1.4.\n\t */\n\t// v1_4 = 1.004,\n\n\t/** Fluid Framework Client 2.0 and newer. */\n\tv2_0 = 2.0,\n\n\t/** Fluid Framework Client 2.1 and newer. */\n\t// If we think we might want to start allowing opting into something that landed in 2.1 (without opting into something newer),\n\t// we could add an entry like this to allow users to indicate that they can be opted in once we are ready,\n\t// then update it to \"2.001\" once we actually have the opt in working.\n\t// v2_1 = v2_0,\n\n\t/** Fluid Framework Client 2.52 and newer. */\n\t// New formats introduced in 2.52:\n\t// - DetachedFieldIndex FormatV2\n\tv2_52 = 2.052,\n\n\t/**\n\t * Enable unreleased and unfinished features.\n\t * @remarks\n\t * Using this value can result in documents which can not be opened in future versions of the framework.\n\t * It can also result in data corruption by enabling unfinished features which may not handle all cases correctly.\n\t *\n\t * This can be used with specific APIs when the caller has knowledge of what specific features those APIs will be opted into with it.\n\t * This is useful for testing features before they are released, but should not be used in production code.\n\t */\n\tEnableUnstableFeatures = Number.POSITIVE_INFINITY,\n}\n\n/**\n * An up to date version which includes all the important stable features.\n * @remarks\n * Use for cases when data is not persisted and thus would only ever be read by the current version of the framework.\n *\n * @privateRemarks\n * Update as needed.\n * TODO: Consider using packageVersion.ts to keep this current.\n */\nexport const currentVersion: FluidClientVersion = FluidClientVersion.v2_0;\n"]}
1
+ {"version":3,"file":"codec.js","sourceRoot":"","sources":["../../src/codec/codec.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,+DAAyE;AACzE,kEAAmE;AA2DnE;;;;GAIG;AACH,MAAM,aAAa,GAAkB;IACpC,OAAO,EAAE,GAA2B,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,IAAI,EAA0B,EAAE,CAAC,IAAI,EAAE,CAAC;CAC1F,CAAC;AAEF;;;GAGG;AACU,QAAA,mBAAmB,GAAG,iBAAiB,CAAC,aAAa,CAAC,CAAC;AAEpE;;GAEG;AACH,SAAgB,iBAAiB,CAAC,OAAsB;IACvD,OAAO,OAAqC,CAAC;AAC9C,CAAC;AAFD,8CAEC;AAED;;GAEG;AACH,SAAgB,oBAAoB,CAAC,KAAsC;IAC1E,OAAO,KAAiC,CAAC;AAC1C,CAAC;AAFD,oDAEC;AAmLD,MAAa,4BAA4B;IAGxC,YAAoC,KAAoB;QAApB,UAAK,GAAL,KAAK,CAAe;IAAG,CAAC;IACrD,MAAM,CAAC,OAAsB;QACnC,OAAO,IAAI,CAAC,KAAK,CAAC;IACnB,CAAC;CACD;AAPD,oEAOC;AAED,MAAa,4BAA4B;IAKxC,YAAoC,GAA+C;QAA/C,QAAG,GAAH,GAAG,CAA4C;IAAG,CAAC;IAChF,MAAM,CAAC,MAAsB;QACnC,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,IAAA,eAAI,EAAC,wBAAwB,CAAC,CAAC;IAC/D,CAAC;CACD;AATD,oEASC;AAEY,QAA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B,kBAAkB,QAkC7B;AAED;;;;;;;;GAQG;AACU,QAAA,cAAc,GAAuB,kBAAkB,CAAC,IAAI,CAAC;AAQ1E,SAAgB,iBAAiB,CAAC,IAAe;IAChD,OAAO;QACN,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,OAAO,EAAE,IAAI,CAAC,OAAO,IAAI,MAAM;QAC/B,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,iBAAiB,CAAC;KAC/C,CAAC;AACH,CAAC;AAND,8CAMC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ErasedType } from \"@fluidframework/core-interfaces/internal\";\nimport { IsoBuffer, bufferToString } from \"@fluid-internal/client-utils\";\nimport { assert, fail } from \"@fluidframework/core-utils/internal\";\nimport type { Static, TAnySchema, TSchema } from \"@sinclair/typebox\";\n\nimport type { ChangeEncodingContext } from \"../core/index.js\";\nimport type { JsonCompatibleReadOnly } from \"../util/index.js\";\n\n/**\n * Translates decoded data to encoded data.\n * @remarks Typically paired with an {@link IEncoder}.\n */\nexport interface IEncoder<TDecoded, TEncoded, TContext> {\n\t/**\n\t * Encodes `obj` into some encoded format.\n\t */\n\tencode(obj: TDecoded, context: TContext): TEncoded;\n}\n\n/**\n * Translates encoded data to decoded data.\n * @remarks Typically paired with an {@link IEncoder}.\n */\nexport interface IDecoder<TDecoded, TEncoded, TContext> {\n\t/**\n\t * Decodes `obj` from some encoded format.\n\t */\n\tdecode(obj: TEncoded, context: TContext): TDecoded;\n}\n\n/**\n * Validates data complies with some particular schema.\n * Implementations are typically created by a {@link JsonValidator}.\n */\nexport interface SchemaValidationFunction<Schema extends TSchema> {\n\t/**\n\t * Returns whether the data matches a schema.\n\t */\n\tcheck(data: unknown): data is Static<Schema>;\n}\n\n/**\n * A kind of validator for SharedTree's internal data formats.\n * @remarks\n * Assuming no data corruption or type confusion, such validation should never fail.\n * Any client version compatibility issues should instead be detected by the data format versioning which Shared Tree does internally independent of data format validation.\n * However, persisted data can sometimes be corrupted, bugs can produce invalid data, or users can mix up which data is compatible with which APIs.\n * In such cases, a format validator can help catch issues.\n *\n * Current options are {@link FormatValidatorNoOp} and {@link FormatValidatorBasic}.\n * @privateRemarks\n * Implement using {@link toFormatValidator}.\n * Consume using {@link extractJsonValidator}.\n *\n * Exposing this as the stable API entry point (instead of {@link JsonValidator}) means that we avoid leaking the reference to TypeBox to the API surface.\n * Additionally, if we adopt non JSON formats, we can just update the validators as needed without breaking the API.\n * This also allows us to avoid stabilizing or documenting how handles interact with JSON validation since that is not exposed through this type.\n * @sealed @alpha\n */\nexport interface FormatValidator extends ErasedType<\"FormatValidator\"> {}\n\n/**\n * A {@link JsonValidator} implementation which performs no validation and accepts all data as valid.\n * @privateRemarks Having this as an option unifies opting out of validation with selection of\n * validators, simplifying code performing validation.\n */\nconst noopValidator: JsonValidator = {\n\tcompile: <Schema extends TSchema>() => ({ check: (data): data is Static<Schema> => true }),\n};\n\n/**\n * A {@link FormatValidator} which does no validation.\n * @alpha\n */\nexport const FormatValidatorNoOp = toFormatValidator(noopValidator);\n\n/**\n * Type erase a {@link JsonValidator} to a {@link FormatValidator}.\n */\nexport function toFormatValidator(factory: JsonValidator): FormatValidator {\n\treturn factory as unknown as FormatValidator;\n}\n\n/**\n * Un-type-erase the {@link FormatValidator}.\n */\nexport function extractJsonValidator(input: FormatValidator | JsonValidator): JsonValidator {\n\treturn input as unknown as JsonValidator;\n}\n\n/**\n * JSON schema validator compliant with draft 6 schema. See https://json-schema.org.\n * @alpha @input\n */\nexport interface JsonValidator {\n\t/**\n\t * Compiles the provided JSON schema into a validator for that schema.\n\t * @param schema - A valid draft 6 JSON schema\n\t * @remarks IFluidHandles--which have circular property references--are used in various places in SharedTree's persisted\n\t * format. Handles should only be contained in sections of data which are validated against the empty schema `{}`\n\t * (see https://datatracker.ietf.org/doc/html/draft-wright-json-schema-01#section-4.4).\n\t *\n\t * Implementations of `JsonValidator` must therefore tolerate these values, despite the input not being valid JSON.\n\t */\n\tcompile<Schema extends TSchema>(schema: Schema): SchemaValidationFunction<Schema>;\n}\n\n/**\n * Options relating to handling of persisted data.\n *\n * @see {@link CodecWriteOptions} for options that are specific to encoding data.\n * @alpha @input\n */\nexport interface ICodecOptions {\n\t/**\n\t * {@link FormatValidator} which SharedTree uses to validate persisted data it reads & writes\n\t * matches the expected encoded format (i.e. the wire format for ops and summaries).\n\t * @remarks\n\t * See {@link FormatValidatorNoOp} and {@link FormatValidatorBasic} for out-of-the-box implementations.\n\t *\n\t * This option is not \"on-by-default\" because JSON schema validation comes with a small but noticeable\n\t * runtime performance cost, and popular schema validation libraries have relatively large bundle size.\n\t *\n\t * SharedTree users are still encouraged to use a non-trivial validator (i.e. not `FormatValidatorNoOp`)\n\t * whenever reasonable: it gives better fail-fast behavior when unexpected encoded data is found,\n\t * which reduces the risk of unrecoverable data corruption.\n\t * @privateRemarks\n\t * This property should probably be renamed to `validator` before stabilizing the API.\n\t */\n\treadonly jsonValidator: FormatValidator;\n}\n\n/**\n * Options relating to encoding of persisted data.\n * @remarks\n * Extends {@link ICodecOptions} with options that are specific to encoding data.\n * @alpha @input\n */\nexport interface CodecWriteOptions extends ICodecOptions {\n\t/**\n\t * The minimum version of the Fluid Framework client output must be encoded to be compatible with.\n\t * @remarks\n\t * This is used to ensure that the the output from this codec can be used with older versions of the Fluid Framework client.\n\t * This includes both concurrent collaboration, and an older version opening the document later.\n\t *\n\t * Note that versions older than this should not result in data corruption if they access the data:\n\t * the data's format should be versioned and if they can't handle the format they should error.\n\t */\n\treadonly oldestCompatibleClient: FluidClientVersion;\n}\n\n/**\n * `TContext` allows passing context to the codec which may configure how data is encoded/decoded.\n * This parameter is typically used for:\n * - Codecs which can pick from multiple encoding options, and imbue the encoded data with information about which option was used.\n * The caller of such a codec can provide context about which encoding choice to make as part of the `encode` call without creating\n * additional codecs. Note that this pattern can always be implemented by having the caller create multiple codecs and selecting the\n * appropriate one, but depending on API layering this might be less ergonomic.\n * - Context for the object currently being encoded, which might enable more efficient encoding. When used in this fashion, the codec author\n * should be careful to include the context somewhere in the encoded data such that decoding can correctly round-trip.\n * For example, a composed set of codecs could implement a form of [dictionary coding](https://en.wikipedia.org/wiki/Dictionary_coder)\n * using a context map which was created by the top-level codec and passed to the inner codecs.\n * This pattern is used:\n * - To avoid repeatedly encoding session ids on commits (only recording it once at the top level)\n * @remarks `TEncoded` should always be valid Json (i.e. not contain functions), but due to TypeScript's handling\n * of index signatures and `JsonCompatibleReadOnly`'s index signature in the Json object case, specifying this as a\n * type-system level constraint makes code that uses this interface more difficult to write.\n *\n * If provided, `TValidate` allows the input type passed to `decode` to be different than `TEncoded`.\n * This is useful when, for example, the type being decoded is `unknown` and must be validated to be a `TEncoded` before being decoded to a `TDecoded`.\n */\nexport interface IJsonCodec<\n\tTDecoded,\n\tTEncoded = JsonCompatibleReadOnly,\n\tTValidate = TEncoded,\n\tTContext = void,\n> extends IEncoder<TDecoded, TEncoded, TContext>,\n\t\tIDecoder<TDecoded, TValidate, TContext> {\n\tencodedSchema?: TAnySchema;\n}\n\n/**\n * @remarks TODO: We might consider using DataView or some kind of writer instead of IsoBuffer.\n */\nexport interface IBinaryCodec<TDecoded, TContext = void>\n\textends IEncoder<TDecoded, IsoBuffer, TContext>,\n\t\tIDecoder<TDecoded, IsoBuffer, TContext> {}\n\n/**\n * Contains knowledge of how to encode some in-memory type into JSON and binary formats,\n * as well as how to decode those representations.\n *\n * @remarks Codecs are typically used in shared-tree to convert data into some persisted format.\n * For this common use case, any format for encoding that was ever actually used needs to\n * be supported for decoding in all future code versions.\n *\n * Using an {@link ICodecFamily} is the recommended strategy for managing this support, keeping in\n * mind evolution of encodings over time.\n */\nexport interface IMultiFormatCodec<\n\tTDecoded,\n\tTJsonEncoded extends JsonCompatibleReadOnly = JsonCompatibleReadOnly,\n\tTJsonValidate = TJsonEncoded,\n\tTContext = void,\n> {\n\tjson: IJsonCodec<TDecoded, TJsonEncoded, TJsonValidate, TContext>;\n\tbinary: IBinaryCodec<TDecoded, TContext>;\n\n\t/** Ensures multi-format codecs cannot also be single-format codecs. */\n\tencode?: never;\n\t/** Ensures multi-format codecs cannot also be single-format codecs. */\n\tdecode?: never;\n}\n\n/**\n * Represents a family of codecs that can be used to encode and decode data in different formats.\n * The family is identified by a format version, which is typically used to select the codec to use.\n *\n * Separating codecs into families rather than having a single codec support multiple versions (i.e. currying\n * the `formatVersion` parameter)\n * allows avoiding some duplicate work at encode/decode time, since the vast majority of document usage will not\n * involve mixed format versions.\n *\n * @privateRemarks - This interface currently assumes all codecs in a family require the same encode/decode context,\n * which isn't necessarily true.\n * This may need to be relaxed in the future.\n */\nexport interface ICodecFamily<TDecoded, TContext = void> {\n\t/**\n\t * @returns a codec that can be used to encode and decode data in the specified format.\n\t * @throws - if the format version is not supported by this family.\n\t * @remarks Implementations should typically emit telemetry (either indirectly by throwing a well-known error with\n\t * logged properties or directly using some logger) when a format version is requested that is not supported.\n\t * This ensures that applications can diagnose compatibility issues.\n\t */\n\tresolve(\n\t\tformatVersion: FormatVersion,\n\t): IMultiFormatCodec<TDecoded, JsonCompatibleReadOnly, JsonCompatibleReadOnly, TContext>;\n\n\t/**\n\t * @returns an iterable of all format versions supported by this family.\n\t */\n\tgetSupportedFormats(): Iterable<FormatVersion>;\n}\n\n/**\n * A version stamp for encoded data.\n *\n * Undefined is tolerated to enable the scenario where data was not initially versioned.\n */\nexport type FormatVersion = number | undefined;\n\n/**\n * A format version which is dependent on some parent format version.\n */\nexport interface DependentFormatVersion<\n\tTParentVersion extends FormatVersion = FormatVersion,\n\tTChildVersion extends FormatVersion = FormatVersion,\n> {\n\t/**\n\t * Looks up the child format version for a given parent format version.\n\t * @param parent - The parent format version.\n\t * @returns The corresponding child format version.\n\t */\n\tlookup(parent: TParentVersion): TChildVersion;\n}\n\nexport class UniqueDependentFormatVersion<TChildVersion extends FormatVersion>\n\timplements DependentFormatVersion<FormatVersion, TChildVersion>\n{\n\tpublic constructor(private readonly child: TChildVersion) {}\n\tpublic lookup(_parent: FormatVersion): TChildVersion {\n\t\treturn this.child;\n\t}\n}\n\nexport class MappedDependentFormatVersion<\n\tTParentVersion extends FormatVersion = FormatVersion,\n\tTChildVersion extends FormatVersion = FormatVersion,\n> implements DependentFormatVersion<TParentVersion, TChildVersion>\n{\n\tpublic constructor(private readonly map: ReadonlyMap<TParentVersion, TChildVersion>) {}\n\tpublic lookup(parent: TParentVersion): TChildVersion {\n\t\treturn this.map.get(parent) ?? fail(\"Unknown parent version\");\n\t}\n}\n\nexport const DependentFormatVersion = {\n\tfromUnique: <TChildVersion extends FormatVersion>(child: TChildVersion) =>\n\t\tnew UniqueDependentFormatVersion(child),\n\tfromMap: <TParentVersion extends FormatVersion, TChildVersion extends FormatVersion>(\n\t\tmap: ReadonlyMap<TParentVersion, TChildVersion>,\n\t) => new MappedDependentFormatVersion(map),\n\tfromPairs: <TParentVersion extends FormatVersion, TChildVersion extends FormatVersion>(\n\t\tpairs: Iterable<[TParentVersion, TChildVersion]>,\n\t) => new MappedDependentFormatVersion(new Map(pairs)),\n};\n\n/**\n * Creates a codec family from a registry of codecs.\n * Any codec that is not a {@link IMultiFormatCodec} will be wrapped with a default binary encoding.\n */\nexport function makeCodecFamily<TDecoded, TContext>(\n\tregistry: Iterable<\n\t\t[\n\t\t\tformatVersion: FormatVersion,\n\t\t\tcodec:\n\t\t\t\t| IMultiFormatCodec<TDecoded, JsonCompatibleReadOnly, JsonCompatibleReadOnly, TContext>\n\t\t\t\t| IJsonCodec<TDecoded, JsonCompatibleReadOnly, JsonCompatibleReadOnly, TContext>,\n\t\t]\n\t>,\n): ICodecFamily<TDecoded, TContext> {\n\tconst codecs: Map<\n\t\tFormatVersion,\n\t\tIMultiFormatCodec<TDecoded, JsonCompatibleReadOnly, JsonCompatibleReadOnly, TContext>\n\t> = new Map();\n\tfor (const [formatVersion, codec] of registry) {\n\t\tif (codecs.has(formatVersion)) {\n\t\t\tfail(0xabf /* Duplicate codecs specified. */);\n\t\t}\n\t\tcodecs.set(formatVersion, ensureBinaryEncoding(codec));\n\t}\n\n\treturn {\n\t\tresolve(\n\t\t\tformatVersion: number,\n\t\t): IMultiFormatCodec<TDecoded, JsonCompatibleReadOnly, JsonCompatibleReadOnly, TContext> {\n\t\t\tconst codec = codecs.get(formatVersion);\n\t\t\tassert(codec !== undefined, 0x5e6 /* Requested coded for unsupported format. */);\n\t\t\treturn codec;\n\t\t},\n\t\tgetSupportedFormats(): Iterable<FormatVersion> {\n\t\t\treturn codecs.keys();\n\t\t},\n\t};\n}\n\nclass DefaultBinaryCodec<TDecoded, TContext> implements IBinaryCodec<TDecoded, TContext> {\n\tpublic constructor(\n\t\tprivate readonly jsonCodec: IJsonCodec<TDecoded, unknown, unknown, TContext>,\n\t) {}\n\n\tpublic encode(change: TDecoded, context: TContext): IsoBuffer {\n\t\tconst jsonable = this.jsonCodec.encode(change, context);\n\t\tconst json = JSON.stringify(jsonable);\n\t\treturn IsoBuffer.from(json);\n\t}\n\n\tpublic decode(change: IsoBuffer, context: TContext): TDecoded {\n\t\tconst json = bufferToString(change, \"utf8\");\n\t\tconst jsonable = JSON.parse(json);\n\t\treturn this.jsonCodec.decode(jsonable, context);\n\t}\n}\n\nfunction isJsonCodec<TDecoded, TContext>(\n\tcodec:\n\t\t| IMultiFormatCodec<TDecoded, JsonCompatibleReadOnly, JsonCompatibleReadOnly, TContext>\n\t\t| IJsonCodec<TDecoded, JsonCompatibleReadOnly, JsonCompatibleReadOnly, TContext>,\n): codec is IJsonCodec<TDecoded, JsonCompatibleReadOnly, JsonCompatibleReadOnly, TContext> {\n\treturn typeof codec.encode === \"function\" && typeof codec.decode === \"function\";\n}\n\n/**\n * Constructs a {@link IMultiFormatCodec} from a `IJsonCodec` using a generic binary encoding that simply writes\n * the json representation of the object to a buffer.\n */\nexport function withDefaultBinaryEncoding<TDecoded, TContext>(\n\tjsonCodec: IJsonCodec<TDecoded, JsonCompatibleReadOnly, JsonCompatibleReadOnly, TContext>,\n): IMultiFormatCodec<TDecoded, JsonCompatibleReadOnly, JsonCompatibleReadOnly, TContext> {\n\treturn {\n\t\tjson: jsonCodec,\n\t\tbinary: new DefaultBinaryCodec(jsonCodec),\n\t};\n}\n\n/**\n * Ensures that the provided single or multi-format codec has a binary encoding.\n * Adapts the json encoding using {@link withDefaultBinaryEncoding} if necessary.\n */\nexport function ensureBinaryEncoding<TDecoded, TContext>(\n\tcodec:\n\t\t| IMultiFormatCodec<TDecoded, JsonCompatibleReadOnly, JsonCompatibleReadOnly, TContext>\n\t\t| IJsonCodec<TDecoded, JsonCompatibleReadOnly, JsonCompatibleReadOnly, TContext>,\n): IMultiFormatCodec<TDecoded, JsonCompatibleReadOnly, JsonCompatibleReadOnly, TContext> {\n\treturn isJsonCodec(codec) ? withDefaultBinaryEncoding(codec) : codec;\n}\n\n/**\n * Codec for objects which carry no information.\n */\nexport const unitCodec: IMultiFormatCodec<\n\t0,\n\tJsonCompatibleReadOnly,\n\tJsonCompatibleReadOnly,\n\tunknown\n> = {\n\tjson: {\n\t\tencode: () => 0,\n\t\tdecode: () => 0,\n\t},\n\tbinary: {\n\t\tencode: () => IsoBuffer.from(\"\"),\n\t\tdecode: () => 0,\n\t},\n};\n\n/**\n * Wraps a codec with JSON schema validation for its encoded type.\n * @returns An {@link IJsonCodec} which validates the data it encodes and decodes matches the provided schema.\n */\nexport function withSchemaValidation<\n\tTInMemoryFormat,\n\tEncodedSchema extends TSchema,\n\tTEncodedFormat = JsonCompatibleReadOnly,\n\tTValidate = TEncodedFormat,\n\tTContext = ChangeEncodingContext,\n>(\n\tschema: EncodedSchema,\n\tcodec: IJsonCodec<TInMemoryFormat, TEncodedFormat, TValidate, TContext>,\n\tvalidator?: JsonValidator | FormatValidator,\n): IJsonCodec<TInMemoryFormat, TEncodedFormat, TValidate, TContext> {\n\tif (!validator) {\n\t\treturn codec;\n\t}\n\tconst compiledFormat = extractJsonValidator(validator).compile(schema);\n\treturn {\n\t\tencode: (obj: TInMemoryFormat, context: TContext): TEncodedFormat => {\n\t\t\tconst encoded = codec.encode(obj, context);\n\t\t\tif (!compiledFormat.check(encoded)) {\n\t\t\t\tfail(0xac0 /* Encoded schema should validate */);\n\t\t\t}\n\t\t\treturn encoded;\n\t\t},\n\t\tdecode: (encoded: TValidate, context: TContext): TInMemoryFormat => {\n\t\t\tif (!compiledFormat.check(encoded)) {\n\t\t\t\tfail(0xac1 /* Encoded schema should validate */);\n\t\t\t}\n\t\t\t// TODO: would be nice to provide a more specific validate type to the inner codec than the outer one gets.\n\t\t\treturn codec.decode(encoded, context) as unknown as TInMemoryFormat;\n\t\t},\n\t};\n}\n\n/**\n * Versions of Fluid Framework client packages.\n * @remarks\n * Used to express compatibility requirements by indicating the oldest version with which compatibility must be maintained.\n *\n * When no compatibility-impacting change is made in a given version, the value associated with its enum entry may point to the older version which it's fully compatible with.\n * Note that this can change if a future version of the framework introduces an option to use something which is only supported at a particular version. In which case, the values of the enum may shift,\n * but the semantics of keys in this enum will not change.\n *\n * Do not depend on the value of this enums's entries: only depend on the keys (enum members) themselves.\n *\n * Some release may also be omitted if there is currently no need to express that specific version.\n * If the need arises, they might be added in the future.\n *\n * @privateRemarks\n * Entries in these enums should document the user facing impact of opting into a particular version.\n * For example, document if there is an encoding efficiency improvement of oping into that version or newer.\n * Versions with no notable impact can be omitted.\n *\n * These use numeric values for easy threshold comparisons.\n * Without zero padding, version 2.10 is treated as 2.1, which is numerically less than 2.2.\n * Adding leading zeros to the minor version ensures correct comparisons.\n * For example, version 2.20.0 is encoded as 2.020, and version 2.2.0 is encoded as 2.002.\n * For example FF 2.20.0 is encoded as 2.020 and FF 2.2.0 is encoded as 2.002.\n *\n * Three digits was selected as that will likely be enough, while two digits could easily be too few.\n * If three digits ends up being too few, minor releases of 1000 and higher\n * could still be handled using something like 2.999_00001 without having to change the lower releases.\n *\n * This scheme assumes a single version will always be enough to communicate compatibility.\n * For this to work, compatibility has to be strictly increasing.\n * If this is violated (for example a subset of incompatible features from 3.x that are not in 3.0 are back ported to 2.x),\n * a more complex scheme may be needed to allow safely opting into incompatible features in those cases:\n * such a system can be added if/when its needed since it will be opt in and thus non-breaking.\n *\n * TODO: this should likely be defined higher in the stack and specified when creating the container, possibly as part of its schema.\n * TODO: compatibility requirements for how this enum can and cannot be changed should be clarified when/if it's used across multiple layers in the stack.\n * For example, if needed, would adding more leading zeros to the minor version break things.\n * @alpha\n */\nexport enum FluidClientVersion {\n\t/**\n\t * Fluid Framework Client 1.4 and newer.\n\t * @remarks\n\t * This opts into support for the 1.4 LTS branch.\n\t * @privateRemarks\n\t * As long as this code is in Tree, there is no reason to have this option as SharedTree did not exist in 1.4.\n\t */\n\t// v1_4 = 1.004,\n\n\t/** Fluid Framework Client 2.0 and newer. */\n\tv2_0 = 2.0,\n\n\t/** Fluid Framework Client 2.1 and newer. */\n\t// If we think we might want to start allowing opting into something that landed in 2.1 (without opting into something newer),\n\t// we could add an entry like this to allow users to indicate that they can be opted in once we are ready,\n\t// then update it to \"2.001\" once we actually have the opt in working.\n\t// v2_1 = v2_0,\n\n\t/** Fluid Framework Client 2.52 and newer. */\n\t// New formats introduced in 2.52:\n\t// - DetachedFieldIndex FormatV2\n\tv2_52 = 2.052,\n\n\t/**\n\t * Enable unreleased and unfinished features.\n\t * @remarks\n\t * Using this value can result in documents which can not be opened in future versions of the framework.\n\t * It can also result in data corruption by enabling unfinished features which may not handle all cases correctly.\n\t *\n\t * This can be used with specific APIs when the caller has knowledge of what specific features those APIs will be opted into with it.\n\t * This is useful for testing features before they are released, but should not be used in production code.\n\t */\n\tEnableUnstableFeatures = Number.POSITIVE_INFINITY,\n}\n\n/**\n * An up to date version which includes all the important stable features.\n * @remarks\n * Use for cases when data is not persisted and thus would only ever be read by the current version of the framework.\n *\n * @privateRemarks\n * Update as needed.\n * TODO: Consider using packageVersion.ts to keep this current.\n */\nexport const currentVersion: FluidClientVersion = FluidClientVersion.v2_0;\n\nexport interface CodecTree {\n\treadonly name: string;\n\treadonly version: FormatVersion;\n\treadonly children?: readonly CodecTree[];\n}\n\nexport function jsonableCodecTree(tree: CodecTree): JsonCompatibleReadOnly {\n\treturn {\n\t\tname: tree.name,\n\t\tversion: tree.version ?? \"null\",\n\t\tchildren: tree.children?.map(jsonableCodecTree),\n\t};\n}\n"]}
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- export { type FormatVersion, type IBinaryCodec, type ICodecFamily, type ICodecOptions, type CodecWriteOptions, type IDecoder, type IEncoder, type IJsonCodec, type IMultiFormatCodec, type JsonValidator, makeCodecFamily, type SchemaValidationFunction, unitCodec, withDefaultBinaryEncoding, withSchemaValidation, FluidClientVersion, currentVersion, toFormatValidator, FormatValidatorNoOp, type FormatValidator, extractJsonValidator, } from "./codec.js";
5
+ export { type FormatVersion, DependentFormatVersion, type IBinaryCodec, type ICodecFamily, type ICodecOptions, type CodecWriteOptions, type IDecoder, type IEncoder, type IJsonCodec, type IMultiFormatCodec, type JsonValidator, makeCodecFamily, type SchemaValidationFunction, unitCodec, withDefaultBinaryEncoding, withSchemaValidation, FluidClientVersion, currentVersion, toFormatValidator, FormatValidatorNoOp, type FormatValidator, type CodecTree, jsonableCodecTree, extractJsonValidator, } from "./codec.js";
6
6
  export { DiscriminatedUnionDispatcher, type DiscriminatedUnionLibrary, unionOptions, } from "./discriminatedUnions.js";
7
7
  export { Versioned, makeVersionedCodec, makeVersionedValidatedCodec, makeVersionDispatchingCodec, } from "./versioned/index.js";
8
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/codec/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,QAAQ,EACb,KAAK,QAAQ,EACb,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,eAAe,EACf,KAAK,wBAAwB,EAC7B,SAAS,EACT,yBAAyB,EACzB,oBAAoB,EACpB,kBAAkB,EAClB,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,KAAK,eAAe,EACpB,oBAAoB,GACpB,MAAM,YAAY,CAAC;AACpB,OAAO,EACN,4BAA4B,EAC5B,KAAK,yBAAyB,EAC9B,YAAY,GACZ,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACN,SAAS,EACT,kBAAkB,EAClB,2BAA2B,EAC3B,2BAA2B,GAC3B,MAAM,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/codec/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,aAAa,EAClB,sBAAsB,EACtB,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,QAAQ,EACb,KAAK,QAAQ,EACb,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,eAAe,EACf,KAAK,wBAAwB,EAC7B,SAAS,EACT,yBAAyB,EACzB,oBAAoB,EACpB,kBAAkB,EAClB,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,KAAK,eAAe,EACpB,KAAK,SAAS,EACd,iBAAiB,EACjB,oBAAoB,GACpB,MAAM,YAAY,CAAC;AACpB,OAAO,EACN,4BAA4B,EAC5B,KAAK,yBAAyB,EAC9B,YAAY,GACZ,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACN,SAAS,EACT,kBAAkB,EAClB,2BAA2B,EAC3B,2BAA2B,GAC3B,MAAM,sBAAsB,CAAC"}
@@ -4,8 +4,9 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.makeVersionDispatchingCodec = exports.makeVersionedValidatedCodec = exports.makeVersionedCodec = exports.Versioned = exports.unionOptions = exports.DiscriminatedUnionDispatcher = exports.extractJsonValidator = exports.FormatValidatorNoOp = exports.toFormatValidator = exports.currentVersion = exports.FluidClientVersion = exports.withSchemaValidation = exports.withDefaultBinaryEncoding = exports.unitCodec = exports.makeCodecFamily = void 0;
7
+ exports.makeVersionDispatchingCodec = exports.makeVersionedValidatedCodec = exports.makeVersionedCodec = exports.Versioned = exports.unionOptions = exports.DiscriminatedUnionDispatcher = exports.extractJsonValidator = exports.jsonableCodecTree = exports.FormatValidatorNoOp = exports.toFormatValidator = exports.currentVersion = exports.FluidClientVersion = exports.withSchemaValidation = exports.withDefaultBinaryEncoding = exports.unitCodec = exports.makeCodecFamily = exports.DependentFormatVersion = void 0;
8
8
  var codec_js_1 = require("./codec.js");
9
+ Object.defineProperty(exports, "DependentFormatVersion", { enumerable: true, get: function () { return codec_js_1.DependentFormatVersion; } });
9
10
  Object.defineProperty(exports, "makeCodecFamily", { enumerable: true, get: function () { return codec_js_1.makeCodecFamily; } });
10
11
  Object.defineProperty(exports, "unitCodec", { enumerable: true, get: function () { return codec_js_1.unitCodec; } });
11
12
  Object.defineProperty(exports, "withDefaultBinaryEncoding", { enumerable: true, get: function () { return codec_js_1.withDefaultBinaryEncoding; } });
@@ -14,6 +15,7 @@ Object.defineProperty(exports, "FluidClientVersion", { enumerable: true, get: fu
14
15
  Object.defineProperty(exports, "currentVersion", { enumerable: true, get: function () { return codec_js_1.currentVersion; } });
15
16
  Object.defineProperty(exports, "toFormatValidator", { enumerable: true, get: function () { return codec_js_1.toFormatValidator; } });
16
17
  Object.defineProperty(exports, "FormatValidatorNoOp", { enumerable: true, get: function () { return codec_js_1.FormatValidatorNoOp; } });
18
+ Object.defineProperty(exports, "jsonableCodecTree", { enumerable: true, get: function () { return codec_js_1.jsonableCodecTree; } });
17
19
  Object.defineProperty(exports, "extractJsonValidator", { enumerable: true, get: function () { return codec_js_1.extractJsonValidator; } });
18
20
  var discriminatedUnions_js_1 = require("./discriminatedUnions.js");
19
21
  Object.defineProperty(exports, "DiscriminatedUnionDispatcher", { enumerable: true, get: function () { return discriminatedUnions_js_1.DiscriminatedUnionDispatcher; } });
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/codec/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,uCAsBoB;AAXnB,2GAAA,eAAe,OAAA;AAEf,qGAAA,SAAS,OAAA;AACT,qHAAA,yBAAyB,OAAA;AACzB,gHAAA,oBAAoB,OAAA;AACpB,8GAAA,kBAAkB,OAAA;AAClB,0GAAA,cAAc,OAAA;AACd,6GAAA,iBAAiB,OAAA;AACjB,+GAAA,mBAAmB,OAAA;AAEnB,gHAAA,oBAAoB,OAAA;AAErB,mEAIkC;AAHjC,sIAAA,4BAA4B,OAAA;AAE5B,sHAAA,YAAY,OAAA;AAEb,iDAK8B;AAJ7B,qGAAA,SAAS,OAAA;AACT,8GAAA,kBAAkB,OAAA;AAClB,uHAAA,2BAA2B,OAAA;AAC3B,uHAAA,2BAA2B,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\ttype FormatVersion,\n\ttype IBinaryCodec,\n\ttype ICodecFamily,\n\ttype ICodecOptions,\n\ttype CodecWriteOptions,\n\ttype IDecoder,\n\ttype IEncoder,\n\ttype IJsonCodec,\n\ttype IMultiFormatCodec,\n\ttype JsonValidator,\n\tmakeCodecFamily,\n\ttype SchemaValidationFunction,\n\tunitCodec,\n\twithDefaultBinaryEncoding,\n\twithSchemaValidation,\n\tFluidClientVersion,\n\tcurrentVersion,\n\ttoFormatValidator,\n\tFormatValidatorNoOp,\n\ttype FormatValidator,\n\textractJsonValidator,\n} from \"./codec.js\";\nexport {\n\tDiscriminatedUnionDispatcher,\n\ttype DiscriminatedUnionLibrary,\n\tunionOptions,\n} from \"./discriminatedUnions.js\";\nexport {\n\tVersioned,\n\tmakeVersionedCodec,\n\tmakeVersionedValidatedCodec,\n\tmakeVersionDispatchingCodec,\n} from \"./versioned/index.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/codec/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,uCAyBoB;AAvBnB,kHAAA,sBAAsB,OAAA;AAUtB,2GAAA,eAAe,OAAA;AAEf,qGAAA,SAAS,OAAA;AACT,qHAAA,yBAAyB,OAAA;AACzB,gHAAA,oBAAoB,OAAA;AACpB,8GAAA,kBAAkB,OAAA;AAClB,0GAAA,cAAc,OAAA;AACd,6GAAA,iBAAiB,OAAA;AACjB,+GAAA,mBAAmB,OAAA;AAGnB,6GAAA,iBAAiB,OAAA;AACjB,gHAAA,oBAAoB,OAAA;AAErB,mEAIkC;AAHjC,sIAAA,4BAA4B,OAAA;AAE5B,sHAAA,YAAY,OAAA;AAEb,iDAK8B;AAJ7B,qGAAA,SAAS,OAAA;AACT,8GAAA,kBAAkB,OAAA;AAClB,uHAAA,2BAA2B,OAAA;AAC3B,uHAAA,2BAA2B,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\ttype FormatVersion,\n\tDependentFormatVersion,\n\ttype IBinaryCodec,\n\ttype ICodecFamily,\n\ttype ICodecOptions,\n\ttype CodecWriteOptions,\n\ttype IDecoder,\n\ttype IEncoder,\n\ttype IJsonCodec,\n\ttype IMultiFormatCodec,\n\ttype JsonValidator,\n\tmakeCodecFamily,\n\ttype SchemaValidationFunction,\n\tunitCodec,\n\twithDefaultBinaryEncoding,\n\twithSchemaValidation,\n\tFluidClientVersion,\n\tcurrentVersion,\n\ttoFormatValidator,\n\tFormatValidatorNoOp,\n\ttype FormatValidator,\n\ttype CodecTree,\n\tjsonableCodecTree,\n\textractJsonValidator,\n} from \"./codec.js\";\nexport {\n\tDiscriminatedUnionDispatcher,\n\ttype DiscriminatedUnionLibrary,\n\tunionOptions,\n} from \"./discriminatedUnions.js\";\nexport {\n\tVersioned,\n\tmakeVersionedCodec,\n\tmakeVersionedValidatedCodec,\n\tmakeVersionDispatchingCodec,\n} from \"./versioned/index.js\";\n"]}
@@ -2,9 +2,9 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- export { EmptyKey, type TreeType, type Value, type TreeValue, AnchorSet, type DetachedField, type UpPath, type NormalizedUpPath, type INormalizedUpPath, type NormalizedFieldUpPath, type Range, type RangeUpPath, type PlaceUpPath, type PlaceIndex, type NodeIndex, type FieldUpPath, type Anchor, type RootField, type ChildCollection, type ChildLocation, type FieldMapObject, type NodeData, type GenericTreeNode, type JsonableTree, EncodedJsonableTree, rootFieldKey, rootField, type ITreeCursor, CursorLocationType, type ITreeCursorSynchronous, castCursorToSynchronous, type GenericFieldsNode, type AnchorLocator, genericTreeKeys, getGenericTreeField, genericTreeDeleteIfEmpty, getDepth, mapCursorField, mapCursorFields, iterateCursorField, type MapTree, detachedFieldAsKey, keyAsDetachedField, visitDelta, createAnnouncedVisitor, combineVisitors, announceDelta, applyDelta, makeDetachedFieldIndex, setGenericTreeField, type DeltaVisitor, type AnnouncedVisitor, SparseNode, getDescendant, compareUpPaths, clonePath, topDownPath, compareFieldUpPaths, forEachNode, forEachNodeInSubtree, forEachField, type PathRootPrefix, deltaForRootInitialization, makeDetachedNodeId, offsetDetachId, emptyDelta, type AnchorSlot, type AnchorNode, anchorSlot, type UpPathDefault, isDetachedUpPath, inCursorField, inCursorNode, type AnchorEvents, type AnchorSetRootEvents, type ProtoNodes, CursorMarker, isCursor, DetachedFieldIndex, type ForestRootId, getDetachedFieldContainingPath, aboveRootPlaceholder, type DeltaRoot, type DeltaMark, type DeltaDetachedNodeId, type DeltaFieldMap, type DeltaDetachedNodeChanges, type DeltaDetachedNodeBuild, type DeltaDetachedNodeDestruction, type DeltaDetachedNodeRename, type DeltaFieldChanges, type ExclusiveMapTree, deepCopyMapTree, type TreeChunk, dummyRoot, cursorChunk, tryGetChunk, type ChunkedCursor, } from "./tree/index.js";
5
+ export { EmptyKey, type TreeType, type Value, type TreeValue, AnchorSet, type DetachedField, type UpPath, type NormalizedUpPath, type INormalizedUpPath, type NormalizedFieldUpPath, type Range, type RangeUpPath, type PlaceUpPath, type PlaceIndex, type NodeIndex, type FieldUpPath, type Anchor, type RootField, type ChildCollection, type ChildLocation, type FieldMapObject, type NodeData, type GenericTreeNode, type JsonableTree, EncodedJsonableTree, rootFieldKey, rootField, type ITreeCursor, CursorLocationType, type ITreeCursorSynchronous, castCursorToSynchronous, type GenericFieldsNode, type AnchorLocator, genericTreeKeys, getGenericTreeField, genericTreeDeleteIfEmpty, getDepth, mapCursorField, mapCursorFields, iterateCursorField, type MapTree, detachedFieldAsKey, keyAsDetachedField, visitDelta, createAnnouncedVisitor, combineVisitors, announceDelta, applyDelta, makeDetachedFieldIndex, setGenericTreeField, type DeltaVisitor, type AnnouncedVisitor, SparseNode, getDescendant, compareUpPaths, clonePath, topDownPath, compareFieldUpPaths, forEachNode, forEachNodeInSubtree, forEachField, type PathRootPrefix, deltaForRootInitialization, makeDetachedNodeId, offsetDetachId, emptyDelta, type AnchorSlot, type AnchorNode, anchorSlot, type UpPathDefault, isDetachedUpPath, inCursorField, inCursorNode, type AnchorEvents, type AnchorSetRootEvents, type ProtoNodes, CursorMarker, isCursor, DetachedFieldIndex, type ForestRootId, getDetachedFieldContainingPath, aboveRootPlaceholder, type DeltaRoot, type DeltaMark, type DeltaDetachedNodeId, type DeltaFieldMap, type DeltaDetachedNodeChanges, type DeltaDetachedNodeBuild, type DeltaDetachedNodeDestruction, type DeltaDetachedNodeRename, type DeltaFieldChanges, type ExclusiveMapTree, deepCopyMapTree, type TreeChunk, dummyRoot, cursorChunk, tryGetChunk, type ChunkedCursor, type DetachedFieldIndexFormatVersion, getCodecTreeForDetachedFieldIndexFormat, } from "./tree/index.js";
6
6
  export { TreeNavigationResult, type IEditableForest, type IForestSubscription, type TreeLocation, type FieldLocation, type ForestLocation, type ITreeSubscriptionCursor, ITreeSubscriptionCursorState, type FieldAnchor, moveToDetachedField, type ForestEvents, } from "./forest/index.js";
7
- export { type FieldKey, type TreeNodeSchemaIdentifier, type TreeFieldStoredSchema, ValueSchema, TreeNodeStoredSchema, type TreeStoredSchemaSubscription, type MutableTreeStoredSchema, type FieldKindIdentifier, type FieldKindData, type TreeTypeSet, type TreeStoredSchema, TreeStoredSchemaRepository, schemaDataIsEmpty, type SchemaEvents, forbiddenFieldKindIdentifier, identifierFieldKindIdentifier, storedEmptyFieldSchema, type StoredSchemaCollection, schemaFormatV1, schemaFormatV2, LeafNodeStoredSchema, ObjectNodeStoredSchema, MapNodeStoredSchema, decodeFieldSchema, encodeFieldSchemaV1, encodeFieldSchemaV2, storedSchemaDecodeDispatcher, type SchemaAndPolicy, Multiplicity, type SchemaPolicy, SchemaVersion, } from "./schema-stored/index.js";
7
+ export { type FieldKey, type TreeNodeSchemaIdentifier, type TreeFieldStoredSchema, ValueSchema, TreeNodeStoredSchema, type TreeStoredSchemaSubscription, type MutableTreeStoredSchema, type FieldKindIdentifier, type FieldKindData, type TreeTypeSet, type TreeStoredSchema, TreeStoredSchemaRepository, schemaDataIsEmpty, type SchemaEvents, forbiddenFieldKindIdentifier, identifierFieldKindIdentifier, storedEmptyFieldSchema, type StoredSchemaCollection, schemaFormatV1, schemaFormatV2, LeafNodeStoredSchema, ObjectNodeStoredSchema, MapNodeStoredSchema, decodeFieldSchema, encodeFieldSchemaV1, encodeFieldSchemaV2, storedSchemaDecodeDispatcher, type SchemaAndPolicy, Multiplicity, type SchemaPolicy, SchemaVersion, type SchemaFormatVersion, } from "./schema-stored/index.js";
8
8
  export { type ChangeFamily, type ChangeFamilyCodec, type ChangeEncodingContext, type ChangeFamilyEditor, EditBuilder, } from "./change-family/index.js";
9
9
  export { areEqualChangeAtomIds, areEqualChangeAtomIdOpts, makeChangeAtomId, asChangeAtomId, type ChangeRebaser, findAncestor, findCommonAncestor, type GraphCommit, CommitKind, type CommitMetadata, type RevisionTag, RevisionTagSchema, RevisionTagCodec, type ChangesetLocalId, type ChangeAtomId, type ChangeAtomIdMap, type TaggedChange, makeAnonChange, tagChange, mapTaggedChange, tagRollbackInverse, SessionIdSchema, mintCommit, rebaseBranch, type BranchRebaseResult, rebaseChange, rebaseChangeOverChanges, type RevisionMetadataSource, revisionMetadataSourceFromInfo, type RevisionInfo, type EncodedRevisionTag, type EncodedStableId, type EncodedChangeAtomId, taggedAtomId, taggedOptAtomId, offsetChangeAtomId, StableIdSchema, subtractChangeAtomIds, replaceAtomRevisions, replaceChange, type RebaseStats, type RebaseStatsWithDuration, isAncestor, type ChangeAtomIdRangeMap, newChangeAtomIdRangeMap, compareRevisions, diffHistories, } from "./rebase/index.js";
10
10
  export { type Adapters, AdaptedViewSchema, type TreeAdapter, } from "./schema-view/index.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,QAAQ,EACR,KAAK,QAAQ,EACb,KAAK,KAAK,EACV,KAAK,SAAS,EACd,SAAS,EACT,KAAK,aAAa,EAClB,KAAK,MAAM,EACX,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,KAAK,EACV,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,MAAM,EACX,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,QAAQ,EACb,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,mBAAmB,EACnB,YAAY,EACZ,SAAS,EACT,KAAK,WAAW,EAChB,kBAAkB,EAClB,KAAK,sBAAsB,EAC3B,uBAAuB,EACvB,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,eAAe,EAC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oB,EACpB,aAAa,EACb,KAAK,WAAW,EAChB,KAAK,uBAAuB,EAC5B,UAAU,EACV,KAAK,oBAAoB,EACzB,uBAAuB,EACvB,gBAAgB,EAChB,aAAa,GACb,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACN,KAAK,QAAQ,EACb,iBAAiB,EACjB,KAAK,WAAW,GAChB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACN,KAAK,UAAU,EACf,gBAAgB,EAChB,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,eAAe,GACpB,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,QAAQ,EACR,KAAK,QAAQ,EACb,KAAK,KAAK,EACV,KAAK,SAAS,EACd,SAAS,EACT,KAAK,aAAa,EAClB,KAAK,MAAM,EACX,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,KAAK,EACV,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,MAAM,EACX,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,QAAQ,EACb,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,mBAAmB,EACnB,YAAY,EACZ,SAAS,EACT,KAAK,WAAW,EAChB,kBAAkB,EAClB,KAAK,sBAAsB,EAC3B,uBAAuB,EACvB,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,eAAe,EACf,mBAAmB,EACnB,wBAAwB,EACxB,QAAQ,EACR,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,KAAK,OAAO,EACZ,kBAAkB,EAClB,kBAAkB,EAClB,UAAU,EACV,sBAAsB,EACtB,eAAe,EACf,aAAa,EACb,UAAU,EACV,sBA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