@scalar/api-client 2.23.3 → 2.24.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 (97) hide show
  1. package/CHANGELOG.md +55 -0
  2. package/dist/layouts/Modal/ApiClientModal.vue.d.ts.map +1 -1
  3. package/dist/layouts/Modal/ApiClientModal.vue.js +2 -2
  4. package/dist/style.css +1 -1
  5. package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts +8 -0
  6. package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts.map +1 -1
  7. package/dist/v2/blocks/operation-block/OperationBlock.vue.js +33 -29
  8. package/dist/v2/blocks/operation-block/components/Header.vue.d.ts +6 -0
  9. package/dist/v2/blocks/operation-block/components/Header.vue.d.ts.map +1 -1
  10. package/dist/v2/blocks/operation-block/components/Header.vue.js +2 -2
  11. package/dist/v2/blocks/operation-block/components/Header.vue2.js +46 -29
  12. package/dist/v2/blocks/request-block/helpers/get-default-headers.js +1 -1
  13. package/dist/v2/blocks/scalar-address-bar-block/components/EnvironmentSelector.vue.d.ts +15 -0
  14. package/dist/v2/blocks/scalar-address-bar-block/components/EnvironmentSelector.vue.d.ts.map +1 -0
  15. package/dist/v2/blocks/scalar-address-bar-block/components/EnvironmentSelector.vue.js +125 -0
  16. package/dist/v2/blocks/scalar-address-bar-block/components/EnvironmentSelector.vue2.js +4 -0
  17. package/dist/v2/blocks/scalar-auth-selector-block/helpers/extract-security-scheme-secrets.d.ts +5 -1
  18. package/dist/v2/blocks/scalar-auth-selector-block/helpers/extract-security-scheme-secrets.d.ts.map +1 -1
  19. package/dist/v2/blocks/scalar-auth-selector-block/helpers/extract-security-scheme-secrets.js +61 -61
  20. package/dist/v2/components/sidebar/SidebarMenu.vue.js +6 -6
  21. package/dist/v2/features/app/App.vue.d.ts +5 -0
  22. package/dist/v2/features/app/App.vue.d.ts.map +1 -1
  23. package/dist/v2/features/app/App.vue.js +89 -108
  24. package/dist/v2/features/app/app-state.d.ts +5 -7
  25. package/dist/v2/features/app/app-state.d.ts.map +1 -1
  26. package/dist/v2/features/app/app-state.js +210 -205
  27. package/dist/v2/features/app/hooks/use-document-watcher.js +8 -8
  28. package/dist/v2/features/collection/components/Environment.vue.d.ts.map +1 -1
  29. package/dist/v2/features/collection/components/Environment.vue.js +12 -11
  30. package/dist/v2/features/collection/components/Settings.vue.d.ts.map +1 -1
  31. package/dist/v2/features/collection/components/Settings.vue.js +17 -25
  32. package/dist/v2/features/command-palette/components/CommandPaletteImport.vue.d.ts +1 -1
  33. package/dist/v2/features/command-palette/components/CommandPaletteImport.vue.d.ts.map +1 -1
  34. package/dist/v2/features/command-palette/components/CommandPaletteImport.vue.js +115 -118
  35. package/dist/v2/features/{import-listener → command-palette}/helpers/generate-unique-slug.d.ts.map +1 -1
  36. package/dist/v2/features/command-palette/helpers/get-openapi-from-postman.d.ts +14 -4
  37. package/dist/v2/features/command-palette/helpers/get-openapi-from-postman.d.ts.map +1 -1
  38. package/dist/v2/features/command-palette/helpers/get-openapi-from-postman.js +5 -6
  39. package/dist/v2/features/{import-listener → command-palette}/helpers/import-document-to-workspace.d.ts.map +1 -1
  40. package/dist/v2/features/command-palette/helpers/load-document-from-source.d.ts +16 -0
  41. package/dist/v2/features/command-palette/helpers/load-document-from-source.d.ts.map +1 -0
  42. package/dist/v2/features/command-palette/helpers/load-document-from-source.js +34 -0
  43. package/dist/v2/features/command-palette/index.d.ts +4 -0
  44. package/dist/v2/features/command-palette/index.d.ts.map +1 -0
  45. package/dist/v2/features/command-palette/index.js +8 -0
  46. package/dist/v2/features/environments/EnvironmentsList.vue.d.ts +4 -0
  47. package/dist/v2/features/environments/EnvironmentsList.vue.d.ts.map +1 -1
  48. package/dist/v2/features/environments/EnvironmentsList.vue.js +29 -27
  49. package/dist/v2/features/environments/components/Environment.vue.d.ts +1 -0
  50. package/dist/v2/features/environments/components/Environment.vue.d.ts.map +1 -1
  51. package/dist/v2/features/environments/components/Environment.vue.js +37 -24
  52. package/dist/v2/features/modal/Modal.vue.d.ts.map +1 -1
  53. package/dist/v2/features/modal/Modal.vue.js +1 -1
  54. package/dist/v2/features/modal/Modal.vue2.js +35 -36
  55. package/dist/v2/features/modal/helpers/create-api-client-modal.d.ts.map +1 -1
  56. package/dist/v2/features/modal/helpers/create-api-client-modal.js +58 -41
  57. package/dist/v2/features/modal/helpers/restore-workspace-state.d.ts +18 -0
  58. package/dist/v2/features/modal/helpers/restore-workspace-state.d.ts.map +1 -0
  59. package/dist/v2/features/modal/helpers/restore-workspace-state.js +36 -0
  60. package/dist/v2/features/operation/Operation.vue.d.ts.map +1 -1
  61. package/dist/v2/features/operation/Operation.vue.js +35 -26
  62. package/dist/v2/workspace-events.d.ts.map +1 -1
  63. package/dist/v2/workspace-events.js +7 -0
  64. package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
  65. package/package.json +20 -20
  66. package/dist/v2/features/import-listener/ImportListener.vue.d.ts +0 -52
  67. package/dist/v2/features/import-listener/ImportListener.vue.d.ts.map +0 -1
  68. package/dist/v2/features/import-listener/ImportListener.vue.js +0 -91
  69. package/dist/v2/features/import-listener/ImportListener.vue2.js +0 -4
  70. package/dist/v2/features/import-listener/components/DropEventListener.vue.d.ts +0 -7
  71. package/dist/v2/features/import-listener/components/DropEventListener.vue.d.ts.map +0 -1
  72. package/dist/v2/features/import-listener/components/DropEventListener.vue.js +0 -81
  73. package/dist/v2/features/import-listener/components/DropEventListener.vue2.js +0 -4
  74. package/dist/v2/features/import-listener/components/ImportModal.vue.d.ts +0 -40
  75. package/dist/v2/features/import-listener/components/ImportModal.vue.d.ts.map +0 -1
  76. package/dist/v2/features/import-listener/components/ImportModal.vue.js +0 -170
  77. package/dist/v2/features/import-listener/components/ImportModal.vue3.js +0 -5
  78. package/dist/v2/features/import-listener/components/WorkspaceSelector.vue.d.ts +0 -29
  79. package/dist/v2/features/import-listener/components/WorkspaceSelector.vue.d.ts.map +0 -1
  80. package/dist/v2/features/import-listener/components/WorkspaceSelector.vue.js +0 -83
  81. package/dist/v2/features/import-listener/components/WorkspaceSelector.vue2.js +0 -4
  82. package/dist/v2/features/import-listener/helpers/get-url-query-parameter.d.ts +0 -8
  83. package/dist/v2/features/import-listener/helpers/get-url-query-parameter.d.ts.map +0 -1
  84. package/dist/v2/features/import-listener/helpers/get-url-query-parameter.js +0 -4
  85. package/dist/v2/features/import-listener/helpers/load-document-from-source.d.ts +0 -15
  86. package/dist/v2/features/import-listener/helpers/load-document-from-source.d.ts.map +0 -1
  87. package/dist/v2/features/import-listener/helpers/load-document-from-source.js +0 -28
  88. package/dist/v2/features/import-listener/helpers/wait-for-condition.d.ts +0 -15
  89. package/dist/v2/features/import-listener/helpers/wait-for-condition.d.ts.map +0 -1
  90. package/dist/v2/features/import-listener/helpers/wait-for-condition.js +0 -16
  91. package/dist/v2/features/import-listener/index.d.ts +0 -2
  92. package/dist/v2/features/import-listener/index.d.ts.map +0 -1
  93. package/dist/v2/features/import-listener/index.js +0 -4
  94. /package/dist/v2/features/{import-listener → command-palette}/helpers/generate-unique-slug.d.ts +0 -0
  95. /package/dist/v2/features/{import-listener → command-palette}/helpers/generate-unique-slug.js +0 -0
  96. /package/dist/v2/features/{import-listener → command-palette}/helpers/import-document-to-workspace.d.ts +0 -0
  97. /package/dist/v2/features/{import-listener → command-palette}/helpers/import-document-to-workspace.js +0 -0
