@scalar/api-client 2.5.35 → 2.6.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 (203) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/components/CodeInput/CodeInput.vue.d.ts +0 -3
  3. package/dist/components/CodeInput/CodeInput.vue.d.ts.map +1 -1
  4. package/dist/components/CodeInput/CodeInput.vue.js +2 -2
  5. package/dist/components/CodeInput/CodeInput.vue2.js +60 -62
  6. package/dist/components/CodeInput/codeVariableWidget.d.ts +1 -3
  7. package/dist/components/CodeInput/codeVariableWidget.d.ts.map +1 -1
  8. package/dist/components/CodeInput/codeVariableWidget.js +25 -32
  9. package/dist/components/DataTable/DataTableInput.vue.d.ts +0 -2
  10. package/dist/components/DataTable/DataTableInput.vue.d.ts.map +1 -1
  11. package/dist/components/DataTable/DataTableInput.vue.js +2 -2
  12. package/dist/components/DataTable/DataTableInput.vue2.js +17 -19
  13. package/dist/layouts/App/create-api-client-app.d.ts +10 -10
  14. package/dist/layouts/App/create-api-client-app.d.ts.map +1 -1
  15. package/dist/layouts/Modal/create-api-client-modal.d.ts +20 -20
  16. package/dist/layouts/Modal/create-api-client-modal.d.ts.map +1 -1
  17. package/dist/layouts/Web/create-api-client-web.d.ts +10 -10
  18. package/dist/layouts/Web/create-api-client-web.d.ts.map +1 -1
  19. package/dist/libs/create-client.d.ts +10 -10
  20. package/dist/libs/create-client.d.ts.map +1 -1
  21. package/dist/libs/send-request/create-request-operation.test.d.ts.map +1 -1
  22. package/dist/store/security-schemes.d.ts +10 -10
  23. package/dist/store/security-schemes.d.ts.map +1 -1
  24. package/dist/store/store.d.ts +10 -10
  25. package/dist/store/store.d.ts.map +1 -1
  26. package/dist/style.css +1 -1
  27. package/dist/v2/blocks/operation-code-sample/components/ExamplePicker.test.d.ts +2 -0
  28. package/dist/v2/blocks/operation-code-sample/components/ExamplePicker.test.d.ts.map +1 -0
  29. package/dist/v2/blocks/operation-code-sample/components/ExamplePicker.vue.d.ts +14 -0
  30. package/dist/v2/blocks/operation-code-sample/components/ExamplePicker.vue.d.ts.map +1 -0
  31. package/dist/v2/blocks/operation-code-sample/components/ExamplePicker.vue.js +55 -0
  32. package/dist/v2/blocks/operation-code-sample/components/ExamplePicker.vue2.js +4 -0
  33. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.test.d.ts +2 -0
  34. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.test.d.ts.map +1 -0
  35. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.d.ts +104 -0
  36. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.d.ts.map +1 -0
  37. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.js +7 -0
  38. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue2.js +237 -0
  39. package/dist/v2/blocks/operation-code-sample/helpers/find-client.d.ts +41 -0
  40. package/dist/v2/blocks/operation-code-sample/helpers/find-client.d.ts.map +1 -0
  41. package/dist/v2/blocks/operation-code-sample/helpers/find-client.js +20 -0
  42. package/dist/v2/blocks/operation-code-sample/helpers/find-client.test.d.ts +2 -0
  43. package/dist/v2/blocks/operation-code-sample/helpers/find-client.test.d.ts.map +1 -0
  44. package/dist/v2/blocks/operation-code-sample/helpers/generate-client-options.d.ts +20 -0
  45. package/dist/v2/blocks/operation-code-sample/helpers/generate-client-options.d.ts.map +1 -0
  46. package/dist/v2/blocks/operation-code-sample/helpers/generate-client-options.js +4 -0
  47. package/dist/v2/blocks/operation-code-sample/helpers/generate-client-options.test.d.ts +2 -0
  48. package/dist/v2/blocks/operation-code-sample/helpers/generate-client-options.test.d.ts.map +1 -0
  49. package/dist/v2/blocks/operation-code-sample/helpers/generate-code-snippet.d.ts +17 -0
  50. package/dist/v2/blocks/operation-code-sample/helpers/generate-code-snippet.d.ts.map +1 -0
  51. package/dist/v2/blocks/operation-code-sample/helpers/generate-code-snippet.js +30 -0
  52. package/dist/v2/blocks/operation-code-sample/helpers/generate-code-snippet.test.d.ts +2 -0
  53. package/dist/v2/blocks/operation-code-sample/helpers/generate-code-snippet.test.d.ts.map +1 -0
  54. package/dist/v2/blocks/operation-code-sample/helpers/get-example-from-schema.d.ts +29 -0
  55. package/dist/v2/blocks/operation-code-sample/helpers/get-example-from-schema.d.ts.map +1 -0
  56. package/dist/v2/blocks/operation-code-sample/helpers/get-example-from-schema.js +209 -0
  57. package/dist/v2/blocks/operation-code-sample/helpers/get-example-from-schema.test.d.ts +2 -0
  58. package/dist/v2/blocks/operation-code-sample/helpers/get-example-from-schema.test.d.ts.map +1 -0
  59. package/dist/v2/blocks/operation-code-sample/helpers/get-resolved-ref-deep.d.ts +26 -0
  60. package/dist/v2/blocks/operation-code-sample/helpers/get-resolved-ref-deep.d.ts.map +1 -0
  61. package/dist/v2/blocks/operation-code-sample/helpers/get-resolved-ref-deep.js +29 -0
  62. package/dist/v2/blocks/operation-code-sample/helpers/get-resolved-ref-deep.test.d.ts +2 -0
  63. package/dist/v2/blocks/operation-code-sample/helpers/get-resolved-ref-deep.test.d.ts.map +1 -0
  64. package/dist/v2/blocks/operation-code-sample/helpers/get-secrets.d.ts +4 -0
  65. package/dist/v2/blocks/operation-code-sample/helpers/get-secrets.d.ts.map +1 -0
  66. package/dist/v2/blocks/operation-code-sample/helpers/get-secrets.js +10 -0
  67. package/dist/v2/blocks/operation-code-sample/helpers/get-secrets.test.d.ts +2 -0
  68. package/dist/v2/blocks/operation-code-sample/helpers/get-secrets.test.d.ts.map +1 -0
  69. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/get-example-value.d.ts +7 -0
  70. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/get-example-value.d.ts.map +1 -0
  71. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/get-example-value.js +28 -0
  72. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/get-example-value.test.d.ts +2 -0
  73. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/get-example-value.test.d.ts.map +1 -0
  74. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.d.ts +52 -0
  75. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.d.ts.map +1 -0
  76. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.js +59 -0
  77. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.test.d.ts +2 -0
  78. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.test.d.ts.map +1 -0
  79. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-body.d.ts +12 -0
  80. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-body.d.ts.map +1 -0
  81. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-body.js +57 -0
  82. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-body.test.d.ts +2 -0
  83. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-body.test.d.ts.map +1 -0
  84. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-parameters.d.ts +25 -0
  85. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-parameters.d.ts.map +1 -0
  86. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-parameters.js +212 -0
  87. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-parameters.test.d.ts +2 -0
  88. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-parameters.test.d.ts.map +1 -0
  89. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-security-schemes.d.ts +15 -0
  90. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-security-schemes.d.ts.map +1 -0
  91. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-security-schemes.js +55 -0
  92. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-security-schemes.test.d.ts +2 -0
  93. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-security-schemes.test.d.ts.map +1 -0
  94. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-server-url.d.ts +6 -0
  95. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-server-url.d.ts.map +1 -0
  96. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-server-url.js +18 -0
  97. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-server-url.test.d.ts +2 -0
  98. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-server-url.test.d.ts.map +1 -0
  99. package/dist/v2/blocks/operation-code-sample/index.d.ts +3 -0
  100. package/dist/v2/blocks/operation-code-sample/index.d.ts.map +1 -0
  101. package/dist/v2/blocks/operation-code-sample/index.js +6 -0
  102. package/dist/v2/blocks/operation-code-sample/types.d.ts +29 -0
  103. package/dist/v2/blocks/operation-code-sample/types.d.ts.map +1 -0
  104. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.test.d.ts +2 -0
  105. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.test.d.ts.map +1 -0
  106. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.d.ts +65 -0
  107. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.d.ts.map +1 -0
  108. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.js +7 -0
  109. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue2.js +122 -0
  110. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.test.d.ts +2 -0
  111. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.test.d.ts.map +1 -0
  112. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.d.ts +25 -0
  113. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.d.ts.map +1 -0
  114. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.js +7 -0
  115. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue2.js +90 -0
  116. package/dist/v2/blocks/scalar-address-bar-block/components/httpStatusCodeColors.d.ts +55 -0
  117. package/dist/v2/blocks/scalar-address-bar-block/components/httpStatusCodeColors.d.ts.map +1 -0
  118. package/dist/v2/blocks/scalar-address-bar-block/components/httpStatusCodeColors.js +39 -0
  119. package/dist/v2/blocks/scalar-address-bar-block/index.d.ts +2 -0
  120. package/dist/v2/blocks/scalar-address-bar-block/index.d.ts.map +1 -0
  121. package/dist/v2/blocks/scalar-address-bar-block/index.js +4 -0
  122. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.test.d.ts +2 -0
  123. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.test.d.ts.map +1 -0
  124. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.d.ts +49 -0
  125. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.d.ts.map +1 -0
  126. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.js +7 -0
  127. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue2.js +172 -0
  128. package/dist/v2/blocks/scalar-auth-selector-block/components/DeleteRequestAuthModal.test.d.ts +2 -0
  129. package/dist/v2/blocks/scalar-auth-selector-block/components/DeleteRequestAuthModal.test.d.ts.map +1 -0
  130. package/dist/v2/blocks/scalar-auth-selector-block/components/DeleteRequestAuthModal.vue.d.ts +17 -0
  131. package/dist/v2/blocks/scalar-auth-selector-block/components/DeleteRequestAuthModal.vue.d.ts.map +1 -0
  132. package/dist/v2/blocks/scalar-auth-selector-block/components/DeleteRequestAuthModal.vue.js +52 -0
  133. package/dist/v2/blocks/scalar-auth-selector-block/components/DeleteRequestAuthModal.vue2.js +4 -0
  134. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.test.d.ts +2 -0
  135. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.test.d.ts.map +1 -0
  136. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts +45 -0
  137. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts.map +1 -0
  138. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.js +254 -0
  139. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue2.js +4 -0
  140. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.test.d.ts +2 -0
  141. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.test.d.ts.map +1 -0
  142. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue.d.ts +16 -0
  143. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue.d.ts.map +1 -0
  144. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue.js +134 -0
  145. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue2.js +4 -0
  146. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.test.d.ts +2 -0
  147. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.test.d.ts.map +1 -0
  148. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.d.ts +33 -0
  149. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.d.ts.map +1 -0
  150. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.js +7 -0
  151. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue2.js +82 -0
  152. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTableInput.vue.d.ts +48 -0
  153. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTableInput.vue.d.ts.map +1 -0
  154. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTableInput.vue.js +48 -0
  155. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTableInput.vue2.js +4 -0
  156. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.test.d.ts +2 -0
  157. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.test.d.ts.map +1 -0
  158. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.d.ts +29 -0
  159. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.d.ts.map +1 -0
  160. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.js +232 -0
  161. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue2.js +4 -0
  162. package/dist/v2/blocks/scalar-auth-selector-block/event-types.d.ts +29 -0
  163. package/dist/v2/blocks/scalar-auth-selector-block/event-types.d.ts.map +1 -0
  164. package/dist/v2/blocks/scalar-auth-selector-block/helpers/auth-options.d.ts +9 -0
  165. package/dist/v2/blocks/scalar-auth-selector-block/helpers/auth-options.d.ts.map +1 -0
  166. package/dist/v2/blocks/scalar-auth-selector-block/helpers/auth-options.js +121 -0
  167. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.d.ts +34 -0
  168. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.d.ts.map +1 -0
  169. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.js +111 -0
  170. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.test.d.ts +2 -0
  171. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.test.d.ts.map +1 -0
  172. package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.d.ts +39 -0
  173. package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.d.ts.map +1 -0
  174. package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.js +52 -0
  175. package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.test.d.ts +2 -0
  176. package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.test.d.ts.map +1 -0
  177. package/dist/v2/blocks/scalar-auth-selector-block/index.d.ts +2 -0
  178. package/dist/v2/blocks/scalar-auth-selector-block/index.d.ts.map +1 -0
  179. package/dist/v2/blocks/scalar-auth-selector-block/index.js +4 -0
  180. package/dist/v2/components/server/ServerDropdown.test.d.ts +2 -0
  181. package/dist/v2/components/server/ServerDropdown.test.d.ts.map +1 -0
  182. package/dist/v2/components/server/ServerDropdown.vue.d.ts +33 -0
  183. package/dist/v2/components/server/ServerDropdown.vue.d.ts.map +1 -0
  184. package/dist/v2/components/server/ServerDropdown.vue.js +87 -0
  185. package/dist/v2/components/server/ServerDropdown.vue2.js +4 -0
  186. package/dist/v2/components/server/ServerDropdownItem.test.d.ts +2 -0
  187. package/dist/v2/components/server/ServerDropdownItem.test.d.ts.map +1 -0
  188. package/dist/v2/components/server/ServerDropdownItem.vue.d.ts +21 -0
  189. package/dist/v2/components/server/ServerDropdownItem.vue.d.ts.map +1 -0
  190. package/dist/v2/components/server/ServerDropdownItem.vue.js +7 -0
  191. package/dist/v2/components/server/ServerDropdownItem.vue2.js +51 -0
  192. package/dist/v2/components/server/index.d.ts +2 -0
  193. package/dist/v2/components/server/index.d.ts.map +1 -0
  194. package/dist/v2/components/server/index.js +4 -0
  195. package/dist/views/Request/Request.vue.js +1 -1
  196. package/dist/views/Request/Request.vue2.js +4 -4
  197. package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue.d.ts +2 -2
  198. package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue.d.ts.map +1 -1
  199. package/dist/views/Request/RequestSection/RequestAuth/RequestAuthDataTable.vue.d.ts +2 -2
  200. package/dist/views/Request/RequestSection/RequestAuth/RequestAuthDataTable.vue.d.ts.map +1 -1
  201. package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
  202. package/dist/vitest.setup.d.ts.map +1 -1
  203. package/package.json +14 -10
