@fluidframework/tree 2.103.0 → 2.111.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (530) hide show
  1. package/.vscode/settings.json +1 -0
  2. package/CHANGELOG.md +109 -0
  3. package/api-report/tree.alpha.api.md +60 -34
  4. package/api-report/tree.beta.api.md +49 -3
  5. package/api-report/tree.legacy.beta.api.md +49 -3
  6. package/dist/codec/versioned/format.js +2 -24
  7. package/dist/codec/versioned/format.js.map +1 -1
  8. package/dist/core/change-family/changeFamily.d.ts +3 -10
  9. package/dist/core/change-family/changeFamily.d.ts.map +1 -1
  10. package/dist/core/change-family/changeFamily.js.map +1 -1
  11. package/dist/core/rebase/types.d.ts +2 -2
  12. package/dist/core/rebase/types.js +2 -24
  13. package/dist/core/rebase/types.js.map +1 -1
  14. package/dist/core/schema-stored/formatV1.js +2 -24
  15. package/dist/core/schema-stored/formatV1.js.map +1 -1
  16. package/dist/core/schema-stored/formatV2.js +2 -24
  17. package/dist/core/schema-stored/formatV2.js.map +1 -1
  18. package/dist/core/schema-stored/index.js +3 -25
  19. package/dist/core/schema-stored/index.js.map +1 -1
  20. package/dist/core/schema-stored/storedSchemaRepository.d.ts +2 -2
  21. package/dist/core/schema-stored/storedSchemaRepository.js.map +1 -1
  22. package/dist/core/tree/anchorSet.js +4 -8
  23. package/dist/core/tree/anchorSet.js.map +1 -1
  24. package/dist/core/tree/detachedFieldIndexFormatCommon.js +2 -24
  25. package/dist/core/tree/detachedFieldIndexFormatCommon.js.map +1 -1
  26. package/dist/core/tree/detachedFieldIndexFormatV2.js +2 -24
  27. package/dist/core/tree/detachedFieldIndexFormatV2.js.map +1 -1
  28. package/dist/core/tree/persistedTreeTextFormat.js +2 -24
  29. package/dist/core/tree/persistedTreeTextFormat.js.map +1 -1
  30. package/dist/entrypoints/alpha.d.ts +1 -1
  31. package/dist/entrypoints/alpha.d.ts.map +1 -1
  32. package/dist/entrypoints/alpha.js.map +1 -1
  33. package/dist/entrypoints/beta.d.ts +1 -1
  34. package/dist/entrypoints/beta.d.ts.map +1 -1
  35. package/dist/entrypoints/beta.js.map +1 -1
  36. package/dist/entrypoints/internal.js +2 -15
  37. package/dist/entrypoints/internal.js.map +1 -1
  38. package/dist/entrypoints/legacy.d.ts +1 -1
  39. package/dist/entrypoints/legacy.d.ts.map +1 -1
  40. package/dist/entrypoints/legacy.js.map +1 -1
  41. package/dist/feature-libraries/chunked-forest/chunkedForest.js +7 -11
  42. package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  43. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +19 -14
  44. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  45. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js +13 -32
  46. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  47. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts +85 -28
  48. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  49. package/dist/feature-libraries/chunked-forest/codec/codecs.js +83 -9
  50. package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  51. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +4 -2
  52. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
  53. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +11 -0
  54. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  55. package/dist/feature-libraries/chunked-forest/codec/format/formatGeneric.js +2 -24
  56. package/dist/feature-libraries/chunked-forest/codec/format/formatGeneric.js.map +1 -1
  57. package/dist/feature-libraries/chunked-forest/codec/format/formatV1.js +2 -24
  58. package/dist/feature-libraries/chunked-forest/codec/format/formatV1.js.map +1 -1
  59. package/dist/feature-libraries/chunked-forest/codec/format/formatV2.js +2 -24
  60. package/dist/feature-libraries/chunked-forest/codec/format/formatV2.js.map +1 -1
  61. package/dist/feature-libraries/chunked-forest/codec/format/formatVText.js +2 -24
  62. package/dist/feature-libraries/chunked-forest/codec/format/formatVText.js.map +1 -1
  63. package/dist/feature-libraries/chunked-forest/codec/index.d.ts +1 -1
  64. package/dist/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
  65. package/dist/feature-libraries/chunked-forest/codec/index.js +2 -1
  66. package/dist/feature-libraries/chunked-forest/codec/index.js.map +1 -1
  67. package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts +1 -1
  68. package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts.map +1 -1
  69. package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.js +3 -15
  70. package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.js.map +1 -1
  71. package/dist/feature-libraries/chunked-forest/index.d.ts +1 -1
  72. package/dist/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  73. package/dist/feature-libraries/chunked-forest/index.js +2 -1
  74. package/dist/feature-libraries/chunked-forest/index.js.map +1 -1
  75. package/dist/feature-libraries/flex-tree/lazyEntity.js +9 -19
  76. package/dist/feature-libraries/flex-tree/lazyEntity.js.map +1 -1
  77. package/dist/feature-libraries/flex-tree/lazyNode.js +3 -13
  78. package/dist/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  79. package/dist/feature-libraries/forest-summary/codec.d.ts +3 -3
  80. package/dist/feature-libraries/forest-summary/codec.d.ts.map +1 -1
  81. package/dist/feature-libraries/forest-summary/codec.js.map +1 -1
  82. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts +3 -2
  83. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  84. package/dist/feature-libraries/forest-summary/forestSummarizer.js +4 -6
  85. package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  86. package/dist/feature-libraries/forest-summary/formatCommon.js +2 -24
  87. package/dist/feature-libraries/forest-summary/formatCommon.js.map +1 -1
  88. package/dist/feature-libraries/index.d.ts +1 -1
  89. package/dist/feature-libraries/index.d.ts.map +1 -1
  90. package/dist/feature-libraries/index.js +4 -25
  91. package/dist/feature-libraries/index.js.map +1 -1
  92. package/dist/feature-libraries/modular-schema/genericFieldKindFormat.js +2 -24
  93. package/dist/feature-libraries/modular-schema/genericFieldKindFormat.js.map +1 -1
  94. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -1
  95. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js +9 -9
  96. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
  97. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  98. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +10 -30
  99. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  100. package/dist/feature-libraries/modular-schema/modularChangeFormatV1.js +2 -24
  101. package/dist/feature-libraries/modular-schema/modularChangeFormatV1.js.map +1 -1
  102. package/dist/feature-libraries/modular-schema/modularChangeFormatV2.js +2 -24
  103. package/dist/feature-libraries/modular-schema/modularChangeFormatV2.js.map +1 -1
  104. package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts +0 -5
  105. package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
  106. package/dist/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
  107. package/dist/feature-libraries/object-forest/objectForest.js +11 -55
  108. package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
  109. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV1.js +2 -24
  110. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV1.js.map +1 -1
  111. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV2.js +2 -24
  112. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV2.js.map +1 -1
  113. package/dist/feature-libraries/schema-edits/schemaChangeFormat.js +2 -24
  114. package/dist/feature-libraries/schema-edits/schemaChangeFormat.js.map +1 -1
  115. package/dist/feature-libraries/schema-index/formatV1.js +2 -24
  116. package/dist/feature-libraries/schema-index/formatV1.js.map +1 -1
  117. package/dist/feature-libraries/schema-index/formatV2.js +2 -24
  118. package/dist/feature-libraries/schema-index/formatV2.js.map +1 -1
  119. package/dist/feature-libraries/sequence-field/formatV1.js +2 -24
  120. package/dist/feature-libraries/sequence-field/formatV1.js.map +1 -1
  121. package/dist/feature-libraries/sequence-field/formatV2.js +2 -24
  122. package/dist/feature-libraries/sequence-field/formatV2.js.map +1 -1
  123. package/dist/feature-libraries/sequence-field/formatV3.js +2 -24
  124. package/dist/feature-libraries/sequence-field/formatV3.js.map +1 -1
  125. package/dist/index.d.ts +2 -2
  126. package/dist/index.d.ts.map +1 -1
  127. package/dist/index.js +4 -25
  128. package/dist/index.js.map +1 -1
  129. package/dist/packageVersion.d.ts +1 -1
  130. package/dist/packageVersion.js +1 -1
  131. package/dist/packageVersion.js.map +1 -1
  132. package/dist/shared-tree/independentView.d.ts.map +1 -1
  133. package/dist/shared-tree/independentView.js +4 -7
  134. package/dist/shared-tree/independentView.js.map +1 -1
  135. package/dist/shared-tree/index.d.ts +1 -1
  136. package/dist/shared-tree/index.d.ts.map +1 -1
  137. package/dist/shared-tree/index.js.map +1 -1
  138. package/dist/shared-tree/schematizingTreeView.d.ts +6 -5
  139. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  140. package/dist/shared-tree/schematizingTreeView.js +7 -41
  141. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  142. package/dist/shared-tree/sharedTree.d.ts +5 -1
  143. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  144. package/dist/shared-tree/sharedTree.js +13 -49
  145. package/dist/shared-tree/sharedTree.js.map +1 -1
  146. package/dist/shared-tree/sharedTreeChangeFormat.js +2 -24
  147. package/dist/shared-tree/sharedTreeChangeFormat.js.map +1 -1
  148. package/dist/shared-tree/transactionPostProcessor.d.ts +28 -0
  149. package/dist/shared-tree/transactionPostProcessor.d.ts.map +1 -0
  150. package/dist/shared-tree/transactionPostProcessor.js +28 -0
  151. package/dist/shared-tree/transactionPostProcessor.js.map +1 -0
  152. package/dist/shared-tree/treeAlpha.js +3 -3
  153. package/dist/shared-tree/treeAlpha.js.map +1 -1
  154. package/dist/shared-tree/treeCheckout.d.ts +28 -15
  155. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  156. package/dist/shared-tree/treeCheckout.js +124 -145
  157. package/dist/shared-tree/treeCheckout.js.map +1 -1
  158. package/dist/shared-tree/unhydratedTreeContext.d.ts +5 -5
  159. package/dist/shared-tree/unhydratedTreeContext.d.ts.map +1 -1
  160. package/dist/shared-tree/unhydratedTreeContext.js.map +1 -1
  161. package/dist/shared-tree-core/branch.js +13 -17
  162. package/dist/shared-tree-core/branch.js.map +1 -1
  163. package/dist/shared-tree-core/editManagerCodecs.d.ts +3 -2
  164. package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  165. package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
  166. package/dist/shared-tree-core/editManagerCodecsCommons.d.ts +3 -9
  167. package/dist/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
  168. package/dist/shared-tree-core/editManagerCodecsCommons.js +2 -4
  169. package/dist/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
  170. package/dist/shared-tree-core/editManagerCodecsV1toV4.d.ts +3 -3
  171. package/dist/shared-tree-core/editManagerCodecsV1toV4.d.ts.map +1 -1
  172. package/dist/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -1
  173. package/dist/shared-tree-core/editManagerCodecsVSharedBranches.d.ts +3 -3
  174. package/dist/shared-tree-core/editManagerCodecsVSharedBranches.d.ts.map +1 -1
  175. package/dist/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
  176. package/dist/shared-tree-core/editManagerFormatCommons.js +2 -24
  177. package/dist/shared-tree-core/editManagerFormatCommons.js.map +1 -1
  178. package/dist/shared-tree-core/editManagerFormatV1toV4.js +2 -24
  179. package/dist/shared-tree-core/editManagerFormatV1toV4.js.map +1 -1
  180. package/dist/shared-tree-core/editManagerFormatVSharedBranches.js +2 -24
  181. package/dist/shared-tree-core/editManagerFormatVSharedBranches.js.map +1 -1
  182. package/dist/shared-tree-core/editManagerSummarizer.d.ts +5 -9
  183. package/dist/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
  184. package/dist/shared-tree-core/editManagerSummarizer.js +5 -10
  185. package/dist/shared-tree-core/editManagerSummarizer.js.map +1 -1
  186. package/dist/shared-tree-core/index.d.ts +1 -1
  187. package/dist/shared-tree-core/index.d.ts.map +1 -1
  188. package/dist/shared-tree-core/index.js +3 -2
  189. package/dist/shared-tree-core/index.js.map +1 -1
  190. package/dist/shared-tree-core/messageCodecVSharedBranches.js +2 -24
  191. package/dist/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
  192. package/dist/shared-tree-core/messageFormatV1ToV4.js +2 -24
  193. package/dist/shared-tree-core/messageFormatV1ToV4.js.map +1 -1
  194. package/dist/shared-tree-core/messageFormatVSharedBranches.js +2 -24
  195. package/dist/shared-tree-core/messageFormatVSharedBranches.js.map +1 -1
  196. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  197. package/dist/shared-tree-core/sharedTreeCore.js +9 -44
  198. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  199. package/dist/shared-tree-core/transaction.d.ts +84 -9
  200. package/dist/shared-tree-core/transaction.d.ts.map +1 -1
  201. package/dist/shared-tree-core/transaction.js +94 -37
  202. package/dist/shared-tree-core/transaction.js.map +1 -1
  203. package/dist/simple-tree/api/index.d.ts +1 -1
  204. package/dist/simple-tree/api/index.d.ts.map +1 -1
  205. package/dist/simple-tree/api/index.js.map +1 -1
  206. package/dist/simple-tree/api/schemaCreationUtilities.d.ts +3 -3
  207. package/dist/simple-tree/api/schemaCreationUtilities.js +3 -3
  208. package/dist/simple-tree/api/schemaCreationUtilities.js.map +1 -1
  209. package/dist/simple-tree/api/schemaFactory.d.ts +1 -1
  210. package/dist/simple-tree/api/schemaFactory.js +2 -2
  211. package/dist/simple-tree/api/schemaFactory.js.map +1 -1
  212. package/dist/simple-tree/api/simpleSchemaCodec.js +2 -24
  213. package/dist/simple-tree/api/simpleSchemaCodec.js.map +1 -1
  214. package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts +2 -2
  215. package/dist/simple-tree/api/snapshotCompatibilityChecker.js +4 -26
  216. package/dist/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
  217. package/dist/simple-tree/api/transactionTypes.d.ts +91 -28
  218. package/dist/simple-tree/api/transactionTypes.d.ts.map +1 -1
  219. package/dist/simple-tree/api/transactionTypes.js.map +1 -1
  220. package/dist/simple-tree/api/tree.d.ts +96 -22
  221. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  222. package/dist/simple-tree/api/tree.js.map +1 -1
  223. package/dist/simple-tree/api/treeBeta.d.ts.map +1 -1
  224. package/dist/simple-tree/api/treeBeta.js.map +1 -1
  225. package/dist/simple-tree/core/treeNodeKernel.js +83 -93
  226. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
  227. package/dist/simple-tree/core/treeNodeSchema.d.ts +7 -7
  228. package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
  229. package/dist/simple-tree/core/unhydratedFlexTree.js +6 -10
  230. package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  231. package/dist/simple-tree/index.d.ts +1 -1
  232. package/dist/simple-tree/index.d.ts.map +1 -1
  233. package/dist/simple-tree/index.js.map +1 -1
  234. package/dist/simple-tree/leafNodeSchema.js +2 -12
  235. package/dist/simple-tree/leafNodeSchema.js.map +1 -1
  236. package/dist/simple-tree/node-kinds/array/arrayNode.js +2 -6
  237. package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  238. package/dist/simple-tree/simpleSchemaFormatV1.js +2 -24
  239. package/dist/simple-tree/simpleSchemaFormatV1.js.map +1 -1
  240. package/dist/tableSchema.d.ts +50 -4
  241. package/dist/tableSchema.d.ts.map +1 -1
  242. package/dist/tableSchema.js +202 -106
  243. package/dist/tableSchema.js.map +1 -1
  244. package/dist/text/index.d.ts +1 -0
  245. package/dist/text/index.d.ts.map +1 -1
  246. package/dist/text/index.js +3 -1
  247. package/dist/text/index.js.map +1 -1
  248. package/dist/text/textDomainFormatted.d.ts +69 -758
  249. package/dist/text/textDomainFormatted.d.ts.map +1 -1
  250. package/dist/text/textDomainFormatted.js +275 -322
  251. package/dist/text/textDomainFormatted.js.map +1 -1
  252. package/dist/text/textDomainFormattedDefault.d.ts +273 -0
  253. package/dist/text/textDomainFormattedDefault.d.ts.map +1 -0
  254. package/dist/text/textDomainFormattedDefault.js +94 -0
  255. package/dist/text/textDomainFormattedDefault.js.map +1 -0
  256. package/dist/util/arrayUtilities.d.ts +20 -0
  257. package/dist/util/arrayUtilities.d.ts.map +1 -1
  258. package/dist/util/arrayUtilities.js +24 -1
  259. package/dist/util/arrayUtilities.js.map +1 -1
  260. package/dist/util/compressedIds.d.ts +118 -0
  261. package/dist/util/compressedIds.d.ts.map +1 -0
  262. package/dist/util/compressedIds.js +133 -0
  263. package/dist/util/compressedIds.js.map +1 -0
  264. package/dist/util/index.d.ts +2 -1
  265. package/dist/util/index.d.ts.map +1 -1
  266. package/dist/util/index.js +11 -2
  267. package/dist/util/index.js.map +1 -1
  268. package/dist/util/rangeMap.d.ts +13 -0
  269. package/dist/util/rangeMap.d.ts.map +1 -1
  270. package/dist/util/rangeMap.js +69 -8
  271. package/dist/util/rangeMap.js.map +1 -1
  272. package/dist/util/typeboxBrand.js +2 -24
  273. package/dist/util/typeboxBrand.js.map +1 -1
  274. package/dist/util/utils.js +2 -24
  275. package/dist/util/utils.js.map +1 -1
  276. package/eslint.config.mts +0 -30
  277. package/lib/core/change-family/changeFamily.d.ts +3 -10
  278. package/lib/core/change-family/changeFamily.d.ts.map +1 -1
  279. package/lib/core/change-family/changeFamily.js.map +1 -1
  280. package/lib/core/rebase/types.d.ts +2 -2
  281. package/lib/core/rebase/types.js.map +1 -1
  282. package/lib/core/schema-stored/storedSchemaRepository.d.ts +2 -2
  283. package/lib/core/schema-stored/storedSchemaRepository.js.map +1 -1
  284. package/lib/core/tree/anchorSet.js +1 -5
  285. package/lib/core/tree/anchorSet.js.map +1 -1
  286. package/lib/entrypoints/alpha.d.ts +1 -1
  287. package/lib/entrypoints/alpha.d.ts.map +1 -1
  288. package/lib/entrypoints/alpha.js.map +1 -1
  289. package/lib/entrypoints/beta.d.ts +1 -1
  290. package/lib/entrypoints/beta.d.ts.map +1 -1
  291. package/lib/entrypoints/beta.js.map +1 -1
  292. package/lib/entrypoints/legacy.d.ts +1 -1
  293. package/lib/entrypoints/legacy.d.ts.map +1 -1
  294. package/lib/entrypoints/legacy.js.map +1 -1
  295. package/lib/feature-libraries/chunked-forest/chunkedForest.js +1 -5
  296. package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  297. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +19 -14
  298. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  299. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js +14 -33
  300. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  301. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts +85 -28
  302. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  303. package/lib/feature-libraries/chunked-forest/codec/codecs.js +82 -9
  304. package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  305. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +4 -2
  306. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
  307. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +12 -1
  308. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  309. package/lib/feature-libraries/chunked-forest/codec/index.d.ts +1 -1
  310. package/lib/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
  311. package/lib/feature-libraries/chunked-forest/codec/index.js +1 -1
  312. package/lib/feature-libraries/chunked-forest/codec/index.js.map +1 -1
  313. package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts +1 -1
  314. package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts.map +1 -1
  315. package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.js +3 -15
  316. package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.js.map +1 -1
  317. package/lib/feature-libraries/chunked-forest/index.d.ts +1 -1
  318. package/lib/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  319. package/lib/feature-libraries/chunked-forest/index.js +1 -1
  320. package/lib/feature-libraries/chunked-forest/index.js.map +1 -1
  321. package/lib/feature-libraries/flex-tree/lazyEntity.js +1 -11
  322. package/lib/feature-libraries/flex-tree/lazyEntity.js.map +1 -1
  323. package/lib/feature-libraries/flex-tree/lazyNode.js +1 -11
  324. package/lib/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  325. package/lib/feature-libraries/forest-summary/codec.d.ts +3 -3
  326. package/lib/feature-libraries/forest-summary/codec.d.ts.map +1 -1
  327. package/lib/feature-libraries/forest-summary/codec.js.map +1 -1
  328. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts +3 -2
  329. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  330. package/lib/feature-libraries/forest-summary/forestSummarizer.js +4 -6
  331. package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  332. package/lib/feature-libraries/index.d.ts +1 -1
  333. package/lib/feature-libraries/index.d.ts.map +1 -1
  334. package/lib/feature-libraries/index.js +1 -1
  335. package/lib/feature-libraries/index.js.map +1 -1
  336. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -1
  337. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js +10 -10
  338. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
  339. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  340. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +10 -30
  341. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  342. package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts +0 -5
  343. package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
  344. package/lib/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
  345. package/lib/feature-libraries/object-forest/objectForest.js +1 -45
  346. package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
  347. package/lib/index.d.ts +2 -2
  348. package/lib/index.d.ts.map +1 -1
  349. package/lib/index.js +1 -1
  350. package/lib/index.js.map +1 -1
  351. package/lib/packageVersion.d.ts +1 -1
  352. package/lib/packageVersion.js +1 -1
  353. package/lib/packageVersion.js.map +1 -1
  354. package/lib/shared-tree/independentView.d.ts.map +1 -1
  355. package/lib/shared-tree/independentView.js +5 -8
  356. package/lib/shared-tree/independentView.js.map +1 -1
  357. package/lib/shared-tree/index.d.ts +1 -1
  358. package/lib/shared-tree/index.d.ts.map +1 -1
  359. package/lib/shared-tree/index.js.map +1 -1
  360. package/lib/shared-tree/schematizingTreeView.d.ts +6 -5
  361. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  362. package/lib/shared-tree/schematizingTreeView.js +4 -38
  363. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  364. package/lib/shared-tree/sharedTree.d.ts +5 -1
  365. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  366. package/lib/shared-tree/sharedTree.js +9 -45
  367. package/lib/shared-tree/sharedTree.js.map +1 -1
  368. package/lib/shared-tree/transactionPostProcessor.d.ts +28 -0
  369. package/lib/shared-tree/transactionPostProcessor.d.ts.map +1 -0
  370. package/lib/shared-tree/transactionPostProcessor.js +23 -0
  371. package/lib/shared-tree/transactionPostProcessor.js.map +1 -0
  372. package/lib/shared-tree/treeAlpha.js +3 -3
  373. package/lib/shared-tree/treeAlpha.js.map +1 -1
  374. package/lib/shared-tree/treeCheckout.d.ts +28 -15
  375. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  376. package/lib/shared-tree/treeCheckout.js +80 -101
  377. package/lib/shared-tree/treeCheckout.js.map +1 -1
  378. package/lib/shared-tree/unhydratedTreeContext.d.ts +5 -5
  379. package/lib/shared-tree/unhydratedTreeContext.d.ts.map +1 -1
  380. package/lib/shared-tree/unhydratedTreeContext.js.map +1 -1
  381. package/lib/shared-tree-core/branch.js +1 -5
  382. package/lib/shared-tree-core/branch.js.map +1 -1
  383. package/lib/shared-tree-core/editManagerCodecs.d.ts +3 -2
  384. package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  385. package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
  386. package/lib/shared-tree-core/editManagerCodecsCommons.d.ts +3 -9
  387. package/lib/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
  388. package/lib/shared-tree-core/editManagerCodecsCommons.js +3 -5
  389. package/lib/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
  390. package/lib/shared-tree-core/editManagerCodecsV1toV4.d.ts +3 -3
  391. package/lib/shared-tree-core/editManagerCodecsV1toV4.d.ts.map +1 -1
  392. package/lib/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -1
  393. package/lib/shared-tree-core/editManagerCodecsVSharedBranches.d.ts +3 -3
  394. package/lib/shared-tree-core/editManagerCodecsVSharedBranches.d.ts.map +1 -1
  395. package/lib/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
  396. package/lib/shared-tree-core/editManagerSummarizer.d.ts +5 -9
  397. package/lib/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
  398. package/lib/shared-tree-core/editManagerSummarizer.js +5 -10
  399. package/lib/shared-tree-core/editManagerSummarizer.js.map +1 -1
  400. package/lib/shared-tree-core/index.d.ts +1 -1
  401. package/lib/shared-tree-core/index.d.ts.map +1 -1
  402. package/lib/shared-tree-core/index.js +1 -1
  403. package/lib/shared-tree-core/index.js.map +1 -1
  404. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  405. package/lib/shared-tree-core/sharedTreeCore.js +4 -39
  406. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  407. package/lib/shared-tree-core/transaction.d.ts +84 -9
  408. package/lib/shared-tree-core/transaction.d.ts.map +1 -1
  409. package/lib/shared-tree-core/transaction.js +74 -17
  410. package/lib/shared-tree-core/transaction.js.map +1 -1
  411. package/lib/simple-tree/api/index.d.ts +1 -1
  412. package/lib/simple-tree/api/index.d.ts.map +1 -1
  413. package/lib/simple-tree/api/index.js.map +1 -1
  414. package/lib/simple-tree/api/schemaCreationUtilities.d.ts +3 -3
  415. package/lib/simple-tree/api/schemaCreationUtilities.js +3 -3
  416. package/lib/simple-tree/api/schemaCreationUtilities.js.map +1 -1
  417. package/lib/simple-tree/api/schemaFactory.d.ts +1 -1
  418. package/lib/simple-tree/api/schemaFactory.js +2 -2
  419. package/lib/simple-tree/api/schemaFactory.js.map +1 -1
  420. package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts +2 -2
  421. package/lib/simple-tree/api/snapshotCompatibilityChecker.js +2 -2
  422. package/lib/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
  423. package/lib/simple-tree/api/transactionTypes.d.ts +91 -28
  424. package/lib/simple-tree/api/transactionTypes.d.ts.map +1 -1
  425. package/lib/simple-tree/api/transactionTypes.js.map +1 -1
  426. package/lib/simple-tree/api/tree.d.ts +96 -22
  427. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  428. package/lib/simple-tree/api/tree.js.map +1 -1
  429. package/lib/simple-tree/api/treeBeta.d.ts.map +1 -1
  430. package/lib/simple-tree/api/treeBeta.js.map +1 -1
  431. package/lib/simple-tree/core/treeNodeKernel.js +1 -11
  432. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
  433. package/lib/simple-tree/core/treeNodeSchema.d.ts +7 -7
  434. package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
  435. package/lib/simple-tree/core/unhydratedFlexTree.js +1 -5
  436. package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  437. package/lib/simple-tree/index.d.ts +1 -1
  438. package/lib/simple-tree/index.d.ts.map +1 -1
  439. package/lib/simple-tree/index.js.map +1 -1
  440. package/lib/simple-tree/leafNodeSchema.js +1 -11
  441. package/lib/simple-tree/leafNodeSchema.js.map +1 -1
  442. package/lib/simple-tree/node-kinds/array/arrayNode.js +1 -5
  443. package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  444. package/lib/tableSchema.d.ts +50 -4
  445. package/lib/tableSchema.d.ts.map +1 -1
  446. package/lib/tableSchema.js +171 -75
  447. package/lib/tableSchema.js.map +1 -1
  448. package/lib/text/index.d.ts +1 -0
  449. package/lib/text/index.d.ts.map +1 -1
  450. package/lib/text/index.js +1 -0
  451. package/lib/text/index.js.map +1 -1
  452. package/lib/text/textDomainFormatted.d.ts +69 -758
  453. package/lib/text/textDomainFormatted.d.ts.map +1 -1
  454. package/lib/text/textDomainFormatted.js +277 -324
  455. package/lib/text/textDomainFormatted.js.map +1 -1
  456. package/lib/text/textDomainFormattedDefault.d.ts +273 -0
  457. package/lib/text/textDomainFormattedDefault.d.ts.map +1 -0
  458. package/lib/text/textDomainFormattedDefault.js +91 -0
  459. package/lib/text/textDomainFormattedDefault.js.map +1 -0
  460. package/lib/util/arrayUtilities.d.ts +20 -0
  461. package/lib/util/arrayUtilities.d.ts.map +1 -1
  462. package/lib/util/arrayUtilities.js +22 -0
  463. package/lib/util/arrayUtilities.js.map +1 -1
  464. package/lib/util/compressedIds.d.ts +118 -0
  465. package/lib/util/compressedIds.d.ts.map +1 -0
  466. package/lib/util/compressedIds.js +124 -0
  467. package/lib/util/compressedIds.js.map +1 -0
  468. package/lib/util/index.d.ts +2 -1
  469. package/lib/util/index.d.ts.map +1 -1
  470. package/lib/util/index.js +2 -1
  471. package/lib/util/index.js.map +1 -1
  472. package/lib/util/rangeMap.d.ts +13 -0
  473. package/lib/util/rangeMap.d.ts.map +1 -1
  474. package/lib/util/rangeMap.js +69 -8
  475. package/lib/util/rangeMap.js.map +1 -1
  476. package/package.json +25 -24
  477. package/src/core/change-family/changeFamily.ts +3 -12
  478. package/src/core/rebase/types.ts +2 -2
  479. package/src/core/schema-stored/storedSchemaRepository.ts +2 -2
  480. package/src/entrypoints/alpha.ts +12 -8
  481. package/src/entrypoints/beta.ts +8 -0
  482. package/src/entrypoints/legacy.ts +8 -0
  483. package/src/feature-libraries/chunked-forest/codec/chunkDecoding.ts +35 -64
  484. package/src/feature-libraries/chunked-forest/codec/codecs.ts +138 -42
  485. package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +32 -4
  486. package/src/feature-libraries/chunked-forest/codec/index.ts +1 -0
  487. package/src/feature-libraries/chunked-forest/codec/nodeEncoder.ts +7 -19
  488. package/src/feature-libraries/chunked-forest/index.ts +3 -0
  489. package/src/feature-libraries/forest-summary/codec.ts +5 -3
  490. package/src/feature-libraries/forest-summary/forestSummarizer.ts +4 -5
  491. package/src/feature-libraries/index.ts +3 -0
  492. package/src/feature-libraries/modular-schema/modularChangeCodecV1.ts +13 -9
  493. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +14 -47
  494. package/src/feature-libraries/modular-schema/modularChangeTypes.ts +0 -5
  495. package/src/index.ts +13 -8
  496. package/src/packageVersion.ts +1 -1
  497. package/src/shared-tree/independentView.ts +5 -10
  498. package/src/shared-tree/index.ts +1 -0
  499. package/src/shared-tree/schematizingTreeView.ts +29 -25
  500. package/src/shared-tree/sharedTree.ts +18 -10
  501. package/src/shared-tree/transactionPostProcessor.ts +40 -0
  502. package/src/shared-tree/treeAlpha.ts +3 -3
  503. package/src/shared-tree/treeCheckout.ts +120 -95
  504. package/src/shared-tree/unhydratedTreeContext.ts +18 -15
  505. package/src/shared-tree-core/editManagerCodecs.ts +3 -2
  506. package/src/shared-tree-core/editManagerCodecsCommons.ts +10 -14
  507. package/src/shared-tree-core/editManagerCodecsV1toV4.ts +3 -2
  508. package/src/shared-tree-core/editManagerCodecsVSharedBranches.ts +3 -2
  509. package/src/shared-tree-core/editManagerSummarizer.ts +5 -9
  510. package/src/shared-tree-core/index.ts +8 -5
  511. package/src/shared-tree-core/sharedTreeCore.ts +3 -2
  512. package/src/shared-tree-core/transaction.ts +148 -18
  513. package/src/simple-tree/api/index.ts +13 -9
  514. package/src/simple-tree/api/schemaCreationUtilities.ts +3 -3
  515. package/src/simple-tree/api/schemaFactory.ts +2 -2
  516. package/src/simple-tree/api/snapshotCompatibilityChecker.ts +2 -2
  517. package/src/simple-tree/api/transactionTypes.ts +111 -39
  518. package/src/simple-tree/api/tree.ts +152 -47
  519. package/src/simple-tree/api/treeBeta.ts +2 -0
  520. package/src/simple-tree/core/treeNodeSchema.ts +7 -7
  521. package/src/simple-tree/index.ts +12 -8
  522. package/src/tableSchema.ts +306 -80
  523. package/src/text/index.ts +1 -0
  524. package/src/text/textDomainFormatted.ts +520 -415
  525. package/src/text/textDomainFormattedDefault.ts +150 -0
  526. package/src/util/arrayUtilities.ts +35 -0
  527. package/src/util/compressedIds.ts +216 -0
  528. package/src/util/index.ts +17 -0
  529. package/src/util/rangeMap.ts +108 -9
  530. package/tsconfig.json +5 -0
