@scalar/api-client 2.29.3 → 2.31.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 (82) hide show
  1. package/CHANGELOG.md +77 -0
  2. package/dist/hooks/useClientConfig.d.ts +3 -0
  3. package/dist/hooks/useClientConfig.d.ts.map +1 -1
  4. package/dist/style.css +1 -1
  5. package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts +9 -69
  6. package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts.map +1 -1
  7. package/dist/v2/blocks/operation-block/OperationBlock.vue.js +74 -76
  8. package/dist/v2/blocks/operation-block/components/Header.vue.d.ts +15 -8
  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 +29 -28
  12. package/dist/v2/blocks/operation-code-sample/helpers/get-resolved-ref-deep.d.ts +1 -1
  13. package/dist/v2/blocks/operation-code-sample/helpers/get-resolved-ref-deep.d.ts.map +1 -1
  14. package/dist/v2/blocks/operation-code-sample/helpers/get-resolved-ref-deep.js +18 -21
  15. package/dist/v2/blocks/request-block/RequestBlock.vue.js +1 -1
  16. package/dist/v2/blocks/request-block/RequestBlock.vue2.js +2 -2
  17. package/dist/v2/blocks/request-block/components/RequestTable.vue.d.ts +12 -0
  18. package/dist/v2/blocks/request-block/components/RequestTable.vue.d.ts.map +1 -1
  19. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.d.ts +12 -0
  20. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.d.ts.map +1 -1
  21. package/dist/v2/blocks/request-block/helpers/get-default-headers.js +1 -1
  22. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.d.ts +13 -8
  23. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.d.ts.map +1 -1
  24. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.js +2 -2
  25. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue2.js +97 -85
  26. package/dist/v2/components/server/ServerDropdown.vue.d.ts +16 -5
  27. package/dist/v2/components/server/ServerDropdown.vue.d.ts.map +1 -1
  28. package/dist/v2/components/server/ServerDropdown.vue.js +27 -24
  29. package/dist/v2/features/app/app-events.d.ts.map +1 -1
  30. package/dist/v2/features/app/app-events.js +29 -14
  31. package/dist/v2/features/app/app-state.d.ts.map +1 -1
  32. package/dist/v2/features/app/app-state.js +57 -57
  33. package/dist/v2/features/app/components/AppSidebar.vue.d.ts.map +1 -1
  34. package/dist/v2/features/app/components/AppSidebar.vue.js +1 -1
  35. package/dist/v2/features/app/components/AppSidebar.vue2.js +171 -148
  36. package/dist/v2/features/app/helpers/routes.d.ts +42 -12
  37. package/dist/v2/features/app/helpers/routes.d.ts.map +1 -1
  38. package/dist/v2/features/app/helpers/routes.js +57 -26
  39. package/dist/v2/features/collection/OperationCollection.vue.d.ts +6 -0
  40. package/dist/v2/features/collection/OperationCollection.vue.d.ts.map +1 -0
  41. package/dist/v2/features/collection/OperationCollection.vue.js +83 -0
  42. package/dist/v2/features/collection/OperationCollection.vue2.js +4 -0
  43. package/dist/v2/features/collection/components/Authentication.vue.d.ts +2 -2
  44. package/dist/v2/features/collection/components/Authentication.vue.d.ts.map +1 -1
  45. package/dist/v2/features/collection/components/Authentication.vue.js +2 -2
  46. package/dist/v2/features/collection/components/Authentication.vue2.js +99 -49
  47. package/dist/v2/features/collection/components/Cookies.vue.d.ts +9 -4
  48. package/dist/v2/features/collection/components/Cookies.vue.d.ts.map +1 -1
  49. package/dist/v2/features/collection/components/Cookies.vue.js +12 -10
  50. package/dist/v2/features/collection/components/Environment.vue.d.ts +9 -4
  51. package/dist/v2/features/collection/components/Environment.vue.d.ts.map +1 -1
  52. package/dist/v2/features/collection/components/Environment.vue.js +18 -16
  53. package/dist/v2/features/collection/components/LabelInput.vue.d.ts +6 -2
  54. package/dist/v2/features/collection/components/LabelInput.vue.d.ts.map +1 -1
  55. package/dist/v2/features/collection/components/LabelInput.vue.js +2 -2
  56. package/dist/v2/features/collection/components/LabelInput.vue2.js +20 -18
  57. package/dist/v2/features/collection/components/Overview.vue.d.ts +2 -2
  58. package/dist/v2/features/collection/components/Overview.vue.d.ts.map +1 -1
  59. package/dist/v2/features/collection/components/Overview.vue.js +1 -1
  60. package/dist/v2/features/collection/components/Overview.vue2.js +177 -75
  61. package/dist/v2/features/collection/components/Servers.vue.d.ts +2 -2
  62. package/dist/v2/features/collection/components/Servers.vue.d.ts.map +1 -1
  63. package/dist/v2/features/collection/components/Servers.vue.js +154 -98
  64. package/dist/v2/features/collection/components/Settings.vue.d.ts +2 -2
  65. package/dist/v2/features/collection/components/Tabs.vue.d.ts +2 -1
  66. package/dist/v2/features/collection/components/Tabs.vue.d.ts.map +1 -1
  67. package/dist/v2/features/collection/components/Tabs.vue.js +25 -27
  68. package/dist/v2/features/collection/helpers/get-default-operation-security-toggle.d.ts +12 -0
  69. package/dist/v2/features/collection/helpers/get-default-operation-security-toggle.d.ts.map +1 -0
  70. package/dist/v2/features/collection/helpers/get-default-operation-security-toggle.js +13 -0
  71. package/dist/v2/features/operation/Operation.vue.d.ts.map +1 -1
  72. package/dist/v2/features/operation/Operation.vue.js +61 -63
  73. package/dist/v2/features/operation/helpers/get-selected-security.d.ts +5 -3
  74. package/dist/v2/features/operation/helpers/get-selected-security.d.ts.map +1 -1
  75. package/dist/v2/features/operation/helpers/get-selected-security.js +7 -8
  76. package/dist/v2/features/operation/helpers/get-selected-server.d.ts +8 -6
  77. package/dist/v2/features/operation/helpers/get-selected-server.d.ts.map +1 -1
  78. package/dist/v2/features/operation/helpers/get-selected-server.js +2 -2
  79. package/dist/v2/workspace-events.d.ts.map +1 -1
  80. package/dist/v2/workspace-events.js +25 -15
  81. package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
  82. package/package.json +13 -13
