@scalar/workspace-store 0.12.0 → 0.14.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 (431) hide show
  1. package/CHANGELOG.md +54 -0
  2. package/dist/client.d.ts +252 -30
  3. package/dist/client.d.ts.map +1 -1
  4. package/dist/client.js +144 -277
  5. package/dist/client.js.map +2 -2
  6. package/dist/helpers/apply-selective-updates.d.ts +1 -1
  7. package/dist/helpers/apply-selective-updates.d.ts.map +1 -1
  8. package/dist/helpers/apply-selective-updates.js +1 -1
  9. package/dist/helpers/apply-selective-updates.js.map +2 -2
  10. package/dist/helpers/deep-clone.d.ts +21 -0
  11. package/dist/helpers/deep-clone.d.ts.map +1 -0
  12. package/dist/helpers/deep-clone.js +18 -0
  13. package/dist/helpers/deep-clone.js.map +7 -0
  14. package/dist/helpers/get-resolved-ref.d.ts +19 -0
  15. package/dist/helpers/get-resolved-ref.d.ts.map +1 -0
  16. package/dist/helpers/get-resolved-ref.js +13 -0
  17. package/dist/helpers/get-resolved-ref.js.map +7 -0
  18. package/dist/helpers/merge-object.d.ts +9 -1
  19. package/dist/helpers/merge-object.d.ts.map +1 -1
  20. package/dist/helpers/merge-object.js +10 -2
  21. package/dist/helpers/merge-object.js.map +2 -2
  22. package/dist/helpers/overrides-proxy.d.ts +43 -1
  23. package/dist/helpers/overrides-proxy.d.ts.map +1 -1
  24. package/dist/helpers/overrides-proxy.js +2 -2
  25. package/dist/helpers/overrides-proxy.js.map +2 -2
  26. package/dist/mutators/helpers.d.ts +2 -34830
  27. package/dist/mutators/helpers.d.ts.map +1 -1
  28. package/dist/mutators/helpers.js.map +2 -2
  29. package/dist/mutators/request-example.d.ts.map +1 -1
  30. package/dist/mutators/request-example.js +4 -7
  31. package/dist/mutators/request-example.js.map +2 -2
  32. package/dist/navigation/helpers/traverse-document.js +2 -2
  33. package/dist/navigation/helpers/traverse-document.js.map +2 -2
  34. package/dist/navigation/helpers/traverse-paths.d.ts.map +1 -1
  35. package/dist/navigation/helpers/traverse-paths.js +8 -5
  36. package/dist/navigation/helpers/traverse-paths.js.map +2 -2
  37. package/dist/navigation/helpers/traverse-schemas.d.ts.map +1 -1
  38. package/dist/navigation/helpers/traverse-schemas.js +8 -5
  39. package/dist/navigation/helpers/traverse-schemas.js.map +2 -2
  40. package/dist/navigation/helpers/traverse-webhooks.d.ts.map +1 -1
  41. package/dist/navigation/helpers/traverse-webhooks.js +9 -5
  42. package/dist/navigation/helpers/traverse-webhooks.js.map +2 -2
  43. package/dist/navigation/types.d.ts +3 -3
  44. package/dist/navigation/types.d.ts.map +1 -1
  45. package/dist/plugins.d.ts +93 -0
  46. package/dist/plugins.d.ts.map +1 -0
  47. package/dist/plugins.js +107 -0
  48. package/dist/plugins.js.map +7 -0
  49. package/dist/schemas/extensions/document/x-internal.d.ts +4 -0
  50. package/dist/schemas/extensions/document/x-internal.d.ts.map +1 -0
  51. package/dist/schemas/extensions/document/x-internal.js +8 -0
  52. package/dist/schemas/extensions/document/x-internal.js.map +7 -0
  53. package/dist/schemas/extensions/document/x-scalar-icon.d.ts +4 -0
  54. package/dist/schemas/extensions/document/x-scalar-icon.d.ts.map +1 -0
  55. package/dist/schemas/extensions/document/x-scalar-icon.js +8 -0
  56. package/dist/schemas/extensions/document/x-scalar-icon.js.map +7 -0
  57. package/dist/schemas/extensions/document/x-scalar-ignore.d.ts +4 -0
  58. package/dist/schemas/extensions/document/x-scalar-ignore.d.ts.map +1 -0
  59. package/dist/schemas/extensions/document/x-scalar-ignore.js +8 -0
  60. package/dist/schemas/extensions/document/x-scalar-ignore.js.map +7 -0
  61. package/dist/schemas/extensions/document/x-scalar-sdk-installation.d.ts +8 -0
  62. package/dist/schemas/extensions/document/x-scalar-sdk-installation.d.ts.map +1 -0
  63. package/dist/schemas/extensions/document/x-scalar-sdk-installation.js +16 -0
  64. package/dist/schemas/extensions/document/x-scalar-sdk-installation.js.map +7 -0
  65. package/dist/schemas/extensions/operation/x-badge.d.ts +58 -0
  66. package/dist/schemas/extensions/operation/x-badge.d.ts.map +1 -0
  67. package/dist/schemas/extensions/operation/x-badge.js +41 -0
  68. package/dist/schemas/extensions/operation/x-badge.js.map +7 -0
  69. package/dist/schemas/extensions/operation/x-code-samples.d.ts +23 -0
  70. package/dist/schemas/extensions/operation/x-code-samples.d.ts.map +1 -0
  71. package/dist/schemas/extensions/operation/x-code-samples.js +16 -0
  72. package/dist/schemas/extensions/operation/x-code-samples.js.map +7 -0
  73. package/dist/schemas/extensions/operation/x-post-response.d.ts +19 -0
  74. package/dist/schemas/extensions/operation/x-post-response.d.ts.map +1 -0
  75. package/dist/schemas/extensions/operation/x-post-response.js +8 -0
  76. package/dist/schemas/extensions/operation/x-post-response.js.map +7 -0
  77. package/dist/schemas/extensions/operation/x-scalar-stability.d.ts +18 -0
  78. package/dist/schemas/extensions/operation/x-scalar-stability.d.ts.map +1 -0
  79. package/dist/schemas/extensions/operation/x-scalar-stability.js +16 -0
  80. package/dist/schemas/extensions/operation/x-scalar-stability.js.map +7 -0
  81. package/dist/schemas/extensions/schema/x-additional-properties-name.d.ts +11 -0
  82. package/dist/schemas/extensions/schema/x-additional-properties-name.d.ts.map +1 -0
  83. package/dist/schemas/extensions/schema/x-additional-properties-name.js +8 -0
  84. package/dist/schemas/extensions/schema/x-additional-properties-name.js.map +7 -0
  85. package/dist/schemas/extensions/schema/x-enum-descriptions.d.ts +17 -0
  86. package/dist/schemas/extensions/schema/x-enum-descriptions.d.ts.map +1 -0
  87. package/dist/schemas/extensions/schema/x-enum-descriptions.js +8 -0
  88. package/dist/schemas/extensions/schema/x-enum-descriptions.js.map +7 -0
  89. package/dist/schemas/extensions/schema/x-variable.d.ts +4 -0
  90. package/dist/schemas/extensions/schema/x-variable.d.ts.map +1 -0
  91. package/dist/schemas/extensions/schema/x-variable.js +8 -0
  92. package/dist/schemas/extensions/schema/x-variable.js.map +7 -0
  93. package/dist/schemas/extensions/security/x-scalar-credentials-location.d.ts +17 -0
  94. package/dist/schemas/extensions/security/x-scalar-credentials-location.d.ts.map +1 -0
  95. package/dist/schemas/extensions/security/x-scalar-credentials-location.js +8 -0
  96. package/dist/schemas/extensions/security/x-scalar-credentials-location.js.map +7 -0
  97. package/dist/schemas/extensions/security/x-scalar-redirect-uri.d.ts +4 -0
  98. package/dist/schemas/extensions/security/x-scalar-redirect-uri.d.ts.map +1 -0
  99. package/dist/schemas/extensions/security/x-scalar-redirect-uri.js +8 -0
  100. package/dist/schemas/extensions/security/x-scalar-redirect-uri.js.map +7 -0
  101. package/dist/schemas/extensions/security/x-scalar-security-body.d.ts +15 -0
  102. package/dist/schemas/extensions/security/x-scalar-security-body.d.ts.map +1 -0
  103. package/dist/schemas/extensions/security/x-scalar-security-body.js +8 -0
  104. package/dist/schemas/extensions/security/x-scalar-security-body.js.map +7 -0
  105. package/dist/schemas/extensions/security/x-scalar-security-query.d.ts +15 -0
  106. package/dist/schemas/extensions/security/x-scalar-security-query.d.ts.map +1 -0
  107. package/dist/schemas/extensions/security/x-scalar-security-query.js +8 -0
  108. package/dist/schemas/extensions/security/x-scalar-security-query.js.map +7 -0
  109. package/dist/schemas/extensions/security/x-scalar-security-secrets.d.ts +18 -0
  110. package/dist/schemas/extensions/security/x-scalar-security-secrets.d.ts.map +1 -0
  111. package/dist/schemas/extensions/security/x-scalar-security-secrets.js +13 -0
  112. package/dist/schemas/extensions/security/x-scalar-security-secrets.js.map +7 -0
  113. package/dist/schemas/extensions/security/x-tokenName.d.ts +12 -0
  114. package/dist/schemas/extensions/security/x-tokenName.d.ts.map +1 -0
  115. package/dist/schemas/extensions/security/x-tokenName.js +8 -0
  116. package/dist/schemas/extensions/security/x-tokenName.js.map +7 -0
  117. package/dist/schemas/extensions/security/x-use-pkce.d.ts +7 -0
  118. package/dist/schemas/extensions/security/x-use-pkce.d.ts.map +1 -0
  119. package/dist/schemas/extensions/security/x-use-pkce.js +13 -0
  120. package/dist/schemas/extensions/security/x-use-pkce.js.map +7 -0
  121. package/dist/schemas/extensions/tag/x-display-name.d.ts +12 -0
  122. package/dist/schemas/extensions/tag/x-display-name.d.ts.map +1 -0
  123. package/dist/schemas/extensions/tag/x-display-name.js +8 -0
  124. package/dist/schemas/extensions/tag/x-display-name.js.map +7 -0
  125. package/dist/schemas/extensions/tag/x-tag-groups.d.ts +28 -0
  126. package/dist/schemas/extensions/tag/x-tag-groups.d.ts.map +1 -0
  127. package/dist/schemas/extensions/tag/x-tag-groups.js +19 -0
  128. package/dist/schemas/extensions/tag/x-tag-groups.js.map +7 -0
  129. package/dist/schemas/inmemory-workspace.d.ts +48 -5545
  130. package/dist/schemas/inmemory-workspace.d.ts.map +1 -1
  131. package/dist/schemas/inmemory-workspace.js +12 -3
  132. package/dist/schemas/inmemory-workspace.js.map +2 -2
  133. package/dist/schemas/reference-config/index.d.ts +12 -4
  134. package/dist/schemas/reference-config/index.d.ts.map +1 -1
  135. package/dist/schemas/reference-config/index.js +0 -6
  136. package/dist/schemas/reference-config/index.js.map +2 -2
  137. package/dist/schemas/reference-config/settings.d.ts +12 -1
  138. package/dist/schemas/reference-config/settings.d.ts.map +1 -1
  139. package/dist/schemas/reference-config/settings.js +9 -2
  140. package/dist/schemas/reference-config/settings.js.map +2 -2
  141. package/dist/schemas/typebox-coerce.d.ts.map +1 -1
  142. package/dist/schemas/typebox-coerce.js +1 -3
  143. package/dist/schemas/typebox-coerce.js.map +2 -2
  144. package/dist/schemas/v3.1/loose/callback.d.ts +10 -0
  145. package/dist/schemas/v3.1/loose/callback.d.ts.map +1 -0
  146. package/dist/schemas/v3.1/loose/callback.js +11 -0
  147. package/dist/schemas/v3.1/loose/callback.js.map +7 -0
  148. package/dist/schemas/v3.1/loose/client-config-extensions/x-scalar-client-config-cookies.d.ts +16 -0
  149. package/dist/schemas/v3.1/loose/client-config-extensions/x-scalar-client-config-cookies.d.ts.map +1 -0
  150. package/dist/schemas/v3.1/loose/client-config-extensions/x-scalar-client-config-cookies.js +13 -0
  151. package/dist/schemas/v3.1/loose/client-config-extensions/x-scalar-client-config-cookies.js.map +7 -0
  152. package/dist/schemas/v3.1/loose/client-config-extensions/x-scalar-client-config-environments.d.ts +27 -0
  153. package/dist/schemas/v3.1/loose/client-config-extensions/x-scalar-client-config-environments.d.ts.map +1 -0
  154. package/dist/schemas/v3.1/loose/client-config-extensions/x-scalar-client-config-environments.js +23 -0
  155. package/dist/schemas/v3.1/loose/client-config-extensions/x-scalar-client-config-environments.js.map +7 -0
  156. package/dist/schemas/v3.1/loose/client-config-extensions/x-scalar-client-config-request-example.d.ts +38 -0
  157. package/dist/schemas/v3.1/loose/client-config-extensions/x-scalar-client-config-request-example.d.ts.map +1 -0
  158. package/dist/schemas/v3.1/loose/client-config-extensions/x-scalar-client-config-request-example.js +45 -0
  159. package/dist/schemas/v3.1/loose/client-config-extensions/x-scalar-client-config-request-example.js.map +7 -0
  160. package/dist/schemas/v3.1/loose/components.d.ts +43 -0
  161. package/dist/schemas/v3.1/loose/components.d.ts.map +1 -0
  162. package/dist/schemas/v3.1/loose/components.js +41 -0
  163. package/dist/schemas/v3.1/loose/components.js.map +7 -0
  164. package/dist/schemas/v3.1/loose/contact.d.ts +10 -0
  165. package/dist/schemas/v3.1/loose/contact.d.ts.map +1 -0
  166. package/dist/schemas/v3.1/loose/contact.js +13 -0
  167. package/dist/schemas/v3.1/loose/contact.js.map +7 -0
  168. package/dist/schemas/v3.1/loose/discriminator.d.ts +12 -0
  169. package/dist/schemas/v3.1/loose/discriminator.d.ts.map +1 -0
  170. package/dist/schemas/v3.1/loose/discriminator.js +11 -0
  171. package/dist/schemas/v3.1/loose/discriminator.js.map +7 -0
  172. package/dist/schemas/v3.1/loose/encoding.d.ts +15 -0
  173. package/dist/schemas/v3.1/loose/encoding.d.ts.map +1 -0
  174. package/dist/schemas/v3.1/loose/encoding.js +12 -0
  175. package/dist/schemas/v3.1/loose/encoding.js.map +7 -0
  176. package/dist/schemas/v3.1/loose/example.d.ts +16 -0
  177. package/dist/schemas/v3.1/loose/example.d.ts.map +1 -0
  178. package/dist/schemas/v3.1/loose/example.js +15 -0
  179. package/dist/schemas/v3.1/loose/example.js.map +7 -0
  180. package/dist/schemas/v3.1/loose/external-documentation.d.ts +8 -0
  181. package/dist/schemas/v3.1/loose/external-documentation.d.ts.map +1 -0
  182. package/dist/schemas/v3.1/loose/external-documentation.js +11 -0
  183. package/dist/schemas/v3.1/loose/external-documentation.js.map +7 -0
  184. package/dist/schemas/v3.1/loose/header.d.ts +355 -0
  185. package/dist/schemas/v3.1/loose/header.d.ts.map +1 -0
  186. package/dist/schemas/v3.1/loose/header.js +43 -0
  187. package/dist/schemas/v3.1/loose/header.js.map +7 -0
  188. package/dist/schemas/v3.1/loose/info.d.ts +48 -0
  189. package/dist/schemas/v3.1/loose/info.d.ts.map +1 -0
  190. package/dist/schemas/v3.1/loose/info.js +29 -0
  191. package/dist/schemas/v3.1/loose/info.js.map +7 -0
  192. package/dist/schemas/v3.1/loose/license.d.ts +10 -0
  193. package/dist/schemas/v3.1/loose/license.d.ts.map +1 -0
  194. package/dist/schemas/v3.1/loose/license.js +13 -0
  195. package/dist/schemas/v3.1/loose/license.js.map +7 -0
  196. package/dist/schemas/v3.1/loose/link.d.ts +30 -0
  197. package/dist/schemas/v3.1/loose/link.d.ts.map +1 -0
  198. package/dist/schemas/v3.1/loose/link.js +20 -0
  199. package/dist/schemas/v3.1/loose/link.js.map +7 -0
  200. package/dist/schemas/v3.1/loose/media-header-encoding.d.ts +1012 -0
  201. package/dist/schemas/v3.1/loose/media-header-encoding.d.ts.map +1 -0
  202. package/dist/schemas/v3.1/loose/media-header-encoding.js +19 -0
  203. package/dist/schemas/v3.1/loose/media-header-encoding.js.map +7 -0
  204. package/dist/schemas/v3.1/loose/media-type.d.ts +161 -0
  205. package/dist/schemas/v3.1/loose/media-type.d.ts.map +1 -0
  206. package/dist/schemas/v3.1/loose/media-type.js +18 -0
  207. package/dist/schemas/v3.1/loose/media-type.js.map +7 -0
  208. package/dist/schemas/v3.1/loose/oauth-flow.d.ts +95 -0
  209. package/dist/schemas/v3.1/loose/oauth-flow.d.ts.map +1 -0
  210. package/dist/schemas/v3.1/loose/oauth-flow.js +57 -0
  211. package/dist/schemas/v3.1/loose/oauth-flow.js.map +7 -0
  212. package/dist/schemas/v3.1/loose/oauthflows.d.ts +43 -0
  213. package/dist/schemas/v3.1/loose/oauthflows.d.ts.map +1 -0
  214. package/dist/schemas/v3.1/loose/oauthflows.js +21 -0
  215. package/dist/schemas/v3.1/loose/oauthflows.js.map +7 -0
  216. package/dist/schemas/v3.1/loose/openapi-document.d.ts +115 -0
  217. package/dist/schemas/v3.1/loose/openapi-document.d.ts.map +1 -0
  218. package/dist/schemas/v3.1/loose/openapi-document.js +64 -0
  219. package/dist/schemas/v3.1/loose/openapi-document.js.map +7 -0
  220. package/dist/schemas/v3.1/loose/operation.d.ts +1645 -0
  221. package/dist/schemas/v3.1/loose/operation.d.ts.map +1 -0
  222. package/dist/schemas/v3.1/loose/operation.js +61 -0
  223. package/dist/schemas/v3.1/loose/operation.js.map +7 -0
  224. package/dist/schemas/v3.1/loose/parameter.d.ts +1074 -0
  225. package/dist/schemas/v3.1/loose/parameter.d.ts.map +1 -0
  226. package/dist/schemas/v3.1/loose/parameter.js +54 -0
  227. package/dist/schemas/v3.1/loose/parameter.js.map +7 -0
  228. package/dist/schemas/v3.1/loose/path-item.d.ts +551 -0
  229. package/dist/schemas/v3.1/loose/path-item.d.ts.map +1 -0
  230. package/dist/schemas/v3.1/loose/path-item.js +42 -0
  231. package/dist/schemas/v3.1/loose/path-item.js.map +7 -0
  232. package/dist/schemas/v3.1/loose/path-operations.d.ts +2196 -0
  233. package/dist/schemas/v3.1/loose/path-operations.d.ts.map +1 -0
  234. package/dist/schemas/v3.1/loose/path-operations.js +21 -0
  235. package/dist/schemas/v3.1/loose/path-operations.js.map +7 -0
  236. package/dist/schemas/v3.1/loose/paths.d.ts +20 -0
  237. package/dist/schemas/v3.1/loose/paths.d.ts.map +1 -0
  238. package/dist/schemas/v3.1/loose/paths.js +11 -0
  239. package/dist/schemas/v3.1/loose/paths.js.map +7 -0
  240. package/dist/schemas/v3.1/loose/reference.d.ts +26 -0
  241. package/dist/schemas/v3.1/loose/reference.d.ts.map +1 -0
  242. package/dist/schemas/v3.1/loose/reference.js +24 -0
  243. package/dist/schemas/v3.1/loose/reference.js.map +7 -0
  244. package/dist/schemas/v3.1/loose/request-body.d.ts +339 -0
  245. package/dist/schemas/v3.1/loose/request-body.d.ts.map +1 -0
  246. package/dist/schemas/v3.1/loose/request-body.js +14 -0
  247. package/dist/schemas/v3.1/loose/request-body.js.map +7 -0
  248. package/dist/schemas/v3.1/loose/response.d.ts +698 -0
  249. package/dist/schemas/v3.1/loose/response.d.ts.map +1 -0
  250. package/dist/schemas/v3.1/loose/response.js +18 -0
  251. package/dist/schemas/v3.1/loose/response.js.map +7 -0
  252. package/dist/schemas/v3.1/loose/responses.d.ts +710 -0
  253. package/dist/schemas/v3.1/loose/responses.d.ts.map +1 -0
  254. package/dist/schemas/v3.1/loose/responses.js +11 -0
  255. package/dist/schemas/v3.1/loose/responses.js.map +7 -0
  256. package/dist/schemas/v3.1/loose/schema.d.ts +373 -0
  257. package/dist/schemas/v3.1/loose/schema.d.ts.map +1 -0
  258. package/dist/schemas/v3.1/loose/schema.js +146 -0
  259. package/dist/schemas/v3.1/loose/schema.js.map +7 -0
  260. package/dist/schemas/v3.1/loose/security-requirement.d.ts +11 -0
  261. package/dist/schemas/v3.1/loose/security-requirement.d.ts.map +1 -0
  262. package/dist/schemas/v3.1/loose/security-requirement.js +10 -0
  263. package/dist/schemas/v3.1/loose/security-requirement.js.map +7 -0
  264. package/dist/schemas/v3.1/loose/security-scheme.d.ts +169 -0
  265. package/dist/schemas/v3.1/loose/security-scheme.d.ts.map +1 -0
  266. package/dist/schemas/v3.1/loose/security-scheme.js +64 -0
  267. package/dist/schemas/v3.1/loose/security-scheme.js.map +7 -0
  268. package/dist/schemas/v3.1/loose/server-variable.d.ts +10 -0
  269. package/dist/schemas/v3.1/loose/server-variable.d.ts.map +1 -0
  270. package/dist/schemas/v3.1/loose/server-variable.js +13 -0
  271. package/dist/schemas/v3.1/loose/server-variable.js.map +7 -0
  272. package/dist/schemas/v3.1/loose/server.d.ts +14 -0
  273. package/dist/schemas/v3.1/loose/server.d.ts.map +1 -0
  274. package/dist/schemas/v3.1/loose/server.js +14 -0
  275. package/dist/schemas/v3.1/loose/server.js.map +7 -0
  276. package/dist/schemas/v3.1/loose/tag.d.ts +19 -0
  277. package/dist/schemas/v3.1/loose/tag.d.ts.map +1 -0
  278. package/dist/schemas/v3.1/loose/tag.js +23 -0
  279. package/dist/schemas/v3.1/loose/tag.js.map +7 -0
  280. package/dist/schemas/v3.1/loose/xml.d.ts +18 -0
  281. package/dist/schemas/v3.1/loose/xml.d.ts.map +1 -0
  282. package/dist/schemas/v3.1/loose/xml.js +17 -0
  283. package/dist/schemas/v3.1/loose/xml.js.map +7 -0
  284. package/dist/schemas/v3.1/strict/callback.d.ts +1 -8
  285. package/dist/schemas/v3.1/strict/callback.d.ts.map +1 -1
  286. package/dist/schemas/v3.1/strict/callback.js +5 -10
  287. package/dist/schemas/v3.1/strict/callback.js.map +2 -2
  288. package/dist/schemas/v3.1/strict/components.d.ts +24 -28
  289. package/dist/schemas/v3.1/strict/components.d.ts.map +1 -1
  290. package/dist/schemas/v3.1/strict/components.js +35 -32
  291. package/dist/schemas/v3.1/strict/components.js.map +2 -2
  292. package/dist/schemas/v3.1/strict/contact.d.ts +2 -2
  293. package/dist/schemas/v3.1/strict/contact.d.ts.map +1 -1
  294. package/dist/schemas/v3.1/strict/contact.js +8 -13
  295. package/dist/schemas/v3.1/strict/contact.js.map +2 -2
  296. package/dist/schemas/v3.1/strict/discriminator.d.ts +2 -2
  297. package/dist/schemas/v3.1/strict/discriminator.d.ts.map +1 -1
  298. package/dist/schemas/v3.1/strict/discriminator.js +6 -11
  299. package/dist/schemas/v3.1/strict/discriminator.js.map +2 -2
  300. package/dist/schemas/v3.1/strict/encoding.d.ts +3 -10
  301. package/dist/schemas/v3.1/strict/encoding.d.ts.map +1 -1
  302. package/dist/schemas/v3.1/strict/encoding.js +7 -12
  303. package/dist/schemas/v3.1/strict/encoding.js.map +2 -2
  304. package/dist/schemas/v3.1/strict/example.d.ts +2 -2
  305. package/dist/schemas/v3.1/strict/example.d.ts.map +1 -1
  306. package/dist/schemas/v3.1/strict/example.js +10 -15
  307. package/dist/schemas/v3.1/strict/example.js.map +2 -2
  308. package/dist/schemas/v3.1/strict/external-documentation.d.ts +2 -2
  309. package/dist/schemas/v3.1/strict/external-documentation.d.ts.map +1 -1
  310. package/dist/schemas/v3.1/strict/external-documentation.js +6 -11
  311. package/dist/schemas/v3.1/strict/external-documentation.js.map +2 -2
  312. package/dist/schemas/v3.1/strict/header.d.ts +292 -54
  313. package/dist/schemas/v3.1/strict/header.d.ts.map +1 -1
  314. package/dist/schemas/v3.1/strict/header.js +14 -17
  315. package/dist/schemas/v3.1/strict/header.js.map +2 -2
  316. package/dist/schemas/v3.1/strict/info.d.ts +11 -5
  317. package/dist/schemas/v3.1/strict/info.d.ts.map +1 -1
  318. package/dist/schemas/v3.1/strict/info.js +2 -2
  319. package/dist/schemas/v3.1/strict/info.js.map +2 -2
  320. package/dist/schemas/v3.1/strict/license.d.ts +2 -2
  321. package/dist/schemas/v3.1/strict/license.d.ts.map +1 -1
  322. package/dist/schemas/v3.1/strict/license.js +8 -13
  323. package/dist/schemas/v3.1/strict/license.js.map +2 -2
  324. package/dist/schemas/v3.1/strict/link.d.ts +6 -6
  325. package/dist/schemas/v3.1/strict/link.d.ts.map +1 -1
  326. package/dist/schemas/v3.1/strict/link.js +14 -19
  327. package/dist/schemas/v3.1/strict/link.js.map +2 -2
  328. package/dist/schemas/v3.1/strict/media-header-encoding.d.ts +1389 -164
  329. package/dist/schemas/v3.1/strict/media-header-encoding.d.ts.map +1 -1
  330. package/dist/schemas/v3.1/strict/media-type.d.ts +145 -19
  331. package/dist/schemas/v3.1/strict/media-type.d.ts.map +1 -1
  332. package/dist/schemas/v3.1/strict/media-type.js +13 -20
  333. package/dist/schemas/v3.1/strict/media-type.js.map +2 -2
  334. package/dist/schemas/v3.1/strict/oauth-flow.d.ts +24 -8
  335. package/dist/schemas/v3.1/strict/oauth-flow.d.ts.map +1 -1
  336. package/dist/schemas/v3.1/strict/oauth-flow.js +9 -9
  337. package/dist/schemas/v3.1/strict/oauth-flow.js.map +2 -2
  338. package/dist/schemas/v3.1/strict/oauthflows.d.ts +12 -4
  339. package/dist/schemas/v3.1/strict/oauthflows.d.ts.map +1 -1
  340. package/dist/schemas/v3.1/strict/oauthflows.js +10 -13
  341. package/dist/schemas/v3.1/strict/oauthflows.js.map +2 -2
  342. package/dist/schemas/v3.1/strict/openapi-document.d.ts +7 -5
  343. package/dist/schemas/v3.1/strict/openapi-document.d.ts.map +1 -1
  344. package/dist/schemas/v3.1/strict/openapi-document.js +0 -2
  345. package/dist/schemas/v3.1/strict/openapi-document.js.map +2 -2
  346. package/dist/schemas/v3.1/strict/operation.d.ts +4711 -343
  347. package/dist/schemas/v3.1/strict/operation.d.ts.map +1 -1
  348. package/dist/schemas/v3.1/strict/operation.js +40 -35
  349. package/dist/schemas/v3.1/strict/operation.js.map +2 -2
  350. package/dist/schemas/v3.1/strict/parameter.d.ts +1226 -164
  351. package/dist/schemas/v3.1/strict/parameter.d.ts.map +1 -1
  352. package/dist/schemas/v3.1/strict/parameter.js +23 -25
  353. package/dist/schemas/v3.1/strict/parameter.js.map +2 -2
  354. package/dist/schemas/v3.1/strict/path-item.d.ts +1320 -102
  355. package/dist/schemas/v3.1/strict/path-item.d.ts.map +1 -1
  356. package/dist/schemas/v3.1/strict/path-item.js +35 -40
  357. package/dist/schemas/v3.1/strict/path-item.js.map +2 -2
  358. package/dist/schemas/v3.1/strict/path-operations.d.ts +10601 -11739
  359. package/dist/schemas/v3.1/strict/path-operations.d.ts.map +1 -1
  360. package/dist/schemas/v3.1/strict/path-operations.js +3 -1
  361. package/dist/schemas/v3.1/strict/path-operations.js.map +2 -2
  362. package/dist/schemas/v3.1/strict/paths.d.ts +3 -5514
  363. package/dist/schemas/v3.1/strict/paths.d.ts.map +1 -1
  364. package/dist/schemas/v3.1/strict/paths.js +4 -9
  365. package/dist/schemas/v3.1/strict/paths.js.map +2 -2
  366. package/dist/schemas/v3.1/strict/reference.d.ts +12 -5
  367. package/dist/schemas/v3.1/strict/reference.d.ts.map +1 -1
  368. package/dist/schemas/v3.1/strict/reference.js +4 -4
  369. package/dist/schemas/v3.1/strict/reference.js.map +2 -2
  370. package/dist/schemas/v3.1/strict/request-body.d.ts +468 -56
  371. package/dist/schemas/v3.1/strict/request-body.d.ts.map +1 -1
  372. package/dist/schemas/v3.1/strict/request-body.js +8 -13
  373. package/dist/schemas/v3.1/strict/request-body.js.map +2 -2
  374. package/dist/schemas/v3.1/strict/response.d.ts +1121 -130
  375. package/dist/schemas/v3.1/strict/response.d.ts.map +1 -1
  376. package/dist/schemas/v3.1/strict/response.js +11 -16
  377. package/dist/schemas/v3.1/strict/response.js.map +2 -2
  378. package/dist/schemas/v3.1/strict/responses.d.ts +2352 -139
  379. package/dist/schemas/v3.1/strict/responses.d.ts.map +1 -1
  380. package/dist/schemas/v3.1/strict/responses.js +4 -6
  381. package/dist/schemas/v3.1/strict/responses.js.map +2 -2
  382. package/dist/schemas/v3.1/strict/schema.d.ts +232 -15
  383. package/dist/schemas/v3.1/strict/schema.d.ts.map +1 -1
  384. package/dist/schemas/v3.1/strict/schema.js +206 -31
  385. package/dist/schemas/v3.1/strict/schema.js.map +2 -2
  386. package/dist/schemas/v3.1/strict/security-requirement.d.ts +1 -1
  387. package/dist/schemas/v3.1/strict/security-requirement.d.ts.map +1 -1
  388. package/dist/schemas/v3.1/strict/security-requirement.js +4 -9
  389. package/dist/schemas/v3.1/strict/security-requirement.js.map +2 -2
  390. package/dist/schemas/v3.1/strict/security-scheme.d.ts +56 -26
  391. package/dist/schemas/v3.1/strict/security-scheme.d.ts.map +1 -1
  392. package/dist/schemas/v3.1/strict/security-scheme.js +11 -8
  393. package/dist/schemas/v3.1/strict/security-scheme.js.map +2 -2
  394. package/dist/schemas/v3.1/strict/server-variable.d.ts +2 -2
  395. package/dist/schemas/v3.1/strict/server-variable.d.ts.map +1 -1
  396. package/dist/schemas/v3.1/strict/server-variable.js +8 -13
  397. package/dist/schemas/v3.1/strict/server-variable.js.map +2 -2
  398. package/dist/schemas/v3.1/strict/server.d.ts +4 -4
  399. package/dist/schemas/v3.1/strict/server.d.ts.map +1 -1
  400. package/dist/schemas/v3.1/strict/server.js +8 -13
  401. package/dist/schemas/v3.1/strict/server.js.map +2 -2
  402. package/dist/schemas/v3.1/strict/tag.d.ts +7 -3
  403. package/dist/schemas/v3.1/strict/tag.d.ts.map +1 -1
  404. package/dist/schemas/v3.1/strict/tag.js +6 -8
  405. package/dist/schemas/v3.1/strict/tag.js.map +2 -2
  406. package/dist/schemas/v3.1/strict/xml.d.ts +2 -2
  407. package/dist/schemas/v3.1/strict/xml.d.ts.map +1 -1
  408. package/dist/schemas/v3.1/strict/xml.js +12 -17
  409. package/dist/schemas/v3.1/strict/xml.js.map +2 -2
  410. package/dist/schemas/workspace-specification/config.d.ts +10 -2
  411. package/dist/schemas/workspace-specification/config.d.ts.map +1 -1
  412. package/dist/schemas/workspace-specification/index.d.ts +39 -13
  413. package/dist/schemas/workspace-specification/index.d.ts.map +1 -1
  414. package/dist/schemas/workspace.d.ts +63 -34
  415. package/dist/schemas/workspace.d.ts.map +1 -1
  416. package/dist/schemas/workspace.js +1 -0
  417. package/dist/schemas/workspace.js.map +2 -2
  418. package/dist/server.d.ts +2 -3290
  419. package/dist/server.d.ts.map +1 -1
  420. package/dist/server.js.map +2 -2
  421. package/dist/types.d.ts +0 -6
  422. package/dist/types.d.ts.map +1 -1
  423. package/package.json +17 -11
  424. package/dist/schemas/v3.1/strict/extensions.d.ts +0 -4
  425. package/dist/schemas/v3.1/strict/extensions.d.ts.map +0 -1
  426. package/dist/schemas/v3.1/strict/extensions.js +0 -6
  427. package/dist/schemas/v3.1/strict/extensions.js.map +0 -7
  428. package/dist/schemas/v3.1/type-guard.d.ts +0 -10
  429. package/dist/schemas/v3.1/type-guard.d.ts.map +0 -1
  430. package/dist/schemas/v3.1/type-guard.js +0 -7
  431. package/dist/schemas/v3.1/type-guard.js.map +0 -7
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/client.ts"],
4
- "sourcesContent": ["import YAML from 'yaml'\nimport { reactive } from 'vue'\nimport { upgrade } from '@scalar/openapi-parser'\nimport { createMagicProxy, getRaw } from '@scalar/json-magic/magic-proxy'\n\nimport type { DeepPartial, DeepRequired } from '@/types'\nimport { applySelectiveUpdates } from '@/helpers/apply-selective-updates'\nimport { deepClone, isObject, safeAssign } from '@/helpers/general'\nimport { getValueByPath } from '@/helpers/json-path-utils'\nimport { mergeObjects } from '@/helpers/merge-object'\nimport { createNavigation, type createNavigationOptions } from '@/navigation'\nimport { extensions } from '@/schemas/extensions'\nimport { coerceValue } from '@/schemas/typebox-coerce'\nimport { OpenAPIDocumentSchema, type OpenApiDocument } from '@/schemas/v3.1/strict/openapi-document'\nimport { defaultReferenceConfig } from '@/schemas/reference-config'\nimport type { Config } from '@/schemas/workspace-specification/config'\nimport { InMemoryWorkspaceSchema, type InMemoryWorkspace } from '@/schemas/inmemory-workspace'\nimport type { WorkspaceSpecification } from '@/schemas/workspace-specification'\nimport { createOverridesProxy } from '@/helpers/overrides-proxy'\nimport type { Workspace, WorkspaceDocumentMeta, WorkspaceMeta } from '@/schemas/workspace'\nimport { bundle } from '@scalar/json-magic/bundle'\nimport { fetchUrls } from '@scalar/json-magic/bundle/plugins/browser'\nimport { apply, diff, merge, type Difference } from '@scalar/json-magic/diff'\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 *\n * TODO: merge navigation options with the document config\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 for generating navigation structure */\n config?: Config & Partial<createNavigationOptions>\n /** Overrides for the document */\n overrides?: DeepPartial<OpenApiDocument>\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 /** 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} & 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\nconst defaultConfig: DeepRequired<Config> = {\n 'x-scalar-reference-config': defaultReferenceConfig,\n}\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 * 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}\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 /** Returns the reactive workspace object with an additional activeDocument getter */\n readonly workspace: Workspace\n /** Updates a specific metadata field in the workspace */\n update<K extends keyof WorkspaceMeta>(key: K, value: WorkspaceMeta[K]): void\n /** Updates a specific metadata field in a document */\n updateDocument<K extends keyof WorkspaceDocumentMeta>(\n name: 'active' | (string & {}),\n key: K,\n value: WorkspaceDocumentMeta[K],\n ): void\n /** Replaces the content of a specific document in the workspace with the provided input */\n replaceDocument(documentName: string, input: Record<string, unknown>): void\n /** Resolves a reference in the active document by following the provided path and resolving any external $ref references */\n resolve(path: string[]): Promise<unknown>\n /** Adds a new document to the workspace */\n addDocument(input: WorkspaceDocumentInput): Promise<void>\n /** Returns the merged configuration for the active document */\n readonly config: typeof defaultConfig\n /** Downloads the specified document in the requested format */\n exportDocument(documentName: string, format: 'json' | 'yaml'): string | undefined\n /** Persists the current state of the specified document back to the original documents map */\n saveDocument(documentName: string): unknown[] | undefined\n /** Reverts the specified document to its original state */\n revertDocumentChanges(documentName: string): void\n /** Commits the specified document */\n commitDocument(documentName: string): void\n /** Serializes the current workspace state to a JSON string for backup, persistence, or sharing. */\n exportWorkspace(): string\n /** Imports a workspace from a serialized JSON string. */\n loadWorkspace(input: string): void\n /** Imports a workspace from a specification object */\n importWorkspaceFromSpecification(specification: WorkspaceSpecification): Promise<void[]>\n /** Rebase document with a remote origin */\n rebaseDocument: (\n documentName: string,\n newDocumentOrigin: Record<string, unknown>,\n resolvedConflicts?: Difference[],\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 Workspace['documents']\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 Workspace['documents']\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: Record<string, DeepPartial<OpenApiDocument>> = {}\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 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 // Apply changes from the current document to the intermediate document in place\n const excludedDiffs = applySelectiveUpdates(intermediateDocument, updatedDocument)\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) {\n const { name, meta } = input\n\n const document = coerceValue(OpenAPIDocumentSchema, upgrade(input.document).specification)\n\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({ ...document, ...meta })\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({ ...document, ...meta })\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\n // Skip navigation generation if the document already has a server-side generated navigation structure\n if (document[extensions.document.navigation] === undefined) {\n document[extensions.document.navigation] = createNavigation(document, input.config ?? {}).entries\n }\n\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 if (document[extensions.document.navigation] === undefined) {\n await bundle(input.document, { treeShake: false, plugins: [fetchUrls()] })\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(createMagicProxy({ ...document, ...meta }), input.overrides)\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 loadDocument(input)\n\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({ ...input, document: resolve.data })\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 /**\n * Returns the reactive workspace object with an additional activeDocument getter\n */\n get workspace() {\n return workspace\n },\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]) {\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 /**\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 ) {\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 /**\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>) {\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 // Normalize the input document to ensure it matches the OpenAPI schema and is upgraded to the latest version.\n const newDocument = coerceValue(OpenAPIDocumentSchema, upgrade(input).specification)\n // Update the current document in place, applying only the necessary changes and omitting any preprocessing fields.\n applySelectiveUpdates(currentDocument, newDocument)\n },\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: 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()],\n urlMap: false,\n hooks: {\n onResolveStart: (node) => {\n node['$status'] = 'loading'\n },\n onResolveError: (node) => {\n node['$status'] = 'error'\n },\n },\n visitedNodes: visitedNodesCache,\n })\n },\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,\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 get config() {\n return mergeObjects<typeof defaultConfig>(\n mergeObjects(defaultConfig, workspaceProps?.config ?? {}),\n documentConfigs[getActiveDocumentName()] ?? {},\n )\n },\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') => {\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 * 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,\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) {\n const workspaceDocument = workspace.documents[documentName]\n\n if (!workspaceDocument) {\n return\n }\n\n const intermediateDocument = intermediateDocuments[documentName]\n // Get the raw state of the current document to avoid diffing resolved references.\n const updatedDocument = getRaw(workspaceDocument)\n\n if (!intermediateDocument || !updatedDocument) {\n return\n }\n\n // Overwrite the current document with the last saved state, discarding unsaved changes.\n applySelectiveUpdates(updatedDocument, intermediateDocument)\n },\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) {\n // TODO: Implement commit logic\n console.warn(`Commit operation for document '${documentName}' is not implemented yet.`)\n },\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() {\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 createOverridesProxy(getRaw(doc), overrides[name]),\n ]),\n ),\n },\n meta: workspaceProps?.meta ?? {},\n documentConfigs,\n originalDocuments,\n intermediateDocuments,\n overrides,\n } as InMemoryWorkspace)\n },\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) {\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(Object.entries(result.documents).map(([name, doc]) => [name, createMagicProxy(doc)])),\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 },\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) => {\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 /**\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[],\n ) => {\n const newOrigin = coerceValue(OpenAPIDocumentSchema, 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) as typeof originalDocument\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 = apply(deepClone(newIntermediateDocument), changesetB) as typeof newIntermediateDocument\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,OAAO,UAAU;AACjB,SAAS,gBAAgB;AACzB,SAAS,eAAe;AACxB,SAAS,kBAAkB,cAAc;AAGzC,SAAS,6BAA6B;AACtC,SAAS,WAAW,UAAU,kBAAkB;AAChD,SAAS,sBAAsB;AAC/B,SAAS,oBAAoB;AAC7B,SAAS,wBAAsD;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YAAM,YAAY,YAAY,uBAAuB,QAAQ,iBAAiB,EAAE,aAAa;AAE7F,YAAM,mBAAmB,kBAAkB,YAAY;AACvD,YAAM,uBAAuB,sBAAsB,YAAY;AAC/D,YAAM,iBAAiB,UAAU,UAAU,YAAY,IAAI,OAAO,UAAU,UAAU,YAAY,CAAC,IAAI;AAEvG,UAAI,CAAC,oBAAoB,CAAC,wBAAwB,CAAC,gBAAgB;AAEjE,eAAO,QAAQ,MAAM,8EAA8E;AAAA,MACrG;AAGA,YAAM,cAAc,KAAK,kBAAkB,SAAS;AACpD,YAAM,cAAc,KAAK,kBAAkB,oBAAoB;AAE/D,YAAM,WAAW,MAAM,aAAa,WAAW;AAE/C,UAAI,sBAAsB,QAAW;AAEnC,eAAO,SAAS;AAAA,MAClB;AAEA,YAAM,aAAa,SAAS,MAAM,OAAO,iBAAiB;AAG1D,YAAM,0BAA0B,MAAM,UAAU,gBAAgB,GAAG,UAAU;AAC7E,4BAAsB,YAAY,IAAI;AAGtC,wBAAkB,YAAY,IAAI;AAGlC,YAAM,cAAc,KAAK,sBAAsB,uBAAuB;AACtE,YAAM,cAAc,KAAK,sBAAsB,cAAc;AAE7D,YAAM,WAAW,MAAM,aAAa,WAAW;AAI/C,YAAM,aAAa,SAAS,MAAM,OAAO,SAAS,UAAU,QAAQ,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC;AAElF,YAAM,oBAAoB,MAAM,UAAU,uBAAuB,GAAG,UAAU;AAG9E,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 YAML from 'yaml'\nimport { reactive } from 'vue'\nimport { upgrade } from '@scalar/openapi-parser'\nimport { createMagicProxy, getRaw } from '@scalar/json-magic/magic-proxy'\n\nimport { applySelectiveUpdates } from '@/helpers/apply-selective-updates'\nimport { isObject, safeAssign, type UnknownObject } from '@/helpers/general'\nimport { getValueByPath } from '@/helpers/json-path-utils'\nimport { mergeObjects } from '@/helpers/merge-object'\nimport { createNavigation } from '@/navigation'\nimport { extensions } from '@/schemas/extensions'\nimport { coerceValue } from '@/schemas/typebox-coerce'\nimport { OpenAPIDocumentSchema as OpenAPIDocumentSchemaStrict } from '@/schemas/v3.1/strict/openapi-document'\nimport { OpenAPIDocumentSchema as OpenAPIDocumentSchemaLoose } from '@/schemas/v3.1/loose/openapi-document'\nimport { defaultReferenceConfig } from '@/schemas/reference-config'\nimport type { Config } from '@/schemas/workspace-specification/config'\nimport { InMemoryWorkspaceSchema, type InMemoryWorkspace } from '@/schemas/inmemory-workspace'\nimport type { WorkspaceSpecification } from '@/schemas/workspace-specification'\nimport { createOverridesProxy } from '@/helpers/overrides-proxy'\nimport type { Workspace, WorkspaceDocumentMeta, WorkspaceMeta } from '@/schemas/workspace'\nimport { bundle } from '@scalar/json-magic/bundle'\nimport { fetchUrls } from '@scalar/json-magic/bundle/plugins/browser'\nimport { apply, diff, merge, type Difference } from '@scalar/json-magic/diff'\nimport type { TraverseSpecOptions } from '@/navigation/types'\nimport type { PartialDeep, RequiredDeep } from 'type-fest'\nimport { externalValueResolver, loadingStatus, refsEverywhere, restoreOriginalRefs } from '@/plugins'\nimport type { Record } from '@sinclair/typebox'\nimport { Value } from '@sinclair/typebox/value'\nimport { deepClone } from '@/helpers/deep-clone'\nimport { measureAsync, measureSync } from '@scalar/helpers/testing/measure'\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\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 }) {\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 })\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 // 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(strictDocument)),\n )\n measureAsync('mergeObjects', async () => mergeObjects(strictDocument, coerced))\n }\n\n const isValid = Value.Check(OpenAPIDocumentSchemaStrict, strictDocument)\n\n if (!isValid) {\n throw 'Invalid document provided! Please check your input document. It has some invalid refs.'\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, {\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\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({ ...input, document: resolve.data, documentSource: getDocumentSource(input) })\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: (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 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, 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,OAAO,UAAU;AACjB,SAAS,gBAAgB;AACzB,SAAS,eAAe;AACxB,SAAS,kBAAkB,cAAc;AAEzC,SAAS,6BAA6B;AACtC,SAAS,UAAU,kBAAsC;AACzD,SAAS,sBAAsB;AAC/B,SAAS,oBAAoB;AAC7B,SAAS,wBAAwB;AACjC,SAAS,kBAAkB;AAC3B,SAAS,mBAAmB;AAC5B,SAAS,yBAAyB,mCAAmC;AACrE,SAAS,yBAAyB,kCAAkC;AACpE,SAAS,8BAA8B;AAEvC,SAAS,+BAAuD;AAEhE,SAAS,4BAA4B;AAErC,SAAS,cAAc;AACvB,SAAS,iBAAiB;AAC1B,SAAS,OAAO,MAAM,aAA8B;AAGpD,SAAS,uBAAuB,eAAe,gBAAgB,2BAA2B;AAE1F,SAAS,aAAa;AACtB,SAAS,iBAAiB;AAC1B,SAAS,cAAc,mBAAmB;AAgC1C,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,GAAG;AAAA,EACjF;AAEA,SAAO;AAAA,IACL,IAAI;AAAA,IACJ,MAAM,kBAAkB;AAAA,EAC1B;AACF;AASA,MAAM,oBAAoB,CAAC,UAAkC;AAC3D,MAAI,SAAS,OAAO;AAClB,WAAO,MAAM;AAAA,EACf;AACA,SAAO;AACT;AAyQO,MAAM,uBAAuB,CAAC,mBAAoD;AAQvF,QAAM,oBAAoB,CAAC;AAa3B,QAAM,wBAAwB,CAAC;AAO/B,QAAM,kBAA0C,CAAC;AAUjD,QAAM,YAA4C,CAAC;AA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M,OAAO,iBAAiB;AAG1D,YAAM,0BAA0B,MAAM,UAAU,gBAAgB,GAAG,UAAU;AAC7E,4BAAsB,YAAY,IAAI;AAGtC,wBAAkB,YAAY,IAAI;AAGlC,YAAM,cAAc,KAAK,sBAAsB,uBAAuB;AACtE,YAAM,cAAc,KAAK,sBAAsB,cAAc;AAE7D,YAAM,WAAW,MAAM,aAAa,WAAW;AAI/C,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;",
6
6
  "names": ["overrides"]
7
7
  }