@@ -3,14 +3,10 @@
3
3
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
4
4
  * Licensed under the MIT License.
5
5
  */
6
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
7
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
8
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
9
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
10
- };
11
6
  var _SharedTreeBranch_events;
12
7
  Object.defineProperty(exports, "__esModule", { value: true });
13
8
  exports.onForkTransitive = exports.SharedTreeBranch = void 0;
9
+ const tslib_1 = require("tslib");
14
10
  const client_utils_1 = require("@fluid-internal/client-utils");
15
11
  const internal_1 = require("@fluidframework/core-utils/internal");
16
12
  const internal_2 = require("@fluidframework/telemetry-utils/internal");
@@ -35,11 +31,11 @@ class SharedTreeBranch {
35
31
  this.branchTrimmer = branchTrimmer;
36
32
  this.telemetryEventBatcher = telemetryEventBatcher;
37
33
  _SharedTreeBranch_events.set(this, (0, client_utils_1.createEmitter)());
38
- this.events = __classPrivateFieldGet(this, _SharedTreeBranch_events, "f");
34
+ this.events = tslib_1.__classPrivateFieldGet(this, _SharedTreeBranch_events, "f");
39
35
  this.disposed = false;
40
36
  this.editor = this.changeFamily.buildEditor(mintRevisionTag, (change) => this.apply(change));
41
37
  this.unsubscribeBranchTrimmer = branchTrimmer?.on("ancestryTrimmed", (commit) => {
42
- __classPrivateFieldGet(this, _SharedTreeBranch_events, "f").emit("ancestryTrimmed", commit);
38
+ tslib_1.__classPrivateFieldGet(this, _SharedTreeBranch_events, "f").emit("ancestryTrimmed", commit);
43
39
  });
44
40
  }
45
41
  /**
@@ -71,9 +67,9 @@ class SharedTreeBranch {
71
67
  change,
72
68
  newCommits: [newHead],
73
69
  };
74
- __classPrivateFieldGet(this, _SharedTreeBranch_events, "f").emit("beforeChange", changeEvent);
70
+ tslib_1.__classPrivateFieldGet(this, _SharedTreeBranch_events, "f").emit("beforeChange", changeEvent);
75
71
  this.head = newHead;
76
- __classPrivateFieldGet(this, _SharedTreeBranch_events, "f").emit("afterChange", changeEvent);
72
+ tslib_1.__classPrivateFieldGet(this, _SharedTreeBranch_events, "f").emit("afterChange", changeEvent);
77
73
  }
78
74
  /**
79
75
  * Gets the commit at the head of this branch.
@@ -91,7 +87,7 @@ class SharedTreeBranch {
91
87
  fork(commit = this.head, mintRevisionTag = this.mintRevisionTag) {
92
88
  this.assertNotDisposed();
93
89
  const fork = new SharedTreeBranch(commit, this.changeFamily, mintRevisionTag, this.branchTrimmer);
94
- __classPrivateFieldGet(this, _SharedTreeBranch_events, "f").emit("fork", fork);
90
+ tslib_1.__classPrivateFieldGet(this, _SharedTreeBranch_events, "f").emit("fork", fork);
95
91
  return fork;
96
92
  }
97
93
  /**
@@ -123,9 +119,9 @@ class SharedTreeBranch {
123
119
  removedCommits: deletedSourceCommits,
124
120
  newCommits,
125
121
  };
126
- __classPrivateFieldGet(this, _SharedTreeBranch_events, "f").emit("beforeChange", changeEvent);
122
+ tslib_1.__classPrivateFieldGet(this, _SharedTreeBranch_events, "f").emit("beforeChange", changeEvent);
127
123
  this.head = newSourceHead;
128
- __classPrivateFieldGet(this, _SharedTreeBranch_events, "f").emit("afterChange", changeEvent);
124
+ tslib_1.__classPrivateFieldGet(this, _SharedTreeBranch_events, "f").emit("afterChange", changeEvent);
129
125
  }
130
126
  /**
131
127
  * Remove a range of commits from this branch.
@@ -155,9 +151,9 @@ class SharedTreeBranch {
155
151
  change,
156
152
  removedCommits,
157
153
  };
158
- __classPrivateFieldGet(this, _SharedTreeBranch_events, "f").emit("beforeChange", changeEvent);
154
+ tslib_1.__classPrivateFieldGet(this, _SharedTreeBranch_events, "f").emit("beforeChange", changeEvent);
159
155
  this.head = commit;
160
- __classPrivateFieldGet(this, _SharedTreeBranch_events, "f").emit("afterChange", changeEvent);
156
+ tslib_1.__classPrivateFieldGet(this, _SharedTreeBranch_events, "f").emit("afterChange", changeEvent);
161
157
  }
162
158
  /**
163
159
  * Apply all the divergent changes on the given branch to this branch.
@@ -185,9 +181,9 @@ class SharedTreeBranch {
185
181
  kind: index_js_1.CommitKind.Default,
186
182
  newCommits: sourceCommits,
187
183
  }, "change", () => (0, index_js_1.makeAnonChange)(rebaser.compose(sourceCommits)));
188
- __classPrivateFieldGet(this, _SharedTreeBranch_events, "f").emit("beforeChange", changeEvent);
184
+ tslib_1.__classPrivateFieldGet(this, _SharedTreeBranch_events, "f").emit("beforeChange", changeEvent);
189
185
  this.head = rebaseResult.newSourceHead;
190
- __classPrivateFieldGet(this, _SharedTreeBranch_events, "f").emit("afterChange", changeEvent);
186
+ tslib_1.__classPrivateFieldGet(this, _SharedTreeBranch_events, "f").emit("afterChange", changeEvent);
191
187
  return { sourceCommits };
192
188
  }
193
189
  /** Rebase `branchHead` onto `onto`, but return undefined if nothing changed */
@@ -217,7 +213,7 @@ class SharedTreeBranch {
217
213
  }
218
214
  this.unsubscribeBranchTrimmer?.();
219
215
  this.disposed = true;
220
- __classPrivateFieldGet(this, _SharedTreeBranch_events, "f").emit("dispose");
216
+ tslib_1.__classPrivateFieldGet(this, _SharedTreeBranch_events, "f").emit("dispose");
221
217
  }
