@fluidframework/tree 2.80.0 → 2.81.0-374083

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 (914) hide show
  1. package/api-report/tree.alpha.api.md +43 -7
  2. package/dist/alpha.d.ts +5 -0
  3. package/dist/core/change-family/changeFamily.d.ts +4 -1
  4. package/dist/core/change-family/changeFamily.d.ts.map +1 -1
  5. package/dist/core/change-family/changeFamily.js.map +1 -1
  6. package/dist/core/change-family/index.d.ts +1 -1
  7. package/dist/core/change-family/index.d.ts.map +1 -1
  8. package/dist/core/change-family/index.js.map +1 -1
  9. package/dist/core/index.d.ts +3 -3
  10. package/dist/core/index.d.ts.map +1 -1
  11. package/dist/core/index.js +6 -4
  12. package/dist/core/index.js.map +1 -1
  13. package/dist/core/rebase/changeRebaser.d.ts +6 -1
  14. package/dist/core/rebase/changeRebaser.d.ts.map +1 -1
  15. package/dist/core/rebase/changeRebaser.js.map +1 -1
  16. package/dist/core/rebase/index.d.ts +1 -1
  17. package/dist/core/rebase/index.d.ts.map +1 -1
  18. package/dist/core/rebase/index.js +2 -1
  19. package/dist/core/rebase/index.js.map +1 -1
  20. package/dist/core/rebase/types.d.ts +46 -8
  21. package/dist/core/rebase/types.d.ts.map +1 -1
  22. package/dist/core/rebase/types.js +5 -1
  23. package/dist/core/rebase/types.js.map +1 -1
  24. package/dist/core/rebase/utils.d.ts.map +1 -1
  25. package/dist/core/rebase/utils.js +30 -8
  26. package/dist/core/rebase/utils.js.map +1 -1
  27. package/dist/core/tree/anchorSet.js +1 -0
  28. package/dist/core/tree/anchorSet.js.map +1 -1
  29. package/dist/core/tree/detachedFieldIndex.d.ts +6 -0
  30. package/dist/core/tree/detachedFieldIndex.d.ts.map +1 -1
  31. package/dist/core/tree/detachedFieldIndex.js +9 -0
  32. package/dist/core/tree/detachedFieldIndex.js.map +1 -1
  33. package/dist/core/tree/index.d.ts +1 -1
  34. package/dist/core/tree/index.d.ts.map +1 -1
  35. package/dist/core/tree/index.js +4 -3
  36. package/dist/core/tree/index.js.map +1 -1
  37. package/dist/core/tree/pathTree.d.ts +11 -3
  38. package/dist/core/tree/pathTree.d.ts.map +1 -1
  39. package/dist/core/tree/pathTree.js +14 -2
  40. package/dist/core/tree/pathTree.js.map +1 -1
  41. package/dist/core/tree/visitDelta.d.ts.map +1 -1
  42. package/dist/core/tree/visitDelta.js +3 -2
  43. package/dist/core/tree/visitDelta.js.map +1 -1
  44. package/dist/core/tree/visitorUtils.d.ts.map +1 -1
  45. package/dist/core/tree/visitorUtils.js +58 -18
  46. package/dist/core/tree/visitorUtils.js.map +1 -1
  47. package/dist/feature-libraries/changeAtomIdBTree.d.ts +10 -4
  48. package/dist/feature-libraries/changeAtomIdBTree.d.ts.map +1 -1
  49. package/dist/feature-libraries/changeAtomIdBTree.js +16 -2
  50. package/dist/feature-libraries/changeAtomIdBTree.js.map +1 -1
  51. package/dist/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
  52. package/dist/feature-libraries/chunked-forest/basicChunk.js +7 -0
  53. package/dist/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
  54. package/dist/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  55. package/dist/feature-libraries/chunked-forest/chunkTree.js +4 -1
  56. package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  57. package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  58. package/dist/feature-libraries/chunked-forest/chunkedForest.js +3 -1
  59. package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  60. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +1 -0
  61. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  62. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts +93 -44
  63. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  64. package/dist/feature-libraries/default-schema/defaultEditBuilder.js +238 -69
  65. package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  66. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts +1 -1
  67. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  68. package/dist/feature-libraries/default-schema/defaultFieldKinds.js +11 -2
  69. package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  70. package/dist/feature-libraries/default-schema/index.d.ts +2 -1
  71. package/dist/feature-libraries/default-schema/index.d.ts.map +1 -1
  72. package/dist/feature-libraries/default-schema/index.js +5 -2
  73. package/dist/feature-libraries/default-schema/index.js.map +1 -1
  74. package/dist/feature-libraries/default-schema/locationBasedEditBuilder.d.ts +38 -0
  75. package/dist/feature-libraries/default-schema/locationBasedEditBuilder.d.ts.map +1 -0
  76. package/dist/feature-libraries/default-schema/locationBasedEditBuilder.js +132 -0
  77. package/dist/feature-libraries/default-schema/locationBasedEditBuilder.js.map +1 -0
  78. package/dist/feature-libraries/default-schema/mappedEditBuilder.d.ts +7 -6
  79. package/dist/feature-libraries/default-schema/mappedEditBuilder.d.ts.map +1 -1
  80. package/dist/feature-libraries/default-schema/mappedEditBuilder.js +15 -0
  81. package/dist/feature-libraries/default-schema/mappedEditBuilder.js.map +1 -1
  82. package/dist/feature-libraries/deltaUtils.d.ts +1 -0
  83. package/dist/feature-libraries/deltaUtils.d.ts.map +1 -1
  84. package/dist/feature-libraries/deltaUtils.js +6 -1
  85. package/dist/feature-libraries/deltaUtils.js.map +1 -1
  86. package/dist/feature-libraries/flex-tree/context.d.ts +9 -0
  87. package/dist/feature-libraries/flex-tree/context.d.ts.map +1 -1
  88. package/dist/feature-libraries/flex-tree/context.js +6 -0
  89. package/dist/feature-libraries/flex-tree/context.js.map +1 -1
  90. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts +6 -6
  91. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  92. package/dist/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  93. package/dist/feature-libraries/flex-tree/lazyField.d.ts +8 -7
  94. package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  95. package/dist/feature-libraries/flex-tree/lazyField.js +40 -9
  96. package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
  97. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  98. package/dist/feature-libraries/forest-summary/forestSummarizer.js +3 -1
  99. package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  100. package/dist/feature-libraries/index.d.ts +3 -3
  101. package/dist/feature-libraries/index.d.ts.map +1 -1
  102. package/dist/feature-libraries/index.js +8 -3
  103. package/dist/feature-libraries/index.js.map +1 -1
  104. package/dist/feature-libraries/mapTreeCursor.d.ts.map +1 -1
  105. package/dist/feature-libraries/mapTreeCursor.js +1 -0
  106. package/dist/feature-libraries/mapTreeCursor.js.map +1 -1
  107. package/dist/feature-libraries/mitigatedChangeFamily.d.ts.map +1 -1
  108. package/dist/feature-libraries/mitigatedChangeFamily.js +2 -2
  109. package/dist/feature-libraries/mitigatedChangeFamily.js.map +1 -1
  110. package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts +97 -21
  111. package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
  112. package/dist/feature-libraries/modular-schema/crossFieldQueries.js +4 -7
  113. package/dist/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
  114. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts +20 -51
  115. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  116. package/dist/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  117. package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  118. package/dist/feature-libraries/modular-schema/genericFieldKind.js +3 -9
  119. package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  120. package/dist/feature-libraries/modular-schema/index.d.ts +4 -4
  121. package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
  122. package/dist/feature-libraries/modular-schema/index.js +2 -2
  123. package/dist/feature-libraries/modular-schema/index.js.map +1 -1
  124. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts +11 -28
  125. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -1
  126. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js +255 -161
  127. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
  128. package/dist/feature-libraries/modular-schema/modularChangeCodecV3.d.ts +15 -0
  129. package/dist/feature-libraries/modular-schema/modularChangeCodecV3.d.ts.map +1 -0
  130. package/dist/feature-libraries/modular-schema/modularChangeCodecV3.js +393 -0
  131. package/dist/feature-libraries/modular-schema/modularChangeCodecV3.js.map +1 -0
  132. package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  133. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js +8 -1
  134. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  135. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +48 -20
  136. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  137. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +1350 -476
  138. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  139. package/dist/feature-libraries/modular-schema/modularChangeFormatV1.d.ts.map +1 -1
  140. package/dist/feature-libraries/modular-schema/modularChangeFormatV1.js.map +1 -1
  141. package/dist/feature-libraries/modular-schema/modularChangeFormatV3.d.ts +146 -0
  142. package/dist/feature-libraries/modular-schema/modularChangeFormatV3.d.ts.map +1 -0
  143. package/dist/feature-libraries/modular-schema/modularChangeFormatV3.js +32 -0
  144. package/dist/feature-libraries/modular-schema/modularChangeFormatV3.js.map +1 -0
  145. package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts +47 -11
  146. package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
  147. package/dist/feature-libraries/modular-schema/modularChangeTypes.js +3 -3
  148. package/dist/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
  149. package/dist/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  150. package/dist/feature-libraries/object-forest/objectForest.js +3 -1
  151. package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
  152. package/dist/feature-libraries/optional-field/index.d.ts +2 -2
  153. package/dist/feature-libraries/optional-field/index.d.ts.map +1 -1
  154. package/dist/feature-libraries/optional-field/index.js +1 -2
  155. package/dist/feature-libraries/optional-field/index.js.map +1 -1
  156. package/dist/feature-libraries/optional-field/optionalField.d.ts +5 -26
  157. package/dist/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
  158. package/dist/feature-libraries/optional-field/optionalField.js +221 -443
  159. package/dist/feature-libraries/optional-field/optionalField.js.map +1 -1
  160. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV3.d.ts +23 -0
  161. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV3.d.ts.map +1 -0
  162. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV3.js +31 -0
  163. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV3.js.map +1 -0
  164. package/dist/feature-libraries/optional-field/optionalFieldChangeTypes.d.ts +24 -33
  165. package/dist/feature-libraries/optional-field/optionalFieldChangeTypes.d.ts.map +1 -1
  166. package/dist/feature-libraries/optional-field/optionalFieldChangeTypes.js.map +1 -1
  167. package/dist/feature-libraries/optional-field/optionalFieldCodecV2.d.ts +1 -1
  168. package/dist/feature-libraries/optional-field/optionalFieldCodecV2.d.ts.map +1 -1
  169. package/dist/feature-libraries/optional-field/optionalFieldCodecV2.js +57 -28
  170. package/dist/feature-libraries/optional-field/optionalFieldCodecV2.js.map +1 -1
  171. package/dist/feature-libraries/optional-field/optionalFieldCodecV3.d.ts +12 -0
  172. package/dist/feature-libraries/optional-field/optionalFieldCodecV3.d.ts.map +1 -0
  173. package/dist/feature-libraries/optional-field/optionalFieldCodecV3.js +57 -0
  174. package/dist/feature-libraries/optional-field/optionalFieldCodecV3.js.map +1 -0
  175. package/dist/feature-libraries/optional-field/optionalFieldCodecs.d.ts.map +1 -1
  176. package/dist/feature-libraries/optional-field/optionalFieldCodecs.js +5 -1
  177. package/dist/feature-libraries/optional-field/optionalFieldCodecs.js.map +1 -1
  178. package/dist/feature-libraries/sequence-field/compose.d.ts +6 -7
  179. package/dist/feature-libraries/sequence-field/compose.d.ts.map +1 -1
  180. package/dist/feature-libraries/sequence-field/compose.js +83 -259
  181. package/dist/feature-libraries/sequence-field/compose.js.map +1 -1
  182. package/dist/feature-libraries/sequence-field/helperTypes.d.ts +14 -10
  183. package/dist/feature-libraries/sequence-field/helperTypes.d.ts.map +1 -1
  184. package/dist/feature-libraries/sequence-field/helperTypes.js.map +1 -1
  185. package/dist/feature-libraries/sequence-field/index.d.ts +2 -3
  186. package/dist/feature-libraries/sequence-field/index.d.ts.map +1 -1
  187. package/dist/feature-libraries/sequence-field/index.js +1 -3
  188. package/dist/feature-libraries/sequence-field/index.js.map +1 -1
  189. package/dist/feature-libraries/sequence-field/invert.d.ts +3 -3
  190. package/dist/feature-libraries/sequence-field/invert.d.ts.map +1 -1
  191. package/dist/feature-libraries/sequence-field/invert.js +65 -167
  192. package/dist/feature-libraries/sequence-field/invert.js.map +1 -1
  193. package/dist/feature-libraries/sequence-field/markQueue.d.ts +2 -2
  194. package/dist/feature-libraries/sequence-field/markQueue.d.ts.map +1 -1
  195. package/dist/feature-libraries/sequence-field/markQueue.js.map +1 -1
  196. package/dist/feature-libraries/sequence-field/moveEffectTable.d.ts +4 -56
  197. package/dist/feature-libraries/sequence-field/moveEffectTable.d.ts.map +1 -1
  198. package/dist/feature-libraries/sequence-field/moveEffectTable.js +7 -90
  199. package/dist/feature-libraries/sequence-field/moveEffectTable.js.map +1 -1
  200. package/dist/feature-libraries/sequence-field/rebase.d.ts +3 -3
  201. package/dist/feature-libraries/sequence-field/rebase.d.ts.map +1 -1
  202. package/dist/feature-libraries/sequence-field/rebase.js +107 -114
  203. package/dist/feature-libraries/sequence-field/rebase.js.map +1 -1
  204. package/dist/feature-libraries/sequence-field/replaceRevisions.d.ts.map +1 -1
  205. package/dist/feature-libraries/sequence-field/replaceRevisions.js +18 -31
  206. package/dist/feature-libraries/sequence-field/replaceRevisions.js.map +1 -1
  207. package/dist/feature-libraries/sequence-field/sequenceFieldChangeHandler.d.ts.map +1 -1
  208. package/dist/feature-libraries/sequence-field/sequenceFieldChangeHandler.js +0 -2
  209. package/dist/feature-libraries/sequence-field/sequenceFieldChangeHandler.js.map +1 -1
  210. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts +22 -4
  211. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
  212. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js +365 -187
  213. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
  214. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts.map +1 -1
  215. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.js +20 -62
  216. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -1
  217. package/dist/feature-libraries/sequence-field/sequenceFieldEditor.d.ts +2 -2
  218. package/dist/feature-libraries/sequence-field/sequenceFieldEditor.d.ts.map +1 -1
  219. package/dist/feature-libraries/sequence-field/sequenceFieldEditor.js +10 -10
  220. package/dist/feature-libraries/sequence-field/sequenceFieldEditor.js.map +1 -1
  221. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts +3 -2
  222. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts.map +1 -1
  223. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js +14 -109
  224. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
  225. package/dist/feature-libraries/sequence-field/types.d.ts +30 -59
  226. package/dist/feature-libraries/sequence-field/types.d.ts.map +1 -1
  227. package/dist/feature-libraries/sequence-field/types.js.map +1 -1
  228. package/dist/feature-libraries/sequence-field/utils.d.ts +15 -24
  229. package/dist/feature-libraries/sequence-field/utils.d.ts.map +1 -1
  230. package/dist/feature-libraries/sequence-field/utils.js +116 -305
  231. package/dist/feature-libraries/sequence-field/utils.js.map +1 -1
  232. package/dist/index.d.ts +3 -2
  233. package/dist/index.d.ts.map +1 -1
  234. package/dist/index.js +4 -1
  235. package/dist/index.js.map +1 -1
  236. package/dist/packageVersion.d.ts +1 -1
  237. package/dist/packageVersion.d.ts.map +1 -1
  238. package/dist/packageVersion.js +1 -1
  239. package/dist/packageVersion.js.map +1 -1
  240. package/dist/shared-tree/index.d.ts +1 -1
  241. package/dist/shared-tree/index.d.ts.map +1 -1
  242. package/dist/shared-tree/index.js.map +1 -1
  243. package/dist/shared-tree/schematizeTree.d.ts +4 -4
  244. package/dist/shared-tree/schematizeTree.d.ts.map +1 -1
  245. package/dist/shared-tree/schematizeTree.js +2 -1
  246. package/dist/shared-tree/schematizeTree.js.map +1 -1
  247. package/dist/shared-tree/schematizingTreeView.d.ts +1 -5
  248. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  249. package/dist/shared-tree/schematizingTreeView.js +38 -35
  250. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  251. package/dist/shared-tree/sharedTree.d.ts +9 -3
  252. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  253. package/dist/shared-tree/sharedTree.js +11 -0
  254. package/dist/shared-tree/sharedTree.js.map +1 -1
  255. package/dist/shared-tree/sharedTreeChangeCodecs.d.ts +1 -1
  256. package/dist/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  257. package/dist/shared-tree/sharedTreeChangeCodecs.js +1 -0
  258. package/dist/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  259. package/dist/shared-tree/sharedTreeChangeEnricher.d.ts.map +1 -1
  260. package/dist/shared-tree/sharedTreeChangeEnricher.js +1 -1
  261. package/dist/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
  262. package/dist/shared-tree/sharedTreeChangeFamily.d.ts +5 -5
  263. package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  264. package/dist/shared-tree/sharedTreeChangeFamily.js +10 -4
  265. package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  266. package/dist/shared-tree/sharedTreeEditBuilder.d.ts +16 -6
  267. package/dist/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
  268. package/dist/shared-tree/sharedTreeEditBuilder.js +14 -7
  269. package/dist/shared-tree/sharedTreeEditBuilder.js.map +1 -1
  270. package/dist/shared-tree/treeCheckout.d.ts +9 -10
  271. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  272. package/dist/shared-tree/treeCheckout.js +63 -8
  273. package/dist/shared-tree/treeCheckout.js.map +1 -1
  274. package/dist/shared-tree-core/branch.d.ts +3 -2
  275. package/dist/shared-tree-core/branch.d.ts.map +1 -1
  276. package/dist/shared-tree-core/branch.js +9 -4
  277. package/dist/shared-tree-core/branch.js.map +1 -1
  278. package/dist/shared-tree-core/editManager.d.ts +2 -2
  279. package/dist/shared-tree-core/editManager.d.ts.map +1 -1
  280. package/dist/shared-tree-core/editManager.js +20 -14
  281. package/dist/shared-tree-core/editManager.js.map +1 -1
  282. package/dist/shared-tree-core/editManagerCodecs.d.ts +4 -0
  283. package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  284. package/dist/shared-tree-core/editManagerCodecs.js +10 -2
  285. package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
  286. package/dist/shared-tree-core/editManagerFormatCommons.d.ts +1 -0
  287. package/dist/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
  288. package/dist/shared-tree-core/editManagerFormatCommons.js +6 -0
  289. package/dist/shared-tree-core/editManagerFormatCommons.js.map +1 -1
  290. package/dist/shared-tree-core/editManagerFormatV1toV4.d.ts +2 -2
  291. package/dist/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -1
  292. package/dist/shared-tree-core/editManagerFormatV1toV4.js +1 -0
  293. package/dist/shared-tree-core/editManagerFormatV1toV4.js.map +1 -1
  294. package/dist/shared-tree-core/index.d.ts +2 -2
  295. package/dist/shared-tree-core/index.d.ts.map +1 -1
  296. package/dist/shared-tree-core/index.js +3 -1
  297. package/dist/shared-tree-core/index.js.map +1 -1
  298. package/dist/shared-tree-core/messageCodecV1ToV4.d.ts +1 -1
  299. package/dist/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
  300. package/dist/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
  301. package/dist/shared-tree-core/messageCodecs.d.ts +4 -0
  302. package/dist/shared-tree-core/messageCodecs.d.ts.map +1 -1
  303. package/dist/shared-tree-core/messageCodecs.js +10 -2
  304. package/dist/shared-tree-core/messageCodecs.js.map +1 -1
  305. package/dist/shared-tree-core/messageFormat.d.ts +1 -0
  306. package/dist/shared-tree-core/messageFormat.d.ts.map +1 -1
  307. package/dist/shared-tree-core/messageFormat.js +6 -0
  308. package/dist/shared-tree-core/messageFormat.js.map +1 -1
  309. package/dist/shared-tree-core/messageFormatV1ToV4.d.ts +2 -2
  310. package/dist/shared-tree-core/messageFormatV1ToV4.d.ts.map +1 -1
  311. package/dist/shared-tree-core/messageFormatV1ToV4.js +1 -0
  312. package/dist/shared-tree-core/messageFormatV1ToV4.js.map +1 -1
  313. package/dist/shared-tree-core/sharedTreeCore.d.ts +1 -0
  314. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  315. package/dist/shared-tree-core/sharedTreeCore.js +1 -1
  316. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  317. package/dist/simple-tree/api/index.d.ts +1 -1
  318. package/dist/simple-tree/api/index.d.ts.map +1 -1
  319. package/dist/simple-tree/api/index.js +2 -1
  320. package/dist/simple-tree/api/index.js.map +1 -1
  321. package/dist/simple-tree/api/schemaFactoryAlpha.js +1 -1
  322. package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  323. package/dist/simple-tree/api/schemaFactoryBeta.js +1 -1
  324. package/dist/simple-tree/api/schemaFactoryBeta.js.map +1 -1
  325. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js +4 -4
  326. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  327. package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts +244 -0
  328. package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -1
  329. package/dist/simple-tree/api/snapshotCompatibilityChecker.js +297 -1
  330. package/dist/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
  331. package/dist/simple-tree/api/tree.d.ts +3 -1
  332. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  333. package/dist/simple-tree/api/tree.js.map +1 -1
  334. package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  335. package/dist/simple-tree/core/treeNodeKernel.js +6 -2
  336. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
  337. package/dist/simple-tree/core/unhydratedFlexTree.d.ts +15 -15
  338. package/dist/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  339. package/dist/simple-tree/core/unhydratedFlexTree.js +59 -8
  340. package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  341. package/dist/simple-tree/fieldSchema.d.ts +4 -4
  342. package/dist/simple-tree/fieldSchema.d.ts.map +1 -1
  343. package/dist/simple-tree/fieldSchema.js.map +1 -1
  344. package/dist/simple-tree/index.d.ts +3 -3
  345. package/dist/simple-tree/index.d.ts.map +1 -1
  346. package/dist/simple-tree/index.js +4 -3
  347. package/dist/simple-tree/index.js.map +1 -1
  348. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  349. package/dist/simple-tree/node-kinds/array/arrayNode.js +7 -5
  350. package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  351. package/dist/simple-tree/node-kinds/common.d.ts.map +1 -1
  352. package/dist/simple-tree/node-kinds/common.js +1 -1
  353. package/dist/simple-tree/node-kinds/common.js.map +1 -1
  354. package/dist/simple-tree/node-kinds/map/mapNode.js +2 -2
  355. package/dist/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  356. package/dist/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  357. package/dist/simple-tree/node-kinds/object/objectNode.js +19 -19
  358. package/dist/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  359. package/dist/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
  360. package/dist/simple-tree/node-kinds/record/recordNode.js +4 -2
  361. package/dist/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  362. package/dist/simple-tree/prepareForInsertion.d.ts +54 -47
  363. package/dist/simple-tree/prepareForInsertion.d.ts.map +1 -1
  364. package/dist/simple-tree/prepareForInsertion.js +184 -126
  365. package/dist/simple-tree/prepareForInsertion.js.map +1 -1
  366. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.d.ts +13 -4
  367. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
  368. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js +31 -13
  369. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
  370. package/dist/text/index.d.ts +6 -0
  371. package/dist/text/index.d.ts.map +1 -0
  372. package/dist/text/index.js +10 -0
  373. package/dist/text/index.js.map +1 -0
  374. package/dist/text/textDomain.d.ts +138 -0
  375. package/dist/text/textDomain.d.ts.map +1 -0
  376. package/dist/text/textDomain.js +121 -0
  377. package/dist/text/textDomain.js.map +1 -0
  378. package/dist/treeFactory.d.ts.map +1 -1
  379. package/dist/treeFactory.js +12 -2
  380. package/dist/treeFactory.js.map +1 -1
  381. package/dist/util/bTreeUtils.d.ts +12 -4
  382. package/dist/util/bTreeUtils.d.ts.map +1 -1
  383. package/dist/util/bTreeUtils.js +14 -18
  384. package/dist/util/bTreeUtils.js.map +1 -1
  385. package/dist/util/index.d.ts +1 -1
  386. package/dist/util/index.d.ts.map +1 -1
  387. package/dist/util/index.js +2 -1
  388. package/dist/util/index.js.map +1 -1
  389. package/dist/util/nestedMap.js +12 -12
  390. package/dist/util/nestedMap.js.map +1 -1
  391. package/dist/util/rangeMap.d.ts +24 -12
  392. package/dist/util/rangeMap.d.ts.map +1 -1
  393. package/dist/util/rangeMap.js +46 -6
  394. package/dist/util/rangeMap.js.map +1 -1
  395. package/docs/user-facing/merge-semantics.md +3 -2
  396. package/eslint.config.mts +4 -32
  397. package/lib/alpha.d.ts +5 -0
  398. package/lib/core/change-family/changeFamily.d.ts +4 -1
  399. package/lib/core/change-family/changeFamily.d.ts.map +1 -1
  400. package/lib/core/change-family/changeFamily.js.map +1 -1
  401. package/lib/core/change-family/index.d.ts +1 -1
  402. package/lib/core/change-family/index.d.ts.map +1 -1
  403. package/lib/core/change-family/index.js.map +1 -1
  404. package/lib/core/index.d.ts +3 -3
  405. package/lib/core/index.d.ts.map +1 -1
  406. package/lib/core/index.js +2 -2
  407. package/lib/core/index.js.map +1 -1
  408. package/lib/core/rebase/changeRebaser.d.ts +6 -1
  409. package/lib/core/rebase/changeRebaser.d.ts.map +1 -1
  410. package/lib/core/rebase/changeRebaser.js.map +1 -1
  411. package/lib/core/rebase/index.d.ts +1 -1
  412. package/lib/core/rebase/index.d.ts.map +1 -1
  413. package/lib/core/rebase/index.js +1 -1
  414. package/lib/core/rebase/index.js.map +1 -1
  415. package/lib/core/rebase/types.d.ts +46 -8
  416. package/lib/core/rebase/types.d.ts.map +1 -1
  417. package/lib/core/rebase/types.js +3 -0
  418. package/lib/core/rebase/types.js.map +1 -1
  419. package/lib/core/rebase/utils.d.ts.map +1 -1
  420. package/lib/core/rebase/utils.js +30 -8
  421. package/lib/core/rebase/utils.js.map +1 -1
  422. package/lib/core/tree/anchorSet.js +1 -0
  423. package/lib/core/tree/anchorSet.js.map +1 -1
  424. package/lib/core/tree/detachedFieldIndex.d.ts +6 -0
  425. package/lib/core/tree/detachedFieldIndex.d.ts.map +1 -1
  426. package/lib/core/tree/detachedFieldIndex.js +10 -1
  427. package/lib/core/tree/detachedFieldIndex.js.map +1 -1
  428. package/lib/core/tree/index.d.ts +1 -1
  429. package/lib/core/tree/index.d.ts.map +1 -1
  430. package/lib/core/tree/index.js +1 -1
  431. package/lib/core/tree/index.js.map +1 -1
  432. package/lib/core/tree/pathTree.d.ts +11 -3
  433. package/lib/core/tree/pathTree.d.ts.map +1 -1
  434. package/lib/core/tree/pathTree.js +12 -1
  435. package/lib/core/tree/pathTree.js.map +1 -1
  436. package/lib/core/tree/visitDelta.d.ts.map +1 -1
  437. package/lib/core/tree/visitDelta.js +3 -2
  438. package/lib/core/tree/visitDelta.js.map +1 -1
  439. package/lib/core/tree/visitorUtils.d.ts.map +1 -1
  440. package/lib/core/tree/visitorUtils.js +58 -18
  441. package/lib/core/tree/visitorUtils.js.map +1 -1
  442. package/lib/feature-libraries/changeAtomIdBTree.d.ts +10 -4
  443. package/lib/feature-libraries/changeAtomIdBTree.d.ts.map +1 -1
  444. package/lib/feature-libraries/changeAtomIdBTree.js +14 -1
  445. package/lib/feature-libraries/changeAtomIdBTree.js.map +1 -1
  446. package/lib/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
  447. package/lib/feature-libraries/chunked-forest/basicChunk.js +8 -1
  448. package/lib/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
  449. package/lib/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  450. package/lib/feature-libraries/chunked-forest/chunkTree.js +4 -1
  451. package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  452. package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  453. package/lib/feature-libraries/chunked-forest/chunkedForest.js +3 -1
  454. package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  455. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +1 -0
  456. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  457. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts +93 -44
  458. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  459. package/lib/feature-libraries/default-schema/defaultEditBuilder.js +236 -70
  460. package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  461. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts +1 -1
  462. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  463. package/lib/feature-libraries/default-schema/defaultFieldKinds.js +11 -2
  464. package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  465. package/lib/feature-libraries/default-schema/index.d.ts +2 -1
  466. package/lib/feature-libraries/default-schema/index.d.ts.map +1 -1
  467. package/lib/feature-libraries/default-schema/index.js +2 -1
  468. package/lib/feature-libraries/default-schema/index.js.map +1 -1
  469. package/lib/feature-libraries/default-schema/locationBasedEditBuilder.d.ts +38 -0
  470. package/lib/feature-libraries/default-schema/locationBasedEditBuilder.d.ts.map +1 -0
  471. package/lib/feature-libraries/default-schema/locationBasedEditBuilder.js +128 -0
  472. package/lib/feature-libraries/default-schema/locationBasedEditBuilder.js.map +1 -0
  473. package/lib/feature-libraries/default-schema/mappedEditBuilder.d.ts +7 -6
  474. package/lib/feature-libraries/default-schema/mappedEditBuilder.d.ts.map +1 -1
  475. package/lib/feature-libraries/default-schema/mappedEditBuilder.js +15 -0
  476. package/lib/feature-libraries/default-schema/mappedEditBuilder.js.map +1 -1
  477. package/lib/feature-libraries/deltaUtils.d.ts +1 -0
  478. package/lib/feature-libraries/deltaUtils.d.ts.map +1 -1
  479. package/lib/feature-libraries/deltaUtils.js +5 -1
  480. package/lib/feature-libraries/deltaUtils.js.map +1 -1
  481. package/lib/feature-libraries/flex-tree/context.d.ts +9 -0
  482. package/lib/feature-libraries/flex-tree/context.d.ts.map +1 -1
  483. package/lib/feature-libraries/flex-tree/context.js +6 -0
  484. package/lib/feature-libraries/flex-tree/context.js.map +1 -1
  485. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts +6 -6
  486. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  487. package/lib/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  488. package/lib/feature-libraries/flex-tree/lazyField.d.ts +8 -7
  489. package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  490. package/lib/feature-libraries/flex-tree/lazyField.js +41 -10
  491. package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
  492. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  493. package/lib/feature-libraries/forest-summary/forestSummarizer.js +3 -1
  494. package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  495. package/lib/feature-libraries/index.d.ts +3 -3
  496. package/lib/feature-libraries/index.d.ts.map +1 -1
  497. package/lib/feature-libraries/index.js +2 -2
  498. package/lib/feature-libraries/index.js.map +1 -1
  499. package/lib/feature-libraries/mapTreeCursor.d.ts.map +1 -1
  500. package/lib/feature-libraries/mapTreeCursor.js +2 -1
  501. package/lib/feature-libraries/mapTreeCursor.js.map +1 -1
  502. package/lib/feature-libraries/mitigatedChangeFamily.d.ts.map +1 -1
  503. package/lib/feature-libraries/mitigatedChangeFamily.js +2 -2
  504. package/lib/feature-libraries/mitigatedChangeFamily.js.map +1 -1
  505. package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts +97 -21
  506. package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
  507. package/lib/feature-libraries/modular-schema/crossFieldQueries.js +3 -5
  508. package/lib/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
  509. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts +20 -51
  510. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  511. package/lib/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  512. package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  513. package/lib/feature-libraries/modular-schema/genericFieldKind.js +3 -9
  514. package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  515. package/lib/feature-libraries/modular-schema/index.d.ts +4 -4
  516. package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
  517. package/lib/feature-libraries/modular-schema/index.js +2 -2
  518. package/lib/feature-libraries/modular-schema/index.js.map +1 -1
  519. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts +11 -28
  520. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -1
  521. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js +247 -143
  522. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
  523. package/lib/feature-libraries/modular-schema/modularChangeCodecV3.d.ts +15 -0
  524. package/lib/feature-libraries/modular-schema/modularChangeCodecV3.d.ts.map +1 -0
  525. package/lib/feature-libraries/modular-schema/modularChangeCodecV3.js +389 -0
  526. package/lib/feature-libraries/modular-schema/modularChangeCodecV3.js.map +1 -0
  527. package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  528. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js +8 -1
  529. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  530. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +48 -20
  531. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  532. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +1344 -479
  533. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  534. package/lib/feature-libraries/modular-schema/modularChangeFormatV1.d.ts.map +1 -1
  535. package/lib/feature-libraries/modular-schema/modularChangeFormatV1.js.map +1 -1
  536. package/lib/feature-libraries/modular-schema/modularChangeFormatV3.d.ts +146 -0
  537. package/lib/feature-libraries/modular-schema/modularChangeFormatV3.d.ts.map +1 -0
  538. package/lib/feature-libraries/modular-schema/modularChangeFormatV3.js +29 -0
  539. package/lib/feature-libraries/modular-schema/modularChangeFormatV3.js.map +1 -0
  540. package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts +47 -11
  541. package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
  542. package/lib/feature-libraries/modular-schema/modularChangeTypes.js +1 -1
  543. package/lib/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
  544. package/lib/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  545. package/lib/feature-libraries/object-forest/objectForest.js +3 -1
  546. package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
  547. package/lib/feature-libraries/optional-field/index.d.ts +2 -2
  548. package/lib/feature-libraries/optional-field/index.d.ts.map +1 -1
  549. package/lib/feature-libraries/optional-field/index.js +1 -1
  550. package/lib/feature-libraries/optional-field/index.js.map +1 -1
  551. package/lib/feature-libraries/optional-field/optionalField.d.ts +5 -26
  552. package/lib/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
  553. package/lib/feature-libraries/optional-field/optionalField.js +221 -441
  554. package/lib/feature-libraries/optional-field/optionalField.js.map +1 -1
  555. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV3.d.ts +23 -0
  556. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV3.d.ts.map +1 -0
  557. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV3.js +27 -0
  558. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV3.js.map +1 -0
  559. package/lib/feature-libraries/optional-field/optionalFieldChangeTypes.d.ts +24 -33
  560. package/lib/feature-libraries/optional-field/optionalFieldChangeTypes.d.ts.map +1 -1
  561. package/lib/feature-libraries/optional-field/optionalFieldChangeTypes.js.map +1 -1
  562. package/lib/feature-libraries/optional-field/optionalFieldCodecV2.d.ts +1 -1
  563. package/lib/feature-libraries/optional-field/optionalFieldCodecV2.d.ts.map +1 -1
  564. package/lib/feature-libraries/optional-field/optionalFieldCodecV2.js +55 -26
  565. package/lib/feature-libraries/optional-field/optionalFieldCodecV2.js.map +1 -1
  566. package/lib/feature-libraries/optional-field/optionalFieldCodecV3.d.ts +12 -0
  567. package/lib/feature-libraries/optional-field/optionalFieldCodecV3.d.ts.map +1 -0
  568. package/lib/feature-libraries/optional-field/optionalFieldCodecV3.js +53 -0
  569. package/lib/feature-libraries/optional-field/optionalFieldCodecV3.js.map +1 -0
  570. package/lib/feature-libraries/optional-field/optionalFieldCodecs.d.ts.map +1 -1
  571. package/lib/feature-libraries/optional-field/optionalFieldCodecs.js +5 -1
  572. package/lib/feature-libraries/optional-field/optionalFieldCodecs.js.map +1 -1
  573. package/lib/feature-libraries/sequence-field/compose.d.ts +6 -7
  574. package/lib/feature-libraries/sequence-field/compose.d.ts.map +1 -1
  575. package/lib/feature-libraries/sequence-field/compose.js +85 -261
  576. package/lib/feature-libraries/sequence-field/compose.js.map +1 -1
  577. package/lib/feature-libraries/sequence-field/helperTypes.d.ts +14 -10
  578. package/lib/feature-libraries/sequence-field/helperTypes.d.ts.map +1 -1
  579. package/lib/feature-libraries/sequence-field/helperTypes.js.map +1 -1
  580. package/lib/feature-libraries/sequence-field/index.d.ts +2 -3
  581. package/lib/feature-libraries/sequence-field/index.d.ts.map +1 -1
  582. package/lib/feature-libraries/sequence-field/index.js +0 -1
  583. package/lib/feature-libraries/sequence-field/index.js.map +1 -1
  584. package/lib/feature-libraries/sequence-field/invert.d.ts +3 -3
  585. package/lib/feature-libraries/sequence-field/invert.d.ts.map +1 -1
  586. package/lib/feature-libraries/sequence-field/invert.js +67 -169
  587. package/lib/feature-libraries/sequence-field/invert.js.map +1 -1
  588. package/lib/feature-libraries/sequence-field/markQueue.d.ts +2 -2
  589. package/lib/feature-libraries/sequence-field/markQueue.d.ts.map +1 -1
  590. package/lib/feature-libraries/sequence-field/markQueue.js.map +1 -1
  591. package/lib/feature-libraries/sequence-field/moveEffectTable.d.ts +4 -56
  592. package/lib/feature-libraries/sequence-field/moveEffectTable.d.ts.map +1 -1
  593. package/lib/feature-libraries/sequence-field/moveEffectTable.js +6 -84
  594. package/lib/feature-libraries/sequence-field/moveEffectTable.js.map +1 -1
  595. package/lib/feature-libraries/sequence-field/rebase.d.ts +3 -3
  596. package/lib/feature-libraries/sequence-field/rebase.d.ts.map +1 -1
  597. package/lib/feature-libraries/sequence-field/rebase.js +109 -116
  598. package/lib/feature-libraries/sequence-field/rebase.js.map +1 -1
  599. package/lib/feature-libraries/sequence-field/replaceRevisions.d.ts.map +1 -1
  600. package/lib/feature-libraries/sequence-field/replaceRevisions.js +18 -31
  601. package/lib/feature-libraries/sequence-field/replaceRevisions.js.map +1 -1
  602. package/lib/feature-libraries/sequence-field/sequenceFieldChangeHandler.d.ts.map +1 -1
  603. package/lib/feature-libraries/sequence-field/sequenceFieldChangeHandler.js +0 -2
  604. package/lib/feature-libraries/sequence-field/sequenceFieldChangeHandler.js.map +1 -1
  605. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts +22 -4
  606. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
  607. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js +356 -182
  608. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
  609. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts.map +1 -1
  610. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.js +21 -63
  611. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -1
  612. package/lib/feature-libraries/sequence-field/sequenceFieldEditor.d.ts +2 -2
  613. package/lib/feature-libraries/sequence-field/sequenceFieldEditor.d.ts.map +1 -1
  614. package/lib/feature-libraries/sequence-field/sequenceFieldEditor.js +10 -10
  615. package/lib/feature-libraries/sequence-field/sequenceFieldEditor.js.map +1 -1
  616. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts +3 -2
  617. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts.map +1 -1
  618. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.js +14 -109
  619. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
  620. package/lib/feature-libraries/sequence-field/types.d.ts +30 -59
  621. package/lib/feature-libraries/sequence-field/types.d.ts.map +1 -1
  622. package/lib/feature-libraries/sequence-field/types.js.map +1 -1
  623. package/lib/feature-libraries/sequence-field/utils.d.ts +15 -24
  624. package/lib/feature-libraries/sequence-field/utils.d.ts.map +1 -1
  625. package/lib/feature-libraries/sequence-field/utils.js +112 -298
  626. package/lib/feature-libraries/sequence-field/utils.js.map +1 -1
  627. package/lib/index.d.ts +3 -2
  628. package/lib/index.d.ts.map +1 -1
  629. package/lib/index.js +2 -1
  630. package/lib/index.js.map +1 -1
  631. package/lib/packageVersion.d.ts +1 -1
  632. package/lib/packageVersion.d.ts.map +1 -1
  633. package/lib/packageVersion.js +1 -1
  634. package/lib/packageVersion.js.map +1 -1
  635. package/lib/shared-tree/index.d.ts +1 -1
  636. package/lib/shared-tree/index.d.ts.map +1 -1
  637. package/lib/shared-tree/index.js.map +1 -1
  638. package/lib/shared-tree/schematizeTree.d.ts +4 -4
  639. package/lib/shared-tree/schematizeTree.d.ts.map +1 -1
  640. package/lib/shared-tree/schematizeTree.js +3 -2
  641. package/lib/shared-tree/schematizeTree.js.map +1 -1
  642. package/lib/shared-tree/schematizingTreeView.d.ts +1 -5
  643. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  644. package/lib/shared-tree/schematizingTreeView.js +41 -38
  645. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  646. package/lib/shared-tree/sharedTree.d.ts +9 -3
  647. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  648. package/lib/shared-tree/sharedTree.js +11 -0
  649. package/lib/shared-tree/sharedTree.js.map +1 -1
  650. package/lib/shared-tree/sharedTreeChangeCodecs.d.ts +1 -1
  651. package/lib/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  652. package/lib/shared-tree/sharedTreeChangeCodecs.js +1 -0
  653. package/lib/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  654. package/lib/shared-tree/sharedTreeChangeEnricher.d.ts.map +1 -1
  655. package/lib/shared-tree/sharedTreeChangeEnricher.js +2 -2
  656. package/lib/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
  657. package/lib/shared-tree/sharedTreeChangeFamily.d.ts +5 -5
  658. package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  659. package/lib/shared-tree/sharedTreeChangeFamily.js +11 -5
  660. package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  661. package/lib/shared-tree/sharedTreeEditBuilder.d.ts +16 -6
  662. package/lib/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
  663. package/lib/shared-tree/sharedTreeEditBuilder.js +12 -6
  664. package/lib/shared-tree/sharedTreeEditBuilder.js.map +1 -1
  665. package/lib/shared-tree/treeCheckout.d.ts +9 -10
  666. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  667. package/lib/shared-tree/treeCheckout.js +66 -11
  668. package/lib/shared-tree/treeCheckout.js.map +1 -1
  669. package/lib/shared-tree-core/branch.d.ts +3 -2
  670. package/lib/shared-tree-core/branch.d.ts.map +1 -1
  671. package/lib/shared-tree-core/branch.js +9 -4
  672. package/lib/shared-tree-core/branch.js.map +1 -1
  673. package/lib/shared-tree-core/editManager.d.ts +2 -2
  674. package/lib/shared-tree-core/editManager.d.ts.map +1 -1
  675. package/lib/shared-tree-core/editManager.js +20 -14
  676. package/lib/shared-tree-core/editManager.js.map +1 -1
  677. package/lib/shared-tree-core/editManagerCodecs.d.ts +4 -0
  678. package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  679. package/lib/shared-tree-core/editManagerCodecs.js +8 -1
  680. package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
  681. package/lib/shared-tree-core/editManagerFormatCommons.d.ts +1 -0
  682. package/lib/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
  683. package/lib/shared-tree-core/editManagerFormatCommons.js +6 -0
  684. package/lib/shared-tree-core/editManagerFormatCommons.js.map +1 -1
  685. package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts +2 -2
  686. package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -1
  687. package/lib/shared-tree-core/editManagerFormatV1toV4.js +1 -0
  688. package/lib/shared-tree-core/editManagerFormatV1toV4.js.map +1 -1
  689. package/lib/shared-tree-core/index.d.ts +2 -2
  690. package/lib/shared-tree-core/index.d.ts.map +1 -1
  691. package/lib/shared-tree-core/index.js +2 -2
  692. package/lib/shared-tree-core/index.js.map +1 -1
  693. package/lib/shared-tree-core/messageCodecV1ToV4.d.ts +1 -1
  694. package/lib/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
  695. package/lib/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
  696. package/lib/shared-tree-core/messageCodecs.d.ts +4 -0
  697. package/lib/shared-tree-core/messageCodecs.d.ts.map +1 -1
  698. package/lib/shared-tree-core/messageCodecs.js +8 -1
  699. package/lib/shared-tree-core/messageCodecs.js.map +1 -1
  700. package/lib/shared-tree-core/messageFormat.d.ts +1 -0
  701. package/lib/shared-tree-core/messageFormat.d.ts.map +1 -1
  702. package/lib/shared-tree-core/messageFormat.js +6 -0
  703. package/lib/shared-tree-core/messageFormat.js.map +1 -1
  704. package/lib/shared-tree-core/messageFormatV1ToV4.d.ts +2 -2
  705. package/lib/shared-tree-core/messageFormatV1ToV4.d.ts.map +1 -1
  706. package/lib/shared-tree-core/messageFormatV1ToV4.js +1 -0
  707. package/lib/shared-tree-core/messageFormatV1ToV4.js.map +1 -1
  708. package/lib/shared-tree-core/sharedTreeCore.d.ts +1 -0
  709. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  710. package/lib/shared-tree-core/sharedTreeCore.js +1 -1
  711. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  712. package/lib/simple-tree/api/index.d.ts +1 -1
  713. package/lib/simple-tree/api/index.d.ts.map +1 -1
  714. package/lib/simple-tree/api/index.js +1 -1
  715. package/lib/simple-tree/api/index.js.map +1 -1
  716. package/lib/simple-tree/api/schemaFactoryAlpha.js +1 -1
  717. package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  718. package/lib/simple-tree/api/schemaFactoryBeta.js +1 -1
  719. package/lib/simple-tree/api/schemaFactoryBeta.js.map +1 -1
  720. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js +4 -4
  721. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  722. package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts +244 -0
  723. package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -1
  724. package/lib/simple-tree/api/snapshotCompatibilityChecker.js +270 -0
  725. package/lib/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
  726. package/lib/simple-tree/api/tree.d.ts +3 -1
  727. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  728. package/lib/simple-tree/api/tree.js.map +1 -1
  729. package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  730. package/lib/simple-tree/core/treeNodeKernel.js +6 -2
  731. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
  732. package/lib/simple-tree/core/unhydratedFlexTree.d.ts +15 -15
  733. package/lib/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  734. package/lib/simple-tree/core/unhydratedFlexTree.js +58 -8
  735. package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  736. package/lib/simple-tree/fieldSchema.d.ts +4 -4
  737. package/lib/simple-tree/fieldSchema.d.ts.map +1 -1
  738. package/lib/simple-tree/fieldSchema.js.map +1 -1
  739. package/lib/simple-tree/index.d.ts +3 -3
  740. package/lib/simple-tree/index.d.ts.map +1 -1
  741. package/lib/simple-tree/index.js +2 -2
  742. package/lib/simple-tree/index.js.map +1 -1
  743. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  744. package/lib/simple-tree/node-kinds/array/arrayNode.js +8 -6
  745. package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  746. package/lib/simple-tree/node-kinds/common.d.ts.map +1 -1
  747. package/lib/simple-tree/node-kinds/common.js +2 -2
  748. package/lib/simple-tree/node-kinds/common.js.map +1 -1
  749. package/lib/simple-tree/node-kinds/map/mapNode.js +2 -2
  750. package/lib/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  751. package/lib/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  752. package/lib/simple-tree/node-kinds/object/objectNode.js +20 -20
  753. package/lib/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  754. package/lib/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
  755. package/lib/simple-tree/node-kinds/record/recordNode.js +4 -2
  756. package/lib/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  757. package/lib/simple-tree/prepareForInsertion.d.ts +54 -47
  758. package/lib/simple-tree/prepareForInsertion.d.ts.map +1 -1
  759. package/lib/simple-tree/prepareForInsertion.js +184 -125
  760. package/lib/simple-tree/prepareForInsertion.js.map +1 -1
  761. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.d.ts +13 -4
  762. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
  763. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js +28 -11
  764. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
  765. package/lib/text/index.d.ts +6 -0
  766. package/lib/text/index.d.ts.map +1 -0
  767. package/lib/text/index.js +6 -0
  768. package/lib/text/index.js.map +1 -0
  769. package/lib/text/textDomain.d.ts +138 -0
  770. package/lib/text/textDomain.d.ts.map +1 -0
  771. package/lib/text/textDomain.js +118 -0
  772. package/lib/text/textDomain.js.map +1 -0
  773. package/lib/treeFactory.d.ts.map +1 -1
  774. package/lib/treeFactory.js +13 -3
  775. package/lib/treeFactory.js.map +1 -1
  776. package/lib/util/bTreeUtils.d.ts +12 -4
  777. package/lib/util/bTreeUtils.d.ts.map +1 -1
  778. package/lib/util/bTreeUtils.js +15 -19
  779. package/lib/util/bTreeUtils.js.map +1 -1
  780. package/lib/util/index.d.ts +1 -1
  781. package/lib/util/index.d.ts.map +1 -1
  782. package/lib/util/index.js +1 -1
  783. package/lib/util/index.js.map +1 -1
  784. package/lib/util/nestedMap.js +12 -12
  785. package/lib/util/nestedMap.js.map +1 -1
  786. package/lib/util/rangeMap.d.ts +24 -12
  787. package/lib/util/rangeMap.d.ts.map +1 -1
  788. package/lib/util/rangeMap.js +44 -5
  789. package/lib/util/rangeMap.js.map +1 -1
  790. package/package.json +25 -25
  791. package/src/core/change-family/changeFamily.ts +5 -0
  792. package/src/core/change-family/index.ts +1 -0
  793. package/src/core/index.ts +6 -1
  794. package/src/core/rebase/changeRebaser.ts +6 -1
  795. package/src/core/rebase/index.ts +3 -0
  796. package/src/core/rebase/types.ts +65 -21
  797. package/src/core/rebase/utils.ts +39 -11
  798. package/src/core/tree/anchorSet.ts +1 -0
  799. package/src/core/tree/detachedFieldIndex.ts +17 -1
  800. package/src/core/tree/index.ts +2 -1
  801. package/src/core/tree/pathTree.ts +16 -4
  802. package/src/core/tree/visitDelta.ts +6 -2
  803. package/src/core/tree/visitorUtils.ts +55 -19
  804. package/src/feature-libraries/changeAtomIdBTree.ts +37 -5
  805. package/src/feature-libraries/chunked-forest/basicChunk.ts +7 -1
  806. package/src/feature-libraries/chunked-forest/chunkTree.ts +6 -1
  807. package/src/feature-libraries/chunked-forest/chunkedForest.ts +3 -1
  808. package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +1 -0
  809. package/src/feature-libraries/default-schema/defaultEditBuilder.ts +399 -127
  810. package/src/feature-libraries/default-schema/defaultFieldKinds.ts +13 -5
  811. package/src/feature-libraries/default-schema/index.ts +17 -5
  812. package/src/feature-libraries/default-schema/locationBasedEditBuilder.ts +188 -0
  813. package/src/feature-libraries/default-schema/mappedEditBuilder.ts +35 -9
  814. package/src/feature-libraries/deltaUtils.ts +6 -1
  815. package/src/feature-libraries/flex-tree/context.ts +17 -0
  816. package/src/feature-libraries/flex-tree/flexTreeTypes.ts +7 -8
  817. package/src/feature-libraries/flex-tree/lazyField.ts +68 -25
  818. package/src/feature-libraries/forest-summary/forestSummarizer.ts +3 -1
  819. package/src/feature-libraries/index.ts +22 -8
  820. package/src/feature-libraries/mapTreeCursor.ts +2 -1
  821. package/src/feature-libraries/mitigatedChangeFamily.ts +3 -1
  822. package/src/feature-libraries/modular-schema/crossFieldQueries.ts +142 -44
  823. package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +32 -58
  824. package/src/feature-libraries/modular-schema/genericFieldKind.ts +6 -18
  825. package/src/feature-libraries/modular-schema/index.ts +16 -15
  826. package/src/feature-libraries/modular-schema/modularChangeCodecV1.ts +560 -351
  827. package/src/feature-libraries/modular-schema/modularChangeCodecV3.ts +760 -0
  828. package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +14 -1
  829. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +2620 -782
  830. package/src/feature-libraries/modular-schema/modularChangeFormatV1.ts +1 -0
  831. package/src/feature-libraries/modular-schema/modularChangeFormatV3.ts +62 -0
  832. package/src/feature-libraries/modular-schema/modularChangeTypes.ts +58 -11
  833. package/src/feature-libraries/object-forest/objectForest.ts +3 -1
  834. package/src/feature-libraries/optional-field/index.ts +1 -3
  835. package/src/feature-libraries/optional-field/optionalField.ts +318 -562
  836. package/src/feature-libraries/optional-field/optionalFieldChangeFormatV3.ts +45 -0
  837. package/src/feature-libraries/optional-field/optionalFieldChangeTypes.ts +24 -38
  838. package/src/feature-libraries/optional-field/optionalFieldCodecV2.ts +89 -35
  839. package/src/feature-libraries/optional-field/optionalFieldCodecV3.ts +94 -0
  840. package/src/feature-libraries/optional-field/optionalFieldCodecs.ts +5 -1
  841. package/src/feature-libraries/sequence-field/compose.ts +139 -522
  842. package/src/feature-libraries/sequence-field/helperTypes.ts +34 -19
  843. package/src/feature-libraries/sequence-field/index.ts +0 -9
  844. package/src/feature-libraries/sequence-field/invert.ts +103 -228
  845. package/src/feature-libraries/sequence-field/markQueue.ts +2 -2
  846. package/src/feature-libraries/sequence-field/moveEffectTable.ts +8 -195
  847. package/src/feature-libraries/sequence-field/rebase.ts +169 -205
  848. package/src/feature-libraries/sequence-field/replaceRevisions.ts +25 -47
  849. package/src/feature-libraries/sequence-field/sequenceFieldChangeHandler.ts +0 -2
  850. package/src/feature-libraries/sequence-field/sequenceFieldCodecV2.ts +648 -228
  851. package/src/feature-libraries/sequence-field/sequenceFieldCodecV3.ts +56 -70
  852. package/src/feature-libraries/sequence-field/sequenceFieldEditor.ts +25 -27
  853. package/src/feature-libraries/sequence-field/sequenceFieldToDelta.ts +19 -129
  854. package/src/feature-libraries/sequence-field/types.ts +34 -64
  855. package/src/feature-libraries/sequence-field/utils.ts +139 -353
  856. package/src/index.ts +7 -0
  857. package/src/packageVersion.ts +1 -1
  858. package/src/shared-tree/index.ts +3 -2
  859. package/src/shared-tree/schematizeTree.ts +21 -8
  860. package/src/shared-tree/schematizingTreeView.ts +56 -70
  861. package/src/shared-tree/sharedTree.ts +20 -3
  862. package/src/shared-tree/sharedTreeChangeCodecs.ts +5 -1
  863. package/src/shared-tree/sharedTreeChangeEnricher.ts +2 -0
  864. package/src/shared-tree/sharedTreeChangeFamily.ts +15 -5
  865. package/src/shared-tree/sharedTreeEditBuilder.ts +39 -8
  866. package/src/shared-tree/treeCheckout.ts +95 -24
  867. package/src/shared-tree-core/branch.ts +13 -3
  868. package/src/shared-tree-core/editManager.ts +42 -28
  869. package/src/shared-tree-core/editManagerCodecs.ts +11 -1
  870. package/src/shared-tree-core/editManagerFormatCommons.ts +6 -0
  871. package/src/shared-tree-core/editManagerFormatV1toV4.ts +3 -1
  872. package/src/shared-tree-core/index.ts +2 -0
  873. package/src/shared-tree-core/messageCodecV1ToV4.ts +2 -1
  874. package/src/shared-tree-core/messageCodecs.ts +11 -1
  875. package/src/shared-tree-core/messageFormat.ts +6 -0
  876. package/src/shared-tree-core/messageFormatV1ToV4.ts +3 -1
  877. package/src/shared-tree-core/sharedTreeCore.ts +4 -1
  878. package/src/simple-tree/api/index.ts +3 -0
  879. package/src/simple-tree/api/schemaFactoryAlpha.ts +1 -1
  880. package/src/simple-tree/api/schemaFactoryBeta.ts +1 -1
  881. package/src/simple-tree/api/simpleSchemaToJsonSchema.ts +4 -4
  882. package/src/simple-tree/api/snapshotCompatibilityChecker.ts +501 -0
  883. package/src/simple-tree/api/tree.ts +3 -1
  884. package/src/simple-tree/core/treeNodeKernel.ts +6 -2
  885. package/src/simple-tree/core/unhydratedFlexTree.ts +87 -36
  886. package/src/simple-tree/fieldSchema.ts +6 -4
  887. package/src/simple-tree/index.ts +5 -1
  888. package/src/simple-tree/node-kinds/array/arrayNode.ts +9 -7
  889. package/src/simple-tree/node-kinds/common.ts +2 -5
  890. package/src/simple-tree/node-kinds/map/mapNode.ts +4 -4
  891. package/src/simple-tree/node-kinds/object/objectNode.ts +26 -26
  892. package/src/simple-tree/node-kinds/record/recordNode.ts +10 -9
  893. package/src/simple-tree/prepareForInsertion.ts +343 -201
  894. package/src/simple-tree/unhydratedFlexTreeFromInsertable.ts +43 -15
  895. package/src/text/README.md +8 -0
  896. package/src/text/index.ts +6 -0
  897. package/src/text/textDomain.ts +199 -0
  898. package/src/treeFactory.ts +14 -4
  899. package/src/util/bTreeUtils.ts +33 -22
  900. package/src/util/index.ts +3 -0
  901. package/src/util/nestedMap.ts +12 -12
  902. package/src/util/rangeMap.ts +72 -18
  903. package/.eslintrc.cjs +0 -125
  904. package/assertTagging.config.mjs +0 -14
  905. package/dist/feature-libraries/sequence-field/relevantRemovedRoots.d.ts +0 -9
  906. package/dist/feature-libraries/sequence-field/relevantRemovedRoots.d.ts.map +0 -1
  907. package/dist/feature-libraries/sequence-field/relevantRemovedRoots.js +0 -50
  908. package/dist/feature-libraries/sequence-field/relevantRemovedRoots.js.map +0 -1
  909. package/docs/main/sequence-field/move-composition.md +0 -46
  910. package/lib/feature-libraries/sequence-field/relevantRemovedRoots.d.ts +0 -9
  911. package/lib/feature-libraries/sequence-field/relevantRemovedRoots.d.ts.map +0 -1
  912. package/lib/feature-libraries/sequence-field/relevantRemovedRoots.js +0 -46
  913. package/lib/feature-libraries/sequence-field/relevantRemovedRoots.js.map +0 -1
  914. package/src/feature-libraries/sequence-field/relevantRemovedRoots.ts +0 -57
