@fluidframework/tree 2.117.0 → 3.0.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 (1275) hide show
  1. package/CHANGELOG.md +385 -7
  2. package/README.md +55 -52
  3. package/{api-extractor.json → api-extractor/api-extractor-model.json} +1 -1
  4. package/api-report/tree.alpha.api.md +174 -146
  5. package/api-report/tree.beta.api.md +160 -91
  6. package/api-report/tree.legacy.beta.api.md +160 -91
  7. package/api-report/tree.legacy.public.api.md +26 -43
  8. package/api-report/tree.public.api.md +26 -43
  9. package/dist/api.d.ts +9 -1
  10. package/dist/api.d.ts.map +1 -1
  11. package/dist/api.js +2 -3
  12. package/dist/api.js.map +1 -1
  13. package/dist/codec/codec.d.ts +2 -2
  14. package/dist/codec/codec.d.ts.map +1 -1
  15. package/dist/codec/codec.js +9 -7
  16. package/dist/codec/codec.js.map +1 -1
  17. package/dist/codec/discriminatedUnions.js +1 -0
  18. package/dist/codec/discriminatedUnions.js.map +1 -1
  19. package/dist/codec/versioned/codec.d.ts.map +1 -1
  20. package/dist/codec/versioned/codec.js +4 -2
  21. package/dist/codec/versioned/codec.js.map +1 -1
  22. package/dist/componentApi.d.ts.map +1 -1
  23. package/dist/componentApi.js +20 -17
  24. package/dist/componentApi.js.map +1 -1
  25. package/dist/core/change-family/editBuilder.js +1 -0
  26. package/dist/core/change-family/editBuilder.js.map +1 -1
  27. package/dist/core/forest/editableForest.js +1 -2
  28. package/dist/core/forest/editableForest.js.map +1 -1
  29. package/dist/core/forest/forest.js +3 -3
  30. package/dist/core/forest/forest.js.map +1 -1
  31. package/dist/core/index.d.ts +2 -2
  32. package/dist/core/index.d.ts.map +1 -1
  33. package/dist/core/index.js +9 -5
  34. package/dist/core/index.js.map +1 -1
  35. package/dist/core/rebase/changeRebaser.js +5 -5
  36. package/dist/core/rebase/changeRebaser.js.map +1 -1
  37. package/dist/core/rebase/index.d.ts +1 -1
  38. package/dist/core/rebase/index.d.ts.map +1 -1
  39. package/dist/core/rebase/index.js +2 -1
  40. package/dist/core/rebase/index.js.map +1 -1
  41. package/dist/core/rebase/revisionTagCodec.d.ts +1 -1
  42. package/dist/core/rebase/revisionTagCodec.d.ts.map +1 -1
  43. package/dist/core/rebase/revisionTagCodec.js +3 -1
  44. package/dist/core/rebase/revisionTagCodec.js.map +1 -1
  45. package/dist/core/rebase/types.d.ts +12 -1
  46. package/dist/core/rebase/types.d.ts.map +1 -1
  47. package/dist/core/rebase/types.js +19 -15
  48. package/dist/core/rebase/types.js.map +1 -1
  49. package/dist/core/rebase/utils.js +9 -10
  50. package/dist/core/rebase/utils.js.map +1 -1
  51. package/dist/core/schema-stored/schema.js +9 -4
  52. package/dist/core/schema-stored/schema.js.map +1 -1
  53. package/dist/core/schema-stored/storedSchemaRepository.d.ts +1 -1
  54. package/dist/core/schema-stored/storedSchemaRepository.d.ts.map +1 -1
  55. package/dist/core/schema-stored/storedSchemaRepository.js +6 -4
  56. package/dist/core/schema-stored/storedSchemaRepository.js.map +1 -1
  57. package/dist/core/tree/anchorSet.d.ts +1 -1
  58. package/dist/core/tree/anchorSet.d.ts.map +1 -1
  59. package/dist/core/tree/anchorSet.js +62 -55
  60. package/dist/core/tree/anchorSet.js.map +1 -1
  61. package/dist/core/tree/chunk.js +2 -2
  62. package/dist/core/tree/chunk.js.map +1 -1
  63. package/dist/core/tree/cursor.js +12 -12
  64. package/dist/core/tree/cursor.js.map +1 -1
  65. package/dist/core/tree/deltaUtil.d.ts +34 -9
  66. package/dist/core/tree/deltaUtil.d.ts.map +1 -1
  67. package/dist/core/tree/deltaUtil.js +51 -17
  68. package/dist/core/tree/deltaUtil.js.map +1 -1
  69. package/dist/core/tree/detachedFieldIndex.js +23 -21
  70. package/dist/core/tree/detachedFieldIndex.js.map +1 -1
  71. package/dist/core/tree/detachedFieldIndexCodecCommon.d.ts +10 -10
  72. package/dist/core/tree/detachedFieldIndexCodecCommon.d.ts.map +1 -1
  73. package/dist/core/tree/detachedFieldIndexCodecCommon.js +1 -2
  74. package/dist/core/tree/detachedFieldIndexCodecCommon.js.map +1 -1
  75. package/dist/core/tree/detachedFieldIndexCodecV1.js +3 -2
  76. package/dist/core/tree/detachedFieldIndexCodecV1.js.map +1 -1
  77. package/dist/core/tree/detachedFieldIndexCodecV2.js +3 -2
  78. package/dist/core/tree/detachedFieldIndexCodecV2.js.map +1 -1
  79. package/dist/core/tree/detachedFieldIndexFormatCommon.d.ts +3 -3
  80. package/dist/core/tree/detachedFieldIndexFormatCommon.d.ts.map +1 -1
  81. package/dist/core/tree/detachedFieldIndexFormatV1.d.ts +1 -1
  82. package/dist/core/tree/detachedFieldIndexFormatV2.d.ts +2 -2
  83. package/dist/core/tree/detachedFieldIndexFormatV2.d.ts.map +1 -1
  84. package/dist/core/tree/index.d.ts +1 -1
  85. package/dist/core/tree/index.d.ts.map +1 -1
  86. package/dist/core/tree/index.js +7 -4
  87. package/dist/core/tree/index.js.map +1 -1
  88. package/dist/core/tree/mapTree.js +1 -2
  89. package/dist/core/tree/mapTree.js.map +1 -1
  90. package/dist/core/tree/pathTree.js +7 -8
  91. package/dist/core/tree/pathTree.js.map +1 -1
  92. package/dist/core/tree/persistedTreeTextFormat.d.ts +4 -4
  93. package/dist/core/tree/persistedTreeTextFormat.d.ts.map +1 -1
  94. package/dist/core/tree/sparseTree.js +17 -13
  95. package/dist/core/tree/sparseTree.js.map +1 -1
  96. package/dist/core/tree/treeTextFormat.js +4 -5
  97. package/dist/core/tree/treeTextFormat.js.map +1 -1
  98. package/dist/core/tree/types.js +3 -3
  99. package/dist/core/tree/types.js.map +1 -1
  100. package/dist/core/tree/visitDelta.js +1 -2
  101. package/dist/core/tree/visitDelta.js.map +1 -1
  102. package/dist/core/tree/visitorUtils.js +5 -6
  103. package/dist/core/tree/visitorUtils.js.map +1 -1
  104. package/dist/entrypoints/alpha.d.ts +1 -1
  105. package/dist/entrypoints/alpha.d.ts.map +1 -1
  106. package/dist/entrypoints/alpha.js +6 -4
  107. package/dist/entrypoints/alpha.js.map +1 -1
  108. package/dist/entrypoints/beta.d.ts +1 -1
  109. package/dist/entrypoints/beta.d.ts.map +1 -1
  110. package/dist/entrypoints/beta.js +2 -2
  111. package/dist/entrypoints/beta.js.map +1 -1
  112. package/dist/entrypoints/legacy.d.ts +1 -1
  113. package/dist/entrypoints/legacy.d.ts.map +1 -1
  114. package/dist/entrypoints/legacy.js +2 -2
  115. package/dist/entrypoints/legacy.js.map +1 -1
  116. package/dist/entrypoints/public.d.ts +1 -1
  117. package/dist/entrypoints/public.d.ts.map +1 -1
  118. package/dist/entrypoints/public.js +1 -2
  119. package/dist/entrypoints/public.js.map +1 -1
  120. package/dist/extensibleUnionNode.d.ts.map +1 -1
  121. package/dist/extensibleUnionNode.js +1 -1
  122. package/dist/extensibleUnionNode.js.map +1 -1
  123. package/dist/feature-libraries/changeAtomIdBTree.js +3 -4
  124. package/dist/feature-libraries/changeAtomIdBTree.js.map +1 -1
  125. package/dist/feature-libraries/changeAtomIdCodec.js +1 -2
  126. package/dist/feature-libraries/changeAtomIdCodec.js.map +1 -1
  127. package/dist/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
  128. package/dist/feature-libraries/chunked-forest/basicChunk.js +14 -1
  129. package/dist/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
  130. package/dist/feature-libraries/chunked-forest/chunkTree.js +28 -20
  131. package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  132. package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  133. package/dist/feature-libraries/chunked-forest/chunkedForest.js +22 -16
  134. package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  135. package/dist/feature-libraries/chunked-forest/codec/chunkCodecUtilities.js +9 -11
  136. package/dist/feature-libraries/chunked-forest/codec/chunkCodecUtilities.js.map +1 -1
  137. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js +15 -7
  138. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  139. package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js +7 -3
  140. package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
  141. package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js +3 -2
  142. package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
  143. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  144. package/dist/feature-libraries/chunked-forest/codec/codecs.js +2 -0
  145. package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  146. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +33 -17
  147. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  148. package/dist/feature-libraries/chunked-forest/codec/format/formatGeneric.d.ts +2 -2
  149. package/dist/feature-libraries/chunked-forest/codec/format/formatGeneric.d.ts.map +1 -1
  150. package/dist/feature-libraries/chunked-forest/codec/format/versions.js +2 -2
  151. package/dist/feature-libraries/chunked-forest/codec/format/versions.js.map +1 -1
  152. package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.js +11 -2
  153. package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.js.map +1 -1
  154. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +5 -6
  155. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
  156. package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.js +2 -3
  157. package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.js.map +1 -1
  158. package/dist/feature-libraries/chunked-forest/sequenceChunk.js +1 -0
  159. package/dist/feature-libraries/chunked-forest/sequenceChunk.js.map +1 -1
  160. package/dist/feature-libraries/chunked-forest/uniformChunk.js +73 -15
  161. package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  162. package/dist/feature-libraries/comparison-forest/comparisonForest.js +79 -79
  163. package/dist/feature-libraries/comparison-forest/comparisonForest.js.map +1 -1
  164. package/dist/feature-libraries/cursorComparator.d.ts +8 -0
  165. package/dist/feature-libraries/cursorComparator.d.ts.map +1 -1
  166. package/dist/feature-libraries/cursorComparator.js +43 -10
  167. package/dist/feature-libraries/cursorComparator.js.map +1 -1
  168. package/dist/feature-libraries/default-schema/defaultEditBuilder.js +6 -3
  169. package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  170. package/dist/feature-libraries/default-schema/defaultFieldKinds.js +2 -2
  171. package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  172. package/dist/feature-libraries/default-schema/mappedEditBuilder.js +2 -0
  173. package/dist/feature-libraries/default-schema/mappedEditBuilder.js.map +1 -1
  174. package/dist/feature-libraries/deltaUtils.js +2 -3
  175. package/dist/feature-libraries/deltaUtils.js.map +1 -1
  176. package/dist/feature-libraries/detachedFieldIndexSummarizer.js +2 -0
  177. package/dist/feature-libraries/detachedFieldIndexSummarizer.js.map +1 -1
  178. package/dist/feature-libraries/editableTreeBinder.js +1 -2
  179. package/dist/feature-libraries/editableTreeBinder.js.map +1 -1
  180. package/dist/feature-libraries/flex-tree/context.js +19 -3
  181. package/dist/feature-libraries/flex-tree/context.js.map +1 -1
  182. package/dist/feature-libraries/flex-tree/flexTreeTypes.js +2 -2
  183. package/dist/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  184. package/dist/feature-libraries/flex-tree/lazyEntity.js +14 -14
  185. package/dist/feature-libraries/flex-tree/lazyEntity.js.map +1 -1
  186. package/dist/feature-libraries/flex-tree/lazyField.js +28 -30
  187. package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
  188. package/dist/feature-libraries/flex-tree/lazyNode.js +24 -23
  189. package/dist/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  190. package/dist/feature-libraries/flex-tree/observer.js +2 -2
  191. package/dist/feature-libraries/flex-tree/observer.js.map +1 -1
  192. package/dist/feature-libraries/flex-tree/utilities.js +5 -5
  193. package/dist/feature-libraries/flex-tree/utilities.js.map +1 -1
  194. package/dist/feature-libraries/forest-summary/forestSummarizer.js +122 -117
  195. package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  196. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js +49 -32
  197. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -1
  198. package/dist/feature-libraries/forest-summary/summaryTypes.js +2 -3
  199. package/dist/feature-libraries/forest-summary/summaryTypes.js.map +1 -1
  200. package/dist/feature-libraries/index.d.ts +1 -1
  201. package/dist/feature-libraries/index.js.map +1 -1
  202. package/dist/feature-libraries/indexing/anchorTreeIndex.js +35 -31
  203. package/dist/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
  204. package/dist/feature-libraries/mapTreeCursor.js +6 -7
  205. package/dist/feature-libraries/mapTreeCursor.js.map +1 -1
  206. package/dist/feature-libraries/mitigatedChangeFamily.js +2 -3
  207. package/dist/feature-libraries/mitigatedChangeFamily.js.map +1 -1
  208. package/dist/feature-libraries/modular-schema/comparison.js +6 -7
  209. package/dist/feature-libraries/modular-schema/comparison.js.map +1 -1
  210. package/dist/feature-libraries/modular-schema/crossFieldQueries.js +4 -4
  211. package/dist/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
  212. package/dist/feature-libraries/modular-schema/defaultRevisionReplacer.js +14 -12
  213. package/dist/feature-libraries/modular-schema/defaultRevisionReplacer.js.map +1 -1
  214. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts +63 -10
  215. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  216. package/dist/feature-libraries/modular-schema/fieldChangeHandler.js +3 -3
  217. package/dist/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  218. package/dist/feature-libraries/modular-schema/fieldKind.js +10 -0
  219. package/dist/feature-libraries/modular-schema/fieldKind.js.map +1 -1
  220. package/dist/feature-libraries/modular-schema/filterEdits.d.ts +13 -0
  221. package/dist/feature-libraries/modular-schema/filterEdits.d.ts.map +1 -0
  222. package/dist/feature-libraries/modular-schema/filterEdits.js +51 -0
  223. package/dist/feature-libraries/modular-schema/filterEdits.js.map +1 -0
  224. package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  225. package/dist/feature-libraries/modular-schema/genericFieldKind.js +7 -4
  226. package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  227. package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.js +1 -2
  228. package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.js.map +1 -1
  229. package/dist/feature-libraries/modular-schema/genericFieldKindFormat.d.ts +2 -2
  230. package/dist/feature-libraries/modular-schema/genericFieldKindFormat.d.ts.map +1 -1
  231. package/dist/feature-libraries/modular-schema/genericFieldKindTypes.js +1 -2
  232. package/dist/feature-libraries/modular-schema/genericFieldKindTypes.js.map +1 -1
  233. package/dist/feature-libraries/modular-schema/index.d.ts +1 -1
  234. package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
  235. package/dist/feature-libraries/modular-schema/index.js.map +1 -1
  236. package/dist/feature-libraries/modular-schema/invert.d.ts +1 -1
  237. package/dist/feature-libraries/modular-schema/invert.d.ts.map +1 -1
  238. package/dist/feature-libraries/modular-schema/invert.js +5 -30
  239. package/dist/feature-libraries/modular-schema/invert.js.map +1 -1
  240. package/dist/feature-libraries/modular-schema/isNeverTree.js +4 -5
  241. package/dist/feature-libraries/modular-schema/isNeverTree.js.map +1 -1
  242. package/dist/feature-libraries/modular-schema/minimizeModularChange.d.ts +5 -7
  243. package/dist/feature-libraries/modular-schema/minimizeModularChange.d.ts.map +1 -1
  244. package/dist/feature-libraries/modular-schema/minimizeModularChange.js +459 -10
  245. package/dist/feature-libraries/modular-schema/minimizeModularChange.js.map +1 -1
  246. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js +14 -15
  247. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
  248. package/dist/feature-libraries/modular-schema/modularChangeCodecV2.js +1 -2
  249. package/dist/feature-libraries/modular-schema/modularChangeCodecV2.js.map +1 -1
  250. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js +2 -2
  251. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  252. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +1 -10
  253. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  254. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +30 -97
  255. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  256. package/dist/feature-libraries/modular-schema/modularChangeFormatV1.d.ts +9 -9
  257. package/dist/feature-libraries/modular-schema/modularChangeFormatV1.d.ts.map +1 -1
  258. package/dist/feature-libraries/modular-schema/modularChangeFormatV2.d.ts +4 -4
  259. package/dist/feature-libraries/modular-schema/modularChangeTypes.js +1 -2
  260. package/dist/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
  261. package/dist/feature-libraries/modular-schema/modularChangeUtils.d.ts +13 -1
  262. package/dist/feature-libraries/modular-schema/modularChangeUtils.d.ts.map +1 -1
  263. package/dist/feature-libraries/modular-schema/modularChangeUtils.js +115 -12
  264. package/dist/feature-libraries/modular-schema/modularChangeUtils.js.map +1 -1
  265. package/dist/feature-libraries/modular-schema/prune.d.ts +2 -3
  266. package/dist/feature-libraries/modular-schema/prune.d.ts.map +1 -1
  267. package/dist/feature-libraries/modular-schema/prune.js +25 -8
  268. package/dist/feature-libraries/modular-schema/prune.js.map +1 -1
  269. package/dist/feature-libraries/node-identifier/mockNodeIdentifierManager.js +1 -3
  270. package/dist/feature-libraries/node-identifier/mockNodeIdentifierManager.js.map +1 -1
  271. package/dist/feature-libraries/node-identifier/nodeIdentifier.js +2 -2
  272. package/dist/feature-libraries/node-identifier/nodeIdentifier.js.map +1 -1
  273. package/dist/feature-libraries/node-identifier/nodeIdentifierManager.js +3 -3
  274. package/dist/feature-libraries/node-identifier/nodeIdentifierManager.js.map +1 -1
  275. package/dist/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  276. package/dist/feature-libraries/object-forest/objectForest.js +274 -267
  277. package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
  278. package/dist/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
  279. package/dist/feature-libraries/optional-field/optionalField.js +27 -35
  280. package/dist/feature-libraries/optional-field/optionalField.js.map +1 -1
  281. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts +7 -7
  282. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts.map +1 -1
  283. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts +8 -8
  284. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts.map +1 -1
  285. package/dist/feature-libraries/optional-field/optionalFieldCodecV2.js +1 -2
  286. package/dist/feature-libraries/optional-field/optionalFieldCodecV2.js.map +1 -1
  287. package/dist/feature-libraries/optional-field/optionalFieldCodecs.d.ts.map +1 -1
  288. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js +1 -2
  289. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
  290. package/dist/feature-libraries/schema-index/schemaSummarizer.js +3 -0
  291. package/dist/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
  292. package/dist/feature-libraries/schemaChecker.d.ts +9 -19
  293. package/dist/feature-libraries/schemaChecker.d.ts.map +1 -1
  294. package/dist/feature-libraries/schemaChecker.js +135 -51
  295. package/dist/feature-libraries/schemaChecker.js.map +1 -1
  296. package/dist/feature-libraries/sequence-field/compose.js +8 -2
  297. package/dist/feature-libraries/sequence-field/compose.js.map +1 -1
  298. package/dist/feature-libraries/sequence-field/filterEdits.d.ts +3 -3
  299. package/dist/feature-libraries/sequence-field/filterEdits.d.ts.map +1 -1
  300. package/dist/feature-libraries/sequence-field/filterEdits.js +29 -11
  301. package/dist/feature-libraries/sequence-field/filterEdits.js.map +1 -1
  302. package/dist/feature-libraries/sequence-field/formatV1.d.ts +102 -102
  303. package/dist/feature-libraries/sequence-field/formatV1.d.ts.map +1 -1
  304. package/dist/feature-libraries/sequence-field/formatV2.d.ts +79 -79
  305. package/dist/feature-libraries/sequence-field/formatV2.d.ts.map +1 -1
  306. package/dist/feature-libraries/sequence-field/formatV3.d.ts +56 -56
  307. package/dist/feature-libraries/sequence-field/formatV3.d.ts.map +1 -1
  308. package/dist/feature-libraries/sequence-field/invert.js +1 -2
  309. package/dist/feature-libraries/sequence-field/invert.js.map +1 -1
  310. package/dist/feature-libraries/sequence-field/markListFactory.js +3 -4
  311. package/dist/feature-libraries/sequence-field/markListFactory.js.map +1 -1
  312. package/dist/feature-libraries/sequence-field/markQueue.js +4 -2
  313. package/dist/feature-libraries/sequence-field/markQueue.js.map +1 -1
  314. package/dist/feature-libraries/sequence-field/moveEffectTable.js +9 -9
  315. package/dist/feature-libraries/sequence-field/moveEffectTable.js.map +1 -1
  316. package/dist/feature-libraries/sequence-field/prune.js +1 -2
  317. package/dist/feature-libraries/sequence-field/prune.js.map +1 -1
  318. package/dist/feature-libraries/sequence-field/rebase.js +7 -2
  319. package/dist/feature-libraries/sequence-field/rebase.js.map +1 -1
  320. package/dist/feature-libraries/sequence-field/relevantRemovedRoots.js +1 -2
  321. package/dist/feature-libraries/sequence-field/relevantRemovedRoots.js.map +1 -1
  322. package/dist/feature-libraries/sequence-field/replaceRevisions.js +1 -2
  323. package/dist/feature-libraries/sequence-field/replaceRevisions.js.map +1 -1
  324. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js +2 -3
  325. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
  326. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.js +1 -2
  327. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -1
  328. package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts.map +1 -1
  329. package/dist/feature-libraries/sequence-field/sequenceFieldEditor.d.ts +9 -9
  330. package/dist/feature-libraries/sequence-field/sequenceFieldEditor.d.ts.map +1 -1
  331. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js +1 -2
  332. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
  333. package/dist/feature-libraries/sequence-field/utils.d.ts +2 -2
  334. package/dist/feature-libraries/sequence-field/utils.d.ts.map +1 -1
  335. package/dist/feature-libraries/sequence-field/utils.js +54 -67
  336. package/dist/feature-libraries/sequence-field/utils.js.map +1 -1
  337. package/dist/feature-libraries/treeCursorUtils.js +19 -15
  338. package/dist/feature-libraries/treeCursorUtils.js.map +1 -1
  339. package/dist/feature-libraries/treeTextCursor.js +8 -8
  340. package/dist/feature-libraries/treeTextCursor.js.map +1 -1
  341. package/dist/feature-libraries/valueUtilities.js +4 -5
  342. package/dist/feature-libraries/valueUtilities.js.map +1 -1
  343. package/dist/index.d.ts +4 -29
  344. package/dist/index.d.ts.map +1 -1
  345. package/dist/index.js +6 -9
  346. package/dist/index.js.map +1 -1
  347. package/dist/internalTypes.d.ts +1 -1
  348. package/dist/internalTypes.d.ts.map +1 -1
  349. package/dist/internalTypes.js.map +1 -1
  350. package/dist/packageVersion.d.ts +1 -1
  351. package/dist/packageVersion.d.ts.map +1 -1
  352. package/dist/packageVersion.js +1 -1
  353. package/dist/packageVersion.js.map +1 -1
  354. package/dist/serializableDomainSchema.d.ts +1 -1
  355. package/dist/shared-tree/history.d.ts.map +1 -1
  356. package/dist/shared-tree/history.js +32 -13
  357. package/dist/shared-tree/history.js.map +1 -1
  358. package/dist/shared-tree/independentView.d.ts +27 -3
  359. package/dist/shared-tree/independentView.d.ts.map +1 -1
  360. package/dist/shared-tree/independentView.js +36 -7
  361. package/dist/shared-tree/independentView.js.map +1 -1
  362. package/dist/shared-tree/index.d.ts +2 -1
  363. package/dist/shared-tree/index.d.ts.map +1 -1
  364. package/dist/shared-tree/index.js +6 -2
  365. package/dist/shared-tree/index.js.map +1 -1
  366. package/dist/shared-tree/isAuditableFromOutcome.js +1 -2
  367. package/dist/shared-tree/isAuditableFromOutcome.js.map +1 -1
  368. package/dist/shared-tree/schematizeTree.js +3 -4
  369. package/dist/shared-tree/schematizeTree.js.map +1 -1
  370. package/dist/shared-tree/schematizingTreeView.d.ts +14 -4
  371. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  372. package/dist/shared-tree/schematizingTreeView.js +107 -37
  373. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  374. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  375. package/dist/shared-tree/sharedTree.js +28 -19
  376. package/dist/shared-tree/sharedTree.js.map +1 -1
  377. package/dist/shared-tree/sharedTreeChangeCodecs.js +3 -3
  378. package/dist/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  379. package/dist/shared-tree/sharedTreeChangeEnricher.d.ts.map +1 -1
  380. package/dist/shared-tree/sharedTreeChangeEnricher.js +12 -4
  381. package/dist/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
  382. package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  383. package/dist/shared-tree/sharedTreeChangeFamily.js +11 -8
  384. package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  385. package/dist/shared-tree/sharedTreeChangeFormat.js +2 -3
  386. package/dist/shared-tree/sharedTreeChangeFormat.js.map +1 -1
  387. package/dist/shared-tree/sharedTreeEditBuilder.js +2 -0
  388. package/dist/shared-tree/sharedTreeEditBuilder.js.map +1 -1
  389. package/dist/shared-tree/transactionMinimize.d.ts.map +1 -1
  390. package/dist/shared-tree/transactionMinimize.js +2 -1
  391. package/dist/shared-tree/transactionMinimize.js.map +1 -1
  392. package/dist/shared-tree/transactionPostProcessor.js +2 -3
  393. package/dist/shared-tree/transactionPostProcessor.js.map +1 -1
  394. package/dist/shared-tree/tree.js +2 -2
  395. package/dist/shared-tree/tree.js.map +1 -1
  396. package/dist/shared-tree/treeAlpha.d.ts +5 -16
  397. package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
  398. package/dist/shared-tree/treeAlpha.js +18 -11
  399. package/dist/shared-tree/treeAlpha.js.map +1 -1
  400. package/{lib/simple-tree/api → dist/shared-tree}/treeBeta.d.ts +8 -65
  401. package/dist/shared-tree/treeBeta.d.ts.map +1 -0
  402. package/dist/shared-tree/treeBeta.js +70 -0
  403. package/dist/shared-tree/treeBeta.js.map +1 -0
  404. package/dist/shared-tree/treeCheckout.d.ts +5 -0
  405. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  406. package/dist/shared-tree/treeCheckout.js +986 -907
  407. package/dist/shared-tree/treeCheckout.js.map +1 -1
  408. package/dist/shared-tree/unhydratedTreeContext.js +3 -4
  409. package/dist/shared-tree/unhydratedTreeContext.js.map +1 -1
  410. package/dist/shared-tree-core/branch.d.ts.map +1 -1
  411. package/dist/shared-tree-core/branch.js +24 -20
  412. package/dist/shared-tree-core/branch.js.map +1 -1
  413. package/dist/shared-tree-core/branchCommitCounter.js +35 -32
  414. package/dist/shared-tree-core/branchCommitCounter.js.map +1 -1
  415. package/dist/shared-tree-core/branchCommitEnricher.js +9 -8
  416. package/dist/shared-tree-core/branchCommitEnricher.js.map +1 -1
  417. package/dist/shared-tree-core/branchIdCodec.js +2 -3
  418. package/dist/shared-tree-core/branchIdCodec.js.map +1 -1
  419. package/dist/shared-tree-core/customMetadataCodec.js +2 -3
  420. package/dist/shared-tree-core/customMetadataCodec.js.map +1 -1
  421. package/dist/shared-tree-core/customMetadataFormat.d.ts.map +1 -1
  422. package/dist/shared-tree-core/defaultResubmitMachine.js +11 -9
  423. package/dist/shared-tree-core/defaultResubmitMachine.js.map +1 -1
  424. package/dist/shared-tree-core/editManager.d.ts.map +1 -1
  425. package/dist/shared-tree-core/editManager.js +73 -44
  426. package/dist/shared-tree-core/editManager.js.map +1 -1
  427. package/dist/shared-tree-core/editManagerCodecs.js +3 -3
  428. package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
  429. package/dist/shared-tree-core/editManagerCodecsCommons.d.ts +1 -1
  430. package/dist/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
  431. package/dist/shared-tree-core/editManagerCodecsCommons.js +33 -36
  432. package/dist/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
  433. package/dist/shared-tree-core/editManagerCodecsV1toV4.js +1 -2
  434. package/dist/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -1
  435. package/dist/shared-tree-core/editManagerCodecsVSharedBranches.js +1 -2
  436. package/dist/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
  437. package/dist/shared-tree-core/editManagerFormatCommons.d.ts +11 -11
  438. package/dist/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
  439. package/dist/shared-tree-core/editManagerFormatV1toV4.d.ts +5 -4
  440. package/dist/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -1
  441. package/dist/shared-tree-core/editManagerFormatVSharedBranches.d.ts +10 -9
  442. package/dist/shared-tree-core/editManagerFormatVSharedBranches.d.ts.map +1 -1
  443. package/dist/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
  444. package/dist/shared-tree-core/editManagerSummarizer.js +6 -1
  445. package/dist/shared-tree-core/editManagerSummarizer.js.map +1 -1
  446. package/dist/shared-tree-core/messageCodecV1ToV4.js +1 -2
  447. package/dist/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
  448. package/dist/shared-tree-core/messageCodecVSharedBranches.js +1 -2
  449. package/dist/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
  450. package/dist/shared-tree-core/messageCodecs.js +3 -3
  451. package/dist/shared-tree-core/messageCodecs.js.map +1 -1
  452. package/dist/shared-tree-core/messageFormatV1ToV4.d.ts +3 -2
  453. package/dist/shared-tree-core/messageFormatV1ToV4.d.ts.map +1 -1
  454. package/dist/shared-tree-core/messageFormatVSharedBranches.d.ts +3 -2
  455. package/dist/shared-tree-core/messageFormatVSharedBranches.d.ts.map +1 -1
  456. package/dist/shared-tree-core/sequenceIdUtils.d.ts.map +1 -1
  457. package/dist/shared-tree-core/sharedTreeCore.js +44 -22
  458. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  459. package/dist/shared-tree-core/summaryTypes.js +2 -2
  460. package/dist/shared-tree-core/summaryTypes.js.map +1 -1
  461. package/dist/shared-tree-core/transaction.js +36 -39
  462. package/dist/shared-tree-core/transaction.js.map +1 -1
  463. package/dist/shared-tree-core/versionedSummarizer.js +4 -0
  464. package/dist/shared-tree-core/versionedSummarizer.js.map +1 -1
  465. package/dist/simple-tree/api/cloneTree.d.ts +11 -0
  466. package/dist/simple-tree/api/cloneTree.d.ts.map +1 -0
  467. package/dist/simple-tree/api/cloneTree.js +31 -0
  468. package/dist/simple-tree/api/cloneTree.js.map +1 -0
  469. package/dist/simple-tree/api/conciseTree.js +2 -3
  470. package/dist/simple-tree/api/conciseTree.js.map +1 -1
  471. package/dist/simple-tree/api/configuration.d.ts +4 -4
  472. package/dist/simple-tree/api/configuration.d.ts.map +1 -1
  473. package/dist/simple-tree/api/configuration.js +21 -2
  474. package/dist/simple-tree/api/configuration.js.map +1 -1
  475. package/dist/simple-tree/api/create.js +2 -3
  476. package/dist/simple-tree/api/create.js.map +1 -1
  477. package/dist/simple-tree/api/customTree.js +6 -6
  478. package/dist/simple-tree/api/customTree.js.map +1 -1
  479. package/dist/simple-tree/api/dirtyIndex.js +1 -2
  480. package/dist/simple-tree/api/dirtyIndex.js.map +1 -1
  481. package/dist/simple-tree/api/discrepancies.d.ts +36 -3
  482. package/dist/simple-tree/api/discrepancies.d.ts.map +1 -1
  483. package/dist/simple-tree/api/discrepancies.js +42 -17
  484. package/dist/simple-tree/api/discrepancies.js.map +1 -1
  485. package/dist/simple-tree/api/eraseSchemaDetails.js +2 -3
  486. package/dist/simple-tree/api/eraseSchemaDetails.js.map +1 -1
  487. package/dist/simple-tree/api/getJsonSchema.js +1 -2
  488. package/dist/simple-tree/api/getJsonSchema.js.map +1 -1
  489. package/dist/simple-tree/api/getSimpleSchema.js +1 -2
  490. package/dist/simple-tree/api/getSimpleSchema.js.map +1 -1
  491. package/dist/simple-tree/api/identifierIndex.js +1 -2
  492. package/dist/simple-tree/api/identifierIndex.js.map +1 -1
  493. package/dist/simple-tree/api/incrementalAllowedTypes.js +2 -2
  494. package/dist/simple-tree/api/incrementalAllowedTypes.js.map +1 -1
  495. package/dist/simple-tree/api/index.d.ts +5 -4
  496. package/dist/simple-tree/api/index.d.ts.map +1 -1
  497. package/dist/simple-tree/api/index.js +5 -7
  498. package/dist/simple-tree/api/index.js.map +1 -1
  499. package/dist/simple-tree/api/schemaCompatibilityTester.d.ts +22 -3
  500. package/dist/simple-tree/api/schemaCompatibilityTester.d.ts.map +1 -1
  501. package/dist/simple-tree/api/schemaCompatibilityTester.js +140 -11
  502. package/dist/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
  503. package/dist/simple-tree/api/schemaCreationUtilities.d.ts +3 -7
  504. package/dist/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -1
  505. package/dist/simple-tree/api/schemaCreationUtilities.js +6 -9
  506. package/dist/simple-tree/api/schemaCreationUtilities.js.map +1 -1
  507. package/dist/simple-tree/api/schemaFactory.d.ts +4 -9
  508. package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
  509. package/dist/simple-tree/api/schemaFactory.js +13 -12
  510. package/dist/simple-tree/api/schemaFactory.js.map +1 -1
  511. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +20 -22
  512. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  513. package/dist/simple-tree/api/schemaFactoryAlpha.js +78 -81
  514. package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  515. package/dist/simple-tree/api/schemaFactoryBeta.d.ts +7 -9
  516. package/dist/simple-tree/api/schemaFactoryBeta.d.ts.map +1 -1
  517. package/dist/simple-tree/api/schemaFactoryBeta.js +32 -35
  518. package/dist/simple-tree/api/schemaFactoryBeta.js.map +1 -1
  519. package/dist/simple-tree/api/schemaFactoryRecursive.js +1 -2
  520. package/dist/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
  521. package/dist/simple-tree/api/schemaFromSimple.js +1 -2
  522. package/dist/simple-tree/api/schemaFromSimple.js.map +1 -1
  523. package/dist/simple-tree/api/schemaStatics.d.ts +7 -7
  524. package/dist/simple-tree/api/schemaStatics.d.ts.map +1 -1
  525. package/dist/simple-tree/api/simpleSchemaCodec.js +2 -3
  526. package/dist/simple-tree/api/simpleSchemaCodec.js.map +1 -1
  527. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js +2 -3
  528. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  529. package/dist/simple-tree/api/simpleTreeIndex.js +1 -2
  530. package/dist/simple-tree/api/simpleTreeIndex.js.map +1 -1
  531. package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts +46 -2
  532. package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -1
  533. package/dist/simple-tree/api/snapshotCompatibilityChecker.js +54 -12
  534. package/dist/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
  535. package/dist/simple-tree/api/storedSchema.js +2 -3
  536. package/dist/simple-tree/api/storedSchema.js.map +1 -1
  537. package/dist/simple-tree/api/transactionTypes.d.ts +4 -4
  538. package/dist/simple-tree/api/transactionTypes.js.map +1 -1
  539. package/dist/simple-tree/api/tree.d.ts +243 -58
  540. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  541. package/dist/simple-tree/api/tree.js +3 -5
  542. package/dist/simple-tree/api/tree.js.map +1 -1
  543. package/dist/simple-tree/api/treeChangeEvents.d.ts +16 -4
  544. package/dist/simple-tree/api/treeChangeEvents.d.ts.map +1 -1
  545. package/dist/simple-tree/api/treeChangeEvents.js.map +1 -1
  546. package/dist/simple-tree/api/treeChangeEventsBeta.d.ts +209 -0
  547. package/dist/simple-tree/api/treeChangeEventsBeta.d.ts.map +1 -0
  548. package/dist/simple-tree/api/{treeAlpha.js → treeChangeEventsBeta.js} +1 -1
  549. package/dist/simple-tree/api/treeChangeEventsBeta.js.map +1 -0
  550. package/dist/simple-tree/api/treeNodeApi.d.ts +1 -75
  551. package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  552. package/dist/simple-tree/api/treeNodeApi.js +7 -7
  553. package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
  554. package/dist/simple-tree/api/typesUnsafe.d.ts +8 -6
  555. package/dist/simple-tree/api/typesUnsafe.d.ts.map +1 -1
  556. package/dist/simple-tree/api/typesUnsafe.js.map +1 -1
  557. package/dist/simple-tree/api/verboseTree.js +5 -6
  558. package/dist/simple-tree/api/verboseTree.js.map +1 -1
  559. package/dist/simple-tree/core/allowedTypes.js +22 -13
  560. package/dist/simple-tree/core/allowedTypes.js.map +1 -1
  561. package/dist/simple-tree/core/context.js +3 -0
  562. package/dist/simple-tree/core/context.js.map +1 -1
  563. package/dist/simple-tree/core/flexList.js +2 -3
  564. package/dist/simple-tree/core/flexList.js.map +1 -1
  565. package/dist/simple-tree/core/getOrCreateNode.js +2 -3
  566. package/dist/simple-tree/core/getOrCreateNode.js.map +1 -1
  567. package/dist/simple-tree/core/index.d.ts +1 -1
  568. package/dist/simple-tree/core/index.d.ts.map +1 -1
  569. package/dist/simple-tree/core/index.js +2 -2
  570. package/dist/simple-tree/core/index.js.map +1 -1
  571. package/dist/simple-tree/core/toStored.d.ts +7 -0
  572. package/dist/simple-tree/core/toStored.d.ts.map +1 -1
  573. package/dist/simple-tree/core/toStored.js.map +1 -1
  574. package/dist/simple-tree/core/treeNode.d.ts +3 -4
  575. package/dist/simple-tree/core/treeNode.d.ts.map +1 -1
  576. package/dist/simple-tree/core/treeNode.js +31 -32
  577. package/dist/simple-tree/core/treeNode.js.map +1 -1
  578. package/dist/simple-tree/core/treeNodeKernel.js +194 -192
  579. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
  580. package/dist/simple-tree/core/treeNodeSchema.js +3 -3
  581. package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
  582. package/dist/simple-tree/core/treeNodeValid.d.ts.map +1 -1
  583. package/dist/simple-tree/core/treeNodeValid.js +25 -25
  584. package/dist/simple-tree/core/treeNodeValid.js.map +1 -1
  585. package/dist/simple-tree/core/types.js +1 -2
  586. package/dist/simple-tree/core/types.js.map +1 -1
  587. package/dist/simple-tree/core/unhydratedFlexTree.js +177 -150
  588. package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  589. package/dist/simple-tree/core/walkSchema.js +2 -3
  590. package/dist/simple-tree/core/walkSchema.js.map +1 -1
  591. package/dist/simple-tree/core/withType.d.ts +7 -9
  592. package/dist/simple-tree/core/withType.d.ts.map +1 -1
  593. package/dist/simple-tree/core/withType.js +6 -7
  594. package/dist/simple-tree/core/withType.js.map +1 -1
  595. package/dist/simple-tree/createContext.js +2 -3
  596. package/dist/simple-tree/createContext.js.map +1 -1
  597. package/dist/simple-tree/fieldSchema.d.ts.map +1 -1
  598. package/dist/simple-tree/fieldSchema.js +33 -15
  599. package/dist/simple-tree/fieldSchema.js.map +1 -1
  600. package/dist/simple-tree/getTreeNodeForField.js +1 -2
  601. package/dist/simple-tree/getTreeNodeForField.js.map +1 -1
  602. package/dist/simple-tree/index.d.ts +2 -2
  603. package/dist/simple-tree/index.d.ts.map +1 -1
  604. package/dist/simple-tree/index.js +6 -8
  605. package/dist/simple-tree/index.js.map +1 -1
  606. package/dist/simple-tree/leafNodeSchema.d.ts +1 -1
  607. package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
  608. package/dist/simple-tree/leafNodeSchema.js +18 -17
  609. package/dist/simple-tree/leafNodeSchema.js.map +1 -1
  610. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts +3 -2
  611. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  612. package/dist/simple-tree/node-kinds/array/arrayNode.js +31 -33
  613. package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  614. package/dist/simple-tree/node-kinds/array/arrayNodeTypes.d.ts.map +1 -1
  615. package/dist/simple-tree/node-kinds/array/arrayNodeTypes.js +2 -2
  616. package/dist/simple-tree/node-kinds/array/arrayNodeTypes.js.map +1 -1
  617. package/dist/simple-tree/node-kinds/common.js +1 -2
  618. package/dist/simple-tree/node-kinds/common.js.map +1 -1
  619. package/dist/simple-tree/node-kinds/map/mapNode.d.ts +6 -6
  620. package/dist/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
  621. package/dist/simple-tree/node-kinds/map/mapNode.js +10 -16
  622. package/dist/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  623. package/dist/simple-tree/node-kinds/map/mapNodeTypes.d.ts.map +1 -1
  624. package/dist/simple-tree/node-kinds/map/mapNodeTypes.js +2 -2
  625. package/dist/simple-tree/node-kinds/map/mapNodeTypes.js.map +1 -1
  626. package/dist/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  627. package/dist/simple-tree/node-kinds/object/objectNode.js +27 -28
  628. package/dist/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  629. package/dist/simple-tree/node-kinds/object/objectNodeTypes.d.ts +1 -1
  630. package/dist/simple-tree/node-kinds/object/objectNodeTypes.d.ts.map +1 -1
  631. package/dist/simple-tree/node-kinds/object/objectNodeTypes.js +2 -2
  632. package/dist/simple-tree/node-kinds/object/objectNodeTypes.js.map +1 -1
  633. package/dist/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
  634. package/dist/simple-tree/node-kinds/record/recordNode.js +10 -13
  635. package/dist/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  636. package/dist/simple-tree/node-kinds/record/recordNodeTypes.d.ts +3 -2
  637. package/dist/simple-tree/node-kinds/record/recordNodeTypes.d.ts.map +1 -1
  638. package/dist/simple-tree/node-kinds/record/recordNodeTypes.js +2 -2
  639. package/dist/simple-tree/node-kinds/record/recordNodeTypes.js.map +1 -1
  640. package/dist/simple-tree/prepareForInsertion.js +4 -5
  641. package/dist/simple-tree/prepareForInsertion.js.map +1 -1
  642. package/dist/simple-tree/toStoredSchema.js +11 -11
  643. package/dist/simple-tree/toStoredSchema.js.map +1 -1
  644. package/dist/simple-tree/treeSchema.js +1 -2
  645. package/dist/simple-tree/treeSchema.js.map +1 -1
  646. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js +3 -4
  647. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
  648. package/dist/simple-tree/walkFieldSchema.js +1 -2
  649. package/dist/simple-tree/walkFieldSchema.js.map +1 -1
  650. package/dist/tableSchema.d.ts +2 -87
  651. package/dist/tableSchema.d.ts.map +1 -1
  652. package/dist/tableSchema.js +309 -275
  653. package/dist/tableSchema.js.map +1 -1
  654. package/dist/text/codePointUtils.d.ts +16 -3
  655. package/dist/text/codePointUtils.d.ts.map +1 -1
  656. package/dist/text/codePointUtils.js +24 -13
  657. package/dist/text/codePointUtils.js.map +1 -1
  658. package/dist/text/textDomain.d.ts +7 -1
  659. package/dist/text/textDomain.d.ts.map +1 -1
  660. package/dist/text/textDomain.js +32 -28
  661. package/dist/text/textDomain.js.map +1 -1
  662. package/dist/text/textDomainFormatted.d.ts.map +1 -1
  663. package/dist/text/textDomainFormatted.js +45 -34
  664. package/dist/text/textDomainFormatted.js.map +1 -1
  665. package/dist/text/textDomainFormattedDefault.js +2 -5
  666. package/dist/text/textDomainFormattedDefault.js.map +1 -1
  667. package/dist/treeDataStore.js +2 -3
  668. package/dist/treeDataStore.js.map +1 -1
  669. package/dist/treeFactory.js +7 -7
  670. package/dist/treeFactory.js.map +1 -1
  671. package/dist/util/arrayUtilities.js +5 -6
  672. package/dist/util/arrayUtilities.js.map +1 -1
  673. package/dist/util/bTreeUtils.js +3 -4
  674. package/dist/util/bTreeUtils.js.map +1 -1
  675. package/dist/util/brand.js +6 -5
  676. package/dist/util/brand.js.map +1 -1
  677. package/dist/util/brandedMap.js +2 -3
  678. package/dist/util/brandedMap.js.map +1 -1
  679. package/dist/util/breakable.d.ts.map +1 -1
  680. package/dist/util/breakable.js +7 -4
  681. package/dist/util/breakable.js.map +1 -1
  682. package/dist/util/cloneWithReplacements.js +1 -2
  683. package/dist/util/cloneWithReplacements.js.map +1 -1
  684. package/dist/util/compressedIds.js +29 -7
  685. package/dist/util/compressedIds.js.map +1 -1
  686. package/dist/util/idAllocator.js +3 -3
  687. package/dist/util/idAllocator.js.map +1 -1
  688. package/dist/util/nestedMap.js +15 -17
  689. package/dist/util/nestedMap.js.map +1 -1
  690. package/dist/util/nestedSet.js +2 -3
  691. package/dist/util/nestedSet.js.map +1 -1
  692. package/dist/util/offsetList.js +2 -4
  693. package/dist/util/offsetList.js.map +1 -1
  694. package/dist/util/opaque.js +2 -3
  695. package/dist/util/opaque.js.map +1 -1
  696. package/dist/util/rangeMap.js +6 -2
  697. package/dist/util/rangeMap.js.map +1 -1
  698. package/dist/util/readSnapshotBlob.d.ts.map +1 -1
  699. package/dist/util/referenceCounting.js +1 -0
  700. package/dist/util/referenceCounting.js.map +1 -1
  701. package/dist/util/stackyIterator.js +3 -2
  702. package/dist/util/stackyIterator.js.map +1 -1
  703. package/dist/util/typeUtils.js +1 -2
  704. package/dist/util/typeUtils.js.map +1 -1
  705. package/dist/util/typeboxBrand.js +2 -3
  706. package/dist/util/typeboxBrand.js.map +1 -1
  707. package/dist/util/utils.d.ts +2 -2
  708. package/dist/util/utils.d.ts.map +1 -1
  709. package/dist/util/utils.js +32 -32
  710. package/dist/util/utils.js.map +1 -1
  711. package/lib/api.d.ts +9 -1
  712. package/lib/api.d.ts.map +1 -1
  713. package/lib/api.js.map +1 -1
  714. package/lib/codec/codec.d.ts +2 -2
  715. package/lib/codec/codec.d.ts.map +1 -1
  716. package/lib/codec/codec.js +2 -0
  717. package/lib/codec/codec.js.map +1 -1
  718. package/lib/codec/discriminatedUnions.js +1 -0
  719. package/lib/codec/discriminatedUnions.js.map +1 -1
  720. package/lib/codec/versioned/codec.d.ts.map +1 -1
  721. package/lib/codec/versioned/codec.js +2 -0
  722. package/lib/codec/versioned/codec.js.map +1 -1
  723. package/lib/componentApi.d.ts.map +1 -1
  724. package/lib/componentApi.js +20 -17
  725. package/lib/componentApi.js.map +1 -1
  726. package/lib/core/change-family/editBuilder.js +1 -0
  727. package/lib/core/change-family/editBuilder.js.map +1 -1
  728. package/lib/core/index.d.ts +2 -2
  729. package/lib/core/index.d.ts.map +1 -1
  730. package/lib/core/index.js +2 -2
  731. package/lib/core/index.js.map +1 -1
  732. package/lib/core/rebase/index.d.ts +1 -1
  733. package/lib/core/rebase/index.d.ts.map +1 -1
  734. package/lib/core/rebase/index.js +1 -1
  735. package/lib/core/rebase/index.js.map +1 -1
  736. package/lib/core/rebase/revisionTagCodec.js +3 -1
  737. package/lib/core/rebase/revisionTagCodec.js.map +1 -1
  738. package/lib/core/rebase/types.d.ts +12 -1
  739. package/lib/core/rebase/types.d.ts.map +1 -1
  740. package/lib/core/rebase/types.js +3 -0
  741. package/lib/core/rebase/types.js.map +1 -1
  742. package/lib/core/schema-stored/schema.js +5 -0
  743. package/lib/core/schema-stored/schema.js.map +1 -1
  744. package/lib/core/schema-stored/storedSchemaRepository.js +4 -2
  745. package/lib/core/schema-stored/storedSchemaRepository.js.map +1 -1
  746. package/lib/core/tree/anchorSet.js +61 -54
  747. package/lib/core/tree/anchorSet.js.map +1 -1
  748. package/lib/core/tree/deltaUtil.d.ts +34 -9
  749. package/lib/core/tree/deltaUtil.d.ts.map +1 -1
  750. package/lib/core/tree/deltaUtil.js +41 -10
  751. package/lib/core/tree/deltaUtil.js.map +1 -1
  752. package/lib/core/tree/detachedFieldIndex.js +23 -21
  753. package/lib/core/tree/detachedFieldIndex.js.map +1 -1
  754. package/lib/core/tree/detachedFieldIndexCodecCommon.d.ts +10 -10
  755. package/lib/core/tree/detachedFieldIndexCodecCommon.d.ts.map +1 -1
  756. package/lib/core/tree/detachedFieldIndexCodecV1.js +2 -0
  757. package/lib/core/tree/detachedFieldIndexCodecV1.js.map +1 -1
  758. package/lib/core/tree/detachedFieldIndexCodecV2.js +2 -0
  759. package/lib/core/tree/detachedFieldIndexCodecV2.js.map +1 -1
  760. package/lib/core/tree/detachedFieldIndexFormatCommon.d.ts +3 -3
  761. package/lib/core/tree/detachedFieldIndexFormatCommon.d.ts.map +1 -1
  762. package/lib/core/tree/index.d.ts +1 -1
  763. package/lib/core/tree/index.d.ts.map +1 -1
  764. package/lib/core/tree/index.js +1 -1
  765. package/lib/core/tree/index.js.map +1 -1
  766. package/lib/core/tree/persistedTreeTextFormat.d.ts +4 -4
  767. package/lib/core/tree/persistedTreeTextFormat.d.ts.map +1 -1
  768. package/lib/core/tree/sparseTree.js +15 -11
  769. package/lib/core/tree/sparseTree.js.map +1 -1
  770. package/lib/entrypoints/alpha.d.ts +1 -1
  771. package/lib/entrypoints/alpha.d.ts.map +1 -1
  772. package/lib/entrypoints/alpha.js +1 -1
  773. package/lib/entrypoints/alpha.js.map +1 -1
  774. package/lib/entrypoints/beta.d.ts +1 -1
  775. package/lib/entrypoints/beta.d.ts.map +1 -1
  776. package/lib/entrypoints/beta.js +1 -1
  777. package/lib/entrypoints/beta.js.map +1 -1
  778. package/lib/entrypoints/legacy.d.ts +1 -1
  779. package/lib/entrypoints/legacy.d.ts.map +1 -1
  780. package/lib/entrypoints/legacy.js +1 -1
  781. package/lib/entrypoints/legacy.js.map +1 -1
  782. package/lib/entrypoints/public.d.ts +1 -1
  783. package/lib/entrypoints/public.d.ts.map +1 -1
  784. package/lib/entrypoints/public.js +1 -1
  785. package/lib/entrypoints/public.js.map +1 -1
  786. package/lib/extensibleUnionNode.d.ts.map +1 -1
  787. package/lib/extensibleUnionNode.js +2 -2
  788. package/lib/extensibleUnionNode.js.map +1 -1
  789. package/lib/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
  790. package/lib/feature-libraries/chunked-forest/basicChunk.js +14 -1
  791. package/lib/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
  792. package/lib/feature-libraries/chunked-forest/chunkTree.js +14 -6
  793. package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  794. package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  795. package/lib/feature-libraries/chunked-forest/chunkedForest.js +18 -12
  796. package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  797. package/lib/feature-libraries/chunked-forest/codec/chunkCodecUtilities.js +1 -3
  798. package/lib/feature-libraries/chunked-forest/codec/chunkCodecUtilities.js.map +1 -1
  799. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js +8 -0
  800. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  801. package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js +4 -0
  802. package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
  803. package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js +1 -0
  804. package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
  805. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  806. package/lib/feature-libraries/chunked-forest/codec/codecs.js +2 -0
  807. package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  808. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +28 -12
  809. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  810. package/lib/feature-libraries/chunked-forest/codec/format/formatGeneric.d.ts +2 -2
  811. package/lib/feature-libraries/chunked-forest/codec/format/formatGeneric.d.ts.map +1 -1
  812. package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.js +9 -0
  813. package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.js.map +1 -1
  814. package/lib/feature-libraries/chunked-forest/sequenceChunk.js +1 -0
  815. package/lib/feature-libraries/chunked-forest/sequenceChunk.js.map +1 -1
  816. package/lib/feature-libraries/chunked-forest/uniformChunk.js +71 -13
  817. package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  818. package/lib/feature-libraries/comparison-forest/comparisonForest.js +79 -79
  819. package/lib/feature-libraries/comparison-forest/comparisonForest.js.map +1 -1
  820. package/lib/feature-libraries/cursorComparator.d.ts +8 -0
  821. package/lib/feature-libraries/cursorComparator.d.ts.map +1 -1
  822. package/lib/feature-libraries/cursorComparator.js +43 -9
  823. package/lib/feature-libraries/cursorComparator.js.map +1 -1
  824. package/lib/feature-libraries/default-schema/defaultEditBuilder.js +3 -0
  825. package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  826. package/lib/feature-libraries/default-schema/mappedEditBuilder.js +2 -0
  827. package/lib/feature-libraries/default-schema/mappedEditBuilder.js.map +1 -1
  828. package/lib/feature-libraries/detachedFieldIndexSummarizer.js +2 -0
  829. package/lib/feature-libraries/detachedFieldIndexSummarizer.js.map +1 -1
  830. package/lib/feature-libraries/flex-tree/context.js +19 -3
  831. package/lib/feature-libraries/flex-tree/context.js.map +1 -1
  832. package/lib/feature-libraries/flex-tree/lazyEntity.js +12 -12
  833. package/lib/feature-libraries/flex-tree/lazyEntity.js.map +1 -1
  834. package/lib/feature-libraries/flex-tree/lazyField.js +25 -27
  835. package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
  836. package/lib/feature-libraries/flex-tree/lazyNode.js +22 -21
  837. package/lib/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  838. package/lib/feature-libraries/forest-summary/forestSummarizer.js +122 -117
  839. package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  840. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js +49 -32
  841. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -1
  842. package/lib/feature-libraries/index.d.ts +1 -1
  843. package/lib/feature-libraries/index.js.map +1 -1
  844. package/lib/feature-libraries/indexing/anchorTreeIndex.js +33 -29
  845. package/lib/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
  846. package/lib/feature-libraries/modular-schema/defaultRevisionReplacer.js +14 -12
  847. package/lib/feature-libraries/modular-schema/defaultRevisionReplacer.js.map +1 -1
  848. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts +63 -10
  849. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  850. package/lib/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  851. package/lib/feature-libraries/modular-schema/fieldKind.js +10 -0
  852. package/lib/feature-libraries/modular-schema/fieldKind.js.map +1 -1
  853. package/lib/feature-libraries/modular-schema/filterEdits.d.ts +13 -0
  854. package/lib/feature-libraries/modular-schema/filterEdits.d.ts.map +1 -0
  855. package/lib/feature-libraries/modular-schema/filterEdits.js +46 -0
  856. package/lib/feature-libraries/modular-schema/filterEdits.js.map +1 -0
  857. package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  858. package/lib/feature-libraries/modular-schema/genericFieldKind.js +5 -2
  859. package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  860. package/lib/feature-libraries/modular-schema/genericFieldKindFormat.d.ts +2 -2
  861. package/lib/feature-libraries/modular-schema/genericFieldKindFormat.d.ts.map +1 -1
  862. package/lib/feature-libraries/modular-schema/index.d.ts +1 -1
  863. package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
  864. package/lib/feature-libraries/modular-schema/index.js.map +1 -1
  865. package/lib/feature-libraries/modular-schema/invert.d.ts +1 -1
  866. package/lib/feature-libraries/modular-schema/invert.d.ts.map +1 -1
  867. package/lib/feature-libraries/modular-schema/invert.js +6 -30
  868. package/lib/feature-libraries/modular-schema/invert.js.map +1 -1
  869. package/lib/feature-libraries/modular-schema/minimizeModularChange.d.ts +5 -7
  870. package/lib/feature-libraries/modular-schema/minimizeModularChange.d.ts.map +1 -1
  871. package/lib/feature-libraries/modular-schema/minimizeModularChange.js +458 -8
  872. package/lib/feature-libraries/modular-schema/minimizeModularChange.js.map +1 -1
  873. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +1 -10
  874. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  875. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +20 -85
  876. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  877. package/lib/feature-libraries/modular-schema/modularChangeUtils.d.ts +13 -1
  878. package/lib/feature-libraries/modular-schema/modularChangeUtils.d.ts.map +1 -1
  879. package/lib/feature-libraries/modular-schema/modularChangeUtils.js +100 -3
  880. package/lib/feature-libraries/modular-schema/modularChangeUtils.js.map +1 -1
  881. package/lib/feature-libraries/modular-schema/prune.d.ts +2 -3
  882. package/lib/feature-libraries/modular-schema/prune.d.ts.map +1 -1
  883. package/lib/feature-libraries/modular-schema/prune.js +25 -7
  884. package/lib/feature-libraries/modular-schema/prune.js.map +1 -1
  885. package/lib/feature-libraries/node-identifier/mockNodeIdentifierManager.js +1 -3
  886. package/lib/feature-libraries/node-identifier/mockNodeIdentifierManager.js.map +1 -1
  887. package/lib/feature-libraries/node-identifier/nodeIdentifierManager.js +1 -0
  888. package/lib/feature-libraries/node-identifier/nodeIdentifierManager.js.map +1 -1
  889. package/lib/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  890. package/lib/feature-libraries/object-forest/objectForest.js +273 -266
  891. package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
  892. package/lib/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
  893. package/lib/feature-libraries/optional-field/optionalField.js +24 -32
  894. package/lib/feature-libraries/optional-field/optionalField.js.map +1 -1
  895. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts +1 -1
  896. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts.map +1 -1
  897. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts +1 -1
  898. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts.map +1 -1
  899. package/lib/feature-libraries/optional-field/optionalFieldCodecs.d.ts.map +1 -1
  900. package/lib/feature-libraries/schema-index/schemaSummarizer.js +3 -0
  901. package/lib/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
  902. package/lib/feature-libraries/schemaChecker.d.ts +9 -19
  903. package/lib/feature-libraries/schemaChecker.d.ts.map +1 -1
  904. package/lib/feature-libraries/schemaChecker.js +133 -49
  905. package/lib/feature-libraries/schemaChecker.js.map +1 -1
  906. package/lib/feature-libraries/sequence-field/compose.js +6 -0
  907. package/lib/feature-libraries/sequence-field/compose.js.map +1 -1
  908. package/lib/feature-libraries/sequence-field/filterEdits.d.ts +3 -3
  909. package/lib/feature-libraries/sequence-field/filterEdits.d.ts.map +1 -1
  910. package/lib/feature-libraries/sequence-field/filterEdits.js +31 -12
  911. package/lib/feature-libraries/sequence-field/filterEdits.js.map +1 -1
  912. package/lib/feature-libraries/sequence-field/formatV1.d.ts +3 -3
  913. package/lib/feature-libraries/sequence-field/formatV1.d.ts.map +1 -1
  914. package/lib/feature-libraries/sequence-field/formatV2.d.ts +3 -3
  915. package/lib/feature-libraries/sequence-field/formatV2.d.ts.map +1 -1
  916. package/lib/feature-libraries/sequence-field/formatV3.d.ts +2 -2
  917. package/lib/feature-libraries/sequence-field/formatV3.d.ts.map +1 -1
  918. package/lib/feature-libraries/sequence-field/markListFactory.js +3 -4
  919. package/lib/feature-libraries/sequence-field/markListFactory.js.map +1 -1
  920. package/lib/feature-libraries/sequence-field/markQueue.js +4 -2
  921. package/lib/feature-libraries/sequence-field/markQueue.js.map +1 -1
  922. package/lib/feature-libraries/sequence-field/rebase.js +6 -0
  923. package/lib/feature-libraries/sequence-field/rebase.js.map +1 -1
  924. package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts.map +1 -1
  925. package/lib/feature-libraries/sequence-field/sequenceFieldEditor.d.ts +9 -9
  926. package/lib/feature-libraries/sequence-field/sequenceFieldEditor.d.ts.map +1 -1
  927. package/lib/feature-libraries/sequence-field/utils.d.ts +2 -2
  928. package/lib/feature-libraries/sequence-field/utils.d.ts.map +1 -1
  929. package/lib/feature-libraries/sequence-field/utils.js +3 -15
  930. package/lib/feature-libraries/sequence-field/utils.js.map +1 -1
  931. package/lib/feature-libraries/treeCursorUtils.js +13 -9
  932. package/lib/feature-libraries/treeCursorUtils.js.map +1 -1
  933. package/lib/index.d.ts +4 -29
  934. package/lib/index.d.ts.map +1 -1
  935. package/lib/index.js +2 -17
  936. package/lib/index.js.map +1 -1
  937. package/lib/internalTypes.d.ts +1 -1
  938. package/lib/internalTypes.d.ts.map +1 -1
  939. package/lib/internalTypes.js.map +1 -1
  940. package/lib/packageVersion.d.ts +1 -1
  941. package/lib/packageVersion.d.ts.map +1 -1
  942. package/lib/packageVersion.js +1 -1
  943. package/lib/packageVersion.js.map +1 -1
  944. package/lib/serializableDomainSchema.d.ts +1 -1
  945. package/lib/shared-tree/history.d.ts.map +1 -1
  946. package/lib/shared-tree/history.js +32 -13
  947. package/lib/shared-tree/history.js.map +1 -1
  948. package/lib/shared-tree/independentView.d.ts +27 -3
  949. package/lib/shared-tree/independentView.d.ts.map +1 -1
  950. package/lib/shared-tree/independentView.js +30 -2
  951. package/lib/shared-tree/independentView.js.map +1 -1
  952. package/lib/shared-tree/index.d.ts +2 -1
  953. package/lib/shared-tree/index.d.ts.map +1 -1
  954. package/lib/shared-tree/index.js +2 -1
  955. package/lib/shared-tree/index.js.map +1 -1
  956. package/lib/shared-tree/schematizingTreeView.d.ts +14 -4
  957. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  958. package/lib/shared-tree/schematizingTreeView.js +109 -39
  959. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  960. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  961. package/lib/shared-tree/sharedTree.js +24 -15
  962. package/lib/shared-tree/sharedTree.js.map +1 -1
  963. package/lib/shared-tree/sharedTreeChangeEnricher.d.ts.map +1 -1
  964. package/lib/shared-tree/sharedTreeChangeEnricher.js +12 -4
  965. package/lib/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
  966. package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  967. package/lib/shared-tree/sharedTreeChangeFamily.js +6 -3
  968. package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  969. package/lib/shared-tree/sharedTreeEditBuilder.js +2 -0
  970. package/lib/shared-tree/sharedTreeEditBuilder.js.map +1 -1
  971. package/lib/shared-tree/transactionMinimize.d.ts.map +1 -1
  972. package/lib/shared-tree/transactionMinimize.js +4 -3
  973. package/lib/shared-tree/transactionMinimize.js.map +1 -1
  974. package/lib/shared-tree/treeAlpha.d.ts +5 -16
  975. package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
  976. package/lib/shared-tree/treeAlpha.js +13 -6
  977. package/lib/shared-tree/treeAlpha.js.map +1 -1
  978. package/{dist/simple-tree/api → lib/shared-tree}/treeBeta.d.ts +8 -65
  979. package/lib/shared-tree/treeBeta.d.ts.map +1 -0
  980. package/lib/shared-tree/treeBeta.js +64 -0
  981. package/lib/shared-tree/treeBeta.js.map +1 -0
  982. package/lib/shared-tree/treeCheckout.d.ts +5 -0
  983. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  984. package/lib/shared-tree/treeCheckout.js +985 -906
  985. package/lib/shared-tree/treeCheckout.js.map +1 -1
  986. package/lib/shared-tree/unhydratedTreeContext.js +3 -4
  987. package/lib/shared-tree/unhydratedTreeContext.js.map +1 -1
  988. package/lib/shared-tree-core/branch.d.ts.map +1 -1
  989. package/lib/shared-tree-core/branch.js +22 -18
  990. package/lib/shared-tree-core/branch.js.map +1 -1
  991. package/lib/shared-tree-core/branchCommitCounter.js +35 -32
  992. package/lib/shared-tree-core/branchCommitCounter.js.map +1 -1
  993. package/lib/shared-tree-core/branchCommitEnricher.js +9 -8
  994. package/lib/shared-tree-core/branchCommitEnricher.js.map +1 -1
  995. package/lib/shared-tree-core/customMetadataFormat.d.ts.map +1 -1
  996. package/lib/shared-tree-core/defaultResubmitMachine.js +11 -9
  997. package/lib/shared-tree-core/defaultResubmitMachine.js.map +1 -1
  998. package/lib/shared-tree-core/editManager.d.ts.map +1 -1
  999. package/lib/shared-tree-core/editManager.js +73 -44
  1000. package/lib/shared-tree-core/editManager.js.map +1 -1
  1001. package/lib/shared-tree-core/editManagerCodecsCommons.d.ts +1 -1
  1002. package/lib/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
  1003. package/lib/shared-tree-core/editManagerCodecsCommons.js +32 -34
  1004. package/lib/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
  1005. package/lib/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -1
  1006. package/lib/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
  1007. package/lib/shared-tree-core/editManagerFormatCommons.d.ts +4 -4
  1008. package/lib/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
  1009. package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts +2 -1
  1010. package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -1
  1011. package/lib/shared-tree-core/editManagerFormatVSharedBranches.d.ts +2 -1
  1012. package/lib/shared-tree-core/editManagerFormatVSharedBranches.d.ts.map +1 -1
  1013. package/lib/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
  1014. package/lib/shared-tree-core/editManagerSummarizer.js +6 -1
  1015. package/lib/shared-tree-core/editManagerSummarizer.js.map +1 -1
  1016. package/lib/shared-tree-core/messageFormatV1ToV4.d.ts +2 -1
  1017. package/lib/shared-tree-core/messageFormatV1ToV4.d.ts.map +1 -1
  1018. package/lib/shared-tree-core/messageFormatVSharedBranches.d.ts +2 -1
  1019. package/lib/shared-tree-core/messageFormatVSharedBranches.d.ts.map +1 -1
  1020. package/lib/shared-tree-core/sequenceIdUtils.d.ts.map +1 -1
  1021. package/lib/shared-tree-core/sharedTreeCore.js +45 -23
  1022. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  1023. package/lib/shared-tree-core/transaction.js +36 -39
  1024. package/lib/shared-tree-core/transaction.js.map +1 -1
  1025. package/lib/shared-tree-core/versionedSummarizer.js +4 -0
  1026. package/lib/shared-tree-core/versionedSummarizer.js.map +1 -1
  1027. package/lib/simple-tree/api/cloneTree.d.ts +11 -0
  1028. package/lib/simple-tree/api/cloneTree.d.ts.map +1 -0
  1029. package/lib/simple-tree/api/cloneTree.js +28 -0
  1030. package/lib/simple-tree/api/cloneTree.js.map +1 -0
  1031. package/lib/simple-tree/api/configuration.d.ts +4 -4
  1032. package/lib/simple-tree/api/configuration.d.ts.map +1 -1
  1033. package/lib/simple-tree/api/configuration.js +19 -0
  1034. package/lib/simple-tree/api/configuration.js.map +1 -1
  1035. package/lib/simple-tree/api/discrepancies.d.ts +36 -3
  1036. package/lib/simple-tree/api/discrepancies.d.ts.map +1 -1
  1037. package/lib/simple-tree/api/discrepancies.js +40 -14
  1038. package/lib/simple-tree/api/discrepancies.js.map +1 -1
  1039. package/lib/simple-tree/api/index.d.ts +5 -4
  1040. package/lib/simple-tree/api/index.d.ts.map +1 -1
  1041. package/lib/simple-tree/api/index.js +2 -2
  1042. package/lib/simple-tree/api/index.js.map +1 -1
  1043. package/lib/simple-tree/api/schemaCompatibilityTester.d.ts +22 -3
  1044. package/lib/simple-tree/api/schemaCompatibilityTester.d.ts.map +1 -1
  1045. package/lib/simple-tree/api/schemaCompatibilityTester.js +136 -7
  1046. package/lib/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
  1047. package/lib/simple-tree/api/schemaCreationUtilities.d.ts +3 -7
  1048. package/lib/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -1
  1049. package/lib/simple-tree/api/schemaCreationUtilities.js +1 -3
  1050. package/lib/simple-tree/api/schemaCreationUtilities.js.map +1 -1
  1051. package/lib/simple-tree/api/schemaFactory.d.ts +4 -9
  1052. package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
  1053. package/lib/simple-tree/api/schemaFactory.js +9 -8
  1054. package/lib/simple-tree/api/schemaFactory.js.map +1 -1
  1055. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +18 -20
  1056. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  1057. package/lib/simple-tree/api/schemaFactoryAlpha.js +78 -81
  1058. package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  1059. package/lib/simple-tree/api/schemaFactoryBeta.d.ts +7 -9
  1060. package/lib/simple-tree/api/schemaFactoryBeta.d.ts.map +1 -1
  1061. package/lib/simple-tree/api/schemaFactoryBeta.js +32 -35
  1062. package/lib/simple-tree/api/schemaFactoryBeta.js.map +1 -1
  1063. package/lib/simple-tree/api/schemaStatics.d.ts +7 -7
  1064. package/lib/simple-tree/api/schemaStatics.d.ts.map +1 -1
  1065. package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts +46 -2
  1066. package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -1
  1067. package/lib/simple-tree/api/snapshotCompatibilityChecker.js +48 -6
  1068. package/lib/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
  1069. package/lib/simple-tree/api/transactionTypes.d.ts +4 -4
  1070. package/lib/simple-tree/api/transactionTypes.js.map +1 -1
  1071. package/lib/simple-tree/api/tree.d.ts +243 -58
  1072. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  1073. package/lib/simple-tree/api/tree.js +2 -3
  1074. package/lib/simple-tree/api/tree.js.map +1 -1
  1075. package/lib/simple-tree/api/treeChangeEvents.d.ts +16 -4
  1076. package/lib/simple-tree/api/treeChangeEvents.d.ts.map +1 -1
  1077. package/lib/simple-tree/api/treeChangeEvents.js.map +1 -1
  1078. package/lib/simple-tree/api/treeChangeEventsBeta.d.ts +209 -0
  1079. package/lib/simple-tree/api/treeChangeEventsBeta.d.ts.map +1 -0
  1080. package/lib/simple-tree/api/{treeAlpha.js → treeChangeEventsBeta.js} +1 -1
  1081. package/lib/simple-tree/api/treeChangeEventsBeta.js.map +1 -0
  1082. package/lib/simple-tree/api/treeNodeApi.d.ts +1 -75
  1083. package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  1084. package/lib/simple-tree/api/treeNodeApi.js +1 -1
  1085. package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
  1086. package/lib/simple-tree/api/typesUnsafe.d.ts +8 -6
  1087. package/lib/simple-tree/api/typesUnsafe.d.ts.map +1 -1
  1088. package/lib/simple-tree/api/typesUnsafe.js.map +1 -1
  1089. package/lib/simple-tree/core/allowedTypes.js +12 -3
  1090. package/lib/simple-tree/core/allowedTypes.js.map +1 -1
  1091. package/lib/simple-tree/core/context.js +3 -0
  1092. package/lib/simple-tree/core/context.js.map +1 -1
  1093. package/lib/simple-tree/core/index.d.ts +1 -1
  1094. package/lib/simple-tree/core/index.d.ts.map +1 -1
  1095. package/lib/simple-tree/core/index.js +1 -1
  1096. package/lib/simple-tree/core/index.js.map +1 -1
  1097. package/lib/simple-tree/core/toStored.d.ts +7 -0
  1098. package/lib/simple-tree/core/toStored.d.ts.map +1 -1
  1099. package/lib/simple-tree/core/toStored.js.map +1 -1
  1100. package/lib/simple-tree/core/treeNode.d.ts +3 -4
  1101. package/lib/simple-tree/core/treeNode.d.ts.map +1 -1
  1102. package/lib/simple-tree/core/treeNode.js +29 -30
  1103. package/lib/simple-tree/core/treeNode.js.map +1 -1
  1104. package/lib/simple-tree/core/treeNodeKernel.js +181 -179
  1105. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
  1106. package/lib/simple-tree/core/treeNodeValid.d.ts.map +1 -1
  1107. package/lib/simple-tree/core/treeNodeValid.js +22 -22
  1108. package/lib/simple-tree/core/treeNodeValid.js.map +1 -1
  1109. package/lib/simple-tree/core/unhydratedFlexTree.js +173 -146
  1110. package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  1111. package/lib/simple-tree/core/withType.d.ts +7 -9
  1112. package/lib/simple-tree/core/withType.d.ts.map +1 -1
  1113. package/lib/simple-tree/core/withType.js +5 -6
  1114. package/lib/simple-tree/core/withType.js.map +1 -1
  1115. package/lib/simple-tree/fieldSchema.d.ts.map +1 -1
  1116. package/lib/simple-tree/fieldSchema.js +23 -5
  1117. package/lib/simple-tree/fieldSchema.js.map +1 -1
  1118. package/lib/simple-tree/index.d.ts +2 -2
  1119. package/lib/simple-tree/index.d.ts.map +1 -1
  1120. package/lib/simple-tree/index.js +2 -2
  1121. package/lib/simple-tree/index.js.map +1 -1
  1122. package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
  1123. package/lib/simple-tree/leafNodeSchema.js +16 -15
  1124. package/lib/simple-tree/leafNodeSchema.js.map +1 -1
  1125. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts +3 -2
  1126. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  1127. package/lib/simple-tree/node-kinds/array/arrayNode.js +28 -32
  1128. package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  1129. package/lib/simple-tree/node-kinds/array/arrayNodeTypes.d.ts.map +1 -1
  1130. package/lib/simple-tree/node-kinds/map/mapNode.d.ts +6 -6
  1131. package/lib/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
  1132. package/lib/simple-tree/node-kinds/map/mapNode.js +10 -17
  1133. package/lib/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  1134. package/lib/simple-tree/node-kinds/map/mapNodeTypes.d.ts.map +1 -1
  1135. package/lib/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  1136. package/lib/simple-tree/node-kinds/object/objectNode.js +25 -28
  1137. package/lib/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  1138. package/lib/simple-tree/node-kinds/object/objectNodeTypes.d.ts +1 -1
  1139. package/lib/simple-tree/node-kinds/object/objectNodeTypes.d.ts.map +1 -1
  1140. package/lib/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
  1141. package/lib/simple-tree/node-kinds/record/recordNode.js +10 -14
  1142. package/lib/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  1143. package/lib/simple-tree/node-kinds/record/recordNodeTypes.d.ts +3 -2
  1144. package/lib/simple-tree/node-kinds/record/recordNodeTypes.d.ts.map +1 -1
  1145. package/lib/simple-tree/node-kinds/record/recordNodeTypes.js.map +1 -1
  1146. package/lib/tableSchema.d.ts +2 -87
  1147. package/lib/tableSchema.d.ts.map +1 -1
  1148. package/lib/tableSchema.js +309 -275
  1149. package/lib/tableSchema.js.map +1 -1
  1150. package/lib/text/codePointUtils.d.ts +16 -3
  1151. package/lib/text/codePointUtils.d.ts.map +1 -1
  1152. package/lib/text/codePointUtils.js +22 -10
  1153. package/lib/text/codePointUtils.js.map +1 -1
  1154. package/lib/text/textDomain.d.ts +7 -1
  1155. package/lib/text/textDomain.d.ts.map +1 -1
  1156. package/lib/text/textDomain.js +21 -17
  1157. package/lib/text/textDomain.js.map +1 -1
  1158. package/lib/text/textDomainFormatted.d.ts.map +1 -1
  1159. package/lib/text/textDomainFormatted.js +43 -32
  1160. package/lib/text/textDomainFormatted.js.map +1 -1
  1161. package/lib/text/textDomainFormattedDefault.js +2 -5
  1162. package/lib/text/textDomainFormattedDefault.js.map +1 -1
  1163. package/lib/util/brand.js +1 -0
  1164. package/lib/util/brand.js.map +1 -1
  1165. package/lib/util/breakable.d.ts.map +1 -1
  1166. package/lib/util/breakable.js +3 -0
  1167. package/lib/util/breakable.js.map +1 -1
  1168. package/lib/util/compressedIds.js +22 -0
  1169. package/lib/util/compressedIds.js.map +1 -1
  1170. package/lib/util/nestedMap.js +2 -4
  1171. package/lib/util/nestedMap.js.map +1 -1
  1172. package/lib/util/offsetList.js +2 -4
  1173. package/lib/util/offsetList.js.map +1 -1
  1174. package/lib/util/rangeMap.js +4 -0
  1175. package/lib/util/rangeMap.js.map +1 -1
  1176. package/lib/util/readSnapshotBlob.d.ts.map +1 -1
  1177. package/lib/util/referenceCounting.js +1 -0
  1178. package/lib/util/referenceCounting.js.map +1 -1
  1179. package/lib/util/stackyIterator.js +3 -2
  1180. package/lib/util/stackyIterator.js.map +1 -1
  1181. package/lib/util/utils.d.ts +2 -2
  1182. package/lib/util/utils.d.ts.map +1 -1
  1183. package/package.json +67 -95
  1184. package/src/api.ts +11 -0
  1185. package/src/core/index.ts +6 -2
  1186. package/src/core/rebase/index.ts +1 -0
  1187. package/src/core/rebase/types.ts +16 -1
  1188. package/src/core/tree/anchorSet.ts +2 -2
  1189. package/src/core/tree/deltaUtil.ts +67 -13
  1190. package/src/core/tree/index.ts +5 -2
  1191. package/src/entrypoints/alpha.ts +21 -20
  1192. package/src/entrypoints/beta.ts +14 -5
  1193. package/src/entrypoints/legacy.ts +14 -5
  1194. package/src/entrypoints/public.ts +1 -5
  1195. package/src/extensibleUnionNode.ts +1 -2
  1196. package/src/feature-libraries/cursorComparator.ts +57 -9
  1197. package/src/feature-libraries/index.ts +1 -1
  1198. package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +77 -12
  1199. package/src/feature-libraries/modular-schema/filterEdits.ts +108 -0
  1200. package/src/feature-libraries/modular-schema/genericFieldKind.ts +7 -4
  1201. package/src/feature-libraries/modular-schema/index.ts +5 -2
  1202. package/src/feature-libraries/modular-schema/invert.ts +16 -61
  1203. package/src/feature-libraries/modular-schema/minimizeModularChange.ts +831 -10
  1204. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +10 -124
  1205. package/src/feature-libraries/modular-schema/modularChangeUtils.ts +164 -2
  1206. package/src/feature-libraries/modular-schema/prune.ts +52 -10
  1207. package/src/feature-libraries/optional-field/optionalField.ts +30 -42
  1208. package/src/feature-libraries/schemaChecker.ts +198 -82
  1209. package/src/feature-libraries/sequence-field/filterEdits.ts +62 -26
  1210. package/src/feature-libraries/sequence-field/utils.ts +7 -19
  1211. package/src/index.ts +10 -39
  1212. package/src/internalTypes.ts +1 -1
  1213. package/src/packageVersion.ts +1 -1
  1214. package/src/shared-tree/history.ts +41 -19
  1215. package/src/shared-tree/independentView.ts +40 -3
  1216. package/src/shared-tree/index.ts +5 -1
  1217. package/src/shared-tree/schematizingTreeView.ts +77 -23
  1218. package/src/shared-tree/sharedTree.ts +2 -1
  1219. package/src/shared-tree/transactionMinimize.ts +13 -4
  1220. package/src/shared-tree/treeAlpha.ts +17 -31
  1221. package/src/{simple-tree/api → shared-tree}/treeBeta.ts +56 -167
  1222. package/src/shared-tree/treeCheckout.ts +82 -9
  1223. package/src/shared-tree-core/editManager.ts +16 -8
  1224. package/src/shared-tree-core/editManagerCodecsCommons.ts +30 -34
  1225. package/src/shared-tree-core/editManagerCodecsV1toV4.ts +1 -1
  1226. package/src/shared-tree-core/editManagerCodecsVSharedBranches.ts +2 -2
  1227. package/src/simple-tree/api/cloneTree.ts +47 -0
  1228. package/src/simple-tree/api/configuration.ts +4 -4
  1229. package/src/simple-tree/api/discrepancies.ts +100 -5
  1230. package/src/simple-tree/api/index.ts +22 -22
  1231. package/src/simple-tree/api/schemaCompatibilityTester.ts +185 -11
  1232. package/src/simple-tree/api/schemaFactoryAlpha.ts +2 -2
  1233. package/src/simple-tree/api/snapshotCompatibilityChecker.ts +87 -6
  1234. package/src/simple-tree/api/transactionTypes.ts +4 -4
  1235. package/src/simple-tree/api/tree.ts +318 -87
  1236. package/src/simple-tree/api/treeChangeEvents.ts +16 -4
  1237. package/src/simple-tree/api/treeChangeEventsBeta.ts +245 -0
  1238. package/src/simple-tree/api/treeNodeApi.ts +6 -85
  1239. package/src/simple-tree/api/typesUnsafe.ts +8 -6
  1240. package/src/simple-tree/core/index.ts +1 -1
  1241. package/src/simple-tree/core/toStored.ts +8 -0
  1242. package/src/simple-tree/core/treeNode.ts +3 -10
  1243. package/src/simple-tree/core/treeNodeValid.ts +3 -1
  1244. package/src/simple-tree/core/withType.ts +8 -11
  1245. package/src/simple-tree/index.ts +7 -7
  1246. package/src/simple-tree/node-kinds/array/arrayNode.ts +14 -12
  1247. package/src/simple-tree/node-kinds/map/mapNode.ts +14 -15
  1248. package/src/simple-tree/node-kinds/object/objectNode.ts +3 -6
  1249. package/src/simple-tree/node-kinds/record/recordNode.ts +6 -8
  1250. package/src/simple-tree/node-kinds/record/recordNodeTypes.ts +2 -1
  1251. package/src/tableSchema.ts +8 -187
  1252. package/src/text/codePointUtils.ts +25 -14
  1253. package/src/text/textDomain.ts +15 -2
  1254. package/src/text/textDomainFormatted.ts +9 -4
  1255. package/tsconfig.json +1 -1
  1256. package/alpha.d.ts +0 -11
  1257. package/beta.d.ts +0 -11
  1258. package/dist/simple-tree/api/treeAlpha.d.ts +0 -126
  1259. package/dist/simple-tree/api/treeAlpha.d.ts.map +0 -1
  1260. package/dist/simple-tree/api/treeAlpha.js.map +0 -1
  1261. package/dist/simple-tree/api/treeBeta.d.ts.map +0 -1
  1262. package/dist/simple-tree/api/treeBeta.js +0 -83
  1263. package/dist/simple-tree/api/treeBeta.js.map +0 -1
  1264. package/docs/main/runtime-schema-upgrade.md +0 -208
  1265. package/internal.d.ts +0 -11
  1266. package/legacy.d.ts +0 -11
  1267. package/lib/simple-tree/api/treeAlpha.d.ts +0 -126
  1268. package/lib/simple-tree/api/treeAlpha.d.ts.map +0 -1
  1269. package/lib/simple-tree/api/treeAlpha.js.map +0 -1
  1270. package/lib/simple-tree/api/treeBeta.d.ts.map +0 -1
  1271. package/lib/simple-tree/api/treeBeta.js +0 -77
  1272. package/lib/simple-tree/api/treeBeta.js.map +0 -1
  1273. package/src/simple-tree/api/treeAlpha.ts +0 -153
  1274. /package/api-extractor/{api-extractor.current.json → api-extractor-report.current.json} +0 -0
  1275. /package/api-extractor/{api-extractor.legacy.json → api-extractor-report.legacy.json} +0 -0