222
218
  assertNotDisposed() {
223
219
  (0, internal_1.assert)(!this.disposed, 0x66e /* Branch is disposed */);
@@ -1 +1 @@
1
- {"version":3,"file":"branch.js","sourceRoot":"","sources":["../../src/shared-tree-core/branch.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;AAEH,+DAA6D;AAE7D,kEAA6D;AAK7D,uEAA+F;AAE/F,+CAc0B;AAC1B,+CAAqE;AA6ErE;;GAEG;AACH,MAAa,gBAAgB;IAM5B;;;;;;;OAOG;IACH,YACS,IAA0B,EAClB,YAA4C,EAC3C,eAAkC,EAClC,aAAgD,EAChD,qBAEhB;QANO,SAAI,GAAJ,IAAI,CAAsB;QAClB,iBAAY,GAAZ,YAAY,CAAgC;QAC3C,oBAAe,GAAf,eAAe,CAAmB;QAClC,kBAAa,GAAb,aAAa,CAAmC;QAChD,0BAAqB,GAArB,qBAAqB,CAErC;QApBO,mCAAU,IAAA,4BAAa,GAA4C,EAAC;QAC7D,WAAM,GAAyD,uBAAA,IAAI,gCAAQ,CAAC;QAEpF,aAAQ,GAAG,KAAK,CAAC;QAmBxB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,YAAY,CAAC,WAAW,CAAC,eAAe,EAAE,CAAC,MAAM,EAAE,EAAE,CACvE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAClB,CAAC;QACF,IAAI,CAAC,wBAAwB,GAAG,aAAa,EAAE,EAAE,CAAC,iBAAiB,E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E;QACpC,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;QAC1C,MAAM,CAAC,IAAI,CAAC,CAAC;IACd,CAAC,CAAC,CACF,CAAC;IACF,OAAO,GAAG,EAAE;QACX,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;YACxB,GAAG,EAAE,CAAC;QACP,CAAC;IACF,CAAC,CAAC;AACH,CAAC;AAhBD,4CAgBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { createEmitter } from \"@fluid-internal/client-utils\";\nimport type { Listenable } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type {\n\tOpSpaceCompressedId,\n\tSessionSpaceCompressedId,\n} from \"@fluidframework/id-compressor\";\nimport { type TelemetryEventBatcher, measure } from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\ttype BranchRebaseResult,\n\ttype ChangeFamily,\n\ttype ChangeFamilyEditor,\n\tCommitKind,\n\ttype GraphCommit,\n\ttype RevisionTag,\n\ttype TaggedChange,\n\tfindAncestor,\n\tmakeAnonChange,\n\tmintCommit,\n\trebaseBranch,\n\ttagRollbackInverse,\n\ttype RebaseStatsWithDuration,\n} from \"../core/index.js\";\nimport { hasSome, defineLazyCachedProperty } from \"../util/index.js\";\n\nexport type BranchId = SessionSpaceCompressedId | \"main\";\nexport type EncodedBranchId = OpSpaceCompressedId;\n\n/**\n * Describes a change to a `SharedTreeBranch`. Each of the following event types provides a `change` which contains the net change to the branch (or is undefined if there was no net change):\n * * Append - when one or more commits are appended to the head of the branch, for example via\n * a change applied by the branch's editor, or as a result of merging another branch into this one\n * * Remove - when one or more commits are removed from the head of the branch.\n * * Rebase - when a rebase operation adds commits from another branch and replaces existing commits with their rebased versions.\n */\nexport type SharedTreeBranchChange<TChange> =\n\t| {\n\t\t\ttype: \"append\";\n\t\t\tkind: CommitKind;\n\t\t\tchange: TaggedChange<TChange>;\n\t\t\t/** The commits appended to the head of the branch by this operation */\n\t\t\tnewCommits: readonly [GraphCommit<TChange>, ...GraphCommit<TChange>[]];\n\t }\n\t| {\n\t\t\ttype: \"remove\";\n\t\t\tchange: TaggedChange<TChange>;\n\t\t\t/** The commits removed from the head of the branch by this operation */\n\t\t\tremovedCommits: readonly [GraphCommit<TChange>, ...GraphCommit<TChange>[]];\n\t }\n\t| {\n\t\t\ttype: \"rebase\";\n\t\t\tchange: TaggedChange<TChange> | undefined;\n\t };\n\n/**\n * The events emitted by a `SharedTreeBranch`\n */\nexport interface SharedTreeBranchEvents<TEditor extends ChangeFamilyEditor, TChange>\n\textends BranchTrimmingEvents {\n\t/**\n\t * Fired just before the head of this branch changes.\n\t * @param change - the change to this branch's state and commits\n\t */\n\tbeforeChange(change: SharedTreeBranchChange<TChange>): void;\n\n\t/**\n\t * Fired just after the head of this branch changes.\n\t * @param change - the change to this branch's state and commits\n\t */\n\tafterChange(change: SharedTreeBranchChange<TChange>): void;\n\n\t/**\n\t * Fired when this branch forks\n\t * @param fork - the new branch that forked off of this branch\n\t */\n\tfork(fork: SharedTreeBranch<TEditor, TChange>): void;\n\n\t/**\n\t * Fired after this branch is disposed\n\t */\n\tdispose(): void;\n}\n\n/**\n * Events related to branch trimming.\n *\n * @remarks\n * Trimming is a very specific kind of mutation which is the only allowed mutations to branches.\n * References to commits from other commits are removed so that the commit objects can be GC'd by the JS engine.\n * This happens by changing a commit's parent property to undefined, which drops all commits that are in its \"ancestry\".\n * It is done as a performance optimization when it is determined that commits are no longer needed for future computation.\n */\nexport interface BranchTrimmingEvents {\n\t/**\n\t * Fired when some contiguous range of commits beginning with the \"global tail\" of this branch are trimmed from the branch.\n\t * This happens by deleting the parent pointer to the last commit in that range. This event can be fired at any time.\n\t */\n\tancestryTrimmed(trimmedRevisions: RevisionTag[]): void;\n}\n\n/**\n * A branch of changes that can be applied to a SharedTree.\n */\nexport class SharedTreeBranch<TEditor extends ChangeFamilyEditor, TChange> {\n\treadonly #events = createEmitter<SharedTreeBranchEvents<TEditor, TChange>>();\n\tpublic readonly events: Listenable<SharedTreeBranchEvents<TEditor, TChange>> = this.#events;\n\tpublic readonly editor: TEditor;\n\tprivate disposed = false;\n\tprivate readonly unsubscribeBranchTrimmer?: () => void;\n\t/**\n\t * Construct a new branch.\n\t * @param head - the head of the branch\n\t * @param changeFamily - determines the set of changes that this branch can commit\n\t * @param mintRevisionTag - used to generate a `RevisionTag` for each change.\n\t * @param branchTrimmer - an optional event emitter that informs the branch it has been trimmed. If this is not supplied, then the branch must\n\t * never be trimmed. See {@link BranchTrimmingEvents} for details on trimming.\n\t */\n\tpublic constructor(\n\t\tprivate head: GraphCommit<TChange>,\n\t\tpublic readonly changeFamily: ChangeFamily<TEditor, TChange>,\n\t\tprivate readonly mintRevisionTag: () => RevisionTag,\n\t\tprivate readonly branchTrimmer?: Listenable<BranchTrimmingEvents>,\n\t\tprivate readonly telemetryEventBatcher?: TelemetryEventBatcher<\n\t\t\tkeyof RebaseStatsWithDuration\n\t\t>,\n\t) {\n\t\tthis.editor = this.changeFamily.buildEditor(mintRevisionTag, (change) =>\n\t\t\tthis.apply(change),\n\t\t);\n\t\tthis.unsubscribeBranchTrimmer = branchTrimmer?.on(\"ancestryTrimmed\", (commit) => {\n\t\t\tthis.#events.emit(\"ancestryTrimmed\", commit);\n\t\t});\n\t}\n\n\t/**\n\t * Sets the head of this branch.\n\t * @remarks This is a \"manual override\" of sorts, for when the branch needs to be set to a certain state without going through the usual flow of edits.\n\t * This might be necessary as a performance optimization, or to prevent parts of the system updating incorrectly (this method emits no change events!).\n\t */\n\tpublic setHead(head: GraphCommit<TChange>): void {\n\t\tthis.assertNotDisposed();\n\t\tthis.head = head;\n\t}\n\n\t/**\n\t * Apply a change to this branch.\n\t * @param change - the change to apply\n\t * @param kind - the kind of change to apply\n\t * @returns the change that was applied and the new head commit of the branch\n\t */\n\tpublic apply(change: TaggedChange<TChange>, kind: CommitKind = CommitKind.Default): void {\n\t\tthis.assertNotDisposed();\n\n\t\tconst revisionTag = change.revision;\n\t\tassert(revisionTag !== undefined, 0xa49 /* Revision tag must be provided */);\n\n\t\tconst newHead = mintCommit(this.head, {\n\t\t\trevision: revisionTag,\n\t\t\tchange: change.change,\n\t\t});\n\n\t\tconst changeEvent = {\n\t\t\ttype: \"append\",\n\t\t\tkind,\n\t\t\tchange,\n\t\t\tnewCommits: [newHead],\n\t\t} as const;\n\n\t\tthis.#events.emit(\"beforeChange\", changeEvent);\n\t\tthis.head = newHead;\n\t\tthis.#events.emit(\"afterChange\", changeEvent);\n\t}\n\n\t/**\n\t * Gets the commit at the head of this branch.\n\t */\n\tpublic getHead(): GraphCommit<TChange> {\n\t\treturn this.head;\n\t}\n\n\t/**\n\t * Spawn a new branch that is based off of the current state of this branch.\n\t * @param commit - The commit to base the new branch off of. Defaults to the head of this branch.\n\t * @param mintRevisionTag - used to generate a `RevisionTag` for each change.\n\t * @remarks Changes made to the new branch will not be applied to this branch until the new branch is {@link SharedTreeBranch.merge | merged} back in.\n\t * Forks created during a transaction will be disposed when the transaction ends.\n\t */\n\tpublic fork(\n\t\tcommit: GraphCommit<TChange> = this.head,\n\t\tmintRevisionTag: () => RevisionTag = this.mintRevisionTag,\n\t): SharedTreeBranch<TEditor, TChange> {\n\t\tthis.assertNotDisposed();\n\t\tconst fork = new SharedTreeBranch(\n\t\t\tcommit,\n\t\t\tthis.changeFamily,\n\t\t\tmintRevisionTag,\n\t\t\tthis.branchTrimmer,\n\t\t);\n\t\tthis.#events.emit(\"fork\", fork);\n\t\treturn fork;\n\t}\n\n\t/**\n\t * Rebase the changes that have been applied to this branch over divergent changes in the given branch.\n\t * After this operation completes, this branch will be based off of `branch`.\n\t *\n\t * @param branch - the branch to rebase onto\n\t * @param upTo - the furthest commit on `branch` over which to rebase (inclusive). Defaults to the head commit of `branch`.\n\t * @returns the result of the rebase or undefined if nothing changed\n\t */\n\tpublic rebaseOnto(\n\t\tbranch: SharedTreeBranch<TEditor, TChange>,\n\t\tupTo = branch.getHead(),\n\t): void {\n\t\tthis.assertNotDisposed();\n\n\t\t// Rebase this branch onto the given branch\n\t\tconst rebaseResult = this.rebaseBranch(this, branch, upTo);\n\t\tif (rebaseResult === undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\t// The net change to this branch is provided by the `rebaseBranch` API\n\t\tconst { newSourceHead, commits } = rebaseResult;\n\t\tconst { deletedSourceCommits, targetCommits, sourceCommits } = commits;\n\t\tassert(hasSome(targetCommits), 0xa83 /* Expected commit(s) for a non no-op rebase */);\n\n\t\tconst newCommits = [...targetCommits, ...sourceCommits];\n\t\tconst changeEvent = {\n\t\t\ttype: \"rebase\",\n\t\t\tget change() {\n\t\t\t\tconst change = rebaseResult.sourceChange;\n\t\t\t\treturn change === undefined ? undefined : makeAnonChange(change);\n\t\t\t},\n\t\t\tremovedCommits: deletedSourceCommits,\n\t\t\tnewCommits,\n\t\t} as const;\n\n\t\tthis.#events.emit(\"beforeChange\", changeEvent);\n\t\tthis.head = newSourceHead;\n\t\tthis.#events.emit(\"afterChange\", changeEvent);\n\t}\n\n\t/**\n\t * Remove a range of commits from this branch.\n\t * @param commit - All commits after (but not including) this commit will be removed.\n\t * @returns The net change to this branch and the commits that were removed from this branch.\n\t */\n\tpublic removeAfter(commit: GraphCommit<TChange>): void {\n\t\tif (commit === this.head) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst removedCommits: GraphCommit<TChange>[] = [];\n\t\tconst inverses: TaggedChange<TChange>[] = [];\n\t\tfindAncestor([this.head, removedCommits], (c) => {\n\t\t\t// TODO: Pull this side effect out if/when more diverse ancestry walking helpers are available\n\t\t\tif (c !== commit) {\n\t\t\t\tconst revision = this.mintRevisionTag();\n\t\t\t\tconst inverse = this.changeFamily.rebaser.invert(c, true, revision);\n\t\t\t\tinverses.push(tagRollbackInverse(inverse, revision, c.revision));\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\treturn true;\n\t\t});\n\t\tassert(hasSome(removedCommits), 0xa84 /* Commit must be in the branch's ancestry */);\n\n\t\tconst change = makeAnonChange(this.changeFamily.rebaser.compose(inverses));\n\t\tconst changeEvent = {\n\t\t\ttype: \"remove\",\n\t\t\tchange,\n\t\t\tremovedCommits,\n\t\t} as const;\n\n\t\tthis.#events.emit(\"beforeChange\", changeEvent);\n\t\tthis.head = commit;\n\t\tthis.#events.emit(\"afterChange\", changeEvent);\n\t}\n\n\t/**\n\t * Apply all the divergent changes on the given branch to this branch.\n\t *\n\t * @param branch - the branch to merge into this branch\n\t * @returns the commits that were added to this branch by the merge, or undefined if nothing changed\n\t */\n\tpublic merge(\n\t\tbranch: SharedTreeBranch<TEditor, TChange>,\n\t): { sourceCommits: GraphCommit<TChange>[] } | undefined {\n\t\tthis.assertNotDisposed();\n\t\tbranch.assertNotDisposed();\n\n\t\tif (branch === this) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// Rebase the given branch onto this branch\n\t\tconst rebaseResult = this.rebaseBranch(branch, this);\n\t\tif (rebaseResult === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// Compute the net change to this branch\n\t\tconst sourceCommits = rebaseResult.commits.sourceCommits;\n\t\tassert(hasSome(sourceCommits), 0xa86 /* Expected source commits in non no-op merge */);\n\t\tconst { rebaser } = this.changeFamily;\n\t\tconst changeEvent = defineLazyCachedProperty(\n\t\t\t{\n\t\t\t\ttype: \"append\",\n\t\t\t\tkind: CommitKind.Default,\n\t\t\t\tnewCommits: sourceCommits,\n\t\t\t} as const,\n\t\t\t\"change\",\n\t\t\t() => makeAnonChange(rebaser.compose(sourceCommits)),\n\t\t);\n\n\t\tthis.#events.emit(\"beforeChange\", changeEvent);\n\t\tthis.head = rebaseResult.newSourceHead;\n\t\tthis.#events.emit(\"afterChange\", changeEvent);\n\t\treturn { sourceCommits };\n\t}\n\n\t/** Rebase `branchHead` onto `onto`, but return undefined if nothing changed */\n\tprivate rebaseBranch(\n\t\tbranch: SharedTreeBranch<TEditor, TChange>,\n\t\tonto: SharedTreeBranch<TEditor, TChange>,\n\t\tupTo = onto.getHead(),\n\t): BranchRebaseResult<TChange> | undefined {\n\t\tconst { head } = branch;\n\t\tif (head === upTo) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst { duration, output } = measure(() =>\n\t\t\trebaseBranch(\n\t\t\t\tthis.mintRevisionTag,\n\t\t\t\tthis.changeFamily.rebaser,\n\t\t\t\thead,\n\t\t\t\tupTo,\n\t\t\t\tonto.getHead(),\n\t\t\t),\n\t\t);\n\n\t\tthis.telemetryEventBatcher?.accumulateAndLog({ duration, ...output.telemetryProperties });\n\n\t\tif (this.head === output.newSourceHead) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn output;\n\t}\n\n\t/**\n\t * Dispose this branch, freezing its state.\n\t *\n\t * @remarks\n\t * Attempts to further mutate the branch will error.\n\t * Any transactions in progress will be aborted.\n\t * Calling dispose more than once has no effect.\n\t */\n\tpublic dispose(): void {\n\t\tif (this.disposed) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.unsubscribeBranchTrimmer?.();\n\n\t\tthis.disposed = true;\n\t\tthis.#events.emit(\"dispose\");\n\t}\n\n\tprivate assertNotDisposed(): void {\n\t\tassert(!this.disposed, 0x66e /* Branch is disposed */);\n\t}\n}\n\n/**\n * Registers an event listener that fires when the given branch forks.\n * The listener will also fire when any of those forks fork, and when those forks of forks fork, and so on.\n * @param branch - the branch that will be listened to for forks\n * @param onFork - the fork event listener\n * @returns a function which when called will deregister all registrations (including transitive) created by this function.\n * The deregister function has undefined behavior if called more than once.\n */\n// Branches are invariant over TChange\nexport function onForkTransitive<T extends { events: Listenable<{ fork(t: T): void }> }>(\n\tbranch: T,\n\tonFork: (fork: T) => void,\n): () => void {\n\tconst offs: (() => void)[] = [];\n\toffs.push(\n\t\tbranch.events.on(\"fork\", (fork: T) => {\n\t\t\toffs.push(onForkTransitive(fork, onFork));\n\t\t\tonFork(fork);\n\t\t}),\n\t);\n\treturn () => {\n\t\tfor (const off of offs) {\n\t\t\toff();\n\t\t}\n\t};\n}\n"]}
1
+ {"version":3,"file":"branch.js","sourceRoot":"","sources":["../../src/shared-tree-core/branch.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;AAEH,+DAA6D;AAE7D,kEAA6D;AAK7D,uEAA+F;AAE/F,+CAc0B;AAC1B,+CAAqE;AA6ErE;;GAEG;AACH,MAAa,gBAAgB;IAM5B;;;;;;;OAOG;IACH,YACS,IAA0B,EAClB,YAA4C,EAC3C,eAAkC,EAClC,aAAgD,EAChD,qBAEhB;QANO,SAAI,GAAJ,IAAI,CAAsB;QAClB,iBAAY,GAAZ,YAAY,CAAgC;QAC3C,oBAAe,GAAf,eAAe,CAAmB;QAClC,kBAAa,GAAb,aAAa,CAAmC;QAChD,0BAAqB,GAArB,qBAAqB,CAErC;QApBO,mCAAU,IAAA,4BAAa,GAA4C,EAAC;QAC7D,WAAM,GAAyD,+BAAA,IAAI,gCAAQ,CAAC;QAEpF,aAAQ,GAAG,KAAK,CAAC;QAmBxB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,YAAY,CAAC,WAAW,CAAC,eAAe,EAAE,CAAC,MAAM,EAAE,EAAE,CACvE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAClB,CAAC;QACF,IAAI,CAAC,wBAAwB,GAAG,aAAa,EAAE,EAAE,CAAC,iBAAiB,EAAE,CAAC,MAAM,EAAE,EAAE;YAC/E,+BAAA,IAAI,gCAAQ,CAAC,IAAI,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC;QAC9C,CAAC,CAAC,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACI,OAAO,CAAC,IAA0B;QACxC,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACzB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IAClB,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,MAA6B,EAAE,OAAmB,qBAAU,CAAC,OAAO;QAChF,IAAI,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License.\n */\n\nimport { createEmitter } from \"@fluid-internal/client-utils\";\nimport type { Listenable } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type {\n\tOpSpaceCompressedId,\n\tSessionSpaceCompressedId,\n} from \"@fluidframework/id-compressor\";\nimport { type TelemetryEventBatcher, measure } from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\ttype BranchRebaseResult,\n\ttype ChangeFamily,\n\ttype ChangeFamilyEditor,\n\tCommitKind,\n\ttype GraphCommit,\n\ttype RevisionTag,\n\ttype TaggedChange,\n\tfindAncestor,\n\tmakeAnonChange,\n\tmintCommit,\n\trebaseBranch,\n\ttagRollbackInverse,\n\ttype RebaseStatsWithDuration,\n} from \"../core/index.js\";\nimport { hasSome, defineLazyCachedProperty } from \"../util/index.js\";\n\nexport type BranchId = SessionSpaceCompressedId | \"main\";\nexport type EncodedBranchId = OpSpaceCompressedId;\n\n/**\n * Describes a change to a `SharedTreeBranch`. Each of the following event types provides a `change` which contains the net change to the branch (or is undefined if there was no net change):\n * * Append - when one or more commits are appended to the head of the branch, for example via\n * a change applied by the branch's editor, or as a result of merging another branch into this one\n * * Remove - when one or more commits are removed from the head of the branch.\n * * Rebase - when a rebase operation adds commits from another branch and replaces existing commits with their rebased versions.\n */\nexport type SharedTreeBranchChange<TChange> =\n\t| {\n\t\t\ttype: \"append\";\n\t\t\tkind: CommitKind;\n\t\t\tchange: TaggedChange<TChange>;\n\t\t\t/** The commits appended to the head of the branch by this operation */\n\t\t\tnewCommits: readonly [GraphCommit<TChange>, ...GraphCommit<TChange>[]];\n\t }\n\t| {\n\t\t\ttype: \"remove\";\n\t\t\tchange: TaggedChange<TChange>;\n\t\t\t/** The commits removed from the head of the branch by this operation */\n\t\t\tremovedCommits: readonly [GraphCommit<TChange>, ...GraphCommit<TChange>[]];\n\t }\n\t| {\n\t\t\ttype: \"rebase\";\n\t\t\tchange: TaggedChange<TChange> | undefined;\n\t };\n\n/**\n * The events emitted by a `SharedTreeBranch`\n */\nexport interface SharedTreeBranchEvents<TEditor extends ChangeFamilyEditor, TChange>\n\textends BranchTrimmingEvents {\n\t/**\n\t * Fired just before the head of this branch changes.\n\t * @param change - the change to this branch's state and commits\n\t */\n\tbeforeChange(change: SharedTreeBranchChange<TChange>): void;\n\n\t/**\n\t * Fired just after the head of this branch changes.\n\t * @param change - the change to this branch's state and commits\n\t */\n\tafterChange(change: SharedTreeBranchChange<TChange>): void;\n\n\t/**\n\t * Fired when this branch forks\n\t * @param fork - the new branch that forked off of this branch\n\t */\n\tfork(fork: SharedTreeBranch<TEditor, TChange>): void;\n\n\t/**\n\t * Fired after this branch is disposed\n\t */\n\tdispose(): void;\n}\n\n/**\n * Events related to branch trimming.\n *\n * @remarks\n * Trimming is a very specific kind of mutation which is the only allowed mutations to branches.\n * References to commits from other commits are removed so that the commit objects can be GC'd by the JS engine.\n * This happens by changing a commit's parent property to undefined, which drops all commits that are in its \"ancestry\".\n * It is done as a performance optimization when it is determined that commits are no longer needed for future computation.\n */\nexport interface BranchTrimmingEvents {\n\t/**\n\t * Fired when some contiguous range of commits beginning with the \"global tail\" of this branch are trimmed from the branch.\n\t * This happens by deleting the parent pointer to the last commit in that range. This event can be fired at any time.\n\t */\n\tancestryTrimmed(trimmedRevisions: RevisionTag[]): void;\n}\n\n/**\n * A branch of changes that can be applied to a SharedTree.\n */\nexport class SharedTreeBranch<TEditor extends ChangeFamilyEditor, TChange> {\n\treadonly #events = createEmitter<SharedTreeBranchEvents<TEditor, TChange>>();\n\tpublic readonly events: Listenable<SharedTreeBranchEvents<TEditor, TChange>> = this.#events;\n\tpublic readonly editor: TEditor;\n\tprivate disposed = false;\n\tprivate readonly unsubscribeBranchTrimmer?: () => void;\n\t/**\n\t * Construct a new branch.\n\t * @param head - the head of the branch\n\t * @param changeFamily - determines the set of changes that this branch can commit\n\t * @param mintRevisionTag - used to generate a `RevisionTag` for each change.\n\t * @param branchTrimmer - an optional event emitter that informs the branch it has been trimmed. If this is not supplied, then the branch must\n\t * never be trimmed. See {@link BranchTrimmingEvents} for details on trimming.\n\t */\n\tpublic constructor(\n\t\tprivate head: GraphCommit<TChange>,\n\t\tpublic readonly changeFamily: ChangeFamily<TEditor, TChange>,\n\t\tprivate readonly mintRevisionTag: () => RevisionTag,\n\t\tprivate readonly branchTrimmer?: Listenable<BranchTrimmingEvents>,\n\t\tprivate readonly telemetryEventBatcher?: TelemetryEventBatcher<\n\t\t\tkeyof RebaseStatsWithDuration\n\t\t>,\n\t) {\n\t\tthis.editor = this.changeFamily.buildEditor(mintRevisionTag, (change) =>\n\t\t\tthis.apply(change),\n\t\t);\n\t\tthis.unsubscribeBranchTrimmer = branchTrimmer?.on(\"ancestryTrimmed\", (commit) => {\n\t\t\tthis.#events.emit(\"ancestryTrimmed\", commit);\n\t\t});\n\t}\n\n\t/**\n\t * Sets the head of this branch.\n\t * @remarks This is a \"manual override\" of sorts, for when the branch needs to be set to a certain state without going through the usual flow of edits.\n\t * This might be necessary as a performance optimization, or to prevent parts of the system updating incorrectly (this method emits no change events!).\n\t */\n\tpublic setHead(head: GraphCommit<TChange>): void {\n\t\tthis.assertNotDisposed();\n\t\tthis.head = head;\n\t}\n\n\t/**\n\t * Apply a change to this branch.\n\t * @param change - the change to apply\n\t * @param kind - the kind of change to apply\n\t * @returns the change that was applied and the new head commit of the branch\n\t */\n\tpublic apply(change: TaggedChange<TChange>, kind: CommitKind = CommitKind.Default): void {\n\t\tthis.assertNotDisposed();\n\n\t\tconst revisionTag = change.revision;\n\t\tassert(revisionTag !== undefined, 0xa49 /* Revision tag must be provided */);\n\n\t\tconst newHead = mintCommit(this.head, {\n\t\t\trevision: revisionTag,\n\t\t\tchange: change.change,\n\t\t});\n\n\t\tconst changeEvent = {\n\t\t\ttype: \"append\",\n\t\t\tkind,\n\t\t\tchange,\n\t\t\tnewCommits: [newHead],\n\t\t} as const;\n\n\t\tthis.#events.emit(\"beforeChange\", changeEvent);\n\t\tthis.head = newHead;\n\t\tthis.#events.emit(\"afterChange\", changeEvent);\n\t}\n\n\t/**\n\t * Gets the commit at the head of this branch.\n\t */\n\tpublic getHead(): GraphCommit<TChange> {\n\t\treturn this.head;\n\t}\n\n\t/**\n\t * Spawn a new branch that is based off of the current state of this branch.\n\t * @param commit - The commit to base the new branch off of. Defaults to the head of this branch.\n\t * @param mintRevisionTag - used to generate a `RevisionTag` for each change.\n\t * @remarks Changes made to the new branch will not be applied to this branch until the new branch is {@link SharedTreeBranch.merge | merged} back in.\n\t * Forks created during a transaction will be disposed when the transaction ends.\n\t */\n\tpublic fork(\n\t\tcommit: GraphCommit<TChange> = this.head,\n\t\tmintRevisionTag: () => RevisionTag = this.mintRevisionTag,\n\t): SharedTreeBranch<TEditor, TChange> {\n\t\tthis.assertNotDisposed();\n\t\tconst fork = new SharedTreeBranch(\n\t\t\tcommit,\n\t\t\tthis.changeFamily,\n\t\t\tmintRevisionTag,\n\t\t\tthis.branchTrimmer,\n\t\t);\n\t\tthis.#events.emit(\"fork\", fork);\n\t\treturn fork;\n\t}\n\n\t/**\n\t * Rebase the changes that have been applied to this branch over divergent changes in the given branch.\n\t * After this operation completes, this branch will be based off of `branch`.\n\t *\n\t * @param branch - the branch to rebase onto\n\t * @param upTo - the furthest commit on `branch` over which to rebase (inclusive). Defaults to the head commit of `branch`.\n\t * @returns the result of the rebase or undefined if nothing changed\n\t */\n\tpublic rebaseOnto(\n\t\tbranch: SharedTreeBranch<TEditor, TChange>,\n\t\tupTo = branch.getHead(),\n\t): void {\n\t\tthis.assertNotDisposed();\n\n\t\t// Rebase this branch onto the given branch\n\t\tconst rebaseResult = this.rebaseBranch(this, branch, upTo);\n\t\tif (rebaseResult === undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\t// The net change to this branch is provided by the `rebaseBranch` API\n\t\tconst { newSourceHead, commits } = rebaseResult;\n\t\tconst { deletedSourceCommits, targetCommits, sourceCommits } = commits;\n\t\tassert(hasSome(targetCommits), 0xa83 /* Expected commit(s) for a non no-op rebase */);\n\n\t\tconst newCommits = [...targetCommits, ...sourceCommits];\n\t\tconst changeEvent = {\n\t\t\ttype: \"rebase\",\n\t\t\tget change() {\n\t\t\t\tconst change = rebaseResult.sourceChange;\n\t\t\t\treturn change === undefined ? undefined : makeAnonChange(change);\n\t\t\t},\n\t\t\tremovedCommits: deletedSourceCommits,\n\t\t\tnewCommits,\n\t\t} as const;\n\n\t\tthis.#events.emit(\"beforeChange\", changeEvent);\n\t\tthis.head = newSourceHead;\n\t\tthis.#events.emit(\"afterChange\", changeEvent);\n\t}\n\n\t/**\n\t * Remove a range of commits from this branch.\n\t * @param commit - All commits after (but not including) this commit will be removed.\n\t * @returns The net change to this branch and the commits that were removed from this branch.\n\t */\n\tpublic removeAfter(commit: GraphCommit<TChange>): void {\n\t\tif (commit === this.head) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst removedCommits: GraphCommit<TChange>[] = [];\n\t\tconst inverses: TaggedChange<TChange>[] = [];\n\t\tfindAncestor([this.head, removedCommits], (c) => {\n\t\t\t// TODO: Pull this side effect out if/when more diverse ancestry walking helpers are available\n\t\t\tif (c !== commit) {\n\t\t\t\tconst revision = this.mintRevisionTag();\n\t\t\t\tconst inverse = this.changeFamily.rebaser.invert(c, true, revision);\n\t\t\t\tinverses.push(tagRollbackInverse(inverse, revision, c.revision));\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\treturn true;\n\t\t});\n\t\tassert(hasSome(removedCommits), 0xa84 /* Commit must be in the branch's ancestry */);\n\n\t\tconst change = makeAnonChange(this.changeFamily.rebaser.compose(inverses));\n\t\tconst changeEvent = {\n\t\t\ttype: \"remove\",\n\t\t\tchange,\n\t\t\tremovedCommits,\n\t\t} as const;\n\n\t\tthis.#events.emit(\"beforeChange\", changeEvent);\n\t\tthis.head = commit;\n\t\tthis.#events.emit(\"afterChange\", changeEvent);\n\t}\n\n\t/**\n\t * Apply all the divergent changes on the given branch to this branch.\n\t *\n\t * @param branch - the branch to merge into this branch\n\t * @returns the commits that were added to this branch by the merge, or undefined if nothing changed\n\t */\n\tpublic merge(\n\t\tbranch: SharedTreeBranch<TEditor, TChange>,\n\t): { sourceCommits: GraphCommit<TChange>[] } | undefined {\n\t\tthis.assertNotDisposed();\n\t\tbranch.assertNotDisposed();\n\n\t\tif (branch === this) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// Rebase the given branch onto this branch\n\t\tconst rebaseResult = this.rebaseBranch(branch, this);\n\t\tif (rebaseResult === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// Compute the net change to this branch\n\t\tconst sourceCommits = rebaseResult.commits.sourceCommits;\n\t\tassert(hasSome(sourceCommits), 0xa86 /* Expected source commits in non no-op merge */);\n\t\tconst { rebaser } = this.changeFamily;\n\t\tconst changeEvent = defineLazyCachedProperty(\n\t\t\t{\n\t\t\t\ttype: \"append\",\n\t\t\t\tkind: CommitKind.Default,\n\t\t\t\tnewCommits: sourceCommits,\n\t\t\t} as const,\n\t\t\t\"change\",\n\t\t\t() => makeAnonChange(rebaser.compose(sourceCommits)),\n\t\t);\n\n\t\tthis.#events.emit(\"beforeChange\", changeEvent);\n\t\tthis.head = rebaseResult.newSourceHead;\n\t\tthis.#events.emit(\"afterChange\", changeEvent);\n\t\treturn { sourceCommits };\n\t}\n\n\t/** Rebase `branchHead` onto `onto`, but return undefined if nothing changed */\n\tprivate rebaseBranch(\n\t\tbranch: SharedTreeBranch<TEditor, TChange>,\n\t\tonto: SharedTreeBranch<TEditor, TChange>,\n\t\tupTo = onto.getHead(),\n\t): BranchRebaseResult<TChange> | undefined {\n\t\tconst { head } = branch;\n\t\tif (head === upTo) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst { duration, output } = measure(() =>\n\t\t\trebaseBranch(\n\t\t\t\tthis.mintRevisionTag,\n\t\t\t\tthis.changeFamily.rebaser,\n\t\t\t\thead,\n\t\t\t\tupTo,\n\t\t\t\tonto.getHead(),\n\t\t\t),\n\t\t);\n\n\t\tthis.telemetryEventBatcher?.accumulateAndLog({ duration, ...output.telemetryProperties });\n\n\t\tif (this.head === output.newSourceHead) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn output;\n\t}\n\n\t/**\n\t * Dispose this branch, freezing its state.\n\t *\n\t * @remarks\n\t * Attempts to further mutate the branch will error.\n\t * Any transactions in progress will be aborted.\n\t * Calling dispose more than once has no effect.\n\t */\n\tpublic dispose(): void {\n\t\tif (this.disposed) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.unsubscribeBranchTrimmer?.();\n\n\t\tthis.disposed = true;\n\t\tthis.#events.emit(\"dispose\");\n\t}\n\n\tprivate assertNotDisposed(): void {\n\t\tassert(!this.disposed, 0x66e /* Branch is disposed */);\n\t}\n}\n\n/**\n * Registers an event listener that fires when the given branch forks.\n * The listener will also fire when any of those forks fork, and when those forks of forks fork, and so on.\n * @param branch - the branch that will be listened to for forks\n * @param onFork - the fork event listener\n * @returns a function which when called will deregister all registrations (including transitive) created by this function.\n * The deregister function has undefined behavior if called more than once.\n */\n// Branches are invariant over TChange\nexport function onForkTransitive<T extends { events: Listenable<{ fork(t: T): void }> }>(\n\tbranch: T,\n\tonFork: (fork: T) => void,\n): () => void {\n\tconst offs: (() => void)[] = [];\n\toffs.push(\n\t\tbranch.events.on(\"fork\", (fork: T) => {\n\t\t\toffs.push(onForkTransitive(fork, onFork));\n\t\t\tonFork(fork);\n\t\t}),\n\t);\n\treturn () => {\n\t\tfor (const off of offs) {\n\t\t\toff();\n\t\t}\n\t};\n}\n"]}
@@ -6,6 +6,7 @@ import type { IIdCompressor } from "@fluidframework/id-compressor";
6
6
  import type { MinimumVersionForCollab } from "@fluidframework/runtime-definitions/internal";
7
7
  import { VersionDispatchingCodecBuilder, type CodecTree, type DependentFormatVersion, type ICodecFamily, type ICodecOptions, type IJsonCodec } from "../codec/index.js";
8
8
  import type { ChangeEncodingContext, EncodedRevisionTag, RevisionTag, SchemaAndPolicy } from "../core/index.js";
9
+ import type { IdentifierHealingConfig } from "../util/index.js";
9
10
  import type { SummaryData } from "./editManager.js";
10
11
  import { EditManagerFormatVersion } from "./editManagerFormatCommons.js";
11
12
  /**
@@ -15,8 +16,8 @@ export interface EditManagerEncodingContext {
15
16
  idCompressor: IIdCompressor;
16
17
  readonly schema?: SchemaAndPolicy;
17
18
  readonly isSummary: boolean;
18
- readonly healUnresolvableIdentifiersOnDecode?: boolean;
19
- readonly sharedObjectId?: string;
19
+ /** See {@link IdentifierHealingConfig}. */
20
+ readonly healing?: IdentifierHealingConfig;
20
21
  }