@@ -1,15 +1,17 @@
1
- import { defineComponent as M, ref as T, computed as x, createElementBlock as v, openBlock as n, Fragment as g, createVNode as a, withCtx as i, createElementVNode as c, renderList as A, createBlock as y, unref as s, toDisplayString as I, createCommentVNode as V, createTextVNode as p } from "vue";
2
- import { useModal as P, ScalarMarkdown as z, ScalarButton as k, ScalarModal as L } from "@scalar/components";
3
- import { debounce as O } from "@scalar/helpers/general/debounce";
4
- import { ScalarIconTrash as R, ScalarIconPlus as j } from "@scalar/icons";
5
- import E from "../../../../components/Sidebar/Actions/DeleteSidebarListElement.vue.js";
6
- import F from "../../settings/components/Section.vue.js";
7
- import W from "./Form.vue.js";
8
- import Y from "../../../../components/Server/ServerVariablesForm.vue.js";
9
- const q = { class: "flex flex-col gap-4" }, G = { class: "bg-b-2 flex items-center justify-between rounded-t-lg px-3 py-1 text-sm" }, H = {
1
+ import { defineComponent as L, ref as B, computed as h, watchEffect as E, createElementBlock as v, openBlock as i, Fragment as b, createVNode as s, createSlots as j, withCtx as u, createElementVNode as l, normalizeClass as T, renderList as F, createBlock as O, unref as n, toDisplayString as W, createCommentVNode as H, createTextVNode as d } from "vue";
2
+ import { useModal as q, ScalarMarkdown as G, ScalarButton as M, ScalarToggle as J, ScalarModal as K } from "@scalar/components";
3
+ import { debounce as Q } from "@scalar/helpers/general/debounce";
4
+ import { isHttpMethod as C } from "@scalar/helpers/http/is-http-method";
5
+ import { ScalarIconTrash as X, ScalarIconPlus as Y } from "@scalar/icons";
6
+ import { getResolvedRef as Z } from "@scalar/workspace-store/helpers/get-resolved-ref";
7
+ import _ from "../../../../components/Sidebar/Actions/DeleteSidebarListElement.vue.js";
8
+ import ee from "../../settings/components/Section.vue.js";
9
+ import te from "./Form.vue.js";
10
+ import le from "../../../../components/Server/ServerVariablesForm.vue.js";
11
+ const re = { class: "flex h-8 items-center" }, ae = { class: "flex flex-col gap-4" }, oe = { class: "bg-b-2 flex items-center justify-between rounded-t-lg px-3 py-1 text-sm" }, se = {
10
12
  key: 1,
11
13
  class: "self-center"
12
- }, J = { class: "divide-0 flex w-full flex-col divide-y rounded-b-lg text-sm" }, K = { class: "text-c-3 flex h-full items-center justify-center rounded-lg border p-4" }, oe = /* @__PURE__ */ M({
14
+ }, ne = { class: "divide-0 flex w-full flex-col divide-y rounded-b-lg text-sm" }, ie = { class: "text-c-3 flex h-full items-center justify-center rounded-lg border p-4" }, ge = /* @__PURE__ */ L({
13
15
  __name: "Servers",
14
16
  props: {
15
17
  documentSlug: {},
@@ -27,10 +29,12 @@ const q = { class: "flex flex-col gap-4" }, G = { class: "bg-b-2 flex items-cent
27
29
  customThemes: {},
28
30
  collectionType: {}
29
31
  },
30
- setup(o) {
31
- const m = P(), l = T(-1), _ = x(
32
- () => o.document?.servers?.[l.value]
33
- ), $ = x(() => o.document?.servers ?? []), B = [
32
+ setup(t) {
33
+ const g = q(), c = B(-1), m = h(() => t.collectionType === "operation"), S = h(() => !m.value || !t.path || !C(t.method) ? null : Z(t.document?.paths?.[t.path]?.[t.method])), f = B(!1);
34
+ E(() => {
35
+ f.value = S.value?.servers !== void 0;
36
+ });
37
+ const k = h(() => t.collectionType === "operation" && S.value ? S.value.servers ?? [] : t.document?.servers ?? []), N = h(() => k.value[c.value]), o = h(() => t.collectionType === "operation" && t.path && C(t.method) ? { type: "operation", path: t.path, method: t.method } : { type: "document" }), V = [
34
38
  {
35
39
  label: "URL",
36
40
  key: "url",
@@ -41,103 +45,155 @@ const q = { class: "flex flex-col gap-4" }, G = { class: "bg-b-2 flex items-cent
41
45
  key: "description",
42
46
  placeholder: "Production"
43
47
  }
44
- ], w = (t) => {
45
- l.value = t, m.show();
46
- }, b = () => {
47
- m.hide(), l.value = -1;
48
- }, N = () => {
49
- l.value < 0 || (o.eventBus.emit("server:delete:server", { index: l.value }), b());
50
- }, { execute: h } = O({ delay: 328, maxWait: 1e3 }), U = (t, e, r) => h(
51
- `${t}-${e}`,
52
- () => o.eventBus.emit("server:update:server", {
53
- index: t,
54
- server: { [e]: r }
48
+ ], D = (r) => {
49
+ c.value = r, g.show();
50
+ }, w = () => {
51
+ g.hide(), c.value = -1;
52
+ }, R = () => {
53
+ c.value < 0 || (t.eventBus.emit("server:delete:server", {
54
+ index: c.value,
55
+ meta: o.value
56
+ }), w());
57
+ }, { execute: $ } = Q({ delay: 328, maxWait: 1e3 }), A = (r, e, a) => $(
58
+ `${r}-${e}-${o.value.type}`,
59
+ () => t.eventBus.emit("server:update:server", {
60
+ index: r,
61
+ server: { [e]: a },
62
+ meta: o.value
55
63
  })
56
- ), C = (t, e, r) => h(
57
- `${t}-${e}`,
58
- () => o.eventBus.emit("server:update:variables", {
59
- index: t,
64
+ ), I = (r, e, a) => $(
65
+ `${r}-${e}-${o.value.type}`,
66
+ () => t.eventBus.emit("server:update:variables", {
67
+ index: r,
60
68
  key: e,
61
- value: r
69
+ value: a,
70
+ meta: o.value
62
71
  })
63
- ), D = () => o.eventBus.emit("server:add:server"), S = (t, e = 0) => t?.description || `Server ${e + 1}`;
64
- return (t, e) => (n(), v(g, null, [
65
- a(F, null, {
66
- title: i(() => [...e[0] || (e[0] = [
67
- p("Servers", -1)
68
- ])]),
69
- description: i(() => [...e[1] || (e[1] = [
70
- p(" Add different base URLs for your API. You can use ", -1),
71
- c("code", { class: "font-code text-c-2" }, "{variables}", -1),
72
- p(" for dynamic parts. ", -1)
73
- ])]),
74
- default: i(() => [
75
- c("div", q, [
76
- (n(!0), v(g, null, A($.value, (r, d) => (n(), v("div", {
77
- key: d,
78
- class: "rounded-lg border"
72
+ ), z = () => t.eventBus.emit("server:add:server", { meta: o.value }), U = (r, e = 0) => r?.description || `Server ${e + 1}`, P = (r) => {
73
+ if (o.value.type === "operation")
74
+ return f.value = r, r ? t.eventBus.emit("server:initialize:servers", {
75
+ meta: o.value
76
+ }) : t.eventBus.emit("server:clear:servers", { meta: o.value });
77
+ };
78
+ return (r, e) => (i(), v(b, null, [
79
+ s(ee, null, j({
80
+ title: u(() => [
81
+ e[0] || (e[0] = d("Servers", -1))
82
+ ]),
83
+ description: u(() => [
84
+ m.value ? (i(), v(b, { key: 0 }, [
85
+ e[1] || (e[1] = l("span", { class: "block" }, " Override servers for this operation with the toggle. ", -1)),
86
+ e[2] || (e[2] = l("span", { class: "mt-1 block" }, [
87
+ l("strong", null, "On"),
88
+ d(" — Servers below apply only to this operation. ")
89
+ ], -1)),
90
+ e[3] || (e[3] = l("span", { class: "mt-1 block" }, [
91
+ l("strong", null, "Off"),
92
+ d(" — Removes operation servers; this operation uses document or path servers from the OpenAPI spec. ")
93
+ ], -1)),
94
+ e[4] || (e[4] = l("span", { class: "text-c-3 mt-1 block" }, [
95
+ d(" Use "),
96
+ l("code", { class: "font-code text-c-2" }, "{variables}"),
97
+ d(" for dynamic URL parts. ")
98
+ ], -1))
99
+ ], 64)) : (i(), v(b, { key: 1 }, [
100
+ e[5] || (e[5] = d(" Add different base URLs for your API. Use ", -1)),
101
+ e[6] || (e[6] = l("code", { class: "font-code text-c-2" }, "{variables}", -1)),
102
+ e[7] || (e[7] = d(" for dynamic parts. ", -1))
103
+ ], 64))
104
+ ]),
105
+ default: u(() => [
106
+ l("div", {
107
+ class: T(m.value && !f.value && "cursor-not-allowed")
108
+ }, [
109
+ l("div", {
110
+ class: T([
111
+ "flex flex-col gap-4",
112
+ m.value && !f.value && "pointer-events-none cursor-not-allowed opacity-50 mix-blend-luminosity"
113
+ ])
79
114
  }, [
80
- c("div", G, [
81
- r.description ? (n(), y(s(z), {
82
- key: 0,
83
- class: "self-center",
84
- value: r.description
85
- }, null, 8, ["value"])) : (n(), v("span", H, I(S(r, d)), 1)),
86
- a(s(k), {
87
- class: "hover:bg-b-3 hover:text-c-1 h-fit p-1.25",
88
- "data-testid": "delete-server-button",
115
+ l("div", ae, [
116
+ (i(!0), v(b, null, F(k.value, (a, p) => (i(), v("div", {
117
+ key: p,
118
+ class: "rounded-lg border"
119
+ }, [
120
+ l("div", oe, [
121
+ a.description ? (i(), O(n(G), {
122
+ key: 0,
123
+ class: "self-center",
124
+ value: a.description
125
+ }, null, 8, ["value"])) : (i(), v("span", se, W(U(a, p)), 1)),
126
+ s(n(M), {
127
+ class: "hover:bg-b-3 hover:text-c-1 h-fit p-1.25",
128
+ "data-testid": "delete-server-button",
129
+ variant: "ghost",
130
+ onClick: (y) => D(p)
131
+ }, {
132
+ default: u(() => [
133
+ s(n(X), { class: "size-3.5" })
134
+ ]),
135
+ _: 1
136
+ }, 8, ["onClick"])
137
+ ]),
138
+ l("div", ne, [
139
+ s(te, {
140
+ data: a,
141
+ environment: t.environment,
142
+ onUpdate: (y, x) => A(p, y, x),
143
+ options: V
144
+ }, null, 8, ["data", "environment", "onUpdate"]),
145
+ a.variables ? (i(), O(n(le), {
146
+ key: 0,
147
+ variables: a.variables,
148
+ "onUpdate:variable": (y, x) => I(p, y, x)
149
+ }, null, 8, ["variables", "onUpdate:variable"])) : H("", !0)
150
+ ])
151
+ ]))), 128))
152
+ ]),
153
+ l("div", ie, [
154
+ s(n(M), {
155
+ class: "hover:bg-b-2 hover:text-c-1 flex items-center gap-2",
156
+ size: "sm",
89
157
  variant: "ghost",
90
- onClick: (u) => w(d)
158
+ onClick: z
91
159
  }, {
92
- default: i(() => [
93
- a(s(R), { class: "size-3.5" })
160
+ default: u(() => [
161
+ s(n(Y)),
162
+ e[8] || (e[8] = l("span", null, "Add Server", -1))
94
163
  ]),
95
164
  _: 1
96
- }, 8, ["onClick"])
97
- ]),
98
- c("div", J, [
99
- a(W, {
100
- data: r,
101
- environment: o.environment,
102
- onUpdate: (u, f) => U(d, u, f),
103
- options: B
104
- }, null, 8, ["data", "environment", "onUpdate"]),
105
- r.variables ? (n(), y(s(Y), {
106
- key: 0,
107
- variables: r.variables,
108
- "onUpdate:variable": (u, f) => C(d, u, f)
109
- }, null, 8, ["variables", "onUpdate:variable"])) : V("", !0)
165
+ })
110
166
  ])
111
- ]))), 128))
112
- ]),
113
- c("div", K, [
114
- a(s(k), {
115
- class: "hover:bg-b-2 hover:text-c-1 flex items-center gap-2",
116
- size: "sm",
117
- variant: "ghost",
118
- onClick: D
119
- }, {
120
- default: i(() => [
121
- a(s(j)),
122
- e[2] || (e[2] = c("span", null, "Add Server", -1))
123
- ]),
124
- _: 1
125
- })
126
- ])
167
+ ], 2)
168
+ ], 2)
127
169
  ]),
128
- _: 1
129
- }),
130
- a(s(L), {
170
+ _: 2
171
+ }, [
172
+ m.value ? {
173
+ name: "actions",
174
+ fn: u(() => [
175
+ l("div", re, [
176
+ s(n(J), {
177
+ class: "w-4",
178
+ modelValue: f.value,
179
+ "onUpdate:modelValue": P
180
+ }, null, 8, ["modelValue"])
181
+ ])
182
+ ]),
183
+ key: "0"
184
+ } : void 0
185
+ ]), 1024),
186
+ s(n(K), {
131
187
  size: "xxs",
132
- state: s(m),
133
- title: `Delete ${S(_.value, l.value)}`
188
+ state: n(g),
189
+ title: `Delete ${U(N.value, c.value)}`
134
190
  }, {
135
- default: i(() => [
136
- a(E, {
191
+ default: u(() => [
192
+ s(_, {
137
193
  variableName: "Server",
138
194
  warningMessage: "Are you sure you want to delete this server? This action cannot be undone.",
139
- onClose: b,
140
- onDelete: N
195
+ onClose: w,
196
+ onDelete: R
141
197
  })
142
198
  ]),
143
199
  _: 1
@@ -146,5 +202,5 @@ const q = { class: "flex flex-col gap-4" }, G = { class: "bg-b-2 flex items-cent
146
202
  }
147
203
  });
148
204
  export {
149
- oe as default
205
+ ge as default
150
206
  };
@@ -1,11 +1,11 @@
1
1
  declare const __VLS_export: import("vue").DefineComponent<(import("../../../../v2/features/app/helpers/routes.js").RouteProps & {
2
- collectionType: "document";
2
+ collectionType: "document" | "operation";
3
3
  document: import("@scalar/workspace-store/schemas").WorkspaceDocument;
4
4
  }) | (import("../../../../v2/features/app/helpers/routes.js").RouteProps & {
5
5
  collectionType: "workspace";
6
6
  document: null;
7
7
  }), {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<(import("../../../../v2/features/app/helpers/routes.js").RouteProps & {
8
- collectionType: "document";
8
+ collectionType: "document" | "operation";
9
9
  document: import("@scalar/workspace-store/schemas").WorkspaceDocument;
10
10
  }) | (import("../../../../v2/features/app/helpers/routes.js").RouteProps & {
11
11
  collectionType: "workspace";
@@ -1,5 +1,6 @@
1
+ import type { CollectionProps } from '../../../../v2/features/app/helpers/routes.js';
1
2
  type __VLS_Props = {
2
- type: 'document' | 'workspace';
3
+ type: CollectionProps['collectionType'];
3
4
  };
4
5
  declare const __VLS_export: 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>;
5
6
  declare const _default: typeof __VLS_export;
@@ -1 +1 @@
1
- {"version":3,"file":"Tabs.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/collection/components/Tabs.vue"],"names":[],"mappings":"AAsDA,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,UAAU,GAAG,WAAW,CAAA;CAC/B,CAAC;AA4GF,QAAA,MAAM,YAAY,kSAEhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
1
+ {"version":3,"file":"Tabs.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/collection/components/Tabs.vue"],"names":[],"mappings":"AA8DA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAA;AAEvE,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,eAAe,CAAC,gBAAgB,CAAC,CAAA;CACxC,CAAC;AAkHF,QAAA,MAAM,YAAY,kSAEhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
@@ -1,40 +1,38 @@
1
- import { defineComponent as a, computed as m, createElementBlock as n, openBlock as t, Fragment as p, renderList as u, createBlock as d, unref as f, withCtx as x, createElementVNode as r, normalizeClass as h, toDisplayString as k, capitalize as v } from "vue";
2
- import { RouterLink as _ } from "vue-router";
3
- const b = { class: "flex w-full gap-2 border-b pl-1.5 md:ml-1.5 md:pl-0" }, w = ["href", "onClick"], z = /* @__PURE__ */ a({
1
+ import { defineComponent as l, computed as u, createElementBlock as n, openBlock as r, Fragment as m, renderList as p, createBlock as f, unref as d, withCtx as h, createElementVNode as o, normalizeClass as v, toDisplayString as x, capitalize as k } from "vue";
2
+ import { RouterLink as b } from "vue-router";
3
+ const w = { class: "flex w-full gap-2 border-b pl-1.5 md:ml-1.5 md:pl-0" }, _ = ["href", "onClick"], z = /* @__PURE__ */ l({
4
4
  __name: "Tabs",
5
5
  props: {
6
6
  type: {}
7
7
  },
8
- setup(o) {
9
- const s = m(
10
- () => o.type === "workspace" ? ["environment", "cookies", "settings"] : [
11
- "overview",
12
- "servers",
13
- "authentication",
14
- "environment",
15
- "cookies",
16
- "settings"
17
- ]
18
- );
19
- return (g, y) => (t(), n("div", b, [
20
- (t(!0), n(p, null, u(s.value, (e) => (t(), d(f(_), {
21
- key: e,
8
+ setup(e) {
9
+ const s = u(() => e.type === "workspace" ? ["environment", "cookies", "settings"] : e.type === "operation" ? ["overview", "servers", "authentication"] : [
10
+ "overview",
11
+ "servers",
12
+ "authentication",
13
+ "environment",
14
+ "cookies",
15
+ "settings"
16
+ ]);
17
+ return (y, g) => (r(), n("div", w, [
18
+ (r(!0), n(m, null, p(s.value, (t) => (r(), f(d(b), {
19
+ key: t,
22
20
  custom: "",
23
- to: { name: `${o.type}.${e}` }
21
+ to: { name: `${e.type}.${t}` }
24
22
  }, {
25
- default: x(({ isActive: c, href: i, navigate: l }) => [
26
- r("a", {
23
+ default: h(({ isActive: i, href: c, navigate: a }) => [
24
+ o("a", {
27
25
  class: "-ml-2 flex h-10 cursor-pointer items-center px-2 text-center text-sm font-medium whitespace-nowrap no-underline -outline-offset-1 has-[:focus-visible]:outline",
28
- href: i,
29
- onClick: l
26
+ href: c,
27
+ onClick: a
30
28
  }, [
31
- r("span", {
32
- class: h([
29
+ o("span", {
30
+ class: v([
33
31
  "flex-center hover:text-c-1 h-full border-b",
34
- c ? "text-c-1 border-c-1" : "text-c-2 hover:text-c-1 border-transparent"
32
+ i ? "text-c-1 border-c-1" : "text-c-2 hover:text-c-1 border-transparent"
35
33
  ])
36
- }, k(v(e)), 3)
37
- ], 8, w)
34
+ }, x(k(t)), 3)
35
+ ], 8, _)
38
36
  ]),
39
37
  _: 2
40
38
  }, 1032, ["to"]))), 128))
@@ -0,0 +1,12 @@
1
+ import type { AuthStore } from '@scalar/workspace-store/entities/auth';
2
+ import type { AuthMeta } from '@scalar/workspace-store/events';
3
+ /**
4
+ * Determines the default toggle state for operation security.
5
+ * Returns false for 'document' type, undefined if path/method is missing,
6
+ * otherwise checks if there are selected auth schemas for the operation.
7
+ */
8
+ export declare const getDefaultOperationSecurityToggle: ({ authStore, documentName, ...payload }: {
9
+ authStore: AuthStore;
10
+ documentName: string;
11
+ } & AuthMeta) => boolean;
12
+ //# sourceMappingURL=get-default-operation-security-toggle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-default-operation-security-toggle.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/collection/helpers/get-default-operation-security-toggle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uCAAuC,CAAA;AACtE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAA;AAE9D;;;;GAIG;AACH,eAAO,MAAM,iCAAiC,GAAI,yCAI/C;IACD,SAAS,EAAE,SAAS,CAAA;IACpB,YAAY,EAAE,MAAM,CAAA;CACrB,GAAG,QAAQ,YAeX,CAAA"}
@@ -0,0 +1,13 @@
1
+ const r = ({
2
+ authStore: t,
3
+ documentName: o,
4
+ ...e
5
+ }) => e.type === "document" ? !1 : t.getAuthSelectedSchemas({
6
+ type: "operation",
7
+ documentName: o,
8
+ path: e.path,
9
+ method: e.method
10
+ }) !== void 0;
11
+ export {
12
+ r as getDefaultOperationSecurityToggle
13
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"Operation.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/features/operation/Operation.vue"],"names":[],"mappings":"AA2NA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAA;AAElE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAA;AAO/D;;;;;;;GAOG;wBACkB,OAAO,YAAY;AAAxC,wBAAyC;AAGzC,QAAA,MAAM,YAAY;IAEd,6CAA6C;cACnC,UAAU,CAAC,SAAS,CAAC;;IAD/B,6CAA6C;cACnC,UAAU,CAAC,SAAS,CAAC;iGAgS/B,CAAC"}
1
+ {"version":3,"file":"Operation.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/features/operation/Operation.vue"],"names":[],"mappings":"AA6OA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAA;AAElE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAA;AAO/D;;;;;;;GAOG;wBACkB,OAAO,YAAY;AAAxC,wBAAyC;AAGzC,QAAA,MAAM,YAAY;IAEd,6CAA6C;cACnC,UAAU,CAAC,SAAS,CAAC;;IAD/B,6CAA6C;cACnC,UAAU,CAAC,SAAS,CAAC;iGA0R/B,CAAC"}
@@ -1,16 +1,16 @@
1
- import { defineComponent as f, computed as n, toValue as o, createBlock as k, createElementBlock as g, openBlock as l, unref as u, createElementVNode as x } from "vue";
2
- import { getResolvedRef as m } from "@scalar/workspace-store/helpers/get-resolved-ref";
3
- import { mapHiddenClientsConfig as w } from "../modal/helpers/map-hidden-clients-config.js";
4
- import { combineParams as C } from "./helpers/combine-params.js";
5
- import { getSelectedServer as B } from "./helpers/get-selected-server.js";
6
- import { getActiveProxyUrl as U } from "../../helpers/get-active-proxy-url.js";
7
- import { getServers as b } from "../../helpers/get-servers.js";
8
- import N from "../../blocks/operation-block/OperationBlock.vue.js";
9
- const A = {
1
+ import { defineComponent as w, computed as t, toValue as a, createBlock as C, createElementBlock as B, openBlock as m, unref as c, createElementVNode as U } from "vue";
2
+ import { getResolvedRef as s } from "@scalar/workspace-store/helpers/get-resolved-ref";
3
+ import { mapHiddenClientsConfig as b } from "../modal/helpers/map-hidden-clients-config.js";
4
+ import { combineParams as N } from "./helpers/combine-params.js";
5
+ import { getSelectedServer as M } from "./helpers/get-selected-server.js";
6
+ import { getActiveProxyUrl as A } from "../../helpers/get-active-proxy-url.js";
7
+ import { getServers as E } from "../../helpers/get-servers.js";
8
+ import V from "../../blocks/operation-block/OperationBlock.vue.js";
9
+ const P = {
10
10
  key: 1,
11
11
  class: "flex h-full w-full items-center justify-center"
12
- }, E = {}, $ = /* @__PURE__ */ f({
13
- ...E,
12
+ }, R = {}, $ = /* @__PURE__ */ w({
13
+ ...R,
14
14
  __name: "Operation",
15
15
  props: {
16
16
  documentSlug: {},
@@ -29,94 +29,92 @@ const A = {
29
29
  options: {}
30
30
  },
31
31
  setup(e) {
32
- const r = n(() => e.path ? m(e.document?.paths?.[e.path]) : null), c = n(() => {
32
+ const l = t(() => e.path ? s(e.document?.paths?.[e.path]) : null), r = t(() => {
33
33
  if (!e.path || !e.method)
34
34
  return null;
35
- const t = m(e.document?.paths?.[e.path]?.[e.method]);
36
- if (!t)
35
+ const n = s(e.document?.paths?.[e.path]?.[e.method]);
36
+ if (!n)
37
37
  return null;
38
- if (!r.value)
39
- return t;
40
- const a = C(
41
- r.value.parameters,
42
- t.parameters
38
+ if (!l.value)
39
+ return n;
40
+ const o = N(
41
+ l.value.parameters,
42
+ n.parameters
43
43
  );
44
- return { ...t, parameters: a };
45
- }), s = n(() => [
46
- ...(e.workspaceStore.workspace?.["x-scalar-cookies"] ?? []).map((t) => ({
47
- ...t,
44
+ return { ...n, parameters: o };
45
+ }), d = t(() => [
46
+ ...(e.workspaceStore.workspace?.["x-scalar-cookies"] ?? []).map((n) => ({
47
+ ...n,
48
48
  location: "workspace"
49
49
  })),
50
- ...(e.document?.["x-scalar-cookies"] ?? []).map((t) => ({
51
- ...t,
50
+ ...(e.document?.["x-scalar-cookies"] ?? []).map((n) => ({
51
+ ...n,
52
52
  location: "document"
53
53
  }))
54
- ]), i = n(() => {
55
- const t = o(e.options)?.servers ?? c.value?.servers ?? r.value?.servers ?? e.document?.servers;
56
- return b(t, {
57
- baseServerUrl: o(e.options)?.baseServerURL,
54
+ ]), u = t(() => {
55
+ const n = a(e.options)?.servers ?? r.value?.servers ?? // pathItem.value?.servers ?? TODO: add support for pathItem servers
56
+ e.document?.servers;
57
+ return E(n, {
58
+ baseServerUrl: a(e.options)?.baseServerURL,
58
59
  documentUrl: e.document?.["x-scalar-original-source-url"]
59
60
  });
60
- }), d = n(
61
- () => B(e.document, i.value)
62
- ), v = n(() => e.document?.["x-scalar-set-operation-security"] ? {
61
+ }), v = t(() => a(e.options)?.servers != null ? e.document?.["x-scalar-selected-server"] : r.value?.servers != null ? r.value["x-scalar-selected-server"] : e.document?.["x-scalar-selected-server"]), h = t(
62
+ () => M(u.value, v.value)
63
+ ), S = t(() => r.value?.servers != null ? { type: "operation", path: e.path ?? "", method: e.method ?? "get" } : { type: "document" }), y = t(() => e.workspaceStore.auth.getAuthSelectedSchemas({
64
+ type: "document",
65
+ documentName: e.documentSlug
66
+ })), i = t(() => e.workspaceStore.auth.getAuthSelectedSchemas({
63
67
  type: "operation",
68
+ documentName: e.documentSlug,
64
69
  path: e.path ?? "",
65
70
  method: e.method ?? "get"
66
- } : {
67
- type: "document"
68
- }), h = n(() => Array.from(
71
+ })), f = t(() => i.value !== void 0 ? {
72
+ type: "operation",
73
+ path: e.path ?? "",
74
+ method: e.method ?? "get"
75
+ } : { type: "document" }), k = t(() => Array.from(
69
76
  new Set(
70
77
  Object.keys({
71
78
  ...e.document?.["x-scalar-environments"],
72
79
  ...e.workspaceStore.workspace["x-scalar-environments"]
73
80
  })
74
81
  )
75
- )), S = n(
76
- () => w(o(e.options)?.hiddenClients)
77
- ), y = "2.29.3";
78
- return (t, a) => e.path && e.method && e.exampleName && c.value ? (l(), k(u(N), {
82
+ )), x = t(
83
+ () => b(a(e.options)?.hiddenClients)
84
+ ), g = "2.31.0";
85
+ return (n, o) => e.path && e.method && e.exampleName && r.value ? (m(), C(c(V), {
79
86
  key: 0,
80
87
  activeEnvironment: e.workspaceStore.workspace["x-scalar-active-environment"],
81
- appVersion: u(y),
82
- authMeta: v.value,
88
+ appVersion: c(g),
89
+ authMeta: f.value,
83
90
  documentSecurity: e.document?.security ?? [],
84
- documentSelectedSecurity: e.workspaceStore.auth.getAuthSelectedSchemas({
85
- type: "document",
86
- documentName: e.documentSlug
87
- }),
91
+ documentSelectedSecurity: y.value,
88
92
  documentUrl: e.document?.["x-scalar-original-source-url"],
89
93
  environment: e.environment,
90
- environments: h.value,
94
+ environments: k.value,
91
95
  eventBus: e.eventBus,
92
96
  exampleKey: e.exampleName,
93
- globalCookies: s.value,
94
- hideClientButton: o(e.options)?.hideClientButton ?? !1,
97
+ globalCookies: d.value,
98
+ hideClientButton: a(e.options)?.hideClientButton ?? !1,
95
99
  history: e.workspaceStore.history.getHistory(e.documentSlug, e.path, e.method),
96
- httpClients: S.value,
100
+ httpClients: x.value,
97
101
  layout: e.layout,
98
102
  method: e.method,
99
- operation: c.value,
100
- operationSelectedSecurity: e.workspaceStore.auth.getAuthSelectedSchemas({
101
- type: "operation",
102
- documentName: e.documentSlug,
103
- path: e.path,
104
- method: e.method
105
- }),
103
+ operation: r.value,
104
+ operationSelectedSecurity: i.value,
106
105
  path: e.path,
107
106
  plugins: e.plugins,
108
- proxyUrl: u(U)(
107
+ proxyUrl: c(A)(
109
108
  e.workspaceStore.workspace["x-scalar-active-proxy"],
110
109
  e.layout
111
110
  ) ?? "",
112
111
  securitySchemes: e.securitySchemes,
113
112
  selectedClient: e.workspaceStore.workspace["x-scalar-default-client"],
114
- server: d.value,
115
- servers: i.value,
116
- setOperationSecurity: e.document?.["x-scalar-set-operation-security"] ?? !1,
117
- "onUpdate:servers": a[0] || (a[0] = (O) => e.eventBus.emit("ui:navigate", { page: "document", path: "servers" }))
118
- }, null, 8, ["activeEnvironment", "appVersion", "authMeta", "documentSecurity", "documentSelectedSecurity", "documentUrl", "environment", "environments", "eventBus", "exampleKey", "globalCookies", "hideClientButton", "history", "httpClients", "layout", "method", "operation", "operationSelectedSecurity", "path", "plugins", "proxyUrl", "securitySchemes", "selectedClient", "server", "servers", "setOperationSecurity"])) : (l(), g("div", A, [...a[1] || (a[1] = [
119
- x("span", { class: "text-c-3" }, "Select an operation to view details", -1)
113
+ server: h.value,
114
+ serverMeta: S.value,
115
+ servers: u.value
116
+ }, null, 8, ["activeEnvironment", "appVersion", "authMeta", "documentSecurity", "documentSelectedSecurity", "documentUrl", "environment", "environments", "eventBus", "exampleKey", "globalCookies", "hideClientButton", "history", "httpClients", "layout", "method", "operation", "operationSelectedSecurity", "path", "plugins", "proxyUrl", "securitySchemes", "selectedClient", "server", "serverMeta", "servers"])) : (m(), B("div", P, [...o[0] || (o[0] = [
117
+ U("span", { class: "text-c-3" }, "Select an operation to view details", -1)
120
118
  ])]));
121
119
  }
122
120
  });
@@ -1,8 +1,10 @@
1
1
  import type { SelectedSecurity } from '@scalar/workspace-store/entities/auth';
2
2
  import type { OpenApiDocument } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
3
3
  /**
4
- * Get the selected security for an operation or document,
5
- * Defaults to the first requirement if no selection is made and you pass in requirements
4
+ * Resolves which security selection to use for an operation.
5
+ * Priority: operation-level selection, then document-level selection, then a default.
6
+ * When neither level has a selection, returns the first security requirement unless
7
+ * authentication is optional or there are no requirements, in which case returns no selection.
6
8
  */
7
- export declare const getSelectedSecurity: (documentSelectedSecurity: SelectedSecurity | undefined, operationSelectedSecurity: SelectedSecurity | undefined, securityRequirements?: NonNullable<OpenApiDocument["security"]>, setOperationSecurity?: boolean) => SelectedSecurity;
9
+ export declare const getSelectedSecurity: (documentSelectedSecurity: SelectedSecurity | undefined, operationSelectedSecurity: SelectedSecurity | undefined, securityRequirements?: NonNullable<OpenApiDocument["security"]>) => SelectedSecurity;
8
10
  //# sourceMappingURL=get-selected-security.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-selected-security.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/operation/helpers/get-selected-security.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAA;AAC7E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8DAA8D,CAAA;AAInG;;;GAGG;AACH,eAAO,MAAM,mBAAmB,GAC9B,0BAA0B,gBAAgB,GAAG,SAAS,EACtD,2BAA2B,gBAAgB,GAAG,SAAS,EACvD,uBAAsB,WAAW,CAAC,eAAe,CAAC,UAAU,CAAC,CAAM,EACnE,8BAA4B,KAC3B,gBA4BF,CAAA"}
1
+ {"version":3,"file":"get-selected-security.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/operation/helpers/get-selected-security.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAA;AAC7E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8DAA8D,CAAA;AAInG;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,GAC9B,0BAA0B,gBAAgB,GAAG,SAAS,EACtD,2BAA2B,gBAAgB,GAAG,SAAS,EACvD,uBAAsB,WAAW,CAAC,eAAe,CAAC,UAAU,CAAC,CAAM,KAClE,gBA0BF,CAAA"}