@fluidframework/tree 2.110.0 → 2.112.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 (598) hide show
  1. package/.vscode/settings.json +1 -0
  2. package/CHANGELOG.md +193 -0
  3. package/api-report/tree.alpha.api.md +96 -36
  4. package/api-report/tree.beta.api.md +39 -1
  5. package/api-report/tree.legacy.beta.api.md +39 -1
  6. package/api-report/tree.legacy.public.api.md +1 -1
  7. package/api-report/tree.public.api.md +1 -1
  8. package/dist/componentApi.d.ts +198 -0
  9. package/dist/componentApi.d.ts.map +1 -0
  10. package/dist/componentApi.js +138 -0
  11. package/dist/componentApi.js.map +1 -0
  12. package/dist/core/change-family/changeFamily.d.ts +3 -10
  13. package/dist/core/change-family/changeFamily.d.ts.map +1 -1
  14. package/dist/core/change-family/changeFamily.js.map +1 -1
  15. package/dist/core/rebase/types.d.ts +2 -2
  16. package/dist/core/rebase/types.js.map +1 -1
  17. package/dist/core/schema-stored/storedSchemaRepository.d.ts +2 -2
  18. package/dist/core/schema-stored/storedSchemaRepository.js.map +1 -1
  19. package/dist/entrypoints/alpha.d.ts +1 -1
  20. package/dist/entrypoints/alpha.d.ts.map +1 -1
  21. package/dist/entrypoints/alpha.js +4 -2
  22. package/dist/entrypoints/alpha.js.map +1 -1
  23. package/dist/entrypoints/beta.d.ts +1 -1
  24. package/dist/entrypoints/beta.d.ts.map +1 -1
  25. package/dist/entrypoints/beta.js.map +1 -1
  26. package/dist/entrypoints/legacy.d.ts +1 -1
  27. package/dist/entrypoints/legacy.d.ts.map +1 -1
  28. package/dist/entrypoints/legacy.js.map +1 -1
  29. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +1 -20
  30. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  31. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js +13 -32
  32. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  33. package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts +1 -2
  34. package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts.map +1 -1
  35. package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
  36. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts +73 -28
  37. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  38. package/dist/feature-libraries/chunked-forest/codec/codecs.js +76 -9
  39. package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  40. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +4 -2
  41. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
  42. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +11 -0
  43. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  44. package/dist/feature-libraries/chunked-forest/codec/index.d.ts +1 -1
  45. package/dist/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
  46. package/dist/feature-libraries/chunked-forest/codec/index.js +2 -1
  47. package/dist/feature-libraries/chunked-forest/codec/index.js.map +1 -1
  48. package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts +1 -1
  49. package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts.map +1 -1
  50. package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.js +3 -15
  51. package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.js.map +1 -1
  52. package/dist/feature-libraries/chunked-forest/index.d.ts +1 -1
  53. package/dist/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  54. package/dist/feature-libraries/chunked-forest/index.js +2 -1
  55. package/dist/feature-libraries/chunked-forest/index.js.map +1 -1
  56. package/dist/feature-libraries/forest-summary/codec.d.ts +3 -3
  57. package/dist/feature-libraries/forest-summary/codec.d.ts.map +1 -1
  58. package/dist/feature-libraries/forest-summary/codec.js.map +1 -1
  59. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts +3 -2
  60. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  61. package/dist/feature-libraries/forest-summary/forestSummarizer.js +4 -6
  62. package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  63. package/dist/feature-libraries/index.d.ts +3 -3
  64. package/dist/feature-libraries/index.d.ts.map +1 -1
  65. package/dist/feature-libraries/index.js +4 -2
  66. package/dist/feature-libraries/index.js.map +1 -1
  67. package/dist/feature-libraries/modular-schema/index.d.ts +1 -0
  68. package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
  69. package/dist/feature-libraries/modular-schema/index.js +3 -1
  70. package/dist/feature-libraries/modular-schema/index.js.map +1 -1
  71. package/dist/feature-libraries/modular-schema/minimizeModularChange.d.ts +25 -0
  72. package/dist/feature-libraries/modular-schema/minimizeModularChange.d.ts.map +1 -0
  73. package/dist/feature-libraries/modular-schema/minimizeModularChange.js +29 -0
  74. package/dist/feature-libraries/modular-schema/minimizeModularChange.js.map +1 -0
  75. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -1
  76. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js +9 -9
  77. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
  78. package/dist/feature-libraries/schemaChecker.d.ts +22 -3
  79. package/dist/feature-libraries/schemaChecker.d.ts.map +1 -1
  80. package/dist/feature-libraries/schemaChecker.js +48 -5
  81. package/dist/feature-libraries/schemaChecker.js.map +1 -1
  82. package/dist/index.d.ts +4 -3
  83. package/dist/index.d.ts.map +1 -1
  84. package/dist/index.js +6 -2
  85. package/dist/index.js.map +1 -1
  86. package/dist/packageVersion.d.ts +1 -1
  87. package/dist/packageVersion.js +1 -1
  88. package/dist/packageVersion.js.map +1 -1
  89. package/dist/shared-tree/independentView.d.ts +17 -4
  90. package/dist/shared-tree/independentView.d.ts.map +1 -1
  91. package/dist/shared-tree/independentView.js +15 -12
  92. package/dist/shared-tree/independentView.js.map +1 -1
  93. package/dist/shared-tree/index.d.ts +3 -2
  94. package/dist/shared-tree/index.d.ts.map +1 -1
  95. package/dist/shared-tree/index.js +3 -1
  96. package/dist/shared-tree/index.js.map +1 -1
  97. package/dist/shared-tree/schematizingTreeView.d.ts +6 -5
  98. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  99. package/dist/shared-tree/schematizingTreeView.js +6 -3
  100. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  101. package/dist/shared-tree/serializedChange.d.ts +41 -0
  102. package/dist/shared-tree/serializedChange.d.ts.map +1 -0
  103. package/dist/shared-tree/serializedChange.js +87 -0
  104. package/dist/shared-tree/serializedChange.js.map +1 -0
  105. package/dist/shared-tree/sharedTree.d.ts +18 -0
  106. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  107. package/dist/shared-tree/sharedTree.js +9 -4
  108. package/dist/shared-tree/sharedTree.js.map +1 -1
  109. package/dist/shared-tree/sharedTreeChangeFamily.d.ts +7 -0
  110. package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  111. package/dist/shared-tree/sharedTreeChangeFamily.js +8 -1
  112. package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  113. package/dist/shared-tree/transactionMinimize.d.ts +35 -0
  114. package/dist/shared-tree/transactionMinimize.d.ts.map +1 -0
  115. package/dist/shared-tree/transactionMinimize.js +65 -0
  116. package/dist/shared-tree/transactionMinimize.js.map +1 -0
  117. package/dist/shared-tree/transactionPostProcessor.d.ts +28 -0
  118. package/dist/shared-tree/transactionPostProcessor.d.ts.map +1 -0
  119. package/dist/shared-tree/transactionPostProcessor.js +28 -0
  120. package/dist/shared-tree/transactionPostProcessor.js.map +1 -0
  121. package/dist/shared-tree/treeAlpha.js +3 -3
  122. package/dist/shared-tree/treeAlpha.js.map +1 -1
  123. package/dist/shared-tree/treeCheckout.d.ts +19 -13
  124. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  125. package/dist/shared-tree/treeCheckout.js +54 -71
  126. package/dist/shared-tree/treeCheckout.js.map +1 -1
  127. package/dist/shared-tree/unhydratedTreeContext.d.ts +5 -5
  128. package/dist/shared-tree/unhydratedTreeContext.d.ts.map +1 -1
  129. package/dist/shared-tree/unhydratedTreeContext.js.map +1 -1
  130. package/dist/shared-tree-core/editManager.d.ts +6 -3
  131. package/dist/shared-tree-core/editManager.d.ts.map +1 -1
  132. package/dist/shared-tree-core/editManager.js +35 -14
  133. package/dist/shared-tree-core/editManager.js.map +1 -1
  134. package/dist/shared-tree-core/editManagerCodecs.d.ts +3 -2
  135. package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  136. package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
  137. package/dist/shared-tree-core/editManagerCodecsCommons.d.ts +3 -9
  138. package/dist/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
  139. package/dist/shared-tree-core/editManagerCodecsCommons.js +2 -4
  140. package/dist/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
  141. package/dist/shared-tree-core/editManagerCodecsV1toV4.d.ts +3 -3
  142. package/dist/shared-tree-core/editManagerCodecsV1toV4.d.ts.map +1 -1
  143. package/dist/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -1
  144. package/dist/shared-tree-core/editManagerCodecsVSharedBranches.d.ts +3 -3
  145. package/dist/shared-tree-core/editManagerCodecsVSharedBranches.d.ts.map +1 -1
  146. package/dist/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
  147. package/dist/shared-tree-core/editManagerFormatCommons.d.ts +1 -1
  148. package/dist/shared-tree-core/editManagerFormatCommons.js +1 -1
  149. package/dist/shared-tree-core/editManagerFormatCommons.js.map +1 -1
  150. package/dist/shared-tree-core/editManagerFormatVSharedBranches.d.ts +1 -1
  151. package/dist/shared-tree-core/editManagerSummarizer.d.ts +5 -9
  152. package/dist/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
  153. package/dist/shared-tree-core/editManagerSummarizer.js +5 -10
  154. package/dist/shared-tree-core/editManagerSummarizer.js.map +1 -1
  155. package/dist/shared-tree-core/index.d.ts +1 -1
  156. package/dist/shared-tree-core/index.d.ts.map +1 -1
  157. package/dist/shared-tree-core/index.js +3 -2
  158. package/dist/shared-tree-core/index.js.map +1 -1
  159. package/dist/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -1
  160. package/dist/shared-tree-core/messageCodecVSharedBranches.js +8 -2
  161. package/dist/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
  162. package/dist/shared-tree-core/messageFormat.d.ts +1 -1
  163. package/dist/shared-tree-core/messageFormat.js +1 -1
  164. package/dist/shared-tree-core/messageFormat.js.map +1 -1
  165. package/dist/shared-tree-core/messageFormatVSharedBranches.d.ts +10 -1
  166. package/dist/shared-tree-core/messageFormatVSharedBranches.d.ts.map +1 -1
  167. package/dist/shared-tree-core/messageFormatVSharedBranches.js +1 -0
  168. package/dist/shared-tree-core/messageFormatVSharedBranches.js.map +1 -1
  169. package/dist/shared-tree-core/messageTypes.d.ts +1 -0
  170. package/dist/shared-tree-core/messageTypes.d.ts.map +1 -1
  171. package/dist/shared-tree-core/messageTypes.js.map +1 -1
  172. package/dist/shared-tree-core/sharedTreeCore.d.ts +9 -3
  173. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  174. package/dist/shared-tree-core/sharedTreeCore.js +27 -12
  175. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  176. package/dist/shared-tree-core/transaction.d.ts +84 -9
  177. package/dist/shared-tree-core/transaction.d.ts.map +1 -1
  178. package/dist/shared-tree-core/transaction.js +88 -7
  179. package/dist/shared-tree-core/transaction.js.map +1 -1
  180. package/dist/simple-tree/api/index.d.ts +2 -2
  181. package/dist/simple-tree/api/index.d.ts.map +1 -1
  182. package/dist/simple-tree/api/index.js +2 -2
  183. package/dist/simple-tree/api/index.js.map +1 -1
  184. package/dist/simple-tree/api/schemaCompatibilityTester.d.ts +9 -24
  185. package/dist/simple-tree/api/schemaCompatibilityTester.d.ts.map +1 -1
  186. package/dist/simple-tree/api/schemaCompatibilityTester.js +31 -44
  187. package/dist/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
  188. package/dist/simple-tree/api/schemaCreationUtilities.d.ts +3 -3
  189. package/dist/simple-tree/api/schemaCreationUtilities.js +3 -3
  190. package/dist/simple-tree/api/schemaCreationUtilities.js.map +1 -1
  191. package/dist/simple-tree/api/schemaFactory.d.ts +1 -1
  192. package/dist/simple-tree/api/schemaFactory.js +2 -2
  193. package/dist/simple-tree/api/schemaFactory.js.map +1 -1
  194. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +56 -15
  195. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  196. package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  197. package/dist/simple-tree/api/schemaFactoryBeta.d.ts +0 -3
  198. package/dist/simple-tree/api/schemaFactoryBeta.d.ts.map +1 -1
  199. package/dist/simple-tree/api/schemaFactoryBeta.js.map +1 -1
  200. package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts +2 -2
  201. package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -1
  202. package/dist/simple-tree/api/snapshotCompatibilityChecker.js +3 -4
  203. package/dist/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
  204. package/dist/simple-tree/api/storedSchema.d.ts.map +1 -1
  205. package/dist/simple-tree/api/storedSchema.js +1 -2
  206. package/dist/simple-tree/api/storedSchema.js.map +1 -1
  207. package/dist/simple-tree/api/transactionTypes.d.ts +91 -28
  208. package/dist/simple-tree/api/transactionTypes.d.ts.map +1 -1
  209. package/dist/simple-tree/api/transactionTypes.js.map +1 -1
  210. package/dist/simple-tree/api/tree.d.ts +108 -24
  211. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  212. package/dist/simple-tree/api/tree.js.map +1 -1
  213. package/dist/simple-tree/api/treeBeta.d.ts.map +1 -1
  214. package/dist/simple-tree/api/treeBeta.js.map +1 -1
  215. package/dist/simple-tree/api/typesUnsafe.d.ts +2 -2
  216. package/dist/simple-tree/api/typesUnsafe.d.ts.map +1 -1
  217. package/dist/simple-tree/api/typesUnsafe.js.map +1 -1
  218. package/dist/simple-tree/core/treeNodeSchema.d.ts +7 -7
  219. package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
  220. package/dist/simple-tree/index.d.ts +1 -1
  221. package/dist/simple-tree/index.d.ts.map +1 -1
  222. package/dist/simple-tree/index.js +2 -2
  223. package/dist/simple-tree/index.js.map +1 -1
  224. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts +83 -4
  225. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  226. package/dist/simple-tree/node-kinds/array/arrayNode.js +39 -0
  227. package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  228. package/dist/simple-tree/simpleSchemaFormatV1.js +1 -1
  229. package/dist/simple-tree/simpleSchemaFormatV1.js.map +1 -1
  230. package/dist/text/index.d.ts +1 -0
  231. package/dist/text/index.d.ts.map +1 -1
  232. package/dist/text/index.js +3 -1
  233. package/dist/text/index.js.map +1 -1
  234. package/dist/text/textDomainFormatted.d.ts +69 -758
  235. package/dist/text/textDomainFormatted.d.ts.map +1 -1
  236. package/dist/text/textDomainFormatted.js +275 -322
  237. package/dist/text/textDomainFormatted.js.map +1 -1
  238. package/dist/text/textDomainFormattedDefault.d.ts +273 -0
  239. package/dist/text/textDomainFormattedDefault.d.ts.map +1 -0
  240. package/dist/text/textDomainFormattedDefault.js +94 -0
  241. package/dist/text/textDomainFormattedDefault.js.map +1 -0
  242. package/dist/treeFactory.js +1 -1
  243. package/dist/treeFactory.js.map +1 -1
  244. package/dist/util/breakable.d.ts +16 -1
  245. package/dist/util/breakable.d.ts.map +1 -1
  246. package/dist/util/breakable.js +9 -1
  247. package/dist/util/breakable.js.map +1 -1
  248. package/dist/util/compressedIds.d.ts +185 -0
  249. package/dist/util/compressedIds.d.ts.map +1 -0
  250. package/dist/util/compressedIds.js +164 -0
  251. package/dist/util/compressedIds.js.map +1 -0
  252. package/dist/util/index.d.ts +2 -1
  253. package/dist/util/index.d.ts.map +1 -1
  254. package/dist/util/index.js +10 -2
  255. package/dist/util/index.js.map +1 -1
  256. package/dist/util/nestedMap.d.ts.map +1 -1
  257. package/dist/util/nestedMap.js +16 -3
  258. package/dist/util/nestedMap.js.map +1 -1
  259. package/dist/util/nestedSet.d.ts +1 -1
  260. package/dist/util/nestedSet.d.ts.map +1 -1
  261. package/dist/util/nestedSet.js.map +1 -1
  262. package/dist/util/utils.d.ts +0 -6
  263. package/dist/util/utils.d.ts.map +1 -1
  264. package/dist/util/utils.js +1 -15
  265. package/dist/util/utils.js.map +1 -1
  266. package/lib/componentApi.d.ts +198 -0
  267. package/lib/componentApi.d.ts.map +1 -0
  268. package/lib/componentApi.js +135 -0
  269. package/lib/componentApi.js.map +1 -0
  270. package/lib/core/change-family/changeFamily.d.ts +3 -10
  271. package/lib/core/change-family/changeFamily.d.ts.map +1 -1
  272. package/lib/core/change-family/changeFamily.js.map +1 -1
  273. package/lib/core/rebase/types.d.ts +2 -2
  274. package/lib/core/rebase/types.js.map +1 -1
  275. package/lib/core/schema-stored/storedSchemaRepository.d.ts +2 -2
  276. package/lib/core/schema-stored/storedSchemaRepository.js.map +1 -1
  277. package/lib/entrypoints/alpha.d.ts +1 -1
  278. package/lib/entrypoints/alpha.d.ts.map +1 -1
  279. package/lib/entrypoints/alpha.js +1 -1
  280. package/lib/entrypoints/alpha.js.map +1 -1
  281. package/lib/entrypoints/beta.d.ts +1 -1
  282. package/lib/entrypoints/beta.d.ts.map +1 -1
  283. package/lib/entrypoints/beta.js.map +1 -1
  284. package/lib/entrypoints/legacy.d.ts +1 -1
  285. package/lib/entrypoints/legacy.d.ts.map +1 -1
  286. package/lib/entrypoints/legacy.js.map +1 -1
  287. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +1 -20
  288. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  289. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js +14 -33
  290. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  291. package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts +1 -2
  292. package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts.map +1 -1
  293. package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
  294. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts +73 -28
  295. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  296. package/lib/feature-libraries/chunked-forest/codec/codecs.js +75 -9
  297. package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  298. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +4 -2
  299. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
  300. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +12 -1
  301. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  302. package/lib/feature-libraries/chunked-forest/codec/index.d.ts +1 -1
  303. package/lib/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
  304. package/lib/feature-libraries/chunked-forest/codec/index.js +1 -1
  305. package/lib/feature-libraries/chunked-forest/codec/index.js.map +1 -1
  306. package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts +1 -1
  307. package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts.map +1 -1
  308. package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.js +3 -15
  309. package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.js.map +1 -1
  310. package/lib/feature-libraries/chunked-forest/index.d.ts +1 -1
  311. package/lib/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  312. package/lib/feature-libraries/chunked-forest/index.js +1 -1
  313. package/lib/feature-libraries/chunked-forest/index.js.map +1 -1
  314. package/lib/feature-libraries/forest-summary/codec.d.ts +3 -3
  315. package/lib/feature-libraries/forest-summary/codec.d.ts.map +1 -1
  316. package/lib/feature-libraries/forest-summary/codec.js.map +1 -1
  317. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts +3 -2
  318. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  319. package/lib/feature-libraries/forest-summary/forestSummarizer.js +4 -6
  320. package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  321. package/lib/feature-libraries/index.d.ts +3 -3
  322. package/lib/feature-libraries/index.d.ts.map +1 -1
  323. package/lib/feature-libraries/index.js +2 -2
  324. package/lib/feature-libraries/index.js.map +1 -1
  325. package/lib/feature-libraries/modular-schema/index.d.ts +1 -0
  326. package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
  327. package/lib/feature-libraries/modular-schema/index.js +1 -0
  328. package/lib/feature-libraries/modular-schema/index.js.map +1 -1
  329. package/lib/feature-libraries/modular-schema/minimizeModularChange.d.ts +25 -0
  330. package/lib/feature-libraries/modular-schema/minimizeModularChange.d.ts.map +1 -0
  331. package/lib/feature-libraries/modular-schema/minimizeModularChange.js +25 -0
  332. package/lib/feature-libraries/modular-schema/minimizeModularChange.js.map +1 -0
  333. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -1
  334. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js +10 -10
  335. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
  336. package/lib/feature-libraries/schemaChecker.d.ts +22 -3
  337. package/lib/feature-libraries/schemaChecker.d.ts.map +1 -1
  338. package/lib/feature-libraries/schemaChecker.js +48 -5
  339. package/lib/feature-libraries/schemaChecker.js.map +1 -1
  340. package/lib/index.d.ts +4 -3
  341. package/lib/index.d.ts.map +1 -1
  342. package/lib/index.js +3 -2
  343. package/lib/index.js.map +1 -1
  344. package/lib/packageVersion.d.ts +1 -1
  345. package/lib/packageVersion.js +1 -1
  346. package/lib/packageVersion.js.map +1 -1
  347. package/lib/shared-tree/independentView.d.ts +17 -4
  348. package/lib/shared-tree/independentView.d.ts.map +1 -1
  349. package/lib/shared-tree/independentView.js +13 -10
  350. package/lib/shared-tree/independentView.js.map +1 -1
  351. package/lib/shared-tree/index.d.ts +3 -2
  352. package/lib/shared-tree/index.d.ts.map +1 -1
  353. package/lib/shared-tree/index.js +1 -0
  354. package/lib/shared-tree/index.js.map +1 -1
  355. package/lib/shared-tree/schematizingTreeView.d.ts +6 -5
  356. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  357. package/lib/shared-tree/schematizingTreeView.js +7 -4
  358. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  359. package/lib/shared-tree/serializedChange.d.ts +41 -0
  360. package/lib/shared-tree/serializedChange.d.ts.map +1 -0
  361. package/lib/shared-tree/serializedChange.js +84 -0
  362. package/lib/shared-tree/serializedChange.js.map +1 -0
  363. package/lib/shared-tree/sharedTree.d.ts +18 -0
  364. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  365. package/lib/shared-tree/sharedTree.js +10 -5
  366. package/lib/shared-tree/sharedTree.js.map +1 -1
  367. package/lib/shared-tree/sharedTreeChangeFamily.d.ts +7 -0
  368. package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  369. package/lib/shared-tree/sharedTreeChangeFamily.js +7 -1
  370. package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  371. package/lib/shared-tree/transactionMinimize.d.ts +35 -0
  372. package/lib/shared-tree/transactionMinimize.d.ts.map +1 -0
  373. package/lib/shared-tree/transactionMinimize.js +62 -0
  374. package/lib/shared-tree/transactionMinimize.js.map +1 -0
  375. package/lib/shared-tree/transactionPostProcessor.d.ts +28 -0
  376. package/lib/shared-tree/transactionPostProcessor.d.ts.map +1 -0
  377. package/lib/shared-tree/transactionPostProcessor.js +23 -0
  378. package/lib/shared-tree/transactionPostProcessor.js.map +1 -0
  379. package/lib/shared-tree/treeAlpha.js +3 -3
  380. package/lib/shared-tree/treeAlpha.js.map +1 -1
  381. package/lib/shared-tree/treeCheckout.d.ts +19 -13
  382. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  383. package/lib/shared-tree/treeCheckout.js +36 -53
  384. package/lib/shared-tree/treeCheckout.js.map +1 -1
  385. package/lib/shared-tree/unhydratedTreeContext.d.ts +5 -5
  386. package/lib/shared-tree/unhydratedTreeContext.d.ts.map +1 -1
  387. package/lib/shared-tree/unhydratedTreeContext.js.map +1 -1
  388. package/lib/shared-tree-core/editManager.d.ts +6 -3
  389. package/lib/shared-tree-core/editManager.d.ts.map +1 -1
  390. package/lib/shared-tree-core/editManager.js +36 -15
  391. package/lib/shared-tree-core/editManager.js.map +1 -1
  392. package/lib/shared-tree-core/editManagerCodecs.d.ts +3 -2
  393. package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  394. package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
  395. package/lib/shared-tree-core/editManagerCodecsCommons.d.ts +3 -9
  396. package/lib/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
  397. package/lib/shared-tree-core/editManagerCodecsCommons.js +3 -5
  398. package/lib/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
  399. package/lib/shared-tree-core/editManagerCodecsV1toV4.d.ts +3 -3
  400. package/lib/shared-tree-core/editManagerCodecsV1toV4.d.ts.map +1 -1
  401. package/lib/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -1
  402. package/lib/shared-tree-core/editManagerCodecsVSharedBranches.d.ts +3 -3
  403. package/lib/shared-tree-core/editManagerCodecsVSharedBranches.d.ts.map +1 -1
  404. package/lib/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
  405. package/lib/shared-tree-core/editManagerFormatCommons.d.ts +1 -1
  406. package/lib/shared-tree-core/editManagerFormatCommons.js +1 -1
  407. package/lib/shared-tree-core/editManagerFormatCommons.js.map +1 -1
  408. package/lib/shared-tree-core/editManagerFormatVSharedBranches.d.ts +1 -1
  409. package/lib/shared-tree-core/editManagerSummarizer.d.ts +5 -9
  410. package/lib/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
  411. package/lib/shared-tree-core/editManagerSummarizer.js +5 -10
  412. package/lib/shared-tree-core/editManagerSummarizer.js.map +1 -1
  413. package/lib/shared-tree-core/index.d.ts +1 -1
  414. package/lib/shared-tree-core/index.d.ts.map +1 -1
  415. package/lib/shared-tree-core/index.js +1 -1
  416. package/lib/shared-tree-core/index.js.map +1 -1
  417. package/lib/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -1
  418. package/lib/shared-tree-core/messageCodecVSharedBranches.js +8 -2
  419. package/lib/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
  420. package/lib/shared-tree-core/messageFormat.d.ts +1 -1
  421. package/lib/shared-tree-core/messageFormat.js +1 -1
  422. package/lib/shared-tree-core/messageFormat.js.map +1 -1
  423. package/lib/shared-tree-core/messageFormatVSharedBranches.d.ts +10 -1
  424. package/lib/shared-tree-core/messageFormatVSharedBranches.d.ts.map +1 -1
  425. package/lib/shared-tree-core/messageFormatVSharedBranches.js +1 -0
  426. package/lib/shared-tree-core/messageFormatVSharedBranches.js.map +1 -1
  427. package/lib/shared-tree-core/messageTypes.d.ts +1 -0
  428. package/lib/shared-tree-core/messageTypes.d.ts.map +1 -1
  429. package/lib/shared-tree-core/messageTypes.js.map +1 -1
  430. package/lib/shared-tree-core/sharedTreeCore.d.ts +9 -3
  431. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  432. package/lib/shared-tree-core/sharedTreeCore.js +28 -13
  433. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  434. package/lib/shared-tree-core/transaction.d.ts +84 -9
  435. package/lib/shared-tree-core/transaction.d.ts.map +1 -1
  436. package/lib/shared-tree-core/transaction.js +87 -6
  437. package/lib/shared-tree-core/transaction.js.map +1 -1
  438. package/lib/simple-tree/api/index.d.ts +2 -2
  439. package/lib/simple-tree/api/index.d.ts.map +1 -1
  440. package/lib/simple-tree/api/index.js +1 -1
  441. package/lib/simple-tree/api/index.js.map +1 -1
  442. package/lib/simple-tree/api/schemaCompatibilityTester.d.ts +9 -24
  443. package/lib/simple-tree/api/schemaCompatibilityTester.d.ts.map +1 -1
  444. package/lib/simple-tree/api/schemaCompatibilityTester.js +29 -42
  445. package/lib/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
  446. package/lib/simple-tree/api/schemaCreationUtilities.d.ts +3 -3
  447. package/lib/simple-tree/api/schemaCreationUtilities.js +3 -3
  448. package/lib/simple-tree/api/schemaCreationUtilities.js.map +1 -1
  449. package/lib/simple-tree/api/schemaFactory.d.ts +1 -1
  450. package/lib/simple-tree/api/schemaFactory.js +2 -2
  451. package/lib/simple-tree/api/schemaFactory.js.map +1 -1
  452. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +56 -15
  453. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  454. package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  455. package/lib/simple-tree/api/schemaFactoryBeta.d.ts +0 -3
  456. package/lib/simple-tree/api/schemaFactoryBeta.d.ts.map +1 -1
  457. package/lib/simple-tree/api/schemaFactoryBeta.js.map +1 -1
  458. package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts +2 -2
  459. package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -1
  460. package/lib/simple-tree/api/snapshotCompatibilityChecker.js +4 -5
  461. package/lib/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
  462. package/lib/simple-tree/api/storedSchema.d.ts.map +1 -1
  463. package/lib/simple-tree/api/storedSchema.js +2 -3
  464. package/lib/simple-tree/api/storedSchema.js.map +1 -1
  465. package/lib/simple-tree/api/transactionTypes.d.ts +91 -28
  466. package/lib/simple-tree/api/transactionTypes.d.ts.map +1 -1
  467. package/lib/simple-tree/api/transactionTypes.js.map +1 -1
  468. package/lib/simple-tree/api/tree.d.ts +108 -24
  469. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  470. package/lib/simple-tree/api/tree.js.map +1 -1
  471. package/lib/simple-tree/api/treeBeta.d.ts.map +1 -1
  472. package/lib/simple-tree/api/treeBeta.js.map +1 -1
  473. package/lib/simple-tree/api/typesUnsafe.d.ts +2 -2
  474. package/lib/simple-tree/api/typesUnsafe.d.ts.map +1 -1
  475. package/lib/simple-tree/api/typesUnsafe.js.map +1 -1
  476. package/lib/simple-tree/core/treeNodeSchema.d.ts +7 -7
  477. package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
  478. package/lib/simple-tree/index.d.ts +1 -1
  479. package/lib/simple-tree/index.d.ts.map +1 -1
  480. package/lib/simple-tree/index.js +1 -1
  481. package/lib/simple-tree/index.js.map +1 -1
  482. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts +83 -4
  483. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  484. package/lib/simple-tree/node-kinds/array/arrayNode.js +39 -0
  485. package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  486. package/lib/simple-tree/simpleSchemaFormatV1.js +1 -1
  487. package/lib/simple-tree/simpleSchemaFormatV1.js.map +1 -1
  488. package/lib/text/index.d.ts +1 -0
  489. package/lib/text/index.d.ts.map +1 -1
  490. package/lib/text/index.js +1 -0
  491. package/lib/text/index.js.map +1 -1
  492. package/lib/text/textDomainFormatted.d.ts +69 -758
  493. package/lib/text/textDomainFormatted.d.ts.map +1 -1
  494. package/lib/text/textDomainFormatted.js +277 -324
  495. package/lib/text/textDomainFormatted.js.map +1 -1
  496. package/lib/text/textDomainFormattedDefault.d.ts +273 -0
  497. package/lib/text/textDomainFormattedDefault.d.ts.map +1 -0
  498. package/lib/text/textDomainFormattedDefault.js +91 -0
  499. package/lib/text/textDomainFormattedDefault.js.map +1 -0
  500. package/lib/treeFactory.js +1 -1
  501. package/lib/treeFactory.js.map +1 -1
  502. package/lib/util/breakable.d.ts +16 -1
  503. package/lib/util/breakable.d.ts.map +1 -1
  504. package/lib/util/breakable.js +9 -1
  505. package/lib/util/breakable.js.map +1 -1
  506. package/lib/util/compressedIds.d.ts +185 -0
  507. package/lib/util/compressedIds.d.ts.map +1 -0
  508. package/lib/util/compressedIds.js +154 -0
  509. package/lib/util/compressedIds.js.map +1 -0
  510. package/lib/util/index.d.ts +2 -1
  511. package/lib/util/index.d.ts.map +1 -1
  512. package/lib/util/index.js +2 -1
  513. package/lib/util/index.js.map +1 -1
  514. package/lib/util/nestedMap.d.ts.map +1 -1
  515. package/lib/util/nestedMap.js +17 -4
  516. package/lib/util/nestedMap.js.map +1 -1
  517. package/lib/util/nestedSet.d.ts +1 -1
  518. package/lib/util/nestedSet.d.ts.map +1 -1
  519. package/lib/util/nestedSet.js.map +1 -1
  520. package/lib/util/utils.d.ts +0 -6
  521. package/lib/util/utils.d.ts.map +1 -1
  522. package/lib/util/utils.js +0 -13
  523. package/lib/util/utils.js.map +1 -1
  524. package/package.json +23 -23
  525. package/src/componentApi.ts +354 -0
  526. package/src/core/change-family/changeFamily.ts +3 -12
  527. package/src/core/rebase/types.ts +2 -2
  528. package/src/core/schema-stored/storedSchemaRepository.ts +2 -2
  529. package/src/entrypoints/alpha.ts +15 -8
  530. package/src/entrypoints/beta.ts +8 -0
  531. package/src/entrypoints/legacy.ts +8 -0
  532. package/src/feature-libraries/chunked-forest/codec/chunkDecoding.ts +22 -72
  533. package/src/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.ts +1 -2
  534. package/src/feature-libraries/chunked-forest/codec/codecs.ts +110 -41
  535. package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +32 -4
  536. package/src/feature-libraries/chunked-forest/codec/index.ts +1 -0
  537. package/src/feature-libraries/chunked-forest/codec/nodeEncoder.ts +7 -19
  538. package/src/feature-libraries/chunked-forest/index.ts +3 -0
  539. package/src/feature-libraries/forest-summary/codec.ts +5 -3
  540. package/src/feature-libraries/forest-summary/forestSummarizer.ts +4 -5
  541. package/src/feature-libraries/index.ts +5 -0
  542. package/src/feature-libraries/modular-schema/index.ts +1 -0
  543. package/src/feature-libraries/modular-schema/minimizeModularChange.ts +33 -0
  544. package/src/feature-libraries/modular-schema/modularChangeCodecV1.ts +13 -9
  545. package/src/feature-libraries/schemaChecker.ts +86 -9
  546. package/src/index.ts +16 -8
  547. package/src/packageVersion.ts +1 -1
  548. package/src/shared-tree/independentView.ts +40 -15
  549. package/src/shared-tree/index.ts +4 -0
  550. package/src/shared-tree/schematizingTreeView.ts +40 -30
  551. package/src/shared-tree/serializedChange.ts +127 -0
  552. package/src/shared-tree/sharedTree.ts +32 -4
  553. package/src/shared-tree/sharedTreeChangeFamily.ts +7 -1
  554. package/src/shared-tree/transactionMinimize.ts +74 -0
  555. package/src/shared-tree/transactionPostProcessor.ts +40 -0
  556. package/src/shared-tree/treeAlpha.ts +3 -3
  557. package/src/shared-tree/treeCheckout.ts +103 -101
  558. package/src/shared-tree/unhydratedTreeContext.ts +18 -15
  559. package/src/shared-tree-core/editManager.ts +42 -6
  560. package/src/shared-tree-core/editManagerCodecs.ts +3 -2
  561. package/src/shared-tree-core/editManagerCodecsCommons.ts +10 -14
  562. package/src/shared-tree-core/editManagerCodecsV1toV4.ts +3 -2
  563. package/src/shared-tree-core/editManagerCodecsVSharedBranches.ts +3 -2
  564. package/src/shared-tree-core/editManagerFormatCommons.ts +1 -1
  565. package/src/shared-tree-core/editManagerSummarizer.ts +5 -9
  566. package/src/shared-tree-core/index.ts +8 -5
  567. package/src/shared-tree-core/messageCodecVSharedBranches.ts +8 -1
  568. package/src/shared-tree-core/messageFormat.ts +1 -1
  569. package/src/shared-tree-core/messageFormatVSharedBranches.ts +10 -0
  570. package/src/shared-tree-core/messageTypes.ts +1 -0
  571. package/src/shared-tree-core/sharedTreeCore.ts +36 -12
  572. package/src/shared-tree-core/transaction.ts +165 -18
  573. package/src/simple-tree/api/index.ts +14 -10
  574. package/src/simple-tree/api/schemaCompatibilityTester.ts +36 -48
  575. package/src/simple-tree/api/schemaCreationUtilities.ts +3 -3
  576. package/src/simple-tree/api/schemaFactory.ts +2 -2
  577. package/src/simple-tree/api/schemaFactoryAlpha.ts +56 -15
  578. package/src/simple-tree/api/schemaFactoryBeta.ts +0 -3
  579. package/src/simple-tree/api/snapshotCompatibilityChecker.ts +4 -5
  580. package/src/simple-tree/api/storedSchema.ts +2 -3
  581. package/src/simple-tree/api/transactionTypes.ts +111 -39
  582. package/src/simple-tree/api/tree.ts +165 -49
  583. package/src/simple-tree/api/treeBeta.ts +2 -0
  584. package/src/simple-tree/api/typesUnsafe.ts +2 -1
  585. package/src/simple-tree/core/treeNodeSchema.ts +7 -7
  586. package/src/simple-tree/index.ts +13 -9
  587. package/src/simple-tree/node-kinds/array/arrayNode.ts +168 -4
  588. package/src/simple-tree/simpleSchemaFormatV1.ts +1 -1
  589. package/src/text/index.ts +1 -0
  590. package/src/text/textDomainFormatted.ts +520 -415
  591. package/src/text/textDomainFormattedDefault.ts +150 -0
  592. package/src/treeFactory.ts +1 -1
  593. package/src/util/breakable.ts +8 -1
  594. package/src/util/compressedIds.ts +304 -0
  595. package/src/util/index.ts +18 -1
  596. package/src/util/nestedMap.ts +21 -4
  597. package/src/util/nestedSet.ts +1 -1
  598. package/src/util/utils.ts +0 -18