@@ -1,8 +1,7 @@
1
- import { defineComponent as i, createBlock as o, openBlock as c, unref as a } from "vue";
2
- import { useRouter as s } from "vue-router";
3
- import h from "../../settings/DocumentSettings.vue.js";
4
- import k from "../../settings/CollectionSettings.vue.js";
5
- const y = /* @__PURE__ */ i({
1
+ import { defineComponent as u, createBlock as c, openBlock as a, unref as n } from "vue";
2
+ import i from "../../settings/DocumentSettings.vue.js";
3
+ import s from "../../settings/CollectionSettings.vue.js";
4
+ const f = /* @__PURE__ */ u({
6
5
  __name: "Settings",
7
6
  props: {
8
7
  documentSlug: {},
@@ -20,41 +19,34 @@ const y = /* @__PURE__ */ i({
20
19
  collectionType: {}
21
20
  },
22
21
  setup(e) {
23
- const n = (t) => {
22
+ const d = (t) => {
24
23
  e.eventBus.emit("document:update:watch-mode", t);
25
- }, r = (t) => {
24
+ }, m = (t) => {
26
25
  e.eventBus.emit("workspace:update:theme", t);
27
- }, d = (t) => {
26
+ }, r = (t) => {
28
27
  e.eventBus.emit("workspace:update:active-proxy", t);
29
- }, m = (t) => {
28
+ }, l = (t) => {
30
29
  e.eventBus.emit("workspace:update:color-mode", t);
31
- }, l = s(), u = () => {
32
- e.workspaceStore.deleteDocument(e.documentSlug), l.push({
33
- name: "workspace.environment",
34
- params: {
35
- workspaceSlug: e.activeWorkspace.id
36
- }
37
- });
38
30
  };
39
- return (t, p) => e.collectionType === "document" ? (c(), o(a(h), {
31
+ return (t, o) => e.collectionType === "document" ? (a(), c(n(i), {
40
32
  key: 0,
41
33
  documentUrl: e.document?.["x-scalar-original-source-url"],
42
34
  isDraftDocument: e.documentSlug === "drafts",
43
35
  title: e.document?.info.title ?? "",
44
- watchMode: e.document?.["x-scalar-watch-mode"] ?? !0,
45
- "onDelete:document": u,
46
- "onUpdate:watchMode": n
47
- }, null, 8, ["documentUrl", "isDraftDocument", "title", "watchMode"])) : (c(), o(a(k), {
36
+ watchMode: e.document?.["x-scalar-watch-mode"],
37
+ "onDelete:document": o[0] || (o[0] = (h) => e.eventBus.emit("document:delete:document", { name: e.documentSlug })),
38
+ "onUpdate:watchMode": d
39
+ }, null, 8, ["documentUrl", "isDraftDocument", "title", "watchMode"])) : (a(), c(n(s), {
48
40
  key: 1,
49
41
  activeProxyUrl: e.workspaceStore.workspace["x-scalar-active-proxy"],
50
42
  activeThemeId: e.workspaceStore.workspace["x-scalar-theme"] ?? "default",
51
43
  colorMode: e.workspaceStore.workspace["x-scalar-color-mode"] ?? "system",
52
- "onUpdate:colorMode": m,
53
- "onUpdate:proxyUrl": d,
54
- "onUpdate:themeId": r
44
+ "onUpdate:colorMode": l,
45
+ "onUpdate:proxyUrl": r,
46
+ "onUpdate:themeId": m
55
47
  }, null, 8, ["activeProxyUrl", "activeThemeId", "colorMode"]));
56
48
  }
57
49
  });
58
50
  export {
59
- y as default
51
+ f as default
60
52
  };
@@ -1,4 +1,4 @@
1
- import type { WorkspaceStore } from '@scalar/workspace-store/client';
1
+ import { type WorkspaceStore } from '@scalar/workspace-store/client';
2
2
  import type { WorkspaceEventBus } from '@scalar/workspace-store/events';
3
3
  /**
4
4
  * Command Palette Import Component
@@ -1 +1 @@
1
- {"version":3,"file":"CommandPaletteImport.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/command-palette/components/CommandPaletteImport.vue"],"names":[],"mappings":"AAwYA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AACpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAkBvE;;;;;;;;;;;;;;;;;GAiBG;;IAMD,+CAA+C;oBAC/B,cAAc;IAC9B,uDAAuD;cAC7C,iBAAiB;;;;;IAH3B,+CAA+C;oBAC/B,cAAc;IAC9B,uDAAuD;cAC7C,iBAAiB;;;;;AAR7B,wBAygBC"}
1
+ {"version":3,"file":"CommandPaletteImport.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/command-palette/components/CommandPaletteImport.vue"],"names":[],"mappings":"AA0UA,OAAO,EAEL,KAAK,cAAc,EACpB,MAAM,gCAAgC,CAAA;AACvC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAiBvE;;;;;;;;;;;;;;;;;GAiBG;;IAGD,+CAA+C;oBAC/B,cAAc;IAC9B,uDAAuD;cAC7C,iBAAiB;;;;;IAH3B,+CAA+C;oBAC/B,cAAc;IAC9B,uDAAuD;cAC7C,iBAAiB;;;;;AAL7B,wBA2cC"}
@@ -1,111 +1,108 @@
1
- import { defineComponent as z, ref as V, computed as x, watch as J, createBlock as S, openBlock as o, unref as l, withCtx as m, createElementBlock as d, Fragment as p, createElementVNode as C, createCommentVNode as X, createVNode as g, createTextVNode as r, toDisplayString as L } from "vue";
2
- import { useLoadingState as Y, ScalarButton as P, ScalarCodeBlock as G, ScalarIcon as H, ScalarTooltip as K } from "@scalar/components";
3
- import { normalize as Q } from "@scalar/openapi-parser";
4
- import { generateUniqueValue as Z } from "@scalar/workspace-store/helpers/generate-unique-value";
5
- import { useRouter as ee } from "vue-router";
6
- import { getOpenApiDocumentDetails as te } from "../helpers/get-openapi-document-details.js";
7
- import { getOpenApiFromPostman as ae } from "../helpers/get-openapi-from-postman.js";
8
- import { getPostmanDocumentDetails as oe } from "../helpers/get-postman-document-details.js";
9
- import { isPostmanCollection as R } from "../helpers/is-postman-collection.js";
10
- import { isUrl as F } from "../../../helpers/is-url.js";
11
- import { slugify as ne } from "../../../helpers/slugify.js";
12
- import se from "./CommandActionForm.vue.js";
13
- import le from "./CommandActionInput.vue.js";
14
- import re from "./WatchModeToggle.vue.js";
15
- import { useFileDialog as ie } from "../../../../hooks/useFileDialog.js";
16
- const ce = { class: "flex justify-between" }, ue = { class: "flex w-full flex-row items-center justify-between gap-3" }, me = {
1
+ import { defineComponent as E, ref as D, computed as v, watch as O, createBlock as g, openBlock as a, unref as r, withCtx as u, createElementBlock as c, Fragment as m, createElementVNode as b, createCommentVNode as _, createVNode as f, createTextVNode as s, toDisplayString as L } from "vue";
2
+ import { useLoadingState as $, ScalarButton as U, ScalarCodeBlock as j, ScalarIcon as M, ScalarTooltip as z } from "@scalar/components";
3
+ import { isLocalUrl as J } from "@scalar/helpers/url/is-local-url";
4
+ import { useToasts as Y } from "@scalar/use-toasts";
5
+ import { createWorkspaceStore as q } from "@scalar/workspace-store/client";
6
+ import { useRouter as G } from "vue-router";
7
+ import { getOpenApiDocumentDetails as H } from "../helpers/get-openapi-document-details.js";
8
+ import { getPostmanDocumentDetails as K } from "../helpers/get-postman-document-details.js";
9
+ import { importDocumentToWorkspace as Q } from "../helpers/import-document-to-workspace.js";
10
+ import { isPostmanCollection as X } from "../helpers/is-postman-collection.js";
11
+ import { loadDocumentFromSource as Z } from "../helpers/load-document-from-source.js";
12
+ import { isUrl as ee } from "../../../helpers/is-url.js";
13
+ import te from "./CommandActionForm.vue.js";
14
+ import oe from "./CommandActionInput.vue.js";
15
+ import ae from "./WatchModeToggle.vue.js";
16
+ import { useFileDialog as le } from "../../../../hooks/useFileDialog.js";
17
+ const ne = { class: "flex justify-between" }, re = { class: "flex w-full flex-row items-center justify-between gap-3" }, se = {
17
18
  name: "CommandPaletteImport"
18
- }, Ie = /* @__PURE__ */ z({
19
- ...me,
19
+ }, Ce = /* @__PURE__ */ E({
20
+ ...se,
20
21
  props: {
21
22
  workspaceStore: {},
22
23
  eventBus: {}
23
24
  },
24
25
  emits: ["close", "back"],
25
- setup(f, { emit: T }) {
26
- const k = T, B = 100, b = "document", E = ee(), w = Y(), a = V(""), y = V(!0), i = x(() => F(a.value)), n = x(() => R(a.value) ? oe(a.value) : te(a.value)), U = x(
27
- () => n.value ? n.value.type : "json"
28
- ), O = x(() => !a.value.trim());
29
- J(i, (e) => {
30
- y.value = e;
26
+ setup(k, { emit: I }) {
27
+ const x = I, { toast: P } = Y(), V = G(), p = $(), o = D(""), y = D(!1), i = v(() => ee(o.value)), A = v(
28
+ () => i.value && J(o.value)
29
+ ), l = v(() => X(o.value) ? K(o.value) : H(o.value)), S = v(
30
+ () => l.value ? l.value.type : "json"
31
+ ), R = v(() => !o.value.trim());
32
+ O(A, (t) => {
33
+ y.value = t;
31
34
  });
32
- const j = (e) => !Object.keys(f.workspaceStore.workspace.documents).includes(e), h = async (e) => await Z({
33
- defaultValue: e,
34
- validation: j,
35
- maxRetries: B,
36
- transformation: ne
37
- }), q = (e) => typeof e.info == "object" && e.info !== null && "title" in e.info && typeof e.info.title == "string" ? e.info.title : b, A = async (e) => {
38
- if (F(e)) {
39
- const s = await h(b);
40
- return s ? { success: await f.workspaceStore.addDocument({
41
- name: s,
42
- url: e,
43
- meta: {
44
- "x-scalar-watch-mode": y.value
45
- }
46
- }), name: s } : (console.error("Failed to generate a unique name"), { success: !1 });
47
- }
48
- if (R(e)) {
49
- const s = ae(e), v = s.info?.title ?? b, D = await h(v);
50
- return D ? { success: await f.workspaceStore.addDocument({
51
- name: D,
52
- document: s
53
- }), name: D } : (console.error("Failed to generate a unique name"), { success: !1 });
54
- }
55
- const t = Q(e), c = q(t), u = await h(c);
56
- return u ? { success: await f.workspaceStore.addDocument({
57
- name: u,
58
- document: t
59
- }), name: u } : (console.error("Failed to generate a unique name"), { success: !1 });
60
- }, I = (e) => {
61
- E.push({
35
+ const h = async (t) => {
36
+ console.error(t), P(t, "error"), await p.invalidate(), x("close");
37
+ }, C = async (t) => {
38
+ p.start();
39
+ const e = "drafts", n = q({
40
+ meta: {
41
+ /** Ensure we use the active proxy to fetch documents */
42
+ "x-scalar-active-proxy": k.workspaceStore.workspace["x-scalar-active-proxy"]
43
+ }
44
+ });
45
+ if (!await Z(
46
+ n,
47
+ t,
48
+ e,
49
+ y.value
50
+ ))
51
+ return h("Failed to import document");
52
+ const d = await Q({
53
+ workspaceStore: k.workspaceStore,
54
+ workspaceState: n.exportWorkspace(),
55
+ name: e
56
+ });
57
+ if (!d.ok)
58
+ return h(d.error);
59
+ await p.validate(), T(d.slug), x("close");
60
+ }, T = (t) => {
61
+ V.push({
62
62
  name: "document.overview",
63
- params: { documentSlug: e }
63
+ params: { documentSlug: t }
64
64
  });
65
- }, { open: M } = ie({
66
- onChange: (e) => {
67
- const [t] = e ?? [];
68
- if (!t)
65
+ }, { open: B } = le({
66
+ onChange: (t) => {
67
+ const [e] = t ?? [];
68
+ if (!e)
69
69
  return;
70
- const c = async (N) => {
71
- const s = N.target?.result, v = await A(s);
72
- v.success && I(v.name), k("close");
73
- }, u = new FileReader();
74
- u.onload = c, u.readAsText(t);
70
+ p.start();
71
+ const n = async (d) => {
72
+ const W = d.target?.result;
73
+ await C(W);
74
+ }, w = new FileReader();
75
+ w.onload = n, w.readAsText(e);
75
76
  },
76
77
  multiple: !1,
77
78
  accept: ".json,.yaml,.yml"
78
- }), _ = async () => {
79
- w.start();
80
- const e = await A(a.value);
81
- e.success ? (await w.clear(), I(e.name)) : await w.invalidate(), k("close");
82
- }, W = (e) => {
83
- if (e.trim().toLowerCase().startsWith("curl"))
84
- return f.eventBus.emit("ui:open:command-palette", {
79
+ }), F = (t) => {
80
+ if (t.trim().toLowerCase().startsWith("curl"))
81
+ return k.eventBus.emit("ui:open:command-palette", {
85
82
  action: "import-curl-command",
86
83
  payload: {
87
- inputValue: e
84
+ inputValue: t
88
85
  }
89
86
  });
90
- a.value = e;
91
- }, $ = (e) => {
92
- k("back", e);
87
+ o.value = t;
88
+ }, N = (t) => {
89
+ x("back", t);
93
90
  };
94
- return (e, t) => (o(), S(se, {
95
- disabled: O.value,
96
- loader: l(w),
97
- onSubmit: _
91
+ return (t, e) => (a(), g(te, {
92
+ disabled: R.value,
93
+ loader: r(p),
94
+ onSubmit: e[2] || (e[2] = (n) => C(o.value))
98
95
  }, {
99
- options: m(() => [
100
- C("div", ue, [
101
- g(l(P), {
96
+ options: u(() => [
97
+ b("div", re, [
98
+ f(r(U), {
102
99
  class: "hover:bg-b-2 relative max-h-8 gap-1.5 p-2 text-xs",
103
100
  variant: "outlined",
104
- onClick: l(M)
101
+ onClick: r(B)
105
102
  }, {
106
- default: m(() => [
107
- t[4] || (t[4] = r(" JSON, or YAML File ", -1)),
108
- g(l(H), {
103
+ default: u(() => [
104
+ e[5] || (e[5] = s(" JSON, or YAML File ", -1)),
105
+ f(r(M), {
109
106
  class: "text-c-3",
110
107
  icon: "Upload",
111
108
  size: "md"
@@ -113,14 +110,14 @@ const ce = { class: "flex justify-between" }, ue = { class: "flex w-full flex-ro
113
110
  ]),
114
111
  _: 1
115
112
  }, 8, ["onClick"]),
116
- g(l(K), {
113
+ f(r(z), {
117
114
  content: i.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.",
118
115
  placement: "bottom"
119
116
  }, {
120
- default: m(() => [
121
- g(re, {
117
+ default: u(() => [
118
+ f(ae, {
122
119
  modelValue: y.value,
123
- "onUpdate:modelValue": t[1] || (t[1] = (c) => y.value = c),
120
+ "onUpdate:modelValue": e[1] || (e[1] = (n) => y.value = n),
124
121
  disabled: !i.value
125
122
  }, null, 8, ["modelValue", "disabled"])
126
123
  ]),
@@ -128,48 +125,48 @@ const ce = { class: "flex justify-between" }, ue = { class: "flex w-full flex-ro
128
125
  }, 8, ["content"])
129
126
  ])
130
127
  ]),
131
- submit: m(() => [
132
- t[5] || (t[5] = r(" Import ", -1)),
133
- i.value ? (o(), d(p, { key: 0 }, [
134
- r("from URL")
135
- ], 64)) : n.value && U.value ? (o(), d(p, { key: 1 }, [
136
- n.value.title ? (o(), d(p, { key: 0 }, [
137
- r(' "' + L(n.value.title) + '" ', 1)
138
- ], 64)) : (o(), d(p, { key: 1 }, [
139
- r(L(n.value.version), 1)
128
+ submit: u(() => [
129
+ e[6] || (e[6] = s(" Import ", -1)),
130
+ i.value ? (a(), c(m, { key: 0 }, [
131
+ s("from URL")
132
+ ], 64)) : l.value && S.value ? (a(), c(m, { key: 1 }, [
133
+ l.value.title ? (a(), c(m, { key: 0 }, [
134
+ s(' "' + L(l.value.title) + '" ', 1)
135
+ ], 64)) : (a(), c(m, { key: 1 }, [
136
+ s(L(l.value.version), 1)
140
137
  ], 64))
141
- ], 64)) : (o(), d(p, { key: 2 }, [
142
- r("Collection")
138
+ ], 64)) : (a(), c(m, { key: 2 }, [
139
+ s("Collection")
143
140
  ], 64))
144
141
  ]),
145
- default: m(() => [
146
- !n.value || i.value ? (o(), S(le, {
142
+ default: u(() => [
143
+ !l.value || i.value ? (a(), g(oe, {
147
144
  key: 0,
148
- modelValue: a.value,
145
+ modelValue: o.value,
149
146
  placeholder: "OpenAPI/Swagger/Postman URL or cURL",
150
- onDelete: $,
151
- "onUpdate:modelValue": W
152
- }, null, 8, ["modelValue"])) : (o(), d(p, { key: 1 }, [
153
- C("div", ce, [
154
- t[3] || (t[3] = C("div", { class: "text-c-2 min-h-8 w-full py-2 pl-12 text-center text-xs" }, " Preview ", -1)),
155
- g(l(P), {
147
+ onDelete: N,
148
+ "onUpdate:modelValue": F
149
+ }, null, 8, ["modelValue"])) : (a(), c(m, { key: 1 }, [
150
+ b("div", ne, [
151
+ e[4] || (e[4] = b("div", { class: "text-c-2 min-h-8 w-full py-2 pl-12 text-center text-xs" }, " Preview ", -1)),
152
+ f(r(U), {
156
153
  class: "hover:bg-b-2 relative ml-auto max-h-8 gap-1.5 p-2 text-xs",
157
154
  variant: "ghost",
158
- onClick: t[0] || (t[0] = (c) => a.value = "")
155
+ onClick: e[0] || (e[0] = (n) => o.value = "")
159
156
  }, {
160
- default: m(() => [...t[2] || (t[2] = [
161
- r(" Clear ", -1)
157
+ default: u(() => [...e[3] || (e[3] = [
158
+ s(" Clear ", -1)
162
159
  ])]),
163
160
  _: 1
164
161
  })
165
162
  ]),
166
- n.value && !i.value ? (o(), S(l(G), {
163
+ l.value && !i.value ? (a(), g(r(j), {
167
164
  key: 0,
168
165
  class: "bg-b-2 mt-1 max-h-[40dvh] rounded border px-2 py-1 text-sm",
169
- content: a.value,
166
+ content: o.value,
170
167
  copy: !1,
171
- lang: U.value
172
- }, null, 8, ["content", "lang"])) : X("", !0)
168
+ lang: S.value
169
+ }, null, 8, ["content", "lang"])) : _("", !0)
173
170
  ], 64))
174
171
  ]),
175
172
  _: 1
@@ -177,5 +174,5 @@ const ce = { class: "flex justify-between" }, ue = { class: "flex w-full flex-ro
177
174
  }
178
175
  });
179
176
  export {
180
- Ie as default
177
+ Ce as default
181
178
  };
@@ -1 +1 @@
1
- {"version":3,"file":"generate-unique-slug.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/import-listener/helpers/generate-unique-slug.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,kBAAkB,GAAU,cAAc,MAAM,GAAG,SAAS,EAAE,kBAAkB,GAAG,CAAC,MAAM,CAAC,gCAOvG,CAAA"}
1
+ {"version":3,"file":"generate-unique-slug.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/command-palette/helpers/generate-unique-slug.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,kBAAkB,GAAU,cAAc,MAAM,GAAG,SAAS,EAAE,kBAAkB,GAAG,CAAC,MAAM,CAAC,gCAOvG,CAAA"}
@@ -1,4 +1,3 @@
1
- import type { OpenAPIV3_1 } from '@scalar/openapi-types';
2
1
  /**
3
2
  * Converts a Postman collection JSON string to an OpenAPI specification document.
4
3
  *
@@ -6,8 +5,19 @@ import type { OpenAPIV3_1 } from '@scalar/openapi-types';
6
5
  * that can be used throughout the application. The convert function handles parsing
7
6
  * and transformation internally.
8
7
  *
9
- * @throws {Error} When the input is not valid JSON or when the conversion fails
10
- * due to invalid Postman collection structure
8
+ * Returns null if the conversion fails due to invalid Postman collection structure
11
9
  */
12
- export declare const getOpenApiFromPostman: (postmanJson: string) => OpenAPIV3_1.Document;
10
+ export declare const getOpenApiFromPostman: (postmanJson: string) => (Omit<Omit<import("@scalar/openapi-types").OpenAPIV3.Document<{}>, "components" | "paths">, keyof {
11
+ [customExtension: `x-${string}`]: any;
12
+ [key: string]: any;
13
+ }> & {
14
+ openapi?: "3.1.0" | "3.1.1" | "3.1.2";
15
+ swagger?: never;
16
+ info?: import("@scalar/openapi-types").OpenAPIV3_1.InfoObject;
17
+ jsonSchemaDialect?: string;
18
+ servers?: import("@scalar/openapi-types").OpenAPIV3_1.ServerObject[];
19
+ } & Pick<import("@scalar/openapi-types").OpenAPIV3_1.PathsWebhooksComponents<{}>, "paths"> & Omit<Partial<import("@scalar/openapi-types").OpenAPIV3_1.PathsWebhooksComponents<{}>>, "paths"> & {
20
+ [customExtension: `x-${string}`]: any;
21
+ [key: string]: any;
22
+ }) | null;
13
23
  //# sourceMappingURL=get-openapi-from-postman.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-openapi-from-postman.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/command-palette/helpers/get-openapi-from-postman.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAGxD;;;;;;;;;GASG;AACH,eAAO,MAAM,qBAAqB,GAAI,aAAa,MAAM,KAAG,WAAW,CAAC,QASvE,CAAA"}
1
+ {"version":3,"file":"get-openapi-from-postman.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/command-palette/helpers/get-openapi-from-postman.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB,GAAI,aAAa,MAAM;;;;;;;;;;;;SAOxD,CAAA"}
@@ -1,12 +1,11 @@
1
1
  import { convert as t } from "@scalar/postman-to-openapi";
2
- const c = (o) => {
2
+ const o = (r) => {
3
3
  try {
4
- return t(o);
5
- } catch (r) {
6
- const e = r instanceof Error ? r.message : "Unknown error";
7
- throw new Error(`Failed to convert Postman collection to OpenAPI: ${e}`);
4
+ return t(r);
5
+ } catch {
6
+ return null;
8
7
  }
9
8
  };
10
9
  export {
11
- c as getOpenApiFromPostman
10
+ o as getOpenApiFromPostman
12
11
  };
@@ -1 +1 @@
1
- {"version":3,"file":"import-document-to-workspace.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/import-listener/helpers/import-document-to-workspace.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AACpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oDAAoD,CAAA;AAI3F;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,yBAAyB,GAAU,2CAI7C;IACD,cAAc,EAAE,cAAc,GAAG,IAAI,CAAA;IACrC,cAAc,EAAE,iBAAiB,CAAA;IACjC,IAAI,EAAE,MAAM,CAAA;CACb,KAAG,OAAO,CAAC;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAwDpE,CAAA"}
1
+ {"version":3,"file":"import-document-to-workspace.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/command-palette/helpers/import-document-to-workspace.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AACpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oDAAoD,CAAA;AAI3F;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,yBAAyB,GAAU,2CAI7C;IACD,cAAc,EAAE,cAAc,GAAG,IAAI,CAAA;IACrC,cAAc,EAAE,iBAAiB,CAAA;IACjC,IAAI,EAAE,MAAM,CAAA;CACb,KAAG,OAAO,CAAC;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAwDpE,CAAA"}
@@ -0,0 +1,16 @@
1
+ import type { WorkspaceStore } from '@scalar/workspace-store/client';
2
+ /**
3
+ * Attempts to add a document to the workspace from a given source, which may be a URL or raw content.
4
+ *
5
+ * - If the source is a URL, adds the document by its URL and includes a watch mode flag as metadata.
6
+ * - If the source is a Postman collection, transforms it to OpenAPI and adds it as a document.
7
+ * - For other raw sources (such as pasted JSON or YAML), attempts to normalize and add them as a document.
8
+ *
9
+ * @param workspaceStore The workspace store where the document will be added.
10
+ * @param source The document source (URL, Postman Collection, JSON, or YAML string).
11
+ * @param name The display name for the new document.
12
+ * @param watchMode Whether to enable watch mode (applies only to URL sources).
13
+ * @returns Promise resolving to true if the document was successfully added, or false if the operation failed.
14
+ */
15
+ export declare const loadDocumentFromSource: (workspaceStore: WorkspaceStore, source: string | null, name: string, watchMode: boolean) => Promise<boolean>;
16
+ //# sourceMappingURL=load-document-from-source.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"load-document-from-source.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/command-palette/helpers/load-document-from-source.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AAMpE;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,sBAAsB,GACjC,gBAAgB,cAAc,EAC9B,QAAQ,MAAM,GAAG,IAAI,EACrB,MAAM,MAAM,EACZ,WAAW,OAAO,KACjB,OAAO,CAAC,OAAO,CAiDjB,CAAA"}
@@ -0,0 +1,34 @@
1
+ import { normalize as i } from "@scalar/openapi-parser";
2
+ import { getOpenApiFromPostman as l } from "./get-openapi-from-postman.js";
3
+ import { isPostmanCollection as u } from "./is-postman-collection.js";
4
+ import { isUrl as d } from "../../../helpers/is-url.js";
5
+ const C = async (r, t, o, m) => {
6
+ if (!t)
7
+ return !1;
8
+ if (d(t))
9
+ return await r.addDocument({
10
+ name: o,
11
+ url: t,
12
+ meta: {
13
+ "x-scalar-watch-mode": m
14
+ }
15
+ });
16
+ if (u(t)) {
17
+ const n = l(t);
18
+ return n === null ? !1 : await r.addDocument({ name: o, document: n });
19
+ }
20
+ const e = ((n) => {
21
+ try {
22
+ return i(n);
23
+ } catch (a) {
24
+ return console.error(a), null;
25
+ }
26
+ })(t);
27
+ return e === null ? !1 : await r.addDocument({
28
+ name: o,
29
+ document: e
30
+ });
31
+ };
32
+ export {
33
+ C as loadDocumentFromSource
34
+ };
@@ -0,0 +1,4 @@
1
+ export { importDocumentToWorkspace } from './helpers/import-document-to-workspace.js';
2
+ export { loadDocumentFromSource } from './helpers/load-document-from-source.js';
3
+ export { default as TheCommandPalette } from './TheCommandPalette.vue.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/v2/features/command-palette/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAA;AAClF,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAA;AAC5E,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,yBAAyB,CAAA"}
@@ -0,0 +1,8 @@
1
+ import { importDocumentToWorkspace as r } from "./helpers/import-document-to-workspace.js";
2
+ import { loadDocumentFromSource as t } from "./helpers/load-document-from-source.js";
3
+ import { default as p } from "./TheCommandPalette.vue.js";
4
+ export {
5
+ p as TheCommandPalette,
6
+ r as importDocumentToWorkspace,
7
+ t as loadDocumentFromSource
8
+ };
@@ -1,8 +1,12 @@
1
1
  import type { CollectionType, WorkspaceEventBus } from '@scalar/workspace-store/events';
2
2
  import type { XScalarEnvironments } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments';
3
3
  type __VLS_Props = {
4
+ /** List of environments, ensured to be non-nullable for safety */
4
5
  environments: NonNullable<XScalarEnvironments['x-scalar-environments']>;
6
+ /** Event bus to handle workspace-related events */
5
7
  eventBus: WorkspaceEventBus;
8
+ /** The currently active environment name */
9
+ activeEnvironment?: string;
6
10
  } & CollectionType;
7
11
  declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
8
12
  export default _default;
@@ -1 +1 @@
1
- {"version":3,"file":"EnvironmentsList.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/features/environments/EnvironmentsList.vue"],"names":[],"mappings":"AA8FA,OAAO,KAAK,EACV,cAAc,EACd,iBAAiB,EAClB,MAAM,gCAAgC,CAAA;AACvC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2EAA2E,CAAA;AAQpH,KAAK,WAAW,GAAG;IACf,YAAY,EAAE,WAAW,CAAC,mBAAmB,CAAC,uBAAuB,CAAC,CAAC,CAAA;IACvE,QAAQ,EAAE,iBAAiB,CAAA;CAC5B,GAAG,cAAc,CAAC;;AAoLrB,wBAMG"}
1
+ {"version":3,"file":"EnvironmentsList.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/features/environments/EnvironmentsList.vue"],"names":[],"mappings":"AAoGA,OAAO,KAAK,EACV,cAAc,EACd,iBAAiB,EAClB,MAAM,gCAAgC,CAAA;AACvC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2EAA2E,CAAA;AAQpH,KAAK,WAAW,GAAG;IACb,kEAAkE;IAClE,YAAY,EAAE,WAAW,CAAC,mBAAmB,CAAC,uBAAuB,CAAC,CAAC,CAAA;IACvE,mDAAmD;IACnD,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,4CAA4C;IAC5C,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAC3B,GAAG,cAAc,CAAC;;AAuLvB,wBAMG"}