21
22
  /**
22
23
  * Codec name used to identify the {@link EditManager} codec, see {@link makeEditManagerCodecBuilder}.
@@ -1 +1 @@
1
- {"version":3,"file":"editManagerCodecs.d.ts","sourceRoot":"","sources":["../../src/shared-tree-core/editManagerCodecs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AAG5F,OAAO,EACN,8BAA8B,EAC9B,KAAK,SAAS,EAEd,KAAK,sBAAsB,EAE3B,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,UAAU,EAEf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EACX,qBAAqB,EACrB,kBAAkB,EAClB,WAAW,EACX,eAAe,EACf,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAGpD,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAEzE;;GAEG;AACH,MAAM,WAAW,0BAA0B;IAC1C,YAAY,EAAE,aAAa,CAAC;IAC5B,QAAQ,CAAC,MAAM,CAAC,EAAE,eAAe,CAAC;IAClC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,mCAAmC,CAAC,EAAE,OAAO,CAAC;IACvD,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;CACjC;AAED;;GAEG;AACH,eAAO,MAAM,oBAAoB,gBAAgB,CAAC;AAElD;;GAEG;AACH,UAAU,uBAAuB,CAAC,UAAU,CAAE,SAAQ,aAAa;IAClE,sCAAsC;IACtC,YAAY,EAAE,YAAY,CAAC,UAAU,EAAE,qBAAqB,CAAC,CAAC;IAC9D,0FAA0F;IAC1F,4BAA4B,EAAE,sBAAsB,CAAC,wBAAwB,CAAC,CAAC;IAC/E,0DAA0D;IAC1D,gBAAgB,EAAE,UAAU,CAC3B,WAAW,EACX,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,CACrB,CAAC;CACF;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CAAC,UAAU,KAAK,8BAA8B,CACxF,uBAAuB,CAAC,UAAU,CAAC,EACnC,WAAW,CAAC,UAAU,CAAC,EACvB,0BAA0B,EAC1B,wBAAwB,EACxB,OAAO,oBAAoB,CAC3B,CAgEA;AAED;;;GAGG;AACH,wBAAgB,0CAA0C,CACzD,aAAa,EAAE,uBAAuB,EACtC,YAAY,EAAE,SAAS,GACrB,SAAS,CAMX"}
1
+ {"version":3,"file":"editManagerCodecs.d.ts","sourceRoot":"","sources":["../../src/shared-tree-core/editManagerCodecs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AAG5F,OAAO,EACN,8BAA8B,EAC9B,KAAK,SAAS,EAEd,KAAK,sBAAsB,EAE3B,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,UAAU,EAEf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EACX,qBAAqB,EACrB,kBAAkB,EAClB,WAAW,EACX,eAAe,EACf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAEhE,OAA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gBAAgB,EACxB,sDAAwB,CAAC,EAAE,CAC3B;SACF;QACD;YACC,mBAAmB,EAAE,SAAS;YAC9B,aAAa,EAAE,sDAAwB,CAAC,eAAe;YACvD,KAAK,EAAE,CAAC,OAA4C,EAAE,EAAE,CACvD,IAAA,wEAAkC,EACjC,OAAO,CAAC,YAAY,CAAC,OAAO,CAC3B,OAAO,CAAC,4BAA4B,CAAC,MAAM,CAC1C,sDAAwB,CAAC,eAAe,CACxC,CACD,EACD,OAAO,CAAC,gBAAgB,EACxB,sDAAwB,CAAC,eAAe,CACxC;SACF;KACD,CAAC;IAEF,OAAO,yCAA8B,CAAC,KAAK,CAAC,4BAAoB,EAAE,QAAQ,CAAC,CAAC;AAC7E,CAAC;AAtED,kEAsEC;AAED;;;GAGG;AACH,SAAgB,0CAA0C,CACzD,aAAsC,EACtC,YAAuB;IAEvB,MAAM,OAAO,GAAG,2BAA2B,EAAE,CAAC;IAC9C,OAAO;QACN,GAAG,OAAO,CAAC,YAAY,CAAC,aAAa,CAAC;QACtC,QAAQ,EAAE,CAAC,YAAY,CAAC;KACxB,CAAC;AACH,CAAC;AATD,gGASC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IIdCompressor } from \"@fluidframework/id-compressor\";\nimport type { MinimumVersionForCollab } from \"@fluidframework/runtime-definitions/internal\";\nimport { lowestMinVersionForCollab } from \"@fluidframework/runtime-utils/internal\";\n\nimport {\n\tVersionDispatchingCodecBuilder,\n\ttype CodecTree,\n\ttype CodecVersion,\n\ttype DependentFormatVersion,\n\tFluidClientVersion,\n\ttype ICodecFamily,\n\ttype ICodecOptions,\n\ttype IJsonCodec,\n\tmakeDiscontinuedCodecAndSchema,\n} from \"../codec/index.js\";\nimport type {\n\tChangeEncodingContext,\n\tEncodedRevisionTag,\n\tRevisionTag,\n\tSchemaAndPolicy,\n} from \"../core/index.js\";\n\nimport type { SummaryData } from \"./editManager.js\";\nimport { makeV1toV4andV6CodecWithVersion } from \"./editManagerCodecsV1toV4.js\";\nimport { makeSharedBranchesCodecWithVersion } from \"./editManagerCodecsVSharedBranches.js\";\nimport { EditManagerFormatVersion } from \"./editManagerFormatCommons.js\";\n\n/**\n * Context required for encoding/decoding the {@link EditManager}'s {@link SummaryData}.\n */\nexport interface EditManagerEncodingContext {\n\tidCompressor: IIdCompressor;\n\treadonly schema?: SchemaAndPolicy;\n\treadonly isSummary: boolean;\n\treadonly healUnresolvableIdentifiersOnDecode?: boolean;\n\treadonly sharedObjectId?: string;\n}\n\n/**\n * Codec name used to identify the {@link EditManager} codec, see {@link makeEditManagerCodecBuilder}.\n */\nexport const editManagerCodecName = \"EditManager\";\n\n/**\n * Options for constructing an {@link EditManager} codec, see {@link makeEditManagerCodecBuilder}.\n */\ninterface EditManagerCodecOptions<TChangeset> extends ICodecOptions {\n\t/** Codecs for encoding changesets. */\n\tchangeCodecs: ICodecFamily<TChangeset, ChangeEncodingContext>;\n\t/** Maps each EditManager format version to the corresponding changeset format version. */\n\tdependentChangeFormatVersion: DependentFormatVersion<EditManagerFormatVersion>;\n\t/** Codec for encoding revision tags within changesets. */\n\trevisionTagCodec: IJsonCodec<\n\t\tRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tChangeEncodingContext\n\t>;\n}\n\n/**\n * Creates a {@link VersionDispatchingCodecBuilder} encoding for {@link SummaryData}.\n */\nexport function makeEditManagerCodecBuilder<TChangeset>(): VersionDispatchingCodecBuilder<\n\tEditManagerCodecOptions<TChangeset>,\n\tSummaryData<TChangeset>,\n\tEditManagerEncodingContext,\n\tEditManagerFormatVersion,\n\ttypeof editManagerCodecName\n> {\n\t// See EditManagerFormatVersion and its members for documentation on what changed in each version.\n\tconst versions: CodecVersion<\n\t\tSummaryData<TChangeset>,\n\t\tEditManagerEncodingContext,\n\t\tEditManagerFormatVersion,\n\t\tEditManagerCodecOptions<TChangeset>\n\t>[] = [\n\t\tmakeDiscontinuedCodecAndSchema(EditManagerFormatVersion.v1, \"2.73.0\"),\n\t\tmakeDiscontinuedCodecAndSchema(EditManagerFormatVersion.v2, \"2.73.0\"),\n\t\t{\n\t\t\tminVersionForCollab: lowestMinVersionForCollab,\n\t\t\tformatVersion: EditManagerFormatVersion.v3,\n\t\t\tcodec: (options: EditManagerCodecOptions<TChangeset>) =>\n\t\t\t\tmakeV1toV4andV6CodecWithVersion(\n\t\t\t\t\toptions.changeCodecs.resolve(\n\t\t\t\t\t\toptions.dependentChangeFormatVersion.lookup(EditManagerFormatVersion.v3),\n\t\t\t\t\t),\n\t\t\t\t\toptions.revisionTagCodec,\n\t\t\t\t\tEditManagerFormatVersion.v3,\n\t\t\t\t),\n\t\t},\n\t\t{\n\t\t\tminVersionForCollab: FluidClientVersion.v2_43,\n\t\t\tformatVersion: EditManagerFormatVersion.v4,\n\t\t\tcodec: (options: EditManagerCodecOptions<TChangeset>) =>\n\t\t\t\tmakeV1toV4andV6CodecWithVersion(\n\t\t\t\t\toptions.changeCodecs.resolve(\n\t\t\t\t\t\toptions.dependentChangeFormatVersion.lookup(EditManagerFormatVersion.v4),\n\t\t\t\t\t),\n\t\t\t\t\toptions.revisionTagCodec,\n\t\t\t\t\tEditManagerFormatVersion.v4,\n\t\t\t\t),\n\t\t},\n\t\tmakeDiscontinuedCodecAndSchema(EditManagerFormatVersion.v5, \"2.74.0\"),\n\t\t{\n\t\t\tminVersionForCollab: FluidClientVersion.v2_80,\n\t\t\tformatVersion: EditManagerFormatVersion.v6,\n\t\t\tcodec: (options: EditManagerCodecOptions<TChangeset>) =>\n\t\t\t\tmakeV1toV4andV6CodecWithVersion(\n\t\t\t\t\toptions.changeCodecs.resolve(\n\t\t\t\t\t\toptions.dependentChangeFormatVersion.lookup(EditManagerFormatVersion.v6),\n\t\t\t\t\t),\n\t\t\t\t\toptions.revisionTagCodec,\n\t\t\t\t\tEditManagerFormatVersion.v6,\n\t\t\t\t),\n\t\t},\n\t\t{\n\t\t\tminVersionForCollab: undefined,\n\t\t\tformatVersion: EditManagerFormatVersion.vSharedBranches,\n\t\t\tcodec: (options: EditManagerCodecOptions<TChangeset>) =>\n\t\t\t\tmakeSharedBranchesCodecWithVersion(\n\t\t\t\t\toptions.changeCodecs.resolve(\n\t\t\t\t\t\toptions.dependentChangeFormatVersion.lookup(\n\t\t\t\t\t\t\tEditManagerFormatVersion.vSharedBranches,\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\t\toptions.revisionTagCodec,\n\t\t\t\t\tEditManagerFormatVersion.vSharedBranches,\n\t\t\t\t),\n\t\t},\n\t];\n\n\treturn VersionDispatchingCodecBuilder.build(editManagerCodecName, versions);\n}\n\n/**\n * Returns a {@link CodecTree} for the EditManager format at the given client version,\n * with the provided change codec tree as a child.\n */\nexport function getCodecTreeForEditManagerFormatWithChange(\n\tclientVersion: MinimumVersionForCollab,\n\tchangeFormat: CodecTree,\n): CodecTree {\n\tconst builder = makeEditManagerCodecBuilder();\n\treturn {\n\t\t...builder.getCodecTree(clientVersion),\n\t\tchildren: [changeFormat],\n\t};\n}\n"]}
1
+ {"version":3,"file":"editManagerCodecs.js","sourceRoot":"","sources":["../../src/shared-tree-core/editManagerCodecs.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,qEAAmF;AAEnF,gDAU2B;AAU3B,6EAA+E;AAC/E,+FAA2F;AAC3F,+EAAyE;AAazE;;GAEG;AACU,QAAA,oBAAoB,GAAG,aAAa,CAAC;AAmBlD;;GAEG;AACH,SAAgB,2BAA2B;IAO1C,kGAAkG;IAClG,MAAM,QAAQ,GAKR;QACL,IAAA,yCAA8B,EAAC,sDAAwB,CAAC,EAAE,EAAE,QAAQ,CAAC;QACrE,IAAA,yCAA8B,EAAC,sDAAwB,CAAC,EAAE,EAAE,QAAQ,CAAC;QACrE;YACC,mBAAmB,EAAE,oCAAyB;YAC9C,aAAa,EAAE,sDAAwB,CAAC,EAAE;YAC1C,KAAK,EAAE,CAAC,OAA4C,EAAE,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C;SACF;KACD,CAAC;IAEF,OAAO,yCAA8B,CAAC,KAAK,CAAC,4BAAoB,EAAE,QAAQ,CAAC,CAAC;AAC7E,CAAC;AAtED,kEAsEC;AAED;;;GAGG;AACH,SAAgB,0CAA0C,CACzD,aAAsC,EACtC,YAAuB;IAEvB,MAAM,OAAO,GAAG,2BAA2B,EAAE,CAAC;IAC9C,OAAO;QACN,GAAG,OAAO,CAAC,YAAY,CAAC,aAAa,CAAC;QACtC,QAAQ,EAAE,CAAC,YAAY,CAAC;KACxB,CAAC;AACH,CAAC;AATD,gGASC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IIdCompressor } from \"@fluidframework/id-compressor\";\nimport type { MinimumVersionForCollab } from \"@fluidframework/runtime-definitions/internal\";\nimport { lowestMinVersionForCollab } from \"@fluidframework/runtime-utils/internal\";\n\nimport {\n\tVersionDispatchingCodecBuilder,\n\ttype CodecTree,\n\ttype CodecVersion,\n\ttype DependentFormatVersion,\n\tFluidClientVersion,\n\ttype ICodecFamily,\n\ttype ICodecOptions,\n\ttype IJsonCodec,\n\tmakeDiscontinuedCodecAndSchema,\n} from \"../codec/index.js\";\nimport type {\n\tChangeEncodingContext,\n\tEncodedRevisionTag,\n\tRevisionTag,\n\tSchemaAndPolicy,\n} from \"../core/index.js\";\nimport type { IdentifierHealingConfig } from \"../util/index.js\";\n\nimport type { SummaryData } from \"./editManager.js\";\nimport { makeV1toV4andV6CodecWithVersion } from \"./editManagerCodecsV1toV4.js\";\nimport { makeSharedBranchesCodecWithVersion } from \"./editManagerCodecsVSharedBranches.js\";\nimport { EditManagerFormatVersion } from \"./editManagerFormatCommons.js\";\n\n/**\n * Context required for encoding/decoding the {@link EditManager}'s {@link SummaryData}.\n */\nexport interface EditManagerEncodingContext {\n\tidCompressor: IIdCompressor;\n\treadonly schema?: SchemaAndPolicy;\n\treadonly isSummary: boolean;\n\t/** See {@link IdentifierHealingConfig}. */\n\treadonly healing?: IdentifierHealingConfig;\n}\n\n/**\n * Codec name used to identify the {@link EditManager} codec, see {@link makeEditManagerCodecBuilder}.\n */\nexport const editManagerCodecName = \"EditManager\";\n\n/**\n * Options for constructing an {@link EditManager} codec, see {@link makeEditManagerCodecBuilder}.\n */\ninterface EditManagerCodecOptions<TChangeset> extends ICodecOptions {\n\t/** Codecs for encoding changesets. */\n\tchangeCodecs: ICodecFamily<TChangeset, ChangeEncodingContext>;\n\t/** Maps each EditManager format version to the corresponding changeset format version. */\n\tdependentChangeFormatVersion: DependentFormatVersion<EditManagerFormatVersion>;\n\t/** Codec for encoding revision tags within changesets. */\n\trevisionTagCodec: IJsonCodec<\n\t\tRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tChangeEncodingContext\n\t>;\n}\n\n/**\n * Creates a {@link VersionDispatchingCodecBuilder} encoding for {@link SummaryData}.\n */\nexport function makeEditManagerCodecBuilder<TChangeset>(): VersionDispatchingCodecBuilder<\n\tEditManagerCodecOptions<TChangeset>,\n\tSummaryData<TChangeset>,\n\tEditManagerEncodingContext,\n\tEditManagerFormatVersion,\n\ttypeof editManagerCodecName\n> {\n\t// See EditManagerFormatVersion and its members for documentation on what changed in each version.\n\tconst versions: CodecVersion<\n\t\tSummaryData<TChangeset>,\n\t\tEditManagerEncodingContext,\n\t\tEditManagerFormatVersion,\n\t\tEditManagerCodecOptions<TChangeset>\n\t>[] = [\n\t\tmakeDiscontinuedCodecAndSchema(EditManagerFormatVersion.v1, \"2.73.0\"),\n\t\tmakeDiscontinuedCodecAndSchema(EditManagerFormatVersion.v2, \"2.73.0\"),\n\t\t{\n\t\t\tminVersionForCollab: lowestMinVersionForCollab,\n\t\t\tformatVersion: EditManagerFormatVersion.v3,\n\t\t\tcodec: (options: EditManagerCodecOptions<TChangeset>) =>\n\t\t\t\tmakeV1toV4andV6CodecWithVersion(\n\t\t\t\t\toptions.changeCodecs.resolve(\n\t\t\t\t\t\toptions.dependentChangeFormatVersion.lookup(EditManagerFormatVersion.v3),\n\t\t\t\t\t),\n\t\t\t\t\toptions.revisionTagCodec,\n\t\t\t\t\tEditManagerFormatVersion.v3,\n\t\t\t\t),\n\t\t},\n\t\t{\n\t\t\tminVersionForCollab: FluidClientVersion.v2_43,\n\t\t\tformatVersion: EditManagerFormatVersion.v4,\n\t\t\tcodec: (options: EditManagerCodecOptions<TChangeset>) =>\n\t\t\t\tmakeV1toV4andV6CodecWithVersion(\n\t\t\t\t\toptions.changeCodecs.resolve(\n\t\t\t\t\t\toptions.dependentChangeFormatVersion.lookup(EditManagerFormatVersion.v4),\n\t\t\t\t\t),\n\t\t\t\t\toptions.revisionTagCodec,\n\t\t\t\t\tEditManagerFormatVersion.v4,\n\t\t\t\t),\n\t\t},\n\t\tmakeDiscontinuedCodecAndSchema(EditManagerFormatVersion.v5, \"2.74.0\"),\n\t\t{\n\t\t\tminVersionForCollab: FluidClientVersion.v2_80,\n\t\t\tformatVersion: EditManagerFormatVersion.v6,\n\t\t\tcodec: (options: EditManagerCodecOptions<TChangeset>) =>\n\t\t\t\tmakeV1toV4andV6CodecWithVersion(\n\t\t\t\t\toptions.changeCodecs.resolve(\n\t\t\t\t\t\toptions.dependentChangeFormatVersion.lookup(EditManagerFormatVersion.v6),\n\t\t\t\t\t),\n\t\t\t\t\toptions.revisionTagCodec,\n\t\t\t\t\tEditManagerFormatVersion.v6,\n\t\t\t\t),\n\t\t},\n\t\t{\n\t\t\tminVersionForCollab: undefined,\n\t\t\tformatVersion: EditManagerFormatVersion.vSharedBranches,\n\t\t\tcodec: (options: EditManagerCodecOptions<TChangeset>) =>\n\t\t\t\tmakeSharedBranchesCodecWithVersion(\n\t\t\t\t\toptions.changeCodecs.resolve(\n\t\t\t\t\t\toptions.dependentChangeFormatVersion.lookup(\n\t\t\t\t\t\t\tEditManagerFormatVersion.vSharedBranches,\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\t\toptions.revisionTagCodec,\n\t\t\t\t\tEditManagerFormatVersion.vSharedBranches,\n\t\t\t\t),\n\t\t},\n\t];\n\n\treturn VersionDispatchingCodecBuilder.build(editManagerCodecName, versions);\n}\n\n/**\n * Returns a {@link CodecTree} for the EditManager format at the given client version,\n * with the provided change codec tree as a child.\n */\nexport function getCodecTreeForEditManagerFormatWithChange(\n\tclientVersion: MinimumVersionForCollab,\n\tchangeFormat: CodecTree,\n): CodecTree {\n\tconst builder = makeEditManagerCodecBuilder();\n\treturn {\n\t\t...builder.getCodecTree(clientVersion),\n\t\tchildren: [changeFormat],\n\t};\n}\n"]}
@@ -5,7 +5,7 @@
5
5
  import type { IIdCompressor, SessionId } from "@fluidframework/id-compressor";