@@ -0,0 +1,354 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ import { UsageError } from "@fluidframework/telemetry-utils/internal";
7
+
8
+ import { getOrCreate } from "./util/index.js";
9
+
10
+ /**
11
+ * Utilities for composing application "components" which contribute to a shared configuration.
12
+ *
13
+ * @remarks
14
+ * Nothing in this namespace is specific to tree schema,
15
+ * however it is designed to be able to handle the needs of components which work with {@link TreeSchema}.
16
+ *
17
+ * This is mainly used to implement "open polymorphism", where the set of allowed types
18
+ * for a field or collection can be extended by independently authored libraries (components) instead of being
19
+ * fixed up front.
20
+ *
21
+ * This basically amounts to dependency injection, where the "injection" is done at "composition" time to build the schema.
22
+ *
23
+ * Tree's schema do not natively support open polymorphism: all possible implementations must be explicitly listed.
24
+ * These tools work around these limitations by carefully controlling evaluation order:
25
+ * the source code can be structured in an open polymorphism style which at runtime evaluates into closed polymorphism
26
+ * by having each component register its implementations into a central collection (typically an
27
+ * {@link AllowedTypes} array).
28
+ *
29
+ * Each component is expressed as a {@link Component.Factory}: a function which receives a lazy reference to the
30
+ * composed configuration and returns the content that component contributes.
31
+ * Because the configuration is provided lazily, components may reference (including recursively) types contributed by
32
+ * other components, as long as nothing evaluates the lazy references until composition has completed.
33
+ * Use {@link Component.(compose:1)} to combine a set of components into a {@link Component.Composed}.
34
+ *
35
+ * See {@link https://github.com/microsoft/FluidFramework/blob/main/packages/dds/tree/src/test/openPolymorphism.integration.ts|openPolymorphism.integration.ts} for worked examples of this pattern.
36
+ *
37
+ * @privateRemarks
38
+ * The examples and integration tests for this pattern live in `openPolymorphism.integration.ts`.
39
+ * Those tests and the docs here should be kept in sync.
40
+ *
41
+ * @alpha
42
+ */
43
+ export namespace Component {
44
+ /**
45
+ * A function which takes in a lazy configuration and returns the content a component contributes.
46
+ *
47
+ * @remarks
48
+ * The lazy configuration allows the component to reference items from the composed configuration, which can
49
+ * include items the component itself contributes (allowing recursive references between components).
50
+ *
51
+ * The execution of the factory must not evaluate `lazyConfiguration` (doing so will error):
52
+ * instead the returned `TComponent` can capture `lazyConfiguration` and evaluate it at a later time
53
+ * (after all components have been composed).
54
+ *
55
+ * @typeParam TComponent - The content a component contributes.
56
+ * @typeParam TConfig - The composed configuration type made available to components.
57
+ * Defaults to the {@link Component.Composed} produced by composition: the common case where
58
+ * components read composed content directly from the composition and no custom configuration type is needed.
59
+ *
60
+ * @input
61
+ * @alpha
62
+ */
63
+ export type Factory<TComponent, TConfig = ComposedDefault<TComponent>> = (
64
+ lazyConfiguration: () => TConfig,
65
+ ) => TComponent;
66
+
67
+ /**
68
+ * A function which returns an array of lazy values which each evaluate to `T`.
69
+ *
70
+ * @remarks
71
+ * This mirrors the shape of {@link AllowedTypes} where all of the values are lazy:
72
+ * the outer function and inner functions defer evaluation until after composition is complete.
73
+ *
74
+ * @typeParam T - The type each lazy value evaluates to.
75
+ *
76
+ * @alpha
77
+ */
78
+ export type LazyArray<T> = () => readonly (() => T)[];
79
+
80
+ /**
81
+ * Wrap a 0 argument function to cache the result.
82
+ * @remarks
83
+ * Do not use for impure functions.
84
+ *
85
+ * Generally {@link Component} utilities have built in caching in most cases,
86
+ * but this is occasionally helpful when manually implementing laziness.
87
+ *
88
+ * Note that this takes a different approach than use in {@link evaluateLazySchema} where the function evaluation is done using a utility that adds caching.
89
+ *
90
+ * @param factory - The factory function to memoize.
91
+ * @returns A function that returns the cached result of the factory.
92
+ * @alpha
93
+ */
94
+ export const memoize = <T>(factory: () => T): (() => T) => {
95
+ let run = false;
96
+ let cached: T;
97
+ return () => {
98
+ if (!run) {
99
+ cached = factory();
100
+ run = true;
101
+ }
102
+ return cached;
103
+ };
104
+ };
105
+
106
+ /**
107
+ * An item which can be configured (evaluated) against a composed configuration to produce a result.
108
+ *
109
+ * @remarks
110
+ * Use {@link Component.Composed.getConfigured} to evaluate a `Configurable`.
111
+ * The result is cached, so a given `Configurable` is only evaluated once per composition.
112
+ *
113
+ * @typeParam TConfigPartial - The configuration type made available when configuring.
114
+ * @typeParam TResult - The result produced by configuring.
115
+ * @typeParam TComponent - The content components contribute.
116
+ *
117
+ * @alpha
118
+ */
119
+ export interface Configurable<TConfigPartial, out TResult, TComponent> {
120
+ /**
121
+ * Produce the configured result.
122
+ * @param config - The composed configuration.
123
+ * @param components - The composed components.
124
+ */
125
+ configure(
126
+ config: TConfigPartial,
127
+ components: Composed<TComponent, TConfigPartial>,
128
+ ): TResult;
129
+ }
130
+
131
+ /**
132
+ * Implementation of {@link Component.Composed}.
133
+ */
134
+ class Config<TConfig, TComponent> implements Composed<TComponent, TConfig> {
135
+ public readonly componentsMap: ReadonlyMap<Factory<TComponent, TConfig>, TComponent>;
136
+
137
+ /**
138
+ * Cache of results produced by {@link Component.Composed.getConfigured}.
139
+ *
140
+ * @remarks
141
+ * Maps each {@link Component.Configurable} to the result of evaluating it against this composition.
142
+ * This ensures a given `Configurable` is only configured once: subsequent lookups return the cached result.
143
+ */
144
+ private readonly evaluatedMap: Map<Configurable<TConfig, unknown, TComponent>, unknown> =
145
+ new Map();
146
+
147
+ /**
148
+ * Cache of results produced by {@link Component.Composed.getComposed}.
149
+ *
150
+ * @remarks
151
+ * Maps each composed property to the array produced for it.
152
+ * This ensures a given property is only composed once: subsequent lookups return the same array
153
+ * (including the same lazy values), so repeated calls with the same property are reference-stable.
154
+ */
155
+ private readonly composedMap: Map<keyof TComponent, readonly unknown[]> = new Map();
156
+
157
+ public readonly components: readonly TComponent[];
158
+
159
+ public readonly config: TConfig;
160
+
161
+ public constructor(
162
+ allComponents: readonly Factory<TComponent, TConfig>[],
163
+ lazyConfiguration: (composed: Composed<TComponent, TConfig>) => TConfig,
164
+ ) {
165
+ // eslint-disable-next-line no-undef-init -- Explicitly undefined: `config` is populated below, after all components have been constructed, and is read lazily via `lazyConfigInner`.
166
+ let config: TConfig | undefined = undefined;
167
+ const lazyConfigInner = (): TConfig => {
168
+ if (config === undefined) {
169
+ throw new UsageError(
170
+ "Configuration not yet available: components must not evaluate the lazy configuration during composition.",
171
+ );
172
+ }
173
+ return config;
174
+ };
175
+ this.componentsMap = new Map(allComponents.map((c) => [c, c(lazyConfigInner)]));
176
+ this.components = [...this.componentsMap.values()];
177
+ config = lazyConfiguration(this);
178
+ this.config = config;
179
+ }
180
+
181
+ public getComponent<TFactory extends Factory<TComponent, TConfig>>(
182
+ factory: TFactory,
183
+ ): ReturnType<TFactory> {
184
+ const found = this.componentsMap.get(factory);
185
+ if (found === undefined) {
186
+ throw new UsageError("Requested component not included in this configuration");
187
+ }
188
+ return found as ReturnType<TFactory>;
189
+ }
190
+
191
+ public getConfigured<TConfigurable extends Configurable<TConfig, unknown, TComponent>>(
192
+ configurable: TConfigurable,
193
+ ): ReturnType<TConfigurable["configure"]> {
194
+ const configured: unknown = getOrCreate(this.evaluatedMap, configurable, (c) => {
195
+ const result = c.configure(this.config, this);
196
+ if (result === undefined) {
197
+ throw new UsageError("Configurable must not return undefined");
198
+ }
199
+ return result;
200
+ });
201
+ return configured as ReturnType<TConfigurable["configure"]>;
202
+ }
203
+
204
+ public getComposed<
205
+ TKey extends keyof {
206
+ [Property in keyof TComponent as TComponent[Property] extends
207
+ | LazyArray<unknown>
208
+ | undefined
209
+ ? Property
210
+ : never]: boolean;
211
+ },
212
+ >(
213
+ property: TKey,
214
+ ): readonly (Exclude<TComponent[TKey], undefined> extends LazyArray<infer U>
215
+ ? () => U
216
+ : never)[] {
217
+ const result = getOrCreate(this.composedMap, property, () =>
218
+ this.components.flatMap((c) => {
219
+ const prop = c[property] as LazyArray<unknown> | undefined;
220
+ if (prop === undefined) {
221
+ return [];
222
+ }
223
+ return prop();
224
+ }),
225
+ );
226
+ return result as (Exclude<TComponent[TKey], undefined> extends LazyArray<infer U>
227
+ ? () => U
228
+ : never)[];
229
+ }
230
+ }
231
+
232
+ /**
233
+ * Combine multiple {@link Component.Factory|components} into a single {@link Component.Composed}.
234
+ *
235
+ * @remarks
236
+ * The {@link Component.Composed} itself is used as the configuration made available to components:
237
+ * the simple case where components read composed content directly from the composition.
238
+ * To produce a custom aggregated configuration, use the overload which takes a `lazyConfiguration` builder.
239
+ *
240
+ * @param allComponents - The components to compose.
241
+ * @returns The composed components, from which configuration and per-component content can be read.
242
+ *
243
+ * @typeParam TComponent - The content each component contributes.
244
+ *
245
+ * @alpha
246
+ */
247
+ export function compose<TComponent>(
248
+ allComponents: readonly Factory<TComponent>[],
249
+ ): Composed<TComponent>;
250
+ /**
251
+ * Combine multiple {@link Component.Factory|components} into a single {@link Component.Composed}.
252
+ *
253
+ * @param allComponents - The components to compose.
254
+ * @param lazyConfiguration - Builds the composed configuration from the composed components.
255
+ * This is invoked once, after all components have been created, and can aggregate content contributed by the
256
+ * components (for example via {@link Component.Composed.getComposed}).
257
+ * @returns The composed components, from which configuration and per-component content can be read.
258
+ *
259
+ * @typeParam TComponent - The content each component contributes.
260
+ * @typeParam TConfig - The composed configuration type made available to components.
261
+ *
262
+ * @alpha
263
+ */
264
+ export function compose<TComponent, TConfig>(
265
+ allComponents: readonly Factory<TComponent, TConfig>[],
266
+ lazyConfiguration: (composed: Composed<TComponent, TConfig>) => TConfig,
267
+ ): Composed<TComponent, TConfig>;
268
+ export function compose<TComponent, TConfig>(
269
+ allComponents: readonly Factory<TComponent, TConfig>[],
270
+ lazyConfiguration: (composed: Composed<TComponent, TConfig>) => TConfig = (composed) =>
271
+ composed as unknown as TConfig,
272
+ ): Composed<TComponent, TConfig> {
273
+ return new Config<TConfig, TComponent>(allComponents, lazyConfiguration);
274
+ }
275
+
276
+ /**
277
+ * The default configuration type for a composition.
278
+ * Also the type of Composed when using the default composition.
279
+ * @privateRemarks
280
+ * Declaring this as its own type makes the recursion possible instead of having to list the config parameter as unknown.
281
+ * This makes it easier to understand what is going on when seeing this type in the intellisense.
282
+ * @sealed @alpha
283
+ */
284
+ export type ComposedDefault<TComponent> = Composed<TComponent, ComposedDefault<TComponent>>;
285
+
286
+ /**
287
+ * The result of composing multiple components.
288
+ *
289
+ * @remarks
290
+ * Create using {@link Component.(compose:1)}.
291
+ *
292
+ * @typeParam TComponent - The content each component contributes.
293
+ * @typeParam TConfig - The composed configuration type made available to components.
294
+ * Defaults to the composition itself: the common case where no custom configuration type is needed.
295
+ *
296
+ * @sealed @alpha
297
+ */
298
+ export interface Composed<TComponent, TConfig = ComposedDefault<TComponent>> {
299
+ /**
300
+ * The components which were composed.
301
+ */
302
+ readonly components: readonly TComponent[];
303
+
304
+ /**
305
+ * The configuration which was produced when composing.
306
+ */
307
+ readonly config: TConfig;
308
+
309
+ /**
310
+ * Get a component by its factory.
311
+ *
312
+ * @param factory - The factory used to look up the component. Must have been provided when composing.
313
+ * @returns The content created by the provided factory.
314
+ * This result is cached during composition and not reevaluated.
315
+ */
316
+ getComponent<TFactory extends Factory<TComponent, TConfig>>(
317
+ factory: TFactory,
318
+ ): ReturnType<TFactory>;
319
+
320
+ /**
321
+ * Configure a {@link Component.Configurable}.
322
+ * @remarks
323
+ * The result is cached when first evaluated, so subsequent calls with the same `configurable` return the
324
+ * same result.
325
+ * @param configurable - The item to configure against this composition.
326
+ */
327
+ getConfigured<TConfigurable extends Configurable<TConfig, unknown, TComponent>>(
328
+ configurable: TConfigurable,
329
+ ): ReturnType<TConfigurable["configure"]>;
330
+
331
+ /**
332
+ * Compose the contents of a {@link Component.LazyArray} property from all components.
333
+ * @remarks
334
+ * The result is cached when first evaluated, so subsequent calls with the same `property` return the
335
+ * same result.
336
+ * @param property - The property of the components to compose.
337
+ * @returns The concatenation of the lazy values contributed by each component for `property`.
338
+ * Components which omit the property contribute nothing.
339
+ */
340
+ getComposed<
341
+ TKey extends keyof {
342
+ [Property in keyof TComponent as TComponent[Property] extends
343
+ | LazyArray<unknown>
344
+ | undefined
345
+ ? Property
346
+ : never]: boolean;
347
+ },
348
+ >(
349
+ property: TKey,
350
+ ): readonly (Exclude<TComponent[TKey], undefined> extends LazyArray<infer U>
351
+ ? () => U
352
+ : never)[];
353
+ }
354
+ }
@@ -7,9 +7,7 @@ import type { IIdCompressor, SessionId } from "@fluidframework/id-compressor";
7
7
 
