@scalar/workspace-store 0.14.2 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (499) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/dist/client.d.ts +24 -4
  3. package/dist/client.d.ts.map +1 -1
  4. package/dist/client.js +58 -52
  5. package/dist/client.js.map +2 -2
  6. package/dist/events/definitions.d.ts +155 -0
  7. package/dist/events/definitions.d.ts.map +1 -0
  8. package/dist/events/definitions.js +13 -0
  9. package/dist/events/definitions.js.map +7 -0
  10. package/dist/events/index.d.ts +3 -0
  11. package/dist/events/index.d.ts.map +1 -0
  12. package/dist/events/index.js +7 -0
  13. package/dist/events/index.js.map +7 -0
  14. package/dist/events/listeners.d.ts +8 -0
  15. package/dist/events/listeners.d.ts.map +1 -0
  16. package/dist/events/listeners.js +23 -0
  17. package/dist/events/listeners.js.map +7 -0
  18. package/dist/helpers/apply-selective-updates.d.ts +1 -1
  19. package/dist/helpers/apply-selective-updates.d.ts.map +1 -1
  20. package/dist/helpers/apply-selective-updates.js +1 -1
  21. package/dist/helpers/apply-selective-updates.js.map +2 -2
  22. package/dist/helpers/deep-clone.d.ts.map +1 -1
  23. package/dist/helpers/general.d.ts.map +1 -1
  24. package/dist/helpers/get-resolved-ref.d.ts.map +1 -1
  25. package/dist/helpers/merge-object.d.ts.map +1 -1
  26. package/dist/helpers/merge-object.js.map +2 -2
  27. package/dist/helpers/overrides-proxy.d.ts.map +1 -1
  28. package/dist/helpers/overrides-proxy.js.map +2 -2
  29. package/dist/mutators/cookie.d.ts.map +1 -1
  30. package/dist/mutators/environment.d.ts +1 -1
  31. package/dist/mutators/environment.d.ts.map +1 -1
  32. package/dist/mutators/environment.js.map +1 -1
  33. package/dist/mutators/helpers.d.ts.map +1 -1
  34. package/dist/mutators/index.d.ts +9 -9
  35. package/dist/mutators/request-example.d.ts.map +1 -1
  36. package/dist/mutators/request.d.ts +1 -1
  37. package/dist/mutators/request.d.ts.map +1 -1
  38. package/dist/mutators/request.js.map +2 -2
  39. package/dist/mutators/security-schemes.d.ts +1 -2
  40. package/dist/mutators/security-schemes.d.ts.map +1 -1
  41. package/dist/mutators/security-schemes.js.map +2 -2
  42. package/dist/mutators/server.d.ts +2 -2
  43. package/dist/mutators/server.d.ts.map +1 -1
  44. package/dist/mutators/server.js +4 -2
  45. package/dist/mutators/server.js.map +2 -2
  46. package/dist/navigation/helpers/get-tag.d.ts.map +1 -1
  47. package/dist/navigation/helpers/traverse-description.d.ts +3 -1
  48. package/dist/navigation/helpers/traverse-description.d.ts.map +1 -1
  49. package/dist/navigation/helpers/traverse-document.d.ts +30 -30
  50. package/dist/navigation/helpers/traverse-document.d.ts.map +1 -1
  51. package/dist/navigation/helpers/traverse-document.js.map +2 -2
  52. package/dist/navigation/helpers/traverse-paths.d.ts +5 -1
  53. package/dist/navigation/helpers/traverse-paths.d.ts.map +1 -1
  54. package/dist/navigation/helpers/traverse-paths.js +3 -3
  55. package/dist/navigation/helpers/traverse-paths.js.map +2 -2
  56. package/dist/navigation/helpers/traverse-schemas.d.ts +5 -1
  57. package/dist/navigation/helpers/traverse-schemas.d.ts.map +1 -1
  58. package/dist/navigation/helpers/traverse-schemas.js +1 -1
  59. package/dist/navigation/helpers/traverse-schemas.js.map +2 -2
  60. package/dist/navigation/helpers/traverse-tags.d.ts +6 -2
  61. package/dist/navigation/helpers/traverse-tags.d.ts.map +1 -1
  62. package/dist/navigation/helpers/traverse-tags.js.map +2 -2
  63. package/dist/navigation/helpers/traverse-webhooks.d.ts +6 -2
  64. package/dist/navigation/helpers/traverse-webhooks.d.ts.map +1 -1
  65. package/dist/navigation/helpers/traverse-webhooks.js +2 -2
  66. package/dist/navigation/helpers/traverse-webhooks.js.map +2 -2
  67. package/dist/navigation/helpers/utils.d.ts.map +1 -1
  68. package/dist/navigation/helpers/utils.js.map +2 -2
  69. package/dist/navigation/index.d.ts +1 -1
  70. package/dist/navigation/index.d.ts.map +1 -1
  71. package/dist/navigation/index.js.map +2 -2
  72. package/dist/navigation/types.d.ts +1 -2
  73. package/dist/navigation/types.d.ts.map +1 -1
  74. package/dist/plugins.d.ts +5 -37
  75. package/dist/plugins.d.ts.map +1 -1
  76. package/dist/plugins.js +0 -21
  77. package/dist/plugins.js.map +2 -2
  78. package/dist/preprocessing/server.d.ts +23 -0
  79. package/dist/preprocessing/server.d.ts.map +1 -0
  80. package/dist/preprocessing/server.js +84 -0
  81. package/dist/preprocessing/server.js.map +7 -0
  82. package/dist/schemas/compose.d.ts +1 -1
  83. package/dist/schemas/compose.d.ts.map +1 -1
  84. package/dist/schemas/compose.js +1 -1
  85. package/dist/schemas/compose.js.map +2 -2
  86. package/dist/schemas/extensions/document/x-internal.d.ts +2 -2
  87. package/dist/schemas/extensions/document/x-internal.js +1 -1
  88. package/dist/schemas/extensions/document/x-internal.js.map +1 -1
  89. package/dist/schemas/extensions/document/x-scalar-icon.d.ts +2 -2
  90. package/dist/schemas/extensions/document/x-scalar-icon.js +1 -1
  91. package/dist/schemas/extensions/document/x-scalar-icon.js.map +1 -1
  92. package/dist/schemas/extensions/document/x-scalar-ignore.d.ts +2 -2
  93. package/dist/schemas/extensions/document/x-scalar-ignore.js +1 -1
  94. package/dist/schemas/extensions/document/x-scalar-ignore.js.map +1 -1
  95. package/dist/schemas/extensions/document/x-scalar-sdk-installation.d.ts +7 -5
  96. package/dist/schemas/extensions/document/x-scalar-sdk-installation.d.ts.map +1 -1
  97. package/dist/schemas/extensions/document/x-scalar-sdk-installation.js +1 -1
  98. package/dist/schemas/extensions/document/x-scalar-sdk-installation.js.map +2 -2
  99. package/dist/schemas/extensions/document/x-tags.d.ts +4 -0
  100. package/dist/schemas/extensions/document/x-tags.d.ts.map +1 -0
  101. package/dist/schemas/extensions/document/x-tags.js +8 -0
  102. package/dist/schemas/extensions/document/x-tags.js.map +7 -0
  103. package/dist/schemas/extensions/operation/x-badge.d.ts +10 -10
  104. package/dist/schemas/extensions/operation/x-badge.d.ts.map +1 -1
  105. package/dist/schemas/extensions/operation/x-badge.js +1 -1
  106. package/dist/schemas/extensions/operation/x-badge.js.map +2 -2
  107. package/dist/schemas/extensions/operation/x-code-samples.d.ts +17 -17
  108. package/dist/schemas/extensions/operation/x-code-samples.js +1 -1
  109. package/dist/schemas/extensions/operation/x-code-samples.js.map +1 -1
  110. package/dist/schemas/extensions/operation/x-post-response.d.ts +2 -2
  111. package/dist/schemas/extensions/operation/x-post-response.js +1 -1
  112. package/dist/schemas/extensions/operation/x-post-response.js.map +1 -1
  113. package/dist/schemas/extensions/operation/x-scalar-stability.d.ts +2 -2
  114. package/dist/schemas/extensions/operation/x-scalar-stability.js +1 -1
  115. package/dist/schemas/extensions/operation/x-scalar-stability.js.map +1 -1
  116. package/dist/schemas/extensions/schema/x-additional-properties-name.d.ts +2 -2
  117. package/dist/schemas/extensions/schema/x-additional-properties-name.js +1 -1
  118. package/dist/schemas/extensions/schema/x-additional-properties-name.js.map +1 -1
  119. package/dist/schemas/extensions/schema/x-enum-descriptions.d.ts +2 -2
  120. package/dist/schemas/extensions/schema/x-enum-descriptions.js +1 -1
  121. package/dist/schemas/extensions/schema/x-enum-descriptions.js.map +1 -1
  122. package/dist/schemas/extensions/schema/x-variable.d.ts +2 -2
  123. package/dist/schemas/extensions/schema/x-variable.js +1 -1
  124. package/dist/schemas/extensions/schema/x-variable.js.map +1 -1
  125. package/dist/schemas/extensions/security/x-scalar-credentials-location.d.ts +2 -2
  126. package/dist/schemas/extensions/security/x-scalar-credentials-location.js +1 -1
  127. package/dist/schemas/extensions/security/x-scalar-credentials-location.js.map +1 -1
  128. package/dist/schemas/extensions/security/x-scalar-redirect-uri.d.ts +2 -2
  129. package/dist/schemas/extensions/security/x-scalar-redirect-uri.js +1 -1
  130. package/dist/schemas/extensions/security/x-scalar-redirect-uri.js.map +1 -1
  131. package/dist/schemas/extensions/security/x-scalar-security-body.d.ts +2 -2
  132. package/dist/schemas/extensions/security/x-scalar-security-body.js +1 -1
  133. package/dist/schemas/extensions/security/x-scalar-security-body.js.map +1 -1
  134. package/dist/schemas/extensions/security/x-scalar-security-query.d.ts +2 -2
  135. package/dist/schemas/extensions/security/x-scalar-security-query.js +1 -1
  136. package/dist/schemas/extensions/security/x-scalar-security-query.js.map +1 -1
  137. package/dist/schemas/extensions/security/x-scalar-security-secrets.d.ts +5 -5
  138. package/dist/schemas/extensions/security/x-scalar-security-secrets.js +1 -1
  139. package/dist/schemas/extensions/security/x-scalar-security-secrets.js.map +1 -1
  140. package/dist/schemas/extensions/security/x-tokenName.d.ts +2 -2
  141. package/dist/schemas/extensions/security/x-tokenName.js +1 -1
  142. package/dist/schemas/extensions/security/x-tokenName.js.map +1 -1
  143. package/dist/schemas/extensions/security/x-use-pkce.d.ts +2 -2
  144. package/dist/schemas/extensions/security/x-use-pkce.js +1 -1
  145. package/dist/schemas/extensions/security/x-use-pkce.js.map +1 -1
  146. package/dist/schemas/extensions/tag/x-display-name.d.ts +2 -2
  147. package/dist/schemas/extensions/tag/x-display-name.js +1 -1
  148. package/dist/schemas/extensions/tag/x-display-name.js.map +1 -1
  149. package/dist/schemas/extensions/tag/x-tag-groups.d.ts +7 -7
  150. package/dist/schemas/extensions/tag/x-tag-groups.js +1 -1
  151. package/dist/schemas/extensions/tag/x-tag-groups.js.map +1 -1
  152. package/dist/schemas/inmemory-workspace.d.ts +2470 -190
  153. package/dist/schemas/inmemory-workspace.d.ts.map +1 -1
  154. package/dist/schemas/inmemory-workspace.js +2 -3
  155. package/dist/schemas/inmemory-workspace.js.map +2 -2
  156. package/dist/schemas/navigation.d.ts +140 -134
  157. package/dist/schemas/navigation.d.ts.map +1 -1
  158. package/dist/schemas/navigation.js +13 -9
  159. package/dist/schemas/navigation.js.map +2 -2
  160. package/dist/schemas/reference-config/appearance.d.ts +9 -9
  161. package/dist/schemas/reference-config/appearance.d.ts.map +1 -1
  162. package/dist/schemas/reference-config/appearance.js +1 -1
  163. package/dist/schemas/reference-config/appearance.js.map +2 -2
  164. package/dist/schemas/reference-config/features.d.ts +11 -11
  165. package/dist/schemas/reference-config/features.d.ts.map +1 -1
  166. package/dist/schemas/reference-config/features.js +1 -1
  167. package/dist/schemas/reference-config/features.js.map +2 -2
  168. package/dist/schemas/reference-config/index.d.ts +1247 -46
  169. package/dist/schemas/reference-config/index.d.ts.map +1 -1
  170. package/dist/schemas/reference-config/index.js +5 -5
  171. package/dist/schemas/reference-config/index.js.map +2 -2
  172. package/dist/schemas/reference-config/meta.d.ts +8 -8
  173. package/dist/schemas/reference-config/meta.d.ts.map +1 -1
  174. package/dist/schemas/reference-config/meta.js +1 -1
  175. package/dist/schemas/reference-config/meta.js.map +2 -2
  176. package/dist/schemas/reference-config/routing.d.ts +4 -4
  177. package/dist/schemas/reference-config/routing.d.ts.map +1 -1
  178. package/dist/schemas/reference-config/routing.js +1 -1
  179. package/dist/schemas/reference-config/routing.js.map +2 -2
  180. package/dist/schemas/reference-config/settings.d.ts +1215 -14
  181. package/dist/schemas/reference-config/settings.d.ts.map +1 -1
  182. package/dist/schemas/reference-config/settings.js +2 -2
  183. package/dist/schemas/reference-config/settings.js.map +2 -2
  184. package/dist/schemas/typebox-coerce.d.ts +1 -1
  185. package/dist/schemas/typebox-coerce.d.ts.map +1 -1
  186. package/dist/schemas/typebox-coerce.js +2 -2
  187. package/dist/schemas/typebox-coerce.js.map +2 -2
  188. package/dist/schemas/v3.1/strict/callback.d.ts +1 -2
  189. package/dist/schemas/v3.1/strict/callback.d.ts.map +1 -1
  190. package/dist/schemas/v3.1/strict/callback.js +5 -4
  191. package/dist/schemas/v3.1/strict/callback.js.map +2 -2
  192. package/dist/schemas/v3.1/strict/client-config-extensions/x-scalar-client-config-cookies.d.ts +11 -11
  193. package/dist/schemas/v3.1/strict/client-config-extensions/x-scalar-client-config-cookies.d.ts.map +1 -1
  194. package/dist/schemas/v3.1/strict/client-config-extensions/x-scalar-client-config-cookies.js +1 -1
  195. package/dist/schemas/v3.1/strict/client-config-extensions/x-scalar-client-config-cookies.js.map +2 -2
  196. package/dist/schemas/v3.1/strict/client-config-extensions/x-scalar-client-config-environments.d.ts +19 -19
  197. package/dist/schemas/v3.1/strict/client-config-extensions/x-scalar-client-config-environments.d.ts.map +1 -1
  198. package/dist/schemas/v3.1/strict/client-config-extensions/x-scalar-client-config-environments.js +1 -1
  199. package/dist/schemas/v3.1/strict/client-config-extensions/x-scalar-client-config-environments.js.map +2 -2
  200. package/dist/schemas/v3.1/strict/client-config-extensions/x-scalar-client-config-request-example.d.ts +27 -27
  201. package/dist/schemas/v3.1/strict/client-config-extensions/x-scalar-client-config-request-example.d.ts.map +1 -1
  202. package/dist/schemas/v3.1/strict/client-config-extensions/x-scalar-client-config-request-example.js +1 -1
  203. package/dist/schemas/v3.1/strict/client-config-extensions/x-scalar-client-config-request-example.js.map +2 -2
  204. package/dist/schemas/v3.1/strict/components.d.ts +22 -42
  205. package/dist/schemas/v3.1/strict/components.d.ts.map +1 -1
  206. package/dist/schemas/v3.1/strict/components.js +24 -29
  207. package/dist/schemas/v3.1/strict/components.js.map +2 -2
  208. package/dist/schemas/v3.1/strict/contact.d.ts +4 -6
  209. package/dist/schemas/v3.1/strict/contact.d.ts.map +1 -1
  210. package/dist/schemas/v3.1/strict/contact.js +3 -3
  211. package/dist/schemas/v3.1/strict/contact.js.map +2 -2
  212. package/dist/schemas/v3.1/strict/discriminator.d.ts +3 -5
  213. package/dist/schemas/v3.1/strict/discriminator.d.ts.map +1 -1
  214. package/dist/schemas/v3.1/strict/discriminator.js +3 -3
  215. package/dist/schemas/v3.1/strict/discriminator.js.map +2 -2
  216. package/dist/schemas/v3.1/strict/encoding.d.ts +10 -4
  217. package/dist/schemas/v3.1/strict/encoding.d.ts.map +1 -1
  218. package/dist/schemas/v3.1/strict/encoding.js +5 -4
  219. package/dist/schemas/v3.1/strict/encoding.js.map +2 -2
  220. package/dist/schemas/v3.1/strict/example.d.ts +5 -7
  221. package/dist/schemas/v3.1/strict/example.d.ts.map +1 -1
  222. package/dist/schemas/v3.1/strict/example.js +3 -3
  223. package/dist/schemas/v3.1/strict/example.js.map +2 -2
  224. package/dist/schemas/v3.1/strict/external-documentation.d.ts +3 -5
  225. package/dist/schemas/v3.1/strict/external-documentation.d.ts.map +1 -1
  226. package/dist/schemas/v3.1/strict/external-documentation.js +3 -3
  227. package/dist/schemas/v3.1/strict/external-documentation.js.map +2 -2
  228. package/dist/schemas/v3.1/strict/header.d.ts +39 -347
  229. package/dist/schemas/v3.1/strict/header.d.ts.map +1 -1
  230. package/dist/schemas/v3.1/strict/header.js +8 -11
  231. package/dist/schemas/v3.1/strict/header.js.map +2 -2
  232. package/dist/schemas/v3.1/strict/info.d.ts +13 -23
  233. package/dist/schemas/v3.1/strict/info.d.ts.map +1 -1
  234. package/dist/schemas/v3.1/strict/info.js +7 -8
  235. package/dist/schemas/v3.1/strict/info.js.map +2 -2
  236. package/dist/schemas/v3.1/strict/license.d.ts +4 -6
  237. package/dist/schemas/v3.1/strict/license.d.ts.map +1 -1
  238. package/dist/schemas/v3.1/strict/license.js +3 -3
  239. package/dist/schemas/v3.1/strict/license.js.map +2 -2
  240. package/dist/schemas/v3.1/strict/link.d.ts +7 -17
  241. package/dist/schemas/v3.1/strict/link.d.ts.map +1 -1
  242. package/dist/schemas/v3.1/strict/link.js +5 -5
  243. package/dist/schemas/v3.1/strict/link.js.map +2 -2
  244. package/dist/schemas/v3.1/strict/media-type.d.ts +10 -164
  245. package/dist/schemas/v3.1/strict/media-type.d.ts.map +1 -1
  246. package/dist/schemas/v3.1/strict/media-type.js +7 -10
  247. package/dist/schemas/v3.1/strict/media-type.js.map +2 -2
  248. package/dist/schemas/v3.1/strict/oauth-flow.d.ts +59 -60
  249. package/dist/schemas/v3.1/strict/oauth-flow.d.ts.map +1 -1
  250. package/dist/schemas/v3.1/strict/oauth-flow.js +3 -3
  251. package/dist/schemas/v3.1/strict/oauth-flow.js.map +2 -2
  252. package/dist/schemas/v3.1/strict/oauthflows.d.ts +30 -32
  253. package/dist/schemas/v3.1/strict/oauthflows.d.ts.map +1 -1
  254. package/dist/schemas/v3.1/strict/oauthflows.js +6 -6
  255. package/dist/schemas/v3.1/strict/oauthflows.js.map +2 -2
  256. package/dist/schemas/v3.1/strict/openapi-document.d.ts +33908 -112
  257. package/dist/schemas/v3.1/strict/openapi-document.d.ts.map +1 -1
  258. package/dist/schemas/v3.1/strict/openapi-document.js +139 -24
  259. package/dist/schemas/v3.1/strict/openapi-document.js.map +2 -2
  260. package/dist/schemas/v3.1/strict/operation.d.ts +52 -4946
  261. package/dist/schemas/v3.1/strict/operation.d.ts.map +1 -1
  262. package/dist/schemas/v3.1/strict/operation.js +22 -19
  263. package/dist/schemas/v3.1/strict/operation.js.map +2 -2
  264. package/dist/schemas/v3.1/strict/parameter.d.ts +51 -1397
  265. package/dist/schemas/v3.1/strict/parameter.d.ts.map +1 -1
  266. package/dist/schemas/v3.1/strict/parameter.js +10 -11
  267. package/dist/schemas/v3.1/strict/parameter.js.map +2 -2
  268. package/dist/schemas/v3.1/strict/path-item.d.ts +15 -1412
  269. package/dist/schemas/v3.1/strict/path-item.d.ts.map +1 -1
  270. package/dist/schemas/v3.1/strict/path-item.js +15 -16
  271. package/dist/schemas/v3.1/strict/path-item.js.map +2 -2
  272. package/dist/schemas/v3.1/strict/paths.d.ts +1 -4
  273. package/dist/schemas/v3.1/strict/paths.d.ts.map +1 -1
  274. package/dist/schemas/v3.1/strict/paths.js +5 -5
  275. package/dist/schemas/v3.1/strict/paths.js.map +2 -2
  276. package/dist/schemas/v3.1/strict/ref-definitions.d.ts +63 -0
  277. package/dist/schemas/v3.1/strict/ref-definitions.d.ts.map +1 -0
  278. package/dist/schemas/v3.1/strict/ref-definitions.js +88 -0
  279. package/dist/schemas/v3.1/strict/ref-definitions.js.map +7 -0
  280. package/dist/schemas/v3.1/strict/reference.d.ts +8 -8
  281. package/dist/schemas/v3.1/strict/reference.d.ts.map +1 -1
  282. package/dist/schemas/v3.1/strict/reference.js +1 -1
  283. package/dist/schemas/v3.1/strict/reference.js.map +2 -2
  284. package/dist/schemas/v3.1/strict/request-body.d.ts +4 -520
  285. package/dist/schemas/v3.1/strict/request-body.d.ts.map +1 -1
  286. package/dist/schemas/v3.1/strict/request-body.js +5 -5
  287. package/dist/schemas/v3.1/strict/request-body.js.map +2 -2
  288. package/dist/schemas/v3.1/strict/response.d.ts +5 -1231
  289. package/dist/schemas/v3.1/strict/response.d.ts.map +1 -1
  290. package/dist/schemas/v3.1/strict/response.js +7 -8
  291. package/dist/schemas/v3.1/strict/response.js.map +2 -2
  292. package/dist/schemas/v3.1/strict/responses.d.ts +1 -2461
  293. package/dist/schemas/v3.1/strict/responses.d.ts.map +1 -1
  294. package/dist/schemas/v3.1/strict/responses.js +5 -5
  295. package/dist/schemas/v3.1/strict/responses.js.map +2 -2
  296. package/dist/schemas/v3.1/strict/schema.d.ts +337 -192
  297. package/dist/schemas/v3.1/strict/schema.d.ts.map +1 -1
  298. package/dist/schemas/v3.1/strict/schema.js +215 -207
  299. package/dist/schemas/v3.1/strict/schema.js.map +2 -2
  300. package/dist/schemas/v3.1/strict/security-requirement.d.ts +1 -3
  301. package/dist/schemas/v3.1/strict/security-requirement.d.ts.map +1 -1
  302. package/dist/schemas/v3.1/strict/security-requirement.js +3 -3
  303. package/dist/schemas/v3.1/strict/security-requirement.js.map +2 -2
  304. package/dist/schemas/v3.1/strict/security-scheme.d.ts +60 -130
  305. package/dist/schemas/v3.1/strict/security-scheme.d.ts.map +1 -1
  306. package/dist/schemas/v3.1/strict/security-scheme.js +5 -5
  307. package/dist/schemas/v3.1/strict/security-scheme.js.map +2 -2
  308. package/dist/schemas/v3.1/strict/server-variable.d.ts +4 -6
  309. package/dist/schemas/v3.1/strict/server-variable.d.ts.map +1 -1
  310. package/dist/schemas/v3.1/strict/server-variable.js +3 -3
  311. package/dist/schemas/v3.1/strict/server-variable.js.map +2 -2
  312. package/dist/schemas/v3.1/strict/server.d.ts +4 -10
  313. package/dist/schemas/v3.1/strict/server.d.ts.map +1 -1
  314. package/dist/schemas/v3.1/strict/server.js +5 -5
  315. package/dist/schemas/v3.1/strict/server.js.map +2 -2
  316. package/dist/schemas/v3.1/strict/tag.d.ts +10 -15
  317. package/dist/schemas/v3.1/strict/tag.d.ts.map +1 -1
  318. package/dist/schemas/v3.1/strict/tag.js +6 -6
  319. package/dist/schemas/v3.1/strict/tag.js.map +2 -2
  320. package/dist/schemas/v3.1/strict/xml.d.ts +6 -8
  321. package/dist/schemas/v3.1/strict/xml.d.ts.map +1 -1
  322. package/dist/schemas/v3.1/strict/xml.js +3 -3
  323. package/dist/schemas/v3.1/strict/xml.js.map +2 -2
  324. package/dist/schemas/workspace-specification/config.d.ts +1248 -47
  325. package/dist/schemas/workspace-specification/config.d.ts.map +1 -1
  326. package/dist/schemas/workspace-specification/config.js +1 -1
  327. package/dist/schemas/workspace-specification/config.js.map +2 -2
  328. package/dist/schemas/workspace-specification/index.d.ts +1260 -224
  329. package/dist/schemas/workspace-specification/index.d.ts.map +1 -1
  330. package/dist/schemas/workspace-specification/index.js +2 -3
  331. package/dist/schemas/workspace-specification/index.js.map +2 -2
  332. package/dist/schemas/workspace-specification/info.d.ts +3 -3
  333. package/dist/schemas/workspace-specification/info.js +1 -1
  334. package/dist/schemas/workspace-specification/info.js.map +1 -1
  335. package/dist/schemas/workspace.d.ts +8520 -199
  336. package/dist/schemas/workspace.d.ts.map +1 -1
  337. package/dist/schemas/workspace.js +6 -8
  338. package/dist/schemas/workspace.js.map +2 -2
  339. package/dist/schemas.d.ts +1 -1
  340. package/dist/schemas.d.ts.map +1 -1
  341. package/dist/schemas.js +1 -4
  342. package/dist/schemas.js.map +2 -2
  343. package/dist/server.d.ts +2 -4
  344. package/dist/server.d.ts.map +1 -1
  345. package/dist/server.js +7 -5
  346. package/dist/server.js.map +2 -2
  347. package/package.json +12 -6
  348. package/dist/schemas/typebox-types.d.ts +0 -14
  349. package/dist/schemas/typebox-types.d.ts.map +0 -1
  350. package/dist/schemas/typebox-types.js +0 -19
  351. package/dist/schemas/typebox-types.js.map +0 -7
  352. package/dist/schemas/v3.1/loose/callback.d.ts +0 -10
  353. package/dist/schemas/v3.1/loose/callback.d.ts.map +0 -1
  354. package/dist/schemas/v3.1/loose/callback.js +0 -11
  355. package/dist/schemas/v3.1/loose/callback.js.map +0 -7
  356. package/dist/schemas/v3.1/loose/client-config-extensions/x-scalar-client-config-cookies.d.ts +0 -16
  357. package/dist/schemas/v3.1/loose/client-config-extensions/x-scalar-client-config-cookies.d.ts.map +0 -1
  358. package/dist/schemas/v3.1/loose/client-config-extensions/x-scalar-client-config-cookies.js +0 -13
  359. package/dist/schemas/v3.1/loose/client-config-extensions/x-scalar-client-config-cookies.js.map +0 -7
  360. package/dist/schemas/v3.1/loose/client-config-extensions/x-scalar-client-config-environments.d.ts +0 -27
  361. package/dist/schemas/v3.1/loose/client-config-extensions/x-scalar-client-config-environments.d.ts.map +0 -1
  362. package/dist/schemas/v3.1/loose/client-config-extensions/x-scalar-client-config-environments.js +0 -23
  363. package/dist/schemas/v3.1/loose/client-config-extensions/x-scalar-client-config-environments.js.map +0 -7
  364. package/dist/schemas/v3.1/loose/client-config-extensions/x-scalar-client-config-request-example.d.ts +0 -38
  365. package/dist/schemas/v3.1/loose/client-config-extensions/x-scalar-client-config-request-example.d.ts.map +0 -1
  366. package/dist/schemas/v3.1/loose/client-config-extensions/x-scalar-client-config-request-example.js +0 -45
  367. package/dist/schemas/v3.1/loose/client-config-extensions/x-scalar-client-config-request-example.js.map +0 -7
  368. package/dist/schemas/v3.1/loose/components.d.ts +0 -43
  369. package/dist/schemas/v3.1/loose/components.d.ts.map +0 -1
  370. package/dist/schemas/v3.1/loose/components.js +0 -41
  371. package/dist/schemas/v3.1/loose/components.js.map +0 -7
  372. package/dist/schemas/v3.1/loose/contact.d.ts +0 -10
  373. package/dist/schemas/v3.1/loose/contact.d.ts.map +0 -1
  374. package/dist/schemas/v3.1/loose/contact.js +0 -13
  375. package/dist/schemas/v3.1/loose/contact.js.map +0 -7
  376. package/dist/schemas/v3.1/loose/discriminator.d.ts +0 -12
  377. package/dist/schemas/v3.1/loose/discriminator.d.ts.map +0 -1
  378. package/dist/schemas/v3.1/loose/discriminator.js +0 -11
  379. package/dist/schemas/v3.1/loose/discriminator.js.map +0 -7
  380. package/dist/schemas/v3.1/loose/encoding.d.ts +0 -15
  381. package/dist/schemas/v3.1/loose/encoding.d.ts.map +0 -1
  382. package/dist/schemas/v3.1/loose/encoding.js +0 -12
  383. package/dist/schemas/v3.1/loose/encoding.js.map +0 -7
  384. package/dist/schemas/v3.1/loose/example.d.ts +0 -16
  385. package/dist/schemas/v3.1/loose/example.d.ts.map +0 -1
  386. package/dist/schemas/v3.1/loose/example.js +0 -15
  387. package/dist/schemas/v3.1/loose/example.js.map +0 -7
  388. package/dist/schemas/v3.1/loose/external-documentation.d.ts +0 -8
  389. package/dist/schemas/v3.1/loose/external-documentation.d.ts.map +0 -1
  390. package/dist/schemas/v3.1/loose/external-documentation.js +0 -11
  391. package/dist/schemas/v3.1/loose/external-documentation.js.map +0 -7
  392. package/dist/schemas/v3.1/loose/header.d.ts +0 -355
  393. package/dist/schemas/v3.1/loose/header.d.ts.map +0 -1
  394. package/dist/schemas/v3.1/loose/header.js +0 -43
  395. package/dist/schemas/v3.1/loose/header.js.map +0 -7
  396. package/dist/schemas/v3.1/loose/info.d.ts +0 -48
  397. package/dist/schemas/v3.1/loose/info.d.ts.map +0 -1
  398. package/dist/schemas/v3.1/loose/info.js +0 -29
  399. package/dist/schemas/v3.1/loose/info.js.map +0 -7
  400. package/dist/schemas/v3.1/loose/license.d.ts +0 -10
  401. package/dist/schemas/v3.1/loose/license.d.ts.map +0 -1
  402. package/dist/schemas/v3.1/loose/license.js +0 -13
  403. package/dist/schemas/v3.1/loose/license.js.map +0 -7
  404. package/dist/schemas/v3.1/loose/link.d.ts +0 -30
  405. package/dist/schemas/v3.1/loose/link.d.ts.map +0 -1
  406. package/dist/schemas/v3.1/loose/link.js +0 -20
  407. package/dist/schemas/v3.1/loose/link.js.map +0 -7
  408. package/dist/schemas/v3.1/loose/media-header-encoding.d.ts +0 -1012
  409. package/dist/schemas/v3.1/loose/media-header-encoding.d.ts.map +0 -1
  410. package/dist/schemas/v3.1/loose/media-header-encoding.js +0 -19
  411. package/dist/schemas/v3.1/loose/media-header-encoding.js.map +0 -7
  412. package/dist/schemas/v3.1/loose/media-type.d.ts +0 -161
  413. package/dist/schemas/v3.1/loose/media-type.d.ts.map +0 -1
  414. package/dist/schemas/v3.1/loose/media-type.js +0 -18
  415. package/dist/schemas/v3.1/loose/media-type.js.map +0 -7
  416. package/dist/schemas/v3.1/loose/oauth-flow.d.ts +0 -95
  417. package/dist/schemas/v3.1/loose/oauth-flow.d.ts.map +0 -1
  418. package/dist/schemas/v3.1/loose/oauth-flow.js +0 -57
  419. package/dist/schemas/v3.1/loose/oauth-flow.js.map +0 -7
  420. package/dist/schemas/v3.1/loose/oauthflows.d.ts +0 -43
  421. package/dist/schemas/v3.1/loose/oauthflows.d.ts.map +0 -1
  422. package/dist/schemas/v3.1/loose/oauthflows.js +0 -21
  423. package/dist/schemas/v3.1/loose/oauthflows.js.map +0 -7
  424. package/dist/schemas/v3.1/loose/openapi-document.d.ts +0 -115
  425. package/dist/schemas/v3.1/loose/openapi-document.d.ts.map +0 -1
  426. package/dist/schemas/v3.1/loose/openapi-document.js +0 -64
  427. package/dist/schemas/v3.1/loose/openapi-document.js.map +0 -7
  428. package/dist/schemas/v3.1/loose/operation.d.ts +0 -1645
  429. package/dist/schemas/v3.1/loose/operation.d.ts.map +0 -1
  430. package/dist/schemas/v3.1/loose/operation.js +0 -61
  431. package/dist/schemas/v3.1/loose/operation.js.map +0 -7
  432. package/dist/schemas/v3.1/loose/parameter.d.ts +0 -1074
  433. package/dist/schemas/v3.1/loose/parameter.d.ts.map +0 -1
  434. package/dist/schemas/v3.1/loose/parameter.js +0 -54
  435. package/dist/schemas/v3.1/loose/parameter.js.map +0 -7
  436. package/dist/schemas/v3.1/loose/path-item.d.ts +0 -551
  437. package/dist/schemas/v3.1/loose/path-item.d.ts.map +0 -1
  438. package/dist/schemas/v3.1/loose/path-item.js +0 -42
  439. package/dist/schemas/v3.1/loose/path-item.js.map +0 -7
  440. package/dist/schemas/v3.1/loose/path-operations.d.ts +0 -2196
  441. package/dist/schemas/v3.1/loose/path-operations.d.ts.map +0 -1
  442. package/dist/schemas/v3.1/loose/path-operations.js +0 -21
  443. package/dist/schemas/v3.1/loose/path-operations.js.map +0 -7
  444. package/dist/schemas/v3.1/loose/paths.d.ts +0 -20
  445. package/dist/schemas/v3.1/loose/paths.d.ts.map +0 -1
  446. package/dist/schemas/v3.1/loose/paths.js +0 -11
  447. package/dist/schemas/v3.1/loose/paths.js.map +0 -7
  448. package/dist/schemas/v3.1/loose/reference.d.ts +0 -26
  449. package/dist/schemas/v3.1/loose/reference.d.ts.map +0 -1
  450. package/dist/schemas/v3.1/loose/reference.js +0 -24
  451. package/dist/schemas/v3.1/loose/reference.js.map +0 -7
  452. package/dist/schemas/v3.1/loose/request-body.d.ts +0 -339
  453. package/dist/schemas/v3.1/loose/request-body.d.ts.map +0 -1
  454. package/dist/schemas/v3.1/loose/request-body.js +0 -14
  455. package/dist/schemas/v3.1/loose/request-body.js.map +0 -7
  456. package/dist/schemas/v3.1/loose/response.d.ts +0 -698
  457. package/dist/schemas/v3.1/loose/response.d.ts.map +0 -1
  458. package/dist/schemas/v3.1/loose/response.js +0 -18
  459. package/dist/schemas/v3.1/loose/response.js.map +0 -7
  460. package/dist/schemas/v3.1/loose/responses.d.ts +0 -710
  461. package/dist/schemas/v3.1/loose/responses.d.ts.map +0 -1
  462. package/dist/schemas/v3.1/loose/responses.js +0 -11
  463. package/dist/schemas/v3.1/loose/responses.js.map +0 -7
  464. package/dist/schemas/v3.1/loose/schema.d.ts +0 -373
  465. package/dist/schemas/v3.1/loose/schema.d.ts.map +0 -1
  466. package/dist/schemas/v3.1/loose/schema.js +0 -146
  467. package/dist/schemas/v3.1/loose/schema.js.map +0 -7
  468. package/dist/schemas/v3.1/loose/security-requirement.d.ts +0 -11
  469. package/dist/schemas/v3.1/loose/security-requirement.d.ts.map +0 -1
  470. package/dist/schemas/v3.1/loose/security-requirement.js +0 -10
  471. package/dist/schemas/v3.1/loose/security-requirement.js.map +0 -7
  472. package/dist/schemas/v3.1/loose/security-scheme.d.ts +0 -169
  473. package/dist/schemas/v3.1/loose/security-scheme.d.ts.map +0 -1
  474. package/dist/schemas/v3.1/loose/security-scheme.js +0 -64
  475. package/dist/schemas/v3.1/loose/security-scheme.js.map +0 -7
  476. package/dist/schemas/v3.1/loose/server-variable.d.ts +0 -10
  477. package/dist/schemas/v3.1/loose/server-variable.d.ts.map +0 -1
  478. package/dist/schemas/v3.1/loose/server-variable.js +0 -13
  479. package/dist/schemas/v3.1/loose/server-variable.js.map +0 -7
  480. package/dist/schemas/v3.1/loose/server.d.ts +0 -14
  481. package/dist/schemas/v3.1/loose/server.d.ts.map +0 -1
  482. package/dist/schemas/v3.1/loose/server.js +0 -14
  483. package/dist/schemas/v3.1/loose/server.js.map +0 -7
  484. package/dist/schemas/v3.1/loose/tag.d.ts +0 -19
  485. package/dist/schemas/v3.1/loose/tag.d.ts.map +0 -1
  486. package/dist/schemas/v3.1/loose/tag.js +0 -23
  487. package/dist/schemas/v3.1/loose/tag.js.map +0 -7
  488. package/dist/schemas/v3.1/loose/xml.d.ts +0 -18
  489. package/dist/schemas/v3.1/loose/xml.d.ts.map +0 -1
  490. package/dist/schemas/v3.1/loose/xml.js +0 -17
  491. package/dist/schemas/v3.1/loose/xml.js.map +0 -7
  492. package/dist/schemas/v3.1/strict/media-header-encoding.d.ts +0 -1560
  493. package/dist/schemas/v3.1/strict/media-header-encoding.d.ts.map +0 -1
  494. package/dist/schemas/v3.1/strict/media-header-encoding.js +0 -19
  495. package/dist/schemas/v3.1/strict/media-header-encoding.js.map +0 -7
  496. package/dist/schemas/v3.1/strict/path-operations.d.ts +0 -10628
  497. package/dist/schemas/v3.1/strict/path-operations.d.ts.map +0 -1
  498. package/dist/schemas/v3.1/strict/path-operations.js +0 -21
  499. package/dist/schemas/v3.1/strict/path-operations.js.map +0 -7