6
6
  import type { IJsonCodec } from "../codec/index.js";
7
7
  import type { ChangeEncodingContext, EncodedRevisionTag, RevisionTag, SchemaAndPolicy } from "../core/index.js";
8
- import { type JsonCompatibleReadOnly } from "../util/index.js";
8
+ import { type IdentifierHealingConfig, type JsonCompatibleReadOnly } from "../util/index.js";
9
9
  import type { SharedBranchSummaryData } from "./editManager.js";
10
10
  import type { EncodedSharedBranch } from "./editManagerFormatCommons.js";
11
11
  export interface EditManagerEncodingContext {
@@ -17,14 +17,8 @@ export interface EditManagerEncodingContext {
17
17
  * but it is carried explicitly so downstream codecs can read it.
18
18
  */
19
19
  readonly isSummary: boolean;
20
- /**
21
- * See {@link ChangeEncodingContext.healUnresolvableIdentifiersOnDecode}.
22
- */
23
- readonly healUnresolvableIdentifiersOnDecode?: boolean;
24
- /**
25
- * See {@link ChangeEncodingContext.sharedObjectId}.
26
- */
27
- readonly sharedObjectId?: string;
20
+ /** See {@link IdentifierHealingConfig}. */
21
+ readonly healing?: IdentifierHealingConfig;
28
22
  }
29
23
  export declare function encodeSharedBranch<TChangeset>(changeCodec: IJsonCodec<TChangeset, JsonCompatibleReadOnly, JsonCompatibleReadOnly, ChangeEncodingContext>, revisionTagCodec: IJsonCodec<RevisionTag, EncodedRevisionTag, EncodedRevisionTag, ChangeEncodingContext>, data: SharedBranchSummaryData<TChangeset>, context: EditManagerEncodingContext, originatorId: SessionId | undefined): EncodedSharedBranch<TChangeset>;
30
24
  export declare function decodeSharedBranch<TChangeset>(changeCodec: IJsonCodec<TChangeset, JsonCompatibleReadOnly, JsonCompatibleReadOnly, ChangeEncodingContext>, revisionTagCodec: IJsonCodec<RevisionTag, EncodedRevisionTag, EncodedRevisionTag, ChangeEncodingContext>, json: EncodedSharedBranch<TChangeset>, context: EditManagerEncodingContext, originatorId: SessionId | undefined): SharedBranchSummaryData<TChangeset>;
@@ -1 +1 @@
1
- {"version":3,"file":"editManagerCodecsCommons.d.ts","sourceRoot":"","sources":["../../src/shared-tree-core/editManagerCodecsCommons.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAE9E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EACX,qBAAqB,EACrB,kBAAkB,EAClB,WAAW,EACX,eAAe,EACf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAe,KAAK,sBAAsB,EAAgB,MAAM,kBAAkB,CAAC;AAG1F,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,KAAK,EAGX,mBAAmB,EAGnB,MAAM,+BAA+B,CAAC;AAEvC,MAAM,WAAW,0BAA0B;IAC1C,YAAY,EAAE,aAAa,CAAC;IAC5B,QAAQ,CAAC,MAAM,CAAC,EAAE,eAAe,CAAC;IAClC;;;;OAIG;IACH,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B;;OAEG;IACH,QAAQ,CAAC,mCAAmC,CAAC,EAAE,OAAO,CAAC;IACvD;;OAEG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;CACjC;AA8DD,wBAAgB,kBAAkB,CAAC,UAAU,EAC5C,WAAW,EAAE,UAAU,CACtB,UAAU,EACV,sBAAsB,EACtB,sBAAsB,EACtB,qBAAqB,CACrB,EACD,gBAAgB,EAAE,UAAU,CAC3B,WAAW,EACX,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,CACrB,EACD,IAAI,EAAE,uBAAuB,CAAC,UAAU,CAAC,EACzC,OAAO,EAAE,0BAA0B,EACnC,YAAY,EAAE,SAAS,GAAG,SAAS,GACjC,mBAAmB,CAAC,UAAU,CAAC,CAyDjC;AAED,wBAAgB,kBAAkB,CAAC,UAAU,EAC5C,WAAW,EAAE,UAAU,CACtB,UAAU,EACV,sBAAsB,EACtB,sBAAsB,EACtB,qBAAqB,CACrB,EACD,gBAAgB,EAAE,UAAU,CAC3B,WAAW,EACX,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,CACrB,EACD,IAAI,EAAE,mBAAmB,CAAC,UAAU,CAAC,EACrC,OAAO,EAAE,0BAA0B,EACnC,YAAY,EAAE,SAAS,GAAG,SAAS,GACjC,uBAAuB,CAAC,UAAU,CAAC,CA4ErC"}
1
+ {"version":3,"file":"editManagerCodecsCommons.d.ts","sourceRoot":"","sources":["../../src/shared-tree-core/editManagerCodecsCommons.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAE9E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EACX,qBAAqB,EACrB,kBAAkB,EAClB,WAAW,EACX,eAAe,EACf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAEN,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAE3B,MAAM,kBAAkB,CAAC;AAG1B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,KAAK,EAGX,mBAAmB,EAGnB,MAAM,+BAA+B,CAAC;AAEvC,MAAM,WAAW,0BAA0B;IAC1C,YAAY,EAAE,aAAa,CAAC;IAC5B,QAAQ,CAAC,MAAM,CAAC,EAAE,eAAe,CAAC;IAClC;;;;OAIG;IACH,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,2CAA2C;IAC3C,QAAQ,CAAC,OAAO,CAAC,EAAE,uBAAuB,CAAC;CAC3C;AA8DD,wBAAgB,kBAAkB,CAAC,UAAU,EAC5C,WAAW,EAAE,UAAU,CACtB,UAAU,EACV,sBAAsB,EACtB,sBAAsB,EACtB,qBAAqB,CACrB,EACD,gBAAgB,EAAE,UAAU,CAC3B,WAAW,EACX,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,CACrB,EACD,IAAI,EAAE,uBAAuB,CAAC,UAAU,CAAC,EACzC,OAAO,EAAE,0BAA0B,EACnC,YAAY,EAAE,SAAS,GAAG,SAAS,GACjC,mBAAmB,CAAC,UAAU,CAAC,CAyDjC;AAED,wBAAgB,kBAAkB,CAAC,UAAU,EAC5C,WAAW,EAAE,UAAU,CACtB,UAAU,EACV,sBAAsB,EACtB,sBAAsB,EACtB,qBAAqB,CACrB,EACD,gBAAgB,EAAE,UAAU,CAC3B,WAAW,EACX,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,CACrB,EACD,IAAI,EAAE,mBAAmB,CAAC,UAAU,CAAC,EACrC,OAAO,EAAE,0BAA0B,EACnC,YAAY,EAAE,SAAS,GAAG,SAAS,GACjC,uBAAuB,CAAC,UAAU,CAAC,CAyErC"}
@@ -98,8 +98,7 @@ function decodeSharedBranch(changeCodec, revisionTagCodec, json, context, origin
98
98
  idCompressor: context.idCompressor,
99
99
  revision: undefined,
100
100
  isSummary: context.isSummary,
101
- healUnresolvableIdentifiersOnDecode: context.healUnresolvableIdentifiersOnDecode,
102
- sharedObjectId: context.sharedObjectId,
101
+ healing: context.healing,
103
102
  })),
104
103
  peerLocalBranches: new Map((0, index_js_1.mapIterable)(json.peers, ([sessionId, branch]) => [
105
104
  sessionId,
@@ -117,8 +116,7 @@ function decodeSharedBranch(changeCodec, revisionTagCodec, json, context, origin
117
116
  idCompressor: context.idCompressor,
118
117
  revision: undefined,
119
118
  isSummary: context.isSummary,
120
- healUnresolvableIdentifiersOnDecode: context.healUnresolvableIdentifiersOnDecode,
121
- sharedObjectId: context.sharedObjectId,
119
+ healing: context.healing,
122
120
  })),
123
121
  },
124
122
  ])),