8
8
  import type { ICodecFamily, IJsonCodec } from "../../codec/index.js";
9
9
  import type { SchemaAndPolicy } from "../../core/index.js";
10
- // eslint-disable-next-line @typescript-eslint/no-unused-vars -- Referenced by doc comments
11
- import type { FieldBatchEncodingContext } from "../../feature-libraries/index.js";
12
- import type { JsonCompatibleReadOnly } from "../../util/index.js";
10
+ import type { IdentifierHealingConfig, JsonCompatibleReadOnly } from "../../util/index.js";
13
11
  import type { ChangeRebaser, RevisionTag, TaggedChange } from "../rebase/index.js";
14
12
 
15
13
  export interface ChangeFamily<TEditor extends ChangeFamilyEditor, TChange> {
@@ -39,17 +37,10 @@ export interface ChangeEncodingContext {
39
37
  */
40
38
  readonly isSummary: boolean;
41
39
  /**
42
- * If `true`, identifier values that the local id-compressor cannot resolve
43
- * during decode are healed into deterministic stable UUIDs instead of
44
- * throwing. See {@link FieldBatchEncodingContext.healUnresolvableIdentifiersOnDecode}.
40
+ * Heal-on-decode workaround configuration. See {@link IdentifierHealingConfig}.
45
41
  * Only takes effect when `isSummary` is also `true`.
46
42
  */
47
- readonly healUnresolvableIdentifiersOnDecode?: boolean;
48
- /**
49
- * The SharedTree's shared-object id, used as input to the deterministic
50
- * UUID derivation when {@link healUnresolvableIdentifiersOnDecode} triggers.
51
- */
52
- readonly sharedObjectId?: string;
43
+ readonly healing?: IdentifierHealingConfig;
53
44
  }
54
45
 
55
46
  export type ChangeFamilyCodec<TChange> = IJsonCodec<
@@ -236,7 +236,7 @@ export interface LocalChangeMetadata extends CommitMetadata {
236
236
  readonly label?: unknown;
237
237
 
238
238
  /**
239
- * A set of {@link RunTransactionParams.label | labels} for all transactions (nested or otherwise)
239
+ * A set of {@link RunTransactionParamsBeta.label | labels} for all transactions (nested or otherwise)
240
240
  * that made up this change.
241
241
  * This can be used to identify, group, or filter changes — for example, to decide whether a change
242
242
  * should be included in an undo/redo stack.
@@ -278,7 +278,7 @@ export interface LocalChangeMetadata extends CommitMetadata {
278
278
  *
279
279
  * @remarks
280
280
  * Each transaction contributes a node whose {@link LabelTree.label} is its
281
- * {@link RunTransactionParams.label | label} (or `undefined` if no label was provided).
281
+ * {@link RunTransactionParamsBeta.label | label} (or `undefined` if no label was provided).
282
282
  * When transactions are nested, inner transaction nodes become {@link LabelTree.sublabels | sublabels}
283
283
  * of outer ones.
284
284
  *
@@ -51,8 +51,8 @@ export interface TreeStoredSchemaSubscription extends TreeStoredSchema {
51
51
  export interface MutableTreeStoredSchema extends TreeStoredSchemaSubscription {
52
52
  /**
53
53
  * Mutates the stored schema.
54
- * Replaces all schema with the provided schema.
55
- * Can over-write preexisting schema, and removes unmentioned schema.
54
+ * Replaces all schemas with the provided schema.
55
+ * Can overwrite preexisting schemas, and removes unmentioned schemas.
56
56
  */
57
57
  apply(newSchema: TreeStoredSchema): void;
58
58
  }
@@ -120,6 +120,7 @@ export {
120
120
  ObjectSchemaOptions,
121
121
  PopUnion,
122
122
  RecordNodeInsertableData,
123
+ RunTransactionParamsBeta,
123
124
  SchemaFactoryBeta,
124
125
  SchemaStaticsBeta,
125
126
  SchemaUpgrade,
@@ -128,6 +129,11 @@ export {
128
129
  SnapshotSchemaCompatibilityOptions,
129
130
  System_TableSchema,
130
131
  TableSchema,
132
+ TransactionCallbackStatusBeta,
133
+ TransactionResultFailed,
134
+ TransactionResultSuccess,
135
+ TransactionValueResult,
136
+ TransactionVoidResult,
131
137
  TreeBeta,
132
138
  TreeBranch,
133
139
  TreeChangeEventsBeta,
@@ -142,6 +148,8 @@ export {
142
148
  UnannotateAllowedTypesList,
143
149
  UnannotateAllowedTypesListUnsafe,
144
150
  UnionToTuple,
151
+ VoidTransactionCallbackStatusBeta,
152
+ WithValue,
145
153
  adaptEnum,
146
154
  asBeta,
147
155
  configuredSharedTreeBeta,
@@ -170,6 +178,7 @@ export {
170
178
  ChangeMetadata,
171
179
  CodecName,
172
180
  CodecWriteOptions,
181
+ Component,
173
182
  CreateIndependentTreeAlphaOptions,
174
183
  DirtyTreeMap,
175
184
  DirtyTreeStatus,
@@ -193,6 +202,7 @@ export {
193
202
  ITreeAlpha,
194
203
  IncrementalEncodingPolicy,
195
204
  IndependentViewOptions,
205
+ IndependentViewTelemetryOptions,
196
206
  Insertable,
197
207
  InsertableContent,
198
208
  InsertableField,
@@ -241,7 +251,7 @@ export {
241
251
  RemoteChangeMetadata,
242
252
  RevertibleAlpha,
243
253
  RevertibleAlphaFactory,
244
- RunTransactionParams,
254
+ RunTransactionParamsAlpha,
245
255
  SchemaFactoryAlpha,
246
256
  SchemaStaticsAlpha,
247
257
  SchemaType,
@@ -259,13 +269,10 @@ export {
259
269
  SimpleRecordNodeSchema,
260
270
  SimpleTreeSchema,
261
271
  TextAsTree,
262
- TransactionCallbackStatus,
272
+ TransactionCallbackStatusAlpha,
263
273
  TransactionConstraintAlpha,
264
274
  TransactionLabels,
265
- TransactionResult,
266
- TransactionResultExt,
267
- TransactionResultFailed,
268
- TransactionResultSuccess,
275
+ TransactionPostProcessor,
269
276
  TreeAlpha,
270
277
  TreeArrayNodeAlpha,
271
278
  TreeBranchAlpha,
@@ -285,8 +292,7 @@ export {
285
292
  VerboseTree,
286
293
  VerboseTreeNode,
287
294
  ViewContent,
288
- VoidTransactionCallbackStatus,
289
- WithValue,
295
+ VoidTransactionCallbackStatusAlpha,
290
296
  allowUnused,
291
297
  asAlpha,
292
298
  asTreeViewAlpha,
@@ -312,6 +318,7 @@ export {
312
318
  incrementalSummaryHint,
313
319
  independentInitializedView,
314
320
  independentView,
321
+ minimize,
315
322
  normalizeAllowedTypes,
316
323
  persistedToSimpleSchema,
317
324
  replaceConciseTreeHandles,
@@ -120,6 +120,7 @@ export {
120
120
  ObjectSchemaOptions,
121
121
  PopUnion,
122
122
  RecordNodeInsertableData,
123
+ RunTransactionParamsBeta,
123
124
  SchemaFactoryBeta,
124
125
  SchemaStaticsBeta,
125
126
  SchemaUpgrade,
@@ -128,6 +129,11 @@ export {
128
129
  SnapshotSchemaCompatibilityOptions,
129
130
  System_TableSchema,
130
131
  TableSchema,
132
+ TransactionCallbackStatusBeta,
133
+ TransactionResultFailed,
134
+ TransactionResultSuccess,
135
+ TransactionValueResult,
136
+ TransactionVoidResult,
131
137
  TreeBeta,
132
138
  TreeBranch,
133
139
  TreeChangeEventsBeta,
@@ -142,6 +148,8 @@ export {
142
148
  UnannotateAllowedTypesList,
143
149
  UnannotateAllowedTypesListUnsafe,
144
150
  UnionToTuple,
151
+ VoidTransactionCallbackStatusBeta,
152
+ WithValue,
145
153
  adaptEnum,
146
154
  asBeta,
147
155
  configuredSharedTreeBeta,
@@ -120,6 +120,7 @@ export {
120
120
  ObjectSchemaOptions,
121
121
  PopUnion,
122
122
  RecordNodeInsertableData,
123
+ RunTransactionParamsBeta,
123
124
  SchemaFactoryBeta,
124
125
  SchemaStaticsBeta,
125
126
  SchemaUpgrade,
@@ -128,6 +129,11 @@ export {
128
129
  SnapshotSchemaCompatibilityOptions,
129
130
  System_TableSchema,
130
131
  TableSchema,
132
+ TransactionCallbackStatusBeta,
133
+ TransactionResultFailed,
134
+ TransactionResultSuccess,
135
+ TransactionValueResult,
136
+ TransactionVoidResult,
131
137
  TreeBeta,
132
138
  TreeBranch,
133
139
  TreeChangeEventsBeta,
@@ -142,6 +148,8 @@ export {
142
148
  UnannotateAllowedTypesList,
143
149
  UnannotateAllowedTypesListUnsafe,
144
150
  UnionToTuple,
151
+ VoidTransactionCallbackStatusBeta,
152
+ WithValue,
145
153
  adaptEnum,
146
154
  asBeta,
147
155
  configuredSharedTreeBeta,
@@ -5,12 +5,9 @@
5
5
 
6
6
  import { assert, unreachableCase, oob } from "@fluidframework/core-utils/internal";
7
7
  import type {
8
- IIdCompressor,
9
8
  OpSpaceCompressedId,
10
- SessionId,
9
+ SessionSpaceCompressedId,
11
10
  } from "@fluidframework/id-compressor";
12
- import { isFinalId } from "@fluidframework/id-compressor/internal";
13
- import { v5 as uuidV5 } from "uuid";
14
11
 
15
12
  import { DiscriminatedUnionDispatcher } from "../../../codec/index.js";
16
13
  import type {
@@ -19,7 +16,12 @@ import type {
19
16
  Value,
20
17
  TreeChunk,
21
18
  } from "../../../core/index.js";
22
- import { assertValidIndex, brand } from "../../../util/index.js";
19
+ import {
20
+ assertValidIndex,
21
+ brand,
22
+ decompressIdentifierIfNeeded,
23
+ type IdDecodingContext,
24
+ } from "../../../util/index.js";
23
25
  import { BasicChunk } from "../basicChunk.js";
24
26
  import { emptyChunk } from "../emptyChunk.js";
25
27
  import { SequenceChunk } from "../sequenceChunk.js";
@@ -39,8 +41,7 @@ import {
39
41
  decode as genericDecode,
40
42
  readStreamIdentifier,
41
43
  } from "./chunkDecodingGeneric.js";
42
- // eslint-disable-next-line @typescript-eslint/no-unused-vars -- Referenced by doc comments
43
- import type { FieldBatchEncodingContext, IncrementalDecoder } from "./codecs.js";
44
+ import type { IncrementalDecoder } from "./codecs.js";
44
45
  import {
45
46
  type EncodedAnyShape,
46
47
  type EncodedChunkShape,
@@ -58,32 +59,6 @@ import {
58
59
  supportsIncrementalEncoding,
59
60
  } from "./format/index.js";
60
61
 
61
- export interface IdDecodingContext {
62
- idCompressor: IIdCompressor;
63
- /**
64
- * The creator of any local Ids to be decoded.
65
- */
66
- originatorId: SessionId;
67
- /**
68
- * {@inheritdoc FieldBatchEncodingContext.isSummary}
69
- */
70
- isSummary: boolean;
71
- /**
72
- * See {@link FieldBatchEncodingContext.healUnresolvableIdentifiersOnDecode}.
73
- */
74
- healUnresolvableIdentifiersOnDecode?: boolean;
75
- /**
76
- * See {@link FieldBatchEncodingContext.sharedObjectId}.
77
- */
78
- sharedObjectId?: string;
79
- }
80
-
81
- /**
82
- * Random v4 UUID generated as a namespace for the "heal an unresolvable identifier into a stable UUID"
83
- * path in {@link readValue}. This scheme requires consensus across all clients to function.
84
- */
85
- const healingNamespace = "f8a89df3-6882-400f-b913-4c1f6f0157bd";
86
-
87
62
  /**
88
63
  * Decode `chunk` into a TreeChunk.
89
64
  */
@@ -281,45 +256,20 @@ export function readValue(
281
256
  typeof streamValue === "number" || typeof streamValue === "string",
282
257
  0x997 /* identifier must be string or number. */,
283
258
  );
284
- if (typeof streamValue === "string") {
285
- return streamValue;
286
- }
287
- const idCompressor = idDecodingContext.idCompressor;
288
- // OpSpaceCompressedIds are negative, and require a session-id to compute their value.
289
- // Due to a bug, we have some special casing for them (see below).
290
- if (
291
- idDecodingContext.isSummary === true &&
292
- !isFinalId(streamValue as OpSpaceCompressedId)
293
- ) {
294
- if (
295
- idDecodingContext.healUnresolvableIdentifiersOnDecode === true &&
296
- idDecodingContext.sharedObjectId !== undefined
297
- ) {
298
- // Documents written before the encode-side fix for non-finalized identifier
299
- // values can persist negative op-space IDs that are no
300
- // longer resolvable once the originating session's local state has been stripped.
301
- // When loading such a summary with the heal-on-decode option on, synthesize a deterministic
302
- // stable UUID so all readers of the same blob agree on the resulting value.
303
- //
304
- // The heal path is intentionally restricted to summary loads — an
305
- // unresolvable ID encountered while applying an op should still surface as
306
- // an error, since it indicates a real bug rather than a recoverable state.
307
- return uuidV5(
308
- `${idDecodingContext.sharedObjectId}|${streamValue}`,
309
- healingNamespace,
310
- );
311
- }
312
- // See `SharedTreeOptionsBeta.healUnresolvableIdentifiersOnDecode` for details on this error.
313
- throw new Error(
314
- "Summary could not be loaded due incorrectly encoded identifier. See SharedTreeOptionsBeta.healUnresolvableIdentifiersOnDecode for mitigation.",
315
- );
316
- }
317
- return idCompressor.decompress(
318
- idCompressor.normalizeToSessionSpace(
319
- streamValue as OpSpaceCompressedId,
320
- idDecodingContext.originatorId,
321
- ),
322
- );
259
+ // Strings (StableId UUIDs, heal-synthesized v5 UUIDs, or arbitrary user
260
+ // identifier strings) are already in the stored form and pass through.
261
+ // Op-space compressed ids are resolved by the caller-supplied
262
+ // `resolveEncodedId`, which encapsulates the originator lookup, finalized-id
263
+ // normalization, and (for the forest summarizer's heal path) UUIDv5 synthesis.
264
+ const sessionIdOrString: SessionSpaceCompressedId | string =
265
+ typeof streamValue === "string"
266
+ ? streamValue
267
+ : idDecodingContext.resolveEncodedId(streamValue as OpSpaceCompressedId);
268
+ // Performance:
269
+ // Currently, we just fully expand the identifier here rather than keeping it in the SessionSpaceCompressedId format.
270
+ // Avoiding this expansion, and keeping the in memory format using SessionSpaceCompressedId would be a good optimization for the future.
271
+ // Keeping this optimization possible is why `resolveEncodedId` doesn't simply return a string.
272
+ return decompressIdentifierIfNeeded(sessionIdOrString, idDecodingContext.idCompressor);
323
273
  } else {
324
274
  // EncodedCounter case:
325
275
  unreachableCase(shape, "decoding values as deltas is not yet supported");