@@ -1 +1 @@
1
- {"version":3,"file":"sharedTreeCore.js","sourceRoot":"","sources":["../../src/shared-tree-core/sharedTreeCore.ts"],"names":[],"mappings":"AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGH,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAcpF,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAK5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAG7E,OAAO,EAKN,gBAAgB,GAKhB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAEN,KAAK,EAGL,aAAa,EACb,aAAa,GACb,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAuC,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC9F,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,6BAA6B,EAAE,MAAM,kBAAkB,CAAC;AAC9E,OAAO,EAAE,oBAAoB,EAAgC,MAAM,wBAAwB,CAAC;AAE5F,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAGN,gBAAgB,GAChB,MAAM,oBAAoB,CAAC;AAI5B,OAAO,EACN,0CAA0C,EAC1C,oBAAoB,EACpB,wCAAwC,GAKxC,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAW/D;;GAEG;IAEU,cAAc;4BAD1B,aAAa;;;;sBAE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AM,YAAY,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;YAC/C,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;gBAChC,OAAO,SAAS,CAAC;YAClB,CAAC;YACD,IAAI,UAAU,GAAG,YAAY,CAAC;YAC9B,KAAK,MAAM,OAAO,IAAI,YAAY,EAAE,CAAC;gBACpC,MAAM,IAAI,GAAG,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;gBACvC,MAAM,CACL,IAAI,KAAK,SAAS,EAClB,KAAK,CAAC,6DAA6D,CACnE,CAAC;gBACF,UAAU,GAAG,IAAI,CAAC;YACnB,CAAC;YACD,OAAO,UAAU,CAAC;QACnB,CAAC;KACD,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IFluidLoadable, ITelemetryBaseLogger } from \"@fluidframework/core-interfaces\";\nimport { assert, fail, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport type { IChannelStorageService } from \"@fluidframework/datastore-definitions/internal\";\nimport type { ISnapshotTree } from \"@fluidframework/driver-definitions/internal\";\nimport type {\n\tIIdCompressor,\n\tSessionId,\n\tSessionSpaceCompressedId,\n} from \"@fluidframework/id-compressor\";\nimport type {\n\tIExperimentalIncrementalSummaryContext,\n\tIRuntimeMessageCollection,\n\tISummaryTreeWithStats,\n\tITelemetryContext,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport { SummaryTreeBuilder } from \"@fluidframework/runtime-utils/internal\";\nimport type {\n\tIChannelView,\n\tIFluidSerializer,\n} from \"@fluidframework/shared-object-base/internal\";\nimport { createChildLogger } from \"@fluidframework/telemetry-utils/internal\";\n\nimport type { CodecWriteOptions, DependentFormatVersion, IJsonCodec } from \"../codec/index.js\";\nimport {\n\ttype ChangeFamily,\n\ttype ChangeFamilyEditor,\n\ttype GraphCommit,\n\ttype RevisionTag,\n\tRevisionTagCodec,\n\ttype SchemaAndPolicy,\n\ttype SchemaPolicy,\n\ttype TaggedChange,\n\ttype TreeStoredSchemaRepository,\n} from \"../core/index.js\";\nimport {\n\ttype JsonCompatibleReadOnly,\n\tbrand,\n\ttype Breakable,\n\ttype WithBreakable,\n\tthrowIfBroken,\n\tbreakingClass,\n} from \"../util/index.js\";\n\nimport type { BranchId, SharedTreeBranch } from \"./branch.js\";\nimport { BranchCommitEnricher } from \"./branchCommitEnricher.js\";\nimport { type ChangeEnricherReadonlyCheckout, NoOpChangeEnricher } from \"./changeEnricher.js\";\nimport { DefaultResubmitMachine } from \"./defaultResubmitMachine.js\";\nimport { EditManager, minimumPossibleSequenceNumber } from \"./editManager.js\";\nimport { makeEditManagerCodec, type EditManagerCodecOptions } from \"./editManagerCodecs.js\";\nimport type { EditManagerFormatVersion, SeqNumber } from \"./editManagerFormatCommons.js\";\nimport { EditManagerSummarizer } from \"./editManagerSummarizer.js\";\nimport {\n\ttype MessageCodecOptions,\n\ttype MessageEncodingContext,\n\tmakeMessageCodec,\n} from \"./messageCodecs.js\";\nimport type { DecodedMessage } from \"./messageTypes.js\";\nimport type { ResubmitMachine } from \"./resubmitMachine.js\";\nimport type { MessageFormatVersion } from \"./messageFormat.js\";\nimport {\n\tminVersionToSharedTreeSummaryFormatVersion,\n\tsummarizablesTreeKey,\n\tsupportedSharedTreeSummaryFormatVersions,\n\ttype SharedTreeSummaryFormatVersion,\n\ttype Summarizable,\n\ttype SummaryElementParser,\n\ttype SummaryElementStringifier,\n} from \"./summaryTypes.js\";\nimport { VersionedSummarizer } from \"./versionedSummarizer.js\";\n\nexport interface ClonableSchemaAndPolicy extends SchemaAndPolicy {\n\tschema: TreeStoredSchemaRepository;\n}\n\nexport interface SharedTreeCoreOptionsInternal\n\textends CodecWriteOptions,\n\t\tEditManagerCodecOptions,\n\t\tMessageCodecOptions {}\n\n/**\n * Generic shared tree, which needs to be configured with indexes, field kinds and other configuration.\n */\n@breakingClass\nexport class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>\n\textends VersionedSummarizer<SharedTreeSummaryFormatVersion>\n\timplements WithBreakable, Summarizable\n{\n\tprivate readonly editManager: EditManager<TEditor, TChange, ChangeFamily<TEditor, TChange>>;\n\tprivate readonly summarizables: readonly [EditManagerSummarizer<TChange>, ...Summarizable[]];\n\t/**\n\t * The sequence number that this instance is at.\n\t * This number is artificial in that it is made up by this instance as opposed to being provided by the runtime.\n\t * Is `undefined` after (and only after) this instance is attached.\n\t */\n\tprivate detachedRevision: SeqNumber | undefined = minimumPossibleSequenceNumber;\n\n\t/**\n\t * Used to encode/decode messages sent to/received from the Fluid runtime.\n\t *\n\t * @remarks Since there is currently only one format, this can just be cached on the class.\n\t * With more write formats active, it may make sense to keep around the \"usual\" format codec\n\t * (the one for the current persisted configuration) and resolve codecs for different versions\n\t * as necessary (e.g. an upgrade op came in, or the configuration changed within the collab window\n\t * and an op needs to be interpreted which isn't written with the current configuration).\n\t */\n\tprivate readonly messageCodec: IJsonCodec<\n\t\tDecodedMessage<TChange>,\n\t\tunknown,\n\t\tunknown,\n\t\tMessageEncodingContext\n\t>;\n\n\tprivate readonly enrichers: Map<BranchId, EnricherState<TChange>> = new Map();\n\n\tpublic readonly mintRevisionTag: () => RevisionTag;\n\n\tprivate readonly schemaAndPolicy: ClonableSchemaAndPolicy;\n\n\t/**\n\t * @param summarizables - Summarizers for all indexes used by this tree\n\t * @param changeFamily - The change family\n\t * @param editManager - The edit manager\n\t * @param runtime - The IFluidDataStoreRuntime which contains the shared object\n\t * @param editor - Used to edit the state of the tree. Edits will be immediately applied locally to the tree.\n\t * If there is no transaction currently ongoing, then the edits will be submitted to Fluid immediately as well.\n\t */\n\tpublic constructor(\n\t\tpublic readonly breaker: Breakable,\n\t\tpublic readonly sharedObject: IChannelView & IFluidLoadable,\n\t\tpublic readonly serializer: IFluidSerializer,\n\t\tpublic readonly submitLocalMessage: (content: unknown, localOpMetadata?: unknown) => void,\n\t\tlogger: ITelemetryBaseLogger | undefined,\n\t\tsummarizables: readonly Summarizable[],\n\t\tprotected readonly changeFamily: ChangeFamily<TEditor, TChange>,\n\t\toptions: SharedTreeCoreOptionsInternal,\n\t\tchangeFormatVersionForEditManager: DependentFormatVersion<EditManagerFormatVersion>,\n\t\tchangeFormatVersionForMessage: DependentFormatVersion<MessageFormatVersion>,\n\t\tprotected readonly idCompressor: IIdCompressor,\n\t\tschema: TreeStoredSchemaRepository,\n\t\tschemaPolicy: SchemaPolicy,\n\t\tresubmitMachine?: ResubmitMachine<TChange>,\n\t\tenricher?: ChangeEnricherReadonlyCheckout<TChange>,\n\t\tpublic readonly getEditor: () => TEditor = () => this.getLocalBranch().editor,\n\t) {\n\t\tsuper(\n\t\t\tsummarizablesTreeKey,\n\t\t\tminVersionToSharedTreeSummaryFormatVersion(options.minVersionForCollab),\n\t\t\tsupportedSharedTreeSummaryFormatVersions,\n\t\t\ttrue /* supportPreVersioningFormat */,\n\t\t);\n\n\t\tthis.schemaAndPolicy = {\n\t\t\tschema,\n\t\t\tpolicy: schemaPolicy,\n\t\t};\n\n\t\tconst rebaseLogger = createChildLogger({\n\t\t\tlogger,\n\t\t\tnamespace: \"Rebase\",\n\t\t});\n\n\t\tthis.mintRevisionTag = () => this.idCompressor.generateCompressedId();\n\t\t/**\n\t\t * A random ID that uniquely identifies this client in the collab session.\n\t\t * This is sent alongside every op to identify which client the op originated from.\n\t\t * This is used rather than the Fluid client ID because the Fluid client ID is not stable across reconnections.\n\t\t */\n\t\tconst localSessionId = idCompressor.localSessionId;\n\t\tthis.editManager = new EditManager(\n\t\t\tchangeFamily,\n\t\t\tlocalSessionId,\n\t\t\tthis.mintRevisionTag,\n\t\t\t(branchId) => this.registerSharedBranch(branchId),\n\t\t\trebaseLogger,\n\t\t);\n\n\t\tthis.registerSharedBranch(\"main\");\n\n\t\tconst revisionTagCodec = new RevisionTagCodec(idCompressor);\n\t\tconst editManagerCodec = makeEditManagerCodec(\n\t\t\tthis.editManager.changeFamily.codecs,\n\t\t\tchangeFormatVersionForEditManager,\n\t\t\trevisionTagCodec,\n\t\t\toptions,\n\t\t);\n\t\tthis.summarizables = [\n\t\t\tnew EditManagerSummarizer(\n\t\t\t\tthis.editManager,\n\t\t\t\teditManagerCodec,\n\t\t\t\tthis.idCompressor,\n\t\t\t\toptions.minVersionForCollab,\n\t\t\t\tthis.schemaAndPolicy,\n\t\t\t),\n\t\t\t...summarizables,\n\t\t];\n\t\tassert(\n\t\t\tnew Set(this.summarizables.map((e) => e.key)).size === this.summarizables.length,\n\t\t\t0x350 /* Index summary element keys must be unique */,\n\t\t);\n\n\t\tthis.messageCodec = makeMessageCodec(\n\t\t\tchangeFamily.codecs,\n\t\t\tchangeFormatVersionForMessage,\n\t\t\tnew RevisionTagCodec(idCompressor),\n\t\t\toptions,\n\t\t);\n\n\t\tthis.registerSharedBranchForEditing(\n\t\t\t\"main\",\n\t\t\tenricher ?? new NoOpChangeEnricher(),\n\t\t\tresubmitMachine,\n\t\t);\n\t}\n\n\t// TODO: SharedObject's merging of the two summary methods into summarizeCore is not what we want here:\n\t// We might want to not subclass it, or override/reimplement most of its functionality.\n\tprotected summarizeInternal(props: {\n\t\tstringify: SummaryElementStringifier;\n\t\tfullTree?: boolean;\n\t\ttrackState?: boolean;\n\t\ttelemetryContext?: ITelemetryContext;\n\t\tincrementalSummaryContext?: IExperimentalIncrementalSummaryContext;\n\t\tbuilder: SummaryTreeBuilder;\n\t}): void {\n\t\tconst { stringify, fullTree, telemetryContext, incrementalSummaryContext, builder } =\n\t\t\tprops;\n\t\tconst summarizableBuilder = new SummaryTreeBuilder();\n\t\t// Merge the summaries of all summarizables together under a single ISummaryTree\n\t\tfor (const s of this.summarizables) {\n\t\t\t// Add the summarizable's path in the summary tree to the incremental summary context's\n\t\t\t// summary path, so that the summarizable can use it to generate incremental summaries.\n\t\t\tconst childIncrementalSummaryContext =\n\t\t\t\tincrementalSummaryContext === undefined\n\t\t\t\t\t? undefined\n\t\t\t\t\t: {\n\t\t\t\t\t\t\t...incrementalSummaryContext,\n\t\t\t\t\t\t\tsummaryPath: `${incrementalSummaryContext.summaryPath}/${summarizablesTreeKey}/${s.key}`,\n\t\t\t\t\t\t};\n\t\t\tsummarizableBuilder.addWithStats(\n\t\t\t\ts.key,\n\t\t\t\ts.summarize({\n\t\t\t\t\tstringify,\n\t\t\t\t\tfullTree,\n\t\t\t\t\ttelemetryContext,\n\t\t\t\t\tincrementalSummaryContext: childIncrementalSummaryContext,\n\t\t\t\t}),\n\t\t\t);\n\t\t}\n\t\tbuilder.addWithStats(summarizablesTreeKey, summarizableBuilder.getSummaryTree());\n\t}\n\n\tprotected async loadInternal(\n\t\tservices: IChannelStorageService,\n\t\tparse: SummaryElementParser,\n\t): Promise<void> {\n\t\tconst [editManagerSummarizer, ...summarizables] = this.summarizables;\n\t\tconst loadEditManager = this.loadSummarizable(editManagerSummarizer, services, parse);\n\t\tconst loadSummarizables = summarizables.map(async (s) =>\n\t\t\tthis.loadSummarizable(s, services, parse),\n\t\t);\n\n\t\tif (this.detachedRevision === undefined) {\n\t\t\tawait Promise.all([loadEditManager, ...loadSummarizables]);\n\t\t} else {\n\t\t\t// If we are detached but loading from a summary, then we need to update our detached revision to ensure that it is ahead of all detached revisions in the summary.\n\t\t\t// First, finish loading the edit manager so that we can inspect the sequence numbers of the commits on the trunk.\n\t\t\tawait loadEditManager;\n\n\t\t\tconst latestDetachedSequenceNumber = this.editManager.getLatestSequenceNumber();\n\t\t\t// When we load a summary for a tree that was never attached,\n\t\t\t// latestDetachedSequenceNumber is either undefined (no commits in summary) or negative (all commits in summary were made while detached).\n\t\t\t// We only need to update `this.detachedRevision` in the latter case.\n\t\t\tif (latestDetachedSequenceNumber !== undefined && latestDetachedSequenceNumber < 0) {\n\t\t\t\tthis.detachedRevision = latestDetachedSequenceNumber;\n\t\t\t}\n\t\t\tawait Promise.all(loadSummarizables);\n\t\t}\n\t}\n\n\t@throwIfBroken\n\tpublic summarizeCore(\n\t\tserializer: IFluidSerializer,\n\t\ttelemetryContext?: ITelemetryContext,\n\t\tincrementalSummaryContext?: IExperimentalIncrementalSummaryContext,\n\t\tfullTree?: boolean,\n\t): ISummaryTreeWithStats {\n\t\treturn this.summarize({\n\t\t\tstringify: (contents: unknown) =>\n\t\t\t\tserializer.stringify(contents, this.sharedObject.handle),\n\t\t\tfullTree,\n\t\t\ttelemetryContext,\n\t\t\tincrementalSummaryContext,\n\t\t});\n\t}\n\n\tpublic async loadCore(services: IChannelStorageService): Promise<void> {\n\t\tassert(\n\t\t\tthis.getLocalBranch().getHead() === this.editManager.getTrunkHead(\"main\"),\n\t\t\t0xaaa /* All local changes should be applied to the trunk before loading from summary */,\n\t\t);\n\t\tawait super.load(services, (contents) => this.serializer.parse(contents));\n\t}\n\n\tprivate registerSharedBranch(branchId: BranchId): void {\n\t\tthis.editManager.getLocalBranch(branchId).events.on(\"beforeChange\", (change) => {\n\t\t\tif (change.type === \"append\") {\n\t\t\t\tif (this.detachedRevision === undefined) {\n\t\t\t\t\t// Commit enrichment is only necessary for changes that will be submitted as ops, and changes issued while detached are not submitted.\n\t\t\t\t\tthis.getCommitEnricher(branchId).processChange(change);\n\t\t\t\t}\n\n\t\t\t\tfor (const commit of change.newCommits) {\n\t\t\t\t\tthis.submitCommit(branchId, commit, this.schemaAndPolicy, false);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\tprivate async loadSummarizable(\n\t\tsummarizable: Summarizable,\n\t\tservices: IChannelStorageService,\n\t\tparse: SummaryElementParser,\n\t): Promise<void> {\n\t\treturn summarizable.load(\n\t\t\tscopeStorageService(services, summarizablesTreeKey, summarizable.key),\n\t\t\tparse,\n\t\t);\n\t}\n\n\t/**\n\t * Submits an op to the Fluid runtime containing the given commit\n\t * @param commit - the commit to submit\n\t * @returns the submitted commit. This is undefined if the underlying `SharedObject` is not attached,\n\t * and may differ from `commit` due to enrichments like detached tree refreshers.\n\t */\n\tprotected submitCommit(\n\t\tbranchId: BranchId,\n\t\tcommit: GraphCommit<TChange>,\n\t\tschemaAndPolicy: ClonableSchemaAndPolicy,\n\t\tisResubmit: boolean,\n\t): void {\n\t\tassert(\n\t\t\tthis.sharedObject.isAttached() === (this.detachedRevision === undefined),\n\t\t\t0x95a /* Detached revision should only be set when not attached */,\n\t\t);\n\n\t\tconst enrichedCommit =\n\t\t\tthis.detachedRevision === undefined && !isResubmit\n\t\t\t\t? this.getCommitEnricher(branchId).enrich(commit)\n\t\t\t\t: commit;\n\n\t\t// Edits submitted before the first attach are treated as sequenced because they will be included\n\t\t// in the attach summary that is uploaded to the service.\n\t\t// Until this attach workflow happens, this instance essentially behaves as a centralized data structure.\n\t\tif (this.detachedRevision !== undefined) {\n\t\t\tconst newRevision: SeqNumber = brand((this.detachedRevision as number) + 1);\n\t\t\tthis.detachedRevision = newRevision;\n\t\t\tthis.editManager.addSequencedChanges(\n\t\t\t\t[enrichedCommit],\n\t\t\t\tthis.editManager.localSessionId,\n\t\t\t\tnewRevision,\n\t\t\t\tthis.detachedRevision,\n\t\t\t\tbranchId,\n\t\t\t);\n\t\t\tthis.editManager.advanceMinimumSequenceNumber(newRevision, false);\n\t\t\treturn undefined;\n\t\t}\n\n\t\tthis.submitMessage(\n\t\t\t{\n\t\t\t\ttype: \"commit\",\n\t\t\t\tcommit: enrichedCommit,\n\t\t\t\tsessionId: this.editManager.localSessionId,\n\t\t\t\tbranchId,\n\t\t\t},\n\t\t\tschemaAndPolicy,\n\t\t);\n\n\t\tthis.getResubmitMachine(branchId).onCommitSubmitted(enrichedCommit);\n\t}\n\n\tprotected submitBranchCreation(branchId: BranchId): void {\n\t\tthis.submitMessage(\n\t\t\t{ type: \"branch\", sessionId: this.editManager.localSessionId, branchId },\n\t\t\tthis.schemaAndPolicy,\n\t\t);\n\t}\n\n\tprivate submitMessage(\n\t\tmessage: DecodedMessage<TChange>,\n\t\tschemaAndPolicy: ClonableSchemaAndPolicy,\n\t): void {\n\t\tconst encodedMessage = this.messageCodec.encode(message, {\n\t\t\tidCompressor: this.idCompressor,\n\t\t\tschema: schemaAndPolicy,\n\t\t});\n\t\tthis.submitLocalMessage(encodedMessage, {\n\t\t\t// Clone the schema to ensure that during resubmit the schema has not been mutated by later changes\n\t\t\tschema: schemaAndPolicy.schema.clone(),\n\t\t\tpolicy: schemaAndPolicy.policy,\n\t\t});\n\t}\n\n\t/**\n\t * Process a bunch of messages from the runtime. SharedObject will call this method with a bunch of messages.\n\t */\n\tpublic processMessagesCore(messagesCollection: IRuntimeMessageCollection): void {\n\t\tconst { envelope, local, messagesContent } = messagesCollection;\n\t\tconst commits: GraphCommit<TChange>[] = [];\n\t\tlet messagesSessionId: SessionId | undefined;\n\t\tlet branchId: BranchId | undefined;\n\n\t\tconst processBunch = (branch: BranchId): void => {\n\t\t\tassert(messagesSessionId !== undefined, 0xada /* Messages must have a session ID */);\n\t\t\tthis.processCommits(\n\t\t\t\tmessagesSessionId,\n\t\t\t\tbrand(envelope.sequenceNumber),\n\t\t\t\tbrand(envelope.referenceSequenceNumber),\n\t\t\t\tlocal,\n\t\t\t\tbranch,\n\t\t\t\tcommits,\n\t\t\t);\n\n\t\t\tcommits.length = 0;\n\t\t\tbranchId = undefined;\n\t\t};\n\n\t\t// Get a list of all the commits from the messages.\n\t\tfor (const messageContent of messagesContent) {\n\t\t\t// Empty context object is passed in, as our decode function is schema-agnostic.\n\t\t\tconst message = this.messageCodec.decode(messageContent.contents, {\n\t\t\t\tidCompressor: this.idCompressor,\n\t\t\t});\n\n\t\t\tif (messagesSessionId !== undefined) {\n\t\t\t\tassert(\n\t\t\t\t\tmessagesSessionId === message.sessionId,\n\t\t\t\t\t0xad9 /* All messages in a bunch must have the same session ID */,\n\t\t\t\t);\n\t\t\t}\n\t\t\tmessagesSessionId = message.sessionId;\n\n\t\t\tconst type = message.type;\n\t\t\tswitch (type) {\n\t\t\t\tcase \"commit\": {\n\t\t\t\t\tif (branchId !== undefined && message.branchId !== branchId) {\n\t\t\t\t\t\tprocessBunch(branchId);\n\t\t\t\t\t}\n\n\t\t\t\t\tbranchId = message.branchId;\n\t\t\t\t\tcommits.push(message.commit);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"branch\": {\n\t\t\t\t\tif (branchId !== undefined) {\n\t\t\t\t\t\tprocessBunch(branchId);\n\t\t\t\t\t}\n\t\t\t\t\tthis.editManager.sequenceBranchCreation(\n\t\t\t\t\t\tmessagesSessionId,\n\t\t\t\t\t\tbrand(envelope.referenceSequenceNumber),\n\t\t\t\t\t\tmessage.branchId,\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\tunreachableCase(type);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (branchId !== undefined) {\n\t\t\tprocessBunch(branchId);\n\t\t}\n\n\t\tthis.editManager.advanceMinimumSequenceNumber(brand(envelope.minimumSequenceNumber));\n\t}\n\n\tprivate processCommits(\n\t\tsessionId: SessionId,\n\t\tsequenceNumber: SeqNumber,\n\t\treferenceSequenceNumber: SeqNumber,\n\t\tisLocal: boolean,\n\t\tbranchId: BranchId,\n\t\tcommits: readonly GraphCommit<TChange>[],\n\t): void {\n\t\tthis.editManager.addSequencedChanges(\n\t\t\tcommits,\n\t\t\tsessionId,\n\t\t\tsequenceNumber,\n\t\t\treferenceSequenceNumber,\n\t\t\tbranchId,\n\t\t);\n\n\t\t// Update the resubmit machine for each commit applied.\n\t\tfor (const commit of commits) {\n\t\t\tthis.tryGetResubmitMachine(branchId)?.onSequencedCommitApplied(commit.revision, isLocal);\n\t\t}\n\t}\n\n\tpublic getLocalBranch(): SharedTreeBranch<TEditor, TChange> {\n\t\treturn this.editManager.getLocalBranch(\"main\");\n\t}\n\n\tpublic getSharedBranchIds(): string[] {\n\t\treturn this.editManager\n\t\t\t.getSharedBranchIds()\n\t\t\t.filter((id): id is SessionSpaceCompressedId => id !== \"main\")\n\t\t\t.map((id) => this.idCompressor.decompress(id));\n\t}\n\tpublic createSharedBranch(): string {\n\t\tconst branchId = this.idCompressor.generateCompressedId();\n\t\tthis.addBranch(branchId);\n\t\tthis.submitBranchCreation(branchId);\n\t\treturn this.idCompressor.decompress(branchId);\n\t}\n\n\tprotected addBranch(branchId: BranchId): void {\n\t\tthis.editManager.addNewBranch(branchId);\n\t}\n\n\tpublic getSharedBranch(branchId: BranchId): SharedTreeBranch<TEditor, TChange> {\n\t\treturn this.editManager.getLocalBranch(branchId);\n\t}\n\n\tpublic didAttach(): void {\n\t\tthis.detachedRevision = undefined;\n\t}\n\n\tpublic reSubmitCore(content: JsonCompatibleReadOnly, localOpMetadata: unknown): void {\n\t\t// Empty context object is passed in, as our decode function is schema-agnostic.\n\t\tconst message = this.messageCodec.decode(this.serializer.decode(content), {\n\t\t\tidCompressor: this.idCompressor,\n\t\t});\n\n\t\tconst type = message.type;\n\t\tswitch (type) {\n\t\t\tcase \"commit\": {\n\t\t\t\tconst {\n\t\t\t\t\tcommit: { revision },\n\t\t\t\t\tbranchId,\n\t\t\t\t} = message;\n\n\t\t\t\tconst resubmitMachine = this.getResubmitMachine(branchId);\n\n\t\t\t\tconst getLocalCommits = (): GraphCommit<TChange>[] => {\n\t\t\t\t\tconst localCommits = this.editManager.getLocalCommits(branchId);\n\t\t\t\t\tconst revisionIndex = localCommits.findIndex((c) => c.revision === revision);\n\t\t\t\t\tassert(revisionIndex >= 0, 0xbdb /* revision must exist in local commits */);\n\t\t\t\t\treturn localCommits.slice(revisionIndex);\n\t\t\t\t};\n\n\t\t\t\tassert(\n\t\t\t\t\tisClonableSchemaPolicy(localOpMetadata),\n\t\t\t\t\t0x95e /* Local metadata must contain schema and policy. */,\n\t\t\t\t);\n\n\t\t\t\tconst enrichedCommit = resubmitMachine.getEnrichedCommit(revision, getLocalCommits);\n\t\t\t\tif (enrichedCommit !== undefined) {\n\t\t\t\t\tthis.submitCommit(branchId, enrichedCommit, localOpMetadata, true);\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"branch\": {\n\t\t\t\tthis.submitBranchCreation(message.branchId);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tunreachableCase(type);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic rollback(content: JsonCompatibleReadOnly, localOpMetadata: unknown): void {\n\t\t// Empty context object is passed in, as our decode function is schema-agnostic.\n\t\tconst message = this.messageCodec.decode(this.serializer.decode(content), {\n\t\t\tidCompressor: this.idCompressor,\n\t\t});\n\n\t\tconst type = message.type;\n\t\tswitch (type) {\n\t\t\tcase \"commit\": {\n\t\t\t\tconst {\n\t\t\t\t\tcommit: { revision },\n\t\t\t\t\tbranchId,\n\t\t\t\t} = message;\n\t\t\t\tconst branch = this.editManager.getLocalBranch(branchId);\n\t\t\t\tconst head = branch.getHead();\n\t\t\t\tassert(head.revision === revision, 0xc6b /* Can only rollback latest commit */);\n\t\t\t\tconst newHead = head.parent ?? fail(0xc6c /* must have parent */);\n\t\t\t\tbranch.removeAfter(newHead);\n\t\t\t\tthis.getResubmitMachine(branchId).onCommitRollback(head);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"branch\": {\n\t\t\t\tthis.editManager.removeBranch(message.branchId);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tunreachableCase(type);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic applyStashedOp(content: JsonCompatibleReadOnly): void {\n\t\t// Empty context object is passed in, as our decode function is schema-agnostic.\n\t\tconst message = this.messageCodec.decode(this.serializer.decode(content), {\n\t\t\tidCompressor: this.idCompressor,\n\t\t});\n\n\t\tconst type = message.type;\n\t\tswitch (type) {\n\t\t\tcase \"commit\": {\n\t\t\t\tconst {\n\t\t\t\t\tcommit: { revision, change },\n\t\t\t\t\tbranchId,\n\t\t\t\t} = message;\n\t\t\t\tthis.editManager.getLocalBranch(branchId).apply({ change, revision });\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"branch\": {\n\t\t\t\tthis.editManager.addNewBranch(message.branchId);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tunreachableCase(type);\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected registerSharedBranchForEditing(\n\t\tbranchId: BranchId,\n\t\tenricher: ChangeEnricherReadonlyCheckout<TChange>,\n\t\tresubmitMachine?: ResubmitMachine<TChange>,\n\t): void {\n\t\tconst changeEnricher = enricher ?? new NoOpChangeEnricher();\n\t\tconst commitEnricher = new BranchCommitEnricher(this.changeFamily.rebaser, changeEnricher);\n\t\tassert(!this.enrichers.has(branchId), 0xc6d /* Branch already registered */);\n\t\tthis.enrichers.set(branchId, {\n\t\t\tenricher: commitEnricher,\n\t\t\tresubmitMachine:\n\t\t\t\tresubmitMachine ??\n\t\t\t\tnew DefaultResubmitMachine(\n\t\t\t\t\t(change: TaggedChange<TChange>) =>\n\t\t\t\t\t\tthis.changeFamily.rebaser.invert(change, true, this.mintRevisionTag()),\n\t\t\t\t\tchangeEnricher,\n\t\t\t\t),\n\t\t});\n\t}\n\n\tprivate getResubmitMachine(branchId: BranchId): ResubmitMachine<TChange> {\n\t\treturn this.getEnricherState(branchId).resubmitMachine;\n\t}\n\n\tprivate tryGetResubmitMachine(branchId: BranchId): ResubmitMachine<TChange> | undefined {\n\t\treturn this.tryGetEnricherState(branchId)?.resubmitMachine;\n\t}\n\n\tpublic getCommitEnricher(branchId: BranchId): BranchCommitEnricher<TChange> {\n\t\treturn this.getEnricherState(branchId).enricher;\n\t}\n\n\tprivate getEnricherState(branchId: BranchId): EnricherState<TChange> {\n\t\treturn (\n\t\t\tthis.tryGetEnricherState(branchId) ??\n\t\t\tfail(0xc6e /* Expected to have a resubmit machine for this branch */)\n\t\t);\n\t}\n\n\tprivate tryGetEnricherState(branchId: BranchId): EnricherState<TChange> | undefined {\n\t\treturn this.enrichers.get(branchId);\n\t}\n}\n\ninterface EnricherState<TChange> {\n\treadonly enricher: BranchCommitEnricher<TChange>;\n\treadonly resubmitMachine: ResubmitMachine<TChange>;\n}\n\nfunction isClonableSchemaPolicy(\n\tmaybeSchemaPolicy: unknown,\n): maybeSchemaPolicy is ClonableSchemaAndPolicy {\n\tconst schemaAndPolicy = maybeSchemaPolicy as ClonableSchemaAndPolicy;\n\treturn schemaAndPolicy.schema !== undefined && schemaAndPolicy.policy !== undefined;\n}\n\n/**\n * Compose an {@link IChannelStorageService} which prefixes all paths before forwarding them to the original service\n */\nfunction scopeStorageService(\n\tservice: IChannelStorageService,\n\t...pathElements: string[]\n): IChannelStorageService {\n\tconst scope = `${pathElements.join(\"/\")}/`;\n\n\treturn {\n\t\tasync readBlob(path: string): Promise<ArrayBufferLike> {\n\t\t\treturn service.readBlob(`${scope}${path}`);\n\t\t},\n\t\tasync contains(path) {\n\t\t\treturn service.contains(`${scope}${path}`);\n\t\t},\n\t\tasync list(path) {\n\t\t\treturn service.list(`${scope}${path}`);\n\t\t},\n\t\tgetSnapshotTree(): ISnapshotTree | undefined {\n\t\t\tconst snapshotTree = service.getSnapshotTree();\n\t\t\tif (snapshotTree === undefined) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tlet scopedTree = snapshotTree;\n\t\t\tfor (const element of pathElements) {\n\t\t\t\tconst tree = scopedTree.trees[element];\n\t\t\t\tassert(\n\t\t\t\t\ttree !== undefined,\n\t\t\t\t\t0xc20 /* snapshot tree not found for one of tree's summarizables */,\n\t\t\t\t);\n\t\t\t\tscopedTree = tree;\n\t\t\t}\n\t\t\treturn scopedTree;\n\t\t},\n\t};\n}\n"]}
1
+ {"version":3,"file":"sharedTreeCore.js","sourceRoot":"","sources":["../../src/shared-tree-core/sharedTreeCore.ts"],"names":[],"mappings":"AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGH,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAcpF,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAK5E,OAAO,EAAE,iBAAiB,EAAE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. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IFluidLoadable, ITelemetryBaseLogger } from \"@fluidframework/core-interfaces\";\nimport { assert, fail, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport type { IChannelStorageService } from \"@fluidframework/datastore-definitions/internal\";\nimport type { ISnapshotTree } from \"@fluidframework/driver-definitions/internal\";\nimport type {\n\tIIdCompressor,\n\tSessionId,\n\tSessionSpaceCompressedId,\n} from \"@fluidframework/id-compressor\";\nimport type {\n\tIExperimentalIncrementalSummaryContext,\n\tIRuntimeMessageCollection,\n\tISummaryTreeWithStats,\n\tITelemetryContext,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport { SummaryTreeBuilder } from \"@fluidframework/runtime-utils/internal\";\nimport type {\n\tIChannelView,\n\tIFluidSerializer,\n} from \"@fluidframework/shared-object-base/internal\";\nimport { createChildLogger } from \"@fluidframework/telemetry-utils/internal\";\n\nimport type { CodecWriteOptions, DependentFormatVersion, IJsonCodec } from \"../codec/index.js\";\nimport {\n\ttype ChangeFamily,\n\ttype ChangeFamilyEditor,\n\ttype GraphCommit,\n\ttype RevisionTag,\n\tRevisionTagCodec,\n\ttype SchemaAndPolicy,\n\ttype SchemaPolicy,\n\ttype TaggedChange,\n\ttype TreeStoredSchemaRepository,\n} from \"../core/index.js\";\nimport {\n\ttype JsonCompatibleReadOnly,\n\tbrand,\n\ttype Breakable,\n\ttype WithBreakable,\n\tthrowIfBroken,\n\tbreakingClass,\n} from \"../util/index.js\";\n\nimport type { BranchId, SharedTreeBranch } from \"./branch.js\";\nimport { BranchCommitEnricher } from \"./branchCommitEnricher.js\";\nimport { type ChangeEnricherReadonlyCheckout, NoOpChangeEnricher } from \"./changeEnricher.js\";\nimport { DefaultResubmitMachine } from \"./defaultResubmitMachine.js\";\nimport { EditManager, minimumPossibleSequenceNumber } from \"./editManager.js\";\nimport { makeEditManagerCodec, type EditManagerCodecOptions } from \"./editManagerCodecs.js\";\nimport type { EditManagerFormatVersion, SeqNumber } from \"./editManagerFormatCommons.js\";\nimport { EditManagerSummarizer } from \"./editManagerSummarizer.js\";\nimport {\n\ttype MessageCodecOptions,\n\ttype MessageEncodingContext,\n\tmakeMessageCodec,\n} from \"./messageCodecs.js\";\nimport type { DecodedMessage } from \"./messageTypes.js\";\nimport type { ResubmitMachine } from \"./resubmitMachine.js\";\nimport type { MessageFormatVersion } from \"./messageFormat.js\";\nimport {\n\tminVersionToSharedTreeSummaryFormatVersion,\n\tsummarizablesTreeKey,\n\tsupportedSharedTreeSummaryFormatVersions,\n\ttype SharedTreeSummaryFormatVersion,\n\ttype Summarizable,\n\ttype SummaryElementParser,\n\ttype SummaryElementStringifier,\n} from \"./summaryTypes.js\";\nimport { VersionedSummarizer } from \"./versionedSummarizer.js\";\n\nexport interface ClonableSchemaAndPolicy extends SchemaAndPolicy {\n\tschema: TreeStoredSchemaRepository;\n}\n\nexport interface SharedTreeCoreOptionsInternal\n\textends CodecWriteOptions,\n\t\tEditManagerCodecOptions,\n\t\tMessageCodecOptions {\n\tcanMakeDetachedRootEdits: boolean;\n}\n\n/**\n * Generic shared tree, which needs to be configured with indexes, field kinds and other configuration.\n */\n@breakingClass\nexport class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>\n\textends VersionedSummarizer<SharedTreeSummaryFormatVersion>\n\timplements WithBreakable, Summarizable\n{\n\tprivate readonly editManager: EditManager<TEditor, TChange, ChangeFamily<TEditor, TChange>>;\n\tprivate readonly summarizables: readonly [EditManagerSummarizer<TChange>, ...Summarizable[]];\n\t/**\n\t * The sequence number that this instance is at.\n\t * This number is artificial in that it is made up by this instance as opposed to being provided by the runtime.\n\t * Is `undefined` after (and only after) this instance is attached.\n\t */\n\tprivate detachedRevision: SeqNumber | undefined = minimumPossibleSequenceNumber;\n\n\t/**\n\t * Used to encode/decode messages sent to/received from the Fluid runtime.\n\t *\n\t * @remarks Since there is currently only one format, this can just be cached on the class.\n\t * With more write formats active, it may make sense to keep around the \"usual\" format codec\n\t * (the one for the current persisted configuration) and resolve codecs for different versions\n\t * as necessary (e.g. an upgrade op came in, or the configuration changed within the collab window\n\t * and an op needs to be interpreted which isn't written with the current configuration).\n\t */\n\tprivate readonly messageCodec: IJsonCodec<\n\t\tDecodedMessage<TChange>,\n\t\tunknown,\n\t\tunknown,\n\t\tMessageEncodingContext\n\t>;\n\n\tprivate readonly enrichers: Map<BranchId, EnricherState<TChange>> = new Map();\n\n\tpublic readonly mintRevisionTag: () => RevisionTag;\n\n\tprivate readonly schemaAndPolicy: ClonableSchemaAndPolicy;\n\n\t/**\n\t * @param summarizables - Summarizers for all indexes used by this tree\n\t * @param changeFamily - The change family\n\t * @param editManager - The edit manager\n\t * @param runtime - The IFluidDataStoreRuntime which contains the shared object\n\t * @param editor - Used to edit the state of the tree. Edits will be immediately applied locally to the tree.\n\t * If there is no transaction currently ongoing, then the edits will be submitted to Fluid immediately as well.\n\t */\n\tpublic constructor(\n\t\tpublic readonly breaker: Breakable,\n\t\tpublic readonly sharedObject: IChannelView & IFluidLoadable,\n\t\tpublic readonly serializer: IFluidSerializer,\n\t\tpublic readonly submitLocalMessage: (content: unknown, localOpMetadata?: unknown) => void,\n\t\tlogger: ITelemetryBaseLogger | undefined,\n\t\tsummarizables: readonly Summarizable[],\n\t\tprotected readonly changeFamily: ChangeFamily<TEditor, TChange>,\n\t\toptions: SharedTreeCoreOptionsInternal,\n\t\tchangeFormatVersionForEditManager: DependentFormatVersion<EditManagerFormatVersion>,\n\t\tchangeFormatVersionForMessage: DependentFormatVersion<MessageFormatVersion>,\n\t\tprotected readonly idCompressor: IIdCompressor,\n\t\tschema: TreeStoredSchemaRepository,\n\t\tschemaPolicy: SchemaPolicy,\n\t\tresubmitMachine?: ResubmitMachine<TChange>,\n\t\tenricher?: ChangeEnricherReadonlyCheckout<TChange>,\n\t\tpublic readonly getEditor: () => TEditor = () => this.getLocalBranch().editor,\n\t) {\n\t\tsuper(\n\t\t\tsummarizablesTreeKey,\n\t\t\tminVersionToSharedTreeSummaryFormatVersion(options.minVersionForCollab),\n\t\t\tsupportedSharedTreeSummaryFormatVersions,\n\t\t\ttrue /* supportPreVersioningFormat */,\n\t\t);\n\n\t\tthis.schemaAndPolicy = {\n\t\t\tschema,\n\t\t\tpolicy: schemaPolicy,\n\t\t};\n\n\t\tconst rebaseLogger = createChildLogger({\n\t\t\tlogger,\n\t\t\tnamespace: \"Rebase\",\n\t\t});\n\n\t\tthis.mintRevisionTag = () => this.idCompressor.generateCompressedId();\n\t\t/**\n\t\t * A random ID that uniquely identifies this client in the collab session.\n\t\t * This is sent alongside every op to identify which client the op originated from.\n\t\t * This is used rather than the Fluid client ID because the Fluid client ID is not stable across reconnections.\n\t\t */\n\t\tconst localSessionId = idCompressor.localSessionId;\n\t\tthis.editManager = new EditManager(\n\t\t\tchangeFamily,\n\t\t\tlocalSessionId,\n\t\t\tthis.mintRevisionTag,\n\t\t\t(branchId) => this.registerSharedBranch(branchId),\n\t\t\toptions,\n\t\t\trebaseLogger,\n\t\t);\n\n\t\tthis.registerSharedBranch(\"main\");\n\n\t\tconst revisionTagCodec = new RevisionTagCodec(idCompressor);\n\t\tconst editManagerCodec = makeEditManagerCodec(\n\t\t\tthis.editManager.changeFamily.codecs,\n\t\t\tchangeFormatVersionForEditManager,\n\t\t\trevisionTagCodec,\n\t\t\toptions,\n\t\t);\n\t\tthis.summarizables = [\n\t\t\tnew EditManagerSummarizer(\n\t\t\t\tthis.editManager,\n\t\t\t\teditManagerCodec,\n\t\t\t\tthis.idCompressor,\n\t\t\t\toptions.minVersionForCollab,\n\t\t\t\tthis.schemaAndPolicy,\n\t\t\t),\n\t\t\t...summarizables,\n\t\t];\n\t\tassert(\n\t\t\tnew Set(this.summarizables.map((e) => e.key)).size === this.summarizables.length,\n\t\t\t0x350 /* Index summary element keys must be unique */,\n\t\t);\n\n\t\tthis.messageCodec = makeMessageCodec(\n\t\t\tchangeFamily.codecs,\n\t\t\tchangeFormatVersionForMessage,\n\t\t\tnew RevisionTagCodec(idCompressor),\n\t\t\toptions,\n\t\t);\n\n\t\tthis.registerSharedBranchForEditing(\n\t\t\t\"main\",\n\t\t\tenricher ?? new NoOpChangeEnricher(),\n\t\t\tresubmitMachine,\n\t\t);\n\t}\n\n\t// TODO: SharedObject's merging of the two summary methods into summarizeCore is not what we want here:\n\t// We might want to not subclass it, or override/reimplement most of its functionality.\n\tprotected summarizeInternal(props: {\n\t\tstringify: SummaryElementStringifier;\n\t\tfullTree?: boolean;\n\t\ttrackState?: boolean;\n\t\ttelemetryContext?: ITelemetryContext;\n\t\tincrementalSummaryContext?: IExperimentalIncrementalSummaryContext;\n\t\tbuilder: SummaryTreeBuilder;\n\t}): void {\n\t\tconst { stringify, fullTree, telemetryContext, incrementalSummaryContext, builder } =\n\t\t\tprops;\n\t\tconst summarizableBuilder = new SummaryTreeBuilder();\n\t\t// Merge the summaries of all summarizables together under a single ISummaryTree\n\t\tfor (const s of this.summarizables) {\n\t\t\t// Add the summarizable's path in the summary tree to the incremental summary context's\n\t\t\t// summary path, so that the summarizable can use it to generate incremental summaries.\n\t\t\tconst childIncrementalSummaryContext =\n\t\t\t\tincrementalSummaryContext === undefined\n\t\t\t\t\t? undefined\n\t\t\t\t\t: {\n\t\t\t\t\t\t\t...incrementalSummaryContext,\n\t\t\t\t\t\t\tsummaryPath: `${incrementalSummaryContext.summaryPath}/${summarizablesTreeKey}/${s.key}`,\n\t\t\t\t\t\t};\n\t\t\tsummarizableBuilder.addWithStats(\n\t\t\t\ts.key,\n\t\t\t\ts.summarize({\n\t\t\t\t\tstringify,\n\t\t\t\t\tfullTree,\n\t\t\t\t\ttelemetryContext,\n\t\t\t\t\tincrementalSummaryContext: childIncrementalSummaryContext,\n\t\t\t\t}),\n\t\t\t);\n\t\t}\n\t\tbuilder.addWithStats(summarizablesTreeKey, summarizableBuilder.getSummaryTree());\n\t}\n\n\tprotected async loadInternal(\n\t\tservices: IChannelStorageService,\n\t\tparse: SummaryElementParser,\n\t): Promise<void> {\n\t\tconst [editManagerSummarizer, ...summarizables] = this.summarizables;\n\t\tconst loadEditManager = this.loadSummarizable(editManagerSummarizer, services, parse);\n\t\tconst loadSummarizables = summarizables.map(async (s) =>\n\t\t\tthis.loadSummarizable(s, services, parse),\n\t\t);\n\n\t\tif (this.detachedRevision === undefined) {\n\t\t\tawait Promise.all([loadEditManager, ...loadSummarizables]);\n\t\t} else {\n\t\t\t// If we are detached but loading from a summary, then we need to update our detached revision to ensure that it is ahead of all detached revisions in the summary.\n\t\t\t// First, finish loading the edit manager so that we can inspect the sequence numbers of the commits on the trunk.\n\t\t\tawait loadEditManager;\n\n\t\t\tconst latestDetachedSequenceNumber = this.editManager.getLatestSequenceNumber();\n\t\t\t// When we load a summary for a tree that was never attached,\n\t\t\t// latestDetachedSequenceNumber is either undefined (no commits in summary) or negative (all commits in summary were made while detached).\n\t\t\t// We only need to update `this.detachedRevision` in the latter case.\n\t\t\tif (latestDetachedSequenceNumber !== undefined && latestDetachedSequenceNumber < 0) {\n\t\t\t\tthis.detachedRevision = latestDetachedSequenceNumber;\n\t\t\t}\n\t\t\tawait Promise.all(loadSummarizables);\n\t\t}\n\t}\n\n\t@throwIfBroken\n\tpublic summarizeCore(\n\t\tserializer: IFluidSerializer,\n\t\ttelemetryContext?: ITelemetryContext,\n\t\tincrementalSummaryContext?: IExperimentalIncrementalSummaryContext,\n\t\tfullTree?: boolean,\n\t): ISummaryTreeWithStats {\n\t\treturn this.summarize({\n\t\t\tstringify: (contents: unknown) =>\n\t\t\t\tserializer.stringify(contents, this.sharedObject.handle),\n\t\t\tfullTree,\n\t\t\ttelemetryContext,\n\t\t\tincrementalSummaryContext,\n\t\t});\n\t}\n\n\tpublic async loadCore(services: IChannelStorageService): Promise<void> {\n\t\tassert(\n\t\t\tthis.getLocalBranch().getHead() === this.editManager.getTrunkHead(\"main\"),\n\t\t\t0xaaa /* All local changes should be applied to the trunk before loading from summary */,\n\t\t);\n\t\tawait super.load(services, (contents) => this.serializer.parse(contents));\n\t}\n\n\tprivate registerSharedBranch(branchId: BranchId): void {\n\t\tthis.editManager.getLocalBranch(branchId).events.on(\"beforeChange\", (change) => {\n\t\t\tif (change.type === \"append\") {\n\t\t\t\tif (this.detachedRevision === undefined) {\n\t\t\t\t\t// Commit enrichment is only necessary for changes that will be submitted as ops, and changes issued while detached are not submitted.\n\t\t\t\t\tthis.getCommitEnricher(branchId).processChange(change);\n\t\t\t\t}\n\n\t\t\t\tfor (const commit of change.newCommits) {\n\t\t\t\t\tthis.submitCommit(branchId, commit, this.schemaAndPolicy, false);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\tprivate async loadSummarizable(\n\t\tsummarizable: Summarizable,\n\t\tservices: IChannelStorageService,\n\t\tparse: SummaryElementParser,\n\t): Promise<void> {\n\t\treturn summarizable.load(\n\t\t\tscopeStorageService(services, summarizablesTreeKey, summarizable.key),\n\t\t\tparse,\n\t\t);\n\t}\n\n\t/**\n\t * Submits an op to the Fluid runtime containing the given commit\n\t * @param commit - the commit to submit\n\t * @returns the submitted commit. This is undefined if the underlying `SharedObject` is not attached,\n\t * and may differ from `commit` due to enrichments like detached tree refreshers.\n\t */\n\tprotected submitCommit(\n\t\tbranchId: BranchId,\n\t\tcommit: GraphCommit<TChange>,\n\t\tschemaAndPolicy: ClonableSchemaAndPolicy,\n\t\tisResubmit: boolean,\n\t): void {\n\t\tassert(\n\t\t\tthis.sharedObject.isAttached() === (this.detachedRevision === undefined),\n\t\t\t0x95a /* Detached revision should only be set when not attached */,\n\t\t);\n\n\t\tconst enrichedCommit =\n\t\t\tthis.detachedRevision === undefined && !isResubmit\n\t\t\t\t? this.getCommitEnricher(branchId).enrich(commit)\n\t\t\t\t: commit;\n\n\t\t// Edits submitted before the first attach are treated as sequenced because they will be included\n\t\t// in the attach summary that is uploaded to the service.\n\t\t// Until this attach workflow happens, this instance essentially behaves as a centralized data structure.\n\t\tif (this.detachedRevision !== undefined) {\n\t\t\tconst newRevision: SeqNumber = brand((this.detachedRevision as number) + 1);\n\t\t\tthis.detachedRevision = newRevision;\n\t\t\tthis.editManager.addSequencedChanges(\n\t\t\t\t[enrichedCommit],\n\t\t\t\tthis.editManager.localSessionId,\n\t\t\t\tnewRevision,\n\t\t\t\tthis.detachedRevision,\n\t\t\t\tbranchId,\n\t\t\t);\n\t\t\tthis.editManager.advanceMinimumSequenceNumber(newRevision, false);\n\t\t\treturn undefined;\n\t\t}\n\n\t\tthis.submitMessage(\n\t\t\t{\n\t\t\t\ttype: \"commit\",\n\t\t\t\tcommit: enrichedCommit,\n\t\t\t\tsessionId: this.editManager.localSessionId,\n\t\t\t\tbranchId,\n\t\t\t},\n\t\t\tschemaAndPolicy,\n\t\t);\n\n\t\tthis.getResubmitMachine(branchId).onCommitSubmitted(enrichedCommit);\n\t}\n\n\tprotected submitBranchCreation(branchId: BranchId): void {\n\t\tthis.submitMessage(\n\t\t\t{ type: \"branch\", sessionId: this.editManager.localSessionId, branchId },\n\t\t\tthis.schemaAndPolicy,\n\t\t);\n\t}\n\n\tprivate submitMessage(\n\t\tmessage: DecodedMessage<TChange>,\n\t\tschemaAndPolicy: ClonableSchemaAndPolicy,\n\t): void {\n\t\tconst encodedMessage = this.messageCodec.encode(message, {\n\t\t\tidCompressor: this.idCompressor,\n\t\t\tschema: schemaAndPolicy,\n\t\t});\n\t\tthis.submitLocalMessage(encodedMessage, {\n\t\t\t// Clone the schema to ensure that during resubmit the schema has not been mutated by later changes\n\t\t\tschema: schemaAndPolicy.schema.clone(),\n\t\t\tpolicy: schemaAndPolicy.policy,\n\t\t});\n\t}\n\n\t/**\n\t * Process a bunch of messages from the runtime. SharedObject will call this method with a bunch of messages.\n\t */\n\tpublic processMessagesCore(messagesCollection: IRuntimeMessageCollection): void {\n\t\tconst { envelope, local, messagesContent } = messagesCollection;\n\t\tconst commits: GraphCommit<TChange>[] = [];\n\t\tlet messagesSessionId: SessionId | undefined;\n\t\tlet branchId: BranchId | undefined;\n\n\t\tconst processBunch = (branch: BranchId): void => {\n\t\t\tassert(messagesSessionId !== undefined, 0xada /* Messages must have a session ID */);\n\t\t\tthis.processCommits(\n\t\t\t\tmessagesSessionId,\n\t\t\t\tbrand(envelope.sequenceNumber),\n\t\t\t\tbrand(envelope.referenceSequenceNumber),\n\t\t\t\tlocal,\n\t\t\t\tbranch,\n\t\t\t\tcommits,\n\t\t\t);\n\n\t\t\tcommits.length = 0;\n\t\t\tbranchId = undefined;\n\t\t};\n\n\t\t// Get a list of all the commits from the messages.\n\t\tfor (const messageContent of messagesContent) {\n\t\t\t// Empty context object is passed in, as our decode function is schema-agnostic.\n\t\t\tconst message = this.messageCodec.decode(messageContent.contents, {\n\t\t\t\tidCompressor: this.idCompressor,\n\t\t\t});\n\n\t\t\tif (messagesSessionId !== undefined) {\n\t\t\t\tassert(\n\t\t\t\t\tmessagesSessionId === message.sessionId,\n\t\t\t\t\t0xad9 /* All messages in a bunch must have the same session ID */,\n\t\t\t\t);\n\t\t\t}\n\t\t\tmessagesSessionId = message.sessionId;\n\n\t\t\tconst type = message.type;\n\t\t\tswitch (type) {\n\t\t\t\tcase \"commit\": {\n\t\t\t\t\tif (branchId !== undefined && message.branchId !== branchId) {\n\t\t\t\t\t\tprocessBunch(branchId);\n\t\t\t\t\t}\n\n\t\t\t\t\tbranchId = message.branchId;\n\t\t\t\t\tcommits.push(message.commit);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"branch\": {\n\t\t\t\t\tif (branchId !== undefined) {\n\t\t\t\t\t\tprocessBunch(branchId);\n\t\t\t\t\t}\n\t\t\t\t\tthis.editManager.sequenceBranchCreation(\n\t\t\t\t\t\tmessagesSessionId,\n\t\t\t\t\t\tbrand(envelope.referenceSequenceNumber),\n\t\t\t\t\t\tmessage.branchId,\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\tunreachableCase(type);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (branchId !== undefined) {\n\t\t\tprocessBunch(branchId);\n\t\t}\n\n\t\tthis.editManager.advanceMinimumSequenceNumber(brand(envelope.minimumSequenceNumber));\n\t}\n\n\tprivate processCommits(\n\t\tsessionId: SessionId,\n\t\tsequenceNumber: SeqNumber,\n\t\treferenceSequenceNumber: SeqNumber,\n\t\tisLocal: boolean,\n\t\tbranchId: BranchId,\n\t\tcommits: readonly GraphCommit<TChange>[],\n\t): void {\n\t\tthis.editManager.addSequencedChanges(\n\t\t\tcommits,\n\t\t\tsessionId,\n\t\t\tsequenceNumber,\n\t\t\treferenceSequenceNumber,\n\t\t\tbranchId,\n\t\t);\n\n\t\t// Update the resubmit machine for each commit applied.\n\t\tfor (const commit of commits) {\n\t\t\tthis.tryGetResubmitMachine(branchId)?.onSequencedCommitApplied(commit.revision, isLocal);\n\t\t}\n\t}\n\n\tpublic getLocalBranch(): SharedTreeBranch<TEditor, TChange> {\n\t\treturn this.editManager.getLocalBranch(\"main\");\n\t}\n\n\tpublic getSharedBranchIds(): string[] {\n\t\treturn this.editManager\n\t\t\t.getSharedBranchIds()\n\t\t\t.filter((id): id is SessionSpaceCompressedId => id !== \"main\")\n\t\t\t.map((id) => this.idCompressor.decompress(id));\n\t}\n\tpublic createSharedBranch(): string {\n\t\tconst branchId = this.idCompressor.generateCompressedId();\n\t\tthis.addBranch(branchId);\n\t\tthis.submitBranchCreation(branchId);\n\t\treturn this.idCompressor.decompress(branchId);\n\t}\n\n\tprotected addBranch(branchId: BranchId): void {\n\t\tthis.editManager.addNewBranch(branchId);\n\t}\n\n\tpublic getSharedBranch(branchId: BranchId): SharedTreeBranch<TEditor, TChange> {\n\t\treturn this.editManager.getLocalBranch(branchId);\n\t}\n\n\tpublic didAttach(): void {\n\t\tthis.detachedRevision = undefined;\n\t}\n\n\tpublic reSubmitCore(content: JsonCompatibleReadOnly, localOpMetadata: unknown): void {\n\t\t// Empty context object is passed in, as our decode function is schema-agnostic.\n\t\tconst message = this.messageCodec.decode(this.serializer.decode(content), {\n\t\t\tidCompressor: this.idCompressor,\n\t\t});\n\n\t\tconst type = message.type;\n\t\tswitch (type) {\n\t\t\tcase \"commit\": {\n\t\t\t\tconst {\n\t\t\t\t\tcommit: { revision },\n\t\t\t\t\tbranchId,\n\t\t\t\t} = message;\n\n\t\t\t\tconst resubmitMachine = this.getResubmitMachine(branchId);\n\n\t\t\t\tconst getLocalCommits = (): GraphCommit<TChange>[] => {\n\t\t\t\t\tconst localCommits = this.editManager.getLocalCommits(branchId);\n\t\t\t\t\tconst revisionIndex = localCommits.findIndex((c) => c.revision === revision);\n\t\t\t\t\tassert(revisionIndex >= 0, 0xbdb /* revision must exist in local commits */);\n\t\t\t\t\treturn localCommits.slice(revisionIndex);\n\t\t\t\t};\n\n\t\t\t\tassert(\n\t\t\t\t\tisClonableSchemaPolicy(localOpMetadata),\n\t\t\t\t\t0x95e /* Local metadata must contain schema and policy. */,\n\t\t\t\t);\n\n\t\t\t\tconst enrichedCommit = resubmitMachine.getEnrichedCommit(revision, getLocalCommits);\n\t\t\t\tif (enrichedCommit !== undefined) {\n\t\t\t\t\tthis.submitCommit(branchId, enrichedCommit, localOpMetadata, true);\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"branch\": {\n\t\t\t\tthis.submitBranchCreation(message.branchId);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tunreachableCase(type);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic rollback(content: JsonCompatibleReadOnly, localOpMetadata: unknown): void {\n\t\t// Empty context object is passed in, as our decode function is schema-agnostic.\n\t\tconst message = this.messageCodec.decode(this.serializer.decode(content), {\n\t\t\tidCompressor: this.idCompressor,\n\t\t});\n\n\t\tconst type = message.type;\n\t\tswitch (type) {\n\t\t\tcase \"commit\": {\n\t\t\t\tconst {\n\t\t\t\t\tcommit: { revision },\n\t\t\t\t\tbranchId,\n\t\t\t\t} = message;\n\t\t\t\tconst branch = this.editManager.getLocalBranch(branchId);\n\t\t\t\tconst head = branch.getHead();\n\t\t\t\tassert(head.revision === revision, 0xc6b /* Can only rollback latest commit */);\n\t\t\t\tconst newHead = head.parent ?? fail(0xc6c /* must have parent */);\n\t\t\t\tbranch.removeAfter(newHead);\n\t\t\t\tthis.getResubmitMachine(branchId).onCommitRollback(head);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"branch\": {\n\t\t\t\tthis.editManager.removeBranch(message.branchId);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tunreachableCase(type);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic applyStashedOp(content: JsonCompatibleReadOnly): void {\n\t\t// Empty context object is passed in, as our decode function is schema-agnostic.\n\t\tconst message = this.messageCodec.decode(this.serializer.decode(content), {\n\t\t\tidCompressor: this.idCompressor,\n\t\t});\n\n\t\tconst type = message.type;\n\t\tswitch (type) {\n\t\t\tcase \"commit\": {\n\t\t\t\tconst {\n\t\t\t\t\tcommit: { revision, change },\n\t\t\t\t\tbranchId,\n\t\t\t\t} = message;\n\t\t\t\tthis.editManager.getLocalBranch(branchId).apply({ change, revision });\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"branch\": {\n\t\t\t\tthis.editManager.addNewBranch(message.branchId);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tunreachableCase(type);\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected registerSharedBranchForEditing(\n\t\tbranchId: BranchId,\n\t\tenricher: ChangeEnricherReadonlyCheckout<TChange>,\n\t\tresubmitMachine?: ResubmitMachine<TChange>,\n\t): void {\n\t\tconst changeEnricher = enricher ?? new NoOpChangeEnricher();\n\t\tconst commitEnricher = new BranchCommitEnricher(this.changeFamily.rebaser, changeEnricher);\n\t\tassert(!this.enrichers.has(branchId), 0xc6d /* Branch already registered */);\n\t\tthis.enrichers.set(branchId, {\n\t\t\tenricher: commitEnricher,\n\t\t\tresubmitMachine:\n\t\t\t\tresubmitMachine ??\n\t\t\t\tnew DefaultResubmitMachine(\n\t\t\t\t\t(change: TaggedChange<TChange>) =>\n\t\t\t\t\t\tthis.changeFamily.rebaser.invert(change, true, this.mintRevisionTag()),\n\t\t\t\t\tchangeEnricher,\n\t\t\t\t),\n\t\t});\n\t}\n\n\tprivate getResubmitMachine(branchId: BranchId): ResubmitMachine<TChange> {\n\t\treturn this.getEnricherState(branchId).resubmitMachine;\n\t}\n\n\tprivate tryGetResubmitMachine(branchId: BranchId): ResubmitMachine<TChange> | undefined {\n\t\treturn this.tryGetEnricherState(branchId)?.resubmitMachine;\n\t}\n\n\tpublic getCommitEnricher(branchId: BranchId): BranchCommitEnricher<TChange> {\n\t\treturn this.getEnricherState(branchId).enricher;\n\t}\n\n\tprivate getEnricherState(branchId: BranchId): EnricherState<TChange> {\n\t\treturn (\n\t\t\tthis.tryGetEnricherState(branchId) ??\n\t\t\tfail(0xc6e /* Expected to have a resubmit machine for this branch */)\n\t\t);\n\t}\n\n\tprivate tryGetEnricherState(branchId: BranchId): EnricherState<TChange> | undefined {\n\t\treturn this.enrichers.get(branchId);\n\t}\n}\n\ninterface EnricherState<TChange> {\n\treadonly enricher: BranchCommitEnricher<TChange>;\n\treadonly resubmitMachine: ResubmitMachine<TChange>;\n}\n\nfunction isClonableSchemaPolicy(\n\tmaybeSchemaPolicy: unknown,\n): maybeSchemaPolicy is ClonableSchemaAndPolicy {\n\tconst schemaAndPolicy = maybeSchemaPolicy as ClonableSchemaAndPolicy;\n\treturn schemaAndPolicy.schema !== undefined && schemaAndPolicy.policy !== undefined;\n}\n\n/**\n * Compose an {@link IChannelStorageService} which prefixes all paths before forwarding them to the original service\n */\nfunction scopeStorageService(\n\tservice: IChannelStorageService,\n\t...pathElements: string[]\n): IChannelStorageService {\n\tconst scope = `${pathElements.join(\"/\")}/`;\n\n\treturn {\n\t\tasync readBlob(path: string): Promise<ArrayBufferLike> {\n\t\t\treturn service.readBlob(`${scope}${path}`);\n\t\t},\n\t\tasync contains(path) {\n\t\t\treturn service.contains(`${scope}${path}`);\n\t\t},\n\t\tasync list(path) {\n\t\t\treturn service.list(`${scope}${path}`);\n\t\t},\n\t\tgetSnapshotTree(): ISnapshotTree | undefined {\n\t\t\tconst snapshotTree = service.getSnapshotTree();\n\t\t\tif (snapshotTree === undefined) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tlet scopedTree = snapshotTree;\n\t\t\tfor (const element of pathElements) {\n\t\t\t\tconst tree = scopedTree.trees[element];\n\t\t\t\tassert(\n\t\t\t\t\ttree !== undefined,\n\t\t\t\t\t0xc20 /* snapshot tree not found for one of tree's summarizables */,\n\t\t\t\t);\n\t\t\t\tscopedTree = tree;\n\t\t\t}\n\t\t\treturn scopedTree;\n\t\t},\n\t};\n}\n"]}
@@ -35,5 +35,5 @@ export { generateSchemaFromSimpleSchema } from "./schemaFromSimple.js";
35
35
  export type { TreeChangeEvents } from "./treeChangeEvents.js";