@@ -1 +1 @@
1
- {"version":3,"file":"editManagerCodecsCommons.js","sourceRoot":"","sources":["../../src/shared-tree-core/editManagerCodecsCommons.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAU7D,+CAA0F;AAE1F,yDAAoE;AA6BpE,4EAA4E;AAC5E,SAAS,YAAY,CACpB,WAKC,EACD,gBAKC,EACD,MAAS,EACT,OAA8B;IAE9B,OAAO;QACN,GAAG,MAAM;QACT,QAAQ,EAAE,gBAAgB,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE;YAClD,YAAY,EAAE,MAAM,CAAC,SAAS;YAC9B,YAAY,EAAE,OAAO,CAAC,YAAY;YAClC,QAAQ,EAAE,SAAS;YACnB,SAAS,EAAE,OAAO,CAAC,SAAS;SAC5B,CAAC;QACF,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,GAAG,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC;KACpF,CAAC;AACH,CAAC;AAED,4EAA4E;AAC5E,SAAS,YAAY,CACpB,WAKC,EACD,gBAKC,EACD,MAAS,EACT,OAA8B;IAE9B,MAAM,QAAQ,GAAG,gBAAgB,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE;QACzD,YAAY,EAAE,MAAM,CAAC,SAAS;QAC9B,YAAY,EAAE,OAAO,CAAC,YAAY;QAClC,QAAQ,EAAE,SAAS;QACnB,SAAS,EAAE,OAAO,CAAC,SAAS;KAC5B,CAAC,CAAC;IAEH,OAAO;QACN,GAAG,MAAM;QACT,QAAQ;QACR,MA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KAAK,SAAS,EAAE,CAAC;QAC7B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;IACvB,CAAC;IACD,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QAC/B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;IAC3B,CAAC;IACD,IAAI,IAAI,CAAC,EAAE,KAAK,SAAS,EAAE,CAAC;QAC3B,IAAA,iBAAM,EACL,YAAY,KAAK,SAAS,EAC1B,KAAK,CAAC,kDAAkD,CACxD,CAAC;QACF,IAAI,CAAC,EAAE,GAAG,IAAA,iCAAc,EAAC,OAAO,CAAC,YAAY,EAAE,IAAI,CAAC,EAAE,EAAE,EAAE,YAAY,EAAE,CAAC,CAAC;IAC3E,CAAC;IACD,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAC7B,IAAA,iBAAM,EACL,YAAY,KAAK,SAAS,EAC1B,KAAK,CAAC,oDAAoD,CAC1D,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE;YAC9C,YAAY;YACZ,YAAY,EAAE,OAAO,CAAC,YAAY;YAClC,QAAQ,EAAE,SAAS;YACnB,SAAS,EAAE,OAAO,CAAC,SAAS;SAC5B,CAAC,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,CAAC;AACb,CAAC;AA5FD,gDA4FC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { IIdCompressor, SessionId } from \"@fluidframework/id-compressor\";\n\nimport type { IJsonCodec } from \"../codec/index.js\";\nimport type {\n\tChangeEncodingContext,\n\tEncodedRevisionTag,\n\tRevisionTag,\n\tSchemaAndPolicy,\n} from \"../core/index.js\";\nimport { mapIterable, type JsonCompatibleReadOnly, type Mutable } from \"../util/index.js\";\n\nimport { decodeBranchId, encodeBranchId } from \"./branchIdCodec.js\";\nimport type { SharedBranchSummaryData } from \"./editManager.js\";\nimport type {\n\tCommit,\n\tEncodedCommit,\n\tEncodedSharedBranch,\n\tSequenceId,\n\tSequencedCommit,\n} from \"./editManagerFormatCommons.js\";\n\nexport interface EditManagerEncodingContext {\n\tidCompressor: IIdCompressor;\n\treadonly schema?: SchemaAndPolicy;\n\t/**\n\t * See {@link ChangeEncodingContext.isSummary}. EditManager codec callers\n\t * always set this to `true` (the codec is only invoked for summaries),\n\t * but it is carried explicitly so downstream codecs can read it.\n\t */\n\treadonly isSummary: boolean;\n\t/**\n\t * See {@link ChangeEncodingContext.healUnresolvableIdentifiersOnDecode}.\n\t */\n\treadonly healUnresolvableIdentifiersOnDecode?: boolean;\n\t/**\n\t * See {@link ChangeEncodingContext.sharedObjectId}.\n\t */\n\treadonly sharedObjectId?: string;\n}\n\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nfunction encodeCommit<TChangeset, T extends Commit<TChangeset>>(\n\tchangeCodec: IJsonCodec<\n\t\tTChangeset,\n\t\tJsonCompatibleReadOnly,\n\t\tJsonCompatibleReadOnly,\n\t\tChangeEncodingContext\n\t>,\n\trevisionTagCodec: IJsonCodec<\n\t\tRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tChangeEncodingContext\n\t>,\n\tcommit: T,\n\tcontext: ChangeEncodingContext,\n) {\n\treturn {\n\t\t...commit,\n\t\trevision: revisionTagCodec.encode(commit.revision, {\n\t\t\toriginatorId: commit.sessionId,\n\t\t\tidCompressor: context.idCompressor,\n\t\t\trevision: undefined,\n\t\t\tisSummary: context.isSummary,\n\t\t}),\n\t\tchange: changeCodec.encode(commit.change, { ...context, revision: commit.revision }),\n\t};\n}\n\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nfunction decodeCommit<TChangeset, T extends EncodedCommit<JsonCompatibleReadOnly>>(\n\tchangeCodec: IJsonCodec<\n\t\tTChangeset,\n\t\tJsonCompatibleReadOnly,\n\t\tJsonCompatibleReadOnly,\n\t\tChangeEncodingContext\n\t>,\n\trevisionTagCodec: IJsonCodec<\n\t\tRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tChangeEncodingContext\n\t>,\n\tcommit: T,\n\tcontext: ChangeEncodingContext,\n) {\n\tconst revision = revisionTagCodec.decode(commit.revision, {\n\t\toriginatorId: commit.sessionId,\n\t\tidCompressor: context.idCompressor,\n\t\trevision: undefined,\n\t\tisSummary: context.isSummary,\n\t});\n\n\treturn {\n\t\t...commit,\n\t\trevision,\n\t\tchange: changeCodec.decode(commit.change, { ...context, revision }),\n\t};\n}\n\nexport function encodeSharedBranch<TChangeset>(\n\tchangeCodec: IJsonCodec<\n\t\tTChangeset,\n\t\tJsonCompatibleReadOnly,\n\t\tJsonCompatibleReadOnly,\n\t\tChangeEncodingContext\n\t>,\n\trevisionTagCodec: IJsonCodec<\n\t\tRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tChangeEncodingContext\n\t>,\n\tdata: SharedBranchSummaryData<TChangeset>,\n\tcontext: EditManagerEncodingContext,\n\toriginatorId: SessionId | undefined,\n): EncodedSharedBranch<TChangeset> {\n\tconst json: Mutable<EncodedSharedBranch<TChangeset>> = {\n\t\ttrunk: data.trunk.map((commit) =>\n\t\t\tencodeCommit(changeCodec, revisionTagCodec, commit, {\n\t\t\t\toriginatorId: commit.sessionId,\n\t\t\t\tidCompressor: context.idCompressor,\n\t\t\t\tschema: context.schema,\n\t\t\t\trevision: undefined,\n\t\t\t\tisSummary: context.isSummary,\n\t\t\t}),\n\t\t),\n\t\tpeers: Array.from(data.peerLocalBranches.entries(), ([sessionId, branch]) => [\n\t\t\tsessionId,\n\t\t\t{\n\t\t\t\tbase: revisionTagCodec.encode(branch.base, {\n\t\t\t\t\toriginatorId: sessionId,\n\t\t\t\t\tidCompressor: context.idCompressor,\n\t\t\t\t\trevision: undefined,\n\t\t\t\t\tisSummary: context.isSummary,\n\t\t\t\t}),\n\t\t\t\tcommits: branch.commits.map((commit) =>\n\t\t\t\t\tencodeCommit(changeCodec, revisionTagCodec, commit, {\n\t\t\t\t\t\toriginatorId: commit.sessionId,\n\t\t\t\t\t\tidCompressor: context.idCompressor,\n\t\t\t\t\t\tschema: context.schema,\n\t\t\t\t\t\trevision: undefined,\n\t\t\t\t\t\tisSummary: context.isSummary,\n\t\t\t\t\t}),\n\t\t\t\t),\n\t\t\t},\n\t\t]),\n\t};\n\tif (data.session !== undefined) {\n\t\tjson.session = data.session;\n\t}\n\tif (data.id !== undefined) {\n\t\tjson.id = encodeBranchId(context.idCompressor, data.id);\n\t}\n\tif (data.name !== undefined) {\n\t\tjson.name = data.name;\n\t}\n\tif (data.author !== undefined) {\n\t\tjson.author = data.author;\n\t}\n\tif (data.base !== undefined) {\n\t\tassert(\n\t\t\toriginatorId !== undefined,\n\t\t\t0xc62 /* Cannot encode branch base without originatorId */,\n\t\t);\n\t\tjson.base = revisionTagCodec.encode(data.base, {\n\t\t\toriginatorId,\n\t\t\tidCompressor: context.idCompressor,\n\t\t\trevision: undefined,\n\t\t\tisSummary: context.isSummary,\n\t\t});\n\t}\n\treturn json;\n}\n\nexport function decodeSharedBranch<TChangeset>(\n\tchangeCodec: IJsonCodec<\n\t\tTChangeset,\n\t\tJsonCompatibleReadOnly,\n\t\tJsonCompatibleReadOnly,\n\t\tChangeEncodingContext\n\t>,\n\trevisionTagCodec: IJsonCodec<\n\t\tRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tChangeEncodingContext\n\t>,\n\tjson: EncodedSharedBranch<TChangeset>,\n\tcontext: EditManagerEncodingContext,\n\toriginatorId: SessionId | undefined,\n): SharedBranchSummaryData<TChangeset> {\n\t// TODO: sort out EncodedCommit vs Commit, and make this type check without type assertion.\n\tconst trunk = json.trunk as readonly (EncodedCommit<JsonCompatibleReadOnly> & SequenceId)[];\n\tconst data: Mutable<SharedBranchSummaryData<TChangeset>> = {\n\t\ttrunk: trunk.map(\n\t\t\t(commit): SequencedCommit<TChangeset> =>\n\t\t\t\t// TODO: sort out EncodedCommit vs Commit, and make this type check without `as`.\n\t\t\t\tdecodeCommit(changeCodec, revisionTagCodec, commit, {\n\t\t\t\t\toriginatorId: commit.sessionId,\n\t\t\t\t\tidCompressor: context.idCompressor,\n\t\t\t\t\trevision: undefined,\n\t\t\t\t\tisSummary: context.isSummary,\n\t\t\t\t\thealUnresolvableIdentifiersOnDecode: context.healUnresolvableIdentifiersOnDecode,\n\t\t\t\t\tsharedObjectId: context.sharedObjectId,\n\t\t\t\t}),\n\t\t),\n\t\tpeerLocalBranches: new Map(\n\t\t\tmapIterable(json.peers, ([sessionId, branch]) => [\n\t\t\t\tsessionId,\n\t\t\t\t{\n\t\t\t\t\tbase: revisionTagCodec.decode(branch.base, {\n\t\t\t\t\t\toriginatorId: sessionId,\n\t\t\t\t\t\tidCompressor: context.idCompressor,\n\t\t\t\t\t\trevision: undefined,\n\t\t\t\t\t\tisSummary: context.isSummary,\n\t\t\t\t\t}),\n\t\t\t\t\tcommits: branch.commits.map((commit) =>\n\t\t\t\t\t\t// TODO: sort out EncodedCommit vs Commit, and make this type check without `as`.\n\t\t\t\t\t\tdecodeCommit(\n\t\t\t\t\t\t\tchangeCodec,\n\t\t\t\t\t\t\trevisionTagCodec,\n\t\t\t\t\t\t\tcommit as EncodedCommit<JsonCompatibleReadOnly>,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\toriginatorId: commit.sessionId,\n\t\t\t\t\t\t\t\tidCompressor: context.idCompressor,\n\t\t\t\t\t\t\t\trevision: undefined,\n\t\t\t\t\t\t\t\tisSummary: context.isSummary,\n\t\t\t\t\t\t\t\thealUnresolvableIdentifiersOnDecode:\n\t\t\t\t\t\t\t\t\tcontext.healUnresolvableIdentifiersOnDecode,\n\t\t\t\t\t\t\t\tsharedObjectId: context.sharedObjectId,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t]),\n\t\t),\n\t};\n\tif (json.session !== undefined) {\n\t\tdata.session = json.session;\n\t}\n\tif (json.name !== undefined) {\n\t\tdata.name = json.name;\n\t}\n\tif (json.author !== undefined) {\n\t\tdata.author = json.author;\n\t}\n\tif (json.id !== undefined) {\n\t\tassert(\n\t\t\toriginatorId !== undefined,\n\t\t\t0xc63 /* Cannot decode branch id without originatorId */,\n\t\t);\n\t\tdata.id = decodeBranchId(context.idCompressor, json.id, { originatorId });\n\t}\n\tif (json.base !== undefined) {\n\t\tassert(\n\t\t\toriginatorId !== undefined,\n\t\t\t0xc64 /* Cannot decode branch base without originatorId */,\n\t\t);\n\t\tdata.base = revisionTagCodec.decode(json.base, {\n\t\t\toriginatorId,\n\t\t\tidCompressor: context.idCompressor,\n\t\t\trevision: undefined,\n\t\t\tisSummary: context.isSummary,\n\t\t});\n\t}\n\treturn data;\n}\n"]}
1
+ {"version":3,"file":"editManagerCodecsCommons.js","sourceRoot":"","sources":["../../src/shared-tree-core/editManagerCodecsCommons.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAU7D,+CAK0B;AAE1B,yDAAoE;AAuBpE,4EAA4E;AAC5E,SAAS,YAAY,CACpB,WAKC,EACD,gBAKC,EACD,MAAS,EACT,OAA8B;IAE9B,OAAO;QACN,GAAG,MAAM;QACT,QAAQ,EAAE,gBAAgB,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE;YAClD,YAAY,EAAE,MAAM,CAAC,SAAS;YAC9B,YAAY,EAAE,OAAO,CAAC,YAAY;YAClC,QAAQ,EAAE,SAAS;YACnB,SAAS,EAAE,OAAO,CAAC,SAAS;SAC5B,CAAC;QACF,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,GAAG,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC;KACp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. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { IIdCompressor, SessionId } from \"@fluidframework/id-compressor\";\n\nimport type { IJsonCodec } from \"../codec/index.js\";\nimport type {\n\tChangeEncodingContext,\n\tEncodedRevisionTag,\n\tRevisionTag,\n\tSchemaAndPolicy,\n} from \"../core/index.js\";\nimport {\n\tmapIterable,\n\ttype IdentifierHealingConfig,\n\ttype JsonCompatibleReadOnly,\n\ttype Mutable,\n} from \"../util/index.js\";\n\nimport { decodeBranchId, encodeBranchId } from \"./branchIdCodec.js\";\nimport type { SharedBranchSummaryData } from \"./editManager.js\";\nimport type {\n\tCommit,\n\tEncodedCommit,\n\tEncodedSharedBranch,\n\tSequenceId,\n\tSequencedCommit,\n} from \"./editManagerFormatCommons.js\";\n\nexport interface EditManagerEncodingContext {\n\tidCompressor: IIdCompressor;\n\treadonly schema?: SchemaAndPolicy;\n\t/**\n\t * See {@link ChangeEncodingContext.isSummary}. EditManager codec callers\n\t * always set this to `true` (the codec is only invoked for summaries),\n\t * but it is carried explicitly so downstream codecs can read it.\n\t */\n\treadonly isSummary: boolean;\n\t/** See {@link IdentifierHealingConfig}. */\n\treadonly healing?: IdentifierHealingConfig;\n}\n\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nfunction encodeCommit<TChangeset, T extends Commit<TChangeset>>(\n\tchangeCodec: IJsonCodec<\n\t\tTChangeset,\n\t\tJsonCompatibleReadOnly,\n\t\tJsonCompatibleReadOnly,\n\t\tChangeEncodingContext\n\t>,\n\trevisionTagCodec: IJsonCodec<\n\t\tRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tChangeEncodingContext\n\t>,\n\tcommit: T,\n\tcontext: ChangeEncodingContext,\n) {\n\treturn {\n\t\t...commit,\n\t\trevision: revisionTagCodec.encode(commit.revision, {\n\t\t\toriginatorId: commit.sessionId,\n\t\t\tidCompressor: context.idCompressor,\n\t\t\trevision: undefined,\n\t\t\tisSummary: context.isSummary,\n\t\t}),\n\t\tchange: changeCodec.encode(commit.change, { ...context, revision: commit.revision }),\n\t};\n}\n\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nfunction decodeCommit<TChangeset, T extends EncodedCommit<JsonCompatibleReadOnly>>(\n\tchangeCodec: IJsonCodec<\n\t\tTChangeset,\n\t\tJsonCompatibleReadOnly,\n\t\tJsonCompatibleReadOnly,\n\t\tChangeEncodingContext\n\t>,\n\trevisionTagCodec: IJsonCodec<\n\t\tRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tChangeEncodingContext\n\t>,\n\tcommit: T,\n\tcontext: ChangeEncodingContext,\n) {\n\tconst revision = revisionTagCodec.decode(commit.revision, {\n\t\toriginatorId: commit.sessionId,\n\t\tidCompressor: context.idCompressor,\n\t\trevision: undefined,\n\t\tisSummary: context.isSummary,\n\t});\n\n\treturn {\n\t\t...commit,\n\t\trevision,\n\t\tchange: changeCodec.decode(commit.change, { ...context, revision }),\n\t};\n}\n\nexport function encodeSharedBranch<TChangeset>(\n\tchangeCodec: IJsonCodec<\n\t\tTChangeset,\n\t\tJsonCompatibleReadOnly,\n\t\tJsonCompatibleReadOnly,\n\t\tChangeEncodingContext\n\t>,\n\trevisionTagCodec: IJsonCodec<\n\t\tRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tChangeEncodingContext\n\t>,\n\tdata: SharedBranchSummaryData<TChangeset>,\n\tcontext: EditManagerEncodingContext,\n\toriginatorId: SessionId | undefined,\n): EncodedSharedBranch<TChangeset> {\n\tconst json: Mutable<EncodedSharedBranch<TChangeset>> = {\n\t\ttrunk: data.trunk.map((commit) =>\n\t\t\tencodeCommit(changeCodec, revisionTagCodec, commit, {\n\t\t\t\toriginatorId: commit.sessionId,\n\t\t\t\tidCompressor: context.idCompressor,\n\t\t\t\tschema: context.schema,\n\t\t\t\trevision: undefined,\n\t\t\t\tisSummary: context.isSummary,\n\t\t\t}),\n\t\t),\n\t\tpeers: Array.from(data.peerLocalBranches.entries(), ([sessionId, branch]) => [\n\t\t\tsessionId,\n\t\t\t{\n\t\t\t\tbase: revisionTagCodec.encode(branch.base, {\n\t\t\t\t\toriginatorId: sessionId,\n\t\t\t\t\tidCompressor: context.idCompressor,\n\t\t\t\t\trevision: undefined,\n\t\t\t\t\tisSummary: context.isSummary,\n\t\t\t\t}),\n\t\t\t\tcommits: branch.commits.map((commit) =>\n\t\t\t\t\tencodeCommit(changeCodec, revisionTagCodec, commit, {\n\t\t\t\t\t\toriginatorId: commit.sessionId,\n\t\t\t\t\t\tidCompressor: context.idCompressor,\n\t\t\t\t\t\tschema: context.schema,\n\t\t\t\t\t\trevision: undefined,\n\t\t\t\t\t\tisSummary: context.isSummary,\n\t\t\t\t\t}),\n\t\t\t\t),\n\t\t\t},\n\t\t]),\n\t};\n\tif (data.session !== undefined) {\n\t\tjson.session = data.session;\n\t}\n\tif (data.id !== undefined) {\n\t\tjson.id = encodeBranchId(context.idCompressor, data.id);\n\t}\n\tif (data.name !== undefined) {\n\t\tjson.name = data.name;\n\t}\n\tif (data.author !== undefined) {\n\t\tjson.author = data.author;\n\t}\n\tif (data.base !== undefined) {\n\t\tassert(\n\t\t\toriginatorId !== undefined,\n\t\t\t0xc62 /* Cannot encode branch base without originatorId */,\n\t\t);\n\t\tjson.base = revisionTagCodec.encode(data.base, {\n\t\t\toriginatorId,\n\t\t\tidCompressor: context.idCompressor,\n\t\t\trevision: undefined,\n\t\t\tisSummary: context.isSummary,\n\t\t});\n\t}\n\treturn json;\n}\n\nexport function decodeSharedBranch<TChangeset>(\n\tchangeCodec: IJsonCodec<\n\t\tTChangeset,\n\t\tJsonCompatibleReadOnly,\n\t\tJsonCompatibleReadOnly,\n\t\tChangeEncodingContext\n\t>,\n\trevisionTagCodec: IJsonCodec<\n\t\tRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tChangeEncodingContext\n\t>,\n\tjson: EncodedSharedBranch<TChangeset>,\n\tcontext: EditManagerEncodingContext,\n\toriginatorId: SessionId | undefined,\n): SharedBranchSummaryData<TChangeset> {\n\t// TODO: sort out EncodedCommit vs Commit, and make this type check without type assertion.\n\tconst trunk = json.trunk as readonly (EncodedCommit<JsonCompatibleReadOnly> & SequenceId)[];\n\tconst data: Mutable<SharedBranchSummaryData<TChangeset>> = {\n\t\ttrunk: trunk.map(\n\t\t\t(commit): SequencedCommit<TChangeset> =>\n\t\t\t\t// TODO: sort out EncodedCommit vs Commit, and make this type check without `as`.\n\t\t\t\tdecodeCommit(changeCodec, revisionTagCodec, commit, {\n\t\t\t\t\toriginatorId: commit.sessionId,\n\t\t\t\t\tidCompressor: context.idCompressor,\n\t\t\t\t\trevision: undefined,\n\t\t\t\t\tisSummary: context.isSummary,\n\t\t\t\t\thealing: context.healing,\n\t\t\t\t}),\n\t\t),\n\t\tpeerLocalBranches: new Map(\n\t\t\tmapIterable(json.peers, ([sessionId, branch]) => [\n\t\t\t\tsessionId,\n\t\t\t\t{\n\t\t\t\t\tbase: revisionTagCodec.decode(branch.base, {\n\t\t\t\t\t\toriginatorId: sessionId,\n\t\t\t\t\t\tidCompressor: context.idCompressor,\n\t\t\t\t\t\trevision: undefined,\n\t\t\t\t\t\tisSummary: context.isSummary,\n\t\t\t\t\t}),\n\t\t\t\t\tcommits: branch.commits.map((commit) =>\n\t\t\t\t\t\t// TODO: sort out EncodedCommit vs Commit, and make this type check without `as`.\n\t\t\t\t\t\tdecodeCommit(\n\t\t\t\t\t\t\tchangeCodec,\n\t\t\t\t\t\t\trevisionTagCodec,\n\t\t\t\t\t\t\tcommit as EncodedCommit<JsonCompatibleReadOnly>,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\toriginatorId: commit.sessionId,\n\t\t\t\t\t\t\t\tidCompressor: context.idCompressor,\n\t\t\t\t\t\t\t\trevision: undefined,\n\t\t\t\t\t\t\t\tisSummary: context.isSummary,\n\t\t\t\t\t\t\t\thealing: context.healing,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t]),\n\t\t),\n\t};\n\tif (json.session !== undefined) {\n\t\tdata.session = json.session;\n\t}\n\tif (json.name !== undefined) {\n\t\tdata.name = json.name;\n\t}\n\tif (json.author !== undefined) {\n\t\tdata.author = json.author;\n\t}\n\tif (json.id !== undefined) {\n\t\tassert(\n\t\t\toriginatorId !== undefined,\n\t\t\t0xc63 /* Cannot decode branch id without originatorId */,\n\t\t);\n\t\tdata.id = decodeBranchId(context.idCompressor, json.id, { originatorId });\n\t}\n\tif (json.base !== undefined) {\n\t\tassert(\n\t\t\toriginatorId !== undefined,\n\t\t\t0xc64 /* Cannot decode branch base without originatorId */,\n\t\t);\n\t\tdata.base = revisionTagCodec.decode(json.base, {\n\t\t\toriginatorId,\n\t\t\tidCompressor: context.idCompressor,\n\t\t\trevision: undefined,\n\t\t\tisSummary: context.isSummary,\n\t\t});\n\t}\n\treturn data;\n}\n"]}
@@ -5,15 +5,15 @@
5
5
  import type { IIdCompressor } from "@fluidframework/id-compressor";
6
6
  import type { CodecAndSchema, IJsonCodec } from "../codec/index.js";
7
7
  import type { ChangeEncodingContext, EncodedRevisionTag, RevisionTag, SchemaAndPolicy } from "../core/index.js";
8
- import { type JsonCompatibleReadOnly } from "../util/index.js";
8
+ import { type IdentifierHealingConfig, type JsonCompatibleReadOnly } from "../util/index.js";
9
9
  import type { SummaryData } from "./editManager.js";
10
10
  import { EncodedEditManager } from "./editManagerFormatV1toV4.js";
11
11
  export interface EditManagerEncodingContext {
12
12
  idCompressor: IIdCompressor;
13
13
  readonly schema?: SchemaAndPolicy;
14
14
  readonly isSummary: boolean;
15
- readonly healUnresolvableIdentifiersOnDecode?: boolean;
16
- readonly sharedObjectId?: string;
15
+ /** See {@link IdentifierHealingConfig}. */
16
+ readonly healing?: IdentifierHealingConfig;
17
17
  }
18
18
  /**
19
19
  * Create the provided version of the {@link EditManager} codec (which encodes it's {@link SummaryData}).
@@ -1 +1 @@
1
- {"version":3,"file":"editManagerCodecsV1toV4.d.ts","sourceRoot":"","sources":["../../src/shared-tree-core/editManagerCodecsV1toV4.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAEnE,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAa,MAAM,mBAAmB,CAAC;AAC/E,OAAO,KAAK,EACX,qBAAqB,EACrB,kBAAkB,EAClB,WAAW,EACX,eAAe,EACf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACN,KAAK,sBAAsB,EAG3B,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAElE,MAAM,WAAW,0BAA0B;IAC1C,YAAY,EAAE,aAAa,CAAC;IAC5B,QAAQ,CAAC,MAAM,CAAC,EAAE,eAAe,CAAC;IAClC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,mCAAmC,CAAC,EAAE,OAAO,CAAC;IACvD,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;CACjC;AAED;;;;;;;GAOG;AACH,wBAAgB,+BAA+B,CAAC,UAAU,EACzD,WAAW,EAAE,UAAU,CACtB,UAAU,EACV,sBAAsB,EACtB,sBAAsB,EACtB,qBAAqB,CACrB,EACD,gBAAgB,EAAE,UAAU,CAC3B,WAAW,EACX,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,CACrB,EACD,OAAO,EAAE,kBAAkB,CAAC,UAAU,CAAC,CAAC,SAAS,CAAC,GAChD,cAAc,CAAC,WAAW,CAAC,UAAU,CAAC,EAAE,0BAA0B,CAAC,CA4CrE"}
1
+ {"version":3,"file":"editManagerCodecsV1toV4.d.ts","sourceRoot":"","sources":["../../src/shared-tree-core/editManagerCodecsV1toV4.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAEnE,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAa,MAAM,mBAAmB,CAAC;AAC/E,OAAO,KAAK,EACX,qBAAqB,EACrB,kBAAkB,EAClB,WAAW,EACX,eAAe,EACf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACN,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAG3B,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAElE,MAAM,WAAW,0BAA0B;IAC1C,YAAY,EAAE,aAAa,CAAC;IAC5B,QAAQ,CAAC,MAAM,CAAC,EAAE,eAAe,CAAC;IAClC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,2CAA2C;IAC3C,QAAQ,CAAC,OAAO,CAAC,EAAE,uBAAuB,CAAC;CAC3C;AAED;;;;;;;GAOG;AACH,wBAAgB,+BAA+B,CAAC,UAAU,EACzD,WAAW,EAAE,UAAU,CACtB,UAAU,EACV,sBAAsB,EACtB,sBAAsB,EACtB,qBAAqB,CACrB,EACD,gBAAgB,EAAE,UAAU,CAC3B,WAAW,EACX,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,CACrB,EACD,OAAO,EAAE,kBAAkB,CAAC,UAAU,CAAC,CAAC,SAAS,CAAC,GAChD,cAAc,CAAC,WAAW,CAAC,UAAU,CAAC,EAAE,0BAA0B,CAAC,CA4CrE"}
@@ -1 +1 @@
1
- {"version":3,"file":"editManagerCodecsV1toV4.js","sourceRoot":"","sources":["../../src/shared-tree-core/editManagerCodecsV1toV4.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAWH,+CAI0B;AAG1B,+EAAuF;AACvF,6EAAkE;AAUlE;;;;;;;GAOG;AACH,SAAgB,+BAA+B,CAC9C,WAKC,EACD,gBAKC,EACD,OAAkD;IAElD,MAAM,MAAM,GAAG,IAAA,+CAAkB,EAAC,WAAW,CAAC,aAAa,IAAI,uCAA4B,CAAC,CAAC;IAE7F,MAAM,KAAK,GAAwE;QAClF,MAAM;QACN,MAAM,EAAE,CACP,IAA6B,EAC7B,OAAmC,EACyC,EAAE;YAC9E,MAAM,UAAU,GAAG,IAAA,gDAAkB,EACpC,WAAW,EACX,gBAAgB,EAChB,IAAI,CAAC,IAAI,EACT,OAAO,EACP,IAAI,CAAC,UAAU,CACf,CAAC;YACF,MAAM,OAAO,GAAmC;gBAC/C,KAAK,EAAE,UAAU,CAAC,KAAK;gBACvB,QAAQ,EAAE,UAAU,CAAC,KAAK;gBAC1B,OAAO;aACP,CAAC;YACF,OAAO,OAEsB,CAAC;QAC/B,CAAC;QACD,MAAM,EAAE,CACP,IAA6D,EAC7D,OAAmC,EACT,EAAE;YAC5B,OAAO;gBACN,IAAI,EAAE,IAAA,gDAAkB,EACvB,WAAW,EACX,gBAAgB,EAChB;oBACC,KAAK,EAAE,IAAI,CAAC,KAAK;oBACjB,KAAK,EAAE,IAAI,CAAC,QAAQ;iBACpB,EACD,OAAO,EACP,SAAS,CACT;aACD,CAAC;QACH,CAAC;KACD,CAAC;IACF,OAAO,KAAK,CAAC;AACd,CAAC;AA1DD,0EA0DC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IIdCompressor } from \"@fluidframework/id-compressor\";\n\nimport type { CodecAndSchema, IJsonCodec, Versioned } from \"../codec/index.js\";\nimport type {\n\tChangeEncodingContext,\n\tEncodedRevisionTag,\n\tRevisionTag,\n\tSchemaAndPolicy,\n} from \"../core/index.js\";\nimport {\n\ttype JsonCompatibleReadOnly,\n\ttype JsonCompatibleReadOnlyObject,\n\tJsonCompatibleReadOnlySchema,\n} from \"../util/index.js\";\n\nimport type { SummaryData } from \"./editManager.js\";\nimport { decodeSharedBranch, encodeSharedBranch } from \"./editManagerCodecsCommons.js\";\nimport { EncodedEditManager } from \"./editManagerFormatV1toV4.js\";\n\nexport interface EditManagerEncodingContext {\n\tidCompressor: IIdCompressor;\n\treadonly schema?: SchemaAndPolicy;\n\treadonly isSummary: boolean;\n\treadonly healUnresolvableIdentifiersOnDecode?: boolean;\n\treadonly sharedObjectId?: string;\n}\n\n/**\n * Create the provided version of the {@link EditManager} codec (which encodes it's {@link SummaryData}).\n * @remarks\n * The changeCodec and revisionTagCodec are not explicitly versioned, so the exact right version of them must be provided here\n * or data will be incompatible.\n *\n * TODO: this file should be renamed as this is used for v6 as well.\n */\nexport function makeV1toV4andV6CodecWithVersion<TChangeset>(\n\tchangeCodec: IJsonCodec<\n\t\tTChangeset,\n\t\tJsonCompatibleReadOnly,\n\t\tJsonCompatibleReadOnly,\n\t\tChangeEncodingContext\n\t>,\n\trevisionTagCodec: IJsonCodec<\n\t\tRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tChangeEncodingContext\n\t>,\n\tversion: EncodedEditManager<TChangeset>[\"version\"],\n): CodecAndSchema<SummaryData<TChangeset>, EditManagerEncodingContext> {\n\tconst schema = EncodedEditManager(changeCodec.encodedSchema ?? JsonCompatibleReadOnlySchema);\n\n\tconst codec: CodecAndSchema<SummaryData<TChangeset>, EditManagerEncodingContext> = {\n\t\tschema,\n\t\tencode: (\n\t\t\tdata: SummaryData<TChangeset>,\n\t\t\tcontext: EditManagerEncodingContext,\n\t\t): EncodedEditManager<TChangeset> & Versioned & JsonCompatibleReadOnlyObject => {\n\t\t\tconst mainBranch = encodeSharedBranch(\n\t\t\t\tchangeCodec,\n\t\t\t\trevisionTagCodec,\n\t\t\t\tdata.main,\n\t\t\t\tcontext,\n\t\t\t\tdata.originator,\n\t\t\t);\n\t\t\tconst encoded: EncodedEditManager<TChangeset> = {\n\t\t\t\ttrunk: mainBranch.trunk,\n\t\t\t\tbranches: mainBranch.peers,\n\t\t\t\tversion,\n\t\t\t};\n\t\t\treturn encoded as EncodedEditManager<TChangeset> &\n\t\t\t\tVersioned &\n\t\t\t\tJsonCompatibleReadOnlyObject;\n\t\t},\n\t\tdecode: (\n\t\t\tjson: EncodedEditManager<TChangeset> & JsonCompatibleReadOnly,\n\t\t\tcontext: EditManagerEncodingContext,\n\t\t): SummaryData<TChangeset> => {\n\t\t\treturn {\n\t\t\t\tmain: decodeSharedBranch(\n\t\t\t\t\tchangeCodec,\n\t\t\t\t\trevisionTagCodec,\n\t\t\t\t\t{\n\t\t\t\t\t\ttrunk: json.trunk,\n\t\t\t\t\t\tpeers: json.branches,\n\t\t\t\t\t},\n\t\t\t\t\tcontext,\n\t\t\t\t\tundefined, // Non \"vSharedBranches\" versions do not encode the summary originatorId.\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t};\n\treturn codec;\n}\n"]}
1
+ {"version":3,"file":"editManagerCodecsV1toV4.js","sourceRoot":"","sources":["../../src/shared-tree-core/editManagerCodecsV1toV4.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAWH,+CAK0B;AAG1B,+EAAuF;AACvF,6EAAkE;AAUlE;;;;;;;GAOG;AACH,SAAgB,+BAA+B,CAC9C,WAKC,EACD,gBAKC,EACD,OAAkD;IAElD,MAAM,MAAM,GAAG,IAAA,+CAAkB,EAAC,WAAW,CAAC,aAAa,IAAI,uCAA4B,CAAC,CAAC;IAE7F,MAAM,KAAK,GAAwE;QAClF,MAAM;QACN,MAAM,EAAE,CACP,IAA6B,EAC7B,OAAmC,EACyC,EAAE;YAC9E,MAAM,UAAU,GAAG,IAAA,gDAAkB,EACpC,WAAW,EACX,gBAAgB,EAChB,IAAI,CAAC,IAAI,EACT,OAAO,EACP,IAAI,CAAC,UAAU,CACf,CAAC;YACF,MAAM,OAAO,GAAmC;gBAC/C,KAAK,EAAE,UAAU,CAAC,KAAK;gBACvB,QAAQ,EAAE,UAAU,CAAC,KAAK;gBAC1B,OAAO;aACP,CAAC;YACF,OAAO,OAEsB,CAAC;QAC/B,CAAC;QACD,MAAM,EAAE,CACP,IAA6D,EAC7D,OAAmC,EACT,EAAE;YAC5B,OAAO;gBACN,IAAI,EAAE,IAAA,gDAAkB,EACvB,WAAW,EACX,gBAAgB,EAChB;oBACC,KAAK,EAAE,IAAI,CAAC,KAAK;oBACjB,KAAK,EAAE,IAAI,CAAC,QAAQ;iBACpB,EACD,OAAO,EACP,SAAS,CACT;aACD,CAAC;QACH,CAAC;KACD,CAAC;IACF,OAAO,KAAK,CAAC;AACd,CAAC;AA1DD,0EA0DC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IIdCompressor } from \"@fluidframework/id-compressor\";\n\nimport type { CodecAndSchema, IJsonCodec, Versioned } from \"../codec/index.js\";\nimport type {\n\tChangeEncodingContext,\n\tEncodedRevisionTag,\n\tRevisionTag,\n\tSchemaAndPolicy,\n} from \"../core/index.js\";\nimport {\n\ttype IdentifierHealingConfig,\n\ttype JsonCompatibleReadOnly,\n\ttype JsonCompatibleReadOnlyObject,\n\tJsonCompatibleReadOnlySchema,\n} from \"../util/index.js\";\n\nimport type { SummaryData } from \"./editManager.js\";\nimport { decodeSharedBranch, encodeSharedBranch } from \"./editManagerCodecsCommons.js\";\nimport { EncodedEditManager } from \"./editManagerFormatV1toV4.js\";\n\nexport interface EditManagerEncodingContext {\n\tidCompressor: IIdCompressor;\n\treadonly schema?: SchemaAndPolicy;\n\treadonly isSummary: boolean;\n\t/** See {@link IdentifierHealingConfig}. */\n\treadonly healing?: IdentifierHealingConfig;\n}\n\n/**\n * Create the provided version of the {@link EditManager} codec (which encodes it's {@link SummaryData}).\n * @remarks\n * The changeCodec and revisionTagCodec are not explicitly versioned, so the exact right version of them must be provided here\n * or data will be incompatible.\n *\n * TODO: this file should be renamed as this is used for v6 as well.\n */\nexport function makeV1toV4andV6CodecWithVersion<TChangeset>(\n\tchangeCodec: IJsonCodec<\n\t\tTChangeset,\n\t\tJsonCompatibleReadOnly,\n\t\tJsonCompatibleReadOnly,\n\t\tChangeEncodingContext\n\t>,\n\trevisionTagCodec: IJsonCodec<\n\t\tRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tChangeEncodingContext\n\t>,\n\tversion: EncodedEditManager<TChangeset>[\"version\"],\n): CodecAndSchema<SummaryData<TChangeset>, EditManagerEncodingContext> {\n\tconst schema = EncodedEditManager(changeCodec.encodedSchema ?? JsonCompatibleReadOnlySchema);\n\n\tconst codec: CodecAndSchema<SummaryData<TChangeset>, EditManagerEncodingContext> = {\n\t\tschema,\n\t\tencode: (\n\t\t\tdata: SummaryData<TChangeset>,\n\t\t\tcontext: EditManagerEncodingContext,\n\t\t): EncodedEditManager<TChangeset> & Versioned & JsonCompatibleReadOnlyObject => {\n\t\t\tconst mainBranch = encodeSharedBranch(\n\t\t\t\tchangeCodec,\n\t\t\t\trevisionTagCodec,\n\t\t\t\tdata.main,\n\t\t\t\tcontext,\n\t\t\t\tdata.originator,\n\t\t\t);\n\t\t\tconst encoded: EncodedEditManager<TChangeset> = {\n\t\t\t\ttrunk: mainBranch.trunk,\n\t\t\t\tbranches: mainBranch.peers,\n\t\t\t\tversion,\n\t\t\t};\n\t\t\treturn encoded as EncodedEditManager<TChangeset> &\n\t\t\t\tVersioned &\n\t\t\t\tJsonCompatibleReadOnlyObject;\n\t\t},\n\t\tdecode: (\n\t\t\tjson: EncodedEditManager<TChangeset> & JsonCompatibleReadOnly,\n\t\t\tcontext: EditManagerEncodingContext,\n\t\t): SummaryData<TChangeset> => {\n\t\t\treturn {\n\t\t\t\tmain: decodeSharedBranch(\n\t\t\t\t\tchangeCodec,\n\t\t\t\t\trevisionTagCodec,\n\t\t\t\t\t{\n\t\t\t\t\t\ttrunk: json.trunk,\n\t\t\t\t\t\tpeers: json.branches,\n\t\t\t\t\t},\n\t\t\t\t\tcontext,\n\t\t\t\t\tundefined, // Non \"vSharedBranches\" versions do not encode the summary originatorId.\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t};\n\treturn codec;\n}\n"]}
@@ -5,15 +5,15 @@
5
5
  import type { IIdCompressor } from "@fluidframework/id-compressor";