@@ -0,0 +1,4 @@
1
+ import f from "./RequestAuthDataTableInput.vue.js";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=RequestAuthTab.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RequestAuthTab.test.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,29 @@
1
+ import type { Environment } from '@scalar/oas-utils/entities/environment';
2
+ import type { ComponentsObject, OpenApiDocument, ServerObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
3
+ import { type EnvVariable } from '../../../../store/index.js';
4
+ import type { UpdateSecuritySchemeEvent } from '../../../../v2/blocks/scalar-auth-selector-block/event-types';
5
+ type __VLS_Props = {
6
+ environment: Environment;
7
+ envVariables: EnvVariable[];
8
+ layout: 'client' | 'reference';
9
+ selectedSecuritySchema: NonNullable<OpenApiDocument['x-scalar-selected-security']>[number];
10
+ securitySchemes: NonNullable<ComponentsObject['securitySchemes']>;
11
+ server: ServerObject | undefined;
12
+ };
13
+ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
14
+ "update:selectedScopes": (payload: {
15
+ id: string[];
16
+ name: string;
17
+ scopes: string[];
18
+ }) => any;
19
+ "update:securityScheme": (payload: UpdateSecuritySchemeEvent) => any;
20
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
21
+ "onUpdate:selectedScopes"?: ((payload: {
22
+ id: string[];
23
+ name: string;
24
+ scopes: string[];
25
+ }) => any) | undefined;
26
+ "onUpdate:securityScheme"?: ((payload: UpdateSecuritySchemeEvent) => any) | undefined;
27
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
28
+ export default _default;
29
+ //# sourceMappingURL=RequestAuthTab.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RequestAuthTab.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue"],"names":[],"mappings":"AAwRA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAA;AAEzE,OAAO,KAAK,EACV,gBAAgB,EAChB,eAAe,EAEf,YAAY,EACb,MAAM,8DAA8D,CAAA;AAIrE,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,SAAS,CAAA;AAE1C,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,oDAAoD,CAAA;AAInG,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,WAAW,CAAA;IACxB,YAAY,EAAE,WAAW,EAAE,CAAA;IAC3B,MAAM,EAAE,QAAQ,GAAG,WAAW,CAAA;IAC9B,sBAAsB,EAAE,WAAW,CACjC,eAAe,CAAC,4BAA4B,CAAC,CAC9C,CAAC,MAAM,CAAC,CAAA;IACT,eAAe,EAAE,WAAW,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,CAAC,CAAA;IACjE,MAAM,EAAE,YAAY,GAAG,SAAS,CAAA;CACjC,CAAC;;;YAciB,MAAM,EAAE;cAAQ,MAAM;gBAAU,MAAM,EAAE;;;;;YAAxC,MAAM,EAAE;cAAQ,MAAM;gBAAU,MAAM,EAAE;;;;AAuhB3D,wBAOG"}
@@ -0,0 +1,232 @@
1
+ import { defineComponent as R, computed as N, ref as P, createElementBlock as u, openBlock as r, Fragment as i, renderList as U, createBlock as k, createCommentVNode as b, unref as s, withCtx as o, createVNode as a, createElementVNode as C, toDisplayString as F, mergeProps as v, createTextVNode as x, normalizeClass as j, capitalize as _ } from "vue";
2
+ import { ScalarMarkdownSummary as z } from "@scalar/components";
3
+ import { getResolvedRef as K } from "@scalar/workspace-store/helpers/get-resolved-ref";
4
+ import O from "./OAuth2.vue.js";
5
+ import w from "./RequestAuthDataTableInput.vue.js";
6
+ import f from "../../../../components/DataTable/DataTableRow.vue.js";
7
+ import B from "../../../../components/DataTable/DataTableCell.vue.js";
8
+ const L = { class: "bg-b-1 text-c-2 outline-b-3 top-0 z-1 h-full w-full overflow-hidden px-3 py-1.25 text-ellipsis group-hover/auth:absolute group-hover/auth:h-auto group-hover/auth:border-b *:first:line-clamp-1 *:first:text-ellipsis group-hover/auth:*:first:line-clamp-none" }, M = {
9
+ key: 0,
10
+ class: "flex min-h-8 border-t text-base"
11
+ }, Q = { class: "flex h-8 max-w-full gap-2.5 overflow-x-auto px-3" }, q = ["onClick"], D = { class: "relative z-10" }, Y = /* @__PURE__ */ R({
12
+ __name: "RequestAuthTab",
13
+ props: {
14
+ environment: {},
15
+ envVariables: {},
16
+ layout: {},
17
+ selectedSecuritySchema: {},
18
+ securitySchemes: {},
19
+ server: {}
20
+ },
21
+ emits: ["update:securityScheme", "update:selectedScopes"],
22
+ setup(S, { emit: I }) {
23
+ const c = I, $ = N(
24
+ () => Object.entries(S.selectedSecuritySchema).map(([l, e]) => ({
25
+ scheme: K(S.securitySchemes[l]),
26
+ name: l,
27
+ scopes: e
28
+ }))
29
+ ), p = P(""), T = (l, e) => {
30
+ const t = e.description ? `: ${e.description}` : "", m = `${_(l)}${t || `: ${e.type}`}`;
31
+ if (e.type === "apiKey")
32
+ return `${_(l)}${t || `: ${e.in}`}`;
33
+ if (e.type === "oauth2") {
34
+ const h = Object.keys(e.flows ?? {})[0];
35
+ return `${_(l)}: ${p.value ? p.value : h}${t}`;
36
+ }
37
+ return e.type === "http" ? `${_(l)}: ${e.scheme}${t}` : `${m}${t}`;
38
+ }, y = {
39
+ environment: S.environment,
40
+ envVariables: S.envVariables
41
+ };
42
+ return (l, e) => (r(!0), u(i, null, U($.value, ({ scheme: t, name: m, scopes: h }) => (r(), u(i, { key: m }, [
43
+ $.value.length > 1 && t ? (r(), k(s(f), { key: 0 }, {
44
+ default: o(() => [
45
+ a(s(B), {
46
+ "aria-label": T(m, t),
47
+ class: "text-c-2 group/auth flex items-center leading-[22px] whitespace-nowrap outline-none hover:whitespace-normal"
48
+ }, {
49
+ default: o(() => [
50
+ C("p", L, F(T(m, t)), 1)
51
+ ]),
52
+ _: 2
53
+ }, 1032, ["aria-label"])
54
+ ]),
55
+ _: 2
56
+ }, 1024)) : b("", !0),
57
+ t?.description && $.value.length <= 1 ? (r(), k(s(f), { key: 1 }, {
58
+ default: o(() => [
59
+ a(s(B), {
60
+ "aria-label": t.description,
61
+ class: "max-h-[auto]"
62
+ }, {
63
+ default: o(() => [
64
+ a(s(z), {
65
+ class: "auth-description bg-b-1 text-c-2 min-w-0 flex-1 px-3 py-1.25",
66
+ value: t.description
67
+ }, null, 8, ["value"])
68
+ ]),
69
+ _: 2
70
+ }, 1032, ["aria-label"])
71
+ ]),
72
+ _: 2
73
+ }, 1024)) : b("", !0),
74
+ t?.type === "http" ? (r(), u(i, { key: 2 }, [
75
+ t.scheme === "bearer" ? (r(), k(s(f), { key: 0 }, {
76
+ default: o(() => [
77
+ a(w, v({ ref_for: !0 }, y, {
78
+ containerClass: l.layout === "reference" && "border-t",
79
+ modelValue: t["x-scalar-secret-token"],
80
+ placeholder: "Token",
81
+ type: "password",
82
+ "onUpdate:modelValue": e[0] || (e[0] = (n) => c("update:securityScheme", {
83
+ type: "http",
84
+ payload: { token: n }
85
+ }))
86
+ }), {
87
+ default: o(() => e[5] || (e[5] = [
88
+ x(" Bearer Token ")
89
+ ])),
90
+ _: 2,
91
+ __: [5]
92
+ }, 1040, ["containerClass", "modelValue"])
93
+ ]),
94
+ _: 2
95
+ }, 1024)) : t?.scheme === "basic" ? (r(), u(i, { key: 1 }, [
96
+ a(s(f), null, {
97
+ default: o(() => [
98
+ a(w, v({ ref_for: !0 }, y, {
99
+ class: "text-c-2",
100
+ modelValue: t["x-scalar-secret-username"],
101
+ placeholder: "janedoe",
102
+ required: "",
103
+ "onUpdate:modelValue": e[1] || (e[1] = (n) => c("update:securityScheme", {
104
+ type: "http",
105
+ payload: { username: n }
106
+ }))
107
+ }), {
108
+ default: o(() => e[6] || (e[6] = [
109
+ x(" Username ")
110
+ ])),
111
+ _: 2,
112
+ __: [6]
113
+ }, 1040, ["modelValue"])
114
+ ]),
115
+ _: 2
116
+ }, 1024),
117
+ a(s(f), null, {
118
+ default: o(() => [
119
+ a(w, v({ ref_for: !0 }, y, {
120
+ modelValue: t["x-scalar-secret-password"],
121
+ placeholder: "********",
122
+ type: "password",
123
+ "onUpdate:modelValue": e[2] || (e[2] = (n) => c("update:securityScheme", {
124
+ type: "http",
125
+ payload: { password: n }
126
+ }))
127
+ }), {
128
+ default: o(() => e[7] || (e[7] = [
129
+ x(" Password ")
130
+ ])),
131
+ _: 2,
132
+ __: [7]
133
+ }, 1040, ["modelValue"])
134
+ ]),
135
+ _: 2
136
+ }, 1024)
137
+ ], 64)) : b("", !0)
138
+ ], 64)) : t?.type === "apiKey" ? (r(), u(i, { key: 3 }, [
139
+ a(s(f), null, {
140
+ default: o(() => [
141
+ a(w, v({ ref_for: !0 }, y, {
142
+ containerClass: l.layout === "reference" && "border-t",
143
+ modelValue: t.name,
144
+ placeholder: "api-key",
145
+ "onUpdate:modelValue": e[3] || (e[3] = (n) => c("update:securityScheme", {
146
+ type: "apiKey",
147
+ payload: { name: n }
148
+ }))
149
+ }), {
150
+ default: o(() => e[8] || (e[8] = [
151
+ x(" Name ")
152
+ ])),
153
+ _: 2,
154
+ __: [8]
155
+ }, 1040, ["containerClass", "modelValue"])
156
+ ]),
157
+ _: 2
158
+ }, 1024),
159
+ a(s(f), null, {
160
+ default: o(() => [
161
+ a(w, v({ ref_for: !0 }, y, {
162
+ modelValue: t["x-scalar-secret-token"],
163
+ placeholder: "QUxMIFlPVVIgQkFTRSBBUkUgQkVMT05HIFRPIFVT",
164
+ type: "password",
165
+ "onUpdate:modelValue": e[4] || (e[4] = (n) => c("update:securityScheme", {
166
+ type: "apiKey",
167
+ payload: { value: n }
168
+ }))
169
+ }), {
170
+ default: o(() => e[9] || (e[9] = [
171
+ x(" Value ")
172
+ ])),
173
+ _: 2,
174
+ __: [9]
175
+ }, 1040, ["modelValue"])
176
+ ]),
177
+ _: 2
178
+ }, 1024)
179
+ ], 64)) : t?.type === "oauth2" ? (r(), u(i, { key: 4 }, [
180
+ a(s(f), null, {
181
+ default: o(() => [
182
+ Object.keys(t.flows).length > 1 ? (r(), u("div", M, [
183
+ C("div", Q, [
184
+ (r(!0), u(i, null, U(t?.flows, (n, d, V) => (r(), u("button", {
185
+ key: d,
186
+ class: j(["floating-bg text-c-3 relative cursor-pointer border-b-[1px] border-transparent py-1 text-base font-medium", {
187
+ "!text-c-1 !rounded-none border-b-[1px] !border-current": l.layout !== "reference" && (p.value === d || V === 0 && !p.value),
188
+ "!text-c-1 !rounded-none border-b-[1px] !border-current opacity-100": l.layout === "reference" && (p.value === d || V === 0 && !p.value)
189
+ }]),
190
+ type: "button",
191
+ onClick: (g) => p.value = d
192
+ }, [
193
+ C("span", D, F(d), 1)
194
+ ], 10, q))), 128))
195
+ ])
196
+ ])) : b("", !0)
197
+ ]),
198
+ _: 2
199
+ }, 1024),
200
+ (r(!0), u(i, null, U(t.flows, (n, d, V) => (r(), u(i, { key: d }, [
201
+ p.value === d || V === 0 && !p.value ? (r(), k(O, v({
202
+ key: 0,
203
+ ref_for: !0
204
+ }, y, {
205
+ flows: t.flows,
206
+ proxyUrl: "",
207
+ scheme: t,
208
+ selectedScopes: h,
209
+ server: l.server,
210
+ type: d,
211
+ "onUpdate:securityScheme": (g) => c("update:securityScheme", {
212
+ type: "oauth2",
213
+ flow: d,
214
+ payload: g
215
+ }),
216
+ "onUpdate:selectedScopes": (g) => c("update:selectedScopes", {
217
+ id: Object.keys(l.selectedSecuritySchema),
218
+ name: m,
219
+ ...g
220
+ })
221
+ }), null, 16, ["flows", "scheme", "selectedScopes", "server", "type", "onUpdate:securityScheme", "onUpdate:selectedScopes"])) : b("", !0)
222
+ ], 64))), 128))
223
+ ], 64)) : t?.type === "openIdConnect" ? (r(), u("div", {
224
+ key: 5,
225
+ class: j(["text-c-3 bg-b-1 flex min-h-[calc(4rem+1px)] items-center justify-center border-t border-b-0 px-4 text-base", { "rounded-b-lg": l.layout === "reference" }])
226
+ }, " Coming soon ", 2)) : b("", !0)
227
+ ], 64))), 128));
228
+ }
229
+ });
230
+ export {
231
+ Y as default
232
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./RequestAuthTab.vue.js";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,29 @@
1
+ export type UpdateSecuritySchemeEvent = {
2
+ type: 'http';
3
+ payload: Partial<{
4
+ token: string;
5
+ username: string;
6
+ password: string;
7
+ }>;
8
+ } | {
9
+ type: 'apiKey';
10
+ payload: Partial<{
11
+ name: string;
12
+ value: string;
13
+ }>;
14
+ } | {
15
+ type: 'oauth2';
16
+ flow: 'implicit' | 'password' | 'clientCredentials' | 'authorizationCode';
17
+ payload: Partial<{
18
+ authUrl: string;
19
+ tokenUrl: string;
20
+ token: string;
21
+ redirectUrl: string;
22
+ clientId: string;
23
+ clientSecret: string;
24
+ usePkce: 'no' | 'SHA-256' | 'plain';
25
+ username: string;
26
+ password: string;
27
+ }>;
28
+ };
29
+ //# sourceMappingURL=event-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-types.d.ts","sourceRoot":"","sources":["../../../../src/v2/blocks/scalar-auth-selector-block/event-types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,yBAAyB,GACjC;IACE,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,OAAO,CAAC;QACf,KAAK,EAAE,MAAM,CAAA;QACb,QAAQ,EAAE,MAAM,CAAA;QAChB,QAAQ,EAAE,MAAM,CAAA;KACjB,CAAC,CAAA;CACH,GACD;IACE,IAAI,EAAE,QAAQ,CAAA;IACd,OAAO,EAAE,OAAO,CAAC;QACf,IAAI,EAAE,MAAM,CAAA;QACZ,KAAK,EAAE,MAAM,CAAA;KACd,CAAC,CAAA;CACH,GACD;IACE,IAAI,EAAE,QAAQ,CAAA;IACd,IAAI,EAAE,UAAU,GAAG,UAAU,GAAG,mBAAmB,GAAG,mBAAmB,CAAA;IACzE,OAAO,EAAE,OAAO,CAAC;QACf,OAAO,EAAE,MAAM,CAAA;QACf,QAAQ,EAAE,MAAM,CAAA;QAChB,KAAK,EAAE,MAAM,CAAA;QACb,WAAW,EAAE,MAAM,CAAA;QACnB,QAAQ,EAAE,MAAM,CAAA;QAChB,YAAY,EAAE,MAAM,CAAA;QACpB,OAAO,EAAE,IAAI,GAAG,SAAS,GAAG,OAAO,CAAA;QACnC,QAAQ,EAAE,MAAM,CAAA;QAChB,QAAQ,EAAE,MAAM,CAAA;KACjB,CAAC,CAAA;CACH,CAAA"}
@@ -0,0 +1,9 @@
1
+ import type { SecuritySchemeObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
2
+ type AuthOption = {
3
+ label: string;
4
+ payload: SecuritySchemeObject;
5
+ };
6
+ /** Predefined authentication options */
7
+ export declare const authOptions: Record<string, AuthOption>;
8
+ export {};
9
+ //# sourceMappingURL=auth-options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth-options.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/helpers/auth-options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8DAA8D,CAAA;AAExG,KAAK,UAAU,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,oBAAoB,CAAA;CAAE,CAAA;AAElE,wCAAwC;AACxC,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAqHlD,CAAA"}
@@ -0,0 +1,121 @@
1
+ const e = {
2
+ apiKeyCookie: {
3
+ label: "API Key in Cookies",
4
+ payload: {
5
+ type: "apiKey",
6
+ in: "cookie",
7
+ name: "apiKeyCookie",
8
+ "x-scalar-secret-token": ""
9
+ }
10
+ },
11
+ apiKeyHeader: {
12
+ label: "API Key in Headers",
13
+ payload: {
14
+ type: "apiKey",
15
+ in: "header",
16
+ name: "apiKeyHeader",
17
+ "x-scalar-secret-token": ""
18
+ }
19
+ },
20
+ apiKeyQuery: {
21
+ label: "API Key in Query Params",
22
+ payload: {
23
+ type: "apiKey",
24
+ in: "query",
25
+ name: "apiKeyQuery",
26
+ "x-scalar-secret-token": ""
27
+ }
28
+ },
29
+ httpBasic: {
30
+ label: "HTTP Basic",
31
+ payload: {
32
+ type: "http",
33
+ scheme: "basic",
34
+ "x-scalar-secret-token": "",
35
+ "x-scalar-secret-username": "",
36
+ "x-scalar-secret-password": ""
37
+ }
38
+ },
39
+ httpBearer: {
40
+ label: "HTTP Bearer",
41
+ payload: {
42
+ type: "http",
43
+ scheme: "bearer",
44
+ "x-scalar-secret-token": "",
45
+ "x-scalar-secret-username": "",
46
+ "x-scalar-secret-password": ""
47
+ }
48
+ },
49
+ oauth2Implicit: {
50
+ label: "Oauth2 Implicit Flow",
51
+ payload: {
52
+ type: "oauth2",
53
+ flows: {
54
+ implicit: {
55
+ authorizationUrl: "",
56
+ refreshUrl: "",
57
+ "x-scalar-secret-client-id": "",
58
+ "x-scalar-secret-redirect-uri": "",
59
+ "x-scalar-secret-token": "",
60
+ scopes: {}
61
+ }
62
+ }
63
+ }
64
+ },
65
+ oauth2Password: {
66
+ label: "Oauth2 Password Flow",
67
+ payload: {
68
+ type: "oauth2",
69
+ flows: {
70
+ password: {
71
+ tokenUrl: "",
72
+ refreshUrl: "",
73
+ "x-scalar-secret-client-id": "",
74
+ "x-scalar-secret-username": "",
75
+ "x-scalar-secret-password": "",
76
+ "x-scalar-secret-token": "",
77
+ "x-scalar-secret-client-secret": "",
78
+ scopes: {}
79
+ }
80
+ }
81
+ }
82
+ },
83
+ oauth2ClientCredentials: {
84
+ label: "Oauth2 Client Credentials",
85
+ payload: {
86
+ type: "oauth2",
87
+ flows: {
88
+ clientCredentials: {
89
+ tokenUrl: "",
90
+ refreshUrl: "",
91
+ "x-scalar-secret-client-id": "",
92
+ "x-scalar-secret-token": "",
93
+ "x-scalar-secret-client-secret": "",
94
+ scopes: {}
95
+ }
96
+ }
97
+ }
98
+ },
99
+ oauth2AuthorizationFlow: {
100
+ label: "Oauth2 Authorization Code",
101
+ payload: {
102
+ type: "oauth2",
103
+ flows: {
104
+ authorizationCode: {
105
+ authorizationUrl: "",
106
+ tokenUrl: "",
107
+ refreshUrl: "",
108
+ "x-scalar-secret-client-id": "",
109
+ "x-scalar-secret-client-secret": "",
110
+ "x-scalar-secret-token": "",
111
+ "x-scalar-secret-redirect-uri": "",
112
+ "x-usePkce": "no",
113
+ scopes: {}
114
+ }
115
+ }
116
+ }
117
+ }
118
+ };
119
+ export {
120
+ e as authOptions
121
+ };
@@ -0,0 +1,34 @@
1
+ import type { OAuthFlowsObject, ServerObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
2
+ import type { ErrorResponse } from '../../../../libs/errors.js';
3
+ /** Oauth2 security schemes which are not implicit */
4
+ type NonImplicitFlow = Omit<OAuthFlowsObject, 'implicit'>;
5
+ type PKCEState = {
6
+ codeVerifier: string;
7
+ codeChallenge: string;
8
+ codeChallengeMethod: string;
9
+ };
10
+ /**
11
+ * Creates a code challenge from the code verifier
12
+ */
13
+ export declare const generateCodeChallenge: (verifier: string, encoding: "SHA-256" | "plain") => Promise<string>;
14
+ /**
15
+ * Authorize oauth2 flow
16
+ *
17
+ * @returns the accessToken
18
+ */
19
+ export declare const authorizeOauth2: (flows: OAuthFlowsObject, type: keyof OAuthFlowsObject, selectedScopes: string[],
20
+ /** We use the active server to set a base for relative redirect uris */
21
+ activeServer: ServerObject,
22
+ /** If we want to use the proxy */
23
+ proxyUrl?: string) => Promise<ErrorResponse<string>>;
24
+ /**
25
+ * Makes the BE authorization call to grab the token server to server
26
+ * Used for clientCredentials and authorizationCode
27
+ */
28
+ export declare const authorizeServers: (flows: NonImplicitFlow, type: keyof NonImplicitFlow, scopes: string, { code, pkce, proxyUrl, }?: {
29
+ code?: string;
30
+ pkce?: PKCEState | null;
31
+ proxyUrl?: string | undefined;
32
+ }) => Promise<ErrorResponse<string>>;
33
+ export {};
34
+ //# sourceMappingURL=oauth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/helpers/oauth.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAGlH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAElD,qDAAqD;AACrD,KAAK,eAAe,GAAG,IAAI,CAAC,gBAAgB,EAAE,UAAU,CAAC,CAAA;AAEzD,KAAK,SAAS,GAAG;IACf,YAAY,EAAE,MAAM,CAAA;IACpB,aAAa,EAAE,MAAM,CAAA;IACrB,mBAAmB,EAAE,MAAM,CAAA;CAC5B,CAAA;AAgBD;;GAEG;AACH,eAAO,MAAM,qBAAqB,GAAU,UAAU,MAAM,EAAE,UAAU,SAAS,GAAG,OAAO,KAAG,OAAO,CAAC,MAAM,CAY3G,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAC1B,OAAO,gBAAgB,EACvB,MAAM,MAAM,gBAAgB,EAC5B,gBAAgB,MAAM,EAAE;AACxB,wEAAwE;AACxE,cAAc,YAAY;AAC1B,kCAAkC;AAClC,WAAW,MAAM,KAChB,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,CAiK/B,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,gBAAgB,GAC3B,OAAO,eAAe,EACtB,MAAM,MAAM,eAAe,EAC3B,QAAQ,MAAM,EACd,4BAIG;IACD,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,SAAS,GAAG,IAAI,CAAA;IACvB,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CACzB,KACL,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,CA8F/B,CAAA"}
@@ -0,0 +1,111 @@
1
+ import { shouldUseProxy as U } from "@scalar/oas-utils/helpers";
2
+ import { encode as A, fromUint8Array as S } from "js-base64";
3
+ const C = () => {
4
+ const s = new Uint8Array(32);
5
+ return crypto.getRandomValues(s), S(s, !0);
6
+ }, E = async (s, r) => {
7
+ if (r === "plain")
8
+ return s;
9
+ const f = new TextEncoder().encode(s), h = await crypto.subtle.digest("SHA-256", f);
10
+ return S(new Uint8Array(h), !0);
11
+ }, z = async (s, r, m, f, h) => {
12
+ const i = s[r];
13
+ try {
14
+ if (!i)
15
+ return [new Error("Flow not found"), null];
16
+ const e = m.join(" ");
17
+ if (r === "clientCredentials" || r === "password")
18
+ return k(s, r, e, {
19
+ proxyUrl: h
20
+ });
21
+ const t = (Math.random() + 1).toString(36).substring(2, 10), c = new URL(s[r].authorizationUrl);
22
+ let o = null;
23
+ if (r === "implicit")
24
+ c.searchParams.set("response_type", "token");
25
+ else if (r === "authorizationCode") {
26
+ const a = s[r];
27
+ if (c.searchParams.set("response_type", "code"), a["x-usePkce"] !== "no") {
28
+ const n = C(), l = await E(n, a["x-usePkce"]);
29
+ o = {
30
+ codeVerifier: n,
31
+ codeChallenge: l,
32
+ codeChallengeMethod: a["x-usePkce"] === "SHA-256" ? "S256" : "plain"
33
+ }, c.searchParams.set("code_challenge", l), c.searchParams.set("code_challenge_method", o.codeChallengeMethod);
34
+ }
35
+ }
36
+ const w = s[r];
37
+ if (w["x-scalar-secret-redirect-uri"].startsWith("/")) {
38
+ const a = f.url || window.location.origin + window.location.pathname, n = new URL(w["x-scalar-secret-redirect-uri"], a).toString();
39
+ c.searchParams.set("redirect_uri", n);
40
+ } else
41
+ c.searchParams.set("redirect_uri", w["x-scalar-secret-redirect-uri"]);
42
+ i["x-scalar-security-query"] && Object.keys(i["x-scalar-security-query"]).forEach((a) => {
43
+ const n = i["x-scalar-security-query"]?.[a];
44
+ n && c.searchParams.set(a, n);
45
+ }), c.searchParams.set("client_id", i["x-scalar-secret-client-id"]), c.searchParams.set("state", t), e && c.searchParams.set("scope", e);
46
+ const d = window.open(c, "openAuth2Window", "left=100,top=100,width=800,height=600");
47
+ return d ? new Promise((a) => {
48
+ const n = setInterval(() => {
49
+ let l = null, g = null, x = null, _ = null;
50
+ try {
51
+ const u = new URL(d.location.href).searchParams, y = i["x-tokenName"] || "access_token";
52
+ l = u.get(y), g = u.get("code"), x = u.get("error"), _ = u.get("error_description");
53
+ const p = new URLSearchParams(d.location.href.split("#")[1]);
54
+ l ||= p.get(y), g ||= p.get("code"), x ||= p.get("error"), _ ||= p.get("error_description");
55
+ } catch {
56
+ }
57
+ if (d.closed || l || g || x)
58
+ if (clearInterval(n), d.close(), x)
59
+ a([new Error(`OAuth error: ${x}${_ ? ` (${_})` : ""}`), null]);
60
+ else if (l) {
61
+ const u = d.location.href.match(/state=([^&]*)/)?.[1];
62
+ a(u === t ? [null, l] : [new Error("State mismatch"), null]);
63
+ } else g && r === "authorizationCode" ? new URL(d.location.href).searchParams.get("state") === t ? k(s, r, e, {
64
+ code: g,
65
+ pkce: o,
66
+ proxyUrl: h
67
+ }).then(a) : a([new Error("State mismatch"), null]) : (clearInterval(n), a([new Error("Window was closed without granting authorization"), null]));
68
+ }, 200);
69
+ }) : [new Error("Failed to open auth window"), null];
70
+ } catch {
71
+ return [new Error("Failed to authorize oauth2 flow"), null];
72
+ }
73
+ }, k = async (s, r, m, {
74
+ code: f,
75
+ pkce: h,
76
+ proxyUrl: i
77
+ } = {}) => {
78
+ const e = s[r];
79
+ if (!e)
80
+ return [new Error("OAuth2 flow was not defined"), null];
81
+ const t = new URLSearchParams();
82
+ if (t.set("client_id", e["x-scalar-secret-client-id"]), m && (r === "clientCredentials" || r === "password") && t.set("scope", m), e["x-scalar-secret-client-secret"] && (!e["x-scalar-credentials-location"] || e["x-scalar-credentials-location"] === "body") && t.set("client_secret", e["x-scalar-secret-client-secret"]), "x-scalar-secret-redirect-uri" in e && e["x-scalar-secret-redirect-uri"] && t.set("redirect_uri", e["x-scalar-secret-redirect-uri"]), f)
83
+ t.set("code", f), t.set("grant_type", "authorization_code"), h && t.set("code_verifier", h.codeVerifier);
84
+ else if (r === "password") {
85
+ const o = s[r];
86
+ t.set("grant_type", "password"), t.set("username", o["x-scalar-secret-username"]), t.set("password", o["x-scalar-secret-password"]);
87
+ } else
88
+ t.set("grant_type", "client_credentials");
89
+ e["x-scalar-security-body"] && Object.entries(e["x-scalar-security-body"]).forEach(([o, w]) => {
90
+ w && t.set(o, w);
91
+ });
92
+ try {
93
+ const o = {
94
+ "Content-Type": "application/x-www-form-urlencoded"
95
+ };
96
+ e["x-scalar-secret-client-secret"] && (!e["x-scalar-credentials-location"] || e["x-scalar-credentials-location"] === "header") && (o.Authorization = `Basic ${A(`${e["x-scalar-secret-client-id"]}:${e["x-scalar-secret-client-secret"]}`)}`);
97
+ const P = U(i, e.tokenUrl) ? `${i}?${new URLSearchParams([["scalar_url", e.tokenUrl]]).toString()}` : e.tokenUrl, a = await (await fetch(P, {
98
+ method: "POST",
99
+ headers: o,
100
+ body: t
101
+ })).json(), n = e["x-tokenName"] || "access_token";
102
+ return [null, a[n]];
103
+ } catch {
104
+ return [new Error("Failed to get an access token. Please check your credentials."), null];
105
+ }
106
+ };
107
+ export {
108
+ z as authorizeOauth2,
109
+ k as authorizeServers,
110
+ E as generateCodeChallenge
111
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=oauth.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oauth.test.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/helpers/oauth.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,39 @@
1
+ import type { ComponentsObject, OpenApiDocument, SecuritySchemeObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
2
+ /** Format a scheme object into a display object */
3
+ export declare const formatScheme: ({ name, type, value, }: {
4
+ name: string;
5
+ type: SecuritySchemeObject["type"] | "complex";
6
+ value: NonNullable<OpenApiDocument["x-scalar-selected-security"]>[number];
7
+ }) => {
8
+ id: string;
9
+ label: string;
10
+ value: {
11
+ [x: string]: string[];
12
+ };
13
+ };
14
+ /** Formats complex security schemes */
15
+ export declare const formatComplexScheme: (scheme: NonNullable<OpenApiDocument["security"]>[number]) => {
16
+ id: string;
17
+ label: string;
18
+ value: {
19
+ [x: string]: string[];
20
+ };
21
+ };
22
+ export type SecuritySchemeOption = {
23
+ id: string;
24
+ label: string;
25
+ value: NonNullable<OpenApiDocument['x-scalar-selected-security']>[number];
26
+ isDeletable?: boolean;
27
+ payload?: SecuritySchemeObject;
28
+ };
29
+ export type SecuritySchemeGroup = {
30
+ label: string;
31
+ options: SecuritySchemeOption[];
32
+ };
33
+ /**
34
+ * Generates the options for the security scheme combobox
35
+ *
36
+ * contains either a flat list, or different groups of required, available, and add new
37
+ */
38
+ export declare const getSecuritySchemeOptions: (security: NonNullable<OpenApiDocument["security"]>, securitySchemes: NonNullable<ComponentsObject["securitySchemes"]>, isReadOnly?: boolean) => SecuritySchemeOption[] | SecuritySchemeGroup[];
39
+ //# sourceMappingURL=security-scheme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"security-scheme.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,gBAAgB,EAChB,eAAe,EACf,oBAAoB,EACrB,MAAM,8DAA8D,CAAA;AAIrE,mDAAmD;AACnD,eAAO,MAAM,YAAY,GAAI,wBAI1B;IACD,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,oBAAoB,CAAC,MAAM,CAAC,GAAG,SAAS,CAAA;IAC9C,KAAK,EAAE,WAAW,CAAC,eAAe,CAAC,4BAA4B,CAAC,CAAC,CAAC,MAAM,CAAC,CAAA;CAC1E;;;;;;CAIC,CAAA;AAEF,uCAAuC;AACvC,eAAO,MAAM,mBAAmB,GAAI,QAAQ,WAAW,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC;;;;;;CASzF,CAAA;AAEH,MAAM,MAAM,oBAAoB,GAAG;IACjC,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,WAAW,CAAC,eAAe,CAAC,4BAA4B,CAAC,CAAC,CAAC,MAAM,CAAC,CAAA;IACzE,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,OAAO,CAAC,EAAE,oBAAoB,CAAA;CAC/B,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,oBAAoB,EAAE,CAAA;CAChC,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,GACnC,UAAU,WAAW,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC,EAClD,iBAAiB,WAAW,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,CAAC,EACjE,aAAY,OAAe,KAC1B,oBAAoB,EAAE,GAAG,mBAAmB,EA6D9C,CAAA"}