package/lib/api.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,QAAQ,EACR,aAAa,EACb,YAAY,EACZ,oBAAoB,EACpB,mBAAmB,EACnB,qBAAqB,EACrB,0BAA0B,EAC1B,aAAa,EACb,kBAAkB,EAClB,WAAW,EACX,gBAAgB,EAChB,MAAM,wBAAwB,CAAC;AAEhC;;;;GAIG;AAEH;;;GAGG;AACH,wBAAgB,OAAO,CAAC,OAAO,SAAS,mBAAmB,EAC1D,IAAI,EAAE,QAAQ,CAAC,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AqB,CAAC,OAAO,CAAC,GAClC,0BAA0B,CAAC,OAAO,CAAC,CAAC;AAEvC;;;GAGG;AACH,wBAAgB,OAAO,CAAC,aAAa,SAAS,oBAAoB,EACjE,IAAI,EAAE,aAAa,CAAC,aAAa,CAAC,GAChC,kBAAkB,CAAC,aAAa,CAAC,CAAC;AAErC;;;GAGG;AACH,wBAAgB,OAAO,CAAC,aAAa,SAAS,oBAAoB,EACjE,IAAI,EAAE,WAAW,CAAC,aAAa,CAAC,GAC9B,gBAAgB,CAAC,aAAa,CAAC,CAAC;AASnC;;;GAGG;AACH,wBAAgB,MAAM,CAAC,OAAO,SAAS,mBAAmB,EACzD,IAAI,EAAE,QAAQ,CAAC,OAAO,CAAC,GACrB,YAAY,CAAC,OAAO,CAAC,CAEvB"}
package/lib/api.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAsDH;;GAEG;AACH,MAAM,UAAU,OAAO,CAAC,IAAa;IACpC,OAAO,IAAI,CAAC;AACb,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,MAAM,CACrB,IAAuB;IAEvB,OAAO,IAA6B,CAAC;AACtC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tTreeView,\n\tTreeViewAlpha,\n\tTreeViewBeta,\n\tImplicitAllowedTypes,\n\tImplicitFieldSchema,\n\tTreeViewConfiguration,\n\tTreeViewConfigurationAlpha,\n\tTreeArrayNode,\n\tTreeArrayNodeAlpha,\n\tTreeMapNode,\n\tTreeMapNodeAlpha,\n} from \"./simple-tree/index.js\";\n\n/**\n * Module entry points for retrieving alternate (alpha/beta) versions of tree APIs.\n * For each API (usually a class) that has an alpha/beta version, add overloads to the function(s) below.\n * These functions should only be used by external consumers, not referenced internally within the tree package, to avoid circular import dependencies.\n */\n\n/**\n * Retrieve the {@link TreeViewAlpha | alpha API} for a {@link TreeView}.\n * @alpha\n */\nexport function asAlpha<TSchema extends ImplicitFieldSchema>(\n\tview: TreeView<TSchema>,\n): TreeViewAlpha<TSchema>;\n\n/**\n * Retrieve the {@link TreeViewConfigurationAlpha | alpha API} for a {@link TreeViewConfiguration}.\n * @alpha\n */\nexport function asAlpha<TSchema extends ImplicitFieldSchema>(\n\tview: TreeViewConfiguration<TSchema>,\n): TreeViewConfigurationAlpha<TSchema>;\n\n/**\n * Retrieve the {@link TreeArrayNodeAlpha | alpha API} for a {@link (TreeArrayNode:interface)}.\n * @alpha\n */\nexport function asAlpha<TAllowedTypes extends ImplicitAllowedTypes>(\n\tnode: TreeArrayNode<TAllowedTypes>,\n): TreeArrayNodeAlpha<TAllowedTypes>;\n\n/**\n * Retrieve the {@link TreeMapNodeAlpha | alpha API} for a {@link TreeMapNode}.\n * @alpha\n */\nexport function asAlpha<TAllowedTypes extends ImplicitAllowedTypes>(\n\tnode: TreeMapNode<TAllowedTypes>,\n): TreeMapNodeAlpha<TAllowedTypes>;\n\n/**\n * Implementation of overloads for {@link asAlpha}.\n */\nexport function asAlpha(view: unknown): unknown {\n\treturn view;\n}\n\n/**\n * Retrieve the {@link TreeViewBeta | beta API} for a {@link TreeView}.\n * @beta\n */\nexport function asBeta<TSchema extends ImplicitFieldSchema>(\n\tview: TreeView<TSchema>,\n): TreeViewBeta<TSchema> {\n\treturn view as TreeViewBeta<TSchema>;\n}\n"]}
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAiEH;;GAEG;AACH,MAAM,UAAU,OAAO,CAAC,IAAa;IACpC,OAAO,IAAI,CAAC;AACb,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,MAAM,CACrB,IAAuB;IAEvB,OAAO,IAA6B,CAAC;AACtC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tITree,\n\tITreeAlpha,\n\tTreeView,\n\tTreeViewAlpha,\n\tTreeViewBeta,\n\tImplicitAllowedTypes,\n\tImplicitFieldSchema,\n\tTreeViewConfiguration,\n\tTreeViewConfigurationAlpha,\n\tTreeArrayNode,\n\tTreeArrayNodeAlpha,\n\tTreeMapNode,\n\tTreeMapNodeAlpha,\n} from \"./simple-tree/index.js\";\n\n/**\n * Module entry points for retrieving alternate (alpha/beta) versions of tree APIs.\n * For each API (usually a class) that has an alpha/beta version, add overloads to the function(s) below.\n * These functions should only be used by external consumers, not referenced internally within the tree package, to avoid circular import dependencies.\n *\n * These are only valid if all implementations are guaranteed to implement the alpha API:\n * cases like SchemaFactory which allow users to construct non-alpha versions must not be added here.\n */\n\n/**\n * Retrieve the {@link ITreeAlpha | alpha API} for an {@link ITree}.\n * @alpha\n */\nexport function asAlpha(tree: ITree): ITreeAlpha;\n\n/**\n * Retrieve the {@link TreeViewAlpha | alpha API} for a {@link TreeView}.\n * @alpha\n */\nexport function asAlpha<TSchema extends ImplicitFieldSchema>(\n\tview: TreeView<TSchema>,\n): TreeViewAlpha<TSchema>;\n\n/**\n * Retrieve the {@link TreeViewConfigurationAlpha | alpha API} for a {@link TreeViewConfiguration}.\n * @alpha\n */\nexport function asAlpha<TSchema extends ImplicitFieldSchema>(\n\tview: TreeViewConfiguration<TSchema>,\n): TreeViewConfigurationAlpha<TSchema>;\n\n/**\n * Retrieve the {@link TreeArrayNodeAlpha | alpha API} for a {@link (TreeArrayNode:interface)}.\n * @alpha\n */\nexport function asAlpha<TAllowedTypes extends ImplicitAllowedTypes>(\n\tnode: TreeArrayNode<TAllowedTypes>,\n): TreeArrayNodeAlpha<TAllowedTypes>;\n\n/**\n * Retrieve the {@link TreeMapNodeAlpha | alpha API} for a {@link TreeMapNode}.\n * @alpha\n */\nexport function asAlpha<TAllowedTypes extends ImplicitAllowedTypes>(\n\tnode: TreeMapNode<TAllowedTypes>,\n): TreeMapNodeAlpha<TAllowedTypes>;\n\n/**\n * Implementation of overloads for {@link asAlpha}.\n */\nexport function asAlpha(view: unknown): unknown {\n\treturn view;\n}\n\n/**\n * Retrieve the {@link TreeViewBeta | beta API} for a {@link TreeView}.\n * @beta\n */\nexport function asBeta<TSchema extends ImplicitFieldSchema>(\n\tview: TreeView<TSchema>,\n): TreeViewBeta<TSchema> {\n\treturn view as TreeViewBeta<TSchema>;\n}\n"]}
@@ -255,8 +255,8 @@ export declare class MappedDependentFormatVersion<TParentVersion extends FormatV
255
255
  }