36
36
  export { incrementalEncodingPolicyForAllowedTypes, incrementalSummaryHint, } from "./incrementalAllowedTypes.js";
37
37
  export { encodeSchemaCompatibilitySnapshot, decodeSchemaCompatibilitySnapshot, } from "./simpleSchemaCodec.js";
38
- export { exportCompatibilitySchemaSnapshot, importCompatibilitySchemaSnapshot, checkCompatibility, } from "./snapshotCompatibilityChecker.js";
38
+ export { exportCompatibilitySchemaSnapshot, importCompatibilitySchemaSnapshot, checkCompatibility, checkSchemaCompatibilitySnapshots, type SnapshotFileSystem, type SchemaCompatibilitySnapshotsOptions, } from "./snapshotCompatibilityChecker.js";
39
39
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,YAAY,EACX,sBAAsB,EACtB,yBAAyB,GACzB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACN,qBAAqB,EACrB,0BAA0B,GAC1B,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACX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,MAAM,sBAAsB,CAAC;AACnF,OAAO,EACN,qBAAqB,EACrB,KAAK,eAAe,GACpB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACN,sBAAsB,EACtB,sBAAsB,GACtB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACN,KAAK,qBAAqB,EAC1B,KAAK,0BAA0B,EAC/B,KAAK,wBAAwB,EAC7B,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,6BAA6B,EAClC,KAAK,yBAAyB,EAC9B,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAC5B,QAAQ,GACR,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,8BAA8B,EAAE,MAAM,uBAAuB,CAAC;AACvE,YAAY,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EACN,wCAAwC,EACxC,sBAAsB,GACtB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACN,iCAAiC,EACjC,iCAAiC,GACjC,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACN,iCAAiC,EACjC,iCAAiC,EACjC,kBAAkB,GAClB,MAAM,mCAAmC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,YAAY,EACX,sBAAsB,EACtB,yBAAyB,GACzB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACN,qBAAqB,EACrB,0BAA0B,GAC1B,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACX,KAAK,EACL,QAAQ,EACR,YAAY,EACZ,cAAc,EACd,yBAAyB,EACzB,aAAa,EACb,YAAY,EACZ,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,UAAU,GACV,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,KAAK,a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K,wBAAwB,EAC7B,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,6BAA6B,EAClC,KAAK,yBAAyB,EAC9B,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAC5B,QAAQ,GACR,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,8BAA8B,EAAE,MAAM,uBAAuB,CAAC;AACvE,YAAY,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EACN,wCAAwC,EACxC,sBAAsB,GACtB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACN,iCAAiC,EACjC,iCAAiC,GACjC,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACN,iCAAiC,EACjC,iCAAiC,EACjC,kBAAkB,EAClB,iCAAiC,EACjC,KAAK,kBAAkB,EACvB,KAAK,mCAAmC,GACxC,MAAM,mCAAmC,CAAC"}
@@ -28,5 +28,5 @@ export { rollback, } from "./transactionTypes.js";
28
28
  export { generateSchemaFromSimpleSchema } from "./schemaFromSimple.js";