6
6
  import type { CodecAndSchema, IJsonCodec } from "../codec/index.js";
7
7
  import type { ChangeEncodingContext, EncodedRevisionTag, RevisionTag, SchemaAndPolicy } from "../core/index.js";
8
- import { type JsonCompatibleReadOnly } from "../util/index.js";
8
+ import { type IdentifierHealingConfig, type JsonCompatibleReadOnly } from "../util/index.js";
9
9
  import type { SummaryData } from "./editManager.js";
10
10
  import { EncodedEditManager } from "./editManagerFormatVSharedBranches.js";
11
11
  export interface EditManagerEncodingContext {
12
12
  idCompressor: IIdCompressor;
13
13
  readonly schema?: SchemaAndPolicy;
14
14
  readonly isSummary: boolean;
15
- readonly healUnresolvableIdentifiersOnDecode?: boolean;
16
- readonly sharedObjectId?: string;
15
+ /** See {@link IdentifierHealingConfig}. */
16
+ readonly healing?: IdentifierHealingConfig;
17
17
  }
18
18
  export declare function makeSharedBranchesCodecWithVersion<TChangeset>(changeCodec: IJsonCodec<TChangeset, JsonCompatibleReadOnly, JsonCompatibleReadOnly, ChangeEncodingContext>, revisionTagCodec: IJsonCodec<RevisionTag, EncodedRevisionTag, EncodedRevisionTag, ChangeEncodingContext>, version: EncodedEditManager<TChangeset>["version"]): CodecAndSchema<SummaryData<TChangeset>, EditManagerEncodingContext>;
19
19
  //# sourceMappingURL=editManagerCodecsVSharedBranches.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"editManagerCodecsVSharedBranches.d.ts","sourceRoot":"","sources":["../../src/shared-tree-core/editManagerCodecsVSharedBranches.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAEnE,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,KAAK,EACX,qBAAqB,EACrB,kBAAkB,EAClB,WAAW,EACX,eAAe,EACf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACN,KAAK,sBAAsB,EAI3B,MAAM,kBAAkB,CAAC;AAG1B,OAAO,KAAK,EAA2B,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAG7E,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAE3E,MAAM,WAAW,0BAA0B;IAC1C,YAAY,EAAE,aAAa,CAAC;IAC5B,QAAQ,CAAC,MAAM,CAAC,EAAE,eAAe,CAAC;IAClC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,mCAAmC,CAAC,EAAE,OAAO,CAAC;IACvD,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;CACjC;AAED,wBAAgB,kCAAkC,CAAC,UAAU,EAC5D,WAAW,EAAE,UAAU,CACtB,UAAU,EACV,sBAAsB,EACtB,sBAAsB,EACtB,qBAAqB,CACrB,EACD,gBAAgB,EAAE,UAAU,CAC3B,WAAW,EACX,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,CACrB,EACD,OAAO,EAAE,kBAAkB,CAAC,UAAU,CAAC,CAAC,SAAS,CAAC,GAChD,cAAc,CAAC,WAAW,CAAC,UAAU,CAAC,EAAE,0BAA0B,CAAC,CA8ErE"}
1
+ {"version":3,"file":"editManagerCodecsVSharedBranches.d.ts","sourceRoot":"","sources":["../../src/shared-tree-core/editManagerCodecsVSharedBranches.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAEnE,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,KAAK,EACX,qBAAqB,EACrB,kBAAkB,EAClB,WAAW,EACX,eAAe,EACf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACN,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAI3B,MAAM,kBAAkB,CAAC;AAG1B,OAAO,KAAK,EAA2B,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAG7E,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAE3E,MAAM,WAAW,0BAA0B;IAC1C,YAAY,EAAE,aAAa,CAAC;IAC5B,QAAQ,CAAC,MAAM,CAAC,EAAE,eAAe,CAAC;IAClC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,2CAA2C;IAC3C,QAAQ,CAAC,OAAO,CAAC,EAAE,uBAAuB,CAAC;CAC3C;AAED,wBAAgB,kCAAkC,CAAC,UAAU,EAC5D,WAAW,EAAE,UAAU,CACtB,UAAU,EACV,sBAAsB,EACtB,sBAAsB,EACtB,qBAAqB,CACrB,EACD,gBAAgB,EAAE,UAAU,CAC3B,WAAW,EACX,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,CACrB,EACD,OAAO,EAAE,kBAAkB,CAAC,UAAU,CAAC,CAAC,SAAS,CAAC,GAChD,cAAc,CAAC,WAAW,CAAC,UAAU,CAAC,EAAE,0BAA0B,CAAC,CA8ErE"}
@@ -1 +1 @@
1
- {"version":3,"file":"editManagerCodecsVSharedBranches.js","sourceRoot":"","sources":["../../src/shared-tree-core/editManagerCodecsVSharedBranches.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAU7D,+CAK0B;AAI1B,+EAAuF;AAEvF,+FAA2E;AAU3E,SAAgB,kCAAkC,CACjD,WAKC,EACD,gBAKC,EACD,OAAkD;IAElD,MAAM,MAAM,GAAG,IAAA,wDAAkB,EAAC,WAAW,CAAC,aAAa,IAAI,uCAA4B,CAAC,CAAC;IAE7F,MAAM,KAAK,GAAwE;QAClF,MAAM;QACN,MAAM,EAAE,CAAC,IAA6B,EAAE,OAAmC,EAAE,EAAE;YAC9E,MAAM,UAAU,GAAG,IAAA,gDAAkB,EACpC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AAM,aAAa,GAAG,IAAA,gDAAkB,EACvC,WAAW,EACX,gBAAgB,EAChB,MAAM,EACN,OAAO,EACP,IAAI,CAAC,UAAU,CACf,CAAC;oBACF,IAAA,iBAAM,EAAC,aAAa,CAAC,EAAE,KAAK,SAAS,EAAE,KAAK,CAAC,qCAAqC,CAAC,CAAC;oBACpF,IAAA,iBAAM,EAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,gCAAgC,CAAC,CAAC;oBAChF,QAAQ,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE,EAAE,aAAa,CAAC,CAAC;gBAC/C,CAAC;gBAED,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC;YAC7B,CAAC;YACD,OAAO,OAAO,CAAC;QAChB,CAAC;KACD,CAAC;IAEF,OAAO,KAAK,CAAC;AACd,CAAC;AA5FD,gFA4FC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { IIdCompressor } from \"@fluidframework/id-compressor\";\n\nimport type { CodecAndSchema, IJsonCodec } from \"../codec/index.js\";\nimport type {\n\tChangeEncodingContext,\n\tEncodedRevisionTag,\n\tRevisionTag,\n\tSchemaAndPolicy,\n} from \"../core/index.js\";\nimport {\n\ttype JsonCompatibleReadOnly,\n\ttype JsonCompatibleReadOnlyObject,\n\tJsonCompatibleReadOnlySchema,\n\ttype Mutable,\n} from \"../util/index.js\";\n\nimport type { BranchId } from \"./branch.js\";\nimport type { SharedBranchSummaryData, SummaryData } from \"./editManager.js\";\nimport { decodeSharedBranch, encodeSharedBranch } from \"./editManagerCodecsCommons.js\";\nimport type { EncodedSharedBranch } from \"./editManagerFormatCommons.js\";\nimport { EncodedEditManager } from \"./editManagerFormatVSharedBranches.js\";\n\nexport interface EditManagerEncodingContext {\n\tidCompressor: IIdCompressor;\n\treadonly schema?: SchemaAndPolicy;\n\treadonly isSummary: boolean;\n\treadonly healUnresolvableIdentifiersOnDecode?: boolean;\n\treadonly sharedObjectId?: string;\n}\n\nexport function makeSharedBranchesCodecWithVersion<TChangeset>(\n\tchangeCodec: IJsonCodec<\n\t\tTChangeset,\n\t\tJsonCompatibleReadOnly,\n\t\tJsonCompatibleReadOnly,\n\t\tChangeEncodingContext\n\t>,\n\trevisionTagCodec: IJsonCodec<\n\t\tRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tChangeEncodingContext\n\t>,\n\tversion: EncodedEditManager<TChangeset>[\"version\"],\n): CodecAndSchema<SummaryData<TChangeset>, EditManagerEncodingContext> {\n\tconst schema = EncodedEditManager(changeCodec.encodedSchema ?? JsonCompatibleReadOnlySchema);\n\n\tconst codec: CodecAndSchema<SummaryData<TChangeset>, EditManagerEncodingContext> = {\n\t\tschema,\n\t\tencode: (data: SummaryData<TChangeset>, context: EditManagerEncodingContext) => {\n\t\t\tconst mainBranch = encodeSharedBranch(\n\t\t\t\tchangeCodec,\n\t\t\t\trevisionTagCodec,\n\t\t\t\tdata.main,\n\t\t\t\tcontext,\n\t\t\t\tdata.originator,\n\t\t\t);\n\t\t\tassert(\n\t\t\t\tdata.originator !== undefined,\n\t\t\t\t0xca5 /* Cannot encode vSharedBranches summary without originator */,\n\t\t\t);\n\t\t\tconst json: Mutable<EncodedEditManager<TChangeset>> = {\n\t\t\t\tmain: mainBranch,\n\t\t\t\toriginator: data.originator,\n\t\t\t\tversion,\n\t\t\t};\n\t\t\tif (data.branches !== undefined && data.branches.size > 0) {\n\t\t\t\tconst branches: EncodedSharedBranch<TChangeset>[] = [];\n\t\t\t\tfor (const [_, branch] of data.branches) {\n\t\t\t\t\tbranches.push(\n\t\t\t\t\t\tencodeSharedBranch(\n\t\t\t\t\t\t\tchangeCodec,\n\t\t\t\t\t\t\trevisionTagCodec,\n\t\t\t\t\t\t\tbranch,\n\t\t\t\t\t\t\tcontext,\n\t\t\t\t\t\t\tdata.originator,\n\t\t\t\t\t\t),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tjson.branches = branches;\n\t\t\t}\n\t\t\treturn json as EncodedEditManager<TChangeset> & JsonCompatibleReadOnlyObject;\n\t\t},\n\t\tdecode: (\n\t\t\tjson: EncodedEditManager<TChangeset> & JsonCompatibleReadOnlyObject,\n\t\t\tcontext: EditManagerEncodingContext,\n\t\t): SummaryData<TChangeset> => {\n\t\t\tconst mainBranch = decodeSharedBranch(\n\t\t\t\tchangeCodec,\n\t\t\t\trevisionTagCodec,\n\t\t\t\tjson.main,\n\t\t\t\tcontext,\n\t\t\t\tjson.originator,\n\t\t\t);\n\n\t\t\tconst decoded: Mutable<SummaryData<TChangeset>> = {\n\t\t\t\tmain: mainBranch,\n\t\t\t\toriginator: json.originator,\n\t\t\t};\n\n\t\t\tif (json.branches !== undefined) {\n\t\t\t\tconst branches = new Map<BranchId, SharedBranchSummaryData<TChangeset>>();\n\t\t\t\tfor (const branch of json.branches) {\n\t\t\t\t\tconst decodedBranch = decodeSharedBranch(\n\t\t\t\t\t\tchangeCodec,\n\t\t\t\t\t\trevisionTagCodec,\n\t\t\t\t\t\tbranch,\n\t\t\t\t\t\tcontext,\n\t\t\t\t\t\tjson.originator,\n\t\t\t\t\t);\n\t\t\t\t\tassert(decodedBranch.id !== undefined, 0xc66 /* Shared branches must have an id */);\n\t\t\t\t\tassert(!branches.has(decodedBranch.id), 0xc67 /* Duplicate shared branch id */);\n\t\t\t\t\tbranches.set(decodedBranch.id, decodedBranch);\n\t\t\t\t}\n\n\t\t\t\tdecoded.branches = branches;\n\t\t\t}\n\t\t\treturn decoded;\n\t\t},\n\t};\n\n\treturn codec;\n}\n"]}
1
+ {"version":3,"file":"editManagerCodecsVSharedBranches.js","sourceRoot":"","sources":["../../src/shared-tree-core/editManagerCodecsVSharedBranches.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAU7D,+CAM0B;AAI1B,+EA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AI,CAAC,UAAU,CACf,CAAC;YAEF,MAAM,OAAO,GAAqC;gBACjD,IAAI,EAAE,UAAU;gBAChB,UAAU,EAAE,IAAI,CAAC,UAAU;aAC3B,CAAC;YAEF,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;gBACjC,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAiD,CAAC;gBAC1E,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;oBACpC,MAAM,aAAa,GAAG,IAAA,gDAAkB,EACvC,WAAW,EACX,gBAAgB,EAChB,MAAM,EACN,OAAO,EACP,IAAI,CAAC,UAAU,CACf,CAAC;oBACF,IAAA,iBAAM,EAAC,aAAa,CAAC,EAAE,KAAK,SAAS,EAAE,KAAK,CAAC,qCAAqC,CAAC,CAAC;oBACpF,IAAA,iBAAM,EAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,gCAAgC,CAAC,CAAC;oBAChF,QAAQ,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE,EAAE,aAAa,CAAC,CAAC;gBAC/C,CAAC;gBAED,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC;YAC7B,CAAC;YACD,OAAO,OAAO,CAAC;QAChB,CAAC;KACD,CAAC;IAEF,OAAO,KAAK,CAAC;AACd,CAAC;AA5FD,gFA4FC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { IIdCompressor } from \"@fluidframework/id-compressor\";\n\nimport type { CodecAndSchema, IJsonCodec } from \"../codec/index.js\";\nimport type {\n\tChangeEncodingContext,\n\tEncodedRevisionTag,\n\tRevisionTag,\n\tSchemaAndPolicy,\n} from \"../core/index.js\";\nimport {\n\ttype IdentifierHealingConfig,\n\ttype JsonCompatibleReadOnly,\n\ttype JsonCompatibleReadOnlyObject,\n\tJsonCompatibleReadOnlySchema,\n\ttype Mutable,\n} from \"../util/index.js\";\n\nimport type { BranchId } from \"./branch.js\";\nimport type { SharedBranchSummaryData, SummaryData } from \"./editManager.js\";\nimport { decodeSharedBranch, encodeSharedBranch } from \"./editManagerCodecsCommons.js\";\nimport type { EncodedSharedBranch } from \"./editManagerFormatCommons.js\";\nimport { EncodedEditManager } from \"./editManagerFormatVSharedBranches.js\";\n\nexport interface EditManagerEncodingContext {\n\tidCompressor: IIdCompressor;\n\treadonly schema?: SchemaAndPolicy;\n\treadonly isSummary: boolean;\n\t/** See {@link IdentifierHealingConfig}. */\n\treadonly healing?: IdentifierHealingConfig;\n}\n\nexport function makeSharedBranchesCodecWithVersion<TChangeset>(\n\tchangeCodec: IJsonCodec<\n\t\tTChangeset,\n\t\tJsonCompatibleReadOnly,\n\t\tJsonCompatibleReadOnly,\n\t\tChangeEncodingContext\n\t>,\n\trevisionTagCodec: IJsonCodec<\n\t\tRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tEncodedRevisionTag,\n\t\tChangeEncodingContext\n\t>,\n\tversion: EncodedEditManager<TChangeset>[\"version\"],\n): CodecAndSchema<SummaryData<TChangeset>, EditManagerEncodingContext> {\n\tconst schema = EncodedEditManager(changeCodec.encodedSchema ?? JsonCompatibleReadOnlySchema);\n\n\tconst codec: CodecAndSchema<SummaryData<TChangeset>, EditManagerEncodingContext> = {\n\t\tschema,\n\t\tencode: (data: SummaryData<TChangeset>, context: EditManagerEncodingContext) => {\n\t\t\tconst mainBranch = encodeSharedBranch(\n\t\t\t\tchangeCodec,\n\t\t\t\trevisionTagCodec,\n\t\t\t\tdata.main,\n\t\t\t\tcontext,\n\t\t\t\tdata.originator,\n\t\t\t);\n\t\t\tassert(\n\t\t\t\tdata.originator !== undefined,\n\t\t\t\t0xca5 /* Cannot encode vSharedBranches summary without originator */,\n\t\t\t);\n\t\t\tconst json: Mutable<EncodedEditManager<TChangeset>> = {\n\t\t\t\tmain: mainBranch,\n\t\t\t\toriginator: data.originator,\n\t\t\t\tversion,\n\t\t\t};\n\t\t\tif (data.branches !== undefined && data.branches.size > 0) {\n\t\t\t\tconst branches: EncodedSharedBranch<TChangeset>[] = [];\n\t\t\t\tfor (const [_, branch] of data.branches) {\n\t\t\t\t\tbranches.push(\n\t\t\t\t\t\tencodeSharedBranch(\n\t\t\t\t\t\t\tchangeCodec,\n\t\t\t\t\t\t\trevisionTagCodec,\n\t\t\t\t\t\t\tbranch,\n\t\t\t\t\t\t\tcontext,\n\t\t\t\t\t\t\tdata.originator,\n\t\t\t\t\t\t),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tjson.branches = branches;\n\t\t\t}\n\t\t\treturn json as EncodedEditManager<TChangeset> & JsonCompatibleReadOnlyObject;\n\t\t},\n\t\tdecode: (\n\t\t\tjson: EncodedEditManager<TChangeset> & JsonCompatibleReadOnlyObject,\n\t\t\tcontext: EditManagerEncodingContext,\n\t\t): SummaryData<TChangeset> => {\n\t\t\tconst mainBranch = decodeSharedBranch(\n\t\t\t\tchangeCodec,\n\t\t\t\trevisionTagCodec,\n\t\t\t\tjson.main,\n\t\t\t\tcontext,\n\t\t\t\tjson.originator,\n\t\t\t);\n\n\t\t\tconst decoded: Mutable<SummaryData<TChangeset>> = {\n\t\t\t\tmain: mainBranch,\n\t\t\t\toriginator: json.originator,\n\t\t\t};\n\n\t\t\tif (json.branches !== undefined) {\n\t\t\t\tconst branches = new Map<BranchId, SharedBranchSummaryData<TChangeset>>();\n\t\t\t\tfor (const branch of json.branches) {\n\t\t\t\t\tconst decodedBranch = decodeSharedBranch(\n\t\t\t\t\t\tchangeCodec,\n\t\t\t\t\t\trevisionTagCodec,\n\t\t\t\t\t\tbranch,\n\t\t\t\t\t\tcontext,\n\t\t\t\t\t\tjson.originator,\n\t\t\t\t\t);\n\t\t\t\t\tassert(decodedBranch.id !== undefined, 0xc66 /* Shared branches must have an id */);\n\t\t\t\t\tassert(!branches.has(decodedBranch.id), 0xc67 /* Duplicate shared branch id */);\n\t\t\t\t\tbranches.set(decodedBranch.id, decodedBranch);\n\t\t\t\t}\n\n\t\t\t\tdecoded.branches = branches;\n\t\t\t}\n\t\t\treturn decoded;\n\t\t},\n\t};\n\n\treturn codec;\n}\n"]}
@@ -3,32 +3,10 @@
3
3
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
4
4
  * Licensed under the MIT License.
5
5
  */
6
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
7
- if (k2 === undefined) k2 = k;
8
- var desc = Object.getOwnPropertyDescriptor(m, k);
9
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
10
- desc = { enumerable: true, get: function() { return m[k]; } };
11
- }
12
- Object.defineProperty(o, k2, desc);
13
- }) : (function(o, m, k, k2) {
14
- if (k2 === undefined) k2 = k;
15
- o[k2] = m[k];
16
- }));
17
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
18
- Object.defineProperty(o, "default", { enumerable: true, value: v });
19
- }) : function(o, v) {
20
- o["default"] = v;
21
- });
22
- var __importStar = (this && this.__importStar) || function (mod) {
23
- if (mod && mod.__esModule) return mod;
24
- var result = {};
25
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
26
- __setModuleDefault(result, mod);
27
- return result;
28
- };
29
6
  Object.defineProperty(exports, "__esModule", { value: true });