@@ -13,5 +13,5 @@ import { type Difference } from '@scalar/json-magic/diff';
13
13
  * @param updatedDocument - The document containing the desired changes
14
14
  * @returns A tuple: [the updated original document, array of excluded diffs that were not applied]
15
15
  */
16
- export declare const applySelectiveUpdates: (originalDocument: UnknownObject, updatedDocument: UnknownObject) => (UnknownObject | Difference[])[];
16
+ export declare const applySelectiveUpdates: (originalDocument: UnknownObject, updatedDocument: UnknownObject) => (UnknownObject | Difference<unknown>[])[];
17
17
  //# sourceMappingURL=apply-selective-updates.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"apply-selective-updates.d.ts","sourceRoot":"","sources":["../../src/helpers/apply-selective-updates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAC7D,OAAO,EAAe,KAAK,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAMtE;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,qBAAqB,qBAAsB,aAAa,mBAAmB,aAAa,qCAQpG,CAAA"}
1
+ {"version":3,"file":"apply-selective-updates.d.ts","sourceRoot":"","sources":["../../src/helpers/apply-selective-updates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAC7D,OAAO,EAAe,KAAK,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAMtE;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,qBAAqB,qBAAsB,aAAa,mBAAmB,aAAa,8CAQpG,CAAA"}
@@ -1,6 +1,6 @@
1
1
  import { split } from "../helpers/general.js";
2
2
  import { apply, diff } from "@scalar/json-magic/diff";
3
- const excludeKeys = /* @__PURE__ */ new Set(["x-scalar-navigation", "x-ext", "x-ext-urls", "$ref", "$status"]);
3
+ const excludeKeys = /* @__PURE__ */ new Set(["x-scalar-navigation", "x-ext", "x-ext-urls", "$status"]);
4
4
  const applySelectiveUpdates = (originalDocument, updatedDocument) => {
5
5
  const diffs = diff(originalDocument, updatedDocument);
6
6
  const [writableDiffs, excludedDiffs] = split(diffs, (d) => !d.path.some((p) => excludeKeys.has(p)));
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/helpers/apply-selective-updates.ts"],
4
- "sourcesContent": ["import { split, type UnknownObject } from '@/helpers/general'\nimport { apply, diff, type Difference } from '@scalar/json-magic/diff'\n\n// Keys to exclude from the diff - these are metadata fields that should not be persisted\n// when applying updates to the original document\nconst excludeKeys = new Set(['x-scalar-navigation', 'x-ext', 'x-ext-urls', '$ref', '$status'])\n\n/**\n * Applies updates from an updated document to an original document, while excluding changes to certain metadata keys.\n *\n * This function computes the differences between the original and updated documents,\n * filters out any diffs that affect excluded keys (such as navigation, external references, or status fields),\n * and applies only the allowed changes to the original document in place.\n *\n * Note: The originalDocument is mutated directly.\n *\n * @param originalDocument - The document to be updated (mutated in place)\n * @param updatedDocument - The document containing the desired changes\n * @returns A tuple: [the updated original document, array of excluded diffs that were not applied]\n */\nexport const applySelectiveUpdates = (originalDocument: UnknownObject, updatedDocument: UnknownObject) => {\n const diffs: Difference[] = diff(originalDocument, updatedDocument)\n\n const [writableDiffs, excludedDiffs] = split(diffs, (d) => !d.path.some((p) => excludeKeys.has(p)))\n\n apply(originalDocument, writableDiffs)\n\n return [originalDocument, excludedDiffs]\n}\n"],
5
- "mappings": "AAAA,SAAS,aAAiC;AAC1C,SAAS,OAAO,YAA6B;AAI7C,MAAM,cAAc,oBAAI,IAAI,CAAC,uBAAuB,SAAS,cAAc,QAAQ,SAAS,CAAC;AAetF,MAAM,wBAAwB,CAAC,kBAAiC,oBAAmC;AACxG,QAAM,QAAsB,KAAK,kBAAkB,eAAe;AAElE,QAAM,CAAC,eAAe,aAAa,IAAI,MAAM,OAAO,CAAC,MAAM,CAAC,EAAE,KAAK,KAAK,CAAC,MAAM,YAAY,IAAI,CAAC,CAAC,CAAC;AAElG,QAAM,kBAAkB,aAAa;AAErC,SAAO,CAAC,kBAAkB,aAAa;AACzC;",
4
+ "sourcesContent": ["import { split, type UnknownObject } from '@/helpers/general'\nimport { apply, diff, type Difference } from '@scalar/json-magic/diff'\n\n// Keys to exclude from the diff - these are metadata fields that should not be persisted\n// when applying updates to the original document\nconst excludeKeys = new Set(['x-scalar-navigation', 'x-ext', 'x-ext-urls', '$status'])\n\n/**\n * Applies updates from an updated document to an original document, while excluding changes to certain metadata keys.\n *\n * This function computes the differences between the original and updated documents,\n * filters out any diffs that affect excluded keys (such as navigation, external references, or status fields),\n * and applies only the allowed changes to the original document in place.\n *\n * Note: The originalDocument is mutated directly.\n *\n * @param originalDocument - The document to be updated (mutated in place)\n * @param updatedDocument - The document containing the desired changes\n * @returns A tuple: [the updated original document, array of excluded diffs that were not applied]\n */\nexport const applySelectiveUpdates = (originalDocument: UnknownObject, updatedDocument: UnknownObject) => {\n const diffs: Difference<unknown>[] = diff(originalDocument, updatedDocument)\n\n const [writableDiffs, excludedDiffs] = split(diffs, (d) => !d.path.some((p) => excludeKeys.has(p)))\n\n apply(originalDocument, writableDiffs)\n\n return [originalDocument, excludedDiffs]\n}\n"],
5
+ "mappings": "AAAA,SAAS,aAAiC;AAC1C,SAAS,OAAO,YAA6B;AAI7C,MAAM,cAAc,oBAAI,IAAI,CAAC,uBAAuB,SAAS,cAAc,SAAS,CAAC;AAe9E,MAAM,wBAAwB,CAAC,kBAAiC,oBAAmC;AACxG,QAAM,QAA+B,KAAK,kBAAkB,eAAe;AAE3E,QAAM,CAAC,eAAe,aAAa,IAAI,MAAM,OAAO,CAAC,MAAM,CAAC,EAAE,KAAK,KAAK,CAAC,MAAM,YAAY,IAAI,CAAC,CAAC,CAAC;AAElG,QAAM,kBAAkB,aAAa;AAErC,SAAO,CAAC,kBAAkB,aAAa;AACzC;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Deeply clones an object or array, handling circular references.
3
+ *
4
+ * This function recursively copies all properties of the input value,
5
+ * creating a new object or array. If the input contains circular references,
6
+ * they are preserved in the clone using a WeakMap to track already-cloned objects.
7
+ *
8
+ * @param value - The value to deep clone (object, array, or primitive)
9
+ * @param hash - (internal) WeakMap for tracking circular references
10
+ * @returns A deep clone of the input value
11
+ *
12
+ * @example
13
+ * const obj: any = { a: 1 }
14
+ * obj.self = obj
15
+ * const clone = deepClone(obj)
16
+ * console.log(clone) // { a: 1, self: [Circular] }
17
+ * console.log(clone !== obj) // true
18
+ * console.log(clone.self === clone) // true
19
+ */
20
+ export declare const deepClone: <T>(value: T, hash?: WeakMap<object, any>) => T;
21
+ //# sourceMappingURL=deep-clone.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deep-clone.d.ts","sourceRoot":"","sources":["../../src/helpers/deep-clone.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,SAAS,GAAI,CAAC,SAAS,CAAC,kCAAyB,CAkB7D,CAAA"}
@@ -0,0 +1,18 @@
1
+ const deepClone = (value, hash = /* @__PURE__ */ new WeakMap()) => {
2
+ if (typeof value !== "object" || value === null) {
3
+ return value;
4
+ }
5
+ if (hash.has(value)) {
6
+ return hash.get(value);
7
+ }
8
+ const result = Array.isArray(value) ? [] : {};
9
+ hash.set(value, result);
10
+ Object.keys(value).forEach((key) => {
11
+ result[key] = deepClone(value[key], hash);
12
+ });
13
+ return result;
14
+ };
15
+ export {
16
+ deepClone
17
+ };
18
+ //# sourceMappingURL=deep-clone.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/helpers/deep-clone.ts"],
4
+ "sourcesContent": ["/**\n * Deeply clones an object or array, handling circular references.\n *\n * This function recursively copies all properties of the input value,\n * creating a new object or array. If the input contains circular references,\n * they are preserved in the clone using a WeakMap to track already-cloned objects.\n *\n * @param value - The value to deep clone (object, array, or primitive)\n * @param hash - (internal) WeakMap for tracking circular references\n * @returns A deep clone of the input value\n *\n * @example\n * const obj: any = { a: 1 }\n * obj.self = obj\n * const clone = deepClone(obj)\n * console.log(clone) // { a: 1, self: [Circular] }\n * console.log(clone !== obj) // true\n * console.log(clone.self === clone) // true\n */\nexport const deepClone = <T>(value: T, hash = new WeakMap()): T => {\n if (typeof value !== 'object' || value === null) {\n return value\n }\n\n if (hash.has(value)) {\n return hash.get(value)\n }\n\n const result = Array.isArray(value) ? [] : {}\n hash.set(value, result)\n\n Object.keys(value).forEach((key) => {\n // @ts-expect-error: Index signature for generic object\n result[key] = deepClone(value[key], hash)\n })\n\n return result as T\n}\n"],
5
+ "mappings": "AAmBO,MAAM,YAAY,CAAI,OAAU,OAAO,oBAAI,QAAQ,MAAS;AACjE,MAAI,OAAO,UAAU,YAAY,UAAU,MAAM;AAC/C,WAAO;AAAA,EACT;AAEA,MAAI,KAAK,IAAI,KAAK,GAAG;AACnB,WAAO,KAAK,IAAI,KAAK;AAAA,EACvB;AAEA,QAAM,SAAS,MAAM,QAAQ,KAAK,IAAI,CAAC,IAAI,CAAC;AAC5C,OAAK,IAAI,OAAO,MAAM;AAEtB,SAAO,KAAK,KAAK,EAAE,QAAQ,CAAC,QAAQ;AAElC,WAAO,GAAG,IAAI,UAAU,MAAM,GAAG,GAAG,IAAI;AAAA,EAC1C,CAAC;AAED,SAAO;AACT;",
6
+ "names": []
7
+ }
@@ -0,0 +1,19 @@
1
+ export type RefNode<Node> = Partial<Node> & {
2
+ $ref: string;
3
+ '$ref-value': Node;
4
+ };
5
+ export type NodeInput<Node> = Node | RefNode<Node>;
6
+ /**
7
+ * Resolves a node that may be a $ref object to its actual value.
8
+ * If the node contains a $ref, applies the provided transform (default: returns '$ref-value').
9
+ * Otherwise, returns the node as-is.
10
+ */
11
+ export declare const getResolvedRef: <Node>(node: NodeInput<Node>, transform?: (node: RefNode<Node>) => Node) => Node;
12
+ /**
13
+ * Type helper we can use if we have getResolvedRef higher in the stack
14
+ */
15
+ export type Dereference<T> = T extends {
16
+ $ref: string;
17
+ '$ref-value'?: infer V;
18
+ } ? (V extends object ? V : never) : T;
19
+ //# sourceMappingURL=get-resolved-ref.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-resolved-ref.d.ts","sourceRoot":"","sources":["../../src/helpers/get-resolved-ref.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,IAAI,CAAA;CAAE,CAAA;AAChF,MAAM,MAAM,SAAS,CAAC,IAAI,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;AAMlD;;;;GAIG;AACH,eAAO,MAAM,cAAc,GAAI,IAAI,QAC3B,SAAS,CAAC,IAAI,CAAC,cACV,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,IAAI,SAOzC,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI,CAAC,SAAS;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAC,CAAA;CAAE,GAAG,CAAC,CAAC,SAAS,MAAM,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,CAAA"}
@@ -0,0 +1,13 @@
1
+ const defaultTransform = (node) => {
2
+ return node["$ref-value"];
3
+ };
4
+ const getResolvedRef = (node, transform = defaultTransform) => {
5
+ if (typeof node === "object" && node !== null && "$ref" in node) {
6
+ return transform(node);
7
+ }
8
+ return node;
9
+ };
10
+ export {
11
+ getResolvedRef
12
+ };
13
+ //# sourceMappingURL=get-resolved-ref.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/helpers/get-resolved-ref.ts"],
4
+ "sourcesContent": ["export type RefNode<Node> = Partial<Node> & { $ref: string; '$ref-value': Node }\nexport type NodeInput<Node> = Node | RefNode<Node>\n\nconst defaultTransform = <Node>(node: RefNode<Node>) => {\n return node['$ref-value']\n}\n\n/**\n * Resolves a node that may be a $ref object to its actual value.\n * If the node contains a $ref, applies the provided transform (default: returns '$ref-value').\n * Otherwise, returns the node as-is.\n */\nexport const getResolvedRef = <Node>(\n node: NodeInput<Node>,\n transform: (node: RefNode<Node>) => Node = defaultTransform,\n) => {\n if (typeof node === 'object' && node !== null && '$ref' in node) {\n return transform(node)\n }\n\n return node\n}\n\n/**\n * Type helper we can use if we have getResolvedRef higher in the stack\n */\nexport type Dereference<T> = T extends { $ref: string; '$ref-value'?: infer V } ? (V extends object ? V : never) : T\n"],
5
+ "mappings": "AAGA,MAAM,mBAAmB,CAAO,SAAwB;AACtD,SAAO,KAAK,YAAY;AAC1B;AAOO,MAAM,iBAAiB,CAC5B,MACA,YAA2C,qBACxC;AACH,MAAI,OAAO,SAAS,YAAY,SAAS,QAAQ,UAAU,MAAM;AAC/D,WAAO,UAAU,IAAI;AAAA,EACvB;AAEA,SAAO;AACT;",
6
+ "names": []
7
+ }
@@ -1,11 +1,13 @@
1
1
  /**
2
2
  * Deep merges two objects, combining their properties recursively.
3
+ * Handles circular references by tracking visited objects to prevent infinite recursion.
3
4
  *
4
5
  * ⚠️ Note: This operation assumes there are no key collisions between the objects.
5
6
  * Use isKeyCollisions() to check for collisions before merging.
6
7
  *
7
8
  * @param a - Target object to merge into
8
9
  * @param b - Source object to merge from
10
+ * @param cache - Set of visited objects to prevent circular reference issues
9
11
  * @returns The merged object (mutates and returns a)
10
12
  *
11
13
  * @example
@@ -18,6 +20,12 @@
18
20
  * const a = { user: { name: 'John' } }
19
21
  * const b = { user: { age: 30 } }
20
22
  * mergeObjects(a, b) // { user: { name: 'John', age: 30 } }
23
+ *
24
+ * // Circular reference safe
25
+ * const obj = { name: 'John' }
26
+ * obj.self = obj
27
+ * const target = { age: 30 }
28
+ * mergeObjects(target, obj) // Safely merges without infinite recursion
21
29
  */