29
29
  export { incrementalEncodingPolicyForAllowedTypes, incrementalSummaryHint, } from "./incrementalAllowedTypes.js";
30
30
  export { encodeSchemaCompatibilitySnapshot, decodeSchemaCompatibilitySnapshot, } from "./simpleSchemaCodec.js";
31
- export { exportCompatibilitySchemaSnapshot, importCompatibilitySchemaSnapshot, checkCompatibility, } from "./snapshotCompatibilityChecker.js";
31
+ export { exportCompatibilitySchemaSnapshot, importCompatibilitySchemaSnapshot, checkCompatibility, checkSchemaCompatibilitySnapshots, } from "./snapshotCompatibilityChecker.js";
32
32
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/simple-tree/api/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,EACN,qBAAqB,EACrB,0BAA0B,GAC1B,MAAM,oBAAoB,CAAC;AAc5B,OAAO,EAA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AAqB,GAErB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACN,sBAAsB,EACtB,sBAAsB,GACtB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAYN,QAAQ,GACR,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,8BAA8B,EAAE,MAAM,uBAAuB,CAAC;AAEvE,OAAO,EACN,wCAAwC,EACxC,sBAAsB,GACtB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACN,iCAAiC,EACjC,iCAAiC,GACjC,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACN,iCAAiC,EACjC,iCAAiC,EACjC,kBAAkB,GAClB,MAAM,mCAAmC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport type {\n\tITreeViewConfiguration,\n\tITreeConfigurationOptions,\n} from \"./configuration.js\";\nexport {\n\tTreeViewConfiguration,\n\tTreeViewConfigurationAlpha,\n} from \"./configuration.js\";\nexport type {\n\tITree,\n\tTreeView,\n\tViewableTree,\n\tTreeViewEvents,\n\tSchemaCompatibilityStatus,\n\tTreeViewAlpha,\n\tTreeViewBeta,\n\tTreeBranch,\n\tTreeBranchAlpha,\n\tTreeBranchEvents,\n\tITreeAlpha,\n} from \"./tree.js\";\nexport { asTreeViewAlpha } from \"./tree.js\";\nexport { type SchemaStatics, schemaStatics } from \"./schemaStatics.js\";\nexport {\n\tSchemaFactory,\n\tscoped,\n\ttype ScopedSchemaName,\n\ttype ObjectSchemaOptionsAlpha,\n\ttype ObjectSchemaOptions,\n\ttype NodeSchemaOptions,\n\ttype NodeSchemaOptionsAlpha,\n\ttype SchemaFactory_base,\n} from \"./schemaFactory.js\";\nexport { SchemaFactoryBeta, type SchemaStaticsBeta } from \"./schemaFactoryBeta.js\";\nexport { SchemaFactoryAlpha } from \"./schemaFactoryAlpha.js\";\nexport {\n\teraseSchemaDetails,\n\teraseSchemaDetailsSubclassable,\n} from \"./eraseSchemaDetails.js\";\nexport type {\n\tValidateRecursiveSchema,\n\tFixRecursiveArraySchema,\n\tValidateRecursiveSchemaTemplate,\n\tFixRecursiveRecursionLimit,\n} from \"./schemaFactoryRecursive.js\";\nexport { allowUnused } from \"./schemaFactoryRecursive.js\";\nexport {\n\tadaptEnum,\n\tenumFromStrings,\n\tsingletonSchema,\n} from \"./schemaCreationUtilities.js\";\nexport {\n\tgetIdentifierFromNode,\n\tgetPropertyKeyFromStoredKey,\n\tgetStoredKey,\n\ttreeNodeApi,\n\ttype TreeNodeApi,\n\ttryGetSchema,\n} from \"./treeNodeApi.js\";\nexport { createFromCursor } from \"./create.js\";\nexport {\n\ttype DirtyTreeStatus,\n\ttrackDirtyNodes,\n\ttype DirtyTreeMap,\n} from \"./dirtyIndex.js\";\nexport {\n\ttype JsonSchemaId,\n\ttype JsonSchemaType,\n\ttype JsonObjectNodeSchema,\n\ttype JsonArrayNodeSchema,\n\ttype JsonMapNodeSchema,\n\ttype JsonLeafNodeSchema,\n\ttype JsonSchemaRef,\n\ttype JsonRefPath,\n\ttype JsonNodeSchema,\n\ttype JsonNodeSchemaBase,\n\ttype JsonTreeSchema,\n\ttype JsonFieldSchema,\n\ttype JsonLeafSchemaType,\n\ttype JsonRecordNodeSchema,\n\ttype JsonStringKeyPatternProperties,\n} from \"./jsonSchema.js\";\nexport type { TreeSchemaEncodingOptions } from \"./getJsonSchema.js\";\nexport { getJsonSchema } from \"./getJsonSchema.js\";\nexport { getSimpleSchema } from \"./getSimpleSchema.js\";\nexport { SchemaCompatibilityTester } from \"./schemaCompatibilityTester.js\";\nexport type {\n\tUnenforced,\n\tFieldSchemaAlphaUnsafe,\n\tArrayNodeCustomizableSchemaUnsafe,\n\tMapNodeCustomizableSchemaUnsafe,\n\tSystem_Unsafe,\n\tTreeRecordNodeUnsafe,\n\tUnannotateAllowedTypeUnsafe,\n\tAnnotatedAllowedTypeUnsafe,\n\tAnnotatedAllowedTypesUnsafe,\n\tAllowedTypesFullUnsafe,\n\tAllowedTypesFullFromMixedUnsafe,\n\tUnannotateAllowedTypesListUnsafe,\n\tAnnotateAllowedTypesListUnsafe,\n} from \"./typesUnsafe.js\";\n\nexport {\n\ttype VerboseTreeNode,\n\ttype VerboseTree,\n\tapplySchemaToParserOptions,\n\tcursorFromVerbose,\n\tverboseFromCursor,\n\treplaceVerboseTreeHandles,\n} from \"./verboseTree.js\";\n\nexport {\n\ttype TreeEncodingOptions,\n\tcustomFromCursorStored,\n\ttype CustomTreeNode,\n\ttype CustomTreeValue,\n\ttryStoredSchemaAsArray,\n\treplaceHandles,\n\ttype HandleConverter,\n\tKeyEncodingOptions,\n\ttype TreeParsingOptions,\n} from \"./customTree.js\";\n\nexport {\n\ttype ConciseTree,\n\tconciseFromCursor,\n\treplaceConciseTreeHandles,\n} from \"./conciseTree.js\";\n\nexport {\n\tborrowCursorFromTreeNodeOrValue,\n\texportConcise,\n\timportConcise,\n\ttype NodeChangedData,\n\tTreeBeta,\n\ttype TreeChangeEventsBeta,\n} from \"./treeBeta.js\";\nexport { createSimpleTreeIndex, type SimpleTreeIndex } from \"./simpleTreeIndex.js\";\nexport {\n\tcreateIdentifierIndex,\n\ttype IdentifierIndex,\n} from \"./identifierIndex.js\";\n\nexport {\n\textractPersistedSchema,\n\tcomparePersistedSchema,\n} from \"./storedSchema.js\";\n\nexport {\n\ttype TransactionConstraint,\n\ttype TransactionConstraintAlpha,\n\ttype NodeInDocumentConstraint,\n\ttype NoChangeConstraint,\n\ttype RunTransactionParams,\n\ttype VoidTransactionCallbackStatus,\n\ttype TransactionCallbackStatus,\n\ttype TransactionResult,\n\ttype TransactionResultExt,\n\ttype TransactionResultSuccess,\n\ttype TransactionResultFailed,\n\trollback,\n} from \"./transactionTypes.js\";\n\nexport { generateSchemaFromSimpleSchema } from \"./schemaFromSimple.js\";\nexport type { TreeChangeEvents } from \"./treeChangeEvents.js\";\nexport {\n\tincrementalEncodingPolicyForAllowedTypes,\n\tincrementalSummaryHint,\n} from \"./incrementalAllowedTypes.js\";\nexport {\n\tencodeSchemaCompatibilitySnapshot,\n\tdecodeSchemaCompatibilitySnapshot,\n} from \"./simpleSchemaCodec.js\";\nexport {\n\texportCompatibilitySchemaSnapshot,\n\timportCompatibilitySchemaSnapshot,\n\tcheckCompatibility,\n} from \"./snapshotCompatibilityChecker.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/simple-tree/api/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,EACN,qBAAqB,EACrB,0BAA0B,GAC1B,MAAM,oBAAoB,CAAC;AAc5B,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAsB,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,EACN,aAAa,EACb,MAAM,GAON,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,iBAAiB,EAA0B,MAAM,wBAAwB,CAAC;AACnF,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EACN,kBAAkB,EAClB,8BAA8B,GAC9B,MAAM,yBAAyB,CAAC;AAOjC,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EACN,SAAS,EACT,eAAe,EACf,eAAe,GACf,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACN,qBAAqB,EACrB,2BAA2B,EAC3B,YAAY,EACZ,WAAW,EAEX,YAAY,GACZ,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAEN,eAAe,GAEf,MAAM,iBAAiB,CAAC;AAmBzB,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAiB3E,OAAO,EAGN,0BAA0B,EAC1B,iBAAiB,EACjB,iBAAiB,EACjB,yBAAyB,GACzB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAEN,sBAAsB,EAGtB,sBAAsB,EACtB,cAAc,EAEd,kBAAkB,GAElB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAEN,iBAAiB,EACjB,yBAAyB,GACzB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACN,+BAA+B,EAC/B,aAAa,EACb,aAAa,EAEb,QAAQ,GAER,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,qBAAqB,EAAwB,MAAM,sBAAsB,CAAC;AACnF,OAAO,EACN,qBAAqB,GAErB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACN,sBAAsB,EACtB,sBAAsB,GACtB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAYN,QAAQ,GACR,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,8BAA8B,EAAE,MAAM,uBAAuB,CAAC;AAEvE,OAAO,EACN,wCAAwC,EACxC,sBAAsB,GACtB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACN,iCAAiC,EACjC,iCAAiC,GACjC,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACN,iCAAiC,EACjC,iCAAiC,EACjC,kBAAkB,EAClB,iCAAiC,GAGjC,MAAM,mCAAmC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport type {\n\tITreeViewConfiguration,\n\tITreeConfigurationOptions,\n} from \"./configuration.js\";\nexport {\n\tTreeViewConfiguration,\n\tTreeViewConfigurationAlpha,\n} from \"./configuration.js\";\nexport type {\n\tITree,\n\tTreeView,\n\tViewableTree,\n\tTreeViewEvents,\n\tSchemaCompatibilityStatus,\n\tTreeViewAlpha,\n\tTreeViewBeta,\n\tTreeBranch,\n\tTreeBranchAlpha,\n\tTreeBranchEvents,\n\tITreeAlpha,\n} from \"./tree.js\";\nexport { asTreeViewAlpha } from \"./tree.js\";\nexport { type SchemaStatics, schemaStatics } from \"./schemaStatics.js\";\nexport {\n\tSchemaFactory,\n\tscoped,\n\ttype ScopedSchemaName,\n\ttype ObjectSchemaOptionsAlpha,\n\ttype ObjectSchemaOptions,\n\ttype NodeSchemaOptions,\n\ttype NodeSchemaOptionsAlpha,\n\ttype SchemaFactory_base,\n} from \"./schemaFactory.js\";\nexport { SchemaFactoryBeta, type SchemaStaticsBeta } from \"./schemaFactoryBeta.js\";\nexport { SchemaFactoryAlpha } from \"./schemaFactoryAlpha.js\";\nexport {\n\teraseSchemaDetails,\n\teraseSchemaDetailsSubclassable,\n} from \"./eraseSchemaDetails.js\";\nexport type {\n\tValidateRecursiveSchema,\n\tFixRecursiveArraySchema,\n\tValidateRecursiveSchemaTemplate,\n\tFixRecursiveRecursionLimit,\n} from \"./schemaFactoryRecursive.js\";\nexport { allowUnused } from \"./schemaFactoryRecursive.js\";\nexport {\n\tadaptEnum,\n\tenumFromStrings,\n\tsingletonSchema,\n} from \"./schemaCreationUtilities.js\";\nexport {\n\tgetIdentifierFromNode,\n\tgetPropertyKeyFromStoredKey,\n\tgetStoredKey,\n\ttreeNodeApi,\n\ttype TreeNodeApi,\n\ttryGetSchema,\n} from \"./treeNodeApi.js\";\nexport { createFromCursor } from \"./create.js\";\nexport {\n\ttype DirtyTreeStatus,\n\ttrackDirtyNodes,\n\ttype DirtyTreeMap,\n} from \"./dirtyIndex.js\";\nexport {\n\ttype JsonSchemaId,\n\ttype JsonSchemaType,\n\ttype JsonObjectNodeSchema,\n\ttype JsonArrayNodeSchema,\n\ttype JsonMapNodeSchema,\n\ttype JsonLeafNodeSchema,\n\ttype JsonSchemaRef,\n\ttype JsonRefPath,\n\ttype JsonNodeSchema,\n\ttype JsonNodeSchemaBase,\n\ttype JsonTreeSchema,\n\ttype JsonFieldSchema,\n\ttype JsonLeafSchemaType,\n\ttype JsonRecordNodeSchema,\n\ttype JsonStringKeyPatternProperties,\n} from \"./jsonSchema.js\";\nexport type { TreeSchemaEncodingOptions } from \"./getJsonSchema.js\";\nexport { getJsonSchema } from \"./getJsonSchema.js\";\nexport { getSimpleSchema } from \"./getSimpleSchema.js\";\nexport { SchemaCompatibilityTester } from \"./schemaCompatibilityTester.js\";\nexport type {\n\tUnenforced,\n\tFieldSchemaAlphaUnsafe,\n\tArrayNodeCustomizableSchemaUnsafe,\n\tMapNodeCustomizableSchemaUnsafe,\n\tSystem_Unsafe,\n\tTreeRecordNodeUnsafe,\n\tUnannotateAllowedTypeUnsafe,\n\tAnnotatedAllowedTypeUnsafe,\n\tAnnotatedAllowedTypesUnsafe,\n\tAllowedTypesFullUnsafe,\n\tAllowedTypesFullFromMixedUnsafe,\n\tUnannotateAllowedTypesListUnsafe,\n\tAnnotateAllowedTypesListUnsafe,\n} from \"./typesUnsafe.js\";\n\nexport {\n\ttype VerboseTreeNode,\n\ttype VerboseTree,\n\tapplySchemaToParserOptions,\n\tcursorFromVerbose,\n\tverboseFromCursor,\n\treplaceVerboseTreeHandles,\n} from \"./verboseTree.js\";\n\nexport {\n\ttype TreeEncodingOptions,\n\tcustomFromCursorStored,\n\ttype CustomTreeNode,\n\ttype CustomTreeValue,\n\ttryStoredSchemaAsArray,\n\treplaceHandles,\n\ttype HandleConverter,\n\tKeyEncodingOptions,\n\ttype TreeParsingOptions,\n} from \"./customTree.js\";\n\nexport {\n\ttype ConciseTree,\n\tconciseFromCursor,\n\treplaceConciseTreeHandles,\n} from \"./conciseTree.js\";\n\nexport {\n\tborrowCursorFromTreeNodeOrValue,\n\texportConcise,\n\timportConcise,\n\ttype NodeChangedData,\n\tTreeBeta,\n\ttype TreeChangeEventsBeta,\n} from \"./treeBeta.js\";\nexport { createSimpleTreeIndex, type SimpleTreeIndex } from \"./simpleTreeIndex.js\";\nexport {\n\tcreateIdentifierIndex,\n\ttype IdentifierIndex,\n} from \"./identifierIndex.js\";\n\nexport {\n\textractPersistedSchema,\n\tcomparePersistedSchema,\n} from \"./storedSchema.js\";\n\nexport {\n\ttype TransactionConstraint,\n\ttype TransactionConstraintAlpha,\n\ttype NodeInDocumentConstraint,\n\ttype NoChangeConstraint,\n\ttype RunTransactionParams,\n\ttype VoidTransactionCallbackStatus,\n\ttype TransactionCallbackStatus,\n\ttype TransactionResult,\n\ttype TransactionResultExt,\n\ttype TransactionResultSuccess,\n\ttype TransactionResultFailed,\n\trollback,\n} from \"./transactionTypes.js\";\n\nexport { generateSchemaFromSimpleSchema } from \"./schemaFromSimple.js\";\nexport type { TreeChangeEvents } from \"./treeChangeEvents.js\";\nexport {\n\tincrementalEncodingPolicyForAllowedTypes,\n\tincrementalSummaryHint,\n} from \"./incrementalAllowedTypes.js\";\nexport {\n\tencodeSchemaCompatibilitySnapshot,\n\tdecodeSchemaCompatibilitySnapshot,\n} from \"./simpleSchemaCodec.js\";\nexport {\n\texportCompatibilitySchemaSnapshot,\n\timportCompatibilitySchemaSnapshot,\n\tcheckCompatibility,\n\tcheckSchemaCompatibilitySnapshots,\n\ttype SnapshotFileSystem,\n\ttype SchemaCompatibilitySnapshotsOptions,\n} from \"./snapshotCompatibilityChecker.js\";\n"]}
@@ -50,7 +50,7 @@ export class SchemaFactoryAlpha extends SchemaFactoryBeta {
50
50
  objectAlpha(name, fields, options) {
51
51
  return objectSchema(scoped(this, name), fields, true, {
52
52
  ...defaultSchemaFactoryObjectOptions,
53
- ...(options ?? {}),
53
+ ...options,
54
54
  });
55
55
  }
56
56
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"schemaFactoryAlpha.js","sourceRoot":"","sources":["../../../src/simple-tree/api/schemaFactoryAlpha.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAEN,WAAW,EAEX,SAAS,EAET,YAAY,EAEZ,YAAY,GACZ,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACN,iCAAiC,EACjC,MAAM,GAIN,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAgBnD,OAAO,EAAE,iBAAiB,EA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aAAa,CAAC,QAAQ,AAAzB,CAA0B;AAElE;;GAEG;AAC6B,2BAAQ,GAAG,aAAa,CAAC,QAAQ,AAAzB,CAA0B;AAElE;;GAEG;AAC6B,oCAAiB,GAAG,aAAa,CAAC,iBAAiB,AAAlC,CAAmC;AAEpF;;GAEG;AAC6B,oCAAiB,GAAG,aAAa,CAAC,iBAAiB,AAAlC,CAAmC;AAEpF;;GAEG;AACoB,6BAAU,GAAG,aAAa,CAAC,UAAU,AAA3B,CAA4B","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\ttype ArrayNodeCustomizableSchema,\n\tarraySchema,\n\ttype MapNodeCustomizableSchema,\n\tmapSchema,\n\ttype ObjectNodeSchema,\n\tobjectSchema,\n\ttype RecordNodeCustomizableSchema,\n\trecordSchema,\n} from \"../node-kinds/index.js\";\nimport {\n\tdefaultSchemaFactoryObjectOptions,\n\tscoped,\n\ttype NodeSchemaOptionsAlpha,\n\ttype ObjectSchemaOptionsAlpha,\n\ttype ScopedSchemaName,\n} from \"./schemaFactory.js\";\nimport { schemaStatics } from \"./schemaStatics.js\";\nimport type { ImplicitFieldSchema } from \"../fieldSchema.js\";\nimport type { RestrictiveStringRecord } from \"../../util/index.js\";\nimport type {\n\tNodeKind,\n\tTreeNodeSchemaClass,\n\tImplicitAllowedTypes,\n\tWithType,\n} from \"../core/index.js\";\nimport type {\n\tArrayNodeCustomizableSchemaUnsafe,\n\tMapNodeCustomizableSchemaUnsafe,\n\tSystem_Unsafe,\n\tTreeRecordNodeUnsafe,\n} from \"./typesUnsafe.js\";\nimport type { SchemaType, SimpleObjectNodeSchema } from \"../simpleSchema.js\";\nimport { SchemaFactoryBeta } from \"./schemaFactoryBeta.js\";\n\n// These imports prevent a large number of type references in the API reports from showing up as *_2.\n/* eslint-disable unused-imports/no-unused-imports, @typescript-eslint/no-unused-vars, import-x/no-duplicates */\nimport type {\n\tFieldProps,\n\tFieldSchemaAlpha,\n\tFieldPropsAlpha,\n\tFieldKind,\n} from \"../fieldSchema.js\";\nimport type { LeafSchema } from \"../leafNodeSchema.js\";\nimport type { SimpleLeafNodeSchema } from \"../simpleSchema.js\";\nimport type { FieldSchemaAlphaUnsafe } from \"./typesUnsafe.js\";\n/* eslint-enable unused-imports/no-unused-imports, @typescript-eslint/no-unused-vars, import-x/no-duplicates */\n\n/**\n * {@link SchemaFactory} with additional alpha APIs.\n *\n * @alpha\n * @privateRemarks\n * When building schema, when `options` is not provided, `TCustomMetadata` is inferred as `unknown`.\n * If desired, this could be made to infer `undefined` instead by adding overloads for everything,\n * but currently it is not worth the maintenance overhead as there is no use case which this is known to be helpful for.\n */\nexport class SchemaFactoryAlpha<\n\tout TScope extends string | undefined = string | undefined,\n\tTName extends number | string = string,\n> extends SchemaFactoryBeta<TScope, TName> {\n\t/**\n\t * Define a {@link TreeNodeSchemaClass} for a {@link TreeObjectNode}.\n\t *\n\t * @param name - Unique identifier for this schema within this factory's scope.\n\t * @param fields - Schema for fields of the object node's schema. Defines what children can be placed under each key.\n\t * @param options - Additional options for the schema.\n\t */\n\tpublic objectAlpha<\n\t\tconst Name extends TName,\n\t\tconst T extends RestrictiveStringRecord<ImplicitFieldSchema>,\n\t\tconst TCustomMetadata = unknown,\n\t>(\n\t\tname: Name,\n\t\tfields: T,\n\t\toptions?: ObjectSchemaOptionsAlpha<TCustomMetadata>,\n\t): ObjectNodeSchema<ScopedSchemaName<TScope, Name>, T, true, TCustomMetadata> & {\n\t\t/**\n\t\t * Typing checking workaround: not for for actual use.\n\t\t * @remarks\n\t\t * This API collides with {@link TreeNodeSchemaCore.createFromInsertable} to disable a type checking optimization which produces different and undesired results.\n\t\t * See {@link https://github.com/microsoft/TypeScript/issues/59049#issuecomment-2773459693} for more details.\n\t\t * @privateRemarks\n\t\t * The specific issue here is non-empty POJO mode object schema not being assignable to `ObjectNodeSchema`,\n\t\t * See the above link and the tests in objectNode.spec.ts which reference it.\n\t\t * @system\n\t\t */\n\t\treadonly createFromInsertable: unknown;\n\t} {\n\t\treturn objectSchema(scoped<TScope, TName, Name>(this, name), fields, true, {\n\t\t\t...defaultSchemaFactoryObjectOptions,\n\t\t\t...(options ?? {}),\n\t\t});\n\t}\n\n\t/**\n\t * {@inheritdoc SchemaFactory.objectRecursive}\n\t */\n\tpublic override objectRecursive<\n\t\tconst Name extends TName,\n\t\tconst T extends RestrictiveStringRecord<System_Unsafe.ImplicitFieldSchemaUnsafe>,\n\t\tconst TCustomMetadata = unknown,\n\t>(\n\t\tname: Name,\n\t\tt: T,\n\t\toptions?: ObjectSchemaOptionsAlpha<TCustomMetadata>,\n\t): TreeNodeSchemaClass<\n\t\tScopedSchemaName<TScope, Name>,\n\t\tNodeKind.Object,\n\t\tSystem_Unsafe.TreeObjectNodeUnsafe<T, ScopedSchemaName<TScope, Name>>,\n\t\tobject & System_Unsafe.InsertableObjectFromSchemaRecordUnsafe<T>,\n\t\tfalse,\n\t\tT,\n\t\tnever,\n\t\tTCustomMetadata\n\t> &\n\t\tSimpleObjectNodeSchema<SchemaType.View, TCustomMetadata> &\n\t\t// We can't just use non generic `ObjectNodeSchema` here since \"Base constructors must all have the same return type\".\n\t\t// We also can't just use generic `ObjectNodeSchema` here and not `TreeNodeSchemaClass` since that doesn't work with unsafe recursive types.\n\t\t// ObjectNodeSchema<\n\t\t// \tScopedSchemaName<TScope, Name>,\n\t\t// \t// T & RestrictiveStringRecord<ImplicitFieldSchema> would be nice to use here, but it breaks the recursive type self references.\n\t\t// \tRestrictiveStringRecord<ImplicitFieldSchema>,\n\t\t// \tfalse,\n\t\t// \tTCustomMetadata\n\t\t// >\n\t\tPick<ObjectNodeSchema, \"fields\"> {\n\t\t// TODO: syntax highting is vs code is broken here. Don't trust it. Use the compiler instead.\n\t\ttype TScopedName = ScopedSchemaName<TScope, Name>;\n\t\treturn this.objectAlpha(\n\t\t\tname,\n\t\t\tt as T & RestrictiveStringRecord<ImplicitFieldSchema>,\n\t\t\toptions,\n\t\t) as unknown as TreeNodeSchemaClass<\n\t\t\tTScopedName,\n\t\t\tNodeKind.Object,\n\t\t\tSystem_Unsafe.TreeObjectNodeUnsafe<T, TScopedName>,\n\t\t\tobject & System_Unsafe.InsertableObjectFromSchemaRecordUnsafe<T>,\n\t\t\tfalse,\n\t\t\tT,\n\t\t\tnever,\n\t\t\tTCustomMetadata\n\t\t> &\n\t\t\tObjectNodeSchema<\n\t\t\t\tScopedSchemaName<TScope, Name>,\n\t\t\t\tRestrictiveStringRecord<ImplicitFieldSchema>,\n\t\t\t\tfalse,\n\t\t\t\tTCustomMetadata\n\t\t\t>;\n\t}\n\n\t/**\n\t * {@inheritDoc SchemaStatics.leaves}\n\t */\n\tpublic static override readonly leaves = schemaStatics.leaves;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.optional}\n\t */\n\tpublic static override readonly optional = schemaStatics.optional;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.required}\n\t */\n\tpublic static override readonly required = schemaStatics.required;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.optionalRecursive}\n\t */\n\tpublic static override readonly optionalRecursive = schemaStatics.optionalRecursive;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.requiredRecursive}\n\t */\n\tpublic static override readonly requiredRecursive = schemaStatics.requiredRecursive;\n\n\t/**\n\t * Like {@link SchemaFactory.identifier} but static and a factory function that can be provided {@link FieldProps}.\n\t */\n\tpublic static readonly identifier = schemaStatics.identifier;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.leaves}\n\t */\n\tpublic override readonly leaves = schemaStatics.leaves;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.optional}\n\t */\n\tpublic override readonly optional = schemaStatics.optional;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.required}\n\t */\n\tpublic override readonly required = schemaStatics.required;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.optionalRecursive}\n\t */\n\tpublic override readonly optionalRecursive = schemaStatics.optionalRecursive;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.requiredRecursive}\n\t */\n\tpublic override readonly requiredRecursive = schemaStatics.requiredRecursive;\n\n\t/**\n\t * Define a {@link TreeNodeSchema} for a {@link TreeMapNode}.\n\t *\n\t * @param name - Unique identifier for this schema within this factory's scope.\n\t * @param allowedTypes - The types that may appear as values in the map.\n\t * @param options - Additional options for the schema.\n\t *\n\t * @example\n\t * ```typescript\n\t * class NamedMap extends factory.map(\"name\", factory.number, {\n\t * \tmetadata: { description: \"A map of numbers\" }\n\t * }) {}\n\t * ```\n\t */\n\tpublic mapAlpha<\n\t\tName extends TName,\n\t\tconst T extends ImplicitAllowedTypes,\n\t\tconst TCustomMetadata = unknown,\n\t>(\n\t\tname: Name,\n\t\tallowedTypes: T,\n\t\toptions?: NodeSchemaOptionsAlpha<TCustomMetadata>,\n\t): MapNodeCustomizableSchema<ScopedSchemaName<TScope, Name>, T, true, TCustomMetadata> {\n\t\treturn mapSchema(\n\t\t\tscoped<TScope, TName, Name>(this, name),\n\t\t\tallowedTypes,\n\t\t\ttrue,\n\t\t\ttrue,\n\t\t\toptions,\n\t\t);\n\t}\n\n\t/**\n\t * {@inheritDoc SchemaFactory.objectRecursive}\n\t */\n\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n\tpublic override mapRecursive<\n\t\tName extends TName,\n\t\tconst T extends System_Unsafe.ImplicitAllowedTypesUnsafe,\n\t\tconst TCustomMetadata = unknown,\n\t>(name: Name, allowedTypes: T, options?: NodeSchemaOptionsAlpha<TCustomMetadata>) {\n\t\treturn this.mapAlpha(\n\t\t\tname,\n\t\t\tallowedTypes as T & ImplicitAllowedTypes,\n\t\t\toptions,\n\t\t) as unknown as MapNodeCustomizableSchemaUnsafe<\n\t\t\tScopedSchemaName<TScope, Name>,\n\t\t\tT,\n\t\t\tTCustomMetadata\n\t\t>;\n\t}\n\n\t/**\n\t * Define a {@link TreeNodeSchemaClass} for a {@link (TreeArrayNode:interface)}.\n\t *\n\t * @param name - Unique identifier for this schema within this factory's scope.\n\t * @param allowedTypes - The types that may appear in the array.\n\t * @param options - Additional options for the schema.\n\t *\n\t * @example\n\t * ```typescript\n\t * class NamedArray extends factory.arrayAlpha(\"name\", factory.number) {}\n\t * ```\n\t */\n\tpublic arrayAlpha<\n\t\tconst Name extends TName,\n\t\tconst T extends ImplicitAllowedTypes,\n\t\tconst TCustomMetadata = unknown,\n\t>(\n\t\tname: Name,\n\t\tallowedTypes: T,\n\t\toptions?: NodeSchemaOptionsAlpha<TCustomMetadata>,\n\t): ArrayNodeCustomizableSchema<ScopedSchemaName<TScope, Name>, T, true, TCustomMetadata> {\n\t\treturn arraySchema(\n\t\t\tscoped<TScope, TName, Name>(this, name),\n\t\t\tallowedTypes,\n\t\t\ttrue,\n\t\t\ttrue,\n\t\t\toptions ?? {},\n\t\t);\n\t}\n\n\t/**\n\t * {@link SchemaFactory.arrayRecursive} but with support for some alpha features.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n\tpublic override arrayRecursive<\n\t\tconst Name extends TName,\n\t\tconst T extends System_Unsafe.ImplicitAllowedTypesUnsafe,\n\t\tconst TCustomMetadata = unknown,\n\t>(name: Name, allowedTypes: T, options?: NodeSchemaOptionsAlpha<TCustomMetadata>) {\n\t\treturn this.arrayAlpha(\n\t\t\tname,\n\t\t\tallowedTypes as T & ImplicitAllowedTypes,\n\t\t\toptions,\n\t\t) as unknown as ArrayNodeCustomizableSchemaUnsafe<\n\t\t\tScopedSchemaName<TScope, Name>,\n\t\t\tT,\n\t\t\tTCustomMetadata\n\t\t>;\n\t}\n\n\t/**\n\t * Define (and add to this library) a {@link TreeNodeSchemaClass} for a {@link (TreeRecordNode:interface)}.\n\t *\n\t * @param name - Unique identifier for this schema within this factory's scope.\n\t * @param allowedTypes - The types that may appear in the record.\n\t * @param options - Additional options for the schema.\n\t *\n\t * @example\n\t * ```typescript\n\t * class NamedRecord extends factory.recordAlpha(\"name\", factory.number) {}\n\t * ```\n\t */\n\tpublic recordAlpha<\n\t\tconst Name extends TName,\n\t\tconst T extends ImplicitAllowedTypes,\n\t\tconst TCustomMetadata = unknown,\n\t>(\n\t\tname: Name,\n\t\tallowedTypes: T,\n\t\toptions?: NodeSchemaOptionsAlpha<TCustomMetadata>,\n\t): RecordNodeCustomizableSchema<ScopedSchemaName<TScope, Name>, T, true, TCustomMetadata> {\n\t\treturn recordSchema({\n\t\t\tidentifier: scoped<TScope, TName, Name>(this, name),\n\t\t\tinfo: allowedTypes,\n\t\t\tcustomizable: true,\n\t\t\timplicitlyConstructable: true,\n\t\t\tnodeOptions: options,\n\t\t});\n\t}\n\n\t/**\n\t * {@link SchemaFactoryBeta.(record:2)} except tweaked to work better for recursive types.\n\t * Use with {@link ValidateRecursiveSchema} for improved type safety.\n\t * @remarks\n\t * This version of `SchemaFactory.record` uses the same workarounds as {@link SchemaFactory.objectRecursive}.\n\t * See {@link ValidateRecursiveSchema} for additional information about using recursive schema.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n\tpublic override recordRecursive<\n\t\tName extends TName,\n\t\tconst T extends System_Unsafe.ImplicitAllowedTypesUnsafe,\n\t\tconst TCustomMetadata = unknown,\n\t>(name: Name, allowedTypes: T, options?: NodeSchemaOptionsAlpha<TCustomMetadata>) {\n\t\tconst RecordSchema = recordSchema({\n\t\t\tidentifier: scoped<TScope, TName, Name>(this, name),\n\t\t\tinfo: allowedTypes as T & ImplicitAllowedTypes,\n\t\t\tcustomizable: true,\n\t\t\t// Setting this to true seems to work ok currently, but not for other node kinds.\n\t\t\t// Supporting this could be fragile and might break other future changes, so it's being kept as false for now.\n\t\t\timplicitlyConstructable: false,\n\t\t\tnodeOptions: options,\n\t\t});\n\n\t\treturn RecordSchema as TreeNodeSchemaClass<\n\t\t\t/* Name */ ScopedSchemaName<TScope, Name>,\n\t\t\t/* Kind */ NodeKind.Record,\n\t\t\t/* TNode */ TreeRecordNodeUnsafe<T> &\n\t\t\t\tWithType<ScopedSchemaName<TScope, Name>, NodeKind.Record>,\n\t\t\t/* TInsertable */ {\n\t\t\t\t// Ideally this would be\n\t\t\t\t// RestrictiveStringRecord<InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>>,\n\t\t\t\t// but doing so breaks recursive types.\n\t\t\t\t// Instead we do a less nice version:\n\t\t\t\treadonly [P in string]: System_Unsafe.InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>;\n\t\t\t},\n\t\t\t/* ImplicitlyConstructable */ false,\n\t\t\t/* Info */ T,\n\t\t\t/* TConstructorExtra */ undefined,\n\t\t\t/* TCustomMetadata */ TCustomMetadata\n\t\t>;\n\t}\n\n\t/**\n\t * {@inheritDoc SchemaFactoryBeta.scopedFactory}\n\t */\n\tpublic scopedFactoryAlpha<\n\t\tconst T extends TName,\n\t\tTNameInner extends number | string = string,\n\t>(name: T): SchemaFactoryAlpha<ScopedSchemaName<TScope, T>, TNameInner> {\n\t\treturn new SchemaFactoryAlpha(scoped<TScope, TName, T>(this, name));\n\t}\n}\n"]}
1
+ {"version":3,"file":"schemaFactoryAlpha.js","sourceRoot":"","sources":["../../../src/simple-tree/api/schemaFactoryAlpha.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAEN,WAAW,EAEX,SAAS,EAET,YAAY,EAEZ,YAAY,GACZ,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACN,iCAAiC,EACjC,MAAM,GAIN,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAgBnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAa3D,+GAA+G;AAE/G;;;;;;;;GAQG;AACH,MAAM,OAAO,kBAGX,SAAQ,iBAAgC;IAH1C;;QA4HC;;WAEG;QACsB,WAAM,GAAG,aAAa,CAAC,MAAM,CAAC;QAEvD;;WAEG;QACsB,aAAQ,GAAG,aAAa,CAAC,QAAQ,CAAC;QAE3D;;WAEG;QACsB,aAAQ,GAAG,aAAa,CAAC,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AA3B,CAA4B","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\ttype ArrayNodeCustomizableSchema,\n\tarraySchema,\n\ttype MapNodeCustomizableSchema,\n\tmapSchema,\n\ttype ObjectNodeSchema,\n\tobjectSchema,\n\ttype RecordNodeCustomizableSchema,\n\trecordSchema,\n} from \"../node-kinds/index.js\";\nimport {\n\tdefaultSchemaFactoryObjectOptions,\n\tscoped,\n\ttype NodeSchemaOptionsAlpha,\n\ttype ObjectSchemaOptionsAlpha,\n\ttype ScopedSchemaName,\n} from \"./schemaFactory.js\";\nimport { schemaStatics } from \"./schemaStatics.js\";\nimport type { ImplicitFieldSchema } from \"../fieldSchema.js\";\nimport type { RestrictiveStringRecord } from \"../../util/index.js\";\nimport type {\n\tNodeKind,\n\tTreeNodeSchemaClass,\n\tImplicitAllowedTypes,\n\tWithType,\n} from \"../core/index.js\";\nimport type {\n\tArrayNodeCustomizableSchemaUnsafe,\n\tMapNodeCustomizableSchemaUnsafe,\n\tSystem_Unsafe,\n\tTreeRecordNodeUnsafe,\n} from \"./typesUnsafe.js\";\nimport type { SchemaType, SimpleObjectNodeSchema } from \"../simpleSchema.js\";\nimport { SchemaFactoryBeta } from \"./schemaFactoryBeta.js\";\n\n// These imports prevent a large number of type references in the API reports from showing up as *_2.\n/* eslint-disable unused-imports/no-unused-imports, @typescript-eslint/no-unused-vars, import-x/no-duplicates */\nimport type {\n\tFieldProps,\n\tFieldSchemaAlpha,\n\tFieldPropsAlpha,\n\tFieldKind,\n} from \"../fieldSchema.js\";\nimport type { LeafSchema } from \"../leafNodeSchema.js\";\nimport type { SimpleLeafNodeSchema } from \"../simpleSchema.js\";\nimport type { FieldSchemaAlphaUnsafe } from \"./typesUnsafe.js\";\n/* eslint-enable unused-imports/no-unused-imports, @typescript-eslint/no-unused-vars, import-x/no-duplicates */\n\n/**\n * {@link SchemaFactory} with additional alpha APIs.\n *\n * @alpha\n * @privateRemarks\n * When building schema, when `options` is not provided, `TCustomMetadata` is inferred as `unknown`.\n * If desired, this could be made to infer `undefined` instead by adding overloads for everything,\n * but currently it is not worth the maintenance overhead as there is no use case which this is known to be helpful for.\n */\nexport class SchemaFactoryAlpha<\n\tout TScope extends string | undefined = string | undefined,\n\tTName extends number | string = string,\n> extends SchemaFactoryBeta<TScope, TName> {\n\t/**\n\t * Define a {@link TreeNodeSchemaClass} for a {@link TreeObjectNode}.\n\t *\n\t * @param name - Unique identifier for this schema within this factory's scope.\n\t * @param fields - Schema for fields of the object node's schema. Defines what children can be placed under each key.\n\t * @param options - Additional options for the schema.\n\t */\n\tpublic objectAlpha<\n\t\tconst Name extends TName,\n\t\tconst T extends RestrictiveStringRecord<ImplicitFieldSchema>,\n\t\tconst TCustomMetadata = unknown,\n\t>(\n\t\tname: Name,\n\t\tfields: T,\n\t\toptions?: ObjectSchemaOptionsAlpha<TCustomMetadata>,\n\t): ObjectNodeSchema<ScopedSchemaName<TScope, Name>, T, true, TCustomMetadata> & {\n\t\t/**\n\t\t * Typing checking workaround: not for for actual use.\n\t\t * @remarks\n\t\t * This API collides with {@link TreeNodeSchemaCore.createFromInsertable} to disable a type checking optimization which produces different and undesired results.\n\t\t * See {@link https://github.com/microsoft/TypeScript/issues/59049#issuecomment-2773459693} for more details.\n\t\t * @privateRemarks\n\t\t * The specific issue here is non-empty POJO mode object schema not being assignable to `ObjectNodeSchema`,\n\t\t * See the above link and the tests in objectNode.spec.ts which reference it.\n\t\t * @system\n\t\t */\n\t\treadonly createFromInsertable: unknown;\n\t} {\n\t\treturn objectSchema(scoped<TScope, TName, Name>(this, name), fields, true, {\n\t\t\t...defaultSchemaFactoryObjectOptions,\n\t\t\t...options,\n\t\t});\n\t}\n\n\t/**\n\t * {@inheritdoc SchemaFactory.objectRecursive}\n\t */\n\tpublic override objectRecursive<\n\t\tconst Name extends TName,\n\t\tconst T extends RestrictiveStringRecord<System_Unsafe.ImplicitFieldSchemaUnsafe>,\n\t\tconst TCustomMetadata = unknown,\n\t>(\n\t\tname: Name,\n\t\tt: T,\n\t\toptions?: ObjectSchemaOptionsAlpha<TCustomMetadata>,\n\t): TreeNodeSchemaClass<\n\t\tScopedSchemaName<TScope, Name>,\n\t\tNodeKind.Object,\n\t\tSystem_Unsafe.TreeObjectNodeUnsafe<T, ScopedSchemaName<TScope, Name>>,\n\t\tobject & System_Unsafe.InsertableObjectFromSchemaRecordUnsafe<T>,\n\t\tfalse,\n\t\tT,\n\t\tnever,\n\t\tTCustomMetadata\n\t> &\n\t\tSimpleObjectNodeSchema<SchemaType.View, TCustomMetadata> &\n\t\t// We can't just use non generic `ObjectNodeSchema` here since \"Base constructors must all have the same return type\".\n\t\t// We also can't just use generic `ObjectNodeSchema` here and not `TreeNodeSchemaClass` since that doesn't work with unsafe recursive types.\n\t\t// ObjectNodeSchema<\n\t\t// \tScopedSchemaName<TScope, Name>,\n\t\t// \t// T & RestrictiveStringRecord<ImplicitFieldSchema> would be nice to use here, but it breaks the recursive type self references.\n\t\t// \tRestrictiveStringRecord<ImplicitFieldSchema>,\n\t\t// \tfalse,\n\t\t// \tTCustomMetadata\n\t\t// >\n\t\tPick<ObjectNodeSchema, \"fields\"> {\n\t\t// TODO: syntax highting is vs code is broken here. Don't trust it. Use the compiler instead.\n\t\ttype TScopedName = ScopedSchemaName<TScope, Name>;\n\t\treturn this.objectAlpha(\n\t\t\tname,\n\t\t\tt as T & RestrictiveStringRecord<ImplicitFieldSchema>,\n\t\t\toptions,\n\t\t) as unknown as TreeNodeSchemaClass<\n\t\t\tTScopedName,\n\t\t\tNodeKind.Object,\n\t\t\tSystem_Unsafe.TreeObjectNodeUnsafe<T, TScopedName>,\n\t\t\tobject & System_Unsafe.InsertableObjectFromSchemaRecordUnsafe<T>,\n\t\t\tfalse,\n\t\t\tT,\n\t\t\tnever,\n\t\t\tTCustomMetadata\n\t\t> &\n\t\t\tObjectNodeSchema<\n\t\t\t\tScopedSchemaName<TScope, Name>,\n\t\t\t\tRestrictiveStringRecord<ImplicitFieldSchema>,\n\t\t\t\tfalse,\n\t\t\t\tTCustomMetadata\n\t\t\t>;\n\t}\n\n\t/**\n\t * {@inheritDoc SchemaStatics.leaves}\n\t */\n\tpublic static override readonly leaves = schemaStatics.leaves;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.optional}\n\t */\n\tpublic static override readonly optional = schemaStatics.optional;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.required}\n\t */\n\tpublic static override readonly required = schemaStatics.required;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.optionalRecursive}\n\t */\n\tpublic static override readonly optionalRecursive = schemaStatics.optionalRecursive;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.requiredRecursive}\n\t */\n\tpublic static override readonly requiredRecursive = schemaStatics.requiredRecursive;\n\n\t/**\n\t * Like {@link SchemaFactory.identifier} but static and a factory function that can be provided {@link FieldProps}.\n\t */\n\tpublic static readonly identifier = schemaStatics.identifier;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.leaves}\n\t */\n\tpublic override readonly leaves = schemaStatics.leaves;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.optional}\n\t */\n\tpublic override readonly optional = schemaStatics.optional;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.required}\n\t */\n\tpublic override readonly required = schemaStatics.required;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.optionalRecursive}\n\t */\n\tpublic override readonly optionalRecursive = schemaStatics.optionalRecursive;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.requiredRecursive}\n\t */\n\tpublic override readonly requiredRecursive = schemaStatics.requiredRecursive;\n\n\t/**\n\t * Define a {@link TreeNodeSchema} for a {@link TreeMapNode}.\n\t *\n\t * @param name - Unique identifier for this schema within this factory's scope.\n\t * @param allowedTypes - The types that may appear as values in the map.\n\t * @param options - Additional options for the schema.\n\t *\n\t * @example\n\t * ```typescript\n\t * class NamedMap extends factory.map(\"name\", factory.number, {\n\t * \tmetadata: { description: \"A map of numbers\" }\n\t * }) {}\n\t * ```\n\t */\n\tpublic mapAlpha<\n\t\tName extends TName,\n\t\tconst T extends ImplicitAllowedTypes,\n\t\tconst TCustomMetadata = unknown,\n\t>(\n\t\tname: Name,\n\t\tallowedTypes: T,\n\t\toptions?: NodeSchemaOptionsAlpha<TCustomMetadata>,\n\t): MapNodeCustomizableSchema<ScopedSchemaName<TScope, Name>, T, true, TCustomMetadata> {\n\t\treturn mapSchema(\n\t\t\tscoped<TScope, TName, Name>(this, name),\n\t\t\tallowedTypes,\n\t\t\ttrue,\n\t\t\ttrue,\n\t\t\toptions,\n\t\t);\n\t}\n\n\t/**\n\t * {@inheritDoc SchemaFactory.objectRecursive}\n\t */\n\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n\tpublic override mapRecursive<\n\t\tName extends TName,\n\t\tconst T extends System_Unsafe.ImplicitAllowedTypesUnsafe,\n\t\tconst TCustomMetadata = unknown,\n\t>(name: Name, allowedTypes: T, options?: NodeSchemaOptionsAlpha<TCustomMetadata>) {\n\t\treturn this.mapAlpha(\n\t\t\tname,\n\t\t\tallowedTypes as T & ImplicitAllowedTypes,\n\t\t\toptions,\n\t\t) as unknown as MapNodeCustomizableSchemaUnsafe<\n\t\t\tScopedSchemaName<TScope, Name>,\n\t\t\tT,\n\t\t\tTCustomMetadata\n\t\t>;\n\t}\n\n\t/**\n\t * Define a {@link TreeNodeSchemaClass} for a {@link (TreeArrayNode:interface)}.\n\t *\n\t * @param name - Unique identifier for this schema within this factory's scope.\n\t * @param allowedTypes - The types that may appear in the array.\n\t * @param options - Additional options for the schema.\n\t *\n\t * @example\n\t * ```typescript\n\t * class NamedArray extends factory.arrayAlpha(\"name\", factory.number) {}\n\t * ```\n\t */\n\tpublic arrayAlpha<\n\t\tconst Name extends TName,\n\t\tconst T extends ImplicitAllowedTypes,\n\t\tconst TCustomMetadata = unknown,\n\t>(\n\t\tname: Name,\n\t\tallowedTypes: T,\n\t\toptions?: NodeSchemaOptionsAlpha<TCustomMetadata>,\n\t): ArrayNodeCustomizableSchema<ScopedSchemaName<TScope, Name>, T, true, TCustomMetadata> {\n\t\treturn arraySchema(\n\t\t\tscoped<TScope, TName, Name>(this, name),\n\t\t\tallowedTypes,\n\t\t\ttrue,\n\t\t\ttrue,\n\t\t\toptions ?? {},\n\t\t);\n\t}\n\n\t/**\n\t * {@link SchemaFactory.arrayRecursive} but with support for some alpha features.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n\tpublic override arrayRecursive<\n\t\tconst Name extends TName,\n\t\tconst T extends System_Unsafe.ImplicitAllowedTypesUnsafe,\n\t\tconst TCustomMetadata = unknown,\n\t>(name: Name, allowedTypes: T, options?: NodeSchemaOptionsAlpha<TCustomMetadata>) {\n\t\treturn this.arrayAlpha(\n\t\t\tname,\n\t\t\tallowedTypes as T & ImplicitAllowedTypes,\n\t\t\toptions,\n\t\t) as unknown as ArrayNodeCustomizableSchemaUnsafe<\n\t\t\tScopedSchemaName<TScope, Name>,\n\t\t\tT,\n\t\t\tTCustomMetadata\n\t\t>;\n\t}\n\n\t/**\n\t * Define (and add to this library) a {@link TreeNodeSchemaClass} for a {@link (TreeRecordNode:interface)}.\n\t *\n\t * @param name - Unique identifier for this schema within this factory's scope.\n\t * @param allowedTypes - The types that may appear in the record.\n\t * @param options - Additional options for the schema.\n\t *\n\t * @example\n\t * ```typescript\n\t * class NamedRecord extends factory.recordAlpha(\"name\", factory.number) {}\n\t * ```\n\t */\n\tpublic recordAlpha<\n\t\tconst Name extends TName,\n\t\tconst T extends ImplicitAllowedTypes,\n\t\tconst TCustomMetadata = unknown,\n\t>(\n\t\tname: Name,\n\t\tallowedTypes: T,\n\t\toptions?: NodeSchemaOptionsAlpha<TCustomMetadata>,\n\t): RecordNodeCustomizableSchema<ScopedSchemaName<TScope, Name>, T, true, TCustomMetadata> {\n\t\treturn recordSchema({\n\t\t\tidentifier: scoped<TScope, TName, Name>(this, name),\n\t\t\tinfo: allowedTypes,\n\t\t\tcustomizable: true,\n\t\t\timplicitlyConstructable: true,\n\t\t\tnodeOptions: options,\n\t\t});\n\t}\n\n\t/**\n\t * {@link SchemaFactoryBeta.(record:2)} except tweaked to work better for recursive types.\n\t * Use with {@link ValidateRecursiveSchema} for improved type safety.\n\t * @remarks\n\t * This version of `SchemaFactory.record` uses the same workarounds as {@link SchemaFactory.objectRecursive}.\n\t * See {@link ValidateRecursiveSchema} for additional information about using recursive schema.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n\tpublic override recordRecursive<\n\t\tName extends TName,\n\t\tconst T extends System_Unsafe.ImplicitAllowedTypesUnsafe,\n\t\tconst TCustomMetadata = unknown,\n\t>(name: Name, allowedTypes: T, options?: NodeSchemaOptionsAlpha<TCustomMetadata>) {\n\t\tconst RecordSchema = recordSchema({\n\t\t\tidentifier: scoped<TScope, TName, Name>(this, name),\n\t\t\tinfo: allowedTypes as T & ImplicitAllowedTypes,\n\t\t\tcustomizable: true,\n\t\t\t// Setting this to true seems to work ok currently, but not for other node kinds.\n\t\t\t// Supporting this could be fragile and might break other future changes, so it's being kept as false for now.\n\t\t\timplicitlyConstructable: false,\n\t\t\tnodeOptions: options,\n\t\t});\n\n\t\treturn RecordSchema as TreeNodeSchemaClass<\n\t\t\t/* Name */ ScopedSchemaName<TScope, Name>,\n\t\t\t/* Kind */ NodeKind.Record,\n\t\t\t/* TNode */ TreeRecordNodeUnsafe<T> &\n\t\t\t\tWithType<ScopedSchemaName<TScope, Name>, NodeKind.Record>,\n\t\t\t/* TInsertable */ {\n\t\t\t\t// Ideally this would be\n\t\t\t\t// RestrictiveStringRecord<InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>>,\n\t\t\t\t// but doing so breaks recursive types.\n\t\t\t\t// Instead we do a less nice version:\n\t\t\t\treadonly [P in string]: System_Unsafe.InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>;\n\t\t\t},\n\t\t\t/* ImplicitlyConstructable */ false,\n\t\t\t/* Info */ T,\n\t\t\t/* TConstructorExtra */ undefined,\n\t\t\t/* TCustomMetadata */ TCustomMetadata\n\t\t>;\n\t}\n\n\t/**\n\t * {@inheritDoc SchemaFactoryBeta.scopedFactory}\n\t */\n\tpublic scopedFactoryAlpha<\n\t\tconst T extends TName,\n\t\tTNameInner extends number | string = string,\n\t>(name: T): SchemaFactoryAlpha<ScopedSchemaName<TScope, T>, TNameInner> {\n\t\treturn new SchemaFactoryAlpha(scoped<TScope, TName, T>(this, name));\n\t}\n}\n"]}
@@ -68,7 +68,7 @@ export class SchemaFactoryBeta extends SchemaFactory {
68
68
  object(name, fields, options) {
69
69
  return objectSchema(scoped(this, name), fields, true, {
70
70
  ...defaultSchemaFactoryObjectOptions,
71
- ...(options ?? {}),
71
+ ...options,
72
72
  });
73
73
  }
74
74
  objectRecursive(name, t, options) {
@@ -1 +1 @@
1
- {"version":3,"file":"schemaFactoryBeta.js","sourceRoot":"","sources":["../../../src/simple-tree/api/schemaFactoryBeta.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,6BAA6B,EAC7B,mBAAmB,EACnB,+BAA+B,GAY/B,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACN,YAAY,EACZ,YAAY,GAKZ,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACN,iCAAiC,EACjC,aAAa,EACb,MAAM,EACN,cAAc,GAId,MAAM,oBAAoB,CAAC;AA4G5B,MAAM,MAAM,GAAG,CACd,CAA8B,EACJ,EAAE;IAC5B,MAAM,aAAa,GAAG,+BAA+B,CAAC,CAAC,CAAC,CAAC;IACzD,OAAO;QACN,IAAI,EAAE,aAAa,CAAC,IAAI;QACxB,QAAQ,EAAE;YACT,GAAG,aAAa,CAAC,QAAQ;YACzB,mBAAmB,EAAE,mBAAmB,EAAE;SAC1C;KACD,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,KAAK,GAAG,CACb,CAAI,EACJ,WAAiC,EAAE,EACJ,EAAE;IACjC,OAAO,6BAA6B,CAAC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ourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tAnnotatedAllowedTypesInternal,\n\tcreateSchemaUpgrade,\n\tnormalizeToAnnotatedAllowedType,\n\ttype AllowedTypesFullFromMixed,\n\ttype AllowedTypesMetadata,\n\ttype AnnotatedAllowedType,\n\ttype ImplicitAllowedTypes,\n\ttype LazyItem,\n\ttype NodeKind,\n\ttype TreeNodeSchema,\n\ttype TreeNodeSchemaBoth,\n\ttype TreeNodeSchemaClass,\n\ttype TreeNodeSchemaNonClass,\n\ttype WithType,\n} from \"../core/index.js\";\n\nimport {\n\tobjectSchema,\n\trecordSchema,\n\ttype InsertableObjectFromSchemaRecord,\n\ttype RecordNodeInsertableData,\n\ttype TreeObjectNode,\n\ttype TreeRecordNode,\n} from \"../node-kinds/index.js\";\nimport {\n\tdefaultSchemaFactoryObjectOptions,\n\tSchemaFactory,\n\tscoped,\n\tstructuralName,\n\ttype NodeSchemaOptions,\n\ttype ObjectSchemaOptions,\n\ttype ScopedSchemaName,\n} from \"./schemaFactory.js\";\nimport type {\n\tAllowedTypesFullFromMixedUnsafe,\n\tAnnotatedAllowedTypeUnsafe,\n\tSystem_Unsafe,\n\tTreeRecordNodeUnsafe,\n\tUnannotateAllowedTypeUnsafe,\n\tUnenforced,\n} from \"./typesUnsafe.js\";\n\n// These imports prevent a large number of type references in the API reports from showing up as *_2.\n/* eslint-disable unused-imports/no-unused-imports, @typescript-eslint/no-unused-vars, import-x/no-duplicates */\nimport type {\n\tFieldProps,\n\tFieldSchemaAlpha,\n\tFieldPropsAlpha,\n\tFieldKind,\n\tImplicitFieldSchema,\n} from \"../fieldSchema.js\";\nimport type { LeafSchema } from \"../leafNodeSchema.js\";\nimport type { SimpleLeafNodeSchema } from \"../simpleSchema.js\";\nimport type { RestrictiveStringRecord } from \"../../util/index.js\";\n/* eslint-enable unused-imports/no-unused-imports, @typescript-eslint/no-unused-vars, import-x/no-duplicates */\n\n/**\n * Stateless APIs exposed via {@link SchemaFactoryBeta} as both instance properties and as statics.\n * @see {@link SchemaStatics} for why this is useful.\n * @system @sealed @beta\n */\nexport interface SchemaStaticsBeta {\n\t/**\n\t * Declares a staged type in a set of {@link AllowedTypes}.\n\t *\n\t * @remarks\n\t * Staged allowed types add support for loading documents which may contain that type at the declared location.\n\t * This allows for an incremental rollout of a schema change to add a {@link TreeNodeSchema} to an {@link AllowedTypes} without breaking cross version collaboration.\n\t * A guide on this process can be found here: https://fluidframework.com/docs/data-structures/tree/schema-evolution/allowed-types-rollout\n\t *\n\t * Once enough clients have the type staged (and thus can read documents which allow it), documents can start being created and upgraded to allow the staged type.\n\t * This is done by deploying a new version of the app which removes the `staged` wrapper around the allowed type in the the schema definition.\n\t * This will also require {@link TreeView.upgradeSchema|upgrading the schema} for existing documents.\n\t *\n\t * Using a staged allowed type in a schema is just like using the schema as an allowed type with the following exceptions:\n\t *\n\t * 1. {@link TreeView.initialize} will omit the staged allowed type from the newly created stored schema.\n\t * 2. {@link TreeView.upgradeSchema} will omit the staged allowed type from the the upgraded stored schema.\n\t * 3. When evaluating {@link TreeView.compatibility}, it will be viewable even if the staged allowed type is not present in the stored schema's corresponding allowed types.\n\t * 4. Because of the above, it is possible to get errors when inserting content which uses the staged allowed type into a tree whose stored schema does not permit it.\n\t *\n\t * For recursive schemas, use {@link SchemaStaticsBeta.stagedRecursive} instead.\n\t * It offers equivalent runtime behavior with relaxed compile-time typing for recursive type.\n\t *\n\t * @example\n\t * A full code example of the schema migration process can be found in our {@link https://github.com/microsoft/FluidFramework/blob/main/packages/dds/tree/src/test/simple-tree/api/stagedSchemaUpgrade.spec.ts | tests}.\n\t *\n\t * @privateRemarks\n\t * TODO:#44317 staged allowed types rely on schema validation of stored schema to output errors, these errors are not very\n\t * user friendly and should be improved, particularly in the case of staged allowed types\n\t *\n\t * TODO: AB#45711: Update the docs above when recursive type support is added.\n\t */\n\treadonly staged: <const T extends LazyItem<TreeNodeSchema>>(\n\t\tt: T | AnnotatedAllowedType<T>,\n\t) => AnnotatedAllowedType<T>;\n\n\t/**\n\t * Normalize information about a set of {@link AllowedTypes} into an {@link AllowedTypesFull}.\n\t * @remarks\n\t * This can take in {@link AnnotatedAllowedType} to preserve their annotations.\n\t */\n\treadonly types: <\n\t\tconst T extends readonly (AnnotatedAllowedType | LazyItem<TreeNodeSchema>)[],\n\t>(\n\t\tt: T,\n\t\tmetadata?: AllowedTypesMetadata,\n\t) => AllowedTypesFullFromMixed<T>;\n\n\t/**\n\t * {@link SchemaStaticsBeta.staged} except tweaked to work better for recursive types.\n\t * Use with {@link ValidateRecursiveSchema} for improved type safety.\n\t * @remarks\n\t * This version of {@link SchemaStaticsBeta.staged} has fewer type constraints to work around TypeScript limitations, see {@link Unenforced}.\n\t * See {@link ValidateRecursiveSchema} for additional information about using recursive schema.\n\t */\n\tstagedRecursive: <\n\t\tconst T extends Unenforced<AnnotatedAllowedType | LazyItem<TreeNodeSchema>>,\n\t>(\n\t\tt: T,\n\t) => AnnotatedAllowedTypeUnsafe<UnannotateAllowedTypeUnsafe<T>>;\n\n\t/**\n\t * {@link SchemaStaticsBeta.types} except tweaked to work better for recursive types.\n\t * Use with {@link ValidateRecursiveSchema} for improved type safety.\n\t * @remarks\n\t * This version of {@link SchemaStaticsBeta.types} has fewer type constraints to work around TypeScript limitations, see {@link Unenforced}.\n\t * See {@link ValidateRecursiveSchema} for additional information about using recursive schema.\n\t * @privateRemarks\n\t * If all inputs (at least recursive ones) were required to be annotated, this could be typed more strongly.\n\t * In that case it could use `T extends readonly (AnnotatedAllowedTypeUnsafe | LazyItem<System_Unsafe.TreeNodeSchemaUnsafe>)[]`.\n\t */\n\treadonly typesRecursive: <\n\t\tconst T extends readonly Unenforced<AnnotatedAllowedType | LazyItem<TreeNodeSchema>>[],\n\t>(\n\t\tt: T,\n\t\tmetadata?: AllowedTypesMetadata,\n\t) => AllowedTypesFullFromMixedUnsafe<T>;\n}\n\nconst staged = <const T extends LazyItem<TreeNodeSchema>>(\n\tt: T | AnnotatedAllowedType<T>,\n): AnnotatedAllowedType<T> => {\n\tconst annotatedType = normalizeToAnnotatedAllowedType(t);\n\treturn {\n\t\ttype: annotatedType.type,\n\t\tmetadata: {\n\t\t\t...annotatedType.metadata,\n\t\t\tstagedSchemaUpgrade: createSchemaUpgrade(),\n\t\t},\n\t};\n};\n\nconst types = <const T extends readonly (AnnotatedAllowedType | LazyItem<TreeNodeSchema>)[]>(\n\tt: T,\n\tmetadata: AllowedTypesMetadata = {},\n): AllowedTypesFullFromMixed<T> => {\n\treturn AnnotatedAllowedTypesInternal.createMixed<T>(t, metadata);\n};\n\nconst schemaStaticsBeta: SchemaStaticsBeta = {\n\tstaged,\n\ttypes,\n\n\tstagedRecursive: staged as SchemaStaticsBeta[\"stagedRecursive\"],\n\ttypesRecursive: types as unknown as SchemaStaticsBeta[\"typesRecursive\"],\n};\n\n/**\n * {@link SchemaFactory} with additional beta APIs.\n * @beta\n * @privateRemarks\n */\nexport class SchemaFactoryBeta<\n\tout TScope extends string | undefined = string | undefined,\n\tTName extends number | string = string,\n> extends SchemaFactory<TScope, TName> {\n\t/**\n\t * {@inheritDoc SchemaStaticsBeta.staged}\n\t */\n\tpublic static staged = schemaStaticsBeta.staged;\n\n\t/**\n\t * {@inheritDoc SchemaStaticsBeta.staged}\n\t */\n\tpublic staged = schemaStaticsBeta.staged;\n\n\t/**\n\t * {@inheritDoc SchemaStaticsBeta.stagedRecursive}\n\t */\n\tpublic static stagedRecursive = schemaStaticsBeta.stagedRecursive;\n\n\t/**\n\t * {@inheritDoc SchemaStaticsBeta.stagedRecursive}\n\t */\n\tpublic stagedRecursive = schemaStaticsBeta.stagedRecursive;\n\n\t/**\n\t * {@inheritDoc SchemaStaticsBeta.types}\n\t */\n\tpublic static types = schemaStaticsBeta.types;\n\n\t/**\n\t * {@inheritDoc SchemaStaticsBeta.types}\n\t */\n\tpublic types = schemaStaticsBeta.types;\n\n\t/**\n\t * {@inheritDoc SchemaStaticsBeta.typesRecursive}\n\t */\n\tpublic static typesRecursive = schemaStaticsBeta.typesRecursive;\n\n\t/**\n\t * {@inheritDoc SchemaStaticsBeta.typesRecursive}\n\t */\n\tpublic typesRecursive = schemaStaticsBeta.typesRecursive;\n\n\t/**\n\t * Create a {@link SchemaFactory} with a {@link SchemaFactory.scope|scope} which is a combination of this factory's scope and the provided name.\n\t * @remarks\n\t * The main use-case for this is when creating a collection of related schema (for example using a function that creates multiple schema).\n\t * Creating such related schema using a sub-scope helps ensure they won't collide with other schema in the parent scope.\n\t */\n\tpublic scopedFactory<const T extends TName, TNameInner extends number | string = string>(\n\t\tname: T,\n\t): SchemaFactoryBeta<ScopedSchemaName<TScope, T>, TNameInner> {\n\t\treturn new SchemaFactoryBeta(scoped<TScope, TName, T>(this, name));\n\t}\n\n\t/**\n\t * Define a {@link TreeNodeSchemaClass} for a {@link TreeObjectNode}.\n\t *\n\t * @param name - Unique identifier for this schema within this factory's scope.\n\t * @param fields - Schema for fields of the object node's schema. Defines what children can be placed under each key.\n\t * @param options - Additional options for the schema.\n\t */\n\tpublic override object<\n\t\tconst Name extends TName,\n\t\tconst T extends RestrictiveStringRecord<ImplicitFieldSchema>,\n\t\tconst TCustomMetadata = unknown,\n\t>(\n\t\tname: Name,\n\t\tfields: T,\n\t\toptions?: ObjectSchemaOptions<TCustomMetadata>,\n\t): TreeNodeSchemaClass<\n\t\tScopedSchemaName<TScope, Name>,\n\t\tNodeKind.Object,\n\t\tTreeObjectNode<T, ScopedSchemaName<TScope, Name>>,\n\t\tobject & InsertableObjectFromSchemaRecord<T>,\n\t\ttrue,\n\t\tT,\n\t\tnever,\n\t\tTCustomMetadata\n\t> {\n\t\treturn objectSchema(scoped<TScope, TName, Name>(this, name), fields, true, {\n\t\t\t...defaultSchemaFactoryObjectOptions,\n\t\t\t...(options ?? {}),\n\t\t});\n\t}\n\n\tpublic override objectRecursive<\n\t\tconst Name extends TName,\n\t\tconst T extends RestrictiveStringRecord<System_Unsafe.ImplicitFieldSchemaUnsafe>,\n\t\tconst TCustomMetadata = unknown,\n\t>(\n\t\tname: Name,\n\t\tt: T,\n\t\toptions?: ObjectSchemaOptions<TCustomMetadata>,\n\t): TreeNodeSchemaClass<\n\t\tScopedSchemaName<TScope, Name>,\n\t\tNodeKind.Object,\n\t\tSystem_Unsafe.TreeObjectNodeUnsafe<T, ScopedSchemaName<TScope, Name>>,\n\t\tobject & System_Unsafe.InsertableObjectFromSchemaRecordUnsafe<T>,\n\t\tfalse,\n\t\tT,\n\t\tnever,\n\t\tTCustomMetadata\n\t> {\n\t\ttype TScopedName = ScopedSchemaName<TScope, Name>;\n\t\treturn this.object(\n\t\t\tname,\n\t\t\tt as T & RestrictiveStringRecord<ImplicitFieldSchema>,\n\t\t\toptions,\n\t\t) as unknown as TreeNodeSchemaClass<\n\t\t\tTScopedName,\n\t\t\tNodeKind.Object,\n\t\t\tSystem_Unsafe.TreeObjectNodeUnsafe<T, TScopedName>,\n\t\t\tobject & System_Unsafe.InsertableObjectFromSchemaRecordUnsafe<T>,\n\t\t\tfalse,\n\t\t\tT,\n\t\t\tnever,\n\t\t\tTCustomMetadata\n\t\t>;\n\t}\n\n\t/**\n\t * Define a structurally typed {@link TreeNodeSchema} for a {@link (TreeRecordNode:interface)}.\n\t *\n\t * @param allowedTypes - The types that may appear in the record.\n\t *\n\t * @remarks\n\t * The identifier for this record is defined as a function of the provided types.\n\t * It is still scoped to this `SchemaFactory`, but multiple calls with the same arguments will return the same\n\t * schema object, providing somewhat structural typing.\n\t * This does not support recursive types.\n\t *\n\t * If using these structurally named records, other types in this schema builder should avoid names of the form `Record<${string}>`.\n\t *\n\t * The underlying data format for `Record` nodes is the same as that for `Map` nodes.\n\t * Therefore, changing an existing `Map` schema to a `Record` schema (or vice versa) is\n\t * a non-breaking change and does not require schema migration.\n\t *\n\t * @example\n\t * The returned schema should be used as a schema directly:\n\t * ```typescript\n\t * const MyRecord = factory.record(factory.number);\n\t * type MyRecord = NodeFromSchema<typeof Record>;\n\t * ```\n\t * Or inline:\n\t * ```typescript\n\t * factory.object(\"Foo\", { myRecord: factory.record(factory.number) });\n\t * ```\n\t *\n\t * @privateRemarks\n\t * The name produced at the type-level here is not as specific as it could be; however, doing type-level sorting and escaping is a real mess.\n\t * There are cases where not having this full type provided will be less than ideal, since TypeScript's structural types will allow assignment between runtime incompatible types at compile time.\n\t * For example, attempts to narrow unions of structural records by name won't work.\n\t * Planned future changes to move to a class based schema system as well as factor function based node construction should mostly avoid these issues,\n\t * though there may still be some problematic cases even after that work is done.\n\t *\n\t * The return value is a class, but its type is intentionally not specific enough to indicate it is a class.\n\t * This prevents callers of this from sub-classing it, which is unlikely to work well (due to the ease of accidentally giving two different calls to this different subclasses)\n\t * when working with structural typing.\n\t *\n\t * {@label STRUCTURAL}\n\t */\n\tpublic record<const T extends TreeNodeSchema | readonly TreeNodeSchema[]>(\n\t\tallowedTypes: T,\n\t): TreeNodeSchemaNonClass<\n\t\t/* Name */ ScopedSchemaName<TScope, `Record<${string}>`>,\n\t\t/* Kind */ NodeKind.Record,\n\t\t/* TNode */ TreeRecordNode<T> &\n\t\t\tWithType<ScopedSchemaName<TScope, `Record<${string}>`>, NodeKind.Record>,\n\t\t/* TInsertable */ RecordNodeInsertableData<T>,\n\t\t/* ImplicitlyConstructable */ true,\n\t\t/* Info */ T,\n\t\t/* TConstructorExtra */ undefined\n\t>;\n\n\t/**\n\t * Define (and add to this library) a {@link TreeNodeSchemaClass} for a {@link (TreeRecordNode:interface)}.\n\t *\n\t * @param name - Unique identifier for this schema within this factory's scope.\n\t * @param allowedTypes - The types that may appear in the record.\n\t * @param options - Additional options for the schema.\n\t *\n\t * @remarks\n\t * The underlying data format for `Record` nodes is the same as that for `Map` nodes.\n\t * Therefore, changing an existing `Map` schema to a `Record` schema (or vice versa) is\n\t * a non-breaking change and does not require schema migration.\n\t *\n\t * Like TypeScript `Record`s, record nodes have some potential pitfalls.\n\t * For example: TypeScript makes assumptions about built-in keys being present (e.g. `toString`, `hasOwnProperty`, etc.).\n\t * Since these are otherwise valid keys in a record, this can lead to unexpected behavior.\n\t * To prevent inconsistent behavior, these built-ins are hidden by record nodes.\n\t * This means that if you try to call these built-ins (e.g. `toString()`) on a record node, you will get an error.\n\t *\n\t * @example\n\t * ```typescript\n\t * class NamedRecord extends factory.record(\"name\", factory.number) {}\n\t * ```\n\t *\n\t * {@label NAMED}\n\t */\n\tpublic record<\n\t\tconst Name extends TName,\n\t\tconst T extends ImplicitAllowedTypes,\n\t\tconst TCustomMetadata = unknown,\n\t>(\n\t\tname: Name,\n\t\tallowedTypes: T,\n\t\toptions?: NodeSchemaOptions<TCustomMetadata>,\n\t): TreeNodeSchemaClass<\n\t\t/* Name */ ScopedSchemaName<TScope, Name>,\n\t\t/* Kind */ NodeKind.Record,\n\t\t/* TNode */ TreeRecordNode<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Record>,\n\t\t/* TInsertable */ RecordNodeInsertableData<T>,\n\t\t/* ImplicitlyConstructable */ true,\n\t\t/* Info */ T,\n\t\t/* TConstructorExtra */ undefined,\n\t\t/* TCustomMetadata */ TCustomMetadata\n\t>;\n\n\t/**\n\t * {@link SchemaFactoryBeta.record} implementation.\n\t *\n\t * @privateRemarks\n\t * This should return {@link TreeNodeSchemaBoth}: see note on {@link SchemaFactory.map} implementation for details.\n\t */\n\tpublic record<const T extends ImplicitAllowedTypes>(\n\t\tnameOrAllowedTypes: TName | ((T & TreeNodeSchema) | readonly TreeNodeSchema[]),\n\t\tmaybeAllowedTypes?: T,\n\t\toptions?: NodeSchemaOptions,\n\t): TreeNodeSchema<\n\t\t/* Name */ ScopedSchemaName<TScope, string>,\n\t\t/* Kind */ NodeKind.Record,\n\t\t/* TNode */ TreeRecordNode<T>,\n\t\t/* TInsertable */ RecordNodeInsertableData<T>,\n\t\t/* ImplicitlyConstructable */ true,\n\t\t/* Info */ T\n\t> {\n\t\tif (maybeAllowedTypes === undefined) {\n\t\t\tconst nodeTypes = nameOrAllowedTypes as (T & TreeNodeSchema) | readonly TreeNodeSchema[];\n\t\t\tconst fullName = structuralName(\"Record\", nodeTypes);\n\t\t\treturn this.getStructuralType(fullName, nodeTypes, () =>\n\t\t\t\tthis.namedRecord(\n\t\t\t\t\tfullName,\n\t\t\t\t\tnameOrAllowedTypes as T,\n\t\t\t\t\t/* customizable */ false,\n\t\t\t\t\t/* implicitlyConstructable */ true,\n\t\t\t\t),\n\t\t\t) as TreeNodeSchemaClass<\n\t\t\t\t/* Name */ ScopedSchemaName<TScope, string>,\n\t\t\t\t/* Kind */ NodeKind.Record,\n\t\t\t\t/* TNode */ TreeRecordNode<T>,\n\t\t\t\t/* TInsertable */ RecordNodeInsertableData<T>,\n\t\t\t\t/* ImplicitlyConstructable */ true,\n\t\t\t\t/* Info */ T,\n\t\t\t\t/* TConstructorExtra */ undefined\n\t\t\t>;\n\t\t}\n\t\tconst out: TreeNodeSchemaBoth<\n\t\t\t/* Name */ ScopedSchemaName<TScope, string>,\n\t\t\t/* Kind */ NodeKind.Record,\n\t\t\t/* TNode */ TreeRecordNode<T>,\n\t\t\t/* TInsertable */ RecordNodeInsertableData<T>,\n\t\t\t/* ImplicitlyConstructable */ true,\n\t\t\t/* Info */ T,\n\t\t\t/* TConstructorExtra */ undefined\n\t\t> = this.namedRecord(\n\t\t\tnameOrAllowedTypes as TName,\n\t\t\tmaybeAllowedTypes,\n\t\t\t/* customizable */ true,\n\t\t\t/* implicitlyConstructable */ true,\n\t\t\toptions,\n\t\t);\n\t\treturn out;\n\t}\n\n\t/**\n\t * Define a {@link TreeNodeSchema} for a {@link (TreeRecordNode:interface)}.\n\t *\n\t * @param name - Unique identifier for this schema within this factory's scope.\n\t *\n\t * @remarks\n\t * This is not intended to be used directly, use the overload of `record` which takes a name instead.\n\t */\n\tprivate namedRecord<\n\t\tName extends TName | string,\n\t\tconst T extends ImplicitAllowedTypes,\n\t\tconst ImplicitlyConstructable extends boolean,\n\t\tconst TCustomMetadata = unknown,\n\t>(\n\t\tname: Name,\n\t\tallowedTypes: T,\n\t\tcustomizable: boolean,\n\t\timplicitlyConstructable: ImplicitlyConstructable,\n\t\toptions?: NodeSchemaOptions<TCustomMetadata>,\n\t): TreeNodeSchemaBoth<\n\t\t/* Name */ ScopedSchemaName<TScope, Name>,\n\t\t/* Kind */ NodeKind.Record,\n\t\t/* TNode */ TreeRecordNode<T> &\n\t\t\tWithType<ScopedSchemaName<TScope, string>, NodeKind.Record>,\n\t\t/* TInsertable */ RecordNodeInsertableData<T>,\n\t\t/* ImplicitlyConstructable */ ImplicitlyConstructable,\n\t\t/* Info */ T,\n\t\t/* TConstructorExtra */ undefined\n\t> {\n\t\treturn recordSchema({\n\t\t\tidentifier: scoped<TScope, TName, Name>(this, name),\n\t\t\tinfo: allowedTypes,\n\t\t\tcustomizable,\n\t\t\timplicitlyConstructable,\n\t\t\tnodeOptions: options,\n\t\t});\n\t}\n\n\t/**\n\t * {@link SchemaFactoryBeta.(record:2)} except tweaked to work better for recursive types.\n\t * Use with {@link ValidateRecursiveSchema} for improved type safety.\n\t * @remarks\n\t * This version of `SchemaFactory.record` uses the same workarounds as {@link SchemaFactory.objectRecursive}.\n\t * See {@link ValidateRecursiveSchema} for additional information about using recursive schema.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n\tpublic recordRecursive<\n\t\tName extends TName,\n\t\tconst T extends System_Unsafe.ImplicitAllowedTypesUnsafe,\n\t\tconst TCustomMetadata = unknown,\n\t>(name: Name, allowedTypes: T, options?: NodeSchemaOptions<TCustomMetadata>) {\n\t\tconst RecordSchema = this.namedRecord(\n\t\t\tname,\n\t\t\tallowedTypes as T & ImplicitAllowedTypes,\n\t\t\t/* customizable */ true,\n\t\t\t// Setting this to true seems to work ok currently, but not for other node kinds.\n\t\t\t// Supporting this could be fragile and might break other future changes, so it's being kept as false for now.\n\t\t\t/* implicitlyConstructable */ false,\n\t\t\toptions,\n\t\t);\n\n\t\treturn RecordSchema as TreeNodeSchemaClass<\n\t\t\t/* Name */ ScopedSchemaName<TScope, Name>,\n\t\t\t/* Kind */ NodeKind.Record,\n\t\t\t/* TNode */ TreeRecordNodeUnsafe<T> &\n\t\t\t\tWithType<ScopedSchemaName<TScope, Name>, NodeKind.Record>,\n\t\t\t/* TInsertable */ {\n\t\t\t\t// Ideally this would be\n\t\t\t\t// RestrictiveStringRecord<InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>>,\n\t\t\t\t// but doing so breaks recursive types.\n\t\t\t\t// Instead we do a less nice version:\n\t\t\t\treadonly [P in string]: System_Unsafe.InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>;\n\t\t\t},\n\t\t\t/* ImplicitlyConstructable */ false,\n\t\t\t/* Info */ T,\n\t\t\t/* TConstructorExtra */ undefined,\n\t\t\t/* TCustomMetadata */ TCustomMetadata\n\t\t>;\n\t}\n}\n"]}
1
+ {"version":3,"file":"schemaFactoryBeta.js","sourceRoot":"","sources":["../../../src/simple-tree/api/schemaFactoryBeta.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,6BAA6B,EAC7B,mBAAmB,EACnB,+BAA+B,GAY/B,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACN,YAAY,EACZ,YAAY,GAKZ,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACN,iCAAiC,EACjC,aAAa,EACb,MAAM,EACN,cAAc,GAId,MAAM,oBAAoB,CAAC;AA4G5B,MAAM,MAAM,GAAG,CACd,CAA8B,EACJ,EAAE;IAC5B,MAAM,aAAa,GAAG,+BAA+B,CAAC,CAAC,CAAC,CAAC;IACzD,OAAO;QACN,IAAI,EAAE,aAAa,CAAC,IAAI;QACxB,QAAQ,EAAE;YACT,GAAG,aAAa,CAAC,QAAQ;YACzB,mBAAmB,EAAE,mBAAmB,EAAE;SAC1C;KACD,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,KAAK,GAAG,CACb,CAAI,EACJ,WAAiC,EAAE,EACJ,EAAE;IACjC,OAAO,6BAA6B,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(c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tAnnotatedAllowedTypesInternal,\n\tcreateSchemaUpgrade,\n\tnormalizeToAnnotatedAllowedType,\n\ttype AllowedTypesFullFromMixed,\n\ttype AllowedTypesMetadata,\n\ttype AnnotatedAllowedType,\n\ttype ImplicitAllowedTypes,\n\ttype LazyItem,\n\ttype NodeKind,\n\ttype TreeNodeSchema,\n\ttype TreeNodeSchemaBoth,\n\ttype TreeNodeSchemaClass,\n\ttype TreeNodeSchemaNonClass,\n\ttype WithType,\n} from \"../core/index.js\";\n\nimport {\n\tobjectSchema,\n\trecordSchema,\n\ttype InsertableObjectFromSchemaRecord,\n\ttype RecordNodeInsertableData,\n\ttype TreeObjectNode,\n\ttype TreeRecordNode,\n} from \"../node-kinds/index.js\";\nimport {\n\tdefaultSchemaFactoryObjectOptions,\n\tSchemaFactory,\n\tscoped,\n\tstructuralName,\n\ttype NodeSchemaOptions,\n\ttype ObjectSchemaOptions,\n\ttype ScopedSchemaName,\n} from \"./schemaFactory.js\";\nimport type {\n\tAllowedTypesFullFromMixedUnsafe,\n\tAnnotatedAllowedTypeUnsafe,\n\tSystem_Unsafe,\n\tTreeRecordNodeUnsafe,\n\tUnannotateAllowedTypeUnsafe,\n\tUnenforced,\n} from \"./typesUnsafe.js\";\n\n// These imports prevent a large number of type references in the API reports from showing up as *_2.\n/* eslint-disable unused-imports/no-unused-imports, @typescript-eslint/no-unused-vars, import-x/no-duplicates */\nimport type {\n\tFieldProps,\n\tFieldSchemaAlpha,\n\tFieldPropsAlpha,\n\tFieldKind,\n\tImplicitFieldSchema,\n} from \"../fieldSchema.js\";\nimport type { LeafSchema } from \"../leafNodeSchema.js\";\nimport type { SimpleLeafNodeSchema } from \"../simpleSchema.js\";\nimport type { RestrictiveStringRecord } from \"../../util/index.js\";\n/* eslint-enable unused-imports/no-unused-imports, @typescript-eslint/no-unused-vars, import-x/no-duplicates */\n\n/**\n * Stateless APIs exposed via {@link SchemaFactoryBeta} as both instance properties and as statics.\n * @see {@link SchemaStatics} for why this is useful.\n * @system @sealed @beta\n */\nexport interface SchemaStaticsBeta {\n\t/**\n\t * Declares a staged type in a set of {@link AllowedTypes}.\n\t *\n\t * @remarks\n\t * Staged allowed types add support for loading documents which may contain that type at the declared location.\n\t * This allows for an incremental rollout of a schema change to add a {@link TreeNodeSchema} to an {@link AllowedTypes} without breaking cross version collaboration.\n\t * A guide on this process can be found here: https://fluidframework.com/docs/data-structures/tree/schema-evolution/allowed-types-rollout\n\t *\n\t * Once enough clients have the type staged (and thus can read documents which allow it), documents can start being created and upgraded to allow the staged type.\n\t * This is done by deploying a new version of the app which removes the `staged` wrapper around the allowed type in the the schema definition.\n\t * This will also require {@link TreeView.upgradeSchema|upgrading the schema} for existing documents.\n\t *\n\t * Using a staged allowed type in a schema is just like using the schema as an allowed type with the following exceptions:\n\t *\n\t * 1. {@link TreeView.initialize} will omit the staged allowed type from the newly created stored schema.\n\t * 2. {@link TreeView.upgradeSchema} will omit the staged allowed type from the the upgraded stored schema.\n\t * 3. When evaluating {@link TreeView.compatibility}, it will be viewable even if the staged allowed type is not present in the stored schema's corresponding allowed types.\n\t * 4. Because of the above, it is possible to get errors when inserting content which uses the staged allowed type into a tree whose stored schema does not permit it.\n\t *\n\t * For recursive schemas, use {@link SchemaStaticsBeta.stagedRecursive} instead.\n\t * It offers equivalent runtime behavior with relaxed compile-time typing for recursive type.\n\t *\n\t * @example\n\t * A full code example of the schema migration process can be found in our {@link https://github.com/microsoft/FluidFramework/blob/main/packages/dds/tree/src/test/simple-tree/api/stagedSchemaUpgrade.spec.ts | tests}.\n\t *\n\t * @privateRemarks\n\t * TODO:#44317 staged allowed types rely on schema validation of stored schema to output errors, these errors are not very\n\t * user friendly and should be improved, particularly in the case of staged allowed types\n\t *\n\t * TODO: AB#45711: Update the docs above when recursive type support is added.\n\t */\n\treadonly staged: <const T extends LazyItem<TreeNodeSchema>>(\n\t\tt: T | AnnotatedAllowedType<T>,\n\t) => AnnotatedAllowedType<T>;\n\n\t/**\n\t * Normalize information about a set of {@link AllowedTypes} into an {@link AllowedTypesFull}.\n\t * @remarks\n\t * This can take in {@link AnnotatedAllowedType} to preserve their annotations.\n\t */\n\treadonly types: <\n\t\tconst T extends readonly (AnnotatedAllowedType | LazyItem<TreeNodeSchema>)[],\n\t>(\n\t\tt: T,\n\t\tmetadata?: AllowedTypesMetadata,\n\t) => AllowedTypesFullFromMixed<T>;\n\n\t/**\n\t * {@link SchemaStaticsBeta.staged} except tweaked to work better for recursive types.\n\t * Use with {@link ValidateRecursiveSchema} for improved type safety.\n\t * @remarks\n\t * This version of {@link SchemaStaticsBeta.staged} has fewer type constraints to work around TypeScript limitations, see {@link Unenforced}.\n\t * See {@link ValidateRecursiveSchema} for additional information about using recursive schema.\n\t */\n\tstagedRecursive: <\n\t\tconst T extends Unenforced<AnnotatedAllowedType | LazyItem<TreeNodeSchema>>,\n\t>(\n\t\tt: T,\n\t) => AnnotatedAllowedTypeUnsafe<UnannotateAllowedTypeUnsafe<T>>;\n\n\t/**\n\t * {@link SchemaStaticsBeta.types} except tweaked to work better for recursive types.\n\t * Use with {@link ValidateRecursiveSchema} for improved type safety.\n\t * @remarks\n\t * This version of {@link SchemaStaticsBeta.types} has fewer type constraints to work around TypeScript limitations, see {@link Unenforced}.\n\t * See {@link ValidateRecursiveSchema} for additional information about using recursive schema.\n\t * @privateRemarks\n\t * If all inputs (at least recursive ones) were required to be annotated, this could be typed more strongly.\n\t * In that case it could use `T extends readonly (AnnotatedAllowedTypeUnsafe | LazyItem<System_Unsafe.TreeNodeSchemaUnsafe>)[]`.\n\t */\n\treadonly typesRecursive: <\n\t\tconst T extends readonly Unenforced<AnnotatedAllowedType | LazyItem<TreeNodeSchema>>[],\n\t>(\n\t\tt: T,\n\t\tmetadata?: AllowedTypesMetadata,\n\t) => AllowedTypesFullFromMixedUnsafe<T>;\n}\n\nconst staged = <const T extends LazyItem<TreeNodeSchema>>(\n\tt: T | AnnotatedAllowedType<T>,\n): AnnotatedAllowedType<T> => {\n\tconst annotatedType = normalizeToAnnotatedAllowedType(t);\n\treturn {\n\t\ttype: annotatedType.type,\n\t\tmetadata: {\n\t\t\t...annotatedType.metadata,\n\t\t\tstagedSchemaUpgrade: createSchemaUpgrade(),\n\t\t},\n\t};\n};\n\nconst types = <const T extends readonly (AnnotatedAllowedType | LazyItem<TreeNodeSchema>)[]>(\n\tt: T,\n\tmetadata: AllowedTypesMetadata = {},\n): AllowedTypesFullFromMixed<T> => {\n\treturn AnnotatedAllowedTypesInternal.createMixed<T>(t, metadata);\n};\n\nconst schemaStaticsBeta: SchemaStaticsBeta = {\n\tstaged,\n\ttypes,\n\n\tstagedRecursive: staged as SchemaStaticsBeta[\"stagedRecursive\"],\n\ttypesRecursive: types as unknown as SchemaStaticsBeta[\"typesRecursive\"],\n};\n\n/**\n * {@link SchemaFactory} with additional beta APIs.\n * @beta\n * @privateRemarks\n */\nexport class SchemaFactoryBeta<\n\tout TScope extends string | undefined = string | undefined,\n\tTName extends number | string = string,\n> extends SchemaFactory<TScope, TName> {\n\t/**\n\t * {@inheritDoc SchemaStaticsBeta.staged}\n\t */\n\tpublic static staged = schemaStaticsBeta.staged;\n\n\t/**\n\t * {@inheritDoc SchemaStaticsBeta.staged}\n\t */\n\tpublic staged = schemaStaticsBeta.staged;\n\n\t/**\n\t * {@inheritDoc SchemaStaticsBeta.stagedRecursive}\n\t */\n\tpublic static stagedRecursive = schemaStaticsBeta.stagedRecursive;\n\n\t/**\n\t * {@inheritDoc SchemaStaticsBeta.stagedRecursive}\n\t */\n\tpublic stagedRecursive = schemaStaticsBeta.stagedRecursive;\n\n\t/**\n\t * {@inheritDoc SchemaStaticsBeta.types}\n\t */\n\tpublic static types = schemaStaticsBeta.types;\n\n\t/**\n\t * {@inheritDoc SchemaStaticsBeta.types}\n\t */\n\tpublic types = schemaStaticsBeta.types;\n\n\t/**\n\t * {@inheritDoc SchemaStaticsBeta.typesRecursive}\n\t */\n\tpublic static typesRecursive = schemaStaticsBeta.typesRecursive;\n\n\t/**\n\t * {@inheritDoc SchemaStaticsBeta.typesRecursive}\n\t */\n\tpublic typesRecursive = schemaStaticsBeta.typesRecursive;\n\n\t/**\n\t * Create a {@link SchemaFactory} with a {@link SchemaFactory.scope|scope} which is a combination of this factory's scope and the provided name.\n\t * @remarks\n\t * The main use-case for this is when creating a collection of related schema (for example using a function that creates multiple schema).\n\t * Creating such related schema using a sub-scope helps ensure they won't collide with other schema in the parent scope.\n\t */\n\tpublic scopedFactory<const T extends TName, TNameInner extends number | string = string>(\n\t\tname: T,\n\t): SchemaFactoryBeta<ScopedSchemaName<TScope, T>, TNameInner> {\n\t\treturn new SchemaFactoryBeta(scoped<TScope, TName, T>(this, name));\n\t}\n\n\t/**\n\t * Define a {@link TreeNodeSchemaClass} for a {@link TreeObjectNode}.\n\t *\n\t * @param name - Unique identifier for this schema within this factory's scope.\n\t * @param fields - Schema for fields of the object node's schema. Defines what children can be placed under each key.\n\t * @param options - Additional options for the schema.\n\t */\n\tpublic override object<\n\t\tconst Name extends TName,\n\t\tconst T extends RestrictiveStringRecord<ImplicitFieldSchema>,\n\t\tconst TCustomMetadata = unknown,\n\t>(\n\t\tname: Name,\n\t\tfields: T,\n\t\toptions?: ObjectSchemaOptions<TCustomMetadata>,\n\t): TreeNodeSchemaClass<\n\t\tScopedSchemaName<TScope, Name>,\n\t\tNodeKind.Object,\n\t\tTreeObjectNode<T, ScopedSchemaName<TScope, Name>>,\n\t\tobject & InsertableObjectFromSchemaRecord<T>,\n\t\ttrue,\n\t\tT,\n\t\tnever,\n\t\tTCustomMetadata\n\t> {\n\t\treturn objectSchema(scoped<TScope, TName, Name>(this, name), fields, true, {\n\t\t\t...defaultSchemaFactoryObjectOptions,\n\t\t\t...options,\n\t\t});\n\t}\n\n\tpublic override objectRecursive<\n\t\tconst Name extends TName,\n\t\tconst T extends RestrictiveStringRecord<System_Unsafe.ImplicitFieldSchemaUnsafe>,\n\t\tconst TCustomMetadata = unknown,\n\t>(\n\t\tname: Name,\n\t\tt: T,\n\t\toptions?: ObjectSchemaOptions<TCustomMetadata>,\n\t): TreeNodeSchemaClass<\n\t\tScopedSchemaName<TScope, Name>,\n\t\tNodeKind.Object,\n\t\tSystem_Unsafe.TreeObjectNodeUnsafe<T, ScopedSchemaName<TScope, Name>>,\n\t\tobject & System_Unsafe.InsertableObjectFromSchemaRecordUnsafe<T>,\n\t\tfalse,\n\t\tT,\n\t\tnever,\n\t\tTCustomMetadata\n\t> {\n\t\ttype TScopedName = ScopedSchemaName<TScope, Name>;\n\t\treturn this.object(\n\t\t\tname,\n\t\t\tt as T & RestrictiveStringRecord<ImplicitFieldSchema>,\n\t\t\toptions,\n\t\t) as unknown as TreeNodeSchemaClass<\n\t\t\tTScopedName,\n\t\t\tNodeKind.Object,\n\t\t\tSystem_Unsafe.TreeObjectNodeUnsafe<T, TScopedName>,\n\t\t\tobject & System_Unsafe.InsertableObjectFromSchemaRecordUnsafe<T>,\n\t\t\tfalse,\n\t\t\tT,\n\t\t\tnever,\n\t\t\tTCustomMetadata\n\t\t>;\n\t}\n\n\t/**\n\t * Define a structurally typed {@link TreeNodeSchema} for a {@link (TreeRecordNode:interface)}.\n\t *\n\t * @param allowedTypes - The types that may appear in the record.\n\t *\n\t * @remarks\n\t * The identifier for this record is defined as a function of the provided types.\n\t * It is still scoped to this `SchemaFactory`, but multiple calls with the same arguments will return the same\n\t * schema object, providing somewhat structural typing.\n\t * This does not support recursive types.\n\t *\n\t * If using these structurally named records, other types in this schema builder should avoid names of the form `Record<${string}>`.\n\t *\n\t * The underlying data format for `Record` nodes is the same as that for `Map` nodes.\n\t * Therefore, changing an existing `Map` schema to a `Record` schema (or vice versa) is\n\t * a non-breaking change and does not require schema migration.\n\t *\n\t * @example\n\t * The returned schema should be used as a schema directly:\n\t * ```typescript\n\t * const MyRecord = factory.record(factory.number);\n\t * type MyRecord = NodeFromSchema<typeof Record>;\n\t * ```\n\t * Or inline:\n\t * ```typescript\n\t * factory.object(\"Foo\", { myRecord: factory.record(factory.number) });\n\t * ```\n\t *\n\t * @privateRemarks\n\t * The name produced at the type-level here is not as specific as it could be; however, doing type-level sorting and escaping is a real mess.\n\t * There are cases where not having this full type provided will be less than ideal, since TypeScript's structural types will allow assignment between runtime incompatible types at compile time.\n\t * For example, attempts to narrow unions of structural records by name won't work.\n\t * Planned future changes to move to a class based schema system as well as factor function based node construction should mostly avoid these issues,\n\t * though there may still be some problematic cases even after that work is done.\n\t *\n\t * The return value is a class, but its type is intentionally not specific enough to indicate it is a class.\n\t * This prevents callers of this from sub-classing it, which is unlikely to work well (due to the ease of accidentally giving two different calls to this different subclasses)\n\t * when working with structural typing.\n\t *\n\t * {@label STRUCTURAL}\n\t */\n\tpublic record<const T extends TreeNodeSchema | readonly TreeNodeSchema[]>(\n\t\tallowedTypes: T,\n\t): TreeNodeSchemaNonClass<\n\t\t/* Name */ ScopedSchemaName<TScope, `Record<${string}>`>,\n\t\t/* Kind */ NodeKind.Record,\n\t\t/* TNode */ TreeRecordNode<T> &\n\t\t\tWithType<ScopedSchemaName<TScope, `Record<${string}>`>, NodeKind.Record>,\n\t\t/* TInsertable */ RecordNodeInsertableData<T>,\n\t\t/* ImplicitlyConstructable */ true,\n\t\t/* Info */ T,\n\t\t/* TConstructorExtra */ undefined\n\t>;\n\n\t/**\n\t * Define (and add to this library) a {@link TreeNodeSchemaClass} for a {@link (TreeRecordNode:interface)}.\n\t *\n\t * @param name - Unique identifier for this schema within this factory's scope.\n\t * @param allowedTypes - The types that may appear in the record.\n\t * @param options - Additional options for the schema.\n\t *\n\t * @remarks\n\t * The underlying data format for `Record` nodes is the same as that for `Map` nodes.\n\t * Therefore, changing an existing `Map` schema to a `Record` schema (or vice versa) is\n\t * a non-breaking change and does not require schema migration.\n\t *\n\t * Like TypeScript `Record`s, record nodes have some potential pitfalls.\n\t * For example: TypeScript makes assumptions about built-in keys being present (e.g. `toString`, `hasOwnProperty`, etc.).\n\t * Since these are otherwise valid keys in a record, this can lead to unexpected behavior.\n\t * To prevent inconsistent behavior, these built-ins are hidden by record nodes.\n\t * This means that if you try to call these built-ins (e.g. `toString()`) on a record node, you will get an error.\n\t *\n\t * @example\n\t * ```typescript\n\t * class NamedRecord extends factory.record(\"name\", factory.number) {}\n\t * ```\n\t *\n\t * {@label NAMED}\n\t */\n\tpublic record<\n\t\tconst Name extends TName,\n\t\tconst T extends ImplicitAllowedTypes,\n\t\tconst TCustomMetadata = unknown,\n\t>(\n\t\tname: Name,\n\t\tallowedTypes: T,\n\t\toptions?: NodeSchemaOptions<TCustomMetadata>,\n\t): TreeNodeSchemaClass<\n\t\t/* Name */ ScopedSchemaName<TScope, Name>,\n\t\t/* Kind */ NodeKind.Record,\n\t\t/* TNode */ TreeRecordNode<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Record>,\n\t\t/* TInsertable */ RecordNodeInsertableData<T>,\n\t\t/* ImplicitlyConstructable */ true,\n\t\t/* Info */ T,\n\t\t/* TConstructorExtra */ undefined,\n\t\t/* TCustomMetadata */ TCustomMetadata\n\t>;\n\n\t/**\n\t * {@link SchemaFactoryBeta.record} implementation.\n\t *\n\t * @privateRemarks\n\t * This should return {@link TreeNodeSchemaBoth}: see note on {@link SchemaFactory.map} implementation for details.\n\t */\n\tpublic record<const T extends ImplicitAllowedTypes>(\n\t\tnameOrAllowedTypes: TName | ((T & TreeNodeSchema) | readonly TreeNodeSchema[]),\n\t\tmaybeAllowedTypes?: T,\n\t\toptions?: NodeSchemaOptions,\n\t): TreeNodeSchema<\n\t\t/* Name */ ScopedSchemaName<TScope, string>,\n\t\t/* Kind */ NodeKind.Record,\n\t\t/* TNode */ TreeRecordNode<T>,\n\t\t/* TInsertable */ RecordNodeInsertableData<T>,\n\t\t/* ImplicitlyConstructable */ true,\n\t\t/* Info */ T\n\t> {\n\t\tif (maybeAllowedTypes === undefined) {\n\t\t\tconst nodeTypes = nameOrAllowedTypes as (T & TreeNodeSchema) | readonly TreeNodeSchema[];\n\t\t\tconst fullName = structuralName(\"Record\", nodeTypes);\n\t\t\treturn this.getStructuralType(fullName, nodeTypes, () =>\n\t\t\t\tthis.namedRecord(\n\t\t\t\t\tfullName,\n\t\t\t\t\tnameOrAllowedTypes as T,\n\t\t\t\t\t/* customizable */ false,\n\t\t\t\t\t/* implicitlyConstructable */ true,\n\t\t\t\t),\n\t\t\t) as TreeNodeSchemaClass<\n\t\t\t\t/* Name */ ScopedSchemaName<TScope, string>,\n\t\t\t\t/* Kind */ NodeKind.Record,\n\t\t\t\t/* TNode */ TreeRecordNode<T>,\n\t\t\t\t/* TInsertable */ RecordNodeInsertableData<T>,\n\t\t\t\t/* ImplicitlyConstructable */ true,\n\t\t\t\t/* Info */ T,\n\t\t\t\t/* TConstructorExtra */ undefined\n\t\t\t>;\n\t\t}\n\t\tconst out: TreeNodeSchemaBoth<\n\t\t\t/* Name */ ScopedSchemaName<TScope, string>,\n\t\t\t/* Kind */ NodeKind.Record,\n\t\t\t/* TNode */ TreeRecordNode<T>,\n\t\t\t/* TInsertable */ RecordNodeInsertableData<T>,\n\t\t\t/* ImplicitlyConstructable */ true,\n\t\t\t/* Info */ T,\n\t\t\t/* TConstructorExtra */ undefined\n\t\t> = this.namedRecord(\n\t\t\tnameOrAllowedTypes as TName,\n\t\t\tmaybeAllowedTypes,\n\t\t\t/* customizable */ true,\n\t\t\t/* implicitlyConstructable */ true,\n\t\t\toptions,\n\t\t);\n\t\treturn out;\n\t}\n\n\t/**\n\t * Define a {@link TreeNodeSchema} for a {@link (TreeRecordNode:interface)}.\n\t *\n\t * @param name - Unique identifier for this schema within this factory's scope.\n\t *\n\t * @remarks\n\t * This is not intended to be used directly, use the overload of `record` which takes a name instead.\n\t */\n\tprivate namedRecord<\n\t\tName extends TName | string,\n\t\tconst T extends ImplicitAllowedTypes,\n\t\tconst ImplicitlyConstructable extends boolean,\n\t\tconst TCustomMetadata = unknown,\n\t>(\n\t\tname: Name,\n\t\tallowedTypes: T,\n\t\tcustomizable: boolean,\n\t\timplicitlyConstructable: ImplicitlyConstructable,\n\t\toptions?: NodeSchemaOptions<TCustomMetadata>,\n\t): TreeNodeSchemaBoth<\n\t\t/* Name */ ScopedSchemaName<TScope, Name>,\n\t\t/* Kind */ NodeKind.Record,\n\t\t/* TNode */ TreeRecordNode<T> &\n\t\t\tWithType<ScopedSchemaName<TScope, string>, NodeKind.Record>,\n\t\t/* TInsertable */ RecordNodeInsertableData<T>,\n\t\t/* ImplicitlyConstructable */ ImplicitlyConstructable,\n\t\t/* Info */ T,\n\t\t/* TConstructorExtra */ undefined\n\t> {\n\t\treturn recordSchema({\n\t\t\tidentifier: scoped<TScope, TName, Name>(this, name),\n\t\t\tinfo: allowedTypes,\n\t\t\tcustomizable,\n\t\t\timplicitlyConstructable,\n\t\t\tnodeOptions: options,\n\t\t});\n\t}\n\n\t/**\n\t * {@link SchemaFactoryBeta.(record:2)} except tweaked to work better for recursive types.\n\t * Use with {@link ValidateRecursiveSchema} for improved type safety.\n\t * @remarks\n\t * This version of `SchemaFactory.record` uses the same workarounds as {@link SchemaFactory.objectRecursive}.\n\t * See {@link ValidateRecursiveSchema} for additional information about using recursive schema.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n\tpublic recordRecursive<\n\t\tName extends TName,\n\t\tconst T extends System_Unsafe.ImplicitAllowedTypesUnsafe,\n\t\tconst TCustomMetadata = unknown,\n\t>(name: Name, allowedTypes: T, options?: NodeSchemaOptions<TCustomMetadata>) {\n\t\tconst RecordSchema = this.namedRecord(\n\t\t\tname,\n\t\t\tallowedTypes as T & ImplicitAllowedTypes,\n\t\t\t/* customizable */ true,\n\t\t\t// Setting this to true seems to work ok currently, but not for other node kinds.\n\t\t\t// Supporting this could be fragile and might break other future changes, so it's being kept as false for now.\n\t\t\t/* implicitlyConstructable */ false,\n\t\t\toptions,\n\t\t);\n\n\t\treturn RecordSchema as TreeNodeSchemaClass<\n\t\t\t/* Name */ ScopedSchemaName<TScope, Name>,\n\t\t\t/* Kind */ NodeKind.Record,\n\t\t\t/* TNode */ TreeRecordNodeUnsafe<T> &\n\t\t\t\tWithType<ScopedSchemaName<TScope, Name>, NodeKind.Record>,\n\t\t\t/* TInsertable */ {\n\t\t\t\t// Ideally this would be\n\t\t\t\t// RestrictiveStringRecord<InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>>,\n\t\t\t\t// but doing so breaks recursive types.\n\t\t\t\t// Instead we do a less nice version:\n\t\t\t\treadonly [P in string]: System_Unsafe.InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>;\n\t\t\t},\n\t\t\t/* ImplicitlyConstructable */ false,\n\t\t\t/* Info */ T,\n\t\t\t/* TConstructorExtra */ undefined,\n\t\t\t/* TCustomMetadata */ TCustomMetadata\n\t\t>;\n\t}\n}\n"]}
@@ -69,9 +69,9 @@ function convertNodeSchema(schema, options) {
69
69
  function convertArrayNodeSchema(schema) {
70
70
  const allowedTypes = [];
71
71
  const allowedTypesIdentifiers = new Set(schema.simpleAllowedTypes.keys());
72
- allowedTypesIdentifiers.forEach((type) => {
72
+ for (const type of allowedTypesIdentifiers) {
73
73
  allowedTypes.push(createSchemaRef(type));
74
- });
74
+ }
75
75
  const items = hasSingle(allowedTypes)
76
76
  ? allowedTypes[0]
77
77
  : { anyOf: allowedTypes };
@@ -151,9 +151,9 @@ export function convertObjectNodeSchema(schema, options) {
151
151
  function convertRecordLikeNodeSchema(schema) {
152
152
  const allowedTypes = [];
153
153
  const allowedTypesIdentifiers = new Set(schema.simpleAllowedTypes.keys());
154
- allowedTypesIdentifiers.forEach((type) => {
154
+ for (const type of allowedTypesIdentifiers) {
155
155
  allowedTypes.push(createSchemaRef(type));
156
- });
156
+ }
157
157
  const output = {
158
158
  type: "object",
159
159
  _treeNodeSchemaKind: schema.kind,
@@ -1 +1 @@
1
- {"version":3,"file":"simpleSchemaToJsonSchema.js","sourceRoot":"","sources":["../../../src/simple-tree/api/simpleSchemaToJsonSchema.ts"],"names":[],"mappings":"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C,kBAAkB,CAAC,IAAI,EAAE,CAChC,CAAC;IACF,uBAAuB,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QACxC,YAAY,CAAC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG;QACd,IAAI,EAAE,QAAQ;QACd,mBAAmB,EAAE,MAAM,CAAC,IAAI;QAChC,iBAAiB,EAAE;YAClB,MAAM,EAAE,SAAS,CAAC,YAAY,CAAC;gBAC9B,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC;gBACjB,CAAC,CAAC;oBACA,KAAK,EAAE,YAAY;iBACnB;SACH;KACQ,CAAC;IAEX,YAAY,CAAC,MAAM,CAAC,QAAQ,EAAE,aAAa,EAAE,MAAM,CAAC,CAAC;IAErD,OAAO,MAAM,CAAC;AACf,CAAC;AAED,SAAS,eAAe,CAAC,QAAgB;IACxC,OAAO;QACN,MAAM,EAAE,aAAa,CAAC,QAAQ,CAAC;KAC/B,CAAC;AACH,CAAC;AAED,SAAS,aAAa,CAAC,QAAgB;IACtC,OAAO,WAAW,QAAQ,EAAE,CAAC;AAC9B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\nimport { ValueSchema } from \"../../core/index.js\";\nimport { copyProperty, hasSingle, type Mutable } from \"../../util/index.js\";\nimport type {\n\tJsonArrayNodeSchema,\n\tJsonFieldSchema,\n\tJsonSchemaRef,\n\tJsonRefPath,\n\tJsonLeafNodeSchema,\n\tJsonMapNodeSchema,\n\tJsonNodeSchema,\n\tJsonObjectNodeSchema,\n\tJsonTreeSchema,\n\tJsonLeafSchemaType,\n\tJsonRecordNodeSchema,\n} from \"./jsonSchema.js\";\nimport { FieldKind } from \"../fieldSchema.js\";\nimport type {\n\tSimpleArrayNodeSchema,\n\tSimpleLeafNodeSchema,\n\tSimpleMapNodeSchema,\n\tSimpleRecordNodeSchema,\n} from \"../simpleSchema.js\";\nimport { NodeKind, type TreeNodeSchema } from \"../core/index.js\";\nimport type { TreeSchema } from \"../treeSchema.js\";\nimport type { TreeSchemaEncodingOptions } from \"./getJsonSchema.js\";\nimport {\n\tArrayNodeSchema,\n\tisMapNodeSchema,\n\tisRecordNodeSchema,\n\tObjectNodeSchema,\n} from \"../node-kinds/index.js\";\nimport { LeafNodeSchema } from \"../leafNodeSchema.js\";\nimport { KeyEncodingOptions } from \"./customTree.js\";\n\n/**\n * Generates a JSON Schema representation from a simple tree schema.\n * @remarks\n * This expects the data to be in the {@link ConciseTree} format.\n *\n * This cannot handle the case where the root is undefined since undefined is not a concept in JSON.\n * This also cannot handle {@link SchemaStatics.handle} since they also are not supported in JSON.\n */\nexport function toJsonSchema(\n\tschema: TreeSchema,\n\toptions: Required<TreeSchemaEncodingOptions>,\n): JsonTreeSchema {\n\tconst definitions = convertDefinitions(schema.definitions, options);\n\n\tconst allowedTypes: JsonSchemaRef[] = [];\n\tfor (const allowedType of schema.root.allowedTypesIdentifiers) {\n\t\tallowedTypes.push(createSchemaRef(allowedType));\n\t}\n\n\t// TODO: deduplicate field handling logic from convertObjectNodeSchema: at least include metadata's description.\n\t// TODO: maybe account for consider schema.kind, or just take in ImplicitAllowedTypes\n\t// TODO: handle case where allowedTypes is empty.\n\t// TODO: handle staged types in a controllable way.\n\treturn hasSingle(allowedTypes)\n\t\t? {\n\t\t\t\t...allowedTypes[0],\n\t\t\t\t$defs: definitions,\n\t\t\t}\n\t\t: {\n\t\t\t\t$defs: definitions,\n\t\t\t\tanyOf: allowedTypes,\n\t\t\t};\n}\n\nfunction convertDefinitions(\n\tdefinitions: ReadonlyMap<string, TreeNodeSchema>,\n\toptions: Required<TreeSchemaEncodingOptions>,\n): Record<string, JsonNodeSchema> {\n\tconst result: Record<string, JsonNodeSchema> = {};\n\tfor (const [key, value] of definitions) {\n\t\tresult[key] = convertNodeSchema(value, options);\n\t}\n\treturn result;\n}\n\n/**\n * Converts an input {@link SimpleNodeSchema} to a {@link JsonNodeSchema}.\n *\n * @remarks Caches the result on the input schema for future calls.\n */\nfunction convertNodeSchema(\n\tschema: TreeNodeSchema,\n\toptions: Required<TreeSchemaEncodingOptions>,\n): JsonNodeSchema {\n\tif (schema instanceof ArrayNodeSchema) {\n\t\treturn convertArrayNodeSchema(schema);\n\t} else if (isMapNodeSchema(schema) || isRecordNodeSchema(schema)) {\n\t\treturn convertRecordLikeNodeSchema(schema);\n\t} else if (schema instanceof ObjectNodeSchema) {\n\t\treturn convertObjectNodeSchema(schema, options);\n\t} else if (schema instanceof LeafNodeSchema) {\n\t\treturn convertLeafNodeSchema(schema);\n\t}\n\tthrow new TypeError(`Unknown node schema kind: ${schema.kind}`);\n}\n\nfunction convertArrayNodeSchema(schema: SimpleArrayNodeSchema): JsonArrayNodeSchema {\n\tconst allowedTypes: JsonSchemaRef[] = [];\n\tconst allowedTypesIdentifiers: ReadonlySet<string> = new Set(\n\t\tschema.simpleAllowedTypes.keys(),\n\t);\n\tallowedTypesIdentifiers.forEach((type) => {\n\t\tallowedTypes.push(createSchemaRef(type));\n\t});\n\n\tconst items: JsonFieldSchema = hasSingle(allowedTypes)\n\t\t? allowedTypes[0]\n\t\t: { anyOf: allowedTypes };\n\n\tconst output: Mutable<JsonArrayNodeSchema> = {\n\t\ttype: \"array\",\n\t\t_treeNodeSchemaKind: NodeKind.Array,\n\t\titems,\n\t};\n\n\tcopyProperty(schema.metadata, \"description\", output);\n\n\treturn output;\n}\n\nfunction convertLeafNodeSchema(schema: SimpleLeafNodeSchema): JsonLeafNodeSchema {\n\tlet type: JsonLeafSchemaType;\n\tswitch (schema.leafKind) {\n\t\tcase ValueSchema.String: {\n\t\t\ttype = \"string\";\n\t\t\tbreak;\n\t\t}\n\t\tcase ValueSchema.Number: {\n\t\t\ttype = \"number\";\n\t\t\tbreak;\n\t\t}\n\t\tcase ValueSchema.Boolean: {\n\t\t\ttype = \"boolean\";\n\t\t\tbreak;\n\t\t}\n\t\tcase ValueSchema.Null: {\n\t\t\ttype = \"null\";\n\t\t\tbreak;\n\t\t}\n\t\tcase ValueSchema.FluidHandle: {\n\t\t\tthrow new UsageError(\"Fluid handles are not supported via JSON Schema.\");\n\t\t}\n\t\tdefault: {\n\t\t\tunreachableCase(schema.leafKind);\n\t\t}\n\t}\n\n\treturn {\n\t\ttype,\n\t\t_treeNodeSchemaKind: NodeKind.Leaf,\n\t};\n}\n\nexport function convertObjectNodeSchema(\n\tschema: ObjectNodeSchema,\n\toptions: Required<TreeSchemaEncodingOptions>,\n): JsonObjectNodeSchema {\n\tconst properties: Record<string, JsonFieldSchema> = {};\n\tconst required: string[] = [];\n\tfor (const [propertyKey, fieldSchema] of schema.fields) {\n\t\tconst key =\n\t\t\toptions.keys === KeyEncodingOptions.usePropertyKeys\n\t\t\t\t? propertyKey\n\t\t\t\t: fieldSchema.storedKey;\n\t\tconst allowedTypes: JsonSchemaRef[] = [];\n\t\tfor (const allowedType of fieldSchema.allowedTypesIdentifiers) {\n\t\t\tallowedTypes.push(createSchemaRef(allowedType));\n\t\t}\n\n\t\tconst output: Mutable<JsonFieldSchema> = hasSingle(allowedTypes)\n\t\t\t? allowedTypes[0]\n\t\t\t: {\n\t\t\t\t\tanyOf: allowedTypes,\n\t\t\t\t};\n\n\t\tcopyProperty(fieldSchema.metadata, \"description\", output);\n\t\tproperties[key] = output;\n\n\t\tif (\n\t\t\tfieldSchema.kind !== FieldKind.Optional &&\n\t\t\t(options.requireFieldsWithDefaults || fieldSchema.props?.defaultProvider === undefined)\n\t\t) {\n\t\t\trequired.push(key);\n\t\t}\n\t}\n\n\tconst transformedNode: Mutable<JsonObjectNodeSchema> = {\n\t\ttype: \"object\",\n\t\t_treeNodeSchemaKind: NodeKind.Object,\n\t\tproperties,\n\t\trequired,\n\t\t// TODO: support unknown optional fields (only when using \"allStoredKeys\", and constrain the content to be in schema somehow)\n\t\tadditionalProperties: false,\n\t};\n\n\tcopyProperty(schema.metadata, \"description\", transformedNode);\n\n\treturn transformedNode;\n}\n\nfunction convertRecordLikeNodeSchema(\n\tschema: SimpleRecordNodeSchema | SimpleMapNodeSchema,\n): JsonMapNodeSchema | JsonRecordNodeSchema {\n\tconst allowedTypes: JsonSchemaRef[] = [];\n\tconst allowedTypesIdentifiers: ReadonlySet<string> = new Set(\n\t\tschema.simpleAllowedTypes.keys(),\n\t);\n\tallowedTypesIdentifiers.forEach((type) => {\n\t\tallowedTypes.push(createSchemaRef(type));\n\t});\n\n\tconst output = {\n\t\ttype: \"object\",\n\t\t_treeNodeSchemaKind: schema.kind,\n\t\tpatternProperties: {\n\t\t\t\"^.*$\": hasSingle(allowedTypes)\n\t\t\t\t? allowedTypes[0]\n\t\t\t\t: {\n\t\t\t\t\t\tanyOf: allowedTypes,\n\t\t\t\t\t},\n\t\t},\n\t} as const;\n\n\tcopyProperty(schema.metadata, \"description\", output);\n\n\treturn output;\n}\n\nfunction createSchemaRef(schemaId: string): JsonSchemaRef {\n\treturn {\n\t\t\"$ref\": createRefPath(schemaId),\n\t};\n}\n\nfunction createRefPath(schemaId: string): JsonRefPath {\n\treturn `#/$defs/${schemaId}`;\n}\n"]}
1
+ {"version":3,"file":"simpleSchemaToJsonSchema.js","sourceRoot":"","sources":["../../../src/simple-tree/api/simpleSchemaToJsonSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,SAAS,EAAgB,MAAM,qBAAqB,CAAC;AAc5E,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAO9C,OAAO,EAAE,QAAQ,EAAuB,MAAM,kBAAkB,C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,CAAC,CAAC;gBACjB,CAAC,CAAC;oBACA,KAAK,EAAE,YAAY;iBACnB;SACH;KACQ,CAAC;IAEX,YAAY,CAAC,MAAM,CAAC,QAAQ,EAAE,aAAa,EAAE,MAAM,CAAC,CAAC;IAErD,OAAO,MAAM,CAAC;AACf,CAAC;AAED,SAAS,eAAe,CAAC,QAAgB;IACxC,OAAO;QACN,MAAM,EAAE,aAAa,CAAC,QAAQ,CAAC;KAC/B,CAAC;AACH,CAAC;AAED,SAAS,aAAa,CAAC,QAAgB;IACtC,OAAO,WAAW,QAAQ,EAAE,CAAC;AAC9B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\nimport { ValueSchema } from \"../../core/index.js\";\nimport { copyProperty, hasSingle, type Mutable } from \"../../util/index.js\";\nimport type {\n\tJsonArrayNodeSchema,\n\tJsonFieldSchema,\n\tJsonSchemaRef,\n\tJsonRefPath,\n\tJsonLeafNodeSchema,\n\tJsonMapNodeSchema,\n\tJsonNodeSchema,\n\tJsonObjectNodeSchema,\n\tJsonTreeSchema,\n\tJsonLeafSchemaType,\n\tJsonRecordNodeSchema,\n} from \"./jsonSchema.js\";\nimport { FieldKind } from \"../fieldSchema.js\";\nimport type {\n\tSimpleArrayNodeSchema,\n\tSimpleLeafNodeSchema,\n\tSimpleMapNodeSchema,\n\tSimpleRecordNodeSchema,\n} from \"../simpleSchema.js\";\nimport { NodeKind, type TreeNodeSchema } from \"../core/index.js\";\nimport type { TreeSchema } from \"../treeSchema.js\";\nimport type { TreeSchemaEncodingOptions } from \"./getJsonSchema.js\";\nimport {\n\tArrayNodeSchema,\n\tisMapNodeSchema,\n\tisRecordNodeSchema,\n\tObjectNodeSchema,\n} from \"../node-kinds/index.js\";\nimport { LeafNodeSchema } from \"../leafNodeSchema.js\";\nimport { KeyEncodingOptions } from \"./customTree.js\";\n\n/**\n * Generates a JSON Schema representation from a simple tree schema.\n * @remarks\n * This expects the data to be in the {@link ConciseTree} format.\n *\n * This cannot handle the case where the root is undefined since undefined is not a concept in JSON.\n * This also cannot handle {@link SchemaStatics.handle} since they also are not supported in JSON.\n */\nexport function toJsonSchema(\n\tschema: TreeSchema,\n\toptions: Required<TreeSchemaEncodingOptions>,\n): JsonTreeSchema {\n\tconst definitions = convertDefinitions(schema.definitions, options);\n\n\tconst allowedTypes: JsonSchemaRef[] = [];\n\tfor (const allowedType of schema.root.allowedTypesIdentifiers) {\n\t\tallowedTypes.push(createSchemaRef(allowedType));\n\t}\n\n\t// TODO: deduplicate field handling logic from convertObjectNodeSchema: at least include metadata's description.\n\t// TODO: maybe account for consider schema.kind, or just take in ImplicitAllowedTypes\n\t// TODO: handle case where allowedTypes is empty.\n\t// TODO: handle staged types in a controllable way.\n\treturn hasSingle(allowedTypes)\n\t\t? {\n\t\t\t\t...allowedTypes[0],\n\t\t\t\t$defs: definitions,\n\t\t\t}\n\t\t: {\n\t\t\t\t$defs: definitions,\n\t\t\t\tanyOf: allowedTypes,\n\t\t\t};\n}\n\nfunction convertDefinitions(\n\tdefinitions: ReadonlyMap<string, TreeNodeSchema>,\n\toptions: Required<TreeSchemaEncodingOptions>,\n): Record<string, JsonNodeSchema> {\n\tconst result: Record<string, JsonNodeSchema> = {};\n\tfor (const [key, value] of definitions) {\n\t\tresult[key] = convertNodeSchema(value, options);\n\t}\n\treturn result;\n}\n\n/**\n * Converts an input {@link SimpleNodeSchema} to a {@link JsonNodeSchema}.\n *\n * @remarks Caches the result on the input schema for future calls.\n */\nfunction convertNodeSchema(\n\tschema: TreeNodeSchema,\n\toptions: Required<TreeSchemaEncodingOptions>,\n): JsonNodeSchema {\n\tif (schema instanceof ArrayNodeSchema) {\n\t\treturn convertArrayNodeSchema(schema);\n\t} else if (isMapNodeSchema(schema) || isRecordNodeSchema(schema)) {\n\t\treturn convertRecordLikeNodeSchema(schema);\n\t} else if (schema instanceof ObjectNodeSchema) {\n\t\treturn convertObjectNodeSchema(schema, options);\n\t} else if (schema instanceof LeafNodeSchema) {\n\t\treturn convertLeafNodeSchema(schema);\n\t}\n\tthrow new TypeError(`Unknown node schema kind: ${schema.kind}`);\n}\n\nfunction convertArrayNodeSchema(schema: SimpleArrayNodeSchema): JsonArrayNodeSchema {\n\tconst allowedTypes: JsonSchemaRef[] = [];\n\tconst allowedTypesIdentifiers: ReadonlySet<string> = new Set(\n\t\tschema.simpleAllowedTypes.keys(),\n\t);\n\tfor (const type of allowedTypesIdentifiers) {\n\t\tallowedTypes.push(createSchemaRef(type));\n\t}\n\n\tconst items: JsonFieldSchema = hasSingle(allowedTypes)\n\t\t? allowedTypes[0]\n\t\t: { anyOf: allowedTypes };\n\n\tconst output: Mutable<JsonArrayNodeSchema> = {\n\t\ttype: \"array\",\n\t\t_treeNodeSchemaKind: NodeKind.Array,\n\t\titems,\n\t};\n\n\tcopyProperty(schema.metadata, \"description\", output);\n\n\treturn output;\n}\n\nfunction convertLeafNodeSchema(schema: SimpleLeafNodeSchema): JsonLeafNodeSchema {\n\tlet type: JsonLeafSchemaType;\n\tswitch (schema.leafKind) {\n\t\tcase ValueSchema.String: {\n\t\t\ttype = \"string\";\n\t\t\tbreak;\n\t\t}\n\t\tcase ValueSchema.Number: {\n\t\t\ttype = \"number\";\n\t\t\tbreak;\n\t\t}\n\t\tcase ValueSchema.Boolean: {\n\t\t\ttype = \"boolean\";\n\t\t\tbreak;\n\t\t}\n\t\tcase ValueSchema.Null: {\n\t\t\ttype = \"null\";\n\t\t\tbreak;\n\t\t}\n\t\tcase ValueSchema.FluidHandle: {\n\t\t\tthrow new UsageError(\"Fluid handles are not supported via JSON Schema.\");\n\t\t}\n\t\tdefault: {\n\t\t\tunreachableCase(schema.leafKind);\n\t\t}\n\t}\n\n\treturn {\n\t\ttype,\n\t\t_treeNodeSchemaKind: NodeKind.Leaf,\n\t};\n}\n\nexport function convertObjectNodeSchema(\n\tschema: ObjectNodeSchema,\n\toptions: Required<TreeSchemaEncodingOptions>,\n): JsonObjectNodeSchema {\n\tconst properties: Record<string, JsonFieldSchema> = {};\n\tconst required: string[] = [];\n\tfor (const [propertyKey, fieldSchema] of schema.fields) {\n\t\tconst key =\n\t\t\toptions.keys === KeyEncodingOptions.usePropertyKeys\n\t\t\t\t? propertyKey\n\t\t\t\t: fieldSchema.storedKey;\n\t\tconst allowedTypes: JsonSchemaRef[] = [];\n\t\tfor (const allowedType of fieldSchema.allowedTypesIdentifiers) {\n\t\t\tallowedTypes.push(createSchemaRef(allowedType));\n\t\t}\n\n\t\tconst output: Mutable<JsonFieldSchema> = hasSingle(allowedTypes)\n\t\t\t? allowedTypes[0]\n\t\t\t: {\n\t\t\t\t\tanyOf: allowedTypes,\n\t\t\t\t};\n\n\t\tcopyProperty(fieldSchema.metadata, \"description\", output);\n\t\tproperties[key] = output;\n\n\t\tif (\n\t\t\tfieldSchema.kind !== FieldKind.Optional &&\n\t\t\t(options.requireFieldsWithDefaults || fieldSchema.props?.defaultProvider === undefined)\n\t\t) {\n\t\t\trequired.push(key);\n\t\t}\n\t}\n\n\tconst transformedNode: Mutable<JsonObjectNodeSchema> = {\n\t\ttype: \"object\",\n\t\t_treeNodeSchemaKind: NodeKind.Object,\n\t\tproperties,\n\t\trequired,\n\t\t// TODO: support unknown optional fields (only when using \"allStoredKeys\", and constrain the content to be in schema somehow)\n\t\tadditionalProperties: false,\n\t};\n\n\tcopyProperty(schema.metadata, \"description\", transformedNode);\n\n\treturn transformedNode;\n}\n\nfunction convertRecordLikeNodeSchema(\n\tschema: SimpleRecordNodeSchema | SimpleMapNodeSchema,\n): JsonMapNodeSchema | JsonRecordNodeSchema {\n\tconst allowedTypes: JsonSchemaRef[] = [];\n\tconst allowedTypesIdentifiers: ReadonlySet<string> = new Set(\n\t\tschema.simpleAllowedTypes.keys(),\n\t);\n\tfor (const type of allowedTypesIdentifiers) {\n\t\tallowedTypes.push(createSchemaRef(type));\n\t}\n\n\tconst output = {\n\t\ttype: \"object\",\n\t\t_treeNodeSchemaKind: schema.kind,\n\t\tpatternProperties: {\n\t\t\t\"^.*$\": hasSingle(allowedTypes)\n\t\t\t\t? allowedTypes[0]\n\t\t\t\t: {\n\t\t\t\t\t\tanyOf: allowedTypes,\n\t\t\t\t\t},\n\t\t},\n\t} as const;\n\n\tcopyProperty(schema.metadata, \"description\", output);\n\n\treturn output;\n}\n\nfunction createSchemaRef(schemaId: string): JsonSchemaRef {\n\treturn {\n\t\t\"$ref\": createRefPath(schemaId),\n\t};\n}\n\nfunction createRefPath(schemaId: string): JsonRefPath {\n\treturn `#/$defs/${schemaId}`;\n}\n"]}