@scalar/api-client 2.5.32 → 2.5.33

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 (235) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/components/AddressBar/AddressBar.vue.js +1 -1
  3. package/dist/components/AddressBar/AddressBar.vue2.js +120 -128
  4. package/dist/components/AddressBar/AddressBarHistory.vue.js +1 -1
  5. package/dist/components/AddressBar/AddressBarHistory.vue2.js +57 -63
  6. package/dist/components/CodeInput/CodeInput.vue.js +2 -2
  7. package/dist/components/CodeInput/CodeInput.vue2.js +143 -150
  8. package/dist/components/CodeInput/codeVariableWidget.js +70 -75
  9. package/dist/components/CommandPalette/CommandActionInput.vue.js +17 -19
  10. package/dist/components/CommandPalette/CommandPaletteCollection.vue.js +26 -27
  11. package/dist/components/CommandPalette/CommandPaletteExample.vue.js +53 -55
  12. package/dist/components/CommandPalette/CommandPaletteImport.vue.js +129 -133
  13. package/dist/components/CommandPalette/CommandPaletteImportCurl.vue.js +1 -1
  14. package/dist/components/CommandPalette/CommandPaletteImportCurl.vue2.js +84 -98
  15. package/dist/components/CommandPalette/CommandPaletteServer.vue.js +64 -74
  16. package/dist/components/CommandPalette/CommandPaletteTag.vue.js +5 -11
  17. package/dist/components/CommandPalette/TheCommandPalette.vue.js +1 -1
  18. package/dist/components/CommandPalette/TheCommandPalette.vue2.js +164 -183
  19. package/dist/components/DataTable/DataTableInput.vue.d.ts.map +1 -1
  20. package/dist/components/DataTable/DataTableInput.vue.js +4 -4
  21. package/dist/components/DataTable/DataTableInput.vue2.js +31 -31
  22. package/dist/components/DataTable/DataTableInputSelect.vue.js +1 -2
  23. package/dist/components/EmptyState.vue.js +1 -1
  24. package/dist/components/EnvironmentSelector/EnvironmentSelector.vue.js +75 -84
  25. package/dist/components/Form/LabelInput.vue.js +1 -1
  26. package/dist/components/HttpMethod/HttpMethod.vue.js +1 -1
  27. package/dist/components/HttpMethod/HttpMethod.vue2.js +11 -11
  28. package/dist/components/ImportCollection/DropEventListener.vue.js +42 -44
  29. package/dist/components/ImportCollection/ImportCollectionListener.vue.js +22 -23
  30. package/dist/components/ImportCollection/ImportCollectionModal.vue.js +141 -149
  31. package/dist/components/ImportCollection/ImportCollectionModal.vue3.js +1 -1
  32. package/dist/components/ImportCollection/ImportNowButton.vue.js +22 -23
  33. package/dist/components/ImportCollection/IntegrationLogo.vue.js +12 -13
  34. package/dist/components/ImportCollection/PasteEventListener.vue.js +11 -12
  35. package/dist/components/ImportCollection/WorkspaceSelector.vue.js +69 -76
  36. package/dist/components/ImportCollection/utils/get-openapi-version.js +8 -8
  37. package/dist/components/ImportCollection/utils/import-collection.js +14 -14
  38. package/dist/components/OpenApiClientButton.vue.js +1 -1
  39. package/dist/components/OpenApiClientButton.vue2.js +10 -10
  40. package/dist/components/ScalarAsciiArt.vue.js +1 -1
  41. package/dist/components/ScalarAsciiArt.vue2.js +19 -22
  42. package/dist/components/Search/useSearch.js +51 -61
  43. package/dist/components/SectionFilter.vue.js +1 -1
  44. package/dist/components/SectionFilter.vue2.js +26 -29
  45. package/dist/components/Server/ServerDropdown.vue.js +70 -96
  46. package/dist/components/Server/ServerDropdownItem.vue.js +1 -1
  47. package/dist/components/Server/ServerDropdownItem.vue2.js +57 -67
  48. package/dist/components/Server/ServerSelector.vue.js +44 -55
  49. package/dist/components/Server/ServerVariablesForm.vue.js +36 -42
  50. package/dist/components/Server/ServerVariablesSelect.vue.js +6 -6
  51. package/dist/components/SideNav/DownloadAppButton.vue.js +1 -1
  52. package/dist/components/SideNav/SideNav.vue.js +68 -74
  53. package/dist/components/Sidebar/Actions/SidebarListElementForm.vue.js +1 -1
  54. package/dist/components/Sidebar/Sidebar.vue.js +1 -1
  55. package/dist/components/Sidebar/SidebarListElement.vue.js +2 -2
  56. package/dist/components/TopNav/TopNav.vue.js +107 -122
  57. package/dist/components/TopNav/TopNavItem.vue.js +1 -1
  58. package/dist/hooks/useFileDialog.js +12 -12
  59. package/dist/hooks/useResponseBody.js +14 -16
  60. package/dist/index.d.ts +1 -1
  61. package/dist/index.js +2 -2
  62. package/dist/layouts/App/ApiClientApp.vue.js +50 -56
  63. package/dist/layouts/App/ApiClientApp.vue3.js +1 -1
  64. package/dist/layouts/App/create-api-client-app.js +19 -20
  65. package/dist/layouts/App/index.js +1 -1
  66. package/dist/layouts/Modal/ApiClientModal.vue.js +1 -1
  67. package/dist/layouts/Modal/ApiClientModal.vue2.js +18 -21
  68. package/dist/layouts/Web/ApiClientWeb.vue.js +45 -51
  69. package/dist/layouts/Web/ApiClientWeb.vue3.js +1 -1
  70. package/dist/layouts/Web/create-api-client-web.js +19 -20
  71. package/dist/layouts/Web/index.js +1 -1
  72. package/dist/libs/create-client.js +102 -109
  73. package/dist/libs/env-helpers.js +3 -3
  74. package/dist/libs/event-bus.js +15 -15
  75. package/dist/libs/extractAttachmentFilename.js +5 -6
  76. package/dist/libs/find-request.js +9 -10
  77. package/dist/libs/get-request-uid-by-path-method.js +12 -12
  78. package/dist/libs/getOpenApiDocumentDetails.js +7 -7
  79. package/dist/libs/importers/curl.js +3 -3
  80. package/dist/libs/normalize-headers.js +9 -10
  81. package/dist/libs/postman.js +15 -17
  82. package/dist/libs/send-request/build-request-security.js +9 -10
  83. package/dist/libs/send-request/create-fetch-body.js +11 -12
  84. package/dist/libs/send-request/create-fetch-query-params.js +13 -13
  85. package/dist/libs/send-request/create-request-operation.js +83 -84
  86. package/dist/libs/send-request/decode-buffer.d.ts.map +1 -1
  87. package/dist/libs/send-request/set-request-cookies.js +12 -12
  88. package/dist/libs/string-template.js +21 -21
  89. package/dist/libs/validate-parameters.js +5 -8
  90. package/dist/plugins/plugin-manager.js +11 -17
  91. package/dist/store/active-entities.js +90 -117
  92. package/dist/store/collections.js +41 -42
  93. package/dist/store/import-spec.js +25 -26
  94. package/dist/store/request-example.js +20 -24
  95. package/dist/store/requests.js +63 -81
  96. package/dist/store/router-params.js +7 -7
  97. package/dist/store/security-schemes.js +35 -36
  98. package/dist/store/store.js +2 -2
  99. package/dist/store/tags.js +20 -21
  100. package/dist/style.css +1 -1
  101. package/dist/views/Collection/Collection.vue2.js +21 -22
  102. package/dist/views/Collection/CollectionAuthentication.vue.js +1 -1
  103. package/dist/views/Collection/CollectionAuthentication.vue2.js +43 -47
  104. package/dist/views/Collection/CollectionEnvironment.vue.js +1 -1
  105. package/dist/views/Collection/CollectionEnvironment.vue2.js +196 -207
  106. package/dist/views/Collection/CollectionInfoForm.vue.js +1 -1
  107. package/dist/views/Collection/CollectionInfoForm.vue2.js +34 -41
  108. package/dist/views/Collection/CollectionNavigation.vue.js +116 -125
  109. package/dist/views/Collection/CollectionOverview.vue2.js +22 -25
  110. package/dist/views/Collection/CollectionServerForm.vue.js +39 -45
  111. package/dist/views/Collection/CollectionServers.vue2.js +88 -98
  112. package/dist/views/Collection/CollectionSettings.vue.js +1 -1
  113. package/dist/views/Collection/CollectionSettings.vue2.js +101 -108
  114. package/dist/views/Collection/components/EnvironmentForm.vue.js +1 -1
  115. package/dist/views/Collection/components/EnvironmentForm.vue2.js +141 -145
  116. package/dist/views/Collection/components/MarkdownInput.vue.js +1 -1
  117. package/dist/views/Collection/components/MarkdownInput.vue2.js +1 -2
  118. package/dist/views/Components/CodeSnippet/CodeSnippet.vue.js +15 -15
  119. package/dist/views/Components/CodeSnippet/helpers/convert-to-har-request.js +15 -16
  120. package/dist/views/Components/CodeSnippet/helpers/get-har-request.js +61 -64
  121. package/dist/views/Components/CodeSnippet/helpers/get-snippet.js +9 -10
  122. package/dist/views/Cookies/CookieModal.vue.js +1 -1
  123. package/dist/views/Cookies/Cookies.vue2.js +90 -93
  124. package/dist/views/Environment/Environment.vue2.js +267 -295
  125. package/dist/views/Environment/EnvironmentModal.vue.js +63 -70
  126. package/dist/views/Environment/EnvironmentVariableDropdown.vue.js +38 -42
  127. package/dist/views/Request/Request.vue.js +1 -1
  128. package/dist/views/Request/Request.vue2.js +60 -67
  129. package/dist/views/Request/RequestRoot.vue.js +1 -1
  130. package/dist/views/Request/RequestRoot.vue2.js +78 -89
  131. package/dist/views/Request/RequestSection/RequestAuth/DeleteRequestAuthModal.vue.js +37 -44
  132. package/dist/views/Request/RequestSection/RequestAuth/OAuth2.vue.js +44 -45
  133. package/dist/views/Request/RequestSection/RequestAuth/OAuthScopesInput.vue.js +111 -127
  134. package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue.js +1 -1
  135. package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue2.js +120 -139
  136. package/dist/views/Request/RequestSection/RequestAuth/RequestAuthDataTable.vue.js +1 -1
  137. package/dist/views/Request/RequestSection/RequestAuth/RequestAuthTab.vue.js +97 -97
  138. package/dist/views/Request/RequestSection/RequestBody.vue.js +1 -1
  139. package/dist/views/Request/RequestSection/RequestBody.vue2.js +287 -310
  140. package/dist/views/Request/RequestSection/RequestCodeExample.vue.js +1 -1
  141. package/dist/views/Request/RequestSection/RequestCodeExample.vue2.js +86 -94
  142. package/dist/views/Request/RequestSection/RequestParams.vue.js +37 -38
  143. package/dist/views/Request/RequestSection/RequestPathParams.vue.js +36 -38
  144. package/dist/views/Request/RequestSection/RequestSection.vue.js +1 -1
  145. package/dist/views/Request/RequestSection/RequestSection.vue2.js +28 -31
  146. package/dist/views/Request/RequestSection/RequestTable.vue.js +1 -1
  147. package/dist/views/Request/RequestSection/RequestTable.vue2.js +49 -52
  148. package/dist/views/Request/RequestSection/RequestTableTooltip.vue.js +1 -1
  149. package/dist/views/Request/RequestSection/helpers/filter-security-requirements.js +16 -16
  150. package/dist/views/Request/RequestSection/helpers/getting-started.js +7 -11
  151. package/dist/views/Request/RequestSection/helpers/update-scheme.js +7 -8
  152. package/dist/views/Request/RequestSidebar.vue.js +1 -1
  153. package/dist/views/Request/RequestSidebar.vue2.js +199 -211
  154. package/dist/views/Request/RequestSidebarItem.vue.js +2 -2
  155. package/dist/views/Request/RequestSidebarItem.vue2.js +332 -349
  156. package/dist/views/Request/RequestSidebarItemMenu.vue.js +1 -1
  157. package/dist/views/Request/RequestSidebarItemMenu.vue2.js +210 -240
  158. package/dist/views/Request/RequestSubpageHeader.vue.js +1 -1
  159. package/dist/views/Request/ResponseSection/RequestHeaders.vue.js +38 -41
  160. package/dist/views/Request/ResponseSection/ResponseBody.vue.js +1 -1
  161. package/dist/views/Request/ResponseSection/ResponseBody.vue2.js +58 -64
  162. package/dist/views/Request/ResponseSection/ResponseBodyDownload.vue.js +1 -2
  163. package/dist/views/Request/ResponseSection/ResponseBodyPreview.vue.js +1 -1
  164. package/dist/views/Request/ResponseSection/ResponseBodyRaw.vue.js +1 -1
  165. package/dist/views/Request/ResponseSection/ResponseBodyRaw.vue2.js +20 -23
  166. package/dist/views/Request/ResponseSection/ResponseBodyVirtual.vue3.js +1 -1
  167. package/dist/views/Request/ResponseSection/ResponseEmpty.vue.js +1 -1
  168. package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +29 -30
  169. package/dist/views/Request/ResponseSection/ResponseHeaders.vue.js +38 -41
  170. package/dist/views/Request/ResponseSection/ResponseLoadingOverlay.vue.js +1 -1
  171. package/dist/views/Request/ResponseSection/ResponseMetaInformation.vue.js +28 -29
  172. package/dist/views/Request/ResponseSection/ResponseSection.vue.js +1 -1
  173. package/dist/views/Request/ResponseSection/ResponseSection.vue2.js +128 -140
  174. package/dist/views/Request/components/WorkspaceDropdown.vue.js +116 -124
  175. package/dist/views/Request/consts/mediaTypes.js +2 -3
  176. package/dist/views/Request/handle-drag.js +24 -28
  177. package/dist/views/Request/hooks/useOpenApiWatcher.js +26 -33
  178. package/dist/views/Request/libs/auth.js +37 -43
  179. package/dist/views/Request/libs/oauth2.js +30 -32
  180. package/dist/views/Request/libs/watch-mode.js +100 -103
  181. package/dist/views/Settings/SettingsGeneral.vue.js +206 -236
  182. package/package.json +22 -22
  183. package/dist/components/AddressBar/AddressBar.vue3.js +0 -4
  184. package/dist/components/AddressBar/AddressBarHistory.vue3.js +0 -4
  185. package/dist/components/CodeInput/CodeInput.vue3.js +0 -4
  186. package/dist/components/CodeInput/CodeInput.vue4.js +0 -4
  187. package/dist/components/CommandPalette/CommandPaletteImportCurl.vue3.js +0 -4
  188. package/dist/components/CommandPalette/TheCommandPalette.vue3.js +0 -4
  189. package/dist/components/DataTable/DataTableInput.vue3.js +0 -4
  190. package/dist/components/EmptyState.vue3.js +0 -4
  191. package/dist/components/Form/LabelInput.vue3.js +0 -4
  192. package/dist/components/HttpMethod/HttpMethod.vue3.js +0 -4
  193. package/dist/components/ImportCollection/ImportCollectionModal.vue2.js +0 -4
  194. package/dist/components/OpenApiClientButton.vue3.js +0 -4
  195. package/dist/components/ScalarAsciiArt.vue3.js +0 -4
  196. package/dist/components/SectionFilter.vue3.js +0 -4
  197. package/dist/components/Server/ServerDropdownItem.vue3.js +0 -4
  198. package/dist/components/SideNav/DownloadAppButton.vue3.js +0 -4
  199. package/dist/components/Sidebar/Actions/SidebarListElementForm.vue3.js +0 -4
  200. package/dist/components/Sidebar/Sidebar.vue3.js +0 -4
  201. package/dist/components/Sidebar/SidebarListElement.vue3.js +0 -4
  202. package/dist/components/Sidebar/SidebarListElement.vue4.js +0 -4
  203. package/dist/components/TopNav/TopNavItem.vue3.js +0 -4
  204. package/dist/layouts/App/ApiClientApp.vue2.js +0 -4
  205. package/dist/layouts/Modal/ApiClientModal.vue3.js +0 -4
  206. package/dist/layouts/Web/ApiClientWeb.vue2.js +0 -4
  207. package/dist/style.css.js +0 -4
  208. package/dist/views/Collection/CollectionAuthentication.vue3.js +0 -4
  209. package/dist/views/Collection/CollectionEnvironment.vue3.js +0 -4
  210. package/dist/views/Collection/CollectionInfoForm.vue3.js +0 -4
  211. package/dist/views/Collection/CollectionSettings.vue3.js +0 -4
  212. package/dist/views/Collection/components/EnvironmentForm.vue3.js +0 -4
  213. package/dist/views/Collection/components/MarkdownInput.vue3.js +0 -4
  214. package/dist/views/Cookies/CookieModal.vue3.js +0 -4
  215. package/dist/views/Request/Request.vue3.js +0 -4
  216. package/dist/views/Request/RequestRoot.vue3.js +0 -4
  217. package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue3.js +0 -4
  218. package/dist/views/Request/RequestSection/RequestAuth/RequestAuthDataTable.vue3.js +0 -4
  219. package/dist/views/Request/RequestSection/RequestBody.vue3.js +0 -4
  220. package/dist/views/Request/RequestSection/RequestCodeExample.vue3.js +0 -4
  221. package/dist/views/Request/RequestSection/RequestSection.vue3.js +0 -4
  222. package/dist/views/Request/RequestSection/RequestTable.vue3.js +0 -4
  223. package/dist/views/Request/RequestSection/RequestTableTooltip.vue3.js +0 -4
  224. package/dist/views/Request/RequestSidebar.vue3.js +0 -4
  225. package/dist/views/Request/RequestSidebarItem.vue3.js +0 -4
  226. package/dist/views/Request/RequestSidebarItem.vue4.js +0 -4
  227. package/dist/views/Request/RequestSidebarItemMenu.vue3.js +0 -4
  228. package/dist/views/Request/RequestSubpageHeader.vue3.js +0 -4
  229. package/dist/views/Request/ResponseSection/ResponseBody.vue3.js +0 -4
  230. package/dist/views/Request/ResponseSection/ResponseBodyPreview.vue3.js +0 -4
  231. package/dist/views/Request/ResponseSection/ResponseBodyRaw.vue3.js +0 -4
  232. package/dist/views/Request/ResponseSection/ResponseBodyVirtual.vue2.js +0 -4
  233. package/dist/views/Request/ResponseSection/ResponseEmpty.vue3.js +0 -4
  234. package/dist/views/Request/ResponseSection/ResponseLoadingOverlay.vue3.js +0 -4
  235. package/dist/views/Request/ResponseSection/ResponseSection.vue3.js +0 -4
