@scalar/api-client 2.5.35 → 2.6.1

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 (207) hide show
  1. package/CHANGELOG.md +35 -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/hooks/useClientConfig.d.ts +3 -0
  14. package/dist/hooks/useClientConfig.d.ts.map +1 -1
  15. package/dist/layouts/App/create-api-client-app.d.ts +10 -10
  16. package/dist/layouts/App/create-api-client-app.d.ts.map +1 -1
  17. package/dist/layouts/Modal/create-api-client-modal.d.ts +20 -20
  18. package/dist/layouts/Modal/create-api-client-modal.d.ts.map +1 -1
  19. package/dist/layouts/Web/create-api-client-web.d.ts +10 -10
  20. package/dist/layouts/Web/create-api-client-web.d.ts.map +1 -1
  21. package/dist/libs/create-client.d.ts +10 -10
  22. package/dist/libs/create-client.d.ts.map +1 -1
  23. package/dist/libs/send-request/create-request-operation.test.d.ts.map +1 -1
  24. package/dist/store/security-schemes.d.ts +10 -10
  25. package/dist/store/security-schemes.d.ts.map +1 -1
  26. package/dist/store/store.d.ts +10 -10
  27. package/dist/store/store.d.ts.map +1 -1
  28. package/dist/style.css +1 -1
  29. package/dist/v2/blocks/operation-code-sample/components/ExamplePicker.test.d.ts +2 -0
  30. package/dist/v2/blocks/operation-code-sample/components/ExamplePicker.test.d.ts.map +1 -0
  31. package/dist/v2/blocks/operation-code-sample/components/ExamplePicker.vue.d.ts +14 -0
  32. package/dist/v2/blocks/operation-code-sample/components/ExamplePicker.vue.d.ts.map +1 -0
  33. package/dist/v2/blocks/operation-code-sample/components/ExamplePicker.vue.js +55 -0
  34. package/dist/v2/blocks/operation-code-sample/components/ExamplePicker.vue2.js +4 -0
  35. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.test.d.ts +2 -0
  36. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.test.d.ts.map +1 -0
  37. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.d.ts +104 -0
  38. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.d.ts.map +1 -0
  39. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.js +7 -0
  40. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue2.js +237 -0
  41. package/dist/v2/blocks/operation-code-sample/helpers/find-client.d.ts +41 -0
  42. package/dist/v2/blocks/operation-code-sample/helpers/find-client.d.ts.map +1 -0
  43. package/dist/v2/blocks/operation-code-sample/helpers/find-client.js +20 -0
  44. package/dist/v2/blocks/operation-code-sample/helpers/find-client.test.d.ts +2 -0
  45. package/dist/v2/blocks/operation-code-sample/helpers/find-client.test.d.ts.map +1 -0
  46. package/dist/v2/blocks/operation-code-sample/helpers/generate-client-options.d.ts +20 -0
  47. package/dist/v2/blocks/operation-code-sample/helpers/generate-client-options.d.ts.map +1 -0
  48. package/dist/v2/blocks/operation-code-sample/helpers/generate-client-options.js +4 -0
  49. package/dist/v2/blocks/operation-code-sample/helpers/generate-client-options.test.d.ts +2 -0
  50. package/dist/v2/blocks/operation-code-sample/helpers/generate-client-options.test.d.ts.map +1 -0
  51. package/dist/v2/blocks/operation-code-sample/helpers/generate-code-snippet.d.ts +17 -0
  52. package/dist/v2/blocks/operation-code-sample/helpers/generate-code-snippet.d.ts.map +1 -0
  53. package/dist/v2/blocks/operation-code-sample/helpers/generate-code-snippet.js +30 -0
  54. package/dist/v2/blocks/operation-code-sample/helpers/generate-code-snippet.test.d.ts +2 -0
  55. package/dist/v2/blocks/operation-code-sample/helpers/generate-code-snippet.test.d.ts.map +1 -0
  56. package/dist/v2/blocks/operation-code-sample/helpers/get-example-from-schema.d.ts +29 -0
  57. package/dist/v2/blocks/operation-code-sample/helpers/get-example-from-schema.d.ts.map +1 -0
  58. package/dist/v2/blocks/operation-code-sample/helpers/get-example-from-schema.js +209 -0
  59. package/dist/v2/blocks/operation-code-sample/helpers/get-example-from-schema.test.d.ts +2 -0
  60. package/dist/v2/blocks/operation-code-sample/helpers/get-example-from-schema.test.d.ts.map +1 -0
  61. package/dist/v2/blocks/operation-code-sample/helpers/get-resolved-ref-deep.d.ts +26 -0
  62. package/dist/v2/blocks/operation-code-sample/helpers/get-resolved-ref-deep.d.ts.map +1 -0
  63. package/dist/v2/blocks/operation-code-sample/helpers/get-resolved-ref-deep.js +29 -0
  64. package/dist/v2/blocks/operation-code-sample/helpers/get-resolved-ref-deep.test.d.ts +2 -0
  65. package/dist/v2/blocks/operation-code-sample/helpers/get-resolved-ref-deep.test.d.ts.map +1 -0
  66. package/dist/v2/blocks/operation-code-sample/helpers/get-secrets.d.ts +4 -0
  67. package/dist/v2/blocks/operation-code-sample/helpers/get-secrets.d.ts.map +1 -0
  68. package/dist/v2/blocks/operation-code-sample/helpers/get-secrets.js +10 -0
  69. package/dist/v2/blocks/operation-code-sample/helpers/get-secrets.test.d.ts +2 -0
  70. package/dist/v2/blocks/operation-code-sample/helpers/get-secrets.test.d.ts.map +1 -0
  71. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/get-example-value.d.ts +7 -0
  72. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/get-example-value.d.ts.map +1 -0
  73. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/get-example-value.js +28 -0
  74. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/get-example-value.test.d.ts +2 -0
  75. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/get-example-value.test.d.ts.map +1 -0
  76. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.d.ts +52 -0
  77. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.d.ts.map +1 -0
  78. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.js +59 -0
  79. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.test.d.ts +2 -0
  80. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.test.d.ts.map +1 -0
  81. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-body.d.ts +12 -0
  82. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-body.d.ts.map +1 -0
  83. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-body.js +57 -0
  84. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-body.test.d.ts +2 -0
  85. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-body.test.d.ts.map +1 -0
  86. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-parameters.d.ts +25 -0
  87. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-parameters.d.ts.map +1 -0
  88. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-parameters.js +212 -0
  89. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-parameters.test.d.ts +2 -0
  90. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-parameters.test.d.ts.map +1 -0
  91. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-security-schemes.d.ts +15 -0
  92. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-security-schemes.d.ts.map +1 -0
  93. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-security-schemes.js +55 -0
  94. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-security-schemes.test.d.ts +2 -0
  95. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-security-schemes.test.d.ts.map +1 -0
  96. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-server-url.d.ts +6 -0
  97. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-server-url.d.ts.map +1 -0
  98. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-server-url.js +18 -0
  99. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-server-url.test.d.ts +2 -0
  100. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-server-url.test.d.ts.map +1 -0
  101. package/dist/v2/blocks/operation-code-sample/index.d.ts +3 -0
  102. package/dist/v2/blocks/operation-code-sample/index.d.ts.map +1 -0
  103. package/dist/v2/blocks/operation-code-sample/index.js +6 -0
  104. package/dist/v2/blocks/operation-code-sample/types.d.ts +29 -0
  105. package/dist/v2/blocks/operation-code-sample/types.d.ts.map +1 -0
  106. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.test.d.ts +2 -0
  107. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.test.d.ts.map +1 -0
  108. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.d.ts +65 -0
  109. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.d.ts.map +1 -0
  110. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.js +7 -0
  111. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue2.js +122 -0
  112. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.test.d.ts +2 -0
  113. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.test.d.ts.map +1 -0
  114. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.d.ts +25 -0
  115. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.d.ts.map +1 -0
  116. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.js +7 -0
  117. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue2.js +90 -0
  118. package/dist/v2/blocks/scalar-address-bar-block/components/httpStatusCodeColors.d.ts +55 -0
  119. package/dist/v2/blocks/scalar-address-bar-block/components/httpStatusCodeColors.d.ts.map +1 -0
  120. package/dist/v2/blocks/scalar-address-bar-block/components/httpStatusCodeColors.js +39 -0
  121. package/dist/v2/blocks/scalar-address-bar-block/index.d.ts +2 -0
  122. package/dist/v2/blocks/scalar-address-bar-block/index.d.ts.map +1 -0
  123. package/dist/v2/blocks/scalar-address-bar-block/index.js +4 -0
  124. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.test.d.ts +2 -0
  125. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.test.d.ts.map +1 -0
  126. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.d.ts +49 -0
  127. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.d.ts.map +1 -0
  128. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.js +7 -0
  129. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue2.js +172 -0
  130. package/dist/v2/blocks/scalar-auth-selector-block/components/DeleteRequestAuthModal.test.d.ts +2 -0
  131. package/dist/v2/blocks/scalar-auth-selector-block/components/DeleteRequestAuthModal.test.d.ts.map +1 -0
  132. package/dist/v2/blocks/scalar-auth-selector-block/components/DeleteRequestAuthModal.vue.d.ts +17 -0
  133. package/dist/v2/blocks/scalar-auth-selector-block/components/DeleteRequestAuthModal.vue.d.ts.map +1 -0
  134. package/dist/v2/blocks/scalar-auth-selector-block/components/DeleteRequestAuthModal.vue.js +52 -0
  135. package/dist/v2/blocks/scalar-auth-selector-block/components/DeleteRequestAuthModal.vue2.js +4 -0
  136. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.test.d.ts +2 -0
  137. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.test.d.ts.map +1 -0
  138. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts +45 -0
  139. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts.map +1 -0
  140. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.js +254 -0
  141. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue2.js +4 -0
  142. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.test.d.ts +2 -0
  143. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.test.d.ts.map +1 -0
  144. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue.d.ts +16 -0
  145. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue.d.ts.map +1 -0
  146. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue.js +134 -0
  147. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue2.js +4 -0
  148. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.test.d.ts +2 -0
  149. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.test.d.ts.map +1 -0
  150. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.d.ts +33 -0
  151. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.d.ts.map +1 -0
  152. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.js +7 -0
  153. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue2.js +82 -0
  154. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTableInput.vue.d.ts +48 -0
  155. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTableInput.vue.d.ts.map +1 -0
  156. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTableInput.vue.js +48 -0
  157. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTableInput.vue2.js +4 -0
  158. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.test.d.ts +2 -0
  159. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.test.d.ts.map +1 -0
  160. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.d.ts +29 -0
  161. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.d.ts.map +1 -0
  162. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.js +232 -0
  163. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue2.js +4 -0
  164. package/dist/v2/blocks/scalar-auth-selector-block/event-types.d.ts +29 -0
  165. package/dist/v2/blocks/scalar-auth-selector-block/event-types.d.ts.map +1 -0
  166. package/dist/v2/blocks/scalar-auth-selector-block/helpers/auth-options.d.ts +9 -0
  167. package/dist/v2/blocks/scalar-auth-selector-block/helpers/auth-options.d.ts.map +1 -0
  168. package/dist/v2/blocks/scalar-auth-selector-block/helpers/auth-options.js +121 -0
  169. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.d.ts +34 -0
  170. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.d.ts.map +1 -0
  171. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.js +111 -0
  172. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.test.d.ts +2 -0
  173. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.test.d.ts.map +1 -0
  174. package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.d.ts +39 -0
  175. package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.d.ts.map +1 -0
  176. package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.js +52 -0
  177. package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.test.d.ts +2 -0
  178. package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.test.d.ts.map +1 -0
  179. package/dist/v2/blocks/scalar-auth-selector-block/index.d.ts +2 -0
  180. package/dist/v2/blocks/scalar-auth-selector-block/index.d.ts.map +1 -0
  181. package/dist/v2/blocks/scalar-auth-selector-block/index.js +4 -0
  182. package/dist/v2/components/server/ServerDropdown.test.d.ts +2 -0
  183. package/dist/v2/components/server/ServerDropdown.test.d.ts.map +1 -0
  184. package/dist/v2/components/server/ServerDropdown.vue.d.ts +33 -0
  185. package/dist/v2/components/server/ServerDropdown.vue.d.ts.map +1 -0
  186. package/dist/v2/components/server/ServerDropdown.vue.js +87 -0
  187. package/dist/v2/components/server/ServerDropdown.vue2.js +4 -0
  188. package/dist/v2/components/server/ServerDropdownItem.test.d.ts +2 -0
  189. package/dist/v2/components/server/ServerDropdownItem.test.d.ts.map +1 -0
  190. package/dist/v2/components/server/ServerDropdownItem.vue.d.ts +21 -0
  191. package/dist/v2/components/server/ServerDropdownItem.vue.d.ts.map +1 -0
  192. package/dist/v2/components/server/ServerDropdownItem.vue.js +7 -0
  193. package/dist/v2/components/server/ServerDropdownItem.vue2.js +51 -0
  194. package/dist/v2/components/server/index.d.ts +2 -0
  195. package/dist/v2/components/server/index.d.ts.map +1 -0
  196. package/dist/v2/components/server/index.js +4 -0
  197. package/dist/views/Request/Request.vue.js +1 -1
  198. package/dist/views/Request/Request.vue2.js +4 -4
  199. package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue.d.ts +2 -2
  200. package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue.d.ts.map +1 -1
  201. package/dist/views/Request/RequestSection/RequestAuth/RequestAuthDataTable.vue.d.ts +2 -2
  202. package/dist/views/Request/RequestSection/RequestAuth/RequestAuthDataTable.vue.d.ts.map +1 -1
  203. package/dist/views/Request/ResponseSection/RequestHeaders.vue.js +1 -1
  204. package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
  205. package/dist/views/Request/ResponseSection/ResponseHeaders.vue.js +1 -1
  206. package/dist/vitest.setup.d.ts.map +1 -1
  207. package/package.json +15 -11
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ExamplePicker.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExamplePicker.test.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-code-sample/components/ExamplePicker.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,14 @@
1
+ import type { MediaTypeObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
2
+ type __VLS_Props = {
3
+ examples?: MediaTypeObject['examples'];
4
+ };
5
+ type __VLS_PublicProps = __VLS_Props & {
6
+ modelValue: string;
7
+ };
8
+ declare const _default: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
9
+ "update:modelValue": (value: string) => any;
10
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
11
+ "onUpdate:modelValue"?: ((value: string) => any) | undefined;
12
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
13
+ export default _default;
14
+ //# sourceMappingURL=ExamplePicker.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExamplePicker.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-code-sample/components/ExamplePicker.vue"],"names":[],"mappings":"AA4DA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8DAA8D,CAAA;AAGnG,KAAK,WAAW,GAAG;IACjB,QAAQ,CAAC,EAAE,eAAe,CAAC,UAAU,CAAC,CAAA;CACvC,CAAC;AAwBF,KAAK,iBAAiB,GAAG,WAAW,GAAG;IACvC,UAAU,EAAE,MAAM,CAAC;CAClB,CAAC;;;;;;AA0GF,wBAOG"}
@@ -0,0 +1,55 @@
1
+ import { defineComponent as u, mergeModels as c, useModel as p, computed as n, createBlock as f, openBlock as x, unref as l, withCtx as r, createVNode as i, createElementVNode as v, toDisplayString as w } from "vue";
2
+ import { ScalarListbox as V, ScalarButton as b } from "@scalar/components";
3
+ import { ScalarIconCaretDown as g } from "@scalar/icons";
4
+ const h = { class: "min-w-0 flex-1 truncate" }, k = /* @__PURE__ */ u({
5
+ __name: "ExamplePicker",
6
+ props: /* @__PURE__ */ c({
7
+ examples: { default: () => ({}) }
8
+ }, {
9
+ modelValue: {
10
+ required: !0
11
+ },
12
+ modelModifiers: {}
13
+ }),
14
+ emits: ["update:modelValue"],
15
+ setup(o) {
16
+ const s = p(o, "modelValue"), m = n(
17
+ () => Object.entries(o.examples).map(([e, t]) => ({
18
+ id: e,
19
+ label: t?.summary ?? e
20
+ }))
21
+ ), a = n({
22
+ get: () => m.value.find(({ id: e }) => e === s.value),
23
+ set: (e) => s.value = e?.id ?? ""
24
+ });
25
+ return (e, t) => (x(), f(l(V), {
26
+ modelValue: a.value,
27
+ "onUpdate:modelValue": t[0] || (t[0] = (d) => a.value = d),
28
+ class: "w-fit min-w-32",
29
+ options: m.value,
30
+ placement: "bottom-start"
31
+ }, {
32
+ default: r(() => [
33
+ i(l(b), {
34
+ class: "text-c-2 hover:text-c-1 flex h-full w-fit min-w-0 gap-1.5 px-1.5 py-0.75 text-base font-normal",
35
+ "data-testid": "example-picker",
36
+ fullWidth: "",
37
+ variant: "ghost"
38
+ }, {
39
+ default: r(() => [
40
+ v("div", h, w(a.value?.label ?? "Select an example"), 1),
41
+ i(l(g), {
42
+ class: "ui-open:rotate-180 mt-0.25 size-3 transition-transform duration-100",
43
+ weight: "bold"
44
+ })
45
+ ]),
46
+ _: 1
47
+ })
48
+ ]),
49
+ _: 1
50
+ }, 8, ["modelValue", "options"]));
51
+ }
52
+ });
53
+ export {
54
+ k as default
55
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./ExamplePicker.vue.js";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=OperationCodeSample.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OperationCodeSample.test.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-code-sample/components/OperationCodeSample.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,104 @@
1
+ import type { HttpMethod as HttpMethodType } from '@scalar/helpers/http/http-methods';
2
+ import { type AvailableClients } from '@scalar/snippetz';
3
+ import type { OperationObject, SecuritySchemeObject, ServerObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
4
+ import type { ClientOptionGroup } from '../../../../v2/blocks/operation-code-sample/types';
5
+ export type OperationCodeSampleProps = {
6
+ /**
7
+ * List of all http clients formatted into option groups for the client selector
8
+ */
9
+ clientOptions: ClientOptionGroup[];
10
+ /**
11
+ * Pre-selected client, this will determine which client is initially selected in the dropdown
12
+ *
13
+ * @defaults to shell/curl or a custom sample if one is available
14
+ */
15
+ selectedClient?: AvailableClients[number];
16
+ /**
17
+ * Which server from the spec to use for the code example
18
+ */
19
+ selectedServer?: ServerObject | undefined;
20
+ /**
21
+ * The selected content type from the requestBody.content, this will determine which examples are available
22
+ * as well as the content type of the code example
23
+ *
24
+ * @defaults to the first content type if not provided
25
+ */
26
+ selectedContentType?: string;
27
+ /**
28
+ * Example name to use for resolving example values for parameters AND requestBody
29
+ *
30
+ * @example "limited"
31
+ * ```ts
32
+ * parameters: {
33
+ * name: 'foobar',
34
+ * in: 'query',
35
+ * examples: {
36
+ * limited: {
37
+ * dataValue: 10,
38
+ * }
39
+ * }
40
+ * },
41
+ * body: {
42
+ * content: {
43
+ * 'application/json': {
44
+ * examples: {
45
+ * limited: {
46
+ * dataValue: { foo: 'bar' },
47
+ * }
48
+ * }
49
+ * }
50
+ * }
51
+ * }
52
+ *
53
+ * ```
54
+ */
55
+ selectedExample?: string;
56
+ /**
57
+ * The security schemes which are applicable to this operation
58
+ */
59
+ securitySchemes?: SecuritySchemeObject[];
60
+ /**
61
+ * HTTP method of the operation
62
+ */
63
+ method: HttpMethodType;
64
+ /**
65
+ * Path of the operation
66
+ */
67
+ path: string;
68
+ /**
69
+ * De-referenced OpenAPI Operation object
70
+ */
71
+ operation: OperationObject;
72
+ /**
73
+ * If true and there's no example, we will display a small card with the method and path only
74
+ */
75
+ fallback?: boolean;
76
+ /**
77
+ * A method to generate the label of the block, should return an html string
78
+ */
79
+ generateLabel?: () => string;
80
+ /**
81
+ * If true, render this as a webhook request example
82
+ */
83
+ isWebhook?: boolean;
84
+ };
85
+ /**
86
+ * Request Example
87
+ *
88
+ * The core component for rendering a request example block,
89
+ * this component does not have much of its own state but operates on props and custom events
90
+ *
91
+ * @event scalar-update-selected-client - Emitted when the selected client changes
92
+ * @event scalar-update-selected-example - Emitted when the selected example changes
93
+ */
94
+ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<OperationCodeSampleProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<OperationCodeSampleProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
95
+ header: () => unknown;
96
+ footer: () => unknown;
97
+ }>;
98
+ export default _default;
99
+ type __VLS_WithSlots<T, S> = T & {
100
+ new (): {
101
+ $slots: S;
102
+ };
103
+ };
104
+ //# sourceMappingURL=OperationCodeSample.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OperationCodeSample.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-code-sample/components/OperationCodeSample.vue"],"names":[],"mappings":"AA6dA,OAAO,KAAK,EAAE,UAAU,IAAI,cAAc,EAAE,MAAM,mCAAmC,CAAA;AAErF,OAAO,EAAE,KAAK,gBAAgB,EAAiB,MAAM,kBAAkB,CAAA;AAGvE,OAAO,KAAK,EACV,eAAe,EACf,oBAAoB,EACpB,YAAY,EACb,MAAM,8DAA8D,CAAA;AASrE,OAAO,KAAK,EAEV,iBAAiB,EAClB,MAAM,yCAAyC,CAAA;AAKhD,MAAM,MAAM,wBAAwB,GAAG;IACrC;;OAEG;IACH,aAAa,EAAE,iBAAiB,EAAE,CAAA;IAClC;;;;OAIG;IACH,cAAc,CAAC,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAA;IACzC;;OAEG;IACH,cAAc,CAAC,EAAE,YAAY,GAAG,SAAS,CAAA;IACzC;;;;;OAKG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB;;OAEG;IACH,eAAe,CAAC,EAAE,oBAAoB,EAAE,CAAA;IACxC;;OAEG;IACH,MAAM,EAAE,cAAc,CAAA;IACtB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IACZ;;OAEG;IACH,SAAS,EAAE,eAAe,CAAA;IAC1B;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,MAAM,CAAA;IAC5B;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB,CAAA;AAED;;;;;;;;GAQG;;YAkBO,MAAM,OAAO;YACb,MAAM,OAAO;;AAlBvB,wBAuiBC;AAOD,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
@@ -0,0 +1,7 @@
1
+ import o from "./OperationCodeSample.vue2.js";
2
+ /* empty css */
3
+ import a from "../../../../_virtual/_plugin-vue_export-helper.js";
4
+ const e = /* @__PURE__ */ a(o, [["__scopeId", "data-v-ab4718a0"]]);
5
+ export {
6
+ e as default
7
+ };
@@ -0,0 +1,237 @@
1
+ import { defineComponent as L, computed as r, ref as k, watch as D, useId as I, createBlock as h, createCommentVNode as m, openBlock as i, unref as o, withCtx as n, createVNode as s, createSlots as M, createElementVNode as v, createElementBlock as S, renderSlot as y, toDisplayString as N } from "vue";
2
+ import { ScalarCard as q, ScalarCardHeader as R, ScalarCombobox as z, ScalarButton as K, ScalarCardSection as E, ScalarCodeBlock as F, ScalarCardFooter as U } from "@scalar/components";
3
+ import { freezeElement as A } from "@scalar/helpers/dom/freeze-element";
4
+ import { ScalarIconCaretDown as G } from "@scalar/icons";
5
+ import { emitCustomEvent as T } from "@scalar/workspace-store/events";
6
+ import { getResolvedRef as J } from "@scalar/workspace-store/helpers/get-resolved-ref";
7
+ import { operationToHar as P } from "../helpers/operation-to-har/operation-to-har.js";
8
+ import { findClient as B } from "../helpers/find-client.js";
9
+ import { generateCustomId as $ } from "../helpers/generate-client-options.js";
10
+ import { generateCodeSnippet as Q } from "../helpers/generate-code-snippet.js";
11
+ import { getSecrets as X } from "../helpers/get-secrets.js";
12
+ import Y from "./ExamplePicker.vue.js";
13
+ import j from "../../../../components/HttpMethod/HttpMethod.vue.js";
14
+ const Z = ["innerHTML"], _ = { class: "text-base font-normal" }, ee = ["id"], te = {
15
+ key: 0,
16
+ class: "request-card-footer-addon"
17
+ }, le = { class: "request-header" }, oe = {}, ye = /* @__PURE__ */ L({
18
+ ...oe,
19
+ __name: "OperationCodeSample",
20
+ props: {
21
+ clientOptions: {},
22
+ selectedClient: {},
23
+ selectedServer: { default: () => ({ url: "/" }) },
24
+ selectedContentType: {},
25
+ selectedExample: {},
26
+ securitySchemes: { default: () => [] },
27
+ method: {},
28
+ path: {},
29
+ operation: {},
30
+ fallback: { type: Boolean },
31
+ generateLabel: { type: Function },
32
+ isWebhook: { type: Boolean }
33
+ },
34
+ setup(l) {
35
+ const c = r(() => {
36
+ const e = J(l.operation.requestBody)?.content ?? {}, t = l.selectedContentType || Object.keys(e)[0];
37
+ return t ? e[t]?.examples ?? {} : {};
38
+ }), f = k(
39
+ l.selectedExample ?? Object.keys(c.value)[0] ?? ""
40
+ ), C = r(() => [
41
+ "x-custom-examples",
42
+ "x-codeSamples",
43
+ "x-code-samples"
44
+ ].flatMap((t) => l.operation[t] ?? [])), p = r(() => C.value.length ? [
45
+ {
46
+ label: "Code Examples",
47
+ options: C.value.map((t) => {
48
+ const a = $(t), x = t.label || t.lang || a;
49
+ return {
50
+ id: a,
51
+ lang: t.lang || "plaintext",
52
+ title: x,
53
+ label: x
54
+ };
55
+ })
56
+ },
57
+ ...l.clientOptions
58
+ ] : l.clientOptions), u = k(
59
+ B(p.value, l.selectedClient)
60
+ );
61
+ D(
62
+ () => l.selectedClient,
63
+ (e) => {
64
+ const t = B(p.value, e);
65
+ t && (u.value = t);
66
+ }
67
+ );
68
+ const b = r(() => {
69
+ if (!l.isWebhook) return null;
70
+ try {
71
+ return P({
72
+ operation: l.operation,
73
+ method: l.method,
74
+ path: l.path,
75
+ example: f.value
76
+ });
77
+ } catch (e) {
78
+ return console.error("[webhookHar]", e), null;
79
+ }
80
+ }), g = r(() => {
81
+ try {
82
+ const e = u.value?.id;
83
+ return e ? e.startsWith("custom") ? C.value.find(
84
+ (t) => $(t) === u.value?.id
85
+ )?.source ?? "Custom example not found" : l.isWebhook ? b.value?.postData?.text ?? "" : Q({
86
+ clientId: e,
87
+ operation: l.operation,
88
+ method: l.method,
89
+ server: l.selectedServer,
90
+ securitySchemes: l.securitySchemes,
91
+ contentType: l.selectedContentType,
92
+ path: l.path,
93
+ example: f.value
94
+ }) : "";
95
+ } catch (e) {
96
+ return console.error("[generateSnippet]", e), "";
97
+ }
98
+ }), O = r(() => l.isWebhook ? V.value : u.value?.lang), V = r(() => {
99
+ if (!b.value?.postData) return "json";
100
+ const e = b.value.postData.mimeType;
101
+ return e?.includes("json") ? "json" : e?.includes("xml") ? "xml" : e?.includes("yaml") || e?.includes("yml") ? "yaml" : e?.includes("text/plain") ? "text" : "json";
102
+ }), w = r(() => X(l.securitySchemes)), d = k(null), W = (e) => {
103
+ if (d.value) {
104
+ const t = A(d.value.$el);
105
+ setTimeout(() => {
106
+ t();
107
+ }, 300);
108
+ }
109
+ u.value = e, e.id.startsWith("custom") || T(d.value?.$el, "scalar-update-selected-client", e.id);
110
+ }, H = I();
111
+ return (e, t) => g.value ? (i(), h(o(q), {
112
+ key: 0,
113
+ ref_key: "elem",
114
+ ref: d,
115
+ class: "request-card dark-mode"
116
+ }, {
117
+ default: n(() => [
118
+ s(o(R), { class: "pr-2.5" }, M({
119
+ default: n(() => [
120
+ t[3] || (t[3] = v("span", { class: "sr-only" }, "Request Example for", -1)),
121
+ s(o(j), {
122
+ as: "span",
123
+ class: "request-method",
124
+ method: e.method
125
+ }, null, 8, ["method"]),
126
+ e.generateLabel ? (i(), S("span", {
127
+ key: 0,
128
+ innerHTML: e.generateLabel()
129
+ }, null, 8, Z)) : m("", !0),
130
+ y(e.$slots, "header", {}, void 0, !0)
131
+ ]),
132
+ _: 2
133
+ }, [
134
+ !e.isWebhook && p.value.length ? {
135
+ name: "actions",
136
+ fn: n(() => [
137
+ s(o(z), {
138
+ class: "max-h-80",
139
+ modelValue: u.value,
140
+ options: p.value,
141
+ placement: "bottom-end",
142
+ teleport: "",
143
+ "onUpdate:modelValue": t[0] || (t[0] = (a) => W(a))
144
+ }, {
145
+ default: n(() => [
146
+ s(o(K), {
147
+ class: "text-c-2 hover:text-c-1 flex h-full w-fit gap-1.5 px-0.5",
148
+ "data-testid": "client-picker",
149
+ fullWidth: "",
150
+ variant: "ghost"
151
+ }, {
152
+ default: n(() => [
153
+ v("span", _, N(u.value?.title), 1),
154
+ s(o(G), {
155
+ class: "ui-open:rotate-180 mt-0.25 size-3 transition-transform duration-100",
156
+ weight: "bold"
157
+ })
158
+ ]),
159
+ _: 1
160
+ })
161
+ ]),
162
+ _: 1
163
+ }, 8, ["modelValue", "options"])
164
+ ]),
165
+ key: "0"
166
+ } : void 0
167
+ ]), 1024),
168
+ s(o(E), { class: "request-editor-section custom-scroll p-0" }, {
169
+ default: n(() => [
170
+ v("div", {
171
+ id: `${o(H)}-example`,
172
+ class: "code-snippet"
173
+ }, [
174
+ s(o(F), {
175
+ class: "bg-b-2 !min-h-full -outline-offset-2",
176
+ content: g.value,
177
+ hideCredentials: w.value,
178
+ lang: O.value,
179
+ lineNumbers: ""
180
+ }, null, 8, ["content", "hideCredentials", "lang"])
181
+ ], 8, ee)
182
+ ]),
183
+ _: 1
184
+ }),
185
+ Object.keys(c.value).length > 1 || e.$slots.footer ? (i(), h(o(U), {
186
+ key: 0,
187
+ class: "request-card-footer bg-b-3"
188
+ }, {
189
+ default: n(() => [
190
+ Object.keys(c.value).length > 1 ? (i(), S("div", te, [
191
+ Object.keys(c.value).length ? (i(), h(Y, {
192
+ key: 0,
193
+ modelValue: f.value,
194
+ "onUpdate:modelValue": [
195
+ t[1] || (t[1] = (a) => f.value = a),
196
+ t[2] || (t[2] = (a) => o(T)(
197
+ d.value?.$el,
198
+ "scalar-update-selected-example",
199
+ a
200
+ ))
201
+ ],
202
+ examples: c.value
203
+ }, null, 8, ["modelValue", "examples"])) : m("", !0)
204
+ ])) : m("", !0),
205
+ y(e.$slots, "footer", {}, void 0, !0)
206
+ ]),
207
+ _: 3
208
+ })) : m("", !0)
209
+ ]),
210
+ _: 3
211
+ }, 512)) : e.fallback ? (i(), h(o(q), {
212
+ key: 1,
213
+ class: "request-card dark-mode"
214
+ }, {
215
+ default: n(() => [
216
+ s(o(E), { class: "request-card-simple" }, {
217
+ default: n(() => [
218
+ v("div", le, [
219
+ s(o(j), {
220
+ as: "span",
221
+ class: "request-method",
222
+ method: e.method
223
+ }, null, 8, ["method"]),
224
+ y(e.$slots, "header", {}, void 0, !0)
225
+ ]),
226
+ y(e.$slots, "footer", {}, void 0, !0)
227
+ ]),
228
+ _: 3
229
+ })
230
+ ]),
231
+ _: 3
232
+ })) : m("", !0);
233
+ }
234
+ });
235
+ export {
236
+ ye as default
237
+ };
@@ -0,0 +1,41 @@
1
+ import { type AvailableClients } from '@scalar/snippetz';
2
+ import type { ClientOption, ClientOptionGroup } from '../../../../v2/blocks/operation-code-sample/types';
3
+ export declare const DEFAULT_CLIENT = "shell/curl";
4
+ /** Type guard to check if a string is a valid client id */
5
+ export declare const isClient: (id: any) => id is AvailableClients[number];
6
+ /**
7
+ * Finds and returns the appropriate client option from a list of client option groups.
8
+ *
9
+ * This function is used to determine which client should be initially selected in the
10
+ * request example block. It prioritizes a specific client ID if provided, otherwise
11
+ * falls back to the first available option.
12
+ *
13
+ * @param options - Array of client option groups, each containing a label and array of client options
14
+ * @param id - Optional client identifier to search for (e.g., 'js/fetch', 'python/requests')
15
+
16
+ * @returns The selected client option. If a specific ID is provided and found, returns that client.
17
+ * If the ID is not found or not provided, returns the first available client option.
18
+ *
19
+ * @example
20
+ * ```typescript
21
+ * const clientGroups = [
22
+ * {
23
+ * label: 'JavaScript',
24
+ * options: [
25
+ * { id: 'js/fetch', label: 'Fetch API', lang: 'js' },
26
+ * { id: 'js/axios', label: 'Axios', lang: 'js' }
27
+ * ]
28
+ * }
29
+ * ]
30
+ *
31
+ * // Find specific client
32
+ * const client = findClient(clientGroups, 'js/fetch')
33
+ * // Returns: { id: 'js/fetch', label: 'Fetch API', lang: 'js' }
34
+ *
35
+ * // Find first available client
36
+ * const firstClient = findClient(clientGroups)
37
+ * // Returns: { id: 'js/fetch', label: 'Fetch API', lang: 'js' }
38
+ * ```
39
+ */
40
+ export declare const findClient: (clientGroups: ClientOptionGroup[], clientId?: AvailableClients[number] | undefined) => ClientOption | undefined;
41
+ //# sourceMappingURL=find-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"find-client.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-code-sample/helpers/find-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAE3E,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAA;AAE9F,eAAO,MAAM,cAAc,eAAe,CAAA;AAE1C,2DAA2D;AAC3D,eAAO,MAAM,QAAQ,GAAI,IAAI,GAAG,KAAG,EAAE,IAAI,gBAAgB,CAAC,MAAM,CAAmC,CAAA;AAEnG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,eAAO,MAAM,UAAU,GACrB,cAAc,iBAAiB,EAAE,EACjC,WAAW,gBAAgB,CAAC,MAAM,CAAC,GAAG,SAAS,KAC9C,YAAY,GAAG,SAwBjB,CAAA"}
@@ -0,0 +1,20 @@
1
+ const r = "shell/curl", p = (t, s) => {
2
+ const f = t[0]?.options[0];
3
+ if (s)
4
+ for (const n of t) {
5
+ const o = n.options.find((i) => i.id === s);
6
+ if (o)
7
+ return o;
8
+ }
9
+ if (!f?.id.startsWith("custom"))
10
+ for (const n of t) {
11
+ const o = n.options.find((i) => i.id === r);
12
+ if (o)
13
+ return o;
14
+ }
15
+ return f;
16
+ };
17
+ export {
18
+ r as DEFAULT_CLIENT,
19
+ p as findClient
20
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=find-client.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"find-client.test.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-code-sample/helpers/find-client.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,20 @@
1
+ import type { ApiReferenceConfiguration } from '@scalar/types/api-reference';
2
+ import type { XCodeSample } from '@scalar/workspace-store/schemas/extensions/operation';
3
+ import type { ClientOptionGroup } from '../../../../v2/blocks/operation-code-sample/types';
4
+ /** Helper to generate an ID for custom code samples */
5
+ export declare const generateCustomId: (example: XCodeSample) => string;
6
+ /**
7
+ * Generates client options for the request example block by filtering and organizing
8
+ * built-in snippets based on the hiddenClients configuration. This function creates
9
+ * a structured list of available client options that can be used to generate code
10
+ * examples for different programming languages and frameworks.
11
+ *
12
+ * The function filters built-in clients based on the hiddenClients parameter and
13
+ * groups them by their category (e.g., JavaScript, Python, etc.). The hiddenClients
14
+ * parameter supports multiple formats:
15
+ * - boolean: true to hide all clients
16
+ * - array: ['fetch', 'axios'] to hide specific clients across all categories
17
+ * - object: { node: true, python: ['requests'] } to hide entire categories or specific clients within categories
18
+ */
19
+ export declare const generateClientOptions: (hiddenClients: ApiReferenceConfiguration["hiddenClients"]) => ClientOptionGroup[];
20
+ //# sourceMappingURL=generate-client-options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-client-options.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-code-sample/helpers/generate-client-options.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAA;AAC5E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sDAAsD,CAAA;AAGvF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAA;AAEhF,uDAAuD;AACvD,eAAO,MAAM,gBAAgB,GAAI,SAAS,WAAW,WAA6B,CAAA;AAElF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,qBAAqB,GAChC,eAAe,yBAAyB,CAAC,eAAe,CAAC,KACxD,iBAAiB,EAwDnB,CAAA"}
@@ -0,0 +1,4 @@
1
+ const e = (t) => `custom/${t.lang}`;
2
+ export {
3
+ e as generateCustomId
4
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=generate-client-options.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-client-options.test.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-code-sample/helpers/generate-client-options.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,17 @@
1
+ import type { HttpMethod } from '@scalar/helpers/http/http-methods';
2
+ import type { AvailableClients } from '@scalar/snippetz';
3
+ import type { OperationObject, SecuritySchemeObject, ServerObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
4
+ type Props = {
5
+ clientId: AvailableClients[number];
6
+ operation: OperationObject;
7
+ example?: string | undefined;
8
+ method: HttpMethod;
9
+ path: string;
10
+ contentType?: string | undefined;
11
+ server?: ServerObject | undefined;
12
+ securitySchemes?: SecuritySchemeObject[] | undefined;
13
+ };
14
+ /** Generate the code snippet for the selected example OR operation */
15
+ export declare const generateCodeSnippet: ({ clientId, operation, method, path, example, contentType, server, securitySchemes, }: Props) => string;
16
+ export {};
17
+ //# sourceMappingURL=generate-code-snippet.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-code-snippet.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-code-sample/helpers/generate-code-snippet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AACnE,OAAO,KAAK,EAAE,gBAAgB,EAAsB,MAAM,kBAAkB,CAAA;AAC5E,OAAO,KAAK,EACV,eAAe,EACf,oBAAoB,EACpB,YAAY,EACb,MAAM,8DAA8D,CAAA;AAKrE,KAAK,KAAK,GAAG;IACX,QAAQ,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAA;IAClC,SAAS,EAAE,eAAe,CAAA;IAC1B,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC5B,MAAM,EAAE,UAAU,CAAA;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAChC,MAAM,CAAC,EAAE,YAAY,GAAG,SAAS,CAAA;IACjC,eAAe,CAAC,EAAE,oBAAoB,EAAE,GAAG,SAAS,CAAA;CACrD,CAAA;AAED,sEAAsE;AACtE,eAAO,MAAM,mBAAmB,GAAI,uFASjC,KAAK,KAAG,MAyBV,CAAA"}
@@ -0,0 +1,30 @@
1
+ import { operationToHar as m } from "./operation-to-har/operation-to-har.js";
2
+ import { getSnippet as u } from "../../../../views/Components/CodeSnippet/helpers/get-snippet.js";
3
+ const f = ({
4
+ clientId: t,
5
+ operation: o,
6
+ method: n,
7
+ path: p,
8
+ example: i,
9
+ contentType: a,
10
+ server: s,
11
+ securitySchemes: c
12
+ }) => {
13
+ try {
14
+ const e = m({
15
+ operation: o,
16
+ contentType: a,
17
+ method: n,
18
+ path: p,
19
+ server: s,
20
+ securitySchemes: c,
21
+ example: i
22
+ }), [g, d] = t.split("/"), [r, l] = u(g, d, e);
23
+ return r ? (console.error("[generateCodeSnippet]", r), r.message ?? "Error generating code snippet") : l;
24
+ } catch (e) {
25
+ return console.error("[generateCodeSnippet]", e), "Error generating code snippet";
26
+ }
27
+ };
28
+ export {
29
+ f as generateCodeSnippet
30
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=generate-code-snippet.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-code-snippet.test.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-code-sample/helpers/generate-code-snippet.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,29 @@
1
+ import type { SchemaObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
2
+ /**
3
+ * Generate an example value from a given OpenAPI SchemaObject.
4
+ *
5
+ * This function recursively processes OpenAPI schemas to create realistic example data.
6
+ * It handles all OpenAPI schema types including primitives, objects, arrays, and
7
+ * composition schemas (allOf, oneOf, anyOf).
8
+ * Uses a tonne of caching for maximum performance.
9
+ *
10
+ * @param schema - The OpenAPI SchemaObject to generate an example from.
11
+ * @param options - Options to customize example generation.
12
+ * @param level - The current recursion depth.
13
+ * @param parentSchema - The parent schema, if any.
14
+ * @param name - The name of the property being processed.
15
+ * @returns An example value for the given schema.
16
+ */
17
+ export declare const getExampleFromSchema: (schema: SchemaObject, options?: {
18
+ /** Fallback string for empty string values. */
19
+ emptyString?: string;
20
+ /** Whether to use XML tag names as keys. */
21
+ xml?: boolean;
22
+ /** Whether to show read-only/write-only properties. */
23
+ mode?: "read" | "write";
24
+ /** Dynamic variables which can replace values via x-variable. */
25
+ variables?: Record<string, unknown>;
26
+ /** Whether to omit empty and optional properties. */
27
+ omitEmptyAndOptionalProperties?: boolean;
28
+ }, level?: number, parentSchema?: SchemaObject, name?: string) => unknown;
29
+ //# sourceMappingURL=get-example-from-schema.d.ts.map