package/CHANGELOG.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # @scalar/workspace-store
2
2
 
3
+ ## 0.15.0
4
+
5
+ ### Minor Changes
6
+
7
+ - a6ae22a: feat: change the way we declare schemas
8
+ - 99894bc: feat: correctly validate the schemas
9
+ - 5ad329e: feat: openapi auth selector block
10
+
11
+ ### Patch Changes
12
+
13
+ - ba27329: chore: switch to the new version of typebox
14
+ - 3473e08: fix: performance issues on script load
15
+ - 63283aa: fix: use hidden properties during validation
16
+ - 8680da6: chore: delete loose schemas
17
+ - Updated dependencies [40e79b9]
18
+ - Updated dependencies [06a46f0]
19
+ - Updated dependencies [98c55d0]
20
+ - Updated dependencies [792c937]
21
+ - Updated dependencies [63283aa]
22
+ - Updated dependencies [0e747c7]
23
+ - Updated dependencies [99894bc]
24
+ - @scalar/snippetz@0.4.8
25
+ - @scalar/json-magic@0.4.0
26
+ - @scalar/helpers@0.0.9
27
+ - @scalar/types@0.2.14
28
+ - @scalar/openapi-parser@0.20.2
29
+ - @scalar/code-highlight@0.1.9
30
+
3
31
  ## 0.14.2