22
- export declare const mergeObjects: <R>(a: Record<string, unknown>, b: Record<string, unknown>) => R;
30
+ export declare const mergeObjects: <R>(a: Record<string, unknown>, b: Record<string, unknown>, cache?: Set<unknown>) => R;
23
31
  //# sourceMappingURL=merge-object.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"merge-object.d.ts","sourceRoot":"","sources":["../../src/helpers/merge-object.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,YAAY,GAAI,CAAC,KAAK,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAG,CAiBxF,CAAA"}
1
+ {"version":3,"file":"merge-object.d.ts","sourceRoot":"","sources":["../../src/helpers/merge-object.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,YAAY,GAAI,CAAC,KACzB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KACvB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,UACnB,GAAG,CAAC,OAAO,CAAC,KAClB,CA8BF,CAAA"}
@@ -1,4 +1,5 @@
1
- const mergeObjects = (a, b) => {
1
+ import { getRaw } from "@scalar/json-magic/magic-proxy";
2
+ const mergeObjects = (a, b, cache = /* @__PURE__ */ new Set()) => {
2
3
  for (const key in b) {
3
4
  if (!(key in a)) {
4
5
  a[key] = b[key];
@@ -6,7 +7,14 @@ const mergeObjects = (a, b) => {
6
7
  const aValue = a[key];
7
8
  const bValue = b[key];
8
9
  if (typeof aValue === "object" && aValue !== null && typeof bValue === "object" && bValue !== null) {
9
- a[key] = mergeObjects(aValue, bValue);
10
+ const rawA = getRaw(aValue);
11
+ const rawB = getRaw(bValue);
12
+ if (cache.has(rawA) || cache.has(rawB)) {
13
+ continue;
14
+ }
15
+ cache.add(rawA);
16
+ cache.add(rawB);
17
+ mergeObjects(aValue, bValue, cache);
10
18
  } else {
11
19
  a[key] = bValue;
12
20
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/helpers/merge-object.ts"],
4
- "sourcesContent": ["/**\n * Deep merges two objects, combining their properties recursively.\n *\n * \u26A0\uFE0F Note: This operation assumes there are no key collisions between the objects.\n * Use isKeyCollisions() to check for collisions before merging.\n *\n * @param a - Target object to merge into\n * @param b - Source object to merge from\n * @returns The merged object (mutates and returns a)\n *\n * @example\n * // Simple merge\n * const a = { name: 'John' }\n * const b = { age: 30 }\n * mergeObjects(a, b) // { name: 'John', age: 30 }\n *\n * // Nested merge\n * const a = { user: { name: 'John' } }\n * const b = { user: { age: 30 } }\n * mergeObjects(a, b) // { user: { name: 'John', age: 30 } }\n */\nexport const mergeObjects = <R>(a: Record<string, unknown>, b: Record<string, unknown>): R => {\n for (const key in b) {\n if (!(key in a)) {\n a[key] = b[key]\n } else {\n const aValue = a[key]\n const bValue = b[key]\n\n if (typeof aValue === 'object' && aValue !== null && typeof bValue === 'object' && bValue !== null) {\n a[key] = mergeObjects(aValue as Record<string, unknown>, bValue as Record<string, unknown>)\n } else {\n a[key] = bValue // Overwrite with b's value if not an object\n }\n }\n }\n\n return a as R\n}\n"],
5
- "mappings": "AAqBO,MAAM,eAAe,CAAI,GAA4B,MAAkC;AAC5F,aAAW,OAAO,GAAG;AACnB,QAAI,EAAE,OAAO,IAAI;AACf,QAAE,GAAG,IAAI,EAAE,GAAG;AAAA,IAChB,OAAO;AACL,YAAM,SAAS,EAAE,GAAG;AACpB,YAAM,SAAS,EAAE,GAAG;AAEpB,UAAI,OAAO,WAAW,YAAY,WAAW,QAAQ,OAAO,WAAW,YAAY,WAAW,MAAM;AAClG,UAAE,GAAG,IAAI,aAAa,QAAmC,MAAiC;AAAA,MAC5F,OAAO;AACL,UAAE,GAAG,IAAI;AAAA,MACX;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;",
4
+ "sourcesContent": ["import type { UnknownObject } from '@/helpers/general'\nimport { getRaw } from '@scalar/json-magic/magic-proxy'\n\n/**\n * Deep merges two objects, combining their properties recursively.\n * Handles circular references by tracking visited objects to prevent infinite recursion.\n *\n * \u26A0\uFE0F Note: This operation assumes there are no key collisions between the objects.\n * Use isKeyCollisions() to check for collisions before merging.\n *\n * @param a - Target object to merge into\n * @param b - Source object to merge from\n * @param cache - Set of visited objects to prevent circular reference issues\n * @returns The merged object (mutates and returns a)\n *\n * @example\n * // Simple merge\n * const a = { name: 'John' }\n * const b = { age: 30 }\n * mergeObjects(a, b) // { name: 'John', age: 30 }\n *\n * // Nested merge\n * const a = { user: { name: 'John' } }\n * const b = { user: { age: 30 } }\n * mergeObjects(a, b) // { user: { name: 'John', age: 30 } }\n *\n * // Circular reference safe\n * const obj = { name: 'John' }\n * obj.self = obj\n * const target = { age: 30 }\n * mergeObjects(target, obj) // Safely merges without infinite recursion\n */\nexport const mergeObjects = <R>(\n a: Record<string, unknown>,\n b: Record<string, unknown>,\n cache: Set<unknown> = new Set(),\n): R => {\n for (const key in b) {\n if (!(key in a)) {\n a[key] = b[key]\n } else {\n const aValue = a[key]\n const bValue = b[key]\n\n if (typeof aValue === 'object' && aValue !== null && typeof bValue === 'object' && bValue !== null) {\n const rawA = getRaw(aValue as UnknownObject)\n const rawB = getRaw(bValue as UnknownObject)\n\n // Check for circular references before recursive merge\n if (cache.has(rawA) || cache.has(rawB)) {\n // Skip merging this branch to prevent infinite recursion\n continue\n }\n\n // Add objects to cache before recursive call\n cache.add(rawA)\n cache.add(rawB)\n\n mergeObjects(aValue as Record<string, unknown>, bValue as Record<string, unknown>, cache)\n } else {\n a[key] = bValue // Overwrite with b's value if not an object\n }\n }\n }\n\n return a as R\n}\n"],
5
+ "mappings": "AACA,SAAS,cAAc;AA+BhB,MAAM,eAAe,CAC1B,GACA,GACA,QAAsB,oBAAI,IAAI,MACxB;AACN,aAAW,OAAO,GAAG;AACnB,QAAI,EAAE,OAAO,IAAI;AACf,QAAE,GAAG,IAAI,EAAE,GAAG;AAAA,IAChB,OAAO;AACL,YAAM,SAAS,EAAE,GAAG;AACpB,YAAM,SAAS,EAAE,GAAG;AAEpB,UAAI,OAAO,WAAW,YAAY,WAAW,QAAQ,OAAO,WAAW,YAAY,WAAW,MAAM;AAClG,cAAM,OAAO,OAAO,MAAuB;AAC3C,cAAM,OAAO,OAAO,MAAuB;AAG3C,YAAI,MAAM,IAAI,IAAI,KAAK,MAAM,IAAI,IAAI,GAAG;AAEtC;AAAA,QACF;AAGA,cAAM,IAAI,IAAI;AACd,cAAM,IAAI,IAAI;AAEd,qBAAa,QAAmC,QAAmC,KAAK;AAAA,MAC1F,OAAO;AACL,UAAE,GAAG,IAAI;AAAA,MACX;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;",
6
6
  "names": []
7
7
  }
@@ -1,5 +1,47 @@
1
1
  import { type UnknownObject } from '../helpers/general.js';
2
- export declare const createOverridesProxy: <T extends object>(targetObject: T, overrides?: unknown) => T;
2
+ /**
3
+ * Recursively makes all properties of a type optional.
4
+ *
5
+ * - If T is an object, recursively applies DeepPartial to each property, making them optional.
6
+ * - Otherwise, T is returned as-is.
7
+ *
8
+ * @template T - The type to make deeply partial (optional).
9
+ * @example
10
+ * type Example = { a: { b: number } }
11
+ * type PartialExample = DeepPartial<Example>
12
+ * // Result: { a?: { b?: number } }
13
+ */
14
+ export type DeepPartial<T> = T extends object ? {
15
+ [K in keyof T]?: DeepPartial<T[K]>;
16
+ } : T;
17
+ /**
18
+ * Creates a proxy object that overlays "overrides" on top of a target object.
19
+ *
20
+ * - When reading a property, if an override exists, it is returned; otherwise, the original value is returned.
21
+ * - When writing to a property, if an override exists, it is updated; otherwise, the original object is updated.
22
+ * - This works recursively for nested objects, so overrides can be deeply partial.
23
+ * - Special symbols are used to identify the proxy and to access the original target.
24
+ *
25
+ * @template T - The type of the target object.
26
+ * @param targetObject - The original object to proxy.
27
+ * @param overrides - An optional object containing override values (deeply partial).
28
+ * @returns A proxy object that reflects overrides on top of the target.
29
+ *
30
+ * @example
31
+ * const original = { a: 1, b: { c: 2 } }
32
+ * const overrides = { b: { c: 42 } }
33
+ * const proxy = createOverridesProxy(original, overrides)
34
+ *
35
+ * console.log(proxy.a) // 1 (from original)
36
+ * console.log(proxy.b.c) // 42 (from overrides)
37
+ *
38
+ * proxy.a = 100
39
+ * console.log(original.a) // 100
40
+ *
41
+ * proxy.b.c = 99
42
+ * console.log(overrides.b.c) // 99
43
+ */
44
+ export declare const createOverridesProxy: <T extends Record<string, unknown>>(targetObject: T, overrides?: DeepPartial<T>) => T;
3
45
  export declare const TARGET_SYMBOL: unique symbol;
4
46
  export declare function unpackOverridesProxy<T extends UnknownObject>(obj: T): T;
5
47
  //# sourceMappingURL=overrides-proxy.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"overrides-proxy.d.ts","sourceRoot":"","sources":["../../src/helpers/overrides-proxy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAIhE,eAAO,MAAM,oBAAoB,GAAI,CAAC,SAAS,MAAM,gBAAgB,CAAC,cAAc,OAAO,KAAG,CAkD7F,CAAA;AAED,eAAO,MAAM,aAAa,eAAiC,CAAA;AAC3D,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,aAAa,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAMvE"}
1
+ {"version":3,"file":"overrides-proxy.d.ts","sourceRoot":"","sources":["../../src/helpers/overrides-proxy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAIhE;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,GAAG;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,GAAG,CAAC,CAAA;AAE1F;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,oBAAoB,GAAI,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,gBACtD,CAAC,cACH,WAAW,CAAC,CAAC,CAAC,KACzB,CAkDF,CAAA;AAED,eAAO,MAAM,aAAa,eAAiC,CAAA;AAC3D,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,aAAa,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAMvE"}
@@ -14,9 +14,9 @@ const createOverridesProxy = (targetObject, overrides) => {
14
14
  }
15
15
  const value = Reflect.get(target, prop, receiver);
16
16
  if (!isObject(value)) {
17
- return Reflect.get(overrides ?? {}, prop, receiver) ?? value;
17
+ return Reflect.get(overrides ?? {}, prop) ?? value;
18
18
  }
19
- return createOverridesProxy(value, overrides?.[prop]);
19
+ return createOverridesProxy(value, Reflect.get(overrides ?? {}, prop));
20
20
  },
21
21
  set(target, prop, value, receiver) {
22
22
  if (prop === isOverridesProxy || prop === TARGET_SYMBOL) {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/helpers/overrides-proxy.ts"],
4
- "sourcesContent": ["import { isObject, type UnknownObject } from '@/helpers/general'\n\nconst isOverridesProxy = Symbol('isOverridesProxy')\n\nexport const createOverridesProxy = <T extends object>(targetObject: T, overrides?: unknown): T => {\n if (!targetObject || typeof targetObject !== 'object') {\n return targetObject\n }\n\n // Create a handler for the proxy\n const handler: ProxyHandler<T> = {\n get(target, prop, receiver) {\n if (prop === isOverridesProxy) {\n return true\n }\n\n if (prop === TARGET_SYMBOL) {\n // Return the original target object when accessing the TARGET_SYMBOL\n return target\n }\n\n const value = Reflect.get(target, prop, receiver)\n\n if (!isObject(value)) {\n return Reflect.get(overrides ?? {}, prop, receiver) ?? value\n }\n\n // If neither exists, return undefined\n // @ts-ignore\n return createOverridesProxy(value, overrides?.[prop])\n },\n\n set(target, prop, value, receiver) {\n if (prop === isOverridesProxy || prop === TARGET_SYMBOL) {\n // Don't allow setting these special properties\n return false\n }\n\n // Check if there's an override for this property\n const hasOverride = overrides && Reflect.has(overrides, prop)\n\n if (hasOverride && overrides && typeof overrides === 'object') {\n // Set the value on the overrides object, but ignore the receiver to avoid proxy issues\n ;(overrides as any)[prop] = value\n return true\n }\n\n // Set the value on the original target\n return Reflect.set(target, prop, value, receiver)\n },\n }\n\n // Create and return the proxy\n return new Proxy<T>(targetObject, handler)\n}\n\nexport const TARGET_SYMBOL = Symbol('overridesProxyTarget')\nexport function unpackOverridesProxy<T extends UnknownObject>(obj: T): T {\n if ((obj as T & { [isOverridesProxy]: boolean | undefined })[isOverridesProxy]) {\n return (obj as T & { [TARGET_SYMBOL]: T })[TARGET_SYMBOL]\n }\n\n return obj\n}\n"],
5
- "mappings": "AAAA,SAAS,gBAAoC;AAE7C,MAAM,mBAAmB,OAAO,kBAAkB;AAE3C,MAAM,uBAAuB,CAAmB,cAAiB,cAA2B;AACjG,MAAI,CAAC,gBAAgB,OAAO,iBAAiB,UAAU;AACrD,WAAO;AAAA,EACT;AAGA,QAAM,UAA2B;AAAA,IAC/B,IAAI,QAAQ,MAAM,UAAU;AAC1B,UAAI,SAAS,kBAAkB;AAC7B,eAAO;AAAA,MACT;AAEA,UAAI,SAAS,eAAe;AAE1B,eAAO;AAAA,MACT;AAEA,YAAM,QAAQ,QAAQ,IAAI,QAAQ,MAAM,QAAQ;AAEhD,UAAI,CAAC,SAAS,KAAK,GAAG;AACpB,eAAO,QAAQ,IAAI,aAAa,CAAC,GAAG,MAAM,QAAQ,KAAK;AAAA,MACzD;AAIA,aAAO,qBAAqB,OAAO,YAAY,IAAI,CAAC;AAAA,IACtD;AAAA,IAEA,IAAI,QAAQ,MAAM,OAAO,UAAU;AACjC,UAAI,SAAS,oBAAoB,SAAS,eAAe;AAEvD,eAAO;AAAA,MACT;AAGA,YAAM,cAAc,aAAa,QAAQ,IAAI,WAAW,IAAI;AAE5D,UAAI,eAAe,aAAa,OAAO,cAAc,UAAU;AAE7D;AAAC,QAAC,UAAkB,IAAI,IAAI;AAC5B,eAAO;AAAA,MACT;AAGA,aAAO,QAAQ,IAAI,QAAQ,MAAM,OAAO,QAAQ;AAAA,IAClD;AAAA,EACF;AAGA,SAAO,IAAI,MAAS,cAAc,OAAO;AAC3C;AAEO,MAAM,gBAAgB,OAAO,sBAAsB;AACnD,SAAS,qBAA8C,KAAW;AACvE,MAAK,IAAwD,gBAAgB,GAAG;AAC9E,WAAQ,IAAmC,aAAa;AAAA,EAC1D;AAEA,SAAO;AACT;",
4
+ "sourcesContent": ["import { isObject, type UnknownObject } from '@/helpers/general'\n\nconst isOverridesProxy = Symbol('isOverridesProxy')\n\n/**\n * Recursively makes all properties of a type optional.\n *\n * - If T is an object, recursively applies DeepPartial to each property, making them optional.\n * - Otherwise, T is returned as-is.\n *\n * @template T - The type to make deeply partial (optional).\n * @example\n * type Example = { a: { b: number } }\n * type PartialExample = DeepPartial<Example>\n * // Result: { a?: { b?: number } }\n */\nexport type DeepPartial<T> = T extends object ? { [K in keyof T]?: DeepPartial<T[K]> } : T\n\n/**\n * Creates a proxy object that overlays \"overrides\" on top of a target object.\n *\n * - When reading a property, if an override exists, it is returned; otherwise, the original value is returned.\n * - When writing to a property, if an override exists, it is updated; otherwise, the original object is updated.\n * - This works recursively for nested objects, so overrides can be deeply partial.\n * - Special symbols are used to identify the proxy and to access the original target.\n *\n * @template T - The type of the target object.\n * @param targetObject - The original object to proxy.\n * @param overrides - An optional object containing override values (deeply partial).\n * @returns A proxy object that reflects overrides on top of the target.\n *\n * @example\n * const original = { a: 1, b: { c: 2 } }\n * const overrides = { b: { c: 42 } }\n * const proxy = createOverridesProxy(original, overrides)\n *\n * console.log(proxy.a) // 1 (from original)\n * console.log(proxy.b.c) // 42 (from overrides)\n *\n * proxy.a = 100\n * console.log(original.a) // 100\n *\n * proxy.b.c = 99\n * console.log(overrides.b.c) // 99\n */\nexport const createOverridesProxy = <T extends Record<string, unknown>>(\n targetObject: T,\n overrides?: DeepPartial<T>,\n): T => {\n if (!targetObject || typeof targetObject !== 'object') {\n return targetObject\n }\n\n // Proxy handler to intercept get/set operations\n const handler: ProxyHandler<T> = {\n get(target, prop, receiver) {\n // Special symbol to identify this as an overrides proxy\n if (prop === isOverridesProxy) {\n return true\n }\n\n // Special symbol to access the original target object\n if (prop === TARGET_SYMBOL) {\n return target\n }\n\n const value = Reflect.get(target, prop, receiver)\n\n // If the value is not an object, return the override if it exists, else the original value\n if (!isObject(value)) {\n return Reflect.get(overrides ?? {}, prop) ?? value\n }\n\n // For nested objects, recursively create a proxy with the corresponding overrides\n return createOverridesProxy(value, Reflect.get(overrides ?? {}, prop))\n },\n\n set(target, prop, value, receiver) {\n // Prevent setting special symbols\n if (prop === isOverridesProxy || prop === TARGET_SYMBOL) {\n return false\n }\n\n // If an override exists for this property, update it\n const hasOverride = overrides && Reflect.has(overrides, prop)\n\n if (hasOverride && overrides && typeof overrides === 'object') {\n ;(overrides as any)[prop] = value\n return true\n }\n\n // Otherwise, update the original target\n return Reflect.set(target, prop, value, receiver)\n },\n }\n\n // Return the proxy object\n return new Proxy<T>(targetObject, handler)\n}\n\nexport const TARGET_SYMBOL = Symbol('overridesProxyTarget')\nexport function unpackOverridesProxy<T extends UnknownObject>(obj: T): T {\n if ((obj as T & { [isOverridesProxy]: boolean | undefined })[isOverridesProxy]) {\n return (obj as T & { [TARGET_SYMBOL]: T })[TARGET_SYMBOL]\n }\n\n return obj\n}\n"],
5
+ "mappings": "AAAA,SAAS,gBAAoC;AAE7C,MAAM,mBAAmB,OAAO,kBAAkB;AA2C3C,MAAM,uBAAuB,CAClC,cACA,cACM;AACN,MAAI,CAAC,gBAAgB,OAAO,iBAAiB,UAAU;AACrD,WAAO;AAAA,EACT;AAGA,QAAM,UAA2B;AAAA,IAC/B,IAAI,QAAQ,MAAM,UAAU;AAE1B,UAAI,SAAS,kBAAkB;AAC7B,eAAO;AAAA,MACT;AAGA,UAAI,SAAS,eAAe;AAC1B,eAAO;AAAA,MACT;AAEA,YAAM,QAAQ,QAAQ,IAAI,QAAQ,MAAM,QAAQ;AAGhD,UAAI,CAAC,SAAS,KAAK,GAAG;AACpB,eAAO,QAAQ,IAAI,aAAa,CAAC,GAAG,IAAI,KAAK;AAAA,MAC/C;AAGA,aAAO,qBAAqB,OAAO,QAAQ,IAAI,aAAa,CAAC,GAAG,IAAI,CAAC;AAAA,IACvE;AAAA,IAEA,IAAI,QAAQ,MAAM,OAAO,UAAU;AAEjC,UAAI,SAAS,oBAAoB,SAAS,eAAe;AACvD,eAAO;AAAA,MACT;AAGA,YAAM,cAAc,aAAa,QAAQ,IAAI,WAAW,IAAI;AAE5D,UAAI,eAAe,aAAa,OAAO,cAAc,UAAU;AAC7D;AAAC,QAAC,UAAkB,IAAI,IAAI;AAC5B,eAAO;AAAA,MACT;AAGA,aAAO,QAAQ,IAAI,QAAQ,MAAM,OAAO,QAAQ;AAAA,IAClD;AAAA,EACF;AAGA,SAAO,IAAI,MAAS,cAAc,OAAO;AAC3C;AAEO,MAAM,gBAAgB,OAAO,sBAAsB;AACnD,SAAS,qBAA8C,KAAW;AACvE,MAAK,IAAwD,gBAAgB,GAAG;AAC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