@@ -1,27 +1,26 @@
1
- import { defineComponent as v, ref as u, createBlock as b, openBlock as _, withCtx as l, createVNode as r, createTextVNode as k, unref as c } from "vue";
2
- import { ScalarButton as C } from "@scalar/components";
3
- import { LibraryIcon as V } from "@scalar/icons/library";
4
- import { useToasts as x } from "@scalar/use-toasts";
5
- import N from "../IconSelector.vue.js";
6
- import { useActiveEntities as B } from "../../store/active-entities.js";
7
- import S from "./CommandActionForm.vue.js";
8
- import $ from "./CommandActionInput.vue.js";
9
- import { useWorkspace as w } from "../../store/store.js";
10
- const D = /* @__PURE__ */ v({
1
+ import { defineComponent as p, ref as m, createBlock as v, openBlock as b, withCtx as l, createVNode as r, createTextVNode as _, unref as u } from "vue";
2
+ import { ScalarButton as k } from "@scalar/components";
3
+ import { LibraryIcon as C } from "@scalar/icons/library";
4
+ import { useToasts as V } from "@scalar/use-toasts";
5
+ import x from "../IconSelector.vue.js";
6
+ import { useActiveEntities as N } from "../../store/active-entities.js";
7
+ import B from "./CommandActionForm.vue.js";
8
+ import S from "./CommandActionInput.vue.js";
9
+ import { useWorkspace as $ } from "../../store/store.js";
10
+ const D = /* @__PURE__ */ p({
11
11
  __name: "CommandPaletteCollection",
12
12
  emits: ["close", "back"],
13
- setup(I, { emit: d }) {
14
- const i = d, { activeWorkspace: s } = B(), { collectionMutators: f } = w(), o = u(""), a = u("interface-content-folder"), { toast: m } = x(), p = () => {
15
- var n, e;
13
+ setup(w, { emit: c }) {
14
+ const n = c, { activeWorkspace: i } = N(), { collectionMutators: d } = $(), o = m(""), a = m("interface-content-folder"), { toast: s } = V(), f = () => {
16
15
  if (!o.value) {
17
- m("Please enter a name before creating a collection.", "error");
16
+ s("Please enter a name before creating a collection.", "error");
18
17
  return;
19
18
  }
20
- if (!((n = s.value) != null && n.uid)) {
21
- m("No active workspace found.", "error");
19
+ if (!i.value?.uid) {
20
+ s("No active workspace found.", "error");
22
21
  return;
23
22
  }
24
- f.add(
23
+ d.add(
25
24
  {
26
25
  openapi: "3.1.0",
27
26
  info: {
@@ -30,26 +29,26 @@ const D = /* @__PURE__ */ v({
30
29
  },
31
30
  "x-scalar-icon": a.value
32
31
  },
33
- (e = s.value) == null ? void 0 : e.uid
34
- ), i("close");
32
+ i.value?.uid
33
+ ), n("close");
35
34
  };
36
- return (n, e) => (_(), b(S, {
35
+ return (I, e) => (b(), v(B, {
37
36
  disabled: !o.value.trim(),
38
- onSubmit: p
37
+ onSubmit: f
39
38
  }, {
40
39
  options: l(() => [
41
- r(N, {
40
+ r(x, {
42
41
  modelValue: a.value,
43
42
  "onUpdate:modelValue": e[2] || (e[2] = (t) => a.value = t),
44
43
  placement: "bottom-start"
45
44
  }, {
46
45
  default: l(() => [
47
- r(c(C), {
46
+ r(u(k), {
48
47
  class: "aspect-square h-auto px-0",
49
48
  variant: "outlined"
50
49
  }, {
51
50
  default: l(() => [
52
- r(c(V), {
51
+ r(u(C), {
53
52
  class: "text-c-2 size-4 stroke-[1.75]",
54
53
  src: a.value
55
54
  }, null, 8, ["src"])
@@ -61,15 +60,15 @@ const D = /* @__PURE__ */ v({
61
60
  }, 8, ["modelValue"])
62
61
  ]),
63
62
  submit: l(() => e[3] || (e[3] = [
64
- k(" Create Collection ")
63
+ _(" Create Collection ")
65
64
  ])),
66
65
  default: l(() => [
67
- r($, {
66
+ r(S, {
68
67
  modelValue: o.value,
69
68
  "onUpdate:modelValue": e[0] || (e[0] = (t) => o.value = t),
70
69
  label: "Collection Name",
71
70
  placeholder: "Collection Name",
72
- onOnDelete: e[1] || (e[1] = (t) => i("back", t))
71
+ onOnDelete: e[1] || (e[1] = (t) => n("back", t))
73
72
  }, null, 8, ["modelValue"])
74
73
  ]),
75
74
  _: 1
@@ -1,71 +1,69 @@
1
- import { defineComponent as q, ref as x, computed as B, createBlock as b, createCommentVNode as P, openBlock as i, withCtx as l, createVNode as r, createTextVNode as u, unref as n, createElementVNode as k, toDisplayString as h, createElementBlock as W, Fragment as $, renderList as I } from "vue";
2
- import { ScalarDropdown as j, ScalarButton as z, ScalarIcon as M, ScalarDropdownItem as T } from "@scalar/components";
3
- import { isDefined as U } from "@scalar/oas-utils/helpers";
4
- import { useToasts as A } from "@scalar/use-toasts";
5
- import { useRouter as F } from "vue-router";
6
- import _ from "../HttpMethod/HttpMethod.vue.js";
7
- import { PathId as c } from "../../routes.js";
8
- import { useActiveEntities as H } from "../../store/active-entities.js";
9
- import L from "./CommandActionForm.vue.js";
10
- import O from "./CommandActionInput.vue.js";
11
- import { useWorkspace as G } from "../../store/store.js";
12
- const J = { class: "flex items-center gap-2" }, K = { class: "custom-scroll max-h-40" }, ne = /* @__PURE__ */ q({
1
+ import { defineComponent as q, ref as v, computed as R, createBlock as x, createCommentVNode as B, openBlock as n, withCtx as l, createVNode as r, createTextVNode as u, unref as m, createElementVNode as b, toDisplayString as k, createElementBlock as P, Fragment as W, renderList as $ } from "vue";
2
+ import { ScalarDropdown as I, ScalarButton as j, ScalarIcon as z, ScalarDropdownItem as M } from "@scalar/components";
3
+ import { isDefined as T } from "@scalar/oas-utils/helpers";
4
+ import { useToasts as U } from "@scalar/use-toasts";
5
+ import { useRouter as A } from "vue-router";
6
+ import h from "../HttpMethod/HttpMethod.vue.js";
7
+ import { PathId as i } from "../../routes.js";
8
+ import { useActiveEntities as F } from "../../store/active-entities.js";
9
+ import H from "./CommandActionForm.vue.js";
10
+ import L from "./CommandActionInput.vue.js";
11
+ import { useWorkspace as O } from "../../store/store.js";
12
+ const G = { class: "flex items-center gap-2" }, J = { class: "custom-scroll max-h-40" }, me = /* @__PURE__ */ q({
13
13
  __name: "CommandPaletteExample",
14
14
  props: {
15
15
  metaData: {}
16
16
  },
17
17
  emits: ["close", "back"],
18
- setup(C, { emit: E }) {
19
- var v;
20
- const w = C, p = E, { push: D } = F(), { activeRequest: S, activeWorkspace: g, activeWorkspaceRequests: y } = H(), { requests: s, requestExampleMutators: N } = G(), { toast: d } = A(), m = x(""), a = x(
18
+ setup(_, { emit: C }) {
19
+ const E = _, c = C, { push: w } = A(), { activeRequest: D, activeWorkspace: S, activeWorkspaceRequests: g } = F(), { requests: p, requestExampleMutators: y } = O(), { toast: d } = U(), s = v(""), t = v(
21
20
  // Ensure we pre-select the correct request
22
- s[((v = w.metaData) == null ? void 0 : v.itemUid) ?? ""] ?? S.value
23
- ), f = (o) => a.value = o, V = () => {
24
- var e;
25
- if (!m.value) {
21
+ p[E.metaData?.itemUid ?? ""] ?? D.value
22
+ ), f = (o) => t.value = o, N = () => {
23
+ if (!s.value) {
26
24
  d("Please enter a name before creating an example.", "error");
27
25
  return;
28
26
  }
29
- if (!a.value) {
27
+ if (!t.value) {
30
28
  d("Please select a request before creating an example.", "error");
31
29
  return;
32
30
  }
33
- const o = N.add(
34
- a.value,
35
- m.value
31
+ const o = y.add(
32
+ t.value,
33
+ s.value
36
34
  );
37
- o && (D({
35
+ o && (w({
38
36
  name: "request.examples",
39
37
  params: {
40
- [c.Workspace]: (e = g.value) == null ? void 0 : e.uid,
41
- [c.Request]: a.value.uid,
42
- [c.Examples]: o.uid
38
+ [i.Workspace]: S.value?.uid,
39
+ [i.Request]: t.value.uid,
40
+ [i.Examples]: o.uid
43
41
  }
44
- }), p("close"));
45
- }, R = B(
46
- () => y.value.map((o) => s == null ? void 0 : s[o]).filter(U)
42
+ }), c("close"));
43
+ }, V = R(
44
+ () => g.value.map((o) => p?.[o]).filter(T)
47
45
  );
48
- return (o, e) => a.value ? (i(), b(L, {
46
+ return (o, a) => t.value ? (n(), x(H, {
49
47
  key: 0,
50
- disabled: !m.value.trim(),
51
- onSubmit: V
48
+ disabled: !s.value.trim(),
49
+ onSubmit: N
52
50
  }, {
53
51
  options: l(() => [
54
- r(n(j), {
52
+ r(m(I), {
55
53
  placement: "bottom",
56
54
  resize: ""
57
55
  }, {
58
56
  items: l(() => [
59
- k("div", K, [
60
- (i(!0), W($, null, I(R.value, (t) => (i(), b(n(T), {
61
- key: t.uid,
57
+ b("div", J, [
58
+ (n(!0), P(W, null, $(V.value, (e) => (n(), x(m(M), {
59
+ key: e.uid,
62
60
  class: "flex h-7 w-full items-center justify-between px-1 pr-[26px]",
63
- onClick: (Q) => f(t)
61
+ onClick: (K) => f(e)
64
62
  }, {
65
63
  default: l(() => [
66
- u(h(t.summary) + " ", 1),
67
- r(_, {
68
- method: t.method
64
+ u(k(e.summary) + " ", 1),
65
+ r(h, {
66
+ method: e.method
69
67
  }, null, 8, ["method"])
70
68
  ]),
71
69
  _: 2
@@ -73,18 +71,18 @@ const J = { class: "flex items-center gap-2" }, K = { class: "custom-scroll max-
73
71
  ])
74
72
  ]),
75
73
  default: l(() => [
76
- r(n(z), {
74
+ r(m(j), {
77
75
  class: "hover:bg-b-2 max-h-8 w-full justify-between gap-1 p-2 text-xs",
78
76
  variant: "outlined",
79
- onClick: e[2] || (e[2] = (t) => f(a.value))
77
+ onClick: a[2] || (a[2] = (e) => f(t.value))
80
78
  }, {
81
79
  default: l(() => [
82
- u(h(a.value.summary) + " ", 1),
83
- k("div", J, [
84
- r(_, {
85
- method: a.value.method
80
+ u(k(t.value.summary) + " ", 1),
81
+ b("div", G, [
82
+ r(h, {
83
+ method: t.value.method
86
84
  }, null, 8, ["method"]),
87
- r(n(M), {
85
+ r(m(z), {
88
86
  class: "text-c-3",
89
87
  icon: "ChevronDown",
90
88
  size: "md"
@@ -97,22 +95,22 @@ const J = { class: "flex items-center gap-2" }, K = { class: "custom-scroll max-
97
95
  _: 1
98
96
  })
99
97
  ]),
100
- submit: l(() => e[3] || (e[3] = [
98
+ submit: l(() => a[3] || (a[3] = [
101
99
  u("Create Example")
102
100
  ])),
103
101
  default: l(() => [
104
- r(O, {
105
- modelValue: m.value,
106
- "onUpdate:modelValue": e[0] || (e[0] = (t) => m.value = t),
102
+ r(L, {
103
+ modelValue: s.value,
104
+ "onUpdate:modelValue": a[0] || (a[0] = (e) => s.value = e),
107
105
  label: "Example Name",
108
106
  placeholder: "Example Name",
109
- onOnDelete: e[1] || (e[1] = (t) => p("back", t))
107
+ onOnDelete: a[1] || (a[1] = (e) => c("back", e))
110
108
  }, null, 8, ["modelValue"])
111
109
  ]),
112
110
  _: 1
113
- }, 8, ["disabled"])) : P("", !0);
111
+ }, 8, ["disabled"])) : B("", !0);
114
112
  }
115
113
  });
116
114
  export {
117
- ne as default
115
+ me as default
118
116
  };
@@ -1,151 +1,147 @@
1
- import { defineComponent as G, ref as D, computed as I, watch as O, createBlock as P, openBlock as i, unref as s, withCtx as v, createElementBlock as f, Fragment as g, createElementVNode as S, createCommentVNode as H, createVNode as C, createTextVNode as p, toDisplayString as V } from "vue";
2
- import { useLoadingState as K, ScalarButton as T, ScalarCodeBlock as Q, ScalarIcon as X, ScalarTooltip as Z } from "@scalar/components";
3
- import { useToasts as ee } from "@scalar/use-toasts";
4
- import { useRouter as te } from "vue-router";
5
- import { importCurlCommand as oe } from "../../libs/importers/curl.js";
6
- import { useActiveEntities as ae } from "../../store/active-entities.js";
7
- import le from "./CommandActionForm.vue.js";
8
- import ne from "./CommandActionInput.vue.js";
9
- import re from "./WatchModeToggle.vue.js";
10
- import { isPostmanCollection as L, getPostmanDocumentDetails as ie, convertPostmanToOpenApi as F } from "../../libs/postman.js";
11
- import { getOpenApiDocumentDetails as se } from "../../libs/getOpenApiDocumentDetails.js";
12
- import { isUrl as U } from "../../libs/isUrl.js";
13
- import { useFileDialog as ue } from "../../hooks/useFileDialog.js";
14
- import { PathId as W } from "../../routes.js";
15
- import { useWorkspace as ce } from "../../store/store.js";
16
- const me = { class: "flex justify-between" }, de = { class: "flex w-full flex-row items-center justify-between gap-3" }, Ae = /* @__PURE__ */ G({
1
+ import { defineComponent as J, ref as L, computed as x, watch as A, createBlock as I, openBlock as l, unref as r, withCtx as p, createElementBlock as d, Fragment as v, createElementVNode as U, createCommentVNode as Y, createVNode as w, createTextVNode as c, toDisplayString as R } from "vue";
2
+ import { useLoadingState as q, ScalarButton as _, ScalarCodeBlock as G, ScalarIcon as H, ScalarTooltip as K } from "@scalar/components";
3
+ import { useToasts as Q } from "@scalar/use-toasts";
4
+ import { useRouter as X } from "vue-router";
5
+ import { importCurlCommand as Z } from "../../libs/importers/curl.js";
6
+ import { useActiveEntities as ee } from "../../store/active-entities.js";
7
+ import te from "./CommandActionForm.vue.js";
8
+ import oe from "./CommandActionInput.vue.js";
9
+ import ae from "./WatchModeToggle.vue.js";
10
+ import { isPostmanCollection as P, getPostmanDocumentDetails as le, convertPostmanToOpenApi as D } from "../../libs/postman.js";
11
+ import { getOpenApiDocumentDetails as re } from "../../libs/getOpenApiDocumentDetails.js";
12
+ import { isUrl as h } from "../../libs/isUrl.js";
13
+ import { useFileDialog as ne } from "../../hooks/useFileDialog.js";
14
+ import { PathId as O } from "../../routes.js";
15
+ import { useWorkspace as ie } from "../../store/store.js";
16
+ const se = { class: "flex justify-between" }, ue = { class: "flex w-full flex-row items-center justify-between gap-3" }, Pe = /* @__PURE__ */ J({
17
17
  __name: "CommandPaletteImport",
18
18
  emits: ["close", "back"],
19
- setup(pe, { emit: N }) {
20
- const k = N, $ = te(), { activeWorkspace: c, activeCollection: B } = ae(), { importSpecFile: w, importSpecFromUrl: M, events: j } = ce(), { toast: m } = ee(), d = K(), a = D(""), y = D(!0), r = I(() => L(a.value) ? ie(a.value) : se(a.value)), A = I(
21
- () => r.value ? r.value.type : "json"
19
+ setup(ce, { emit: V }) {
20
+ const C = V, T = X(), { activeWorkspace: n, activeCollection: F } = ee(), { importSpecFile: k, importSpecFromUrl: W, events: N } = ie(), { toast: i } = Q(), s = q(), o = L(""), f = L(!0), a = x(() => P(o.value) ? le(o.value) : re(o.value)), S = x(
21
+ () => a.value ? a.value.type : "json"
22
22
  );
23
- function x(t) {
24
- var e;
25
- t && $.push({
23
+ function g(e) {
24
+ e && T.push({
26
25
  name: "collection",
27
26
  params: {
28
- [W.Workspace]: (e = c.value) == null ? void 0 : e.uid,
29
- [W.Collection]: t.uid
27
+ [O.Workspace]: n.value?.uid,
28
+ [O.Collection]: e.uid
30
29
  }
31
30
  });
32
31
  }
33
- const h = I(() => U(a.value)), E = I(() => !!r.value), { open: z } = ue({
34
- onChange: async (t) => {
35
- const e = t == null ? void 0 : t[0];
36
- if (e) {
37
- const n = new FileReader();
38
- n.onload = async (b) => {
39
- var u, R, _;
40
- const o = (u = b.target) == null ? void 0 : u.result;
32
+ const y = x(() => h(o.value)), $ = x(() => !!a.value), { open: B } = ne({
33
+ onChange: async (e) => {
34
+ const t = e?.[0];
35
+ if (t) {
36
+ const u = new FileReader();
37
+ u.onload = async (E) => {
38
+ const b = E.target?.result;
41
39
  try {
42
- if (L(o)) {
43
- const l = await w(
44
- await F(o),
45
- ((R = c.value) == null ? void 0 : R.uid) ?? ""
40
+ if (P(b)) {
41
+ const m = await k(
42
+ await D(b),
43
+ n.value?.uid ?? ""
46
44
  );
47
- x(l == null ? void 0 : l.collection);
45
+ g(m?.collection);
48
46
  } else {
49
- const l = await w(
50
- o,
51
- ((_ = c.value) == null ? void 0 : _.uid) ?? ""
47
+ const m = await k(
48
+ b,
49
+ n.value?.uid ?? ""
52
50
  );
53
- x(l == null ? void 0 : l.collection);
51
+ g(m?.collection);
54
52
  }
55
- m("Import successful", "info"), k("close");
56
- } catch (l) {
57
- console.error(l);
58
- const q = (l == null ? void 0 : l.message) || "Unknown error";
59
- m(`Import failed: ${q}`, "error");
53
+ i("Import successful", "info"), C("close");
54
+ } catch (m) {
55
+ console.error(m);
56
+ const z = m?.message || "Unknown error";
57
+ i(`Import failed: ${z}`, "error");
60
58
  }
61
- }, n.readAsText(e);
59
+ }, u.readAsText(t);
62
60
  }
63
61
  },
64
62
  multiple: !1,
65
63
  accept: ".json,.yaml,.yml"
66
64
  });
67
- O(h, (t) => {
68
- t || (y.value = !1);
69
- }), O(a, (t) => {
70
- U(t) || (y.value = !1);
65
+ A(y, (e) => {
66
+ e || (f.value = !1);
67
+ }), A(o, (e) => {
68
+ h(e) || (f.value = !1);
71
69
  });
72
- async function J() {
73
- var t, e, n, b;
74
- if (!(!a.value || d.isLoading)) {
75
- d.startLoading();
70
+ async function M() {
71
+ if (!(!o.value || s.isLoading)) {
72
+ s.startLoading();
76
73
  try {
77
- if (h.value) {
78
- const [o, u] = await M(
79
- a.value,
80
- ((t = c.value) == null ? void 0 : t.uid) ?? "",
74
+ if (y.value) {
75
+ const [e, t] = await W(
76
+ o.value,
77
+ n.value?.uid ?? "",
81
78
  {
82
- proxyUrl: (e = c.value) == null ? void 0 : e.proxyUrl,
83
- watchMode: y.value
79
+ proxyUrl: n.value?.proxyUrl,
80
+ watchMode: f.value
84
81
  }
85
82
  );
86
- if (x(u == null ? void 0 : u.collection), o) {
87
- m(
83
+ if (g(t?.collection), e) {
84
+ i(
88
85
  "There was a possible CORS error while importing your spec, please make sure this server is allowed in the CORS policy of your OpenAPI document.",
89
86
  "error",
90
87
  { timeout: 5e3 }
91
- ), d.invalidate(2e3, !0);
88
+ ), s.invalidate(2e3, !0);
92
89
  return;
93
90
  }
94
- } else if (E.value)
95
- if (L(a.value)) {
96
- const o = await w(
97
- await F(a.value),
98
- ((n = c.value) == null ? void 0 : n.uid) ?? ""
91
+ } else if ($.value)
92
+ if (P(o.value)) {
93
+ const e = await k(
94
+ await D(o.value),
95
+ n.value?.uid ?? ""
99
96
  );
100
- x(o == null ? void 0 : o.collection), m("Successfully converted Postman collection", "info");
97
+ g(e?.collection), i("Successfully converted Postman collection", "info");
101
98
  } else {
102
- const o = await w(
103
- a.value,
104
- ((b = c.value) == null ? void 0 : b.uid) ?? ""
99
+ const e = await k(
100
+ o.value,
101
+ n.value?.uid ?? ""
105
102
  );
106
- x(o == null ? void 0 : o.collection);
103
+ g(e?.collection);
107
104
  }
108
105
  else {
109
- m("Import failed: Invalid URL or OpenAPI document", "error"), d.invalidate(2e3, !0);
106
+ i("Import failed: Invalid URL or OpenAPI document", "error"), s.invalidate(2e3, !0);
110
107
  return;
111
108
  }
112
- d.clear(), k("close"), m("Import successful", "info");
113
- } catch (o) {
114
- console.error("[importCollection]", o);
115
- const u = (o == null ? void 0 : o.message) || "Unknown error";
116
- d.invalidate(2e3, !0), m(`Import failed: ${u}`, "error");
109
+ s.clear(), C("close"), i("Import successful", "info");
110
+ } catch (e) {
111
+ console.error("[importCollection]", e);
112
+ const t = e?.message || "Unknown error";
113
+ s.invalidate(2e3, !0), i(`Import failed: ${t}`, "error");
117
114
  }
118
115
  }
119
116
  }
120
- const Y = (t) => {
121
- var e;
122
- if (t.trim().toLowerCase().startsWith("curl")) {
123
- j.commandPalette.emit({
117
+ const j = (e) => {
118
+ if (e.trim().toLowerCase().startsWith("curl")) {
119
+ N.commandPalette.emit({
124
120
  commandName: "Import from cURL",
125
121
  metaData: {
126
- parsedCurl: oe(t),
127
- collectionUid: (e = B.value) == null ? void 0 : e.uid
122
+ parsedCurl: Z(e),
123
+ collectionUid: F.value?.uid
128
124
  }
129
125
  });
130
126
  return;
131
127
  }
132
- a.value = t;
128
+ o.value = e;
133
129
  };
134
- return (t, e) => (i(), P(le, {
135
- disabled: !a.value.trim(),
136
- loading: s(d),
137
- onSubmit: J
130
+ return (e, t) => (l(), I(te, {
131
+ disabled: !o.value.trim(),
132
+ loading: r(s),
133
+ onSubmit: M
138
134
  }, {
139
- options: v(() => [
140
- S("div", de, [
141
- C(s(T), {
135
+ options: p(() => [
136
+ U("div", ue, [
137
+ w(r(_), {
142
138
  class: "hover:bg-b-2 relative max-h-8 gap-1.5 p-2 text-xs",
143
139
  variant: "outlined",
144
- onClick: s(z)
140
+ onClick: r(B)
145
141
  }, {
146
- default: v(() => [
147
- e[5] || (e[5] = p(" JSON, or YAML File ")),
148
- C(s(X), {
142
+ default: p(() => [
143
+ t[5] || (t[5] = c(" JSON, or YAML File ")),
144
+ w(r(H), {
149
145
  class: "text-c-3",
150
146
  icon: "Upload",
151
147
  size: "md"
@@ -154,64 +150,64 @@ const me = { class: "flex justify-between" }, de = { class: "flex w-full flex-ro
154
150
  _: 1,
155
151
  __: [5]
156
152
  }, 8, ["onClick"]),
157
- C(s(Z), {
158
- content: h.value ? "Watch mode automatically updates the API client when the OpenAPI URL content changes, ensuring your client remains up-to-date." : "Watch mode is only available for URL imports. When enabled it automatically updates the API client when the OpenAPI URL content changes.",
153
+ w(r(K), {
154
+ content: y.value ? "Watch mode automatically updates the API client when the OpenAPI URL content changes, ensuring your client remains up-to-date." : "Watch mode is only available for URL imports. When enabled it automatically updates the API client when the OpenAPI URL content changes.",
159
155
  placement: "bottom"
160
156
  }, {
161
- default: v(() => [
162
- C(re, {
163
- modelValue: y.value,
164
- "onUpdate:modelValue": e[2] || (e[2] = (n) => y.value = n),
165
- disabled: !h.value
157
+ default: p(() => [
158
+ w(ae, {
159
+ modelValue: f.value,
160
+ "onUpdate:modelValue": t[2] || (t[2] = (u) => f.value = u),
161
+ disabled: !y.value
166
162
  }, null, 8, ["modelValue", "disabled"])
167
163
  ]),
168
164
  _: 1
169
165
  }, 8, ["content"])
170
166
  ])
171
167
  ]),
172
- submit: v(() => [
173
- e[6] || (e[6] = p(" Import ")),
174
- h.value ? (i(), f(g, { key: 0 }, [
175
- p(" from URL ")
176
- ], 64)) : r.value && A.value ? (i(), f(g, { key: 1 }, [
177
- r.value.title ? (i(), f(g, { key: 0 }, [
178
- p(' "' + V(r.value.title) + '" ', 1)
179
- ], 64)) : (i(), f(g, { key: 1 }, [
180
- p(V(r.value.version), 1)
168
+ submit: p(() => [
169
+ t[6] || (t[6] = c(" Import ")),
170
+ y.value ? (l(), d(v, { key: 0 }, [
171
+ c(" from URL ")
172
+ ], 64)) : a.value && S.value ? (l(), d(v, { key: 1 }, [
173
+ a.value.title ? (l(), d(v, { key: 0 }, [
174
+ c(' "' + R(a.value.title) + '" ', 1)
175
+ ], 64)) : (l(), d(v, { key: 1 }, [
176
+ c(R(a.value.version), 1)
181
177
  ], 64))
182
- ], 64)) : (i(), f(g, { key: 2 }, [
183
- p(" Collection ")
178
+ ], 64)) : (l(), d(v, { key: 2 }, [
179
+ c(" Collection ")
184
180
  ], 64))
185
181
  ]),
186
- default: v(() => [
187
- !r.value || s(U)(a.value) ? (i(), P(ne, {
182
+ default: p(() => [
183
+ !a.value || r(h)(o.value) ? (l(), I(oe, {
188
184
  key: 0,
189
- modelValue: a.value,
185
+ modelValue: o.value,
190
186
  placeholder: "OpenAPI/Swagger/Postman URL or cURL",
191
- onOnDelete: e[0] || (e[0] = (n) => k("back", n)),
192
- "onUpdate:modelValue": Y
193
- }, null, 8, ["modelValue"])) : (i(), f(g, { key: 1 }, [
194
- S("div", me, [
195
- e[4] || (e[4] = S("div", { class: "text-c-2 min-h-8 w-full py-2 pl-12 text-center text-xs" }, " Preview ", -1)),
196
- C(s(T), {
187
+ onOnDelete: t[0] || (t[0] = (u) => C("back", u)),
188
+ "onUpdate:modelValue": j
189
+ }, null, 8, ["modelValue"])) : (l(), d(v, { key: 1 }, [
190
+ U("div", se, [
191
+ t[4] || (t[4] = U("div", { class: "text-c-2 min-h-8 w-full py-2 pl-12 text-center text-xs" }, " Preview ", -1)),
192
+ w(r(_), {
197
193
  class: "hover:bg-b-2 relative ml-auto max-h-8 gap-1.5 p-2 text-xs",
198
194
  variant: "ghost",
199
- onClick: e[1] || (e[1] = (n) => a.value = "")
195
+ onClick: t[1] || (t[1] = (u) => o.value = "")
200
196
  }, {
201
- default: v(() => e[3] || (e[3] = [
202
- p(" Clear ")
197
+ default: p(() => t[3] || (t[3] = [
198
+ c(" Clear ")
203
199
  ])),
204
200
  _: 1,
205
201
  __: [3]
206
202
  })
207
203
  ]),
208
- r.value && !s(U)(a.value) ? (i(), P(s(Q), {
204
+ a.value && !r(h)(o.value) ? (l(), I(r(G), {
209
205
  key: 0,
210
206
  class: "bg-b-2 mt-1 max-h-[40dvh] rounded border px-2 py-1 text-sm",
211
- content: a.value,
207
+ content: o.value,
212
208
  copy: !1,
213
- lang: A.value
214
- }, null, 8, ["content", "lang"])) : H("", !0)
209
+ lang: S.value
210
+ }, null, 8, ["content", "lang"])) : Y("", !0)
215
211
  ], 64))
216
212
  ]),
217
213
  _: 1
@@ -219,5 +215,5 @@ const me = { class: "flex justify-between" }, de = { class: "flex w-full flex-ro
219
215
  }
220
216
  });
221
217
  export {
222
- Ae as default
218
+ Pe as default
223
219
  };
@@ -1,5 +1,5 @@
1
1
  import o from "./CommandPaletteImportCurl.vue2.js";
2
- import "./CommandPaletteImportCurl.vue3.js";
2
+ /* empty css */
3
3
  import t from "../../_virtual/_plugin-vue_export-helper.js";
4
4
  const p = /* @__PURE__ */ t(o, [["__scopeId", "data-v-708cc906"]]);
5
5
  export {