4
32
 
5
33
  ### Patch Changes
package/dist/client.d.ts CHANGED
@@ -1,10 +1,11 @@
1
+ import { type Difference, merge } from '@scalar/json-magic/diff';
2
+ import type { PartialDeep } from 'type-fest/source/partial-deep';
3
+ import type { RequiredDeep } from 'type-fest/source/required-deep';
1
4
  import type { TraverseSpecOptions } from './navigation/types.js';
2
- import { type InMemoryWorkspace } from './schemas/inmemory-workspace.js';
5
+ import { type OpenApiDocument } from './schemas/v3.1/strict/openapi-document.js';
3
6
  import type { Workspace, WorkspaceDocumentMeta, WorkspaceMeta } from './schemas/workspace.js';
4
7
  import type { WorkspaceSpecification } from './schemas/workspace-specification/index.js';
5
8
  import type { Config } from './schemas/workspace-specification/config.js';
6
- import { type Difference, merge } from '@scalar/json-magic/diff';
7
- import type { PartialDeep, RequiredDeep } from 'type-fest';
8
9
  export type DocumentConfiguration = Config & PartialDeep<{
9
10
  'x-scalar-reference-config': {
10
11
  tagSort: TraverseSpecOptions['tagsSorter'];
@@ -54,7 +55,7 @@ type WorkspaceDocumentMetaInput = {
54
55
  /** Optional configuration options */
55
56
  config?: DocumentConfiguration;
56
57
  /** Overrides for the document */
57
- overrides?: InMemoryWorkspace['overrides'][string];
58
+ overrides?: PartialDeep<OpenApiDocument>;
58
59
  /** Optional custom fetch implementation to use when retrieving the document. By default the global fetch implementation will be used */
59
60
  fetch?: (input: string | URL | globalThis.Request, init?: RequestInit) => Promise<Response>;
60
61
  };
@@ -202,6 +203,25 @@ export type WorkspaceStore = {
202
203
  * const yamlString = store.exportDocument('api', 'yaml')
203
204
  */
204
205
  exportDocument(documentName: string, format: 'json' | 'yaml'): string | undefined;
206
+ /**
207
+ * Exports the currently active document in the requested format.
208
+ *
209
+ * This is a convenience method that exports the active document (determined by the workspace's
210
+ * activeDocument extension) without requiring the caller to specify the document name.
211
+ * The exported document reflects the last locally saved state, including any edits that have
212
+ * been saved but not yet synced to a remote registry.
213
+ *
214
+ * @param format - The output format: 'json' for a JSON string, or 'yaml' for a YAML string.
215
+ * @returns The active document as a string in the requested format, or undefined if no active document exists.
216
+ *
217
+ * @example
218
+ * // Export the active document as JSON
219
+ * const jsonString = store.exportActiveDocument('json')
220
+ *
221
+ * // Export the active document as YAML
222
+ * const yamlString = store.exportActiveDocument('yaml')
223
+ */
224
+ exportActiveDocument(format: 'json' | 'yaml'): string | undefined;
205
225
  /**
206
226
  * Saves the current state of the specified document to the intermediate documents map.
207
227
  *
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAG7D,OAAO,EAAE,KAAK,iBAAiB,EAA2B,MAAM,8BAA8B,CAAA;AAQ9F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;OAiBG;IACH,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;IACjE;;;;;;;;;;;;;;;;;;OAkBG;IACH,YAAY,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,GAAG,SAAS,CAAC,CAAA;IAClE;;;;;;;;;;;;;;;;OAgBG;IACH,qBAAqB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC1D;;;;;;;;;OASG;IACH,cAAc,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1C;;;;;;;;;OASG;IACH,eAAe,IAAI,MAAM,CAAA;IACzB;;;;;;;;OAQG;IACH,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IAClC;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,gCAAgC,CAAC,aAAa,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,CAAA;IACxF;;;;;;;;;;;;;;;;;;;OAmBG;IACH,cAAc,EAAE,CACd,YAAY,EAAE,MAAM,EACpB,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC1C,iBAAiB,CAAC,EAAE,UAAU,CAAC,OAAO,CAAC,EAAE,KACtC,IAAI,GAAG,UAAU,CAAC,OAAO,KAAK,CAAC,CAAC,WAAW,CAAC,CAAA;CAClD,CAAA;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,oBAAoB,GAAI,iBAAiB,cAAc,KAAG,cA+ftE,CAAA;AAGD,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAA"}
package/dist/client.js CHANGED
@@ -1,5 +1,10 @@
1
+ import { measureAsync, measureSync } from "@scalar/helpers/testing/measure";
2
+ import { bundle } from "@scalar/json-magic/bundle";
3
+ import { fetchUrls } from "@scalar/json-magic/bundle/plugins/browser";
4
+ import { apply, diff, merge } from "@scalar/json-magic/diff";
1
5
  import { createMagicProxy, getRaw } from "@scalar/json-magic/magic-proxy";
2
6
  import { upgrade } from "@scalar/openapi-parser";
7
+ import { Value } from "@scalar/typebox/value";
3
8
  import { reactive } from "vue";
4
9
  import YAML from "yaml";
5
10
  import { applySelectiveUpdates } from "./helpers/apply-selective-updates.js";
@@ -10,19 +15,14 @@ import { mergeObjects } from "./helpers/merge-object.js";
10
15
  import { createOverridesProxy } from "./helpers/overrides-proxy.js";
11
16
  import { createNavigation } from "./navigation/index.js";
12
17
  import { externalValueResolver, loadingStatus, refsEverywhere, restoreOriginalRefs } from "./plugins.js";
18
+ import { getServersFromDocument } from "./preprocessing/server.js";
13
19
  import { extensions } from "./schemas/extensions.js";
14
20
  import { InMemoryWorkspaceSchema } from "./schemas/inmemory-workspace.js";
15
21
  import { defaultReferenceConfig } from "./schemas/reference-config/index.js";
16
22
  import { coerceValue } from "./schemas/typebox-coerce.js";
17
- import { OpenAPIDocumentSchema as OpenAPIDocumentSchemaLoose } from "./schemas/v3.1/loose/openapi-document.js";
18
23
  import {
19
24
  OpenAPIDocumentSchema as OpenAPIDocumentSchemaStrict
20
25
  } from "./schemas/v3.1/strict/openapi-document.js";
21
- import { measureAsync, measureSync } from "@scalar/helpers/testing/measure";
22
- import { bundle } from "@scalar/json-magic/bundle";
23
- import { fetchUrls } from "@scalar/json-magic/bundle/plugins/browser";
24
- import { apply, diff, merge } from "@scalar/json-magic/diff";
25
- import { Value } from "@sinclair/typebox/value";
26
26
  const defaultConfig = {
27
27
  "x-scalar-reference-config": defaultReferenceConfig
28
28
  };
@@ -66,6 +66,16 @@ const createWorkspaceStore = (workspaceProps) => {
66
66
  function getActiveDocumentName() {
67
67
  return workspace[extensions.workspace.activeDocument] ?? Object.keys(workspace.documents)[0] ?? "";
68
68
  }
69
+ function exportDocument(documentName, format) {
70
+ const intermediateDocument = intermediateDocuments[documentName];
71
+ if (!intermediateDocument) {
72
+ return;
73
+ }
74
+ if (format === "json") {
75
+ return JSON.stringify(intermediateDocument);
76
+ }
77
+ return YAML.stringify(intermediateDocument);
78
+ }
69
79
  async function saveDocument(documentName) {
70
80
  const intermediateDocument = intermediateDocuments[documentName];
71
81
  const workspaceDocument = workspace.documents[documentName];
@@ -84,6 +94,16 @@ const createWorkspaceStore = (workspaceProps) => {
84
94
  const excludedDiffs = applySelectiveUpdates(intermediateDocument, updatedWithOriginalRefs);
85
95
  return excludedDiffs;
86
96
  }
97
+ const processDocument = (input, options) => {
98
+ const servers = getServersFromDocument(options["x-scalar-reference-config"]?.settings?.servers ?? input.servers, {
99
+ baseServerUrl: options["x-scalar-reference-config"]?.settings?.baseServerUrl,
100
+ documentUrl: options.documentSource
101
+ });
102
+ if (servers.length) {
103
+ input.servers = servers.map((it) => ({ url: it.url, description: it.description, variables: it.variables }));
104
+ }
105
+ return input;
106
+ };
87
107
  async function addInMemoryDocument(input) {
88
108
  const { name, meta } = input;
89
109
  const cloned = measureSync("deepClone", () => deepClone(input.document));
@@ -98,11 +118,12 @@ const createWorkspaceStore = (workspaceProps) => {
98
118
  extraDocumentConfigurations[name] = { fetch: input.fetch };
99
119
  }
100
120
  });
101
- const temporaryDocument = createMagicProxy({ ...inputDocument, ...meta });
102
- if (temporaryDocument[extensions.document.navigation] === void 0) {
121
+ const strictDocument = createMagicProxy({ ...inputDocument, ...meta }, { showInternal: true });
122
+ strictDocument["x-original-oas-version"] = input.document.openapi ?? input.document.swagger;
123
+ if (strictDocument[extensions.document.navigation] === void 0) {
103
124
  await measureAsync(
104
125
  "bundle",
105
- async () => await bundle(getRaw(temporaryDocument), {
126
+ async () => await bundle(getRaw(strictDocument), {
106
127
  treeShake: false,
107
128
  plugins: [
108
129
  fetchUrls({
@@ -110,8 +131,6 @@ const createWorkspaceStore = (workspaceProps) => {
110
131
  }),
111
132
  externalValueResolver(),
112
133
  refsEverywhere()
113
- // TODO: investigate problems with type: {} properties
114
- // cleanUp(),
115
134
  ],
116
135
  urlMap: true,
117
136
  origin: documentMeta[name]?.documentSource
@@ -120,34 +139,38 @@ const createWorkspaceStore = (workspaceProps) => {
120
139
  );
121
140
  const coerced = measureSync(
122
141
  "coerceValue",
123
- () => coerceValue(OpenAPIDocumentSchemaStrict, deepClone(temporaryDocument))
142
+ () => coerceValue(OpenAPIDocumentSchemaStrict, deepClone(strictDocument))
124
143
  );
125
- measureAsync("mergeObjects", async () => mergeObjects(temporaryDocument, coerced));
144
+ measureAsync("mergeObjects", async () => mergeObjects(strictDocument, coerced));
126
145
  }
127
- const isValid = Value.Check(OpenAPIDocumentSchemaStrict, temporaryDocument);
128
- let errors = null;
146
+ const isValid = Value.Check(OpenAPIDocumentSchemaStrict, strictDocument);
129
147
  if (!isValid) {
130
- const validationErrors = Array.from(Value.Errors(OpenAPIDocumentSchemaStrict, temporaryDocument));
131
- errors = validationErrors.map((error) => ({
132
- message: error.message,
133
- path: error.path,
134
- schema: error.schema,
135
- value: error.value
136
- }));
148
+ const validationErrors = Array.from(Value.Errors(OpenAPIDocumentSchemaStrict, strictDocument));
149
+ console.warn("document validation errors: ");
150
+ console.warn(
151
+ validationErrors.map((error) => ({
152
+ message: error.message,
153
+ path: error.path,
154
+ schema: error.schema,
155
+ value: error.value
156
+ }))
157
+ );
137
158
  }
138
- const strictDocument = isValid ? temporaryDocument : temporaryDocument;
139
159
  if (strictDocument[extensions.document.navigation] === void 0) {
140
160
  const showModels = input.config?.["x-scalar-reference-config"]?.features?.showModels;
141
161
  strictDocument[extensions.document.navigation] = createNavigation(strictDocument, {
142
162
  ...input.config?.["x-scalar-reference-config"] ?? {},
143
163
  hideModels: showModels === void 0 ? void 0 : !showModels
144
164
  }).entries;
165
+ processDocument(getRaw(strictDocument), {
166
+ ...input.config,
167
+ documentSource: input.documentSource
168
+ });
145
169
  }
146
- workspace.documents[name] = createOverridesProxy(strictDocument, input.overrides);
147
- return {
148
- errors,
149
- document: workspace.documents[name]
150
- };
170
+ workspace.documents[name] = createOverridesProxy(
171
+ createMagicProxy(getRaw(strictDocument)),
172
+ input.overrides
173
+ );
151
174
  }
152
175
  async function addDocument(input) {
153
176
  const { name, meta } = input;
@@ -180,14 +203,11 @@ const createWorkspaceStore = (workspaceProps) => {
180
203
  };
181
204
  return;
182
205
  }
183
- const { errors } = await addInMemoryDocument({
206
+ await addInMemoryDocument({
184
207
  ...input,
185
208
  document: resolve.data,
186
209
  documentSource: getDocumentSource(input)
187
210
  });
188
- if (errors) {
189
- console.warn("OpenAPI Document Validation Errors", errors);
190
- }
191
211
  });
192
212
  }
193
213
  const getDocumentConfiguration = (name) => {
@@ -219,7 +239,7 @@ const createWorkspaceStore = (workspaceProps) => {
219
239
  if (!currentDocument) {
220
240
  return console.error(`Document '${documentName}' does not exist in the workspace.`);
221
241
  }
222
- const { errors } = await addInMemoryDocument({
242
+ await addInMemoryDocument({
223
243
  name: documentName,
224
244
  document: input,
225
245
  // Preserve the current metadata
@@ -229,9 +249,6 @@ const createWorkspaceStore = (workspaceProps) => {
229
249
  },
230
250
  initialize: false
231
251
  });
232
- if (errors) {
233
- console.warn("OpenAPI Document Validation Errors", errors);
234
- }
235
252
  },
236
253
  resolve: async (path) => {
237
254
  const activeDocument = workspace.activeDocument;
@@ -254,16 +271,8 @@ const createWorkspaceStore = (workspaceProps) => {
254
271
  get config() {
255
272
  return getDocumentConfiguration(getActiveDocumentName());
256
273
  },
257
- exportDocument: (documentName, format) => {
258
- const intermediateDocument = intermediateDocuments[documentName];
259
- if (!intermediateDocument) {
260
- return;
261
- }
262
- if (format === "json") {
263
- return JSON.stringify(intermediateDocument);
264
- }
265
- return YAML.stringify(intermediateDocument);
266
- },
274
+ exportDocument,
275
+ exportActiveDocument: (format) => exportDocument(getActiveDocumentName(), format),
267
276
  saveDocument,
268
277
  async revertDocumentChanges(documentName) {
269
278
  const workspaceDocument = workspace.documents[documentName];
@@ -271,14 +280,11 @@ const createWorkspaceStore = (workspaceProps) => {
271
280
  if (!workspaceDocument || !intermediate) {
272
281
  return;
273
282
  }
274
- const { errors } = await addInMemoryDocument({
283
+ await addInMemoryDocument({
275
284
  name: documentName,
276
285
  document: intermediate,
277
286
  initialize: false
278
287
  });
279
- if (errors) {
280
- console.warn("OpenAPI Document Validation Errors", errors);
281
- }
282
288
  },
283
289
  commitDocument(documentName) {
284
290
  console.warn(`Commit operation for document '${documentName}' is not implemented yet.`);
@@ -322,7 +328,7 @@ const createWorkspaceStore = (workspaceProps) => {
322
328
  safeAssign(documentMeta, result.documentMeta);
323
329
  },
324
330
  importWorkspaceFromSpecification: (specification) => {
325
- const { documents, overrides: overrides2, info, workspace: workspaceVersion, ...meta } = specification;
331
+ const { documents, overrides: overrides2, info: _info, workspace: _workspaceVersion, ...meta } = specification;
326
332
  safeAssign(workspace, meta);
327
333
  return Promise.all(
328
334
  Object.entries(documents ?? {}).map(
@@ -331,7 +337,7 @@ const createWorkspaceStore = (workspaceProps) => {
331
337
  );
332
338
  },
333
339
  rebaseDocument: (documentName, newDocumentOrigin, resolvedConflicts) => {
334
- const newOrigin = coerceValue(OpenAPIDocumentSchemaLoose, upgrade(newDocumentOrigin).specification);
340
+ const newOrigin = upgrade(newDocumentOrigin).specification;
335
341
  const originalDocument = originalDocuments[documentName];
336
342
  const intermediateDocument = intermediateDocuments[documentName];
337
343
  const activeDocument = workspace.documents[documentName] ? getRaw(workspace.documents[documentName]) : void 0;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/client.ts"],
4
- "sourcesContent": ["import { createMagicProxy, getRaw } from '@scalar/json-magic/magic-proxy'\nimport { upgrade } from '@scalar/openapi-parser'\nimport { reactive } from 'vue'\nimport YAML from 'yaml'\n\nimport { applySelectiveUpdates } from '@/helpers/apply-selective-updates'\nimport { deepClone } from '@/helpers/deep-clone'\nimport { type UnknownObject, isObject, safeAssign } from '@/helpers/general'\nimport { getValueByPath } from '@/helpers/json-path-utils'\nimport { mergeObjects } from '@/helpers/merge-object'\nimport { createOverridesProxy } from '@/helpers/overrides-proxy'\nimport { createNavigation } from '@/navigation'\nimport type { TraverseSpecOptions } from '@/navigation/types'\nimport { externalValueResolver, loadingStatus, refsEverywhere, restoreOriginalRefs } from '@/plugins'\nimport { extensions } from '@/schemas/extensions'\nimport { type InMemoryWorkspace, InMemoryWorkspaceSchema } from '@/schemas/inmemory-workspace'\nimport { defaultReferenceConfig } from '@/schemas/reference-config'\nimport { coerceValue } from '@/schemas/typebox-coerce'\nimport { OpenAPIDocumentSchema as OpenAPIDocumentSchemaLoose } from '@/schemas/v3.1/loose/openapi-document'\nimport {\n OpenAPIDocumentSchema as OpenAPIDocumentSchemaStrict,\n type OpenApiDocument,\n} from '@/schemas/v3.1/strict/openapi-document'\nimport type { Workspace, WorkspaceDocumentMeta, WorkspaceMeta } from '@/schemas/workspace'\nimport type { WorkspaceSpecification } from '@/schemas/workspace-specification'\nimport type { Config } from '@/schemas/workspace-specification/config'\nimport { measureAsync, measureSync } from '@scalar/helpers/testing/measure'\nimport { bundle } from '@scalar/json-magic/bundle'\nimport { fetchUrls } from '@scalar/json-magic/bundle/plugins/browser'\nimport { type Difference, apply, diff, merge } from '@scalar/json-magic/diff'\nimport type { Record } from '@sinclair/typebox'\nimport { Value } from '@sinclair/typebox/value'\nimport type { PartialDeep, RequiredDeep } from 'type-fest'\n\nexport type DocumentConfiguration = Config &\n PartialDeep<{\n 'x-scalar-reference-config': {\n tagSort: TraverseSpecOptions['tagsSorter']\n operationsSorter: TraverseSpecOptions['operationsSorter']\n getHeadingId: TraverseSpecOptions['getHeadingId']\n getOperationId: TraverseSpecOptions['getOperationId']\n getWebhookId: TraverseSpecOptions['getWebhookId']\n getModelId: TraverseSpecOptions['getModelId']\n getTagId: TraverseSpecOptions['getTagId']\n generateOperationSlug?: (details: {\n path: string\n operationId?: string\n method: string\n summary?: string\n }) => string\n generateHeadingSlug?: (details: { slug?: string }) => string\n generateTagSlug?: (details: { name?: string }) => string\n generateModelSlug?: (details: { name?: string }) => string\n generateWebhookSlug?: (details: { name: string; method: string }) => string\n }\n }>\n\ntype ExtraDocumentConfigurations = Record<\n string,\n {\n fetch: WorkspaceDocumentMetaInput['fetch']\n }\n>\n\nexport type ValidationError = {\n message: string\n path: string\n schema: unknown\n value: unknown\n}\n\nconst defaultConfig: RequiredDeep<Config> = {\n 'x-scalar-reference-config': defaultReferenceConfig,\n}\n\n/**\n * Input type for workspace document metadata and configuration.\n * This type defines the required and optional fields for initializing a document in the workspace.\n */\ntype WorkspaceDocumentMetaInput = {\n /** Optional metadata about the document like title, description, etc */\n meta?: WorkspaceDocumentMeta\n /** Required unique identifier for the document */\n name: string\n /** Optional configuration options */\n config?: DocumentConfiguration\n /** Overrides for the document */\n overrides?: InMemoryWorkspace['overrides'][string]\n /** Optional custom fetch implementation to use when retrieving the document. By default the global fetch implementation will be used */\n fetch?: (input: string | URL | globalThis.Request, init?: RequestInit) => Promise<Response>\n}\n\n/**\n * Represents a document that is loaded from a URL.\n * This type extends WorkspaceDocumentMetaInput to include URL-specific properties.\n */\nexport type UrlDoc = {\n /** URL to fetch the OpenAPI document from */\n url: string\n} & WorkspaceDocumentMetaInput\n\n/** Represents a document that is provided directly as an object rather than loaded from a URL */\nexport type ObjectDoc = {\n /** The OpenAPI document object containing the API specification */\n document: Record<string, unknown>\n} & WorkspaceDocumentMetaInput\n\n/**\n * Union type representing the possible input formats for a workspace document:\n * - UrlDoc: Document loaded from a URL with optional fetch configuration\n * - ObjectDoc: Direct document object with metadata\n */\nexport type WorkspaceDocumentInput = UrlDoc | ObjectDoc\n\n/**\n * Resolves a workspace document from various input sources (URL, local file, or direct document object).\n *\n * @param workspaceDocument - The document input to resolve, which can be:\n * - A URL to fetch the document from\n * - A direct document object\n * @returns A promise that resolves to an object containing:\n * - ok: boolean indicating if the resolution was successful\n * - data: The resolved document data\n *\n * @example\n * // Resolve from URL\n * const urlDoc = await loadDocument({ name: 'api', url: 'https://api.example.com/openapi.json' })\n *\n * // Resolve direct document\n * const directDoc = await loadDocument({\n * name: 'inline',\n * document: { openapi: '3.0.0', paths: {} }\n * })\n */\nasync function loadDocument(workspaceDocument: WorkspaceDocumentInput) {\n if ('url' in workspaceDocument) {\n return fetchUrls({ fetch: workspaceDocument.fetch }).exec(workspaceDocument.url)\n }\n\n return {\n ok: true as const,\n data: workspaceDocument.document,\n }\n}\n\n/**\n * Returns the origin (URL) of a workspace document if it was loaded from a URL.\n * If the document was provided directly as an object, returns undefined.\n *\n * @param input - The workspace document input (either UrlDoc or ObjectDoc)\n * @returns The URL string if present, otherwise undefined\n */\nconst getDocumentSource = (input: WorkspaceDocumentInput) => {\n if ('url' in input) {\n return input.url\n }\n return undefined\n}\n\n/**\n * Configuration object for initializing a workspace store.\n * Defines the initial state and documents for the workspace.\n */\ntype WorkspaceProps = {\n /** Optional metadata for the workspace including theme, active document, etc */\n meta?: WorkspaceMeta\n /** Workspace configuration */\n config?: Config\n /** Fetch function for retrieving documents */\n fetch?: WorkspaceDocumentInput['fetch']\n}\n\n/**\n * Type definition for the workspace store return object.\n * This explicit type is needed to avoid TypeScript inference limits.\n *\n * @see https://github.com/microsoft/TypeScript/issues/43817#issuecomment-827746462\n */\nexport type WorkspaceStore = {\n /**\n * Returns the reactive workspace object with an additional activeDocument getter\n */\n readonly workspace: Workspace\n /**\n * Updates a specific metadata field in the workspace\n * @param key - The metadata field to update\n * @param value - The new value for the field\n * @example\n * // Update the workspace title\n * update('x-scalar-active-document', 'document-name')\n */\n update<K extends keyof WorkspaceMeta>(key: K, value: WorkspaceMeta[K]): void\n /**\n * Updates a specific metadata field in a document\n * @param name - The name of the document to update ('active' or a specific document name)\n * @param key - The metadata field to update\n * @param value - The new value for the field\n * @throws Error if the specified document doesn't exist\n * @example\n * // Update the auth of the active document\n * updateDocument('active', 'x-scalar-active-auth', 'Bearer')\n * // Update the auth of a specific document\n * updateDocument('document-name', 'x-scalar-active-auth', 'Bearer')\n */\n updateDocument<K extends keyof WorkspaceDocumentMeta>(\n name: 'active' | (string & {}),\n key: K,\n value: WorkspaceDocumentMeta[K],\n ): void\n /**\n * Replaces the content of a specific document in the workspace with the provided input.\n * This method computes the difference between the current document and the new input,\n * then applies only the necessary changes in place. The updates are applied atomically,\n * ensuring the document is updated in a single operation.\n *\n * @param documentName - The name of the document to update.\n * @param input - The new content to apply to the document (as a plain object).\n * @example\n * // Replace the content of the 'api' document with new data\n * store.replaceDocument('api', {\n * openapi: '3.1.0',\n * info: { title: 'Updated API', version: '1.0.1' },\n * paths: {},\n * })\n */\n replaceDocument(documentName: string, input: Record<string, unknown>): Promise<void>\n /**\n * Resolves a reference in the active document by following the provided path and resolving any external $ref references.\n * This method traverses the document structure following the given path and resolves any $ref references it encounters.\n * During resolution, it sets a loading status and updates the reference with the resolved content.\n *\n * @param path - Array of strings representing the path to the reference (e.g. ['paths', '/users', 'get', 'responses', '200'])\n * @throws Error if the path is invalid or empty\n * @example\n * // Resolve a reference in the active document\n * resolve(['paths', '/users', 'get', 'responses', '200'])\n */\n resolve(path: string[]): Promise<unknown>\n /**\n * Adds a new document to the workspace\n * @param document - The document content to add. This should be a valid OpenAPI/Swagger document or other supported format\n * @param meta - Metadata for the document, including its name and other properties defined in WorkspaceDocumentMeta\n * @example\n * // Add a new OpenAPI document to the workspace\n * store.addDocument({\n * name: 'name',\n * document: {\n * openapi: '3.0.0',\n * info: { title: 'title' },\n * },\n * meta: {\n * 'x-scalar-active-auth': 'Bearer',\n * 'x-scalar-active-server': 'production'\n * }\n * })\n */\n addDocument(input: WorkspaceDocumentInput): Promise<void>\n /**\n * Returns the merged configuration for the active document.\n *\n * This getter merges configurations in the following order of precedence:\n * 1. Document-specific configuration (highest priority)\n * 2. Workspace-level configuration\n * 3. Default configuration (lowest priority)\n *\n * The active document is determined by the workspace's activeDocument extension,\n * falling back to the first document if none is specified.\n */\n readonly config: typeof defaultConfig\n /**\n * Exports the specified document in the requested format.\n *\n * This method serializes the most recently saved local version of the document (from the intermediateDocuments map)\n * to either JSON or YAML. The exported document reflects the last locally saved state, including any edits\n * that have been saved but not yet synced to a remote registry. Runtime/in-memory changes that have not been saved\n * will not be included.\n *\n * @param documentName - The name of the document to export.\n * @param format - The output format: 'json' for a JSON string, or 'yaml' for a YAML string.\n * @returns The document as a string in the requested format, or undefined if the document does not exist.\n *\n * @example\n * // Export a document as JSON\n * const jsonString = store.exportDocument('api', 'json')\n *\n * // Export a document as YAML\n * const yamlString = store.exportDocument('api', 'yaml')\n */\n exportDocument(documentName: string, format: 'json' | 'yaml'): string | undefined\n /**\n * Saves the current state of the specified document to the intermediate documents map.\n *\n * This function captures the latest (reactive) state of the document from the workspace and\n * applies its changes to the corresponding entry in the `intermediateDocuments` map.\n * The `intermediateDocuments` map represents the most recently \"saved\" local version of the document,\n * which may include edits not yet synced to the remote registry.\n *\n * The update is performed in-place. A deep clone of the current document\n * state is used to avoid mutating the reactive object directly.\n *\n * @param documentName - The name of the document to save.\n * @returns An array of diffs that were excluded from being applied (such as changes to ignored keys),\n * or undefined if the document does not exist or cannot be updated.\n *\n * @example\n * // Save the current state of the document named 'api'\n * const excludedDiffs = store.saveDocument('api')\n */\n saveDocument(documentName: string): Promise<unknown[] | undefined>\n /**\n * Restores the specified document to its last locally saved state.\n *\n * This method updates the current reactive document (in the workspace) with the contents of the\n * corresponding intermediate document (from the `intermediateDocuments` map), effectively discarding\n * any unsaved in-memory changes and reverting to the last saved version.\n * Vue reactivity is preserved by updating the existing reactive object in place.\n *\n * **Warning:** This operation will discard all unsaved (in-memory) changes to the specified document.\n *\n * @param documentName - The name of the document to restore.\n * @returns void\n *\n * @example\n * // Restore the document named 'api' to its last saved state\n * store.revertDocumentChanges('api')\n */\n revertDocumentChanges(documentName: string): Promise<void>\n /**\n * Commits the specified document.\n *\n * This method is intended to finalize and persist the current state of the document,\n * potentially syncing it with a remote registry or marking it as the latest committed version.\n *\n * @param documentName - The name of the document to commit.\n * @remarks\n * The actual commit logic is not implemented yet.\n */\n commitDocument(documentName: string): void\n /**\n * Serializes the current workspace state to a JSON string for backup, persistence, or sharing.\n *\n * This method exports all workspace documents (removing Vue reactivity proxies), workspace metadata,\n * document configurations, and both the original and intermediate document states. The resulting JSON\n * can be imported later to fully restore the workspace to this exact state, including all documents\n * and their configurations.\n *\n * @returns A JSON string representing the complete workspace state.\n */\n exportWorkspace(): string\n /**\n * Imports a workspace from a serialized JSON string.\n *\n * This method parses the input string using the InMemoryWorkspaceSchema,\n * then updates the current workspace state, including documents, metadata,\n * and configuration, with the imported values.\n *\n * @param input - The serialized workspace JSON string to import.\n */\n loadWorkspace(input: string): void\n /**\n * Imports a workspace from a WorkspaceSpecification object.\n *\n * This method assigns workspace metadata and adds all documents defined in the specification.\n * Each document is added using its $ref and optional overrides.\n *\n * @example\n * ```ts\n * await store.importWorkspaceFromSpecification({\n * documents: {\n * api: { $ref: '/specs/api.yaml' },\n * petstore: { $ref: '/specs/petstore.yaml' }\n * },\n * overrides: {\n * api: { config: { features: { showModels: true } } }\n * },\n * info: { title: 'My Workspace' },\n * workspace: 'v1',\n * \"x-scalar-dark-mode\": true\n * })\n * ```\n *\n * @param specification - The workspace specification to import.\n */\n importWorkspaceFromSpecification(specification: WorkspaceSpecification): Promise<void[]>\n /**\n * Rebases a document in the workspace with a new origin, resolving conflicts if provided.\n *\n * This method is used to rebase a document (e.g., after pulling remote changes) by applying the changes\n * from the new origin and merging them with local edits. If there are conflicts, they can be resolved\n * by providing a list of resolved conflicts.\n *\n * @param documentName - The name of the document to rebase.\n * @param newDocumentOrigin - The new origin document (as an object) to rebase onto.\n * @param resolvedConflicts - (Optional) An array of resolved conflicts to apply.\n * @returns If there are unresolved conflicts and no resolution is provided, returns the list of conflicts.\n *\n * @example\n * // Example: Rebase a document with a new origin and resolve conflicts\n * const conflicts = store.rebaseDocument('api', newOriginDoc)\n * if (conflicts && conflicts.length > 0) {\n * // User resolves conflicts here...\n * store.rebaseDocument('api', newOriginDoc, userResolvedConflicts)\n * }\n */\n rebaseDocument: (\n documentName: string,\n newDocumentOrigin: Record<string, unknown>,\n resolvedConflicts?: Difference<unknown>[],\n ) => void | ReturnType<typeof merge>['conflicts']\n}\n\n/**\n * Creates a reactive workspace store that manages documents and their metadata.\n * The store provides functionality for accessing, updating, and resolving document references.\n *\n * @param workspaceProps - Configuration object for the workspace\n * @param workspaceProps.meta - Optional metadata for the workspace\n * @param workspaceProps.documents - Optional record of documents to initialize the workspace with\n * Documents that require asynchronous loading must be added using `addDocument` after the store is created\n * this allows atomic awaiting and does not block page load for the store initialization\n * @returns An object containing methods and getters for managing the workspace\n */\nexport const createWorkspaceStore = (workspaceProps?: WorkspaceProps): WorkspaceStore => {\n /**\n * Holds the original, unmodified documents as they were initially loaded into the workspace.\n * These documents are stored in their raw form\u2014prior to any reactive wrapping, dereferencing, or bundling.\n * This map preserves the pristine structure of each document, using deep clones to ensure that\n * subsequent mutations in the workspace do not affect the originals.\n * The originals are retained so that we can restore, compare, or sync with the remote registry as needed.\n */\n const originalDocuments = {} as Record<string, UnknownObject>\n /**\n * Stores the intermediate state of documents after local edits but before syncing with the remote registry.\n *\n * This map acts as a local \"saved\" version of the document, reflecting the user's changes after they hit \"save\".\n * The `originalDocuments` map, by contrast, always mirrors the document as it exists in the remote registry.\n *\n * Use this map to stage local changes that are ready to be propagated back to the remote registry.\n * This separation allows us to distinguish between:\n * - The last known remote version (`originalDocuments`)\n * - The latest locally saved version (`intermediateDocuments`)\n * - The current in-memory (possibly unsaved) workspace document (`workspace.documents`)\n */\n const intermediateDocuments = {} as Record<string, UnknownObject>\n /**\n * A map of document configurations keyed by document name.\n * This stores the configuration options for each document in the workspace,\n * allowing for document-specific settings like navigation options, appearance,\n * and other reference configuration.\n */\n const documentConfigs: Record<string, Config> = {}\n /**\n * Stores per-document overrides for OpenAPI documents.\n * This object is used to override specific fields of a document\n * when you cannot (or should not) modify the source document directly.\n * For example, this enables UI-driven or temporary changes to be applied\n * on top of the original document, without mutating the source.\n * The key is the document name, and the value is a deep partial\n * OpenAPI document representing the overridden fields.\n */\n const overrides: InMemoryWorkspace['overrides'] = {}\n /**\n * Holds additional metadata for each document in the workspace.\n *\n * This metadata should be persisted together with the document itself.\n * It can include information such as user preferences, UI state, or other\n * per-document attributes that are not part of the OpenAPI document structure.\n */\n const documentMeta: InMemoryWorkspace['documentMeta'] = {}\n\n /**\n * Holds additional configuration options for each document in the workspace.\n *\n * This can include settings that can not be persisted between sessions (not JSON serializable)\n */\n const extraDocumentConfigurations: ExtraDocumentConfigurations = {}\n\n // Create a reactive workspace object with proxied documents\n // Each document is wrapped in a proxy to enable reactive updates and reference resolution\n const workspace = reactive<Workspace>({\n ...workspaceProps?.meta,\n documents: {},\n /**\n * Returns the currently active document from the workspace.\n * The active document is determined by the 'x-scalar-active-document' metadata field,\n * falling back to the first document in the workspace if no active document is specified.\n *\n * @returns The active document or undefined if no document is found\n */\n get activeDocument(): NonNullable<Workspace['activeDocument']> | undefined {\n const activeDocumentKey =\n workspace[extensions.workspace.activeDocument] ?? Object.keys(workspace.documents)[0] ?? ''\n return workspace.documents[activeDocumentKey]\n },\n })\n\n /**\n * Returns the name of the currently active document in the workspace.\n * The active document is determined by the 'x-scalar-active-document' metadata field,\n * falling back to the first document in the workspace if no active document is specified.\n *\n * @returns The name of the active document or an empty string if no document is found\n */\n function getActiveDocumentName() {\n return workspace[extensions.workspace.activeDocument] ?? Object.keys(workspace.documents)[0] ?? ''\n }\n\n // Save the current state of the specified document to the intermediate documents map.\n // This function captures the latest (reactive) state of the document from the workspace and\n // applies its changes to the corresponding entry in the `intermediateDocuments` map.\n // The `intermediateDocuments` map represents the most recently \"saved\" local version of the document,\n // which may include edits not yet synced to the remote registry.\n async function saveDocument(documentName: string) {\n const intermediateDocument = intermediateDocuments[documentName]\n const workspaceDocument = workspace.documents[documentName]\n\n if (!workspaceDocument) {\n return\n }\n\n // Obtain the raw state of the current document to ensure accurate diffing\n const updatedDocument = getRaw(workspaceDocument)\n\n // If either the intermediate or updated document is missing, do nothing\n if (!intermediateDocument || !updatedDocument) {\n return\n }\n\n // Traverse the document and convert refs back to the original shape\n const updatedWithOriginalRefs = await bundle(deepClone(updatedDocument), {\n plugins: [restoreOriginalRefs()],\n treeShake: false,\n urlMap: true,\n })\n\n // Apply changes from the current document to the intermediate document in place\n const excludedDiffs = applySelectiveUpdates(intermediateDocument, updatedWithOriginalRefs as UnknownObject)\n return excludedDiffs\n }\n\n // Add a document to the store synchronously from an in-memory OpenAPI document\n async function addInMemoryDocument(input: ObjectDoc & { initialize?: boolean; documentSource?: string }): Promise<{\n errors: ValidationError[] | null\n document: unknown\n }> {\n const { name, meta } = input\n const cloned = measureSync('deepClone', () => deepClone(input.document))\n const inputDocument = measureSync('upgrade', () => upgrade(cloned).specification)\n\n measureSync('initialize', () => {\n if (input.initialize !== false) {\n // Store the original document in the originalDocuments map\n // This is used to track the original state of the document as it was loaded into the workspace\n originalDocuments[name] = deepClone({ ...inputDocument })\n\n // Store the intermediate document state for local edits\n // This is used to track the last saved state of the document\n // It allows us to differentiate between the original document and the latest saved version\n // This is important for local edits that are not yet synced with the remote registry\n // The intermediate document is used to store the latest saved state of the document\n // This allows us to track changes and revert to the last saved state if needed\n intermediateDocuments[name] = deepClone({ ...inputDocument })\n // Add the document config to the documentConfigs map\n documentConfigs[name] = input.config ?? {}\n // Store the overrides for this document, or an empty object if none are provided\n overrides[name] = input.overrides ?? {}\n // Store the document metadata for this document, setting the origin if provided\n documentMeta[name] = { documentSource: input.documentSource }\n // Store extra document configurations that can not be persisted\n extraDocumentConfigurations[name] = { fetch: input.fetch }\n }\n })\n\n const temporaryDocument: UnknownObject = createMagicProxy({ ...inputDocument, ...meta })\n\n if (temporaryDocument[extensions.document.navigation] === undefined) {\n // If the document navigation is not already present, bundle the entire document to resolve all references.\n // This typically applies when the document is not preprocessed by the server and needs local reference resolution.\n // We need to bundle document first before we validate, so we can also validate the external references\n await measureAsync(\n 'bundle',\n async () =>\n await bundle(getRaw(temporaryDocument), {\n treeShake: false,\n plugins: [\n fetchUrls({\n fetch: extraDocumentConfigurations[name]?.fetch ?? workspaceProps?.fetch,\n }),\n externalValueResolver(),\n refsEverywhere(),\n // TODO: investigate problems with type: {} properties\n // cleanUp(),\n ],\n urlMap: true,\n origin: documentMeta[name]?.documentSource, // use the document origin (if provided) as the base URL for resolution\n }),\n )\n\n // We coerce the values only when the document is not preprocessed by the server-side-store\n const coerced = measureSync('coerceValue', () =>\n coerceValue(OpenAPIDocumentSchemaStrict, deepClone(temporaryDocument)),\n )\n measureAsync('mergeObjects', async () => mergeObjects(temporaryDocument, coerced))\n }\n\n const isValid = Value.Check(OpenAPIDocumentSchemaStrict, temporaryDocument)\n let errors: ValidationError[] | null = null\n\n if (!isValid) {\n const validationErrors = Array.from(Value.Errors(OpenAPIDocumentSchemaStrict, temporaryDocument))\n\n errors = validationErrors.map((error) => ({\n message: error.message,\n path: error.path,\n schema: error.schema,\n value: error.value,\n }))\n }\n\n // Type-cast and just try to render, even if the document is (partially) invalid\n const strictDocument = isValid ? temporaryDocument : (temporaryDocument as OpenApiDocument)\n\n // Skip navigation generation if the document already has a server-side generated navigation structure\n if (strictDocument[extensions.document.navigation] === undefined) {\n const showModels = input.config?.['x-scalar-reference-config']?.features?.showModels\n\n strictDocument[extensions.document.navigation] = createNavigation(strictDocument, {\n ...(input.config?.['x-scalar-reference-config'] ?? {}),\n hideModels: showModels === undefined ? undefined : !showModels,\n }).entries\n }\n\n // Create a proxied document with magic proxy and apply any overrides, then store it in the workspace documents map\n workspace.documents[name] = createOverridesProxy(strictDocument, input.overrides)\n\n // Always return success with the processed document and any validation errors\n return {\n errors,\n document: workspace.documents[name],\n }\n }\n\n // Asynchronously adds a new document to the workspace by loading and validating the input.\n // If loading fails, a placeholder error document is added instead.\n async function addDocument(input: WorkspaceDocumentInput) {\n const { name, meta } = input\n\n const resolve = await measureAsync(\n 'loadDocument',\n async () => await loadDocument({ ...input, fetch: input.fetch ?? workspaceProps?.fetch }),\n )\n\n // Log the time taken to add a document\n await measureAsync('addDocument', async () => {\n if (!resolve.ok) {\n console.error(`Failed to fetch document '${name}': request was not successful`)\n\n workspace.documents[name] = {\n ...meta,\n openapi: '3.1.0',\n info: {\n title: `Document '${name}' could not be loaded`,\n version: 'unknown',\n },\n }\n\n return\n }\n\n if (!isObject(resolve.data)) {\n console.error(`Failed to load document '${name}': response data is not a valid object`)\n\n workspace.documents[name] = {\n ...meta,\n openapi: '3.1.0',\n info: {\n title: `Document '${name}' could not be loaded`,\n version: 'unknown',\n },\n }\n\n return\n }\n\n const { errors } = await addInMemoryDocument({\n ...input,\n document: resolve.data,\n documentSource: getDocumentSource(input),\n })\n\n if (errors) {\n console.warn('OpenAPI Document Validation Errors', errors)\n }\n })\n }\n\n // Returns the effective document configuration for a given document name,\n // merging (in order of increasing priority): the default config, workspace-level config, and document-specific config.\n const getDocumentConfiguration = (name: string) => {\n return mergeObjects<typeof defaultConfig>(\n mergeObjects(defaultConfig, workspaceProps?.config ?? {}),\n documentConfigs[name] ?? {},\n )\n }\n\n // Cache to track visited nodes during reference resolution to prevent bundling the same subtree multiple times\n // This is needed because we are doing partial bundle operations\n const visitedNodesCache = new Set()\n\n return {\n get workspace() {\n return workspace\n },\n update<K extends keyof WorkspaceMeta>(key: K, value: WorkspaceMeta[K]) {\n // @ts-ignore\n if (key === '__proto__' || key === 'constructor' || key === 'prototype') {\n throw new Error('Invalid key: cannot modify prototype')\n }\n Object.assign(workspace, { [key]: value })\n },\n updateDocument<K extends keyof WorkspaceDocumentMeta>(\n name: 'active' | (string & {}),\n key: K,\n value: WorkspaceDocumentMeta[K],\n ) {\n const currentDocument = workspace.documents[name === 'active' ? getActiveDocumentName() : name]\n\n if (!currentDocument) {\n throw 'Please select a valid document'\n }\n\n Object.assign(currentDocument, { [key]: value })\n },\n async replaceDocument(documentName: string, input: Record<string, unknown>) {\n const currentDocument = workspace.documents[documentName]\n\n if (!currentDocument) {\n return console.error(`Document '${documentName}' does not exist in the workspace.`)\n }\n\n // Replace the whole document\n const { errors } = await addInMemoryDocument({\n name: documentName,\n document: input,\n // Preserve the current metadata\n meta: {\n 'x-scalar-active-auth': currentDocument['x-scalar-active-auth'],\n 'x-scalar-active-server': currentDocument['x-scalar-active-server'],\n },\n initialize: false,\n })\n\n if (errors) {\n console.warn('OpenAPI Document Validation Errors', errors)\n }\n },\n resolve: async (path: string[]) => {\n const activeDocument = workspace.activeDocument\n\n const target = getValueByPath(activeDocument, path)\n\n if (!isObject(target)) {\n console.error(\n `Invalid path provided for resolution. Path: [${path.join(', ')}]. Found value of type: ${typeof target}. Expected an object.`,\n )\n return\n }\n\n // Bundle the target document with the active document as root, resolving any external references\n // and tracking resolution status through hooks\n return bundle(target, {\n root: activeDocument,\n treeShake: false,\n plugins: [fetchUrls(), loadingStatus(), externalValueResolver()],\n urlMap: true,\n visitedNodes: visitedNodesCache,\n })\n },\n addDocument,\n get config() {\n return getDocumentConfiguration(getActiveDocumentName())\n },\n exportDocument: (documentName: string, format: 'json' | 'yaml') => {\n const intermediateDocument = intermediateDocuments[documentName]\n\n if (!intermediateDocument) {\n return\n }\n\n if (format === 'json') {\n return JSON.stringify(intermediateDocument)\n }\n\n return YAML.stringify(intermediateDocument)\n },\n saveDocument,\n async revertDocumentChanges(documentName: string) {\n const workspaceDocument = workspace.documents[documentName]\n const intermediate = intermediateDocuments[documentName]\n\n if (!workspaceDocument || !intermediate) {\n return\n }\n\n const { errors } = await addInMemoryDocument({\n name: documentName,\n document: intermediate,\n initialize: false,\n })\n\n if (errors) {\n console.warn('OpenAPI Document Validation Errors', errors)\n }\n },\n commitDocument(documentName: string) {\n // TODO: Implement commit logic\n console.warn(`Commit operation for document '${documentName}' is not implemented yet.`)\n },\n exportWorkspace() {\n return JSON.stringify({\n documents: {\n ...Object.fromEntries(\n Object.entries(workspace.documents).map(([name, doc]) => [\n name,\n // Extract the raw document data for export, removing any Vue reactivity wrappers.\n // When importing, the document can be wrapped again in a magic proxy.\n getRaw(doc),\n ]),\n ),\n },\n meta: workspaceProps?.meta ?? {},\n documentConfigs,\n originalDocuments,\n intermediateDocuments,\n overrides,\n documentMeta,\n } satisfies InMemoryWorkspace)\n },\n loadWorkspace(input: string) {\n const result = coerceValue(InMemoryWorkspaceSchema, JSON.parse(input))\n\n // Assign the magic proxy to the documents\n safeAssign(\n workspace.documents,\n Object.fromEntries(\n Object.entries(result.documents).map(([name, doc]) => [\n name,\n createOverridesProxy(createMagicProxy(doc), result.overrides[name]),\n ]),\n ),\n )\n\n safeAssign(originalDocuments, result.originalDocuments)\n safeAssign(intermediateDocuments, result.intermediateDocuments)\n safeAssign(documentConfigs, result.documentConfigs)\n safeAssign(overrides, result.overrides)\n safeAssign(workspace, result.meta)\n safeAssign(documentMeta, result.documentMeta)\n },\n importWorkspaceFromSpecification: (specification: WorkspaceSpecification) => {\n const { documents, overrides, info, workspace: workspaceVersion, ...meta } = specification\n\n // Assign workspace metadata\n safeAssign(workspace, meta)\n\n // Add workspace documents\n return Promise.all(\n Object.entries(documents ?? {}).map(([name, doc]) =>\n addDocument({ url: doc.$ref, name, overrides: overrides?.[name] }),\n ),\n )\n },\n rebaseDocument: (documentName, newDocumentOrigin, resolvedConflicts) => {\n const newOrigin = coerceValue(OpenAPIDocumentSchemaLoose, upgrade(newDocumentOrigin).specification)\n\n const originalDocument = originalDocuments[documentName]\n const intermediateDocument = intermediateDocuments[documentName]\n const activeDocument = workspace.documents[documentName] ? getRaw(workspace.documents[documentName]) : undefined // raw version without any overrides\n\n if (!originalDocument || !intermediateDocument || !activeDocument) {\n // If any required document state is missing, do nothing\n return console.error('[ERROR]: Specified document is missing or internal corrupted workspace state')\n }\n\n // ---- Get the new intermediate document\n const changelogAA = diff(originalDocument, newOrigin)\n const changelogAB = diff(originalDocument, intermediateDocument)\n\n const changesA = merge(changelogAA, changelogAB)\n\n if (resolvedConflicts === undefined) {\n // If there are conflicts, return the list of conflicts for user resolution\n return changesA.conflicts\n }\n\n const changesetA = changesA.diffs.concat(resolvedConflicts)\n\n // Apply the changes to the original document to get the new intermediate\n const newIntermediateDocument = apply(deepClone(originalDocument), changesetA)\n intermediateDocuments[documentName] = newIntermediateDocument\n\n // Update the original document\n originalDocuments[documentName] = newOrigin\n\n // ---- Get the new active document\n const changelogBA = diff(intermediateDocument, newIntermediateDocument)\n const changelogBB = diff(intermediateDocument, activeDocument)\n\n const changesB = merge(changelogBA, changelogBB)\n\n // Auto-conflict resolution: pick only the changes from the first changeset\n // TODO: In the future, implement smarter conflict resolution if needed\n const changesetB = changesB.diffs.concat(changesB.conflicts.flatMap((it) => it[0]))\n\n const newActiveDocument = coerceValue(\n OpenAPIDocumentSchemaStrict,\n apply(deepClone(newIntermediateDocument), changesetB),\n )\n\n // Update the active document to the new value\n workspace.documents[documentName] = createOverridesProxy(\n createMagicProxy({ ...newActiveDocument }),\n overrides[documentName],\n )\n return\n },\n }\n}\n\n// biome-ignore lint/performance/noBarrelFile: <explanation>\nexport { generateClientMutators } from '@/mutators'\n"],
5
- "mappings": "AAAA,SAAS,kBAAkB,cAAc;AACzC,SAAS,eAAe;AACxB,SAAS,gBAAgB;AACzB,OAAO,UAAU;AAEjB,SAAS,6BAA6B;AACtC,SAAS,iBAAiB;AAC1B,SAA6B,UAAU,kBAAkB;AACzD,SAAS,sBAAsB;AAC/B,SAAS,oBAAoB;AAC7B,SAAS,4BAA4B;AACrC,SAAS,wBAAwB;AAEjC,SAAS,uBAAuB,eAAe,gBAAgB,2BAA2B;AAC1F,SAAS,kBAAkB;AAC3B,SAAiC,+BAA+B;AAChE,SAAS,8BAA8B;AACvC,SAAS,mBAAmB;AAC5B,SAAS,yBAAyB,kCAAkC;AACpE;AAAA,EACE,yBAAyB;AAAA,OAEpB;AAIP,SAAS,cAAc,mBAAmB;AAC1C,SAAS,cAAc;AACvB,SAAS,iBAAiB;AAC1B,SAA0B,OAAO,MAAM,aAAa;AAEpD,SAAS,aAAa;AAwCtB,MAAM,gBAAsC;AAAA,EAC1C,6BAA6B;AAC/B;AA6DA,eAAe,aAAa,mBAA2C;AACrE,MAAI,SAAS,mBAAmB;AAC9B,WAAO,UAAU,EAAE,OAAO,kBAAkB,MAAM,CAAC,EAAE,KAAK,k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,YAAM,aAAa,SAAS,MAAM,OAAO,SAAS,UAAU,QAAQ,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC;AAElF,YAAM,oBAAoB;AAAA,QACxB;AAAA,QACA,MAAM,UAAU,uBAAuB,GAAG,UAAU;AAAA,MACtD;AAGA,gBAAU,UAAU,YAAY,IAAI;AAAA,QAClC,iBAAiB,EAAE,GAAG,kBAAkB,CAAC;AAAA,QACzC,UAAU,YAAY;AAAA,MACxB;AACA;AAAA,IACF;AAAA,EACF;AACF;AAGA,SAAS,8BAA8B;",
4
+ "sourcesContent": ["import { measureAsync, measureSync } from '@scalar/helpers/testing/measure'\nimport { bundle } from '@scalar/json-magic/bundle'\nimport { fetchUrls } from '@scalar/json-magic/bundle/plugins/browser'\nimport { type Difference, apply, diff, merge } from '@scalar/json-magic/diff'\nimport { createMagicProxy, getRaw } from '@scalar/json-magic/magic-proxy'\nimport { upgrade } from '@scalar/openapi-parser'\nimport type { Record } from '@scalar/typebox'\nimport { Value } from '@scalar/typebox/value'\nimport type { PartialDeep } from 'type-fest/source/partial-deep'\nimport type { RequiredDeep } from 'type-fest/source/required-deep'\nimport { reactive } from 'vue'\nimport YAML from 'yaml'\n\nimport { applySelectiveUpdates } from '@/helpers/apply-selective-updates'\nimport { deepClone } from '@/helpers/deep-clone'\nimport { type UnknownObject, isObject, safeAssign } from '@/helpers/general'\nimport { getValueByPath } from '@/helpers/json-path-utils'\nimport { mergeObjects } from '@/helpers/merge-object'\nimport { createOverridesProxy } from '@/helpers/overrides-proxy'\nimport { createNavigation } from '@/navigation'\nimport type { TraverseSpecOptions } from '@/navigation/types'\nimport { externalValueResolver, loadingStatus, refsEverywhere, restoreOriginalRefs } from '@/plugins'\nimport { getServersFromDocument } from '@/preprocessing/server'\nimport { extensions } from '@/schemas/extensions'\nimport { type InMemoryWorkspace, InMemoryWorkspaceSchema } from '@/schemas/inmemory-workspace'\nimport { defaultReferenceConfig } from '@/schemas/reference-config'\nimport { coerceValue } from '@/schemas/typebox-coerce'\nimport {\n OpenAPIDocumentSchema as OpenAPIDocumentSchemaStrict,\n type OpenApiDocument,\n} from '@/schemas/v3.1/strict/openapi-document'\nimport type { Workspace, WorkspaceDocumentMeta, WorkspaceMeta } from '@/schemas/workspace'\nimport type { WorkspaceSpecification } from '@/schemas/workspace-specification'\nimport type { Config } from '@/schemas/workspace-specification/config'\n\nexport type DocumentConfiguration = Config &\n PartialDeep<{\n 'x-scalar-reference-config': {\n tagSort: TraverseSpecOptions['tagsSorter']\n operationsSorter: TraverseSpecOptions['operationsSorter']\n getHeadingId: TraverseSpecOptions['getHeadingId']\n getOperationId: TraverseSpecOptions['getOperationId']\n getWebhookId: TraverseSpecOptions['getWebhookId']\n getModelId: TraverseSpecOptions['getModelId']\n getTagId: TraverseSpecOptions['getTagId']\n generateOperationSlug?: (details: {\n path: string\n operationId?: string\n method: string\n summary?: string\n }) => string\n generateHeadingSlug?: (details: { slug?: string }) => string\n generateTagSlug?: (details: { name?: string }) => string\n generateModelSlug?: (details: { name?: string }) => string\n generateWebhookSlug?: (details: { name: string; method: string }) => string\n }\n }>\n\ntype ExtraDocumentConfigurations = Record<\n string,\n {\n fetch: WorkspaceDocumentMetaInput['fetch']\n }\n>\n\nexport type ValidationError = {\n message: string\n path: string\n schema: unknown\n value: unknown\n}\n\nconst defaultConfig: RequiredDeep<Config> = {\n 'x-scalar-reference-config': defaultReferenceConfig,\n}\n\n/**\n * Input type for workspace document metadata and configuration.\n * This type defines the required and optional fields for initializing a document in the workspace.\n */\ntype WorkspaceDocumentMetaInput = {\n /** Optional metadata about the document like title, description, etc */\n meta?: WorkspaceDocumentMeta\n /** Required unique identifier for the document */\n name: string\n /** Optional configuration options */\n config?: DocumentConfiguration\n /** Overrides for the document */\n overrides?: PartialDeep<OpenApiDocument>\n /** Optional custom fetch implementation to use when retrieving the document. By default the global fetch implementation will be used */\n fetch?: (input: string | URL | globalThis.Request, init?: RequestInit) => Promise<Response>\n}\n\n/**\n * Represents a document that is loaded from a URL.\n * This type extends WorkspaceDocumentMetaInput to include URL-specific properties.\n */\nexport type UrlDoc = {\n /** URL to fetch the OpenAPI document from */\n url: string\n} & WorkspaceDocumentMetaInput\n\n/** Represents a document that is provided directly as an object rather than loaded from a URL */\nexport type ObjectDoc = {\n /** The OpenAPI document object containing the API specification */\n document: Record<string, unknown>\n} & WorkspaceDocumentMetaInput\n\n/**\n * Union type representing the possible input formats for a workspace document:\n * - UrlDoc: Document loaded from a URL with optional fetch configuration\n * - ObjectDoc: Direct document object with metadata\n */\nexport type WorkspaceDocumentInput = UrlDoc | ObjectDoc\n\n/**\n * Resolves a workspace document from various input sources (URL, local file, or direct document object).\n *\n * @param workspaceDocument - The document input to resolve, which can be:\n * - A URL to fetch the document from\n * - A direct document object\n * @returns A promise that resolves to an object containing:\n * - ok: boolean indicating if the resolution was successful\n * - data: The resolved document data\n *\n * @example\n * // Resolve from URL\n * const urlDoc = await loadDocument({ name: 'api', url: 'https://api.example.com/openapi.json' })\n *\n * // Resolve direct document\n * const directDoc = await loadDocument({\n * name: 'inline',\n * document: { openapi: '3.0.0', paths: {} }\n * })\n */\nasync function loadDocument(workspaceDocument: WorkspaceDocumentInput) {\n if ('url' in workspaceDocument) {\n return fetchUrls({ fetch: workspaceDocument.fetch }).exec(workspaceDocument.url)\n }\n\n return {\n ok: true as const,\n data: workspaceDocument.document,\n }\n}\n\n/**\n * Returns the origin (URL) of a workspace document if it was loaded from a URL.\n * If the document was provided directly as an object, returns undefined.\n *\n * @param input - The workspace document input (either UrlDoc or ObjectDoc)\n * @returns The URL string if present, otherwise undefined\n */\nconst getDocumentSource = (input: WorkspaceDocumentInput) => {\n if ('url' in input) {\n return input.url\n }\n return undefined\n}\n\n/**\n * Configuration object for initializing a workspace store.\n * Defines the initial state and documents for the workspace.\n */\ntype WorkspaceProps = {\n /** Optional metadata for the workspace including theme, active document, etc */\n meta?: WorkspaceMeta\n /** Workspace configuration */\n config?: Config\n /** Fetch function for retrieving documents */\n fetch?: WorkspaceDocumentInput['fetch']\n}\n\n/**\n * Type definition for the workspace store return object.\n * This explicit type is needed to avoid TypeScript inference limits.\n *\n * @see https://github.com/microsoft/TypeScript/issues/43817#issuecomment-827746462\n */\nexport type WorkspaceStore = {\n /**\n * Returns the reactive workspace object with an additional activeDocument getter\n */\n readonly workspace: Workspace\n /**\n * Updates a specific metadata field in the workspace\n * @param key - The metadata field to update\n * @param value - The new value for the field\n * @example\n * // Update the workspace title\n * update('x-scalar-active-document', 'document-name')\n */\n update<K extends keyof WorkspaceMeta>(key: K, value: WorkspaceMeta[K]): void\n /**\n * Updates a specific metadata field in a document\n * @param name - The name of the document to update ('active' or a specific document name)\n * @param key - The metadata field to update\n * @param value - The new value for the field\n * @throws Error if the specified document doesn't exist\n * @example\n * // Update the auth of the active document\n * updateDocument('active', 'x-scalar-active-auth', 'Bearer')\n * // Update the auth of a specific document\n * updateDocument('document-name', 'x-scalar-active-auth', 'Bearer')\n */\n updateDocument<K extends keyof WorkspaceDocumentMeta>(\n name: 'active' | (string & {}),\n key: K,\n value: WorkspaceDocumentMeta[K],\n ): void\n /**\n * Replaces the content of a specific document in the workspace with the provided input.\n * This method computes the difference between the current document and the new input,\n * then applies only the necessary changes in place. The updates are applied atomically,\n * ensuring the document is updated in a single operation.\n *\n * @param documentName - The name of the document to update.\n * @param input - The new content to apply to the document (as a plain object).\n * @example\n * // Replace the content of the 'api' document with new data\n * store.replaceDocument('api', {\n * openapi: '3.1.0',\n * info: { title: 'Updated API', version: '1.0.1' },\n * paths: {},\n * })\n */\n replaceDocument(documentName: string, input: Record<string, unknown>): Promise<void>\n /**\n * Resolves a reference in the active document by following the provided path and resolving any external $ref references.\n * This method traverses the document structure following the given path and resolves any $ref references it encounters.\n * During resolution, it sets a loading status and updates the reference with the resolved content.\n *\n * @param path - Array of strings representing the path to the reference (e.g. ['paths', '/users', 'get', 'responses', '200'])\n * @throws Error if the path is invalid or empty\n * @example\n * // Resolve a reference in the active document\n * resolve(['paths', '/users', 'get', 'responses', '200'])\n */\n resolve(path: string[]): Promise<unknown>\n /**\n * Adds a new document to the workspace\n * @param document - The document content to add. This should be a valid OpenAPI/Swagger document or other supported format\n * @param meta - Metadata for the document, including its name and other properties defined in WorkspaceDocumentMeta\n * @example\n * // Add a new OpenAPI document to the workspace\n * store.addDocument({\n * name: 'name',\n * document: {\n * openapi: '3.0.0',\n * info: { title: 'title' },\n * },\n * meta: {\n * 'x-scalar-active-auth': 'Bearer',\n * 'x-scalar-active-server': 'production'\n * }\n * })\n */\n addDocument(input: WorkspaceDocumentInput): Promise<void>\n /**\n * Returns the merged configuration for the active document.\n *\n * This getter merges configurations in the following order of precedence:\n * 1. Document-specific configuration (highest priority)\n * 2. Workspace-level configuration\n * 3. Default configuration (lowest priority)\n *\n * The active document is determined by the workspace's activeDocument extension,\n * falling back to the first document if none is specified.\n */\n readonly config: typeof defaultConfig\n /**\n * Exports the specified document in the requested format.\n *\n * This method serializes the most recently saved local version of the document (from the intermediateDocuments map)\n * to either JSON or YAML. The exported document reflects the last locally saved state, including any edits\n * that have been saved but not yet synced to a remote registry. Runtime/in-memory changes that have not been saved\n * will not be included.\n *\n * @param documentName - The name of the document to export.\n * @param format - The output format: 'json' for a JSON string, or 'yaml' for a YAML string.\n * @returns The document as a string in the requested format, or undefined if the document does not exist.\n *\n * @example\n * // Export a document as JSON\n * const jsonString = store.exportDocument('api', 'json')\n *\n * // Export a document as YAML\n * const yamlString = store.exportDocument('api', 'yaml')\n */\n exportDocument(documentName: string, format: 'json' | 'yaml'): string | undefined\n /**\n * Exports the currently active document in the requested format.\n *\n * This is a convenience method that exports the active document (determined by the workspace's\n * activeDocument extension) without requiring the caller to specify the document name.\n * The exported document reflects the last locally saved state, including any edits that have\n * been saved but not yet synced to a remote registry.\n *\n * @param format - The output format: 'json' for a JSON string, or 'yaml' for a YAML string.\n * @returns The active document as a string in the requested format, or undefined if no active document exists.\n *\n * @example\n * // Export the active document as JSON\n * const jsonString = store.exportActiveDocument('json')\n *\n * // Export the active document as YAML\n * const yamlString = store.exportActiveDocument('yaml')\n */\n exportActiveDocument(format: 'json' | 'yaml'): string | undefined\n /**\n * Saves the current state of the specified document to the intermediate documents map.\n *\n * This function captures the latest (reactive) state of the document from the workspace and\n * applies its changes to the corresponding entry in the `intermediateDocuments` map.\n * The `intermediateDocuments` map represents the most recently \"saved\" local version of the document,\n * which may include edits not yet synced to the remote registry.\n *\n * The update is performed in-place. A deep clone of the current document\n * state is used to avoid mutating the reactive object directly.\n *\n * @param documentName - The name of the document to save.\n * @returns An array of diffs that were excluded from being applied (such as changes to ignored keys),\n * or undefined if the document does not exist or cannot be updated.\n *\n * @example\n * // Save the current state of the document named 'api'\n * const excludedDiffs = store.saveDocument('api')\n */\n saveDocument(documentName: string): Promise<unknown[] | undefined>\n /**\n * Restores the specified document to its last locally saved state.\n *\n * This method updates the current reactive document (in the workspace) with the contents of the\n * corresponding intermediate document (from the `intermediateDocuments` map), effectively discarding\n * any unsaved in-memory changes and reverting to the last saved version.\n * Vue reactivity is preserved by updating the existing reactive object in place.\n *\n * **Warning:** This operation will discard all unsaved (in-memory) changes to the specified document.\n *\n * @param documentName - The name of the document to restore.\n * @returns void\n *\n * @example\n * // Restore the document named 'api' to its last saved state\n * store.revertDocumentChanges('api')\n */\n revertDocumentChanges(documentName: string): Promise<void>\n /**\n * Commits the specified document.\n *\n * This method is intended to finalize and persist the current state of the document,\n * potentially syncing it with a remote registry or marking it as the latest committed version.\n *\n * @param documentName - The name of the document to commit.\n * @remarks\n * The actual commit logic is not implemented yet.\n */\n commitDocument(documentName: string): void\n /**\n * Serializes the current workspace state to a JSON string for backup, persistence, or sharing.\n *\n * This method exports all workspace documents (removing Vue reactivity proxies), workspace metadata,\n * document configurations, and both the original and intermediate document states. The resulting JSON\n * can be imported later to fully restore the workspace to this exact state, including all documents\n * and their configurations.\n *\n * @returns A JSON string representing the complete workspace state.\n */\n exportWorkspace(): string\n /**\n * Imports a workspace from a serialized JSON string.\n *\n * This method parses the input string using the InMemoryWorkspaceSchema,\n * then updates the current workspace state, including documents, metadata,\n * and configuration, with the imported values.\n *\n * @param input - The serialized workspace JSON string to import.\n */\n loadWorkspace(input: string): void\n /**\n * Imports a workspace from a WorkspaceSpecification object.\n *\n * This method assigns workspace metadata and adds all documents defined in the specification.\n * Each document is added using its $ref and optional overrides.\n *\n * @example\n * ```ts\n * await store.importWorkspaceFromSpecification({\n * documents: {\n * api: { $ref: '/specs/api.yaml' },\n * petstore: { $ref: '/specs/petstore.yaml' }\n * },\n * overrides: {\n * api: { config: { features: { showModels: true } } }\n * },\n * info: { title: 'My Workspace' },\n * workspace: 'v1',\n * \"x-scalar-dark-mode\": true\n * })\n * ```\n *\n * @param specification - The workspace specification to import.\n */\n importWorkspaceFromSpecification(specification: WorkspaceSpecification): Promise<void[]>\n /**\n * Rebases a document in the workspace with a new origin, resolving conflicts if provided.\n *\n * This method is used to rebase a document (e.g., after pulling remote changes) by applying the changes\n * from the new origin and merging them with local edits. If there are conflicts, they can be resolved\n * by providing a list of resolved conflicts.\n *\n * @param documentName - The name of the document to rebase.\n * @param newDocumentOrigin - The new origin document (as an object) to rebase onto.\n * @param resolvedConflicts - (Optional) An array of resolved conflicts to apply.\n * @returns If there are unresolved conflicts and no resolution is provided, returns the list of conflicts.\n *\n * @example\n * // Example: Rebase a document with a new origin and resolve conflicts\n * const conflicts = store.rebaseDocument('api', newOriginDoc)\n * if (conflicts && conflicts.length > 0) {\n * // User resolves conflicts here...\n * store.rebaseDocument('api', newOriginDoc, userResolvedConflicts)\n * }\n */\n rebaseDocument: (\n documentName: string,\n newDocumentOrigin: Record<string, unknown>,\n resolvedConflicts?: Difference<unknown>[],\n ) => void | ReturnType<typeof merge>['conflicts']\n}\n\n/**\n * Creates a reactive workspace store that manages documents and their metadata.\n * The store provides functionality for accessing, updating, and resolving document references.\n *\n * @param workspaceProps - Configuration object for the workspace\n * @param workspaceProps.meta - Optional metadata for the workspace\n * @param workspaceProps.documents - Optional record of documents to initialize the workspace with\n * Documents that require asynchronous loading must be added using `addDocument` after the store is created\n * this allows atomic awaiting and does not block page load for the store initialization\n * @returns An object containing methods and getters for managing the workspace\n */\nexport const createWorkspaceStore = (workspaceProps?: WorkspaceProps): WorkspaceStore => {\n /**\n * Holds the original, unmodified documents as they were initially loaded into the workspace.\n * These documents are stored in their raw form\u2014prior to any reactive wrapping, dereferencing, or bundling.\n * This map preserves the pristine structure of each document, using deep clones to ensure that\n * subsequent mutations in the workspace do not affect the originals.\n * The originals are retained so that we can restore, compare, or sync with the remote registry as needed.\n */\n const originalDocuments = {} as Record<string, UnknownObject>\n /**\n * Stores the intermediate state of documents after local edits but before syncing with the remote registry.\n *\n * This map acts as a local \"saved\" version of the document, reflecting the user's changes after they hit \"save\".\n * The `originalDocuments` map, by contrast, always mirrors the document as it exists in the remote registry.\n *\n * Use this map to stage local changes that are ready to be propagated back to the remote registry.\n * This separation allows us to distinguish between:\n * - The last known remote version (`originalDocuments`)\n * - The latest locally saved version (`intermediateDocuments`)\n * - The current in-memory (possibly unsaved) workspace document (`workspace.documents`)\n */\n const intermediateDocuments = {} as Record<string, UnknownObject>\n /**\n * A map of document configurations keyed by document name.\n * This stores the configuration options for each document in the workspace,\n * allowing for document-specific settings like navigation options, appearance,\n * and other reference configuration.\n */\n const documentConfigs: Record<string, Config> = {}\n /**\n * Stores per-document overrides for OpenAPI documents.\n * This object is used to override specific fields of a document\n * when you cannot (or should not) modify the source document directly.\n * For example, this enables UI-driven or temporary changes to be applied\n * on top of the original document, without mutating the source.\n * The key is the document name, and the value is a deep partial\n * OpenAPI document representing the overridden fields.\n */\n const overrides: InMemoryWorkspace['overrides'] = {}\n /**\n * Holds additional metadata for each document in the workspace.\n *\n * This metadata should be persisted together with the document itself.\n * It can include information such as user preferences, UI state, or other\n * per-document attributes that are not part of the OpenAPI document structure.\n */\n const documentMeta: InMemoryWorkspace['documentMeta'] = {}\n\n /**\n * Holds additional configuration options for each document in the workspace.\n *\n * This can include settings that can not be persisted between sessions (not JSON serializable)\n */\n const extraDocumentConfigurations: ExtraDocumentConfigurations = {}\n\n // Create a reactive workspace object with proxied documents\n // Each document is wrapped in a proxy to enable reactive updates and reference resolution\n const workspace = reactive<Workspace>({\n ...workspaceProps?.meta,\n documents: {},\n /**\n * Returns the currently active document from the workspace.\n * The active document is determined by the 'x-scalar-active-document' metadata field,\n * falling back to the first document in the workspace if no active document is specified.\n *\n * @returns The active document or undefined if no document is found\n */\n get activeDocument(): NonNullable<Workspace['activeDocument']> | undefined {\n const activeDocumentKey =\n workspace[extensions.workspace.activeDocument] ?? Object.keys(workspace.documents)[0] ?? ''\n return workspace.documents[activeDocumentKey]\n },\n })\n\n /**\n * Returns the name of the currently active document in the workspace.\n * The active document is determined by the 'x-scalar-active-document' metadata field,\n * falling back to the first document in the workspace if no active document is specified.\n *\n * @returns The name of the active document or an empty string if no document is found\n */\n function getActiveDocumentName() {\n return workspace[extensions.workspace.activeDocument] ?? Object.keys(workspace.documents)[0] ?? ''\n }\n\n function exportDocument(documentName: string, format: 'json' | 'yaml') {\n const intermediateDocument = intermediateDocuments[documentName]\n\n if (!intermediateDocument) {\n return\n }\n\n if (format === 'json') {\n return JSON.stringify(intermediateDocument)\n }\n\n return YAML.stringify(intermediateDocument)\n }\n\n // Save the current state of the specified document to the intermediate documents map.\n // This function captures the latest (reactive) state of the document from the workspace and\n // applies its changes to the corresponding entry in the `intermediateDocuments` map.\n // The `intermediateDocuments` map represents the most recently \"saved\" local version of the document,\n // which may include edits not yet synced to the remote registry.\n async function saveDocument(documentName: string) {\n const intermediateDocument = intermediateDocuments[documentName]\n const workspaceDocument = workspace.documents[documentName]\n\n if (!workspaceDocument) {\n return\n }\n\n // Obtain the raw state of the current document to ensure accurate diffing\n const updatedDocument = getRaw(workspaceDocument)\n\n // If either the intermediate or updated document is missing, do nothing\n if (!intermediateDocument || !updatedDocument) {\n return\n }\n\n // Traverse the document and convert refs back to the original shape\n const updatedWithOriginalRefs = await bundle(deepClone(updatedDocument), {\n plugins: [restoreOriginalRefs()],\n treeShake: false,\n urlMap: true,\n })\n\n // Apply changes from the current document to the intermediate document in place\n const excludedDiffs = applySelectiveUpdates(intermediateDocument, updatedWithOriginalRefs as UnknownObject)\n return excludedDiffs\n }\n\n const processDocument = (input: OpenApiDocument, options: Config & { documentSource?: string }): OpenApiDocument => {\n // Get the servers from the document or the config and perform some mutations on them\n const servers = getServersFromDocument(options['x-scalar-reference-config']?.settings?.servers ?? input.servers, {\n baseServerUrl: options['x-scalar-reference-config']?.settings?.baseServerUrl,\n documentUrl: options.documentSource,\n })\n\n if (servers.length) {\n input.servers = servers.map((it) => ({ url: it.url, description: it.description, variables: it.variables }))\n }\n\n return input\n }\n\n // Add a document to the store synchronously from an in-memory OpenAPI document\n async function addInMemoryDocument(input: ObjectDoc & { initialize?: boolean; documentSource?: string }) {\n const { name, meta } = input\n const cloned = measureSync('deepClone', () => deepClone(input.document))\n const inputDocument = measureSync('upgrade', () => upgrade(cloned).specification)\n\n measureSync('initialize', () => {\n if (input.initialize !== false) {\n // Store the original document in the originalDocuments map\n // This is used to track the original state of the document as it was loaded into the workspace\n originalDocuments[name] = deepClone({ ...inputDocument })\n\n // Store the intermediate document state for local edits\n // This is used to track the last saved state of the document\n // It allows us to differentiate between the original document and the latest saved version\n // This is important for local edits that are not yet synced with the remote registry\n // The intermediate document is used to store the latest saved state of the document\n // This allows us to track changes and revert to the last saved state if needed\n intermediateDocuments[name] = deepClone({ ...inputDocument })\n // Add the document config to the documentConfigs map\n documentConfigs[name] = input.config ?? {}\n // Store the overrides for this document, or an empty object if none are provided\n overrides[name] = input.overrides ?? {}\n // Store the document metadata for this document, setting the origin if provided\n documentMeta[name] = { documentSource: input.documentSource }\n // Store extra document configurations that can not be persisted\n extraDocumentConfigurations[name] = { fetch: input.fetch }\n }\n })\n\n const strictDocument: UnknownObject = createMagicProxy({ ...inputDocument, ...meta }, { showInternal: true })\n\n strictDocument['x-original-oas-version'] = input.document.openapi ?? input.document.swagger\n\n if (strictDocument[extensions.document.navigation] === undefined) {\n // If the document navigation is not already present, bundle the entire document to resolve all references.\n // This typically applies when the document is not preprocessed by the server and needs local reference resolution.\n // We need to bundle document first before we validate, so we can also validate the external references\n await measureAsync(\n 'bundle',\n async () =>\n await bundle(getRaw(strictDocument), {\n treeShake: false,\n plugins: [\n fetchUrls({\n fetch: extraDocumentConfigurations[name]?.fetch ?? workspaceProps?.fetch,\n }),\n externalValueResolver(),\n refsEverywhere(),\n ],\n urlMap: true,\n origin: documentMeta[name]?.documentSource, // use the document origin (if provided) as the base URL for resolution\n }),\n )\n\n // We coerce the values only when the document is not preprocessed by the server-side-store\n const coerced = measureSync('coerceValue', () =>\n coerceValue(OpenAPIDocumentSchemaStrict, deepClone(strictDocument)),\n )\n measureAsync('mergeObjects', async () => mergeObjects(strictDocument, coerced))\n }\n\n const isValid = Value.Check(OpenAPIDocumentSchemaStrict, strictDocument)\n\n if (!isValid) {\n const validationErrors = Array.from(Value.Errors(OpenAPIDocumentSchemaStrict, strictDocument))\n\n console.warn('document validation errors: ')\n console.warn(\n validationErrors.map((error) => ({\n message: error.message,\n path: error.path,\n schema: error.schema,\n value: error.value,\n })),\n )\n }\n\n // Skip navigation generation if the document already has a server-side generated navigation structure\n if (strictDocument[extensions.document.navigation] === undefined) {\n const showModels = input.config?.['x-scalar-reference-config']?.features?.showModels\n\n strictDocument[extensions.document.navigation] = createNavigation(strictDocument as OpenApiDocument, {\n ...(input.config?.['x-scalar-reference-config'] ?? {}),\n hideModels: showModels === undefined ? undefined : !showModels,\n }).entries\n\n // Do some document processing\n processDocument(getRaw(strictDocument as OpenApiDocument), {\n ...input.config,\n documentSource: input.documentSource,\n })\n }\n\n // Create a proxied document with magic proxy and apply any overrides, then store it in the workspace documents map\n // We create a new proxy here in order to hide internal properties after validation and processing\n // This ensures that the workspace document only exposes the intended OpenAPI properties and extensions\n workspace.documents[name] = createOverridesProxy(\n createMagicProxy(getRaw(strictDocument)) as OpenApiDocument,\n input.overrides,\n )\n }\n\n // Asynchronously adds a new document to the workspace by loading and validating the input.\n // If loading fails, a placeholder error document is added instead.\n async function addDocument(input: WorkspaceDocumentInput) {\n const { name, meta } = input\n\n const resolve = await measureAsync(\n 'loadDocument',\n async () => await loadDocument({ ...input, fetch: input.fetch ?? workspaceProps?.fetch }),\n )\n\n // Log the time taken to add a document\n await measureAsync('addDocument', async () => {\n if (!resolve.ok) {\n console.error(`Failed to fetch document '${name}': request was not successful`)\n\n workspace.documents[name] = {\n ...meta,\n openapi: '3.1.0',\n info: {\n title: `Document '${name}' could not be loaded`,\n version: 'unknown',\n },\n }\n\n return\n }\n\n if (!isObject(resolve.data)) {\n console.error(`Failed to load document '${name}': response data is not a valid object`)\n\n workspace.documents[name] = {\n ...meta,\n openapi: '3.1.0',\n info: {\n title: `Document '${name}' could not be loaded`,\n version: 'unknown',\n },\n }\n\n return\n }\n\n await addInMemoryDocument({\n ...input,\n document: resolve.data,\n documentSource: getDocumentSource(input),\n })\n })\n }\n\n // Returns the effective document configuration for a given document name,\n // merging (in order of increasing priority): the default config, workspace-level config, and document-specific config.\n const getDocumentConfiguration = (name: string) => {\n return mergeObjects<typeof defaultConfig>(\n mergeObjects(defaultConfig, workspaceProps?.config ?? {}),\n documentConfigs[name] ?? {},\n )\n }\n\n // Cache to track visited nodes during reference resolution to prevent bundling the same subtree multiple times\n // This is needed because we are doing partial bundle operations\n const visitedNodesCache = new Set()\n\n return {\n get workspace() {\n return workspace\n },\n update<K extends keyof WorkspaceMeta>(key: K, value: WorkspaceMeta[K]) {\n // @ts-ignore\n if (key === '__proto__' || key === 'constructor' || key === 'prototype') {\n throw new Error('Invalid key: cannot modify prototype')\n }\n Object.assign(workspace, { [key]: value })\n },\n updateDocument<K extends keyof WorkspaceDocumentMeta>(\n name: 'active' | (string & {}),\n key: K,\n value: WorkspaceDocumentMeta[K],\n ) {\n const currentDocument = workspace.documents[name === 'active' ? getActiveDocumentName() : name]\n\n if (!currentDocument) {\n throw 'Please select a valid document'\n }\n\n Object.assign(currentDocument, { [key]: value })\n },\n async replaceDocument(documentName: string, input: Record<string, unknown>) {\n const currentDocument = workspace.documents[documentName]\n\n if (!currentDocument) {\n return console.error(`Document '${documentName}' does not exist in the workspace.`)\n }\n\n // Replace the whole document\n await addInMemoryDocument({\n name: documentName,\n document: input,\n // Preserve the current metadata\n meta: {\n 'x-scalar-active-auth': currentDocument['x-scalar-active-auth'],\n 'x-scalar-active-server': currentDocument['x-scalar-active-server'],\n },\n initialize: false,\n })\n },\n resolve: async (path: string[]) => {\n const activeDocument = workspace.activeDocument\n\n const target = getValueByPath(activeDocument, path)\n\n if (!isObject(target)) {\n console.error(\n `Invalid path provided for resolution. Path: [${path.join(', ')}]. Found value of type: ${typeof target}. Expected an object.`,\n )\n return\n }\n\n // Bundle the target document with the active document as root, resolving any external references\n // and tracking resolution status through hooks\n return bundle(target, {\n root: activeDocument,\n treeShake: false,\n plugins: [fetchUrls(), loadingStatus(), externalValueResolver()],\n urlMap: true,\n visitedNodes: visitedNodesCache,\n })\n },\n addDocument,\n get config() {\n return getDocumentConfiguration(getActiveDocumentName())\n },\n exportDocument,\n exportActiveDocument: (format) => exportDocument(getActiveDocumentName(), format),\n saveDocument,\n async revertDocumentChanges(documentName: string) {\n const workspaceDocument = workspace.documents[documentName]\n const intermediate = intermediateDocuments[documentName]\n\n if (!workspaceDocument || !intermediate) {\n return\n }\n\n await addInMemoryDocument({\n name: documentName,\n document: intermediate,\n initialize: false,\n })\n },\n commitDocument(documentName: string) {\n // TODO: Implement commit logic\n console.warn(`Commit operation for document '${documentName}' is not implemented yet.`)\n },\n exportWorkspace() {\n return JSON.stringify({\n documents: {\n ...Object.fromEntries(\n Object.entries(workspace.documents).map(([name, doc]) => [\n name,\n // Extract the raw document data for export, removing any Vue reactivity wrappers.\n // When importing, the document can be wrapped again in a magic proxy.\n getRaw(doc),\n ]),\n ),\n },\n meta: workspaceProps?.meta ?? {},\n documentConfigs,\n originalDocuments,\n intermediateDocuments,\n overrides,\n documentMeta,\n } satisfies InMemoryWorkspace)\n },\n loadWorkspace(input: string) {\n const result = coerceValue(InMemoryWorkspaceSchema, JSON.parse(input))\n\n // Assign the magic proxy to the documents\n safeAssign(\n workspace.documents,\n Object.fromEntries(\n Object.entries(result.documents).map(([name, doc]) => [\n name,\n createOverridesProxy(createMagicProxy(doc), result.overrides[name]),\n ]),\n ),\n )\n\n safeAssign(originalDocuments, result.originalDocuments)\n safeAssign(intermediateDocuments, result.intermediateDocuments)\n safeAssign(documentConfigs, result.documentConfigs)\n safeAssign(overrides, result.overrides)\n safeAssign(workspace, result.meta)\n safeAssign(documentMeta, result.documentMeta)\n },\n importWorkspaceFromSpecification: (specification: WorkspaceSpecification) => {\n const { documents, overrides, info: _info, workspace: _workspaceVersion, ...meta } = specification\n\n // Assign workspace metadata\n safeAssign(workspace, meta)\n\n // Add workspace documents\n return Promise.all(\n Object.entries(documents ?? {}).map(([name, doc]) =>\n addDocument({ url: doc.$ref, name, overrides: overrides?.[name] }),\n ),\n )\n },\n rebaseDocument: (documentName, newDocumentOrigin, resolvedConflicts) => {\n const newOrigin = upgrade(newDocumentOrigin).specification\n\n const originalDocument = originalDocuments[documentName]\n const intermediateDocument = intermediateDocuments[documentName]\n const activeDocument = workspace.documents[documentName] ? getRaw(workspace.documents[documentName]) : undefined // raw version without any overrides\n\n if (!originalDocument || !intermediateDocument || !activeDocument) {\n // If any required document state is missing, do nothing\n return console.error('[ERROR]: Specified document is missing or internal corrupted workspace state')\n }\n\n // ---- Get the new intermediate document\n const changelogAA = diff(originalDocument, newOrigin)\n const changelogAB = diff(originalDocument, intermediateDocument)\n\n const changesA = merge(changelogAA, changelogAB)\n\n if (resolvedConflicts === undefined) {\n // If there are conflicts, return the list of conflicts for user resolution\n return changesA.conflicts\n }\n\n const changesetA = changesA.diffs.concat(resolvedConflicts)\n\n // Apply the changes to the original document to get the new intermediate\n const newIntermediateDocument = apply(deepClone(originalDocument), changesetA)\n intermediateDocuments[documentName] = newIntermediateDocument\n\n // Update the original document\n originalDocuments[documentName] = newOrigin\n\n // ---- Get the new active document\n const changelogBA = diff(intermediateDocument, newIntermediateDocument)\n const changelogBB = diff(intermediateDocument, activeDocument)\n\n const changesB = merge(changelogBA, changelogBB)\n\n // Auto-conflict resolution: pick only the changes from the first changeset\n // TODO: In the future, implement smarter conflict resolution if needed\n const changesetB = changesB.diffs.concat(changesB.conflicts.flatMap((it) => it[0]))\n\n const newActiveDocument = coerceValue(\n OpenAPIDocumentSchemaStrict,\n apply(deepClone(newIntermediateDocument), changesetB),\n )\n\n // Update the active document to the new value\n workspace.documents[documentName] = createOverridesProxy(\n createMagicProxy({ ...newActiveDocument }),\n overrides[documentName],\n )\n return\n },\n }\n}\n\n// biome-ignore lint/performance/noBarrelFile: It's a package entry point\nexport { generateClientMutators } from '@/mutators'\n"],
5
+ "mappings": "AAAA,SAAS,cAAc,mBAAmB;AAC1C,SAAS,cAAc;AACvB,SAAS,iBAAiB;AAC1B,SAA0B,OAAO,MAAM,aAAa;AACpD,SAAS,kBAAkB,cAAc;AACzC,SAAS,eAAe;AAExB,SAAS,aAAa;AAGtB,SAAS,gBAAgB;AACzB,OAAO,UAAU;AAEjB,SAAS,6BAA6B;AACtC,SAAS,iBAAiB;AAC1B,SAA6B,UAAU,kBAAkB;AACzD,SAAS,sBAAsB;AAC/B,SAAS,oBAAoB;AAC7B,SAAS,4BAA4B;AACrC,SAAS,wBAAwB;AAEjC,SAAS,uBAAuB,eAAe,gBAAgB,2BAA2B;AAC1F,SAAS,8BAA8B;AACvC,SAAS,kBAAkB;AAC3B,SAAiC,+BAA+B;AAChE,SAAS,8BAA8B;AACvC,SAAS,mBAAmB;AAC5B;AAAA,EACE,yBAAyB;AAAA,OAEpB;AA0CP,MAAM,gBAAsC;AAAA,EAC1C,6BAA6B;AAC/B;AA6DA,eAAe,aAAa,mBAA2C;AACrE,MAAI,SAAS,mBAAmB;AAC9B,WAAO,UAAU,EAAE,OAAO,kBAAkB,MAAM,CAAC,EAAE,KAAK,kBAAkB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