30
7
  exports.editManagerFormatVersions = exports.supportedEditManagerFormatVersions = exports.EditManagerFormatVersion = exports.EncodedSharedBranch = exports.SummarySessionBranch = exports.SequencedCommit = void 0;
31
- const Type = __importStar(require("@sinclair/typebox"));
8
+ const tslib_1 = require("tslib");
9
+ const Type = tslib_1.__importStar(require("@sinclair/typebox"));
32
10
  const index_js_1 = require("../core/index.js");
33
11
  const index_js_2 = require("../util/index.js");
34
12
  const noAdditionalProps = { additionalProperties: false };
@@ -1 +1 @@
1
- {"version":3,"file":"editManagerFormatComm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AC,EAAE;IAC3B,gCAAwB,CAAC,EAAE;IAC3B,gCAAwB,CAAC,eAAe;CACxC,CAAC,CAAC;AACS,QAAA,yBAAyB,GAA0C,IAAI,GAAG,CACtF,MAAM,CAAC,MAAM,CAAC,gCAAwB,CAAC,CACvC,CAAC;AACF,oEAAoE","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { SessionId } from \"@fluidframework/id-compressor\";\nimport * as Type from \"@sinclair/typebox\";\nimport type { ObjectOptions, Static, TSchema } from \"@sinclair/typebox\";\n\nimport {\n\ttype EncodedRevisionTag,\n\ttype RevisionTag,\n\tRevisionTagSchema,\n\tSessionIdSchema,\n} from \"../core/index.js\";\nimport { type Brand, brandedNumberType, strictEnum, type Values } from \"../util/index.js\";\n\nimport type { EncodedBranchId } from \"./branch.js\";\n\n/**\n * Contains a single change to the `SharedTree` and associated metadata.\n *\n * TODO: if this type is not used in the encoded format, move it out of this file, and stop using it in EncodedEditManager.\n * If this is an encoded format, clarify the difference between it and EncodedCommit.\n */\nexport interface Commit<TChangeset> {\n\treadonly revision: RevisionTag;\n\treadonly change: TChangeset;\n\t/** An identifier representing the session/user/client that made this commit */\n\treadonly sessionId: SessionId;\n}\n\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\nexport type EncodedCommit<TChangeset> = {\n\treadonly revision: EncodedRevisionTag;\n\treadonly change: TChangeset;\n\treadonly sessionId: SessionId;\n};\n\nconst noAdditionalProps: ObjectOptions = { additionalProperties: false };\n\n// Many of the return types in this module are intentionally derived, rather than explicitly specified.\n/* eslint-disable @typescript-eslint/explicit-function-return-type */\n\nconst CommitBase = <ChangeSchema extends TSchema>(tChange: ChangeSchema) =>\n\tType.Object({\n\t\trevision: RevisionTagSchema,\n\t\tchange: tChange,\n\t\tsessionId: SessionIdSchema,\n\t});\n/**\n * @privateRemarks Commits are generally encoded from `GraphCommit`s, which often contain extra data.\n * This `noAdditionalProps` is especially important in that light.\n */\nconst Commit = <ChangeSchema extends TSchema>(tChange: ChangeSchema) =>\n\tType.Composite([CommitBase(tChange)], noAdditionalProps);\n\nexport type SeqNumber = Brand<number, \"edit-manager.SeqNumber\">;\nconst SeqNumber = brandedNumberType<SeqNumber>({ multipleOf: 1 });\n\nconst SequenceId = Type.Object({\n\tsequenceNumber: SeqNumber,\n\tindexInBatch: Type.Optional(Type.Number({ multipleOf: 1, minimum: 0 })),\n});\n\nexport type SequenceId = Static<typeof SequenceId>;\n\n/**\n * A commit with a sequence number but no parentage; used for serializing the `EditManager` into a summary\n */\nexport interface SequencedCommit<TChangeset> extends Commit<TChangeset>, SequenceId {}\n\nexport const SequencedCommit = <ChangeSchema extends TSchema>(tChange: ChangeSchema) =>\n\tType.Composite([CommitBase(tChange), SequenceId], noAdditionalProps);\n\n/**\n * A branch off of the trunk for use in summaries.\n *\n * TODO: if this type is not used in the encoded format, move it out of this file, and stop using it in EncodedEditManager.\n * If this is an encoded format, use EncodedCommit instead of Commit or clarify that Commit is also an encoded format.\n */\nexport interface SummarySessionBranch<TChangeset> {\n\treadonly base: RevisionTag;\n\treadonly commits: Commit<TChangeset>[];\n}\n\nexport interface EncodedSummarySessionBranch<TChangeset> {\n\treadonly base: EncodedRevisionTag;\n\treadonly commits: Commit<TChangeset>[];\n}\n\nexport const SummarySessionBranch = <ChangeSchema extends TSchema>(tChange: ChangeSchema) =>\n\tType.Object(\n\t\t{\n\t\t\tbase: RevisionTagSchema,\n\t\t\tcommits: Type.Array(Commit(tChange)),\n\t\t},\n\t\tnoAdditionalProps,\n\t);\n\nexport interface EncodedSharedBranch<TChangeset> {\n\treadonly id?: EncodedBranchId;\n\treadonly name?: string;\n\treadonly author?: string;\n\treadonly session?: SessionId;\n\treadonly base?: EncodedRevisionTag;\n\treadonly trunk: readonly Readonly<SequencedCommit<TChangeset>>[];\n\treadonly peers: readonly [SessionId, Readonly<EncodedSummarySessionBranch<TChangeset>>][];\n}\n\nexport const EncodedSharedBranch = <ChangeSchema extends TSchema>(tChange: ChangeSchema) =>\n\tType.Object(\n\t\t{\n\t\t\tid: Type.Optional(Type.Number()),\n\t\t\tname: Type.Optional(Type.String()),\n\t\t\tsession: Type.Optional(SessionIdSchema),\n\t\t\tauthor: Type.Optional(Type.String()),\n\t\t\tbase: Type.Optional(RevisionTagSchema),\n\t\t\ttrunk: Type.Array(SequencedCommit(tChange)),\n\t\t\tpeers: Type.Array(Type.Tuple([SessionIdSchema, SummarySessionBranch(tChange)])),\n\t\t},\n\t\tnoAdditionalProps,\n\t);\n\n/**\n * The format version for the EditManager.\n */\nexport const EditManagerFormatVersion = strictEnum(\"editManager.FormatVersion\", {\n\t/**\n\t * Introduced and retired prior to 2.0.\n\t * Reading and writing capability removed in 2.73.0.\n\t */\n\tv1: 1,\n\t/**\n\t * Introduced and retired prior to 2.0.\n\t * Reading and writing capability removed in 2.73.0.\n\t */\n\tv2: 2,\n\t/**\n\t * Introduced prior to 2.0 and used beyond.\n\t * Reading capability must be maintained for backwards compatibility.\n\t * Writing capability needs to be maintained so long as {@link lowestMinVersionForCollab} is less than 2.2.0.\n\t */\n\tv3: 3,\n\t/**\n\t * Introduced in 2.2.0.\n\t * Was inadvertently made usable for writing in 2.43.0 (through configuredSharedTree) and remains available.\n\t * Reading capability must be maintained for backwards compatibility.\n\t * Writing capability could be dropped in favor of {@link EditManagerFormatVersion.v3},\n\t * but doing so would make the pattern of writable versions more complex and gain little\n\t * because most of the logic for this format is shared with {@link EditManagerFormatVersion.v3}.\n\t */\n\tv4: 4,\n\t/**\n\t * This version number was used internally for testing shared branches.\n\t * This format was never made stable.\n\t * This version number is kept here solely to avoid reusing the number: it is not supported for either reading or writing.\n\t * @deprecated Use {@link EditManagerFormatVersion.vSharedBranches} for testing shared branches.\n\t */\n\tv5: 5,\n\t/**\n\t * Introduced and made available for writing in 2.80.0\n\t * Adds support for \"no change\" constraints.\n\t */\n\tv6: 6,\n\t/**\n\t * Not yet released.\n\t * Only used for testing shared branches.\n\t */\n\tvSharedBranches: \"shared-branches|v0.1\",\n});\nexport type EditManagerFormatVersion = Values<typeof EditManagerFormatVersion>;\nexport const supportedEditManagerFormatVersions: ReadonlySet<EditManagerFormatVersion> =\n\tnew Set([\n\t\tEditManagerFormatVersion.v3,\n\t\tEditManagerFormatVersion.v4,\n\t\tEditManagerFormatVersion.v6,\n\t\tEditManagerFormatVersion.vSharedBranches,\n\t]);\nexport const editManagerFormatVersions: ReadonlySet<EditManagerFormatVersion> = new Set(\n\tObject.values(EditManagerFormatVersion),\n);\n/* eslint-enable @typescript-eslint/explicit-function-return-type */\n"]}
1
+ {"version":3,"file":"editManagerFormatCommons.js","sourceRoot":"","sources":["../../src/shared-tree-core/editManagerFormatCommons.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;AAGH,gEAA0C;AAG1C,+CAK0B;AAC1B,+CAA0F;AAwB1F,MAAM,iBAAiB,GAAkB,EAAE,oBAAoB,EAAE,KAAK,EAAE,CAAC;AAEzE,uGAAuG;AACvG,qEAAqE;AAErE,MAAM,UAAU,GAAG,CAA+B,OAAqB,EAAE,EAAE,CAC1E,IAAI,CAAC,MAAM,CAAC;IACX,QAAQ,EAAE,4BAAiB;IAC3B,MAAM,EAAE,OAAO;IACf,SAAS,EAAE,0BAAe;CAC1B,CAAC,CAAC;AACJ;;;GAGG;AACH,MAAM,MAAM,GAAG,CAA+B,OAAqB,EAAE,EAAE,CACtE,IAAI,CAAC,SAAS,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,EAAE,iBAAiB,CAAC,CAAC;AAG1D,MAAM,SAAS,GAAG,IAAA,4BAAiB,EAAY,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC,CAAC;AAElE,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC;IAC9B,cAAc,EAAE,SAAS;IACzB,YAAY,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,OAAO,EAAE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;IAC/E;;;OAGG;IACH,EAAE,EAAE,CAAC;IACL;;;OAGG;IACH,EAAE,EAAE,CAAC;IACL;;;;OAIG;IACH,EAAE,EAAE,CAAC;IACL;;;;;;;OAOG;IACH,EAAE,EAAE,CAAC;IACL;;;;;OAKG;IACH,EAAE,EAAE,CAAC;IACL;;;OAGG;IACH,EAAE,EAAE,CAAC;IACL;;;OAGG;IACH,eAAe,EAAE,sBAAsB;CACvC,CAAC,CAAC;AAEU,QAAA,kCAAkC,GAC9C,IAAI,GAAG,CAAC;IACP,gCAAwB,CAAC,EAAE;IAC3B,gCAAwB,CAAC,EAAE;IAC3B,gCAAwB,CAAC,EAAE;IAC3B,gCAAwB,CAAC,eAAe;CACxC,CAAC,CAAC;AACS,QAAA,yBAAyB,GAA0C,IAAI,GAAG,CACtF,MAAM,CAAC,MAAM,CAAC,gCAAwB,CAAC,CACvC,CAAC;AACF,oEAAoE","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { SessionId } from \"@fluidframework/id-compressor\";\nimport * as Type from \"@sinclair/typebox\";\nimport type { ObjectOptions, Static, TSchema } from \"@sinclair/typebox\";\n\nimport {\n\ttype EncodedRevisionTag,\n\ttype RevisionTag,\n\tRevisionTagSchema,\n\tSessionIdSchema,\n} from \"../core/index.js\";\nimport { type Brand, brandedNumberType, strictEnum, type Values } from \"../util/index.js\";\n\nimport type { EncodedBranchId } from \"./branch.js\";\n\n/**\n * Contains a single change to the `SharedTree` and associated metadata.\n *\n * TODO: if this type is not used in the encoded format, move it out of this file, and stop using it in EncodedEditManager.\n * If this is an encoded format, clarify the difference between it and EncodedCommit.\n */\nexport interface Commit<TChangeset> {\n\treadonly revision: RevisionTag;\n\treadonly change: TChangeset;\n\t/** An identifier representing the session/user/client that made this commit */\n\treadonly sessionId: SessionId;\n}\n\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\nexport type EncodedCommit<TChangeset> = {\n\treadonly revision: EncodedRevisionTag;\n\treadonly change: TChangeset;\n\treadonly sessionId: SessionId;\n};\n\nconst noAdditionalProps: ObjectOptions = { additionalProperties: false };\n\n// Many of the return types in this module are intentionally derived, rather than explicitly specified.\n/* eslint-disable @typescript-eslint/explicit-function-return-type */\n\nconst CommitBase = <ChangeSchema extends TSchema>(tChange: ChangeSchema) =>\n\tType.Object({\n\t\trevision: RevisionTagSchema,\n\t\tchange: tChange,\n\t\tsessionId: SessionIdSchema,\n\t});\n/**\n * @privateRemarks Commits are generally encoded from `GraphCommit`s, which often contain extra data.\n * This `noAdditionalProps` is especially important in that light.\n */\nconst Commit = <ChangeSchema extends TSchema>(tChange: ChangeSchema) =>\n\tType.Composite([CommitBase(tChange)], noAdditionalProps);\n\nexport type SeqNumber = Brand<number, \"edit-manager.SeqNumber\">;\nconst SeqNumber = brandedNumberType<SeqNumber>({ multipleOf: 1 });\n\nconst SequenceId = Type.Object({\n\tsequenceNumber: SeqNumber,\n\tindexInBatch: Type.Optional(Type.Number({ multipleOf: 1, minimum: 0 })),\n});\n\nexport type SequenceId = Static<typeof SequenceId>;\n\n/**\n * A commit with a sequence number but no parentage; used for serializing the `EditManager` into a summary\n */\nexport interface SequencedCommit<TChangeset> extends Commit<TChangeset>, SequenceId {}\n\nexport const SequencedCommit = <ChangeSchema extends TSchema>(tChange: ChangeSchema) =>\n\tType.Composite([CommitBase(tChange), SequenceId], noAdditionalProps);\n\n/**\n * A branch off of the trunk for use in summaries.\n *\n * TODO: if this type is not used in the encoded format, move it out of this file, and stop using it in EncodedEditManager.\n * If this is an encoded format, use EncodedCommit instead of Commit or clarify that Commit is also an encoded format.\n */\nexport interface SummarySessionBranch<TChangeset> {\n\treadonly base: RevisionTag;\n\treadonly commits: Commit<TChangeset>[];\n}\n\nexport interface EncodedSummarySessionBranch<TChangeset> {\n\treadonly base: EncodedRevisionTag;\n\treadonly commits: Commit<TChangeset>[];\n}\n\nexport const SummarySessionBranch = <ChangeSchema extends TSchema>(tChange: ChangeSchema) =>\n\tType.Object(\n\t\t{\n\t\t\tbase: RevisionTagSchema,\n\t\t\tcommits: Type.Array(Commit(tChange)),\n\t\t},\n\t\tnoAdditionalProps,\n\t);\n\nexport interface EncodedSharedBranch<TChangeset> {\n\treadonly id?: EncodedBranchId;\n\treadonly name?: string;\n\treadonly author?: string;\n\treadonly session?: SessionId;\n\treadonly base?: EncodedRevisionTag;\n\treadonly trunk: readonly Readonly<SequencedCommit<TChangeset>>[];\n\treadonly peers: readonly [SessionId, Readonly<EncodedSummarySessionBranch<TChangeset>>][];\n}\n\nexport const EncodedSharedBranch = <ChangeSchema extends TSchema>(tChange: ChangeSchema) =>\n\tType.Object(\n\t\t{\n\t\t\tid: Type.Optional(Type.Number()),\n\t\t\tname: Type.Optional(Type.String()),\n\t\t\tsession: Type.Optional(SessionIdSchema),\n\t\t\tauthor: Type.Optional(Type.String()),\n\t\t\tbase: Type.Optional(RevisionTagSchema),\n\t\t\ttrunk: Type.Array(SequencedCommit(tChange)),\n\t\t\tpeers: Type.Array(Type.Tuple([SessionIdSchema, SummarySessionBranch(tChange)])),\n\t\t},\n\t\tnoAdditionalProps,\n\t);\n\n/**\n * The format version for the EditManager.\n */\nexport const EditManagerFormatVersion = strictEnum(\"editManager.FormatVersion\", {\n\t/**\n\t * Introduced and retired prior to 2.0.\n\t * Reading and writing capability removed in 2.73.0.\n\t */\n\tv1: 1,\n\t/**\n\t * Introduced and retired prior to 2.0.\n\t * Reading and writing capability removed in 2.73.0.\n\t */\n\tv2: 2,\n\t/**\n\t * Introduced prior to 2.0 and used beyond.\n\t * Reading capability must be maintained for backwards compatibility.\n\t * Writing capability needs to be maintained so long as {@link lowestMinVersionForCollab} is less than 2.2.0.\n\t */\n\tv3: 3,\n\t/**\n\t * Introduced in 2.2.0.\n\t * Was inadvertently made usable for writing in 2.43.0 (through configuredSharedTree) and remains available.\n\t * Reading capability must be maintained for backwards compatibility.\n\t * Writing capability could be dropped in favor of {@link EditManagerFormatVersion.v3},\n\t * but doing so would make the pattern of writable versions more complex and gain little\n\t * because most of the logic for this format is shared with {@link EditManagerFormatVersion.v3}.\n\t */\n\tv4: 4,\n\t/**\n\t * This version number was used internally for testing shared branches.\n\t * This format was never made stable.\n\t * This version number is kept here solely to avoid reusing the number: it is not supported for either reading or writing.\n\t * @deprecated Use {@link EditManagerFormatVersion.vSharedBranches} for testing shared branches.\n\t */\n\tv5: 5,\n\t/**\n\t * Introduced and made available for writing in 2.80.0\n\t * Adds support for \"no change\" constraints.\n\t */\n\tv6: 6,\n\t/**\n\t * Not yet released.\n\t * Only used for testing shared branches.\n\t */\n\tvSharedBranches: \"shared-branches|v0.1\",\n});\nexport type EditManagerFormatVersion = Values<typeof EditManagerFormatVersion>;\nexport const supportedEditManagerFormatVersions: ReadonlySet<EditManagerFormatVersion> =\n\tnew Set([\n\t\tEditManagerFormatVersion.v3,\n\t\tEditManagerFormatVersion.v4,\n\t\tEditManagerFormatVersion.v6,\n\t\tEditManagerFormatVersion.vSharedBranches,\n\t]);\nexport const editManagerFormatVersions: ReadonlySet<EditManagerFormatVersion> = new Set(\n\tObject.values(EditManagerFormatVersion),\n);\n/* eslint-enable @typescript-eslint/explicit-function-return-type */\n"]}