256
256
  export declare const DependentFormatVersion: {
257
257
  fromUnique: <TChildVersion extends FormatVersion>(child: TChildVersion) => UniqueDependentFormatVersion<TChildVersion>;
258
- fromMap: <TParentVersion extends FormatVersion, TChildVersion_1 extends FormatVersion>(map: ReadonlyMap<TParentVersion, TChildVersion_1>) => MappedDependentFormatVersion<TParentVersion, TChildVersion_1>;
259
- fromPairs: <TParentVersion_1 extends FormatVersion, TChildVersion_2 extends FormatVersion>(pairs: Iterable<[TParentVersion_1, TChildVersion_2]>) => MappedDependentFormatVersion<TParentVersion_1, TChildVersion_2>;
258
+ fromMap: <TParentVersion extends FormatVersion, TChildVersion extends FormatVersion>(map: ReadonlyMap<TParentVersion, TChildVersion>) => MappedDependentFormatVersion<TParentVersion, TChildVersion>;
259
+ fromPairs: <TParentVersion extends FormatVersion, TChildVersion extends FormatVersion>(pairs: Iterable<[TParentVersion, TChildVersion]>) => MappedDependentFormatVersion<TParentVersion, TChildVersion>;
260
260
  };
261
261
  /**
262
262
  * Creates a codec family from a registry of codecs.
@@ -1 +1 @@
1
- {"version":3,"file":"codec.d.ts","sourceRoot":"","sources":["../../src/codec/codec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAE3E,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,8CAA8C,CAAC;AAEjG,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM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AEG;AACH,eAAO,MAAM,SAAS,EAAE,UAAU,CACjC,CAAC,EACD,sBAAsB,EACtB,sBAAsB,EACtB,OAAO,CAIP,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,oBAAoB,CACnC,eAAe,EACf,aAAa,SAAS,OAAO,EAC7B,cAAc,EACd,SAAS,EACT,cAAc,EACd,cAAc,GAAG,cAAc,EAE/B,MAAM,EAAE,aAAa,EACrB,KAAK,EAAE,UAAU,CAChB,eAAe,EACf,cAAc,EACd,SAAS,EACT,cAAc,EACd,cAAc,CACd,EACD,SAAS,CAAC,EAAE,aAAa,GAAG,eAAe,GACzC,UAAU,CAAC,eAAe,EAAE,cAAc,EAAE,SAAS,EAAE,cAAc,EAAE,cAAc,CAAC,CAqBxF;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,kBAAkB;IAC9B;;OAEG;;IAGH;;;;;;;;OAQG;;IAGH;;;;;OAKG;;IAGH;;;;;OAKG;;IAGH;;;;;;;;;;;OAWG;;IAGH;;;;;;;;OAQG;;IAGH;;;;;;;;;;;;;;;;OAgBG;;CAE6D,CAAC;AAElE;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,cAAc,EAAE,4BAAgE,CAAC;AAE9F;;;;;;;GAOG;AACH,MAAM,WAAW,SAAS,CAAC,cAAc,SAAS,aAAa,GAAG,aAAa;IAC9E,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;IACjC,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,SAAS,EAAE,CAAC;CACzC;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,SAAS,GAAG,sBAAsB,CAMzE"}
@@ -36,6 +36,7 @@ export function eraseEncodedType(codec) {
36
36
  return codec;
37
37
  }
38
38
  export class UniqueDependentFormatVersion {
39
+ child;
39
40
  constructor(child) {
40
41
  this.child = child;
41
42
  }
@@ -44,6 +45,7 @@ export class UniqueDependentFormatVersion {
44
45
  }
45
46
  }
46
47
  export class MappedDependentFormatVersion {
48
+ map;
47
49
  constructor(map) {
48
50
  this.map = map;
49
51
  }
@@ -1 +1 @@
1
- {"version":3,"file":"codec.js","sourceRoot":"","sources":["../../src/codec/codec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,qCAAqC,CAAC;AAEnE,OAAO,EAAE,qBAAqB,IAAI,iCAAiC,EAAE,MAAM,wCAAwC,CAAC;AA0DpH;;;;GAIG;AACH,MAAM,aAAa,GAAkB;IACpC,OAAO,EAAE,GAA2B,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,IAAI,EAA0B,EAAE,CAAC,IAAI,EAAE,CAAC;CAC1F,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,iBAAiB,CAAC,aAAa,CAAC,CAAC;AAEpE;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAsB;IACvD,OAAO,OAAqC,CAAC;AAC9C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAAsC;IAC1E,OAAO,KAAiC,CAAC;AAC1C,CAAC;AA0ID;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAO/B,KAAgF;IAEhF,OAAO,KAMN,CAAC;AACH,CAAC;AA4ED,MAAM,OAAO,4BAA4B;IAGxC,YAAoC,KAAoB;QAApB,UAAK,GAAL,KAAK,CAAe;IAAG,CAAC;IACrD,MAAM,CAAC,OAAsB;QACnC,OAAO,IAAI,CAAC,KAAK,CAAC;IACnB,CAAC;CACD;AAED,MAAM,OAAO,4BAA4B;IAKxC,YAAoC,GAA+C;QAA/C,QAAG,GAAH,GAAG,CAA4C;IAAG,CAAC;IAChF,MAAM,CAAC,MAAsB;QACnC,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,4BAA4B,CAAC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C;AAgB9F,MAAM,UAAU,iBAAiB,CAAC,IAAe;IAChD,OAAO;QACN,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,OAAO,EAAE,IAAI,CAAC,OAAO,IAAI,MAAM;QAC/B,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,iBAAiB,CAAC;KAC/C,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ErasedType } from \"@fluidframework/core-interfaces/internal\";\nimport { assert, fail } from \"@fluidframework/core-utils/internal\";\nimport type { OldestSupportedClientVersion } from \"@fluidframework/runtime-definitions/internal\";\nimport { cleanedPackageVersion as runtimeUtilsCleanedPackageVersion } from \"@fluidframework/runtime-utils/internal\";\nimport type { Static, TAnySchema, TSchema } from \"@sinclair/typebox\";\n\nimport type { JsonCompatibleReadOnly } from \"../util/index.js\";\n\n/**\n * Translates decoded data to encoded data.\n * @remarks Typically paired with an {@link IEncoder}.\n */\nexport interface IEncoder<TDecoded, TEncoded, TContext> {\n\t/**\n\t * Encodes `obj` into some encoded format.\n\t */\n\tencode(obj: TDecoded, context: TContext): TEncoded;\n}\n\n/**\n * Translates encoded data to decoded data.\n * @remarks Typically paired with an {@link IEncoder}.\n */\nexport interface IDecoder<TDecoded, TEncoded, TContext> {\n\t/**\n\t * Decodes `obj` from some encoded format.\n\t */\n\tdecode(obj: TEncoded, context: TContext): TDecoded;\n}\n\n/**\n * Validates data complies with some particular schema.\n * Implementations are typically created by a {@link JsonValidator}.\n */\nexport interface SchemaValidationFunction<Schema extends TSchema> {\n\t/**\n\t * Returns whether the data matches a schema.\n\t */\n\tcheck(data: unknown): data is Static<Schema>;\n}\n\n/**\n * A kind of validator for SharedTree's internal data formats.\n * @remarks\n * Assuming no data corruption or type confusion, such validation should never fail.\n * Any client version compatibility issues should instead be detected by the data format versioning which Shared Tree does internally independent of data format validation.\n * However, persisted data can sometimes be corrupted, bugs can produce invalid data, or users can mix up which data is compatible with which APIs.\n * In such cases, a format validator can help catch issues.\n *\n * Current options are {@link FormatValidatorNoOp} and {@link FormatValidatorBasic}.\n * @privateRemarks\n * Implement using {@link toFormatValidator}.\n * Consume using {@link extractJsonValidator}.\n *\n * Exposing this as the stable API entry point (instead of {@link JsonValidator}) means that we avoid leaking the reference to TypeBox to the API surface.\n * Additionally, if we adopt non JSON formats, we can just update the validators as needed without breaking the API.\n * This also allows us to avoid stabilizing or documenting how handles interact with JSON validation since that is not exposed through this type.\n * @sealed @alpha\n */\nexport interface FormatValidator extends ErasedType<\"FormatValidator\"> {}\n\n/**\n * A {@link JsonValidator} implementation which performs no validation and accepts all data as valid.\n * @privateRemarks Having this as an option unifies opting out of validation with selection of\n * validators, simplifying code performing validation.\n */\nconst noopValidator: JsonValidator = {\n\tcompile: <Schema extends TSchema>() => ({ check: (data): data is Static<Schema> => true }),\n};\n\n/**\n * A {@link FormatValidator} which does no validation.\n * @alpha\n */\nexport const FormatValidatorNoOp = toFormatValidator(noopValidator);\n\n/**\n * Type erase a {@link JsonValidator} to a {@link FormatValidator}.\n */\nexport function toFormatValidator(factory: JsonValidator): FormatValidator {\n\treturn factory as unknown as FormatValidator;\n}\n\n/**\n * Un-type-erase the {@link FormatValidator}.\n */\nexport function extractJsonValidator(input: FormatValidator | JsonValidator): JsonValidator {\n\treturn input as unknown as JsonValidator;\n}\n\n/**\n * JSON schema validator compliant with draft 6 schema. See https://json-schema.org.\n * @alpha @input\n */\nexport interface JsonValidator {\n\t/**\n\t * Compiles the provided JSON schema into a validator for that schema.\n\t * @param schema - A valid draft 6 JSON schema\n\t * @remarks IFluidHandles--which have circular property references--are used in various places in SharedTree's persisted\n\t * format. Handles should only be contained in sections of data which are validated against the empty schema `{}`\n\t * (see https://datatracker.ietf.org/doc/html/draft-wright-json-schema-01#section-4.4).\n\t *\n\t * Implementations of `JsonValidator` must therefore tolerate these values, despite the input not being valid JSON.\n\t */\n\tcompile<Schema extends TSchema>(schema: Schema): SchemaValidationFunction<Schema>;\n}\n\n/**\n * Options relating to handling of persisted data.\n *\n * @see {@link CodecWriteOptions} for options that are specific to encoding data.\n * @alpha @input\n */\nexport interface ICodecOptions {\n\t/**\n\t * {@link FormatValidator} which SharedTree uses to validate persisted data it reads & writes\n\t * matches the expected encoded format (i.e. the wire format for ops and summaries).\n\t * @remarks\n\t * See {@link FormatValidatorNoOp} and {@link FormatValidatorBasic} for out-of-the-box implementations.\n\t *\n\t * This option is not \"on-by-default\" because JSON schema validation comes with a small but noticeable\n\t * runtime performance cost, and popular schema validation libraries have relatively large bundle size.\n\t *\n\t * SharedTree users are still encouraged to use a non-trivial validator (i.e. not `FormatValidatorNoOp`)\n\t * whenever reasonable: it gives better fail-fast behavior when unexpected encoded data is found,\n\t * which reduces the risk of unrecoverable data corruption.\n\t * @privateRemarks\n\t * This property should probably be renamed to `validator` before stabilizing the API.\n\t */\n\treadonly jsonValidator: FormatValidator;\n}\n\n/**\n * Options relating to encoding of persisted data.\n * @input @beta\n */\nexport interface CodecWriteOptionsBeta {\n\t/**\n\t * The minimum version of the Fluid Framework client output must be encoded to be compatible with.\n\t * @remarks\n\t * This is used to ensure that the the output from this codec can be used with older versions of the Fluid Framework client.\n\t * This includes both concurrent collaboration, and an older version opening the document later.\n\t *\n\t * Note that versions older than this should not result in data corruption if they access the data:\n\t * the data's format should be versioned and if they can't handle the format they should error.\n\t */\n\treadonly minVersionForCollab: OldestSupportedClientVersion;\n}\n\n/**\n * Options relating to encoding of persisted data.\n * @remarks\n * Extends {@link ICodecOptions} with options that are specific to encoding data.\n * @alpha @input\n */\nexport interface CodecWriteOptions extends ICodecOptions, CodecWriteOptionsBeta {\n\t/**\n\t * Overrides the version of the codec to use for encoding.\n\t * @remarks\n\t * Without an override, the selected version will be based on {@link CodecWriteOptionsBeta.minVersionForCollab}.\n\t */\n\treadonly writeVersionOverrides?: ReadonlyMap<CodecName, FormatVersion>;\n\n\t/**\n\t * If true, suppress errors when `writeVersionOverrides` selects a version which may not be compatible with the {@link CodecWriteOptionsBeta.minVersionForCollab}.\n\t */\n\treadonly allowPossiblyIncompatibleWriteVersionOverrides?: boolean;\n}\n\n/**\n * `TEncodeContext` and `TDecodeContext` allow passing context to the codec which may configure how data is encoded/decoded.\n * `TDecodeContext` defaults to `TEncodeContext`; specify them separately when encode and decode need different context (for example, when encoding uses heuristics that are unneeded when decoding).\n * These parameters are typically used for:\n * - Codecs which can pick from multiple encoding options, and imbue the encoded data with information about which option was used.\n * The caller of such a codec can provide context about which encoding choice to make as part of the `encode` call without creating\n * additional codecs. Note that this pattern can always be implemented by having the caller create multiple codecs and selecting the\n * appropriate one, but depending on API layering this might be less ergonomic.\n * - Context for the object currently being encoded, which might enable more efficient encoding. When used in this fashion, the codec author\n * should be careful to include the context somewhere in the encoded data such that decoding can correctly round-trip.\n * For example, a composed set of codecs could implement a form of {@link https://en.wikipedia.org/wiki/Dictionary_coder | dictionary coding}\n * using a context map which was created by the top-level codec and passed to the inner codecs.\n * This pattern is used:\n * - To avoid repeatedly encoding session ids on commits (only recording it once at the top level)\n * @remarks `TEncoded` should always be valid Json (i.e. not contain functions), but due to TypeScript's handling\n * of index signatures and `JsonCompatibleReadOnly`'s index signature in the Json object case, specifying this as a\n * type-system level constraint makes code that uses this interface more difficult to write.\n *\n * If provided, `TValidate` allows the input type passed to `decode` to be different than `TEncoded`.\n * This is useful when, for example, the type being decoded is `unknown` and must be validated to be a `TEncoded` before being decoded to a `TDecoded`.\n */\nexport interface IJsonCodec<\n\tTDecoded,\n\tTEncoded = JsonCompatibleReadOnly,\n\tTValidate = TEncoded,\n\tTEncodeContext = void,\n\tTDecodeContext = TEncodeContext,\n> extends IEncoder<TDecoded, TEncoded, TEncodeContext>,\n\t\tIDecoder<TDecoded, TValidate, TDecodeContext> {\n\tencodedSchema?: TAnySchema;\n}\n\n/**\n * Part of a codec.\n * @remarks\n * Encode and decode logic and schema for some chunk of data.\n * Can be composed into larger codecs, and eventually versioned at the top level using\n * {@link VersionDispatchingCodecBuilder}.\n *\n * This portion of a codec is not responsible for managing versioning or validation of the data against the schema.\n */\nexport interface JsonCodecPart<\n\tTDecoded,\n\tTEncodedSchema extends TAnySchema,\n\tTEncodeContext = void,\n\tTDecodeContext = TEncodeContext,\n> extends IEncoder<TDecoded, Static<TEncodedSchema>, TEncodeContext>,\n\t\tIDecoder<TDecoded, Static<TEncodedSchema>, TDecodeContext> {\n\t/**\n\t * TypeBox schema which describes the encoded format for this chunk of data.\n\t * @remarks\n\t * The user of this codec can use this to build its own larger schema,\n\t * until eventually it is provided to the {@link VersionDispatchingCodecBuilder}.\n\t */\n\tencodedSchema: TEncodedSchema;\n}\n\n/**\n * Type erase the more detailed encoded type from a codec.\n */\nexport function eraseEncodedType<\n\tTDecoded,\n\tTEncoded = JsonCompatibleReadOnly,\n\tTValidate = TEncoded,\n\tTEncodeContext = void,\n\tTDecodeContext = TEncodeContext,\n>(\n\tcodec: IJsonCodec<TDecoded, TEncoded, TValidate, TEncodeContext, TDecodeContext>,\n): IJsonCodec<TDecoded, TValidate, TValidate, TEncodeContext, TDecodeContext> {\n\treturn codec as unknown as IJsonCodec<\n\t\tTDecoded,\n\t\tTValidate,\n\t\tTValidate,\n\t\tTEncodeContext,\n\t\tTDecodeContext\n\t>;\n}\n\n/**\n * Represents a family of codecs that can be used to encode and decode data in different formats.\n * The family is identified by a format version, which is typically used to select the codec to use.\n *\n * Separating codecs into families rather than having a single codec support multiple versions (i.e. currying\n * the `formatVersion` parameter)\n * allows avoiding some duplicate work at encode/decode time, since the vast majority of document usage will not\n * involve mixed format versions.\n *\n * @privateRemarks\n * Encode and decode can be parameterized independently — the encode-side context type need not equal the decode-side context type.\n * `TDecodeContext` defaults to `TEncodeContext` so callers that share a single context shape (the common case) don't need to specify it.\n */\nexport interface ICodecFamily<\n\tTDecoded,\n\tTEncodeContext = void,\n\tTDecodeContext = TEncodeContext,\n> {\n\t/**\n\t * @returns a codec that can be used to encode and decode data in the specified format.\n\t * @throws if the format version is not supported by this family.\n\t * @remarks Implementations should typically emit telemetry (either indirectly by throwing a well-known error with\n\t * logged properties or directly using some logger) when a format version is requested that is not supported.\n\t * This ensures that applications can diagnose compatibility issues.\n\t */\n\tresolve(\n\t\tformatVersion: FormatVersion,\n\t): IJsonCodec<\n\t\tTDecoded,\n\t\tJsonCompatibleReadOnly,\n\t\tJsonCompatibleReadOnly,\n\t\tTEncodeContext,\n\t\tTDecodeContext\n\t>;\n\n\t/**\n\t * @returns an iterable of all format versions supported by this family.\n\t */\n\tgetSupportedFormats(): Iterable<FormatVersion>;\n}\n\n/**\n * A version stamp for encoded data.\n * @remarks\n * Strings are used for formats that are not yet officially supported.\n * When such formats become officially supported/stable, they will be switched to using a number.\n * Undefined is tolerated to enable the scenario where data was not initially versioned.\n * @alpha\n */\nexport type FormatVersion = number | string | undefined;\n\n/**\n * A unique name given to this codec family.\n * @remarks\n * This is not persisted: it is only used to specify version overrides and in errors.\n * @alpha\n */\nexport type CodecName = string;\n\n/**\n * A format version which is dependent on some parent format version.\n */\nexport interface DependentFormatVersion<\n\tTParentVersion extends FormatVersion = FormatVersion,\n\tTChildVersion extends FormatVersion = FormatVersion,\n> {\n\t/**\n\t * Looks up the child format version for a given parent format version.\n\t * @param parent - The parent format version.\n\t * @returns The corresponding child format version.\n\t */\n\tlookup(parent: TParentVersion): TChildVersion;\n}\n\nexport class UniqueDependentFormatVersion<TChildVersion extends FormatVersion>\n\timplements DependentFormatVersion<FormatVersion, TChildVersion>\n{\n\tpublic constructor(private readonly child: TChildVersion) {}\n\tpublic lookup(_parent: FormatVersion): TChildVersion {\n\t\treturn this.child;\n\t}\n}\n\nexport class MappedDependentFormatVersion<\n\tTParentVersion extends FormatVersion = FormatVersion,\n\tTChildVersion extends FormatVersion = FormatVersion,\n> implements DependentFormatVersion<TParentVersion, TChildVersion>\n{\n\tpublic constructor(private readonly map: ReadonlyMap<TParentVersion, TChildVersion>) {}\n\tpublic lookup(parent: TParentVersion): TChildVersion {\n\t\treturn this.map.get(parent) ?? fail(0xc73 /* Unknown parent version */);\n\t}\n}\n\nexport const DependentFormatVersion = {\n\tfromUnique: <TChildVersion extends FormatVersion>(\n\t\tchild: TChildVersion,\n\t): UniqueDependentFormatVersion<TChildVersion> => new UniqueDependentFormatVersion(child),\n\tfromMap: <TParentVersion extends FormatVersion, TChildVersion extends FormatVersion>(\n\t\tmap: ReadonlyMap<TParentVersion, TChildVersion>,\n\t): MappedDependentFormatVersion<TParentVersion, TChildVersion> =>\n\t\tnew MappedDependentFormatVersion(map),\n\tfromPairs: <TParentVersion extends FormatVersion, TChildVersion extends FormatVersion>(\n\t\tpairs: Iterable<[TParentVersion, TChildVersion]>,\n\t): MappedDependentFormatVersion<TParentVersion, TChildVersion> =>\n\t\tnew MappedDependentFormatVersion(new Map(pairs)),\n};\n\n/**\n * Creates a codec family from a registry of codecs.\n */\nexport function makeCodecFamily<TDecoded, TEncodeContext, TDecodeContext = TEncodeContext>(\n\tregistry: Iterable<\n\t\t[\n\t\t\tformatVersion: FormatVersion,\n\t\t\tcodec: IJsonCodec<\n\t\t\t\tTDecoded,\n\t\t\t\tJsonCompatibleReadOnly,\n\t\t\t\tJsonCompatibleReadOnly,\n\t\t\t\tTEncodeContext,\n\t\t\t\tTDecodeContext\n\t\t\t>,\n\t\t]\n\t>,\n): ICodecFamily<TDecoded, TEncodeContext, TDecodeContext> {\n\tconst codecs: Map<\n\t\tFormatVersion,\n\t\tIJsonCodec<\n\t\t\tTDecoded,\n\t\t\tJsonCompatibleReadOnly,\n\t\t\tJsonCompatibleReadOnly,\n\t\t\tTEncodeContext,\n\t\t\tTDecodeContext\n\t\t>\n\t> = new Map();\n\tfor (const [formatVersion, codec] of registry) {\n\t\tif (codecs.has(formatVersion)) {\n\t\t\tfail(0xabf /* Duplicate codecs specified. */);\n\t\t}\n\t\tcodecs.set(formatVersion, codec);\n\t}\n\n\treturn {\n\t\tresolve(\n\t\t\tformatVersion: FormatVersion,\n\t\t): IJsonCodec<\n\t\t\tTDecoded,\n\t\t\tJsonCompatibleReadOnly,\n\t\t\tJsonCompatibleReadOnly,\n\t\t\tTEncodeContext,\n\t\t\tTDecodeContext\n\t\t> {\n\t\t\tconst codec = codecs.get(formatVersion);\n\t\t\tassert(codec !== undefined, 0x5e6 /* Requested codec for unsupported format. */);\n\t\t\treturn codec;\n\t\t},\n\t\tgetSupportedFormats(): Iterable<FormatVersion> {\n\t\t\treturn codecs.keys();\n\t\t},\n\t};\n}\n\n/**\n * Codec for objects which carry no information.\n */\nexport const unitCodec: IJsonCodec<\n\t0,\n\tJsonCompatibleReadOnly,\n\tJsonCompatibleReadOnly,\n\tunknown\n> = {\n\tencode: () => 0,\n\tdecode: () => 0,\n};\n\n/**\n * Wraps a codec with JSON schema validation for its encoded type.\n * @returns An {@link IJsonCodec} which validates the data it encodes and decodes matches the provided schema.\n * @remarks\n * Eventually all codecs should use the same pattern implemented by VersionDispatchingCodecBuilder, resulting in that having the only use of this API.\n */\nexport function withSchemaValidation<\n\tTInMemoryFormat,\n\tEncodedSchema extends TSchema,\n\tTEncodedFormat,\n\tTValidate,\n\tTEncodeContext,\n\tTDecodeContext = TEncodeContext,\n>(\n\tschema: EncodedSchema,\n\tcodec: IJsonCodec<\n\t\tTInMemoryFormat,\n\t\tTEncodedFormat,\n\t\tTValidate,\n\t\tTEncodeContext,\n\t\tTDecodeContext\n\t>,\n\tvalidator?: JsonValidator | FormatValidator,\n): IJsonCodec<TInMemoryFormat, TEncodedFormat, TValidate, TEncodeContext, TDecodeContext> {\n\tif (!validator) {\n\t\treturn codec;\n\t}\n\tconst compiledFormat = extractJsonValidator(validator).compile(schema);\n\treturn {\n\t\tencode: (obj: TInMemoryFormat, context: TEncodeContext): TEncodedFormat => {\n\t\t\tconst encoded = codec.encode(obj, context);\n\t\t\tif (!compiledFormat.check(encoded)) {\n\t\t\t\tfail(0xac0 /* Encoded data should validate */);\n\t\t\t}\n\t\t\treturn encoded;\n\t\t},\n\t\tdecode: (encoded: TValidate, context: TDecodeContext): TInMemoryFormat => {\n\t\t\tif (!compiledFormat.check(encoded)) {\n\t\t\t\tfail(0xac1 /* Data being decoded should validate */);\n\t\t\t}\n\t\t\treturn codec.decode(encoded, context);\n\t\t},\n\t\tencodedSchema: schema,\n\t};\n}\n\n/**\n * Versions of Fluid Framework client packages, usable as a {@link @fluidframework/runtime-definitions#OldestSupportedClientVersion}.\n * @remarks\n * Versions with no notable impact may be omitted, and added later if needed.\n *\n * @privateRemarks\n * Each entry should document:\n * - The user-facing impact of opting into it (e.g. encoding efficiency improvements).\n * - Any new data formats introduced in that version.\n * - Whether those features/formats are enabled by default or require {@link OldestSupportedClientVersion | minVersionForCollab} to be set accordingly.\n * @alpha\n */\nexport const FluidClientVersion = {\n\t/**\n\t * Fluid Framework Client 2.0 and newer.\n\t */\n\tv2_0: \"2.0.0\",\n\n\t/**\n\t * Fluid Framework Client 2.43 and newer.\n\t * @remarks\n\t * New formats introduced in 2.43:\n\t * - SchemaFormatVersion.v2 - written when minVersionForCollab \\>= 2.43\n\t * - MessageFormatVersion.v4 - written when minVersionForCollab \\>= 2.43\n\t * - EditManagerFormatVersion.v4 - written when minVersionForCollab \\>= 2.43\n\t * - sequence-field/formatV3 - written when minVersionForCollab \\>= 2.43\n\t */\n\tv2_43: \"2.43.0\",\n\n\t/**\n\t * Fluid Framework Client 2.52 and newer.\n\t * @remarks\n\t * New formats introduced in 2.52:\n\t * - DetachedFieldIndexFormatVersion.v2 - written when minVersionForCollab \\>= 2.52\n\t */\n\tv2_52: \"2.52.0\",\n\n\t/**\n\t * Fluid Framework Client 2.73 and newer.\n\t * @remarks\n\t * New formats introduced in 2.73:\n\t * - FieldBatchFormatVersion.v2 - written when minVersionForCollab \\>= 2.73\n\t */\n\tv2_73: \"2.73.0\",\n\n\t/**\n\t * Fluid Framework Client 2.74 and newer.\n\t * @remarks\n\t * New formats introduced in 2.74:\n\t * - SharedTreeSummaryFormatVersion.v2 - written by default\n\t * - DetachedFieldIndexSummaryFormatVersion.v2 - written by default\n\t * - SchemaSummaryFormatVersion.v2 - written by default\n\t * - EditManagerSummaryFormatVersion.v2 - written by default\n\t * - ForestSummaryFormatVersion.v2 - written by default\n\t * - ForestFormatVersion.v2 - written when minVersionForCollab \\>= 2.74\n\t * - ForestSummaryFormatVersion.v3 - written when minVersionForCollab \\>= 2.74\n\t */\n\tv2_74: \"2.74.0\",\n\n\t/**\n\t * Fluid Framework Client 2.80 and newer.\n\t * @remarks\n\t * New formats introduced in 2.80:\n\t * - MessageFormatVersion.v6 - written when minVersionForCollab \\>= 2.80\n\t * - EditManagerFormatVersion.v6 - written when minVersionForCollab \\>= 2.80\n\t * - SharedTreeChangeFormatVersion.v5 - written when minVersionForCollab \\>= 2.80\n\t * - ModularChangeFormatVersion.v5 - written when minVersionForCollab \\>= 2.80\n\t */\n\tv2_80: \"2.80.0\",\n\n\t/**\n\t * Fluid Framework Client 2.117 and newer.\n\t * @remarks\n\t * New formats introduced in 2.117:\n\t * - MessageFormatVersion.v7 - written when minVersionForCollab \\>= 2.117\n\t * - EditManagerFormatVersion.v7 - written when minVersionForCollab \\>= 2.117\n\t *\n\t * @privateRemarks\n\t * These formats are gated at 2.117.0 rather than 3.0.0 so that they can also be carried by a\n\t * 2.117.0 minor cut from the last pre-3.0 commit on main, should one be needed for consumers\n\t * that cannot yet absorb the 3.0 breaking changes. Since 3.0.0 \\> 2.117.0, 3.x clients select\n\t * these formats for any minVersionForCollab at or above 2.117.0 whether or not that release\n\t * ever ships.\n\t *\n\t * Every client at or above 2.117.0 must therefore be able to read and write these formats. A\n\t * client that maps 2.117.0 to an older format would silently strip metadata when encoding.\n\t */\n\tv2_117: \"2.117.0\",\n} as const satisfies Record<string, OldestSupportedClientVersion>;\n\n/**\n * An up to date version which includes all stable features.\n * @remarks\n * Use for cases when data is not persisted and thus would only ever be read by the the same version of the code which read this value.\n *\n * The pkgVersion from this package (tree) can not be used here as it is not guaranteed to be a valid OldestSupportedClientVersion\n * and would also unexpectedly disable features in prereleases and on CI if it didn't fail validation.\n * See {@link @fluidframework/runtime-utils/internal#cleanedPackageVersion} for more details on why cleanedPackageVersion is preferred over pkgVersion.\n *\n * @privateRemarks\n * It is safe to use CleanedPackageVersion from runtime-utils here since features are enabled in minor versions,\n * and this package (tree) depends on runtime-utils with a `~` semver range\n * ensuring that the version of runtime-utils this was imported from will match the version of this (tree) package at least up to the minor version.\n * Reusing this from runtime-utils avoids duplicating the cleanup logic here as well as the cost or recomputing it.\n * If in the future for some reason this becomes not okay, runtime-utils could instead export a function that performs that cleanup logic which could be reused here.\n */\nexport const currentVersion: OldestSupportedClientVersion = runtimeUtilsCleanedPackageVersion;\n\n/**\n * TODO:\n * This needs to be documented.\n * Its documentation should cover at least the following:\n * - Is this used for anything other than testing.\n * - What should be included as children. For example should it include versioned codecs which dispatch base on the min version for collaboration? If so, what version of them should be used?\n * - What risks does having this mitigate?\n */\nexport interface CodecTree<TFormatVersion extends FormatVersion = FormatVersion> {\n\treadonly name: string;\n\treadonly version: TFormatVersion;\n\treadonly children?: readonly CodecTree[];\n}\n\nexport function jsonableCodecTree(tree: CodecTree): JsonCompatibleReadOnly {\n\treturn {\n\t\tname: tree.name,\n\t\tversion: tree.version ?? \"null\",\n\t\tchildren: tree.children?.map(jsonableCodecTree),\n\t};\n}\n"]}
1
+ {"version":3,"file":"codec.js","sourceRoot":"","sources":["../../src/codec/codec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,qCAAqC,CAAC;AAEnE,OAAO,EAAE,qBAAqB,IAAI,iCAAiC,EAAE,MAAM,wCAAwC,CAAC;AA0DpH;;;;GAIG;AACH,MAAM,aAAa,GAAkB;IACpC,OAAO,EAAE,GAA2B,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,IAAI,EAA0B,EAAE,CAAC,IAAI,EAAE,CAAC;CAC1F,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,G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ACxE,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;gBACpC,IAAI,CAAC,KAAK,CAAC,wCAAwC,CAAC,CAAC;YACtD,CAAC;YACD,OAAO,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACvC,CAAC;QACD,aAAa,EAAE,MAAM;KACrB,CAAC;AACH,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;IACjC;;OAEG;IACH,IAAI,EAAE,OAAO;IAEb;;;;;;;;OAQG;IACH,KAAK,EAAE,QAAQ;IAEf;;;;;OAKG;IACH,KAAK,EAAE,QAAQ;IAEf;;;;;OAKG;IACH,KAAK,EAAE,QAAQ;IAEf;;;;;;;;;;;OAWG;IACH,KAAK,EAAE,QAAQ;IAEf;;;;;;;;OAQG;IACH,KAAK,EAAE,QAAQ;IAEf;;;;;;;;;;;;;;;;OAgBG;IACH,MAAM,EAAE,SAAS;CAC+C,CAAC;AAElE;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,cAAc,GAAiC,iCAAiC,CAAC;AAgB9F,MAAM,UAAU,iBAAiB,CAAC,IAAe;IAChD,OAAO;QACN,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,OAAO,EAAE,IAAI,CAAC,OAAO,IAAI,MAAM;QAC/B,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,iBAAiB,CAAC;KAC/C,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ErasedType } from \"@fluidframework/core-interfaces/internal\";\nimport { assert, fail } from \"@fluidframework/core-utils/internal\";\nimport type { OldestSupportedClientVersion } from \"@fluidframework/runtime-definitions/internal\";\nimport { cleanedPackageVersion as runtimeUtilsCleanedPackageVersion } from \"@fluidframework/runtime-utils/internal\";\nimport type { Static, TAnySchema, TSchema } from \"@sinclair/typebox\";\n\nimport type { JsonCompatibleReadOnly } from \"../util/index.js\";\n\n/**\n * Translates decoded data to encoded data.\n * @remarks Typically paired with an {@link IEncoder}.\n */\nexport interface IEncoder<TDecoded, TEncoded, TContext> {\n\t/**\n\t * Encodes `obj` into some encoded format.\n\t */\n\tencode(obj: TDecoded, context: TContext): TEncoded;\n}\n\n/**\n * Translates encoded data to decoded data.\n * @remarks Typically paired with an {@link IEncoder}.\n */\nexport interface IDecoder<TDecoded, TEncoded, TContext> {\n\t/**\n\t * Decodes `obj` from some encoded format.\n\t */\n\tdecode(obj: TEncoded, context: TContext): TDecoded;\n}\n\n/**\n * Validates data complies with some particular schema.\n * Implementations are typically created by a {@link JsonValidator}.\n */\nexport interface SchemaValidationFunction<Schema extends TSchema> {\n\t/**\n\t * Returns whether the data matches a schema.\n\t */\n\tcheck(data: unknown): data is Static<Schema>;\n}\n\n/**\n * A kind of validator for SharedTree's internal data formats.\n * @remarks\n * Assuming no data corruption or type confusion, such validation should never fail.\n * Any client version compatibility issues should instead be detected by the data format versioning which Shared Tree does internally independent of data format validation.\n * However, persisted data can sometimes be corrupted, bugs can produce invalid data, or users can mix up which data is compatible with which APIs.\n * In such cases, a format validator can help catch issues.\n *\n * Current options are {@link FormatValidatorNoOp} and {@link FormatValidatorBasic}.\n * @privateRemarks\n * Implement using {@link toFormatValidator}.\n * Consume using {@link extractJsonValidator}.\n *\n * Exposing this as the stable API entry point (instead of {@link JsonValidator}) means that we avoid leaking the reference to TypeBox to the API surface.\n * Additionally, if we adopt non JSON formats, we can just update the validators as needed without breaking the API.\n * This also allows us to avoid stabilizing or documenting how handles interact with JSON validation since that is not exposed through this type.\n * @sealed @alpha\n */\nexport interface FormatValidator extends ErasedType<\"FormatValidator\"> {}\n\n/**\n * A {@link JsonValidator} implementation which performs no validation and accepts all data as valid.\n * @privateRemarks Having this as an option unifies opting out of validation with selection of\n * validators, simplifying code performing validation.\n */\nconst noopValidator: JsonValidator = {\n\tcompile: <Schema extends TSchema>() => ({ check: (data): data is Static<Schema> => true }),\n};\n\n/**\n * A {@link FormatValidator} which does no validation.\n * @alpha\n */\nexport const FormatValidatorNoOp = toFormatValidator(noopValidator);\n\n/**\n * Type erase a {@link JsonValidator} to a {@link FormatValidator}.\n */\nexport function toFormatValidator(factory: JsonValidator): FormatValidator {\n\treturn factory as unknown as FormatValidator;\n}\n\n/**\n * Un-type-erase the {@link FormatValidator}.\n */\nexport function extractJsonValidator(input: FormatValidator | JsonValidator): JsonValidator {\n\treturn input as unknown as JsonValidator;\n}\n\n/**\n * JSON schema validator compliant with draft 6 schema. See https://json-schema.org.\n * @alpha @input\n */\nexport interface JsonValidator {\n\t/**\n\t * Compiles the provided JSON schema into a validator for that schema.\n\t * @param schema - A valid draft 6 JSON schema\n\t * @remarks IFluidHandles--which have circular property references--are used in various places in SharedTree's persisted\n\t * format. Handles should only be contained in sections of data which are validated against the empty schema `{}`\n\t * (see https://datatracker.ietf.org/doc/html/draft-wright-json-schema-01#section-4.4).\n\t *\n\t * Implementations of `JsonValidator` must therefore tolerate these values, despite the input not being valid JSON.\n\t */\n\tcompile<Schema extends TSchema>(schema: Schema): SchemaValidationFunction<Schema>;\n}\n\n/**\n * Options relating to handling of persisted data.\n *\n * @see {@link CodecWriteOptions} for options that are specific to encoding data.\n * @alpha @input\n */\nexport interface ICodecOptions {\n\t/**\n\t * {@link FormatValidator} which SharedTree uses to validate persisted data it reads & writes\n\t * matches the expected encoded format (i.e. the wire format for ops and summaries).\n\t * @remarks\n\t * See {@link FormatValidatorNoOp} and {@link FormatValidatorBasic} for out-of-the-box implementations.\n\t *\n\t * This option is not \"on-by-default\" because JSON schema validation comes with a small but noticeable\n\t * runtime performance cost, and popular schema validation libraries have relatively large bundle size.\n\t *\n\t * SharedTree users are still encouraged to use a non-trivial validator (i.e. not `FormatValidatorNoOp`)\n\t * whenever reasonable: it gives better fail-fast behavior when unexpected encoded data is found,\n\t * which reduces the risk of unrecoverable data corruption.\n\t * @privateRemarks\n\t * This property should probably be renamed to `validator` before stabilizing the API.\n\t */\n\treadonly jsonValidator: FormatValidator;\n}\n\n/**\n * Options relating to encoding of persisted data.\n * @input @beta\n */\nexport interface CodecWriteOptionsBeta {\n\t/**\n\t * The minimum version of the Fluid Framework client output must be encoded to be compatible with.\n\t * @remarks\n\t * This is used to ensure that the the output from this codec can be used with older versions of the Fluid Framework client.\n\t * This includes both concurrent collaboration, and an older version opening the document later.\n\t *\n\t * Note that versions older than this should not result in data corruption if they access the data:\n\t * the data's format should be versioned and if they can't handle the format they should error.\n\t */\n\treadonly minVersionForCollab: OldestSupportedClientVersion;\n}\n\n/**\n * Options relating to encoding of persisted data.\n * @remarks\n * Extends {@link ICodecOptions} with options that are specific to encoding data.\n * @alpha @input\n */\nexport interface CodecWriteOptions extends ICodecOptions, CodecWriteOptionsBeta {\n\t/**\n\t * Overrides the version of the codec to use for encoding.\n\t * @remarks\n\t * Without an override, the selected version will be based on {@link CodecWriteOptionsBeta.minVersionForCollab}.\n\t */\n\treadonly writeVersionOverrides?: ReadonlyMap<CodecName, FormatVersion>;\n\n\t/**\n\t * If true, suppress errors when `writeVersionOverrides` selects a version which may not be compatible with the {@link CodecWriteOptionsBeta.minVersionForCollab}.\n\t */\n\treadonly allowPossiblyIncompatibleWriteVersionOverrides?: boolean;\n}\n\n/**\n * `TEncodeContext` and `TDecodeContext` allow passing context to the codec which may configure how data is encoded/decoded.\n * `TDecodeContext` defaults to `TEncodeContext`; specify them separately when encode and decode need different context (for example, when encoding uses heuristics that are unneeded when decoding).\n * These parameters are typically used for:\n * - Codecs which can pick from multiple encoding options, and imbue the encoded data with information about which option was used.\n * The caller of such a codec can provide context about which encoding choice to make as part of the `encode` call without creating\n * additional codecs. Note that this pattern can always be implemented by having the caller create multiple codecs and selecting the\n * appropriate one, but depending on API layering this might be less ergonomic.\n * - Context for the object currently being encoded, which might enable more efficient encoding. When used in this fashion, the codec author\n * should be careful to include the context somewhere in the encoded data such that decoding can correctly round-trip.\n * For example, a composed set of codecs could implement a form of {@link https://en.wikipedia.org/wiki/Dictionary_coder | dictionary coding}\n * using a context map which was created by the top-level codec and passed to the inner codecs.\n * This pattern is used:\n * - To avoid repeatedly encoding session ids on commits (only recording it once at the top level)\n * @remarks `TEncoded` should always be valid Json (i.e. not contain functions), but due to TypeScript's handling\n * of index signatures and `JsonCompatibleReadOnly`'s index signature in the Json object case, specifying this as a\n * type-system level constraint makes code that uses this interface more difficult to write.\n *\n * If provided, `TValidate` allows the input type passed to `decode` to be different than `TEncoded`.\n * This is useful when, for example, the type being decoded is `unknown` and must be validated to be a `TEncoded` before being decoded to a `TDecoded`.\n */\nexport interface IJsonCodec<\n\tTDecoded,\n\tTEncoded = JsonCompatibleReadOnly,\n\tTValidate = TEncoded,\n\tTEncodeContext = void,\n\tTDecodeContext = TEncodeContext,\n> extends IEncoder<TDecoded, TEncoded, TEncodeContext>,\n\t\tIDecoder<TDecoded, TValidate, TDecodeContext> {\n\tencodedSchema?: TAnySchema;\n}\n\n/**\n * Part of a codec.\n * @remarks\n * Encode and decode logic and schema for some chunk of data.\n * Can be composed into larger codecs, and eventually versioned at the top level using\n * {@link VersionDispatchingCodecBuilder}.\n *\n * This portion of a codec is not responsible for managing versioning or validation of the data against the schema.\n */\nexport interface JsonCodecPart<\n\tTDecoded,\n\tTEncodedSchema extends TAnySchema,\n\tTEncodeContext = void,\n\tTDecodeContext = TEncodeContext,\n> extends IEncoder<TDecoded, Static<TEncodedSchema>, TEncodeContext>,\n\t\tIDecoder<TDecoded, Static<TEncodedSchema>, TDecodeContext> {\n\t/**\n\t * TypeBox schema which describes the encoded format for this chunk of data.\n\t * @remarks\n\t * The user of this codec can use this to build its own larger schema,\n\t * until eventually it is provided to the {@link VersionDispatchingCodecBuilder}.\n\t */\n\tencodedSchema: TEncodedSchema;\n}\n\n/**\n * Type erase the more detailed encoded type from a codec.\n */\nexport function eraseEncodedType<\n\tTDecoded,\n\tTEncoded = JsonCompatibleReadOnly,\n\tTValidate = TEncoded,\n\tTEncodeContext = void,\n\tTDecodeContext = TEncodeContext,\n>(\n\tcodec: IJsonCodec<TDecoded, TEncoded, TValidate, TEncodeContext, TDecodeContext>,\n): IJsonCodec<TDecoded, TValidate, TValidate, TEncodeContext, TDecodeContext> {\n\treturn codec as unknown as IJsonCodec<\n\t\tTDecoded,\n\t\tTValidate,\n\t\tTValidate,\n\t\tTEncodeContext,\n\t\tTDecodeContext\n\t>;\n}\n\n/**\n * Represents a family of codecs that can be used to encode and decode data in different formats.\n * The family is identified by a format version, which is typically used to select the codec to use.\n *\n * Separating codecs into families rather than having a single codec support multiple versions (i.e. currying\n * the `formatVersion` parameter)\n * allows avoiding some duplicate work at encode/decode time, since the vast majority of document usage will not\n * involve mixed format versions.\n *\n * @privateRemarks\n * Encode and decode can be parameterized independently — the encode-side context type need not equal the decode-side context type.\n * `TDecodeContext` defaults to `TEncodeContext` so callers that share a single context shape (the common case) don't need to specify it.\n */\nexport interface ICodecFamily<\n\tTDecoded,\n\tTEncodeContext = void,\n\tTDecodeContext = TEncodeContext,\n> {\n\t/**\n\t * @returns a codec that can be used to encode and decode data in the specified format.\n\t * @throws if the format version is not supported by this family.\n\t * @remarks Implementations should typically emit telemetry (either indirectly by throwing a well-known error with\n\t * logged properties or directly using some logger) when a format version is requested that is not supported.\n\t * This ensures that applications can diagnose compatibility issues.\n\t */\n\tresolve(\n\t\tformatVersion: FormatVersion,\n\t): IJsonCodec<\n\t\tTDecoded,\n\t\tJsonCompatibleReadOnly,\n\t\tJsonCompatibleReadOnly,\n\t\tTEncodeContext,\n\t\tTDecodeContext\n\t>;\n\n\t/**\n\t * @returns an iterable of all format versions supported by this family.\n\t */\n\tgetSupportedFormats(): Iterable<FormatVersion>;\n}\n\n/**\n * A version stamp for encoded data.\n * @remarks\n * Strings are used for formats that are not yet officially supported.\n * When such formats become officially supported/stable, they will be switched to using a number.\n * Undefined is tolerated to enable the scenario where data was not initially versioned.\n * @alpha\n */\nexport type FormatVersion = number | string | undefined;\n\n/**\n * A unique name given to this codec family.\n * @remarks\n * This is not persisted: it is only used to specify version overrides and in errors.\n * @alpha\n */\nexport type CodecName = string;\n\n/**\n * A format version which is dependent on some parent format version.\n */\nexport interface DependentFormatVersion<\n\tTParentVersion extends FormatVersion = FormatVersion,\n\tTChildVersion extends FormatVersion = FormatVersion,\n> {\n\t/**\n\t * Looks up the child format version for a given parent format version.\n\t * @param parent - The parent format version.\n\t * @returns The corresponding child format version.\n\t */\n\tlookup(parent: TParentVersion): TChildVersion;\n}\n\nexport class UniqueDependentFormatVersion<TChildVersion extends FormatVersion>\n\timplements DependentFormatVersion<FormatVersion, TChildVersion>\n{\n\tpublic constructor(private readonly child: TChildVersion) {}\n\tpublic lookup(_parent: FormatVersion): TChildVersion {\n\t\treturn this.child;\n\t}\n}\n\nexport class MappedDependentFormatVersion<\n\tTParentVersion extends FormatVersion = FormatVersion,\n\tTChildVersion extends FormatVersion = FormatVersion,\n> implements DependentFormatVersion<TParentVersion, TChildVersion>\n{\n\tpublic constructor(private readonly map: ReadonlyMap<TParentVersion, TChildVersion>) {}\n\tpublic lookup(parent: TParentVersion): TChildVersion {\n\t\treturn this.map.get(parent) ?? fail(0xc73 /* Unknown parent version */);\n\t}\n}\n\nexport const DependentFormatVersion = {\n\tfromUnique: <TChildVersion extends FormatVersion>(\n\t\tchild: TChildVersion,\n\t): UniqueDependentFormatVersion<TChildVersion> => new UniqueDependentFormatVersion(child),\n\tfromMap: <TParentVersion extends FormatVersion, TChildVersion extends FormatVersion>(\n\t\tmap: ReadonlyMap<TParentVersion, TChildVersion>,\n\t): MappedDependentFormatVersion<TParentVersion, TChildVersion> =>\n\t\tnew MappedDependentFormatVersion(map),\n\tfromPairs: <TParentVersion extends FormatVersion, TChildVersion extends FormatVersion>(\n\t\tpairs: Iterable<[TParentVersion, TChildVersion]>,\n\t): MappedDependentFormatVersion<TParentVersion, TChildVersion> =>\n\t\tnew MappedDependentFormatVersion(new Map(pairs)),\n};\n\n/**\n * Creates a codec family from a registry of codecs.\n */\nexport function makeCodecFamily<TDecoded, TEncodeContext, TDecodeContext = TEncodeContext>(\n\tregistry: Iterable<\n\t\t[\n\t\t\tformatVersion: FormatVersion,\n\t\t\tcodec: IJsonCodec<\n\t\t\t\tTDecoded,\n\t\t\t\tJsonCompatibleReadOnly,\n\t\t\t\tJsonCompatibleReadOnly,\n\t\t\t\tTEncodeContext,\n\t\t\t\tTDecodeContext\n\t\t\t>,\n\t\t]\n\t>,\n): ICodecFamily<TDecoded, TEncodeContext, TDecodeContext> {\n\tconst codecs: Map<\n\t\tFormatVersion,\n\t\tIJsonCodec<\n\t\t\tTDecoded,\n\t\t\tJsonCompatibleReadOnly,\n\t\t\tJsonCompatibleReadOnly,\n\t\t\tTEncodeContext,\n\t\t\tTDecodeContext\n\t\t>\n\t> = new Map();\n\tfor (const [formatVersion, codec] of registry) {\n\t\tif (codecs.has(formatVersion)) {\n\t\t\tfail(0xabf /* Duplicate codecs specified. */);\n\t\t}\n\t\tcodecs.set(formatVersion, codec);\n\t}\n\n\treturn {\n\t\tresolve(\n\t\t\tformatVersion: FormatVersion,\n\t\t): IJsonCodec<\n\t\t\tTDecoded,\n\t\t\tJsonCompatibleReadOnly,\n\t\t\tJsonCompatibleReadOnly,\n\t\t\tTEncodeContext,\n\t\t\tTDecodeContext\n\t\t> {\n\t\t\tconst codec = codecs.get(formatVersion);\n\t\t\tassert(codec !== undefined, 0x5e6 /* Requested codec for unsupported format. */);\n\t\t\treturn codec;\n\t\t},\n\t\tgetSupportedFormats(): Iterable<FormatVersion> {\n\t\t\treturn codecs.keys();\n\t\t},\n\t};\n}\n\n/**\n * Codec for objects which carry no information.\n */\nexport const unitCodec: IJsonCodec<\n\t0,\n\tJsonCompatibleReadOnly,\n\tJsonCompatibleReadOnly,\n\tunknown\n> = {\n\tencode: () => 0,\n\tdecode: () => 0,\n};\n\n/**\n * Wraps a codec with JSON schema validation for its encoded type.\n * @returns An {@link IJsonCodec} which validates the data it encodes and decodes matches the provided schema.\n * @remarks\n * Eventually all codecs should use the same pattern implemented by VersionDispatchingCodecBuilder, resulting in that having the only use of this API.\n */\nexport function withSchemaValidation<\n\tTInMemoryFormat,\n\tEncodedSchema extends TSchema,\n\tTEncodedFormat,\n\tTValidate,\n\tTEncodeContext,\n\tTDecodeContext = TEncodeContext,\n>(\n\tschema: EncodedSchema,\n\tcodec: IJsonCodec<\n\t\tTInMemoryFormat,\n\t\tTEncodedFormat,\n\t\tTValidate,\n\t\tTEncodeContext,\n\t\tTDecodeContext\n\t>,\n\tvalidator?: JsonValidator | FormatValidator,\n): IJsonCodec<TInMemoryFormat, TEncodedFormat, TValidate, TEncodeContext, TDecodeContext> {\n\tif (!validator) {\n\t\treturn codec;\n\t}\n\tconst compiledFormat = extractJsonValidator(validator).compile(schema);\n\treturn {\n\t\tencode: (obj: TInMemoryFormat, context: TEncodeContext): TEncodedFormat => {\n\t\t\tconst encoded = codec.encode(obj, context);\n\t\t\tif (!compiledFormat.check(encoded)) {\n\t\t\t\tfail(0xac0 /* Encoded data should validate */);\n\t\t\t}\n\t\t\treturn encoded;\n\t\t},\n\t\tdecode: (encoded: TValidate, context: TDecodeContext): TInMemoryFormat => {\n\t\t\tif (!compiledFormat.check(encoded)) {\n\t\t\t\tfail(0xac1 /* Data being decoded should validate */);\n\t\t\t}\n\t\t\treturn codec.decode(encoded, context);\n\t\t},\n\t\tencodedSchema: schema,\n\t};\n}\n\n/**\n * Versions of Fluid Framework client packages, usable as a {@link @fluidframework/runtime-definitions#OldestSupportedClientVersion}.\n * @remarks\n * Versions with no notable impact may be omitted, and added later if needed.\n *\n * @privateRemarks\n * Each entry should document:\n * - The user-facing impact of opting into it (e.g. encoding efficiency improvements).\n * - Any new data formats introduced in that version.\n * - Whether those features/formats are enabled by default or require {@link OldestSupportedClientVersion | minVersionForCollab} to be set accordingly.\n * @alpha\n */\nexport const FluidClientVersion = {\n\t/**\n\t * Fluid Framework Client 2.0 and newer.\n\t */\n\tv2_0: \"2.0.0\",\n\n\t/**\n\t * Fluid Framework Client 2.43 and newer.\n\t * @remarks\n\t * New formats introduced in 2.43:\n\t * - SchemaFormatVersion.v2 - written when minVersionForCollab \\>= 2.43\n\t * - MessageFormatVersion.v4 - written when minVersionForCollab \\>= 2.43\n\t * - EditManagerFormatVersion.v4 - written when minVersionForCollab \\>= 2.43\n\t * - sequence-field/formatV3 - written when minVersionForCollab \\>= 2.43\n\t */\n\tv2_43: \"2.43.0\",\n\n\t/**\n\t * Fluid Framework Client 2.52 and newer.\n\t * @remarks\n\t * New formats introduced in 2.52:\n\t * - DetachedFieldIndexFormatVersion.v2 - written when minVersionForCollab \\>= 2.52\n\t */\n\tv2_52: \"2.52.0\",\n\n\t/**\n\t * Fluid Framework Client 2.73 and newer.\n\t * @remarks\n\t * New formats introduced in 2.73:\n\t * - FieldBatchFormatVersion.v2 - written when minVersionForCollab \\>= 2.73\n\t */\n\tv2_73: \"2.73.0\",\n\n\t/**\n\t * Fluid Framework Client 2.74 and newer.\n\t * @remarks\n\t * New formats introduced in 2.74:\n\t * - SharedTreeSummaryFormatVersion.v2 - written by default\n\t * - DetachedFieldIndexSummaryFormatVersion.v2 - written by default\n\t * - SchemaSummaryFormatVersion.v2 - written by default\n\t * - EditManagerSummaryFormatVersion.v2 - written by default\n\t * - ForestSummaryFormatVersion.v2 - written by default\n\t * - ForestFormatVersion.v2 - written when minVersionForCollab \\>= 2.74\n\t * - ForestSummaryFormatVersion.v3 - written when minVersionForCollab \\>= 2.74\n\t */\n\tv2_74: \"2.74.0\",\n\n\t/**\n\t * Fluid Framework Client 2.80 and newer.\n\t * @remarks\n\t * New formats introduced in 2.80:\n\t * - MessageFormatVersion.v6 - written when minVersionForCollab \\>= 2.80\n\t * - EditManagerFormatVersion.v6 - written when minVersionForCollab \\>= 2.80\n\t * - SharedTreeChangeFormatVersion.v5 - written when minVersionForCollab \\>= 2.80\n\t * - ModularChangeFormatVersion.v5 - written when minVersionForCollab \\>= 2.80\n\t */\n\tv2_80: \"2.80.0\",\n\n\t/**\n\t * Fluid Framework Client 2.117 and newer.\n\t * @remarks\n\t * New formats introduced in 2.117:\n\t * - MessageFormatVersion.v7 - written when minVersionForCollab \\>= 2.117\n\t * - EditManagerFormatVersion.v7 - written when minVersionForCollab \\>= 2.117\n\t *\n\t * @privateRemarks\n\t * These formats are gated at 2.117.0 rather than 3.0.0 so that they can also be carried by a\n\t * 2.117.0 minor cut from the last pre-3.0 commit on main, should one be needed for consumers\n\t * that cannot yet absorb the 3.0 breaking changes. Since 3.0.0 \\> 2.117.0, 3.x clients select\n\t * these formats for any minVersionForCollab at or above 2.117.0 whether or not that release\n\t * ever ships.\n\t *\n\t * Every client at or above 2.117.0 must therefore be able to read and write these formats. A\n\t * client that maps 2.117.0 to an older format would silently strip metadata when encoding.\n\t */\n\tv2_117: \"2.117.0\",\n} as const satisfies Record<string, OldestSupportedClientVersion>;\n\n/**\n * An up to date version which includes all stable features.\n * @remarks\n * Use for cases when data is not persisted and thus would only ever be read by the the same version of the code which read this value.\n *\n * The pkgVersion from this package (tree) can not be used here as it is not guaranteed to be a valid OldestSupportedClientVersion\n * and would also unexpectedly disable features in prereleases and on CI if it didn't fail validation.\n * See {@link @fluidframework/runtime-utils/internal#cleanedPackageVersion} for more details on why cleanedPackageVersion is preferred over pkgVersion.\n *\n * @privateRemarks\n * It is safe to use CleanedPackageVersion from runtime-utils here since features are enabled in minor versions,\n * and this package (tree) depends on runtime-utils with a `~` semver range\n * ensuring that the version of runtime-utils this was imported from will match the version of this (tree) package at least up to the minor version.\n * Reusing this from runtime-utils avoids duplicating the cleanup logic here as well as the cost or recomputing it.\n * If in the future for some reason this becomes not okay, runtime-utils could instead export a function that performs that cleanup logic which could be reused here.\n */\nexport const currentVersion: OldestSupportedClientVersion = runtimeUtilsCleanedPackageVersion;\n\n/**\n * TODO:\n * This needs to be documented.\n * Its documentation should cover at least the following:\n * - Is this used for anything other than testing.\n * - What should be included as children. For example should it include versioned codecs which dispatch base on the min version for collaboration? If so, what version of them should be used?\n * - What risks does having this mitigate?\n */\nexport interface CodecTree<TFormatVersion extends FormatVersion = FormatVersion> {\n\treadonly name: string;\n\treadonly version: TFormatVersion;\n\treadonly children?: readonly CodecTree[];\n}\n\nexport function jsonableCodecTree(tree: CodecTree): JsonCompatibleReadOnly {\n\treturn {\n\t\tname: tree.name,\n\t\tversion: tree.version ?? \"null\",\n\t\tchildren: tree.children?.map(jsonableCodecTree),\n\t};\n}\n"]}
@@ -75,6 +75,7 @@ export const unionOptions = {
75
75
  * where only a single property of `EncodedOperation` is populated for a given encoded value.
76
76
  */
77
77
  export class DiscriminatedUnionDispatcher {
78
+ library;
78
79
  constructor(library) {
79
80
  this.library = objectToMap(library);
80
81
  }
@@ -1 +1 @@
1
- {"version":3,"file":"discriminatedUnions.js","sourceRoot":"","sources":["../../src/codec/discriminatedUnions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,qCAAqC,CAAC;AAGnE,OAAO,EAAqB,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAElE;;;;GAIG;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAAkB;IAC1C,oBAAoB,EAAE,KAAK;IAC3B,aAAa,EAAE,CAAC;IAChB,aAAa,EAAE,CAAC;CAChB,CAAC;AAqBF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AACH,MAAM,OAAO,4BAA4B;IAWxC,YAAmB,OAA0D;QAC5E,IAAI,CAAC,OAAO,GAAG,WAAW,CACzB,OAA4E,CAC5E,CAAC;IACH,CAAC;IAEM,QAAQ,CAAC,KAAa,EAAE,GAAG,IAAW;QAC5C,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QACpC,MAAM,CACL,IAAI,CAAC,MAAM,KAAK,CAAC,EACjB,KAAK,CAAC,6DAA6D,CACnE,CAAC;QACF,MAAM,GAAG,GAAiB,IAAI,CAAC,CAAC,CAAiB,CAAC;QAClD,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;QACzB,MAAM,OAAO,GACZ,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,uCAAuC,CAAC,CAAC;QAC9E,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,CAAC;QACvC,OAAO,MAAM,CAAC;IACf,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, fail } from \"@fluidframework/core-utils/internal\";\nimport type { ObjectOptions } from \"@sinclair/typebox\";\n\nimport { type _InlineTrick, objectToMap } from \"../util/index.js\";\n\n/**\n * This module contains utilities for an encoding of a discriminated union that is efficient to validate using\n * a JSON schema validator.\n * See {@link DiscriminatedUnionDispatcher} for more information on this pattern.\n */\n\n/**\n * Options to configure a TypeBox schema as a discriminated union that is simple to validate data against.\n *\n * See {@link DiscriminatedUnionDispatcher} for more information on this pattern.\n */\nexport const unionOptions: ObjectOptions = {\n\tadditionalProperties: false,\n\tminProperties: 1,\n\tmaxProperties: 1,\n};\n\n/**\n * An object containing functions for each member of the union.\n *\n * See {@link DiscriminatedUnionDispatcher}.\n */\nexport type DiscriminatedUnionLibrary<\n\tTUnion extends object,\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tTArgs extends any[],\n\tTResult,\n> = [\n\t{\n\t\treadonly [Property in keyof TUnion]-?: (\n\t\t\tvalue: Required<TUnion>[Property],\n\t\t\t...args: TArgs\n\t\t) => TResult;\n\t},\n][_InlineTrick];\n\n/**\n * Applies a function to the content of a {@link https://en.wikipedia.org/wiki/Tagged_union | discriminated union}\n * where the function to apply depends on which value from the union it holds.\n *\n * This uses a rather non-standard encoding of the union where it is an object with many differently named optional fields,\n * and which of the fields is populated determines the content type.\n * This union encoding has the advantage that schema validation (such as that implemented by TypeBox) can validate the data efficiently.\n * Other encodings--such as using an untagged union, then tagging the content types with a marker enum--require the schema validator to disambiguate the union members.\n * Most JSON validator implementations fail to recognize the marker enum determines which component of the discriminated union the data must be,\n * and end up checking against all candidate members of the union.\n *\n * @example\n *\n * The following union:\n * ```typescript\n * type Operation = Add | Subtract | Multiply | Divide;\n *\n * interface BinaryOperation {\n * readonly left: number;\n * readonly right: number;\n * }\n *\n * interface Add extends BinaryOperation {\n * readonly type: \"add\";\n * }\n *\n * interface Subtract extends BinaryOperation {\n * readonly type: \"subtract\";\n * }\n *\n * interface Multiply extends BinaryOperation {\n * readonly type: \"multiply\";\n * }\n *\n * interface Divide extends BinaryOperation {\n * readonly type: \"divide\";\n * }\n *\n * ```\n * Would be encoded using this strategy as:\n * ```typescript\n * interface EncodedBinaryOperation {\n * readonly left: number;\n * readonly right: number;\n * }\n *\n * interface EncodedOperation {\n * add?: EncodedBinaryOperation;\n * subtract?: EncodedBinaryOperation;\n * multiply?: EncodedBinaryOperation;\n * divide?: EncodedBinaryOperation;\n * }\n * ```\n * where only a single property of `EncodedOperation` is populated for a given encoded value.\n */\nexport class DiscriminatedUnionDispatcher<\n\tTUnion extends object,\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tTArgs extends any[],\n\tTResult,\n> {\n\tprivate readonly library: ReadonlyMap<\n\t\tkeyof TUnion,\n\t\t(value: unknown, ...args: TArgs) => TResult\n\t>;\n\n\tpublic constructor(library: DiscriminatedUnionLibrary<TUnion, TArgs, TResult>) {\n\t\tthis.library = objectToMap(\n\t\t\tlibrary as Record<keyof TUnion, (value: unknown, ...args: TArgs) => TResult>,\n\t\t);\n\t}\n\n\tpublic dispatch(union: TUnion, ...args: TArgs): TResult {\n\t\tconst keys = Reflect.ownKeys(union);\n\t\tassert(\n\t\t\tkeys.length === 1,\n\t\t\t0x733 /* discriminated union type should have exactly one member */,\n\t\t);\n\t\tconst key: keyof TUnion = keys[0] as keyof TUnion;\n\t\tconst value = union[key];\n\t\tconst factory =\n\t\t\tthis.library.get(key) ?? fail(0xac2 /* missing function for union member */);\n\t\tconst result = factory(value, ...args);\n\t\treturn result;\n\t}\n}\n"]}
1
+ {"version":3,"file":"discriminatedUnions.js","sourceRoot":"","sources":["../../src/codec/discriminatedUnions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,qCAAqC,CAAC;AAGnE,OAAO,EAAqB,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAElE;;;;GAIG;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAAkB;IAC1C,oBAAoB,EAAE,KAAK;IAC3B,aAAa,EAAE,CAAC;IAChB,aAAa,EAAE,CAAC;CAChB,CAAC;AAqBF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AACH,MAAM,OAAO,4BAA4B;IAMvB,OAAO,CAGtB;IAEF,YAAmB,OAA0D;QAC5E,IAAI,CAAC,OAAO,GAAG,WAAW,CACzB,OAA4E,CAC5E,CAAC;IACH,CAAC;IAEM,QAAQ,CAAC,KAAa,EAAE,GAAG,IAAW;QAC5C,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QACpC,MAAM,CACL,IAAI,CAAC,MAAM,KAAK,CAAC,EACjB,KAAK,CAAC,6DAA6D,CACnE,CAAC;QACF,MAAM,GAAG,GAAiB,IAAI,CAAC,CAAC,CAAiB,CAAC;QAClD,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;QACzB,MAAM,OAAO,GACZ,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,uCAAuC,CAAC,CAAC;QAC9E,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,CAAC;QACvC,OAAO,MAAM,CAAC;IACf,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, fail } from \"@fluidframework/core-utils/internal\";\nimport type { ObjectOptions } from \"@sinclair/typebox\";\n\nimport { type _InlineTrick, objectToMap } from \"../util/index.js\";\n\n/**\n * This module contains utilities for an encoding of a discriminated union that is efficient to validate using\n * a JSON schema validator.\n * See {@link DiscriminatedUnionDispatcher} for more information on this pattern.\n */\n\n/**\n * Options to configure a TypeBox schema as a discriminated union that is simple to validate data against.\n *\n * See {@link DiscriminatedUnionDispatcher} for more information on this pattern.\n */\nexport const unionOptions: ObjectOptions = {\n\tadditionalProperties: false,\n\tminProperties: 1,\n\tmaxProperties: 1,\n};\n\n/**\n * An object containing functions for each member of the union.\n *\n * See {@link DiscriminatedUnionDispatcher}.\n */\nexport type DiscriminatedUnionLibrary<\n\tTUnion extends object,\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tTArgs extends any[],\n\tTResult,\n> = [\n\t{\n\t\treadonly [Property in keyof TUnion]-?: (\n\t\t\tvalue: Required<TUnion>[Property],\n\t\t\t...args: TArgs\n\t\t) => TResult;\n\t},\n][_InlineTrick];\n\n/**\n * Applies a function to the content of a {@link https://en.wikipedia.org/wiki/Tagged_union | discriminated union}\n * where the function to apply depends on which value from the union it holds.\n *\n * This uses a rather non-standard encoding of the union where it is an object with many differently named optional fields,\n * and which of the fields is populated determines the content type.\n * This union encoding has the advantage that schema validation (such as that implemented by TypeBox) can validate the data efficiently.\n * Other encodings--such as using an untagged union, then tagging the content types with a marker enum--require the schema validator to disambiguate the union members.\n * Most JSON validator implementations fail to recognize the marker enum determines which component of the discriminated union the data must be,\n * and end up checking against all candidate members of the union.\n *\n * @example\n *\n * The following union:\n * ```typescript\n * type Operation = Add | Subtract | Multiply | Divide;\n *\n * interface BinaryOperation {\n * readonly left: number;\n * readonly right: number;\n * }\n *\n * interface Add extends BinaryOperation {\n * readonly type: \"add\";\n * }\n *\n * interface Subtract extends BinaryOperation {\n * readonly type: \"subtract\";\n * }\n *\n * interface Multiply extends BinaryOperation {\n * readonly type: \"multiply\";\n * }\n *\n * interface Divide extends BinaryOperation {\n * readonly type: \"divide\";\n * }\n *\n * ```\n * Would be encoded using this strategy as:\n * ```typescript\n * interface EncodedBinaryOperation {\n * readonly left: number;\n * readonly right: number;\n * }\n *\n * interface EncodedOperation {\n * add?: EncodedBinaryOperation;\n * subtract?: EncodedBinaryOperation;\n * multiply?: EncodedBinaryOperation;\n * divide?: EncodedBinaryOperation;\n * }\n * ```\n * where only a single property of `EncodedOperation` is populated for a given encoded value.\n */\nexport class DiscriminatedUnionDispatcher<\n\tTUnion extends object,\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tTArgs extends any[],\n\tTResult,\n> {\n\tprivate readonly library: ReadonlyMap<\n\t\tkeyof TUnion,\n\t\t(value: unknown, ...args: TArgs) => TResult\n\t>;\n\n\tpublic constructor(library: DiscriminatedUnionLibrary<TUnion, TArgs, TResult>) {\n\t\tthis.library = objectToMap(\n\t\t\tlibrary as Record<keyof TUnion, (value: unknown, ...args: TArgs) => TResult>,\n\t\t);\n\t}\n\n\tpublic dispatch(union: TUnion, ...args: TArgs): TResult {\n\t\tconst keys = Reflect.ownKeys(union);\n\t\tassert(\n\t\t\tkeys.length === 1,\n\t\t\t0x733 /* discriminated union type should have exactly one member */,\n\t\t);\n\t\tconst key: keyof TUnion = keys[0] as keyof TUnion;\n\t\tconst value = union[key];\n\t\tconst factory =\n\t\t\tthis.library.get(key) ?? fail(0xac2 /* missing function for union member */);\n\t\tconst result = factory(value, ...args);\n\t\treturn result;\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"codec.d.ts","sourceRoot":"","sources":["../../../src/codec/versioned/codec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,8CAA8C,CAAC;A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AAQ,EACR,cAAc,EACd,cAAc,EACd,aAAa,EACb,cAAc,CACd,EAAE,CAAC;IAEJ;;;;;;;OAOG;IACH,OAAO;IA6DP;;;;;OAKG;IACI,YAAY,CAClB,OAAO,EAAE,aAAa,GACpB,qBAAqB,CAAC,QAAQ,EAAE,cAAc,EAAE,cAAc,EAAE,cAAc,CAAC,EAAE;IAQpF;;;OAGG;IACI,KAAK,CACX,OAAO,EAAE,aAAa,GAAG,iBAAiB,GACxC,uBAAuB,CAAC,QAAQ,EAAE,cAAc,EAAE,cAAc,EAAE,cAAc,CAAC;IAYpF,OAAO,CAAC,oBAAoB;IAsC5B;;;;;;;;;OASG;IACI,YAAY,CAClB,OAAO,EAAE,aAAa,GACpB,IAAI,CACN,uBAAuB,CAAC,QAAQ,EAAE,cAAc,EAAE,cAAc,EAAE,cAAc,CAAC,EACjF,QAAQ,CACR;IAIM,YAAY,CAAC,aAAa,EAAE,4BAA4B,GAAG,SAAS,CAAC,cAAc,CAAC;IAS3F;;;;;;;;;;;;;;;OAeG;WAEW,KAAK,CAClB,IAAI,SAAS,SAAS,EACtB,KAAK,SAAS,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,OAAO,CAAC,EAC1E,IAAI,EAAE,IAAI,EAAE,aAAa,EAAE,SAAS,KAAK,EAAE,oGAQuB,CAAC,+EANlC,CAAC,kHAEQ,CAAC,iGAAD,CAAC,iGAEQ,CAAC,sOAFV,CAAC,iGAAD,CAAC;CAoC7C"}
@@ -96,6 +96,8 @@ function normalizeCodecVersion(codecVersion) {
96
96
  * the second (the instance build) can bring in configuration.
97
97
  */
98
98
  export class VersionDispatchingCodecBuilder {
99
+ name;
100
+ registry;
99
101
  /**
100
102
  * Use {@link VersionDispatchingCodecBuilder.build} to create an instance of this class.
101
103
  * @remarks
@@ -1 +1 @@
1
- {"version":3,"file":"codec.js","sourceRoot":"","sources":["../../../src/codec/versioned/codec.ts"],"names":[],"mappings":"AAAA;;;GA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2BAA2B,mDAAmD,OAAO,CAAC,mBAAmB,+FAA+F,CACnW,CAAC;YACH,CAAC;QACF,CAAC;QAED,OAAO,QAAQ,CAAC;IACjB,CAAC;IAED,OAAO,0BAA0B,CAAC,QAAQ,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAC1E,CAAC;AAED;;GAEG;AACH,SAAS,0BAA0B,CAClC,QAAsB,EACtB,mBAAiD;IAEjD,MAAM,cAAc,GAAsE,EAAE,CAAC;IAC7F,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAChC,IAAI,OAAO,CAAC,mBAAmB,KAAK,SAAS,EAAE,CAAC;YAC/C,cAAc,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,mBAAmB,EAAE,OAAO,CAAC,CAAC,CAAC;QAC7D,CAAC;IACF,CAAC;IAED,MAAM,MAAM,GAAM,uCAAuC,CACxD,mBAAmB,EACnB,cAAc,CACd,CAAC;IACF,OAAO,MAAM,CAAC;AACf,CAAC;AAED;;GAEG;AACH,SAAS,WAAW,CAAC,QAAqC;IACzD,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;AAC7E,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, debugAssert } from \"@fluidframework/core-utils/internal\";\nimport type { OldestSupportedClientVersion } from \"@fluidframework/runtime-definitions/internal\";\nimport {\n\tgetConfigForMinVersionForCollabIterable,\n\tlowestMinVersionForCollab,\n\ttype MinimumMinorSemanticVersion,\n\ttype SemanticVersion,\n} from \"@fluidframework/runtime-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\nimport type { TSchema } from \"@sinclair/typebox\";\nimport { gt } from \"semver-ts\";\n\nimport { pkgVersion } from \"../../packageVersion.js\";\nimport {\n\tJsonCompatibleReadOnlySchema,\n\ttype JsonCompatibleReadOnly,\n\ttype JsonCompatibleReadOnlyObject,\n} from \"../../util/index.js\";\nimport {\n\ttype ICodecOptions,\n\ttype IJsonCodec,\n\twithSchemaValidation,\n\ttype FormatVersion,\n\ttype CodecWriteOptions,\n\ttype CodecName,\n\ttype CodecTree,\n} from \"../codec.js\";\n\nimport { Versioned } from \"./format.js\";\n\n/**\n * Json compatible data with a format version.\n */\ntype VersionedJson = JsonCompatibleReadOnlyObject & Versioned;\n\n/**\n * Validate that the version is one of the supported values.\n * @remarks\n * If supportedVersions contains undefined, data with no version field is also accepted despite the return type indicating otherwise.\n * This is for legacy compatibility where older data may not have a version field.\n */\nfunction makeVersionedCodec<\n\tTDecoded,\n\tTEncoded extends Versioned = VersionedJson,\n\tTValidate = TEncoded,\n\tTEncodeContext = void,\n\tTDecodeContext = TEncodeContext,\n>(\n\tsupportedVersions: Set<FormatVersion>,\n\t{ jsonValidator: validator }: ICodecOptions,\n\tinner: IJsonCodec<TDecoded, TEncoded, TValidate, TEncodeContext, TDecodeContext>,\n): IJsonCodec<TDecoded, TEncoded, TValidate, TEncodeContext, TDecodeContext> {\n\tconst codec = {\n\t\tencode: (data: TDecoded, context: TEncodeContext): TEncoded => {\n\t\t\tconst encoded = inner.encode(data, context);\n\t\t\tassert(\n\t\t\t\tsupportedVersions.has(encoded.version),\n\t\t\t\t0x88b /* version being encoded should be supported */,\n\t\t\t);\n\t\t\treturn encoded;\n\t\t},\n\t\tdecode: (data: TValidate, context: TDecodeContext): TDecoded => {\n\t\t\tconst versioned = data as Versioned; // Validated by withSchemaValidation\n\t\t\tif (!supportedVersions.has(versioned.version)) {\n\t\t\t\tthrow new UsageError(\n\t\t\t\t\t`Unsupported version ${versioned.version} encountered while decoding data. Supported versions for this data are: ${[...supportedVersions].join(\", \")}.\nThe client which encoded this data likely specified an \"minVersionForCollab\" value which corresponds to a version newer than the version of this client (\"${pkgVersion}\").`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst decoded = inner.decode(data, context);\n\t\t\treturn decoded;\n\t\t},\n\t};\n\n\t// If undefined is a supported version, skip using withSchemaValidation to enforce there is a version field.\n\t// Codec will still assert the content of the field is in supportedVersions, so it is still somewhat validated, just in a different way.\n\tif (supportedVersions.has(undefined)) {\n\t\treturn codec;\n\t}\n\n\treturn withSchemaValidation(Versioned, codec, validator);\n}\n\n/**\n * Wrap a codec with version checking and schema validation.\n * @remarks\n * The passed in codec should not perform its own schema validation.\n * The schema validation gets added here.\n */\nfunction makeVersionedValidatedCodec<\n\tEncodedSchema extends TSchema,\n\tTDecoded,\n\tTEncoded extends Versioned = VersionedJson,\n\tTValidate = TEncoded,\n\tTEncodeContext = void,\n\tTDecodeContext = TEncodeContext,\n>(\n\toptions: ICodecOptions,\n\tsupportedVersions: Set<FormatVersion>,\n\tschema: EncodedSchema,\n\tcodec: IJsonCodec<TDecoded, TEncoded, TValidate, TEncodeContext, TDecodeContext>,\n): IJsonCodec<TDecoded, TEncoded, TValidate, TEncodeContext, TDecodeContext> &\n\tPick<CodecAndSchema<TDecoded, TEncodeContext, TDecodeContext>, \"schema\"> {\n\treturn {\n\t\t...makeVersionedCodec(\n\t\t\tsupportedVersions,\n\t\t\toptions,\n\t\t\twithSchemaValidation(schema, codec, options.jsonValidator),\n\t\t),\n\t\tschema,\n\t};\n}\n\n/**\n * Creates a codec version which always throws a UsageError when encoding or decoding, indicating that the format version is discontinued.\n */\nexport function makeDiscontinuedCodecAndSchema<\n\tTDecoded,\n\tTFormatVersion extends FormatVersion = FormatVersion,\n>(\n\tdiscontinuedVersion: TFormatVersion,\n\tdiscontinuedSince: SemanticVersion,\n): CodecVersion<TDecoded, unknown, TFormatVersion, ICodecOptions, unknown> {\n\treturn {\n\t\tminVersionForCollab: undefined,\n\t\tformatVersion: discontinuedVersion,\n\t\tcodec: {\n\t\t\tschema: JsonCompatibleReadOnlySchema,\n\t\t\tencode: (_data: TDecoded) => {\n\t\t\t\tthrow new UsageError(\n\t\t\t\t\t`Cannot encode data to format ${discontinuedVersion}. The codec was discontinued in Fluid Framework client version ${discontinuedSince}.`,\n\t\t\t\t);\n\t\t\t},\n\t\t\tdecode: (data: unknown) => {\n\t\t\t\tthrow new UsageError(\n\t\t\t\t\t`Cannot decode data in format ${discontinuedVersion}. The codec was discontinued in Fluid Framework client version ${discontinuedSince}.`,\n\t\t\t\t);\n\t\t\t},\n\t\t},\n\t};\n}\n\n/**\n * A friendly format for codec authors use to define their codec and schema for use in {@link CodecVersion}.\n * @remarks\n * The codec should not perform its own schema validation.\n * The schema validation gets added when normalizing to {@link NormalizedCodecVersion}.\n */\nexport type CodecAndSchema<\n\tTDecoded,\n\tTEncodeContext = void,\n\tTDecodeContext = TEncodeContext,\n> = {\n\treadonly schema: TSchema;\n} & IJsonCodec<\n\tTDecoded,\n\tVersionedJson,\n\tJsonCompatibleReadOnly,\n\tTEncodeContext,\n\tTDecodeContext\n>;\n\n/**\n * A codec alongside its format version and schema.\n */\nexport interface CodecVersionBase<\n\tT = unknown,\n\tTFormatVersion extends FormatVersion = FormatVersion,\n> {\n\t/**\n\t * When `undefined` the codec will never be selected as a write version except via override.\n\t * @remarks\n\t * This format will be used for decode if data in it needs to be decoded, regardless of `minVersionForCollab`.\n\t * `undefined` should be used for unstable codec versions (with string FormatVersions),\n\t * as well as previously stabilized formats that are discontinued (meaning we always prefer to use some other format for encoding).\n\t */\n\treadonly minVersionForCollab: OldestSupportedClientVersion | undefined;\n\treadonly formatVersion: TFormatVersion;\n\treadonly codec: T;\n}\n\n/**\n * A particular version of a codec and when to use it.\n * @privateRemarks\n * This allows lazy building of the codec with options.\n * This option can likely be removed as the codec handling is made simpler and more consistent.\n * Removing support for this laziness would be nice to help prevent unexpected coupling and alteration to codec behavior,\n * helping ensure that tests and production code behave the same.\n */\nexport interface CodecVersion<\n\tTDecoded,\n\tTEncodeContext,\n\tTFormatVersion extends FormatVersion,\n\tTBuildOptions extends ICodecOptions = ICodecOptions,\n\tTDecodeContext = TEncodeContext,\n> extends CodecVersionBase<\n\t\t| CodecAndSchema<TDecoded, TEncodeContext, TDecodeContext>\n\t\t| ((options: TBuildOptions) => CodecAndSchema<TDecoded, TEncodeContext, TDecodeContext>),\n\t\tTFormatVersion\n\t> {}\n\n/**\n * {@link CodecVersion} after normalization into a consistent type.\n * @remarks\n * Produced by {@link normalizeCodecVersion}.\n * Includes schema validation.\n */\nexport interface NormalizedCodecVersion<\n\tTDecoded,\n\tTEncodeContext,\n\tTFormatVersion extends FormatVersion,\n\tTBuildOptions extends ICodecOptions,\n\tTDecodeContext = TEncodeContext,\n> extends CodecVersionBase<\n\t\t(options: TBuildOptions) => CodecAndSchema<TDecoded, TEncodeContext, TDecodeContext>,\n\t\tTFormatVersion\n\t> {}\n\n/**\n * {@link NormalizedCodecVersion} after applying the build options.\n * @remarks\n * Produced by {@link VersionDispatchingCodecBuilder.applyOptions}.\n */\ninterface EvaluatedCodecVersion<\n\tTDecoded,\n\tTEncodeContext,\n\tTFormatVersion extends FormatVersion,\n\tTDecodeContext = TEncodeContext,\n> extends CodecVersionBase<\n\t\tCodecAndSchema<TDecoded, TEncodeContext, TDecodeContext>,\n\t\tTFormatVersion\n\t> {}\n\n/**\n * Normalize the codec to a single format.\n * @remarks\n * Bakes in schema validation, so output no longer exposes the schema.\n */\nfunction normalizeCodecVersion<\n\tTDecoded,\n\tTEncodeContext,\n\tTFormatVersion extends FormatVersion,\n\tTBuildOptions extends ICodecOptions,\n\tTDecodeContext = TEncodeContext,\n>(\n\tcodecVersion: CodecVersion<\n\t\tTDecoded,\n\t\tTEncodeContext,\n\t\tTFormatVersion,\n\t\tTBuildOptions,\n\t\tTDecodeContext\n\t>,\n): NormalizedCodecVersion<\n\tTDecoded,\n\tTEncodeContext,\n\tTFormatVersion,\n\tTBuildOptions,\n\tTDecodeContext\n> {\n\tconst codecBuilder: (\n\t\toptions: TBuildOptions,\n\t) => CodecAndSchema<TDecoded, TEncodeContext, TDecodeContext> =\n\t\ttypeof codecVersion.codec === \"function\"\n\t\t\t? codecVersion.codec\n\t\t\t: () => codecVersion.codec as CodecAndSchema<TDecoded, TEncodeContext, TDecodeContext>;\n\tconst codec = (\n\t\toptions: TBuildOptions,\n\t): CodecAndSchema<TDecoded, TEncodeContext, TDecodeContext> => {\n\t\tconst built = codecBuilder(options);\n\t\treturn makeVersionedValidatedCodec(\n\t\t\toptions,\n\t\t\tnew Set([codecVersion.formatVersion]),\n\t\t\tbuilt.schema,\n\t\t\tbuilt,\n\t\t);\n\t};\n\n\treturn {\n\t\tminVersionForCollab: codecVersion.minVersionForCollab,\n\t\tformatVersion: codecVersion.formatVersion,\n\t\tcodec,\n\t};\n}\n\n/**\n * A codec that can read multiple format versions and write a single selected version.\n * @remarks\n * Produced by {@link VersionDispatchingCodecBuilder.build}.\n *\n * @typeParam TDecoded - The in memory (not encoded) format.\n * @typeParam TEncodeContext - Context type passed to encode operations.\n * @typeParam TFormatVersion - The type of format version identifiers used by this codec.\n * @typeParam TDecodeContext - Context type passed to decode operations. Defaults to `TEncodeContext`.\n */\nexport interface VersionDispatchingCodec<\n\tTDecoded,\n\tTEncodeContext,\n\tTFormatVersion extends FormatVersion,\n\tTDecodeContext = TEncodeContext,\n> extends IJsonCodec<\n\t\tTDecoded,\n\t\tJsonCompatibleReadOnly,\n\t\tJsonCompatibleReadOnly,\n\t\tTEncodeContext,\n\t\tTDecodeContext\n\t> {\n\t/**\n\t * The format version which this codec writes.\n\t * @remarks\n\t * Selected by {@link VersionDispatchingCodecBuilder.build} based on the provided options.\n\t */\n\treadonly writeVersion: TFormatVersion;\n}\n\n/**\n * Creates a {@link VersionDispatchingCodec} using a {@link CodecVersion} to select the {@link VersionDispatchingCodec.writeVersion}.\n * @privateRemarks\n * This is a two stage builder so the first stage (the static build) can encapsulate all codec specific details and\n * the second (the instance build) can bring in configuration.\n */\nexport class VersionDispatchingCodecBuilder<\n\tTBuildOptions extends ICodecOptions = ICodecOptions,\n\tTDecoded = unknown,\n\tTEncodeContext = unknown,\n\tTFormatVersion extends FormatVersion = FormatVersion,\n\tTName extends CodecName = string,\n\tTDecodeContext = TEncodeContext,\n> {\n\tpublic readonly registry: readonly NormalizedCodecVersion<\n\t\tTDecoded,\n\t\tTEncodeContext,\n\t\tTFormatVersion,\n\t\tTBuildOptions,\n\t\tTDecodeContext\n\t>[];\n\n\t/**\n\t * Use {@link VersionDispatchingCodecBuilder.build} to create an instance of this class.\n\t * @remarks\n\t * Inputs to this are assumed to be constants in the code controlled by the developers of this package,\n\t * and constructed at least once during tests.\n\t * Because of this, the validation of these inputs done with debugAssert should be sufficient,\n\t * and using debugAssert avoids bloating the bundle size for production users.\n\t */\n\tprivate constructor(\n\t\t/**\n\t\t * See {@link CodecName}.\n\t\t */\n\t\tpublic readonly name: TName,\n\t\t/**\n\t\t * The registry of codecs which this builder can use to encode and decode data.\n\t\t */\n\t\tinputRegistry: readonly CodecVersion<\n\t\t\tTDecoded,\n\t\t\tTEncodeContext,\n\t\t\tTFormatVersion,\n\t\t\tTBuildOptions,\n\t\t\tTDecodeContext\n\t\t>[],\n\t) {\n\t\ttype Normalized = NormalizedCodecVersion<\n\t\t\tTDecoded,\n\t\t\tTEncodeContext,\n\t\t\tTFormatVersion,\n\t\t\tTBuildOptions,\n\t\t\tTDecodeContext\n\t\t>;\n\t\tconst normalizedRegistry: Normalized[] = [];\n\t\tconst formats: Set<FormatVersion> = new Set();\n\t\tconst versions: Set<string | undefined> = new Set();\n\n\t\tfor (const codec of inputRegistry) {\n\t\t\tdebugAssert(\n\t\t\t\t() =>\n\t\t\t\t\t!formats.has(codec.formatVersion) ||\n\t\t\t\t\t`duplicate codec format ${name} ${codec.formatVersion}`,\n\t\t\t);\n\t\t\tdebugAssert(\n\t\t\t\t() =>\n\t\t\t\t\tcodec.minVersionForCollab === undefined ||\n\t\t\t\t\ttypeof codec.formatVersion !== \"string\" ||\n\t\t\t\t\t`unstable format ${JSON.stringify(codec.formatVersion)} (string formats) must not have a minVersionForCollab in ${name}`,\n\t\t\t);\n\t\t\tformats.add(codec.formatVersion);\n\t\t\tconst normalizedCodec = normalizeCodecVersion(codec);\n\t\t\tnormalizedRegistry.push(normalizedCodec);\n\t\t\tif (codec.minVersionForCollab !== undefined) {\n\t\t\t\tdebugAssert(\n\t\t\t\t\t() =>\n\t\t\t\t\t\t!versions.has(codec.minVersionForCollab) ||\n\t\t\t\t\t\t`Codec ${name} has multiple entries for version ${JSON.stringify(codec.minVersionForCollab)}`,\n\t\t\t\t);\n\t\t\t\tversions.add(codec.minVersionForCollab);\n\t\t\t}\n\t\t}\n\n\t\tdebugAssert(\n\t\t\t() =>\n\t\t\t\tversions.has(lowestMinVersionForCollab) ||\n\t\t\t\t`Codec ${name} is missing entry for lowestMinVersionForCollab`,\n\t\t);\n\n\t\tthis.registry = normalizedRegistry;\n\t}\n\n\t/**\n\t * Applies `options` to the codec registry to produce a list of evaluated codecs.\n\t * @remarks\n\t * This is used by build, which is what production code should use.\n\t * This is only exposed for testing purposes.\n\t */\n\tpublic applyOptions(\n\t\toptions: TBuildOptions,\n\t): EvaluatedCodecVersion<TDecoded, TEncodeContext, TFormatVersion, TDecodeContext>[] {\n\t\treturn this.registry.map((codec) => ({\n\t\t\tminVersionForCollab: codec.minVersionForCollab,\n\t\t\tformatVersion: codec.formatVersion,\n\t\t\tcodec: codec.codec(options),\n\t\t}));\n\t}\n\n\t/**\n\t * Builds a complete {@link VersionDispatchingCodec} that can decode all registered versions\n\t * and encode a version selected by the provided options.\n\t */\n\tpublic build(\n\t\toptions: TBuildOptions & CodecWriteOptions,\n\t): VersionDispatchingCodec<TDecoded, TEncodeContext, TFormatVersion, TDecodeContext> {\n\t\tconst [applied, decoder] = this.buildDecoderInternal(options);\n\t\tconst writeVersion = getWriteVersion(this.name, options, applied);\n\t\treturn {\n\t\t\t...decoder,\n\t\t\tencode: (data: TDecoded, context: TEncodeContext): JsonCompatibleReadOnly => {\n\t\t\t\treturn writeVersion.codec.encode(data, context);\n\t\t\t},\n\t\t\twriteVersion: writeVersion.formatVersion,\n\t\t};\n\t}\n\n\tprivate buildDecoderInternal(\n\t\toptions: TBuildOptions,\n\t): [\n\t\tEvaluatedCodecVersion<TDecoded, TEncodeContext, TFormatVersion, TDecodeContext>[],\n\t\tPick<\n\t\t\tIJsonCodec<\n\t\t\t\tTDecoded,\n\t\t\t\tJsonCompatibleReadOnly,\n\t\t\t\tJsonCompatibleReadOnly,\n\t\t\t\tTEncodeContext,\n\t\t\t\tTDecodeContext\n\t\t\t>,\n\t\t\t\"decode\"\n\t\t>,\n\t] {\n\t\tconst applied = this.applyOptions(options);\n\t\tconst fromFormatVersion = new Map<\n\t\t\tFormatVersion,\n\t\t\tEvaluatedCodecVersion<TDecoded, TEncodeContext, TFormatVersion, TDecodeContext>\n\t\t>(applied.map((codec) => [codec.formatVersion, codec]));\n\t\treturn [\n\t\t\tapplied,\n\t\t\t{\n\t\t\t\tdecode: (data: JsonCompatibleReadOnly, context: TDecodeContext): TDecoded => {\n\t\t\t\t\tconst versioned = data as Partial<Versioned>;\n\t\t\t\t\tconst codec = fromFormatVersion.get(versioned.version);\n\t\t\t\t\tif (codec === undefined) {\n\t\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t\t`Unsupported version ${versioned.version} encountered while decoding ${this.name} data. Supported versions for this data are: ${versionList(applied)}.\nThe client which encoded this data likely specified an \"minVersionForCollab\" value which corresponds to a version newer than the version of this client (\"${pkgVersion}\").`,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\treturn codec.codec.decode(data, context);\n\t\t\t\t},\n\t\t\t},\n\t\t];\n\t}\n\n\t/**\n\t * Builds a decoder-only codec that can decode any supported format without encoding capability.\n\t *\n\t * @remarks\n\t * The returned codec contains only the `decode` method and can be used when only decoding is needed.\n\t * This is useful for scenarios where reading/decoding versioned data is sufficient.\n\t *\n\t * @param options - Build options (typically containing the `jsonValidator`)\n\t * @returns An object with a `decode` method that can handle any supported format version\n\t */\n\tpublic buildDecoder(\n\t\toptions: TBuildOptions,\n\t): Pick<\n\t\tVersionDispatchingCodec<TDecoded, TEncodeContext, TFormatVersion, TDecodeContext>,\n\t\t\"decode\"\n\t> {\n\t\treturn this.buildDecoderInternal(options)[1];\n\t}\n\n\tpublic getCodecTree(clientVersion: OldestSupportedClientVersion): CodecTree<TFormatVersion> {\n\t\t// TODO: add support for children codecs.\n\t\tconst selected = getWriteVersionNoOverrides(this.registry, clientVersion);\n\t\treturn {\n\t\t\tname: this.name,\n\t\t\tversion: selected.formatVersion,\n\t\t};\n\t}\n\n\t/**\n\t * Creates a new VersionDispatchingCodecBuilder from the provided codec registry.\n\t *\n\t * @remarks\n\t * This static method infers the types of the builder from the provided registry,\n\t * making it easier to create builders without needing to explicitly specify all type parameters.\n\t * This gets better type inference than the constructor.\n\t *\n\t * @example\n\t * ```typescript\n\t * const builder = VersionDispatchingCodecBuilder.build('myCodec', [\n\t * { minVersionForCollab: lowestMinVersionForCollab, formatVersion: 1, codec: { encode, decode, schema } },\n\t * { minVersionForCollab: '2.100.0', formatVersion: 2, codec: { encode, decode, schema } },\n\t * ]);\n\t * ```\n\t */\n\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n\tpublic static build<\n\t\tName extends CodecName,\n\t\tEntry extends CodecVersion<unknown, unknown, FormatVersion, never, unknown>,\n\t>(name: Name, inputRegistry: readonly Entry[]) {\n\t\ttype TDecoded2 =\n\t\t\tEntry extends CodecVersion<infer D, unknown, FormatVersion, never, unknown> ? D : never;\n\t\ttype TEncodeContext2 =\n\t\t\tEntry extends CodecVersion<unknown, infer C, FormatVersion, never, unknown> ? C : never;\n\t\ttype TFormatVersion2 =\n\t\t\tEntry extends CodecVersion<unknown, unknown, infer F, never, unknown> ? F : never;\n\t\ttype TBuildOptions2 =\n\t\t\tEntry extends CodecVersion<unknown, unknown, FormatVersion, infer B, unknown>\n\t\t\t\t? B\n\t\t\t\t: never;\n\t\ttype TDecodeContext2 =\n\t\t\tEntry extends CodecVersion<unknown, unknown, FormatVersion, never, infer D> ? D : never;\n\n\t\ttype ResolvedEncodeContext = unknown extends TEncodeContext2 ? void : TEncodeContext2;\n\t\ttype ResolvedDecodeContext = unknown extends TDecodeContext2\n\t\t\t? ResolvedEncodeContext\n\t\t\t: TDecodeContext2;\n\n\t\ttype CodecFinal = CodecVersion<\n\t\t\tTDecoded2,\n\t\t\t// If it does not matter what context is provided, undefined is fine, so allow it to be omitted.\n\t\t\tResolvedEncodeContext,\n\t\t\tTFormatVersion2,\n\t\t\tTBuildOptions2,\n\t\t\tResolvedDecodeContext\n\t\t>;\n\n\t\tconst input = inputRegistry as readonly unknown[] as readonly CodecFinal[];\n\n\t\tconst builder = new VersionDispatchingCodecBuilder<\n\t\t\tTBuildOptions2,\n\t\t\tTDecoded2,\n\t\t\tResolvedEncodeContext,\n\t\t\tTFormatVersion2,\n\t\t\tName,\n\t\t\tResolvedDecodeContext\n\t\t>(name, input);\n\t\treturn builder;\n\t}\n}\n\n/**\n * Selects which format should be used when writing data.\n * @remarks\n * This either uses the override specified in the options, or selects the newest format compatible with the provided minVersionForCollab.\n */\nfunction getWriteVersion<T extends CodecVersionBase>(\n\tname: CodecName,\n\toptions: CodecWriteOptions,\n\tversions: readonly T[],\n): T {\n\tif (options.writeVersionOverrides?.has(name) === true) {\n\t\tconst selectedFormatVersion = options.writeVersionOverrides.get(name);\n\t\tconst selected = versions.find((codec) => codec.formatVersion === selectedFormatVersion);\n\t\tif (selected === undefined) {\n\t\t\tthrow new UsageError(\n\t\t\t\t`Codec \"${name}\" does not support requested format version ${JSON.stringify(selectedFormatVersion)}. Supported versions are: ${versionList(versions)}.`,\n\t\t\t);\n\t\t} else if (options.allowPossiblyIncompatibleWriteVersionOverrides !== true) {\n\t\t\tconst selectedMinVersionForCollab = selected.minVersionForCollab;\n\t\t\tif (selectedMinVersionForCollab === undefined) {\n\t\t\t\tthrow new UsageError(\n\t\t\t\t\t`Codec \"${name}\" does not support requested format version ${JSON.stringify(selectedFormatVersion)} because it has minVersionForCollab undefined. Use \"allowPossiblyIncompatibleWriteVersionOverrides\" to suppress this error if appropriate.`,\n\t\t\t\t);\n\t\t\t} else if (gt(selectedMinVersionForCollab, options.minVersionForCollab)) {\n\t\t\t\tthrow new UsageError(\n\t\t\t\t\t`Codec \"${name}\" does not support requested format version ${JSON.stringify(selectedFormatVersion)} because it is only compatible back to client version ${selectedMinVersionForCollab} and the requested oldest compatible client was ${options.minVersionForCollab}. Use \"allowPossiblyIncompatibleWriteVersionOverrides\" to suppress this error if appropriate.`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\treturn selected;\n\t}\n\n\treturn getWriteVersionNoOverrides(versions, options.minVersionForCollab);\n}\n\n/**\n * Selects which format should be used when writing data, without consider overrides.\n */\nfunction getWriteVersionNoOverrides<T extends CodecVersionBase>(\n\tversions: readonly T[],\n\tminVersionForCollab: OldestSupportedClientVersion,\n): T {\n\tconst stableVersions: [MinimumMinorSemanticVersion | OldestSupportedClientVersion, T][] = [];\n\tfor (const version of versions) {\n\t\tif (version.minVersionForCollab !== undefined) {\n\t\t\tstableVersions.push([version.minVersionForCollab, version]);\n\t\t}\n\t}\n\n\tconst result: T = getConfigForMinVersionForCollabIterable(\n\t\tminVersionForCollab,\n\t\tstableVersions,\n\t);\n\treturn result;\n}\n\n/**\n * Formats a list of versions for use in UsageErrors.\n */\nfunction versionList(versions: readonly CodecVersionBase[]): string {\n\treturn JSON.stringify(Array.from(versions, (codec) => codec.formatVersion));\n}\n"]}
1
+ {"version":3,"file":"codec.js","sourceRoot":"","sources":["../../../src/codec/versioned/codec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAE1E,OAAO,EACN,uCAAuC,EACvC,yBAAyB,GAGzB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAEtE,OAAO,EAAE,EAAE,EAAE,MAAM,WAAW,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AED;;GAEG;AACH,SAAS,0BAA0B,CAClC,QAAsB,EACtB,mBAAiD;IAEjD,MAAM,cAAc,GAAsE,EAAE,CAAC;IAC7F,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAChC,IAAI,OAAO,CAAC,mBAAmB,KAAK,SAAS,EAAE,CAAC;YAC/C,cAAc,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,mBAAmB,EAAE,OAAO,CAAC,CAAC,CAAC;QAC7D,CAAC;IACF,CAAC;IAED,MAAM,MAAM,GAAM,uCAAuC,CACxD,mBAAmB,EACnB,cAAc,CACd,CAAC;IACF,OAAO,MAAM,CAAC;AACf,CAAC;AAED;;GAEG;AACH,SAAS,WAAW,CAAC,QAAqC;IACzD,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;AAC7E,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, debugAssert } from \"@fluidframework/core-utils/internal\";\nimport type { OldestSupportedClientVersion } from \"@fluidframework/runtime-definitions/internal\";\nimport {\n\tgetConfigForMinVersionForCollabIterable,\n\tlowestMinVersionForCollab,\n\ttype MinimumMinorSemanticVersion,\n\ttype SemanticVersion,\n} from \"@fluidframework/runtime-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\nimport type { TSchema } from \"@sinclair/typebox\";\nimport { gt } from \"semver-ts\";\n\nimport { pkgVersion } from \"../../packageVersion.js\";\nimport {\n\tJsonCompatibleReadOnlySchema,\n\ttype JsonCompatibleReadOnly,\n\ttype JsonCompatibleReadOnlyObject,\n} from \"../../util/index.js\";\nimport {\n\ttype ICodecOptions,\n\ttype IJsonCodec,\n\twithSchemaValidation,\n\ttype FormatVersion,\n\ttype CodecWriteOptions,\n\ttype CodecName,\n\ttype CodecTree,\n} from \"../codec.js\";\n\nimport { Versioned } from \"./format.js\";\n\n/**\n * Json compatible data with a format version.\n */\ntype VersionedJson = JsonCompatibleReadOnlyObject & Versioned;\n\n/**\n * Validate that the version is one of the supported values.\n * @remarks\n * If supportedVersions contains undefined, data with no version field is also accepted despite the return type indicating otherwise.\n * This is for legacy compatibility where older data may not have a version field.\n */\nfunction makeVersionedCodec<\n\tTDecoded,\n\tTEncoded extends Versioned = VersionedJson,\n\tTValidate = TEncoded,\n\tTEncodeContext = void,\n\tTDecodeContext = TEncodeContext,\n>(\n\tsupportedVersions: Set<FormatVersion>,\n\t{ jsonValidator: validator }: ICodecOptions,\n\tinner: IJsonCodec<TDecoded, TEncoded, TValidate, TEncodeContext, TDecodeContext>,\n): IJsonCodec<TDecoded, TEncoded, TValidate, TEncodeContext, TDecodeContext> {\n\tconst codec = {\n\t\tencode: (data: TDecoded, context: TEncodeContext): TEncoded => {\n\t\t\tconst encoded = inner.encode(data, context);\n\t\t\tassert(\n\t\t\t\tsupportedVersions.has(encoded.version),\n\t\t\t\t0x88b /* version being encoded should be supported */,\n\t\t\t);\n\t\t\treturn encoded;\n\t\t},\n\t\tdecode: (data: TValidate, context: TDecodeContext): TDecoded => {\n\t\t\tconst versioned = data as Versioned; // Validated by withSchemaValidation\n\t\t\tif (!supportedVersions.has(versioned.version)) {\n\t\t\t\tthrow new UsageError(\n\t\t\t\t\t`Unsupported version ${versioned.version} encountered while decoding data. Supported versions for this data are: ${[...supportedVersions].join(\", \")}.\nThe client which encoded this data likely specified an \"minVersionForCollab\" value which corresponds to a version newer than the version of this client (\"${pkgVersion}\").`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst decoded = inner.decode(data, context);\n\t\t\treturn decoded;\n\t\t},\n\t};\n\n\t// If undefined is a supported version, skip using withSchemaValidation to enforce there is a version field.\n\t// Codec will still assert the content of the field is in supportedVersions, so it is still somewhat validated, just in a different way.\n\tif (supportedVersions.has(undefined)) {\n\t\treturn codec;\n\t}\n\n\treturn withSchemaValidation(Versioned, codec, validator);\n}\n\n/**\n * Wrap a codec with version checking and schema validation.\n * @remarks\n * The passed in codec should not perform its own schema validation.\n * The schema validation gets added here.\n */\nfunction makeVersionedValidatedCodec<\n\tEncodedSchema extends TSchema,\n\tTDecoded,\n\tTEncoded extends Versioned = VersionedJson,\n\tTValidate = TEncoded,\n\tTEncodeContext = void,\n\tTDecodeContext = TEncodeContext,\n>(\n\toptions: ICodecOptions,\n\tsupportedVersions: Set<FormatVersion>,\n\tschema: EncodedSchema,\n\tcodec: IJsonCodec<TDecoded, TEncoded, TValidate, TEncodeContext, TDecodeContext>,\n): IJsonCodec<TDecoded, TEncoded, TValidate, TEncodeContext, TDecodeContext> &\n\tPick<CodecAndSchema<TDecoded, TEncodeContext, TDecodeContext>, \"schema\"> {\n\treturn {\n\t\t...makeVersionedCodec(\n\t\t\tsupportedVersions,\n\t\t\toptions,\n\t\t\twithSchemaValidation(schema, codec, options.jsonValidator),\n\t\t),\n\t\tschema,\n\t};\n}\n\n/**\n * Creates a codec version which always throws a UsageError when encoding or decoding, indicating that the format version is discontinued.\n */\nexport function makeDiscontinuedCodecAndSchema<\n\tTDecoded,\n\tTFormatVersion extends FormatVersion = FormatVersion,\n>(\n\tdiscontinuedVersion: TFormatVersion,\n\tdiscontinuedSince: SemanticVersion,\n): CodecVersion<TDecoded, unknown, TFormatVersion, ICodecOptions, unknown> {\n\treturn {\n\t\tminVersionForCollab: undefined,\n\t\tformatVersion: discontinuedVersion,\n\t\tcodec: {\n\t\t\tschema: JsonCompatibleReadOnlySchema,\n\t\t\tencode: (_data: TDecoded) => {\n\t\t\t\tthrow new UsageError(\n\t\t\t\t\t`Cannot encode data to format ${discontinuedVersion}. The codec was discontinued in Fluid Framework client version ${discontinuedSince}.`,\n\t\t\t\t);\n\t\t\t},\n\t\t\tdecode: (data: unknown) => {\n\t\t\t\tthrow new UsageError(\n\t\t\t\t\t`Cannot decode data in format ${discontinuedVersion}. The codec was discontinued in Fluid Framework client version ${discontinuedSince}.`,\n\t\t\t\t);\n\t\t\t},\n\t\t},\n\t};\n}\n\n/**\n * A friendly format for codec authors use to define their codec and schema for use in {@link CodecVersion}.\n * @remarks\n * The codec should not perform its own schema validation.\n * The schema validation gets added when normalizing to {@link NormalizedCodecVersion}.\n */\nexport type CodecAndSchema<\n\tTDecoded,\n\tTEncodeContext = void,\n\tTDecodeContext = TEncodeContext,\n> = {\n\treadonly schema: TSchema;\n} & IJsonCodec<\n\tTDecoded,\n\tVersionedJson,\n\tJsonCompatibleReadOnly,\n\tTEncodeContext,\n\tTDecodeContext\n>;\n\n/**\n * A codec alongside its format version and schema.\n */\nexport interface CodecVersionBase<\n\tT = unknown,\n\tTFormatVersion extends FormatVersion = FormatVersion,\n> {\n\t/**\n\t * When `undefined` the codec will never be selected as a write version except via override.\n\t * @remarks\n\t * This format will be used for decode if data in it needs to be decoded, regardless of `minVersionForCollab`.\n\t * `undefined` should be used for unstable codec versions (with string FormatVersions),\n\t * as well as previously stabilized formats that are discontinued (meaning we always prefer to use some other format for encoding).\n\t */\n\treadonly minVersionForCollab: OldestSupportedClientVersion | undefined;\n\treadonly formatVersion: TFormatVersion;\n\treadonly codec: T;\n}\n\n/**\n * A particular version of a codec and when to use it.\n * @privateRemarks\n * This allows lazy building of the codec with options.\n * This option can likely be removed as the codec handling is made simpler and more consistent.\n * Removing support for this laziness would be nice to help prevent unexpected coupling and alteration to codec behavior,\n * helping ensure that tests and production code behave the same.\n */\nexport interface CodecVersion<\n\tTDecoded,\n\tTEncodeContext,\n\tTFormatVersion extends FormatVersion,\n\tTBuildOptions extends ICodecOptions = ICodecOptions,\n\tTDecodeContext = TEncodeContext,\n> extends CodecVersionBase<\n\t\t| CodecAndSchema<TDecoded, TEncodeContext, TDecodeContext>\n\t\t| ((options: TBuildOptions) => CodecAndSchema<TDecoded, TEncodeContext, TDecodeContext>),\n\t\tTFormatVersion\n\t> {}\n\n/**\n * {@link CodecVersion} after normalization into a consistent type.\n * @remarks\n * Produced by {@link normalizeCodecVersion}.\n * Includes schema validation.\n */\nexport interface NormalizedCodecVersion<\n\tTDecoded,\n\tTEncodeContext,\n\tTFormatVersion extends FormatVersion,\n\tTBuildOptions extends ICodecOptions,\n\tTDecodeContext = TEncodeContext,\n> extends CodecVersionBase<\n\t\t(options: TBuildOptions) => CodecAndSchema<TDecoded, TEncodeContext, TDecodeContext>,\n\t\tTFormatVersion\n\t> {}\n\n/**\n * {@link NormalizedCodecVersion} after applying the build options.\n * @remarks\n * Produced by {@link VersionDispatchingCodecBuilder.applyOptions}.\n */\ninterface EvaluatedCodecVersion<\n\tTDecoded,\n\tTEncodeContext,\n\tTFormatVersion extends FormatVersion,\n\tTDecodeContext = TEncodeContext,\n> extends CodecVersionBase<\n\t\tCodecAndSchema<TDecoded, TEncodeContext, TDecodeContext>,\n\t\tTFormatVersion\n\t> {}\n\n/**\n * Normalize the codec to a single format.\n * @remarks\n * Bakes in schema validation, so output no longer exposes the schema.\n */\nfunction normalizeCodecVersion<\n\tTDecoded,\n\tTEncodeContext,\n\tTFormatVersion extends FormatVersion,\n\tTBuildOptions extends ICodecOptions,\n\tTDecodeContext = TEncodeContext,\n>(\n\tcodecVersion: CodecVersion<\n\t\tTDecoded,\n\t\tTEncodeContext,\n\t\tTFormatVersion,\n\t\tTBuildOptions,\n\t\tTDecodeContext\n\t>,\n): NormalizedCodecVersion<\n\tTDecoded,\n\tTEncodeContext,\n\tTFormatVersion,\n\tTBuildOptions,\n\tTDecodeContext\n> {\n\tconst codecBuilder: (\n\t\toptions: TBuildOptions,\n\t) => CodecAndSchema<TDecoded, TEncodeContext, TDecodeContext> =\n\t\ttypeof codecVersion.codec === \"function\"\n\t\t\t? codecVersion.codec\n\t\t\t: () => codecVersion.codec as CodecAndSchema<TDecoded, TEncodeContext, TDecodeContext>;\n\tconst codec = (\n\t\toptions: TBuildOptions,\n\t): CodecAndSchema<TDecoded, TEncodeContext, TDecodeContext> => {\n\t\tconst built = codecBuilder(options);\n\t\treturn makeVersionedValidatedCodec(\n\t\t\toptions,\n\t\t\tnew Set([codecVersion.formatVersion]),\n\t\t\tbuilt.schema,\n\t\t\tbuilt,\n\t\t);\n\t};\n\n\treturn {\n\t\tminVersionForCollab: codecVersion.minVersionForCollab,\n\t\tformatVersion: codecVersion.formatVersion,\n\t\tcodec,\n\t};\n}\n\n/**\n * A codec that can read multiple format versions and write a single selected version.\n * @remarks\n * Produced by {@link VersionDispatchingCodecBuilder.build}.\n *\n * @typeParam TDecoded - The in memory (not encoded) format.\n * @typeParam TEncodeContext - Context type passed to encode operations.\n * @typeParam TFormatVersion - The type of format version identifiers used by this codec.\n * @typeParam TDecodeContext - Context type passed to decode operations. Defaults to `TEncodeContext`.\n */\nexport interface VersionDispatchingCodec<\n\tTDecoded,\n\tTEncodeContext,\n\tTFormatVersion extends FormatVersion,\n\tTDecodeContext = TEncodeContext,\n> extends IJsonCodec<\n\t\tTDecoded,\n\t\tJsonCompatibleReadOnly,\n\t\tJsonCompatibleReadOnly,\n\t\tTEncodeContext,\n\t\tTDecodeContext\n\t> {\n\t/**\n\t * The format version which this codec writes.\n\t * @remarks\n\t * Selected by {@link VersionDispatchingCodecBuilder.build} based on the provided options.\n\t */\n\treadonly writeVersion: TFormatVersion;\n}\n\n/**\n * Creates a {@link VersionDispatchingCodec} using a {@link CodecVersion} to select the {@link VersionDispatchingCodec.writeVersion}.\n * @privateRemarks\n * This is a two stage builder so the first stage (the static build) can encapsulate all codec specific details and\n * the second (the instance build) can bring in configuration.\n */\nexport class VersionDispatchingCodecBuilder<\n\tTBuildOptions extends ICodecOptions = ICodecOptions,\n\tTDecoded = unknown,\n\tTEncodeContext = unknown,\n\tTFormatVersion extends FormatVersion = FormatVersion,\n\tTName extends CodecName = string,\n\tTDecodeContext = TEncodeContext,\n> {\n\tpublic readonly registry: readonly NormalizedCodecVersion<\n\t\tTDecoded,\n\t\tTEncodeContext,\n\t\tTFormatVersion,\n\t\tTBuildOptions,\n\t\tTDecodeContext\n\t>[];\n\n\t/**\n\t * Use {@link VersionDispatchingCodecBuilder.build} to create an instance of this class.\n\t * @remarks\n\t * Inputs to this are assumed to be constants in the code controlled by the developers of this package,\n\t * and constructed at least once during tests.\n\t * Because of this, the validation of these inputs done with debugAssert should be sufficient,\n\t * and using debugAssert avoids bloating the bundle size for production users.\n\t */\n\tprivate constructor(\n\t\t/**\n\t\t * See {@link CodecName}.\n\t\t */\n\t\tpublic readonly name: TName,\n\t\t/**\n\t\t * The registry of codecs which this builder can use to encode and decode data.\n\t\t */\n\t\tinputRegistry: readonly CodecVersion<\n\t\t\tTDecoded,\n\t\t\tTEncodeContext,\n\t\t\tTFormatVersion,\n\t\t\tTBuildOptions,\n\t\t\tTDecodeContext\n\t\t>[],\n\t) {\n\t\ttype Normalized = NormalizedCodecVersion<\n\t\t\tTDecoded,\n\t\t\tTEncodeContext,\n\t\t\tTFormatVersion,\n\t\t\tTBuildOptions,\n\t\t\tTDecodeContext\n\t\t>;\n\t\tconst normalizedRegistry: Normalized[] = [];\n\t\tconst formats: Set<FormatVersion> = new Set();\n\t\tconst versions: Set<string | undefined> = new Set();\n\n\t\tfor (const codec of inputRegistry) {\n\t\t\tdebugAssert(\n\t\t\t\t() =>\n\t\t\t\t\t!formats.has(codec.formatVersion) ||\n\t\t\t\t\t`duplicate codec format ${name} ${codec.formatVersion}`,\n\t\t\t);\n\t\t\tdebugAssert(\n\t\t\t\t() =>\n\t\t\t\t\tcodec.minVersionForCollab === undefined ||\n\t\t\t\t\ttypeof codec.formatVersion !== \"string\" ||\n\t\t\t\t\t`unstable format ${JSON.stringify(codec.formatVersion)} (string formats) must not have a minVersionForCollab in ${name}`,\n\t\t\t);\n\t\t\tformats.add(codec.formatVersion);\n\t\t\tconst normalizedCodec = normalizeCodecVersion(codec);\n\t\t\tnormalizedRegistry.push(normalizedCodec);\n\t\t\tif (codec.minVersionForCollab !== undefined) {\n\t\t\t\tdebugAssert(\n\t\t\t\t\t() =>\n\t\t\t\t\t\t!versions.has(codec.minVersionForCollab) ||\n\t\t\t\t\t\t`Codec ${name} has multiple entries for version ${JSON.stringify(codec.minVersionForCollab)}`,\n\t\t\t\t);\n\t\t\t\tversions.add(codec.minVersionForCollab);\n\t\t\t}\n\t\t}\n\n\t\tdebugAssert(\n\t\t\t() =>\n\t\t\t\tversions.has(lowestMinVersionForCollab) ||\n\t\t\t\t`Codec ${name} is missing entry for lowestMinVersionForCollab`,\n\t\t);\n\n\t\tthis.registry = normalizedRegistry;\n\t}\n\n\t/**\n\t * Applies `options` to the codec registry to produce a list of evaluated codecs.\n\t * @remarks\n\t * This is used by build, which is what production code should use.\n\t * This is only exposed for testing purposes.\n\t */\n\tpublic applyOptions(\n\t\toptions: TBuildOptions,\n\t): EvaluatedCodecVersion<TDecoded, TEncodeContext, TFormatVersion, TDecodeContext>[] {\n\t\treturn this.registry.map((codec) => ({\n\t\t\tminVersionForCollab: codec.minVersionForCollab,\n\t\t\tformatVersion: codec.formatVersion,\n\t\t\tcodec: codec.codec(options),\n\t\t}));\n\t}\n\n\t/**\n\t * Builds a complete {@link VersionDispatchingCodec} that can decode all registered versions\n\t * and encode a version selected by the provided options.\n\t */\n\tpublic build(\n\t\toptions: TBuildOptions & CodecWriteOptions,\n\t): VersionDispatchingCodec<TDecoded, TEncodeContext, TFormatVersion, TDecodeContext> {\n\t\tconst [applied, decoder] = this.buildDecoderInternal(options);\n\t\tconst writeVersion = getWriteVersion(this.name, options, applied);\n\t\treturn {\n\t\t\t...decoder,\n\t\t\tencode: (data: TDecoded, context: TEncodeContext): JsonCompatibleReadOnly => {\n\t\t\t\treturn writeVersion.codec.encode(data, context);\n\t\t\t},\n\t\t\twriteVersion: writeVersion.formatVersion,\n\t\t};\n\t}\n\n\tprivate buildDecoderInternal(\n\t\toptions: TBuildOptions,\n\t): [\n\t\tEvaluatedCodecVersion<TDecoded, TEncodeContext, TFormatVersion, TDecodeContext>[],\n\t\tPick<\n\t\t\tIJsonCodec<\n\t\t\t\tTDecoded,\n\t\t\t\tJsonCompatibleReadOnly,\n\t\t\t\tJsonCompatibleReadOnly,\n\t\t\t\tTEncodeContext,\n\t\t\t\tTDecodeContext\n\t\t\t>,\n\t\t\t\"decode\"\n\t\t>,\n\t] {\n\t\tconst applied = this.applyOptions(options);\n\t\tconst fromFormatVersion = new Map<\n\t\t\tFormatVersion,\n\t\t\tEvaluatedCodecVersion<TDecoded, TEncodeContext, TFormatVersion, TDecodeContext>\n\t\t>(applied.map((codec) => [codec.formatVersion, codec]));\n\t\treturn [\n\t\t\tapplied,\n\t\t\t{\n\t\t\t\tdecode: (data: JsonCompatibleReadOnly, context: TDecodeContext): TDecoded => {\n\t\t\t\t\tconst versioned = data as Partial<Versioned>;\n\t\t\t\t\tconst codec = fromFormatVersion.get(versioned.version);\n\t\t\t\t\tif (codec === undefined) {\n\t\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t\t`Unsupported version ${versioned.version} encountered while decoding ${this.name} data. Supported versions for this data are: ${versionList(applied)}.\nThe client which encoded this data likely specified an \"minVersionForCollab\" value which corresponds to a version newer than the version of this client (\"${pkgVersion}\").`,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\treturn codec.codec.decode(data, context);\n\t\t\t\t},\n\t\t\t},\n\t\t];\n\t}\n\n\t/**\n\t * Builds a decoder-only codec that can decode any supported format without encoding capability.\n\t *\n\t * @remarks\n\t * The returned codec contains only the `decode` method and can be used when only decoding is needed.\n\t * This is useful for scenarios where reading/decoding versioned data is sufficient.\n\t *\n\t * @param options - Build options (typically containing the `jsonValidator`)\n\t * @returns An object with a `decode` method that can handle any supported format version\n\t */\n\tpublic buildDecoder(\n\t\toptions: TBuildOptions,\n\t): Pick<\n\t\tVersionDispatchingCodec<TDecoded, TEncodeContext, TFormatVersion, TDecodeContext>,\n\t\t\"decode\"\n\t> {\n\t\treturn this.buildDecoderInternal(options)[1];\n\t}\n\n\tpublic getCodecTree(clientVersion: OldestSupportedClientVersion): CodecTree<TFormatVersion> {\n\t\t// TODO: add support for children codecs.\n\t\tconst selected = getWriteVersionNoOverrides(this.registry, clientVersion);\n\t\treturn {\n\t\t\tname: this.name,\n\t\t\tversion: selected.formatVersion,\n\t\t};\n\t}\n\n\t/**\n\t * Creates a new VersionDispatchingCodecBuilder from the provided codec registry.\n\t *\n\t * @remarks\n\t * This static method infers the types of the builder from the provided registry,\n\t * making it easier to create builders without needing to explicitly specify all type parameters.\n\t * This gets better type inference than the constructor.\n\t *\n\t * @example\n\t * ```typescript\n\t * const builder = VersionDispatchingCodecBuilder.build('myCodec', [\n\t * { minVersionForCollab: lowestMinVersionForCollab, formatVersion: 1, codec: { encode, decode, schema } },\n\t * { minVersionForCollab: '2.100.0', formatVersion: 2, codec: { encode, decode, schema } },\n\t * ]);\n\t * ```\n\t */\n\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n\tpublic static build<\n\t\tName extends CodecName,\n\t\tEntry extends CodecVersion<unknown, unknown, FormatVersion, never, unknown>,\n\t>(name: Name, inputRegistry: readonly Entry[]) {\n\t\ttype TDecoded2 =\n\t\t\tEntry extends CodecVersion<infer D, unknown, FormatVersion, never, unknown> ? D : never;\n\t\ttype TEncodeContext2 =\n\t\t\tEntry extends CodecVersion<unknown, infer C, FormatVersion, never, unknown> ? C : never;\n\t\ttype TFormatVersion2 =\n\t\t\tEntry extends CodecVersion<unknown, unknown, infer F, never, unknown> ? F : never;\n\t\ttype TBuildOptions2 =\n\t\t\tEntry extends CodecVersion<unknown, unknown, FormatVersion, infer B, unknown>\n\t\t\t\t? B\n\t\t\t\t: never;\n\t\ttype TDecodeContext2 =\n\t\t\tEntry extends CodecVersion<unknown, unknown, FormatVersion, never, infer D> ? D : never;\n\n\t\ttype ResolvedEncodeContext = unknown extends TEncodeContext2 ? void : TEncodeContext2;\n\t\ttype ResolvedDecodeContext = unknown extends TDecodeContext2\n\t\t\t? ResolvedEncodeContext\n\t\t\t: TDecodeContext2;\n\n\t\ttype CodecFinal = CodecVersion<\n\t\t\tTDecoded2,\n\t\t\t// If it does not matter what context is provided, undefined is fine, so allow it to be omitted.\n\t\t\tResolvedEncodeContext,\n\t\t\tTFormatVersion2,\n\t\t\tTBuildOptions2,\n\t\t\tResolvedDecodeContext\n\t\t>;\n\n\t\tconst input = inputRegistry as readonly unknown[] as readonly CodecFinal[];\n\n\t\tconst builder = new VersionDispatchingCodecBuilder<\n\t\t\tTBuildOptions2,\n\t\t\tTDecoded2,\n\t\t\tResolvedEncodeContext,\n\t\t\tTFormatVersion2,\n\t\t\tName,\n\t\t\tResolvedDecodeContext\n\t\t>(name, input);\n\t\treturn builder;\n\t}\n}\n\n/**\n * Selects which format should be used when writing data.\n * @remarks\n * This either uses the override specified in the options, or selects the newest format compatible with the provided minVersionForCollab.\n */\nfunction getWriteVersion<T extends CodecVersionBase>(\n\tname: CodecName,\n\toptions: CodecWriteOptions,\n\tversions: readonly T[],\n): T {\n\tif (options.writeVersionOverrides?.has(name) === true) {\n\t\tconst selectedFormatVersion = options.writeVersionOverrides.get(name);\n\t\tconst selected = versions.find((codec) => codec.formatVersion === selectedFormatVersion);\n\t\tif (selected === undefined) {\n\t\t\tthrow new UsageError(\n\t\t\t\t`Codec \"${name}\" does not support requested format version ${JSON.stringify(selectedFormatVersion)}. Supported versions are: ${versionList(versions)}.`,\n\t\t\t);\n\t\t} else if (options.allowPossiblyIncompatibleWriteVersionOverrides !== true) {\n\t\t\tconst selectedMinVersionForCollab = selected.minVersionForCollab;\n\t\t\tif (selectedMinVersionForCollab === undefined) {\n\t\t\t\tthrow new UsageError(\n\t\t\t\t\t`Codec \"${name}\" does not support requested format version ${JSON.stringify(selectedFormatVersion)} because it has minVersionForCollab undefined. Use \"allowPossiblyIncompatibleWriteVersionOverrides\" to suppress this error if appropriate.`,\n\t\t\t\t);\n\t\t\t} else if (gt(selectedMinVersionForCollab, options.minVersionForCollab)) {\n\t\t\t\tthrow new UsageError(\n\t\t\t\t\t`Codec \"${name}\" does not support requested format version ${JSON.stringify(selectedFormatVersion)} because it is only compatible back to client version ${selectedMinVersionForCollab} and the requested oldest compatible client was ${options.minVersionForCollab}. Use \"allowPossiblyIncompatibleWriteVersionOverrides\" to suppress this error if appropriate.`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\treturn selected;\n\t}\n\n\treturn getWriteVersionNoOverrides(versions, options.minVersionForCollab);\n}\n\n/**\n * Selects which format should be used when writing data, without consider overrides.\n */\nfunction getWriteVersionNoOverrides<T extends CodecVersionBase>(\n\tversions: readonly T[],\n\tminVersionForCollab: OldestSupportedClientVersion,\n): T {\n\tconst stableVersions: [MinimumMinorSemanticVersion | OldestSupportedClientVersion, T][] = [];\n\tfor (const version of versions) {\n\t\tif (version.minVersionForCollab !== undefined) {\n\t\t\tstableVersions.push([version.minVersionForCollab, version]);\n\t\t}\n\t}\n\n\tconst result: T = getConfigForMinVersionForCollabIterable(\n\t\tminVersionForCollab,\n\t\tstableVersions,\n\t);\n\treturn result;\n}\n\n/**\n * Formats a list of versions for use in UsageErrors.\n */\nfunction versionList(versions: readonly CodecVersionBase[]): string {\n\treturn JSON.stringify(Array.from(versions, (codec) => codec.formatVersion));\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"componentApi.d.ts","sourceRoot":"","sources":["../src/componentApi.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,yBAAiB,SAAS,CAAC;IAC1B;;;;;;;;;;;;;;;;;;OAkBG;IACH,KAAY,OAAO,CAAC,UAAU,EAAE,OAAO,GAAG,eAAe,CAAC,UAAU,CAAC,IAAI,CACxE,iBAAiB,EAAE,MAAM,OAAO,KAC5B,UAAU,CAAC;IAEhB;;;;;;;;;;OAUG;IACH,KAAY,SAAS,CAAC,CAAC,IAAI,MAAM,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC;IAEtD;;;;;;;;;;;;;OAaG;IACI,MAAM,OAAO,eAAgB,MAAM,CAAC,KAAG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AAQ,CAAC,SAClD,SAAS,CAAC,OAAO,CAAC,GAClB,SAAS,GACT,QAAQ,GACR,KAAK,GAAG,OAAO;SAClB,EAED,QAAQ,EAAE,IAAI,GACZ,SAAS,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC,SAAS,SAAS,CAAC,MAAM,CAAC,CAAC,GACzE,MAAM,CAAC,GACP,KAAK,CAAC,EAAE,CAAC;KACZ;CACD"}
@@ -68,24 +68,27 @@ export var Component;
68
68
  * Implementation of {@link Component.Composed}.
69
69
  */
70
70
  class Config {
71
+ componentsMap;
72
+ /**
73
+ * Cache of results produced by {@link Component.Composed.getConfigured}.
74
+ *
75
+ * @remarks
76
+ * Maps each {@link Component.Configurable} to the result of evaluating it against this composition.
77
+ * This ensures a given `Configurable` is only configured once: subsequent lookups return the cached result.
78
+ */
79
+ evaluatedMap = new Map();
80
+ /**
81
+ * Cache of results produced by {@link Component.Composed.getComposed}.
82
+ *
83
+ * @remarks
84
+ * Maps each composed property to the array produced for it.
85
+ * This ensures a given property is only composed once: subsequent lookups return the same array
86
+ * (including the same lazy values), so repeated calls with the same property are reference-stable.
87
+ */
88
+ composedMap = new Map();
89
+ components;
90
+ config;
71
91
  constructor(allComponents, lazyConfiguration) {
72
- /**
73
- * Cache of results produced by {@link Component.Composed.getConfigured}.
74
- *
75
- * @remarks
76
- * Maps each {@link Component.Configurable} to the result of evaluating it against this composition.
77
- * This ensures a given `Configurable` is only configured once: subsequent lookups return the cached result.
78
- */
79
- this.evaluatedMap = new Map();
80
- /**
81
- * Cache of results produced by {@link Component.Composed.getComposed}.
82
- *
83
- * @remarks
84
- * Maps each composed property to the array produced for it.
85
- * This ensures a given property is only composed once: subsequent lookups return the same array
86
- * (including the same lazy values), so repeated calls with the same property are reference-stable.
87
- */
88
- this.composedMap = new Map();
89
92
  // 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`.
90
93
  let config = undefined;
91
94
  const lazyConfigInner = () => {
@@ -1 +1 @@
1
- {"version":3,"file":"componentApi.js","sourceRoot":"","sources":["../src/componentApi.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAEtE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,KAAW,SAAS,CAuTzB;AAvTD,WAAiB,SAAS;IAqCzB;;;;;;;;;;;;;OAaG;IACU,iBAAO,GAAG,CAAI,OAAgB,EAAa,EAAE;QACzD,IAAI,GAAG,GAAG,KAAK,CAAC;QAChB,IAAI,MAAS,CAAC;QACd,OAAO,GAAG,EAAE;YACX,IAAI,CAAC,GAAG,EAAE,CAAC;gBACV,MAAM,GAAG,OAAO,EAAE,CAAC;gBACnB,GAAG,GAAG,IAAI,CAAC;YACZ,CAAC;YACD,OAAO,MAAM,CAAC;QACf,CAAC,CAAC;IACH,CAAC,CAAC;IA2BF;;OAEG;IACH,MAAM,MAAM;QA2BX,YACC,aAAsD,EACtD,iBAAuE;YA1BxE;;;;;;eAMG;YACc,iBAAY,GAC5B,IAAI,GAAG,EAAE,CAAC;YAEX;;;;;;;eAOG;YACc,gBAAW,GAA8C,IAAI,GAAG,EAAE,CAAC;YAUnF,qLAAqL;YACrL,IAAI,MAAM,GAAwB,SAAS,CAAC;YAC5C,MAAM,eAAe,GAAG,GAAY,EAAE;gBACrC,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;oBAC1B,MAAM,IAAI,UAAU,CACnB,0GAA0G,CAC1G,CAAC;gBACH,CAAC;gBACD,OAAO,MAAM,CAAC;YACf,CAAC,CAAC;YACF,IAAI,CAAC,aAAa,GAAG,IAAI,GAAG,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,eAAe,CAAC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AC,CAAC,CACF,CAAC;YACF,OAAO,MAEI,CAAC;QACb,CAAC;KACD;IAsCD,SAAgB,OAAO,CACtB,aAAsD,EACtD,oBAA0E,CAAC,QAAQ,EAAE,EAAE,CACtF,QAA8B;QAE/B,OAAO,IAAI,MAAM,CAAsB,aAAa,EAAE,iBAAiB,CAAC,CAAC;IAC1E,CAAC;IANe,iBAAO,UAMtB,CAAA;AAgFF,CAAC,EAvTgB,SAAS,KAAT,SAAS,QAuTzB","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { getOrCreate } from \"./util/index.js\";\n\n/**\n * Utilities for composing application \"components\" which contribute to a shared configuration.\n *\n * @remarks\n * Nothing in this namespace is specific to tree schema,\n * however it is designed to be able to handle the needs of components which work with {@link TreeSchema}.\n *\n * This is mainly used to implement \"open polymorphism\", where the set of allowed types\n * for a field or collection can be extended by independently authored libraries (components) instead of being\n * fixed up front.\n *\n * This basically amounts to dependency injection, where the \"injection\" is done at \"composition\" time to build the schema.\n *\n * Tree's schema do not natively support open polymorphism: all possible implementations must be explicitly listed.\n * These tools work around these limitations by carefully controlling evaluation order:\n * the source code can be structured in an open polymorphism style which at runtime evaluates into closed polymorphism\n * by having each component register its implementations into a central collection (typically an\n * {@link AllowedTypes} array).\n *\n * Each component is expressed as a {@link Component.Factory}: a function which receives a lazy reference to the\n * composed configuration and returns the content that component contributes.\n * Because the configuration is provided lazily, components may reference (including recursively) types contributed by\n * other components, as long as nothing evaluates the lazy references until composition has completed.\n * Use {@link Component.(compose:1)} to combine a set of components into a {@link Component.Composed}.\n *\n * 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.\n *\n * @privateRemarks\n * The examples and integration tests for this pattern live in `openPolymorphism.integration.ts`.\n * Those tests and the docs here should be kept in sync.\n *\n * @alpha\n */\nexport namespace Component {\n\t/**\n\t * A function which takes in a lazy configuration and returns the content a component contributes.\n\t *\n\t * @remarks\n\t * The lazy configuration allows the component to reference items from the composed configuration, which can\n\t * include items the component itself contributes (allowing recursive references between components).\n\t *\n\t * The execution of the factory must not evaluate `lazyConfiguration` (doing so will error):\n\t * instead the returned `TComponent` can capture `lazyConfiguration` and evaluate it at a later time\n\t * (after all components have been composed).\n\t *\n\t * @typeParam TComponent - The content a component contributes.\n\t * @typeParam TConfig - The composed configuration type made available to components.\n\t * Defaults to the {@link Component.Composed} produced by composition: the common case where\n\t * components read composed content directly from the composition and no custom configuration type is needed.\n\t *\n\t * @input\n\t * @alpha\n\t */\n\texport type Factory<TComponent, TConfig = ComposedDefault<TComponent>> = (\n\t\tlazyConfiguration: () => TConfig,\n\t) => TComponent;\n\n\t/**\n\t * A function which returns an array of lazy values which each evaluate to `T`.\n\t *\n\t * @remarks\n\t * This mirrors the shape of {@link AllowedTypes} where all of the values are lazy:\n\t * the outer function and inner functions defer evaluation until after composition is complete.\n\t *\n\t * @typeParam T - The type each lazy value evaluates to.\n\t *\n\t * @alpha\n\t */\n\texport type LazyArray<T> = () => readonly (() => T)[];\n\n\t/**\n\t * Wrap a 0 argument function to cache the result.\n\t * @remarks\n\t * Do not use for impure functions.\n\t *\n\t * Generally {@link Component} utilities have built in caching in most cases,\n\t * but this is occasionally helpful when manually implementing laziness.\n\t *\n\t * Note that this takes a different approach than use in {@link evaluateLazySchema} where the function evaluation is done using a utility that adds caching.\n\t *\n\t * @param factory - The factory function to memoize.\n\t * @returns A function that returns the cached result of the factory.\n\t * @alpha\n\t */\n\texport const memoize = <T>(factory: () => T): (() => T) => {\n\t\tlet run = false;\n\t\tlet cached: T;\n\t\treturn () => {\n\t\t\tif (!run) {\n\t\t\t\tcached = factory();\n\t\t\t\trun = true;\n\t\t\t}\n\t\t\treturn cached;\n\t\t};\n\t};\n\n\t/**\n\t * An item which can be configured (evaluated) against a composed configuration to produce a result.\n\t *\n\t * @remarks\n\t * Use {@link Component.Composed.getConfigured} to evaluate a `Configurable`.\n\t * The result is cached, so a given `Configurable` is only evaluated once per composition.\n\t *\n\t * @typeParam TConfigPartial - The configuration type made available when configuring.\n\t * @typeParam TResult - The result produced by configuring.\n\t * @typeParam TComponent - The content components contribute.\n\t *\n\t * @alpha\n\t */\n\texport interface Configurable<TConfigPartial, out TResult, TComponent> {\n\t\t/**\n\t\t * Produce the configured result.\n\t\t * @param config - The composed configuration.\n\t\t * @param components - The composed components.\n\t\t */\n\t\tconfigure(\n\t\t\tconfig: TConfigPartial,\n\t\t\tcomponents: Composed<TComponent, TConfigPartial>,\n\t\t): TResult;\n\t}\n\n\t/**\n\t * Implementation of {@link Component.Composed}.\n\t */\n\tclass Config<TConfig, TComponent> implements Composed<TComponent, TConfig> {\n\t\tpublic readonly componentsMap: ReadonlyMap<Factory<TComponent, TConfig>, TComponent>;\n\n\t\t/**\n\t\t * Cache of results produced by {@link Component.Composed.getConfigured}.\n\t\t *\n\t\t * @remarks\n\t\t * Maps each {@link Component.Configurable} to the result of evaluating it against this composition.\n\t\t * This ensures a given `Configurable` is only configured once: subsequent lookups return the cached result.\n\t\t */\n\t\tprivate readonly evaluatedMap: Map<Configurable<TConfig, unknown, TComponent>, unknown> =\n\t\t\tnew Map();\n\n\t\t/**\n\t\t * Cache of results produced by {@link Component.Composed.getComposed}.\n\t\t *\n\t\t * @remarks\n\t\t * Maps each composed property to the array produced for it.\n\t\t * This ensures a given property is only composed once: subsequent lookups return the same array\n\t\t * (including the same lazy values), so repeated calls with the same property are reference-stable.\n\t\t */\n\t\tprivate readonly composedMap: Map<keyof TComponent, readonly unknown[]> = new Map();\n\n\t\tpublic readonly components: readonly TComponent[];\n\n\t\tpublic readonly config: TConfig;\n\n\t\tpublic constructor(\n\t\t\tallComponents: readonly Factory<TComponent, TConfig>[],\n\t\t\tlazyConfiguration: (composed: Composed<TComponent, TConfig>) => TConfig,\n\t\t) {\n\t\t\t// 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`.\n\t\t\tlet config: TConfig | undefined = undefined;\n\t\t\tconst lazyConfigInner = (): TConfig => {\n\t\t\t\tif (config === undefined) {\n\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t\"Configuration not yet available: components must not evaluate the lazy configuration during composition.\",\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn config;\n\t\t\t};\n\t\t\tthis.componentsMap = new Map(allComponents.map((c) => [c, c(lazyConfigInner)]));\n\t\t\tthis.components = [...this.componentsMap.values()];\n\t\t\tconfig = lazyConfiguration(this);\n\t\t\tthis.config = config;\n\t\t}\n\n\t\tpublic getComponent<TFactory extends Factory<TComponent, TConfig>>(\n\t\t\tfactory: TFactory,\n\t\t): ReturnType<TFactory> {\n\t\t\tconst found = this.componentsMap.get(factory);\n\t\t\tif (found === undefined) {\n\t\t\t\tthrow new UsageError(\"Requested component not included in this configuration\");\n\t\t\t}\n\t\t\treturn found as ReturnType<TFactory>;\n\t\t}\n\n\t\tpublic getConfigured<TConfigurable extends Configurable<TConfig, unknown, TComponent>>(\n\t\t\tconfigurable: TConfigurable,\n\t\t): ReturnType<TConfigurable[\"configure\"]> {\n\t\t\tconst configured: unknown = getOrCreate(this.evaluatedMap, configurable, (c) => {\n\t\t\t\tconst result = c.configure(this.config, this);\n\t\t\t\tif (result === undefined) {\n\t\t\t\t\tthrow new UsageError(\"Configurable must not return undefined\");\n\t\t\t\t}\n\t\t\t\treturn result;\n\t\t\t});\n\t\t\treturn configured as ReturnType<TConfigurable[\"configure\"]>;\n\t\t}\n\n\t\tpublic getComposed<\n\t\t\tTKey extends keyof {\n\t\t\t\t[Property in keyof TComponent as TComponent[Property] extends\n\t\t\t\t\t| LazyArray<unknown>\n\t\t\t\t\t| undefined\n\t\t\t\t\t? Property\n\t\t\t\t\t: never]: boolean;\n\t\t\t},\n\t\t>(\n\t\t\tproperty: TKey,\n\t\t): readonly (Exclude<TComponent[TKey], undefined> extends LazyArray<infer U>\n\t\t\t? () => U\n\t\t\t: never)[] {\n\t\t\tconst result = getOrCreate(this.composedMap, property, () =>\n\t\t\t\tthis.components.flatMap((c) => {\n\t\t\t\t\tconst prop = c[property] as LazyArray<unknown> | undefined;\n\t\t\t\t\tif (prop === undefined) {\n\t\t\t\t\t\treturn [];\n\t\t\t\t\t}\n\t\t\t\t\treturn prop();\n\t\t\t\t}),\n\t\t\t);\n\t\t\treturn result as (Exclude<TComponent[TKey], undefined> extends LazyArray<infer U>\n\t\t\t\t? () => U\n\t\t\t\t: never)[];\n\t\t}\n\t}\n\n\t/**\n\t * Combine multiple {@link Component.Factory|components} into a single {@link Component.Composed}.\n\t *\n\t * @remarks\n\t * The {@link Component.Composed} itself is used as the configuration made available to components:\n\t * the simple case where components read composed content directly from the composition.\n\t * To produce a custom aggregated configuration, use the overload which takes a `lazyConfiguration` builder.\n\t *\n\t * @param allComponents - The components to compose.\n\t * @returns The composed components, from which configuration and per-component content can be read.\n\t *\n\t * @typeParam TComponent - The content each component contributes.\n\t *\n\t * @alpha\n\t */\n\texport function compose<TComponent>(\n\t\tallComponents: readonly Factory<TComponent>[],\n\t): Composed<TComponent>;\n\t/**\n\t * Combine multiple {@link Component.Factory|components} into a single {@link Component.Composed}.\n\t *\n\t * @param allComponents - The components to compose.\n\t * @param lazyConfiguration - Builds the composed configuration from the composed components.\n\t * This is invoked once, after all components have been created, and can aggregate content contributed by the\n\t * components (for example via {@link Component.Composed.getComposed}).\n\t * @returns The composed components, from which configuration and per-component content can be read.\n\t *\n\t * @typeParam TComponent - The content each component contributes.\n\t * @typeParam TConfig - The composed configuration type made available to components.\n\t *\n\t * @alpha\n\t */\n\texport function compose<TComponent, TConfig>(\n\t\tallComponents: readonly Factory<TComponent, TConfig>[],\n\t\tlazyConfiguration: (composed: Composed<TComponent, TConfig>) => TConfig,\n\t): Composed<TComponent, TConfig>;\n\texport function compose<TComponent, TConfig>(\n\t\tallComponents: readonly Factory<TComponent, TConfig>[],\n\t\tlazyConfiguration: (composed: Composed<TComponent, TConfig>) => TConfig = (composed) =>\n\t\t\tcomposed as unknown as TConfig,\n\t): Composed<TComponent, TConfig> {\n\t\treturn new Config<TConfig, TComponent>(allComponents, lazyConfiguration);\n\t}\n\n\t/**\n\t * The default configuration type for a composition.\n\t * Also the type of Composed when using the default composition.\n\t * @privateRemarks\n\t * Declaring this as its own type makes the recursion possible instead of having to list the config parameter as unknown.\n\t * This makes it easier to understand what is going on when seeing this type in the intellisense.\n\t * @sealed @alpha\n\t */\n\texport type ComposedDefault<TComponent> = Composed<TComponent, ComposedDefault<TComponent>>;\n\n\t/**\n\t * The result of composing multiple components.\n\t *\n\t * @remarks\n\t * Create using {@link Component.(compose:1)}.\n\t *\n\t * @typeParam TComponent - The content each component contributes.\n\t * @typeParam TConfig - The composed configuration type made available to components.\n\t * Defaults to the composition itself: the common case where no custom configuration type is needed.\n\t *\n\t * @sealed @alpha\n\t */\n\texport interface Composed<TComponent, TConfig = ComposedDefault<TComponent>> {\n\t\t/**\n\t\t * The components which were composed.\n\t\t */\n\t\treadonly components: readonly TComponent[];\n\n\t\t/**\n\t\t * The configuration which was produced when composing.\n\t\t */\n\t\treadonly config: TConfig;\n\n\t\t/**\n\t\t * Get a component by its factory.\n\t\t *\n\t\t * @param factory - The factory used to look up the component. Must have been provided when composing.\n\t\t * @returns The content created by the provided factory.\n\t\t * This result is cached during composition and not reevaluated.\n\t\t */\n\t\tgetComponent<TFactory extends Factory<TComponent, TConfig>>(\n\t\t\tfactory: TFactory,\n\t\t): ReturnType<TFactory>;\n\n\t\t/**\n\t\t * Configure a {@link Component.Configurable}.\n\t\t * @remarks\n\t\t * The result is cached when first evaluated, so subsequent calls with the same `configurable` return the\n\t\t * same result.\n\t\t * @param configurable - The item to configure against this composition.\n\t\t */\n\t\tgetConfigured<TConfigurable extends Configurable<TConfig, unknown, TComponent>>(\n\t\t\tconfigurable: TConfigurable,\n\t\t): ReturnType<TConfigurable[\"configure\"]>;\n\n\t\t/**\n\t\t * Compose the contents of a {@link Component.LazyArray} property from all components.\n\t\t * @remarks\n\t\t * The result is cached when first evaluated, so subsequent calls with the same `property` return the\n\t\t * same result.\n\t\t * @param property - The property of the components to compose.\n\t\t * @returns The concatenation of the lazy values contributed by each component for `property`.\n\t\t * Components which omit the property contribute nothing.\n\t\t */\n\t\tgetComposed<\n\t\t\tTKey extends keyof {\n\t\t\t\t[Property in keyof TComponent as TComponent[Property] extends\n\t\t\t\t\t| LazyArray<unknown>\n\t\t\t\t\t| undefined\n\t\t\t\t\t? Property\n\t\t\t\t\t: never]: boolean;\n\t\t\t},\n\t\t>(\n\t\t\tproperty: TKey,\n\t\t): readonly (Exclude<TComponent[TKey], undefined> extends LazyArray<infer U>\n\t\t\t? () => U\n\t\t\t: never)[];\n\t}\n}\n"]}
1
+ {"version":3,"file":"componentApi.js","sourceRoot":"","sources":["../src/componentApi.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAEtE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,KAAW,SAAS,CAuTzB;AAvTD,WAAiB,SAAS;IAqCzB;;;;;;;;;;;;;OAaG;IACU,iBAAO,GAAG,CAAI,OAAgB,EAAa,EAAE;QACzD,IAAI,GAAG,GAAG,KAAK,CAAC;QAChB,IAAI,MAAS,CAAC;QACd,OAAO,GAAG,EAAE;YACX,IAAI,CAAC,GAAG,EAAE,CAAC;gBACV,MAAM,GAAG,OAAO,EAAE,CAAC;gBACnB,GAAG,GAAG,IAAI,CAAC;YACZ,CAAC;YACD,OAAO,MAAM,CAAC;QACf,CAAC,CAAC;IACH,CAAC,CAAC;IA2BF;;OAEG;IACH,MAAM,MAAM;QACK,aAAa,CAAwD;QAErF;;;;;;WAMG;QACc,YAAY,GAC5B,IAAI,G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AAM,KAAK,SAAS,EAAE,CAAC;oBAC1B,MAAM,IAAI,UAAU,CAAC,wCAAwC,CAAC,CAAC;gBAChE,CAAC;gBACD,OAAO,MAAM,CAAC;YACf,CAAC,CAAC,CAAC;YACH,OAAO,UAAoD,CAAC;QAC7D,CAAC;QAEM,WAAW,CASjB,QAAc;YAId,MAAM,MAAM,GAAG,WAAW,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,EAAE,GAAG,EAAE,CAC3D,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;gBAC7B,MAAM,IAAI,GAAG,CAAC,CAAC,QAAQ,CAAmC,CAAC;gBAC3D,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;oBACxB,OAAO,EAAE,CAAC;gBACX,CAAC;gBACD,OAAO,IAAI,EAAE,CAAC;YACf,CAAC,CAAC,CACF,CAAC;YACF,OAAO,MAEI,CAAC;QACb,CAAC;KACD;IAsCD,SAAgB,OAAO,CACtB,aAAsD,EACtD,oBAA0E,CAAC,QAAQ,EAAE,EAAE,CACtF,QAA8B;QAE/B,OAAO,IAAI,MAAM,CAAsB,aAAa,EAAE,iBAAiB,CAAC,CAAC;IAC1E,CAAC;IANe,iBAAO,UAMtB,CAAA;AAgFF,CAAC,EAvTgB,SAAS,KAAT,SAAS,QAuTzB","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { getOrCreate } from \"./util/index.js\";\n\n/**\n * Utilities for composing application \"components\" which contribute to a shared configuration.\n *\n * @remarks\n * Nothing in this namespace is specific to tree schema,\n * however it is designed to be able to handle the needs of components which work with {@link TreeSchema}.\n *\n * This is mainly used to implement \"open polymorphism\", where the set of allowed types\n * for a field or collection can be extended by independently authored libraries (components) instead of being\n * fixed up front.\n *\n * This basically amounts to dependency injection, where the \"injection\" is done at \"composition\" time to build the schema.\n *\n * Tree's schema do not natively support open polymorphism: all possible implementations must be explicitly listed.\n * These tools work around these limitations by carefully controlling evaluation order:\n * the source code can be structured in an open polymorphism style which at runtime evaluates into closed polymorphism\n * by having each component register its implementations into a central collection (typically an\n * {@link AllowedTypes} array).\n *\n * Each component is expressed as a {@link Component.Factory}: a function which receives a lazy reference to the\n * composed configuration and returns the content that component contributes.\n * Because the configuration is provided lazily, components may reference (including recursively) types contributed by\n * other components, as long as nothing evaluates the lazy references until composition has completed.\n * Use {@link Component.(compose:1)} to combine a set of components into a {@link Component.Composed}.\n *\n * 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.\n *\n * @privateRemarks\n * The examples and integration tests for this pattern live in `openPolymorphism.integration.ts`.\n * Those tests and the docs here should be kept in sync.\n *\n * @alpha\n */\nexport namespace Component {\n\t/**\n\t * A function which takes in a lazy configuration and returns the content a component contributes.\n\t *\n\t * @remarks\n\t * The lazy configuration allows the component to reference items from the composed configuration, which can\n\t * include items the component itself contributes (allowing recursive references between components).\n\t *\n\t * The execution of the factory must not evaluate `lazyConfiguration` (doing so will error):\n\t * instead the returned `TComponent` can capture `lazyConfiguration` and evaluate it at a later time\n\t * (after all components have been composed).\n\t *\n\t * @typeParam TComponent - The content a component contributes.\n\t * @typeParam TConfig - The composed configuration type made available to components.\n\t * Defaults to the {@link Component.Composed} produced by composition: the common case where\n\t * components read composed content directly from the composition and no custom configuration type is needed.\n\t *\n\t * @input\n\t * @alpha\n\t */\n\texport type Factory<TComponent, TConfig = ComposedDefault<TComponent>> = (\n\t\tlazyConfiguration: () => TConfig,\n\t) => TComponent;\n\n\t/**\n\t * A function which returns an array of lazy values which each evaluate to `T`.\n\t *\n\t * @remarks\n\t * This mirrors the shape of {@link AllowedTypes} where all of the values are lazy:\n\t * the outer function and inner functions defer evaluation until after composition is complete.\n\t *\n\t * @typeParam T - The type each lazy value evaluates to.\n\t *\n\t * @alpha\n\t */\n\texport type LazyArray<T> = () => readonly (() => T)[];\n\n\t/**\n\t * Wrap a 0 argument function to cache the result.\n\t * @remarks\n\t * Do not use for impure functions.\n\t *\n\t * Generally {@link Component} utilities have built in caching in most cases,\n\t * but this is occasionally helpful when manually implementing laziness.\n\t *\n\t * Note that this takes a different approach than use in {@link evaluateLazySchema} where the function evaluation is done using a utility that adds caching.\n\t *\n\t * @param factory - The factory function to memoize.\n\t * @returns A function that returns the cached result of the factory.\n\t * @alpha\n\t */\n\texport const memoize = <T>(factory: () => T): (() => T) => {\n\t\tlet run = false;\n\t\tlet cached: T;\n\t\treturn () => {\n\t\t\tif (!run) {\n\t\t\t\tcached = factory();\n\t\t\t\trun = true;\n\t\t\t}\n\t\t\treturn cached;\n\t\t};\n\t};\n\n\t/**\n\t * An item which can be configured (evaluated) against a composed configuration to produce a result.\n\t *\n\t * @remarks\n\t * Use {@link Component.Composed.getConfigured} to evaluate a `Configurable`.\n\t * The result is cached, so a given `Configurable` is only evaluated once per composition.\n\t *\n\t * @typeParam TConfigPartial - The configuration type made available when configuring.\n\t * @typeParam TResult - The result produced by configuring.\n\t * @typeParam TComponent - The content components contribute.\n\t *\n\t * @alpha\n\t */\n\texport interface Configurable<TConfigPartial, out TResult, TComponent> {\n\t\t/**\n\t\t * Produce the configured result.\n\t\t * @param config - The composed configuration.\n\t\t * @param components - The composed components.\n\t\t */\n\t\tconfigure(\n\t\t\tconfig: TConfigPartial,\n\t\t\tcomponents: Composed<TComponent, TConfigPartial>,\n\t\t): TResult;\n\t}\n\n\t/**\n\t * Implementation of {@link Component.Composed}.\n\t */\n\tclass Config<TConfig, TComponent> implements Composed<TComponent, TConfig> {\n\t\tpublic readonly componentsMap: ReadonlyMap<Factory<TComponent, TConfig>, TComponent>;\n\n\t\t/**\n\t\t * Cache of results produced by {@link Component.Composed.getConfigured}.\n\t\t *\n\t\t * @remarks\n\t\t * Maps each {@link Component.Configurable} to the result of evaluating it against this composition.\n\t\t * This ensures a given `Configurable` is only configured once: subsequent lookups return the cached result.\n\t\t */\n\t\tprivate readonly evaluatedMap: Map<Configurable<TConfig, unknown, TComponent>, unknown> =\n\t\t\tnew Map();\n\n\t\t/**\n\t\t * Cache of results produced by {@link Component.Composed.getComposed}.\n\t\t *\n\t\t * @remarks\n\t\t * Maps each composed property to the array produced for it.\n\t\t * This ensures a given property is only composed once: subsequent lookups return the same array\n\t\t * (including the same lazy values), so repeated calls with the same property are reference-stable.\n\t\t */\n\t\tprivate readonly composedMap: Map<keyof TComponent, readonly unknown[]> = new Map();\n\n\t\tpublic readonly components: readonly TComponent[];\n\n\t\tpublic readonly config: TConfig;\n\n\t\tpublic constructor(\n\t\t\tallComponents: readonly Factory<TComponent, TConfig>[],\n\t\t\tlazyConfiguration: (composed: Composed<TComponent, TConfig>) => TConfig,\n\t\t) {\n\t\t\t// 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`.\n\t\t\tlet config: TConfig | undefined = undefined;\n\t\t\tconst lazyConfigInner = (): TConfig => {\n\t\t\t\tif (config === undefined) {\n\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t\"Configuration not yet available: components must not evaluate the lazy configuration during composition.\",\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn config;\n\t\t\t};\n\t\t\tthis.componentsMap = new Map(allComponents.map((c) => [c, c(lazyConfigInner)]));\n\t\t\tthis.components = [...this.componentsMap.values()];\n\t\t\tconfig = lazyConfiguration(this);\n\t\t\tthis.config = config;\n\t\t}\n\n\t\tpublic getComponent<TFactory extends Factory<TComponent, TConfig>>(\n\t\t\tfactory: TFactory,\n\t\t): ReturnType<TFactory> {\n\t\t\tconst found = this.componentsMap.get(factory);\n\t\t\tif (found === undefined) {\n\t\t\t\tthrow new UsageError(\"Requested component not included in this configuration\");\n\t\t\t}\n\t\t\treturn found as ReturnType<TFactory>;\n\t\t}\n\n\t\tpublic getConfigured<TConfigurable extends Configurable<TConfig, unknown, TComponent>>(\n\t\t\tconfigurable: TConfigurable,\n\t\t): ReturnType<TConfigurable[\"configure\"]> {\n\t\t\tconst configured: unknown = getOrCreate(this.evaluatedMap, configurable, (c) => {\n\t\t\t\tconst result = c.configure(this.config, this);\n\t\t\t\tif (result === undefined) {\n\t\t\t\t\tthrow new UsageError(\"Configurable must not return undefined\");\n\t\t\t\t}\n\t\t\t\treturn result;\n\t\t\t});\n\t\t\treturn configured as ReturnType<TConfigurable[\"configure\"]>;\n\t\t}\n\n\t\tpublic getComposed<\n\t\t\tTKey extends keyof {\n\t\t\t\t[Property in keyof TComponent as TComponent[Property] extends\n\t\t\t\t\t| LazyArray<unknown>\n\t\t\t\t\t| undefined\n\t\t\t\t\t? Property\n\t\t\t\t\t: never]: boolean;\n\t\t\t},\n\t\t>(\n\t\t\tproperty: TKey,\n\t\t): readonly (Exclude<TComponent[TKey], undefined> extends LazyArray<infer U>\n\t\t\t? () => U\n\t\t\t: never)[] {\n\t\t\tconst result = getOrCreate(this.composedMap, property, () =>\n\t\t\t\tthis.components.flatMap((c) => {\n\t\t\t\t\tconst prop = c[property] as LazyArray<unknown> | undefined;\n\t\t\t\t\tif (prop === undefined) {\n\t\t\t\t\t\treturn [];\n\t\t\t\t\t}\n\t\t\t\t\treturn prop();\n\t\t\t\t}),\n\t\t\t);\n\t\t\treturn result as (Exclude<TComponent[TKey], undefined> extends LazyArray<infer U>\n\t\t\t\t? () => U\n\t\t\t\t: never)[];\n\t\t}\n\t}\n\n\t/**\n\t * Combine multiple {@link Component.Factory|components} into a single {@link Component.Composed}.\n\t *\n\t * @remarks\n\t * The {@link Component.Composed} itself is used as the configuration made available to components:\n\t * the simple case where components read composed content directly from the composition.\n\t * To produce a custom aggregated configuration, use the overload which takes a `lazyConfiguration` builder.\n\t *\n\t * @param allComponents - The components to compose.\n\t * @returns The composed components, from which configuration and per-component content can be read.\n\t *\n\t * @typeParam TComponent - The content each component contributes.\n\t *\n\t * @alpha\n\t */\n\texport function compose<TComponent>(\n\t\tallComponents: readonly Factory<TComponent>[],\n\t): Composed<TComponent>;\n\t/**\n\t * Combine multiple {@link Component.Factory|components} into a single {@link Component.Composed}.\n\t *\n\t * @param allComponents - The components to compose.\n\t * @param lazyConfiguration - Builds the composed configuration from the composed components.\n\t * This is invoked once, after all components have been created, and can aggregate content contributed by the\n\t * components (for example via {@link Component.Composed.getComposed}).\n\t * @returns The composed components, from which configuration and per-component content can be read.\n\t *\n\t * @typeParam TComponent - The content each component contributes.\n\t * @typeParam TConfig - The composed configuration type made available to components.\n\t *\n\t * @alpha\n\t */\n\texport function compose<TComponent, TConfig>(\n\t\tallComponents: readonly Factory<TComponent, TConfig>[],\n\t\tlazyConfiguration: (composed: Composed<TComponent, TConfig>) => TConfig,\n\t): Composed<TComponent, TConfig>;\n\texport function compose<TComponent, TConfig>(\n\t\tallComponents: readonly Factory<TComponent, TConfig>[],\n\t\tlazyConfiguration: (composed: Composed<TComponent, TConfig>) => TConfig = (composed) =>\n\t\t\tcomposed as unknown as TConfig,\n\t): Composed<TComponent, TConfig> {\n\t\treturn new Config<TConfig, TComponent>(allComponents, lazyConfiguration);\n\t}\n\n\t/**\n\t * The default configuration type for a composition.\n\t * Also the type of Composed when using the default composition.\n\t * @privateRemarks\n\t * Declaring this as its own type makes the recursion possible instead of having to list the config parameter as unknown.\n\t * This makes it easier to understand what is going on when seeing this type in the intellisense.\n\t * @sealed @alpha\n\t */\n\texport type ComposedDefault<TComponent> = Composed<TComponent, ComposedDefault<TComponent>>;\n\n\t/**\n\t * The result of composing multiple components.\n\t *\n\t * @remarks\n\t * Create using {@link Component.(compose:1)}.\n\t *\n\t * @typeParam TComponent - The content each component contributes.\n\t * @typeParam TConfig - The composed configuration type made available to components.\n\t * Defaults to the composition itself: the common case where no custom configuration type is needed.\n\t *\n\t * @sealed @alpha\n\t */\n\texport interface Composed<TComponent, TConfig = ComposedDefault<TComponent>> {\n\t\t/**\n\t\t * The components which were composed.\n\t\t */\n\t\treadonly components: readonly TComponent[];\n\n\t\t/**\n\t\t * The configuration which was produced when composing.\n\t\t */\n\t\treadonly config: TConfig;\n\n\t\t/**\n\t\t * Get a component by its factory.\n\t\t *\n\t\t * @param factory - The factory used to look up the component. Must have been provided when composing.\n\t\t * @returns The content created by the provided factory.\n\t\t * This result is cached during composition and not reevaluated.\n\t\t */\n\t\tgetComponent<TFactory extends Factory<TComponent, TConfig>>(\n\t\t\tfactory: TFactory,\n\t\t): ReturnType<TFactory>;\n\n\t\t/**\n\t\t * Configure a {@link Component.Configurable}.\n\t\t * @remarks\n\t\t * The result is cached when first evaluated, so subsequent calls with the same `configurable` return the\n\t\t * same result.\n\t\t * @param configurable - The item to configure against this composition.\n\t\t */\n\t\tgetConfigured<TConfigurable extends Configurable<TConfig, unknown, TComponent>>(\n\t\t\tconfigurable: TConfigurable,\n\t\t): ReturnType<TConfigurable[\"configure\"]>;\n\n\t\t/**\n\t\t * Compose the contents of a {@link Component.LazyArray} property from all components.\n\t\t * @remarks\n\t\t * The result is cached when first evaluated, so subsequent calls with the same `property` return the\n\t\t * same result.\n\t\t * @param property - The property of the components to compose.\n\t\t * @returns The concatenation of the lazy values contributed by each component for `property`.\n\t\t * Components which omit the property contribute nothing.\n\t\t */\n\t\tgetComposed<\n\t\t\tTKey extends keyof {\n\t\t\t\t[Property in keyof TComponent as TComponent[Property] extends\n\t\t\t\t\t| LazyArray<unknown>\n\t\t\t\t\t| undefined\n\t\t\t\t\t? Property\n\t\t\t\t\t: never]: boolean;\n\t\t\t},\n\t\t>(\n\t\t\tproperty: TKey,\n\t\t): readonly (Exclude<TComponent[TKey], undefined> extends LazyArray<infer U>\n\t\t\t? () => U\n\t\t\t: never)[];\n\t}\n}\n"]}
@@ -3,6 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  export class EditBuilder {
6
+ changeReceiver;
6
7
  constructor(changeReceiver) {
7
8
  this.changeReceiver = changeReceiver;
8
9
  }
@@ -1 +1 @@
1
- {"version":3,"file":"editBuilder.js","sourceRoot":"","sources":["../../../src/core/change-family/editBuilder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,MAAM,OAAgB,WAAW;IAChC,YACkB,cAAuD;QAAvD,mBAAc,GAAd,cAAc,CAAyC;IACtE,CAAC;IAEJ;;;;OAIG;IACO,WAAW,CAAC,MAA6B;QAClD,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;IAC7B,CAAC;IAEM,gBAAgB,KAAU,CAAC;IAC3B,eAAe,KAAU,CAAC;CACjC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { TaggedChange } from \"../rebase/index.js\";\n\nimport type { ChangeFamilyEditor } from \"./changeFamily.js\";\n\nexport abstract class EditBuilder<TChange> implements ChangeFamilyEditor {\n\tpublic constructor(\n\t\tprivate readonly changeReceiver: (change: TaggedChange<TChange>) => void,\n\t) {}\n\n\t/**\n\t * Subclasses add editing methods which call this with their generated edits.\n\t *\n\t * @sealed\n\t */\n\tprotected applyChange(change: TaggedChange<TChange>): void {\n\t\tthis.changeReceiver(change);\n\t}\n\n\tpublic enterTransaction(): void {}\n\tpublic exitTransaction(): void {}\n}\n"]}
1
+ {"version":3,"file":"editBuilder.js","sourceRoot":"","sources":["../../../src/core/change-family/editBuilder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,MAAM,OAAgB,WAAW;IAEd;IADlB,YACkB,cAAuD;QAAvD,mBAAc,GAAd,cAAc,CAAyC;IACtE,CAAC;IAEJ;;;;OAIG;IACO,WAAW,CAAC,MAA6B;QAClD,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;IAC7B,CAAC;IAEM,gBAAgB,KAAU,CAAC;IAC3B,eAAe,KAAU,CAAC;CACjC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { TaggedChange } from \"../rebase/index.js\";\n\nimport type { ChangeFamilyEditor } from \"./changeFamily.js\";\n\nexport abstract class EditBuilder<TChange> implements ChangeFamilyEditor {\n\tpublic constructor(\n\t\tprivate readonly changeReceiver: (change: TaggedChange<TChange>) => void,\n\t) {}\n\n\t/**\n\t * Subclasses add editing methods which call this with their generated edits.\n\t *\n\t * @sealed\n\t */\n\tprotected applyChange(change: TaggedChange<TChange>): void {\n\t\tthis.changeReceiver(change);\n\t}\n\n\tpublic enterTransaction(): void {}\n\tpublic exitTransaction(): void {}\n}\n"]}