@scalar/api-client 2.2.42 → 2.2.44

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 (58) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/dist/layouts/App/create-api-client-app.d.ts +29 -29
  3. package/dist/layouts/App/create-api-client-app.d.ts.map +1 -1
  4. package/dist/layouts/Modal/create-api-client-modal.d.ts +58 -58
  5. package/dist/layouts/Modal/create-api-client-modal.d.ts.map +1 -1
  6. package/dist/layouts/Web/create-api-client-web.d.ts +29 -29
  7. package/dist/layouts/Web/create-api-client-web.d.ts.map +1 -1
  8. package/dist/libs/create-client.d.ts +29 -29
  9. package/dist/libs/create-client.d.ts.map +1 -1
  10. package/dist/libs/find-request.d.ts +1 -1
  11. package/dist/libs/find-request.d.ts.map +1 -1
  12. package/dist/libs/send-request/send-request.d.ts +8 -10
  13. package/dist/libs/send-request/send-request.d.ts.map +1 -1
  14. package/dist/libs/send-request/send-request.js +100 -100
  15. package/dist/store/active-entities.d.ts +5 -3
  16. package/dist/store/active-entities.d.ts.map +1 -1
  17. package/dist/store/collections.d.ts +12 -12
  18. package/dist/store/collections.d.ts.map +1 -1
  19. package/dist/store/import-spec.d.ts +2 -2
  20. package/dist/store/import-spec.d.ts.map +1 -1
  21. package/dist/store/requests.d.ts +13 -13
  22. package/dist/store/requests.d.ts.map +1 -1
  23. package/dist/store/security-schemes.d.ts.map +1 -1
  24. package/dist/store/security-schemes.js +25 -25
  25. package/dist/store/store.d.ts +29 -29
  26. package/dist/store/store.d.ts.map +1 -1
  27. package/dist/style.css +1 -1
  28. package/dist/views/Request/RequestSection/RequestAuth/DeleteRequestAuthModal.vue.js +4 -4
  29. package/dist/views/Request/RequestSection/RequestAuth/OAuth2.vue.d.ts +5 -1
  30. package/dist/views/Request/RequestSection/RequestAuth/OAuth2.vue.d.ts.map +1 -1
  31. package/dist/views/Request/RequestSection/RequestAuth/OAuth2.vue.js +60 -58
  32. package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue.d.ts +10 -7
  33. package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue.d.ts.map +1 -1
  34. package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue.js +1 -1
  35. package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue2.js +103 -115
  36. package/dist/views/Request/RequestSection/RequestAuth/RequestAuthDataTable.vue.d.ts +9 -1
  37. package/dist/views/Request/RequestSection/RequestAuth/RequestAuthDataTable.vue.d.ts.map +1 -1
  38. package/dist/views/Request/RequestSection/RequestAuth/RequestAuthDataTable.vue.js +2 -2
  39. package/dist/views/Request/RequestSection/RequestAuth/RequestAuthDataTable.vue2.js +52 -44
  40. package/dist/views/Request/RequestSection/RequestAuth/{RequestExampleAuth.vue.d.ts → RequestAuthTab.vue.d.ts} +7 -2
  41. package/dist/views/Request/RequestSection/RequestAuth/RequestAuthTab.vue.d.ts.map +1 -0
  42. package/dist/views/Request/RequestSection/RequestAuth/RequestAuthTab.vue.js +7 -0
  43. package/dist/views/Request/RequestSection/RequestAuth/{RequestExampleAuth.vue2.js → RequestAuthTab.vue2.js} +68 -62
  44. package/dist/views/Request/RequestSection/RequestBody.vue.d.ts.map +1 -1
  45. package/dist/views/Request/RequestSection/RequestBody.vue.js +2 -2
  46. package/dist/views/Request/RequestSection/RequestBody.vue2.js +107 -97
  47. package/dist/views/Request/RequestSection/RequestSection.vue.d.ts +2 -1
  48. package/dist/views/Request/RequestSection/RequestSection.vue.d.ts.map +1 -1
  49. package/dist/views/Request/RequestSection/RequestSection.vue.js +2 -2
  50. package/dist/views/Request/RequestSection/RequestSection.vue2.js +78 -67
  51. package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
  52. package/dist/views/Request/libs/auth.d.ts +22 -2
  53. package/dist/views/Request/libs/auth.d.ts.map +1 -1
  54. package/dist/views/Request/libs/auth.js +56 -5
  55. package/dist/views/Request/libs/index.js +9 -6
  56. package/package.json +12 -12
  57. package/dist/views/Request/RequestSection/RequestAuth/RequestExampleAuth.vue.d.ts.map +0 -1
  58. package/dist/views/Request/RequestSection/RequestAuth/RequestExampleAuth.vue.js +0 -7
@@ -1,6 +1,6 @@
1
1
  import { defineComponent as b, openBlock as y, createBlock as S, unref as s, withCtx as n, createElementVNode as r, toDisplayString as i, createVNode as m, createTextVNode as u } from "vue";
2
- import { ScalarModal as _, ScalarButton as d } from "@scalar/components";
3
- import { useWorkspace as g } from "../../../../store/store.js";
2
+ import { useWorkspace as _ } from "../../../../store/store.js";
3
+ import { ScalarModal as g, ScalarButton as d } from "@scalar/components";
4
4
  const k = { class: "mb-4 leading-normal text-c-2 text-sm" }, C = { class: "flex justify-between gap-2" }, B = /* @__PURE__ */ b({
5
5
  __name: "DeleteRequestAuthModal",
6
6
  props: {
@@ -9,11 +9,11 @@ const k = { class: "mb-4 leading-normal text-c-2 text-sm" }, C = { class: "flex
9
9
  },
10
10
  emits: ["close", "delete"],
11
11
  setup(p, { emit: f }) {
12
- const l = p, c = f, { securitySchemeMutators: h } = g(), x = () => {
12
+ const l = p, c = f, { securitySchemeMutators: h } = _(), x = () => {
13
13
  var e;
14
14
  (e = l.scheme) != null && e.id && h.delete(l.scheme.id), c("delete");
15
15
  };
16
- return (e, t) => (y(), S(s(_), {
16
+ return (e, t) => (y(), S(s(g), {
17
17
  size: "xxs",
18
18
  state: e.state,
19
19
  title: "Delete Security Scheme"
@@ -1,7 +1,11 @@
1
- import { type Oauth2Flow, type SecuritySchemeOauth2 } from '@scalar/oas-utils/entities/spec';
1
+ import { type Collection, type Oauth2Flow, type SecuritySchemeOauth2, type Server } from '@scalar/oas-utils/entities/spec';
2
+ import type { Workspace } from '@scalar/oas-utils/entities/workspace';
2
3
  type __VLS_Props = {
3
4
  scheme: SecuritySchemeOauth2;
4
5
  flow: Oauth2Flow;
6
+ collection: Collection;
7
+ server: Server | undefined;
8
+ workspace: Workspace;
5
9
  };
6
10
  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>;
7
11
  export default _default;
@@ -1 +1 @@
1
- {"version":3,"file":"OAuth2.vue.d.ts","sourceRoot":"","sources":["../../../../../src/views/Request/RequestSection/RequestAuth/OAuth2.vue"],"names":[],"mappings":"AAsOA,OAAO,EACL,KAAK,UAAU,EACf,KAAK,oBAAoB,EAE1B,MAAM,iCAAiC,CAAA;AAQxC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,oBAAoB,CAAA;IAC5B,IAAI,EAAE,UAAU,CAAA;CACjB,CAAC;;AA8dF,wBAMG"}
1
+ {"version":3,"file":"OAuth2.vue.d.ts","sourceRoot":"","sources":["../../../../../src/views/Request/RequestSection/RequestAuth/OAuth2.vue"],"names":[],"mappings":"AAwOA,OAAO,EACL,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,oBAAoB,EACzB,KAAK,MAAM,EAEZ,MAAM,iCAAiC,CAAA;AACxC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAA;AAQrE,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,oBAAoB,CAAA;IAC5B,IAAI,EAAE,UAAU,CAAA;IAChB,UAAU,EAAE,UAAU,CAAA;IACtB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,SAAS,EAAE,SAAS,CAAA;CACrB,CAAC;;AA4dF,wBAMG"}
@@ -1,37 +1,39 @@
1
- import { defineComponent as L, openBlock as d, createElementBlock as w, Fragment as k, createVNode as a, unref as r, withCtx as o, createTextVNode as u, createElementVNode as v, createBlock as m, createCommentVNode as i } from "vue";
2
- import { useActiveEntities as P } from "../../../../store/active-entities.js";
3
- import { useLoadingState as R, ScalarButton as $ } from "@scalar/components";
4
- import { pkceOptions as A } from "@scalar/oas-utils/entities/spec";
5
- import { useToasts as B } from "@scalar/use-toasts";
6
- import F from "./OAuthScopesInput.vue.js";
1
+ import { defineComponent as v, openBlock as d, createElementBlock as k, Fragment as y, createVNode as a, unref as r, withCtx as o, createTextVNode as n, createElementVNode as g, createBlock as p, createCommentVNode as i } from "vue";
2
+ import { useWorkspace as C } from "../../../../store/store.js";
3
+ import { useLoadingState as T, ScalarButton as $ } from "@scalar/components";
4
+ import { pkceOptions as L } from "@scalar/oas-utils/entities/spec";
5
+ import { useToasts as P } from "@scalar/use-toasts";
6
+ import R from "./OAuthScopesInput.vue.js";
7
7
  import f from "./RequestAuthDataTableInput.vue.js";
8
- import n from "../../../../components/DataTable/DataTableRow.vue.js";
9
- import { authorizeOauth2 as b } from "../../libs/oauth2.js";
10
- import { useWorkspace as I } from "../../../../store/store.js";
11
- const N = { class: "h-8 flex items-center justify-self-end" }, O = { class: "h-8 flex items-center justify-end border-t-1/2 w-full" }, Z = /* @__PURE__ */ L({
8
+ import u from "../../../../components/DataTable/DataTableRow.vue.js";
9
+ import { authorizeOauth2 as B } from "../../libs/oauth2.js";
10
+ const F = { class: "h-8 flex items-center justify-self-end" }, b = { class: "h-8 flex items-center justify-end border-t-1/2 w-full" }, H = /* @__PURE__ */ v({
12
11
  __name: "OAuth2",
13
12
  props: {
14
13
  scheme: {},
15
- flow: {}
14
+ flow: {},
15
+ collection: {},
16
+ server: {},
17
+ workspace: {}
16
18
  },
17
- setup(y) {
18
- const p = R(), { toast: V } = B(), { activeCollection: S, activeServer: U, activeWorkspace: z } = P(), { securitySchemeMutators: C } = I(), s = (l, e) => C.edit(y.scheme.uid, l, e), T = async () => {
19
- var t, g;
20
- if (p.isLoading || !((t = S.value) != null && t.uid)) return;
21
- if (p.startLoading(), !U.value) {
19
+ setup(m) {
20
+ const w = T(), { toast: V } = P(), { securitySchemeMutators: z } = C(), s = (l, e) => z.edit(m.scheme.uid, l, e), S = async () => {
21
+ var t, U;
22
+ if (w.isLoading || !((t = m.collection) != null && t.uid)) return;
23
+ if (w.startLoading(), !m.server) {
22
24
  V("No server selected", "error");
23
25
  return;
24
26
  }
25
- const [l, e] = await b(
26
- y.flow,
27
- U.value,
28
- (g = z.value) == null ? void 0 : g.proxyUrl
29
- ).finally(() => p.stopLoading());
30
- e ? s(`flows.${y.flow.type}.token`, e) : (console.error(l), V((l == null ? void 0 : l.message) ?? "Failed to authorize", "error"));
27
+ const [l, e] = await B(
28
+ m.flow,
29
+ m.server,
30
+ (U = m.workspace) == null ? void 0 : U.proxyUrl
31
+ ).finally(() => w.stopLoading());
32
+ e ? s(`flows.${m.flow.type}.token`, e) : (console.error(l), V((l == null ? void 0 : l.message) ?? "Failed to authorize", "error"));
31
33
  };
32
- return (l, e) => (d(), w(k, null, [
33
- l.flow.token ? (d(), w(k, { key: 0 }, [
34
- a(r(n), null, {
34
+ return (l, e) => (d(), k(y, null, [
35
+ l.flow.token ? (d(), k(y, { key: 0 }, [
36
+ a(r(u), null, {
35
37
  default: o(() => [
36
38
  a(f, {
37
39
  class: "border-r-transparent",
@@ -41,25 +43,25 @@ const N = { class: "h-8 flex items-center justify-self-end" }, O = { class: "h-8
41
43
  "onUpdate:modelValue": e[0] || (e[0] = (t) => s(`flows.${l.flow.type}.token`, t))
42
44
  }, {
43
45
  default: o(() => e[10] || (e[10] = [
44
- u(" Access Token ")
46
+ n(" Access Token ")
45
47
  ])),
46
48
  _: 1
47
49
  }, 8, ["modelValue"])
48
50
  ]),
49
51
  _: 1
50
52
  }),
51
- a(r(n), { class: "min-w-full" }, {
53
+ a(r(u), { class: "min-w-full" }, {
52
54
  default: o(() => [
53
- v("div", N, [
55
+ g("div", F, [
54
56
  a(r($), {
55
57
  class: "p-0 py-0.5 px-2 mr-1",
56
- loading: r(p),
58
+ loading: r(w),
57
59
  size: "sm",
58
60
  variant: "outlined",
59
61
  onClick: e[1] || (e[1] = (t) => s(`flows.${l.flow.type}.token`, ""))
60
62
  }, {
61
63
  default: o(() => e[11] || (e[11] = [
62
- u(" Clear ")
64
+ n(" Clear ")
63
65
  ])),
64
66
  _: 1
65
67
  }, 8, ["loading"])
@@ -67,35 +69,35 @@ const N = { class: "h-8 flex items-center justify-self-end" }, O = { class: "h-8
67
69
  ]),
68
70
  _: 1
69
71
  })
70
- ], 64)) : (d(), w(k, { key: 1 }, [
71
- a(r(n), null, {
72
+ ], 64)) : (d(), k(y, { key: 1 }, [
73
+ a(r(u), null, {
72
74
  default: o(() => [
73
- "authorizationUrl" in l.flow ? (d(), m(f, {
75
+ "authorizationUrl" in l.flow ? (d(), p(f, {
74
76
  key: 0,
75
77
  modelValue: l.flow.authorizationUrl,
76
78
  placeholder: "https://galaxy.scalar.com/authorize",
77
79
  "onUpdate:modelValue": e[2] || (e[2] = (t) => s(`flows.${l.flow.type}.authorizationUrl`, t))
78
80
  }, {
79
81
  default: o(() => e[12] || (e[12] = [
80
- u(" Auth URL ")
82
+ n(" Auth URL ")
81
83
  ])),
82
84
  _: 1
83
85
  }, 8, ["modelValue"])) : i("", !0),
84
- "tokenUrl" in l.flow ? (d(), m(f, {
86
+ "tokenUrl" in l.flow ? (d(), p(f, {
85
87
  key: 1,
86
88
  modelValue: l.flow.tokenUrl,
87
89
  placeholder: "https://galaxy.scalar.com/token",
88
90
  "onUpdate:modelValue": e[3] || (e[3] = (t) => s(`flows.${l.flow.type}.tokenUrl`, t))
89
91
  }, {
90
92
  default: o(() => e[13] || (e[13] = [
91
- u(" Token URL ")
93
+ n(" Token URL ")
92
94
  ])),
93
95
  _: 1
94
96
  }, 8, ["modelValue"])) : i("", !0)
95
97
  ]),
96
98
  _: 1
97
99
  }),
98
- "x-scalar-redirect-uri" in l.flow ? (d(), m(r(n), { key: 0 }, {
100
+ "x-scalar-redirect-uri" in l.flow ? (d(), p(r(u), { key: 0 }, {
99
101
  default: o(() => [
100
102
  a(f, {
101
103
  modelValue: l.flow["x-scalar-redirect-uri"],
@@ -103,15 +105,15 @@ const N = { class: "h-8 flex items-center justify-self-end" }, O = { class: "h-8
103
105
  "onUpdate:modelValue": e[4] || (e[4] = (t) => s(`flows.${l.flow.type}.x-scalar-redirect-uri`, t))
104
106
  }, {
105
107
  default: o(() => e[14] || (e[14] = [
106
- u(" Redirect URL ")
108
+ n(" Redirect URL ")
107
109
  ])),
108
110
  _: 1
109
111
  }, 8, ["modelValue"])
110
112
  ]),
111
113
  _: 1
112
114
  })) : i("", !0),
113
- l.flow.type === "password" ? (d(), w(k, { key: 1 }, [
114
- a(r(n), null, {
115
+ l.flow.type === "password" ? (d(), k(y, { key: 1 }, [
116
+ a(r(u), null, {
115
117
  default: o(() => [
116
118
  a(f, {
117
119
  class: "text-c-2",
@@ -120,14 +122,14 @@ const N = { class: "h-8 flex items-center justify-self-end" }, O = { class: "h-8
120
122
  "onUpdate:modelValue": e[5] || (e[5] = (t) => s(`flows.${l.flow.type}.username`, t))
121
123
  }, {
122
124
  default: o(() => e[15] || (e[15] = [
123
- u(" Username ")
125
+ n(" Username ")
124
126
  ])),
125
127
  _: 1
126
128
  }, 8, ["modelValue"])
127
129
  ]),
128
130
  _: 1
129
131
  }),
130
- a(r(n), null, {
132
+ a(r(u), null, {
131
133
  default: o(() => [
132
134
  a(f, {
133
135
  modelValue: l.flow.password,
@@ -136,7 +138,7 @@ const N = { class: "h-8 flex items-center justify-self-end" }, O = { class: "h-8
136
138
  "onUpdate:modelValue": e[6] || (e[6] = (t) => s(`flows.${l.flow.type}.password`, t))
137
139
  }, {
138
140
  default: o(() => e[16] || (e[16] = [
139
- u(" Password ")
141
+ n(" Password ")
140
142
  ])),
141
143
  _: 1
142
144
  }, 8, ["modelValue"])
@@ -144,7 +146,7 @@ const N = { class: "h-8 flex items-center justify-self-end" }, O = { class: "h-8
144
146
  _: 1
145
147
  })
146
148
  ], 64)) : i("", !0),
147
- a(r(n), null, {
149
+ a(r(u), null, {
148
150
  default: o(() => [
149
151
  a(f, {
150
152
  modelValue: l.flow["x-scalar-client-id"],
@@ -152,14 +154,14 @@ const N = { class: "h-8 flex items-center justify-self-end" }, O = { class: "h-8
152
154
  "onUpdate:modelValue": e[7] || (e[7] = (t) => s(`flows.${l.flow.type}.x-scalar-client-id`, t))
153
155
  }, {
154
156
  default: o(() => e[17] || (e[17] = [
155
- u(" Client ID ")
157
+ n(" Client ID ")
156
158
  ])),
157
159
  _: 1
158
160
  }, 8, ["modelValue"])
159
161
  ]),
160
162
  _: 1
161
163
  }),
162
- "clientSecret" in l.flow ? (d(), m(r(n), { key: 2 }, {
164
+ "clientSecret" in l.flow ? (d(), p(r(u), { key: 2 }, {
163
165
  default: o(() => [
164
166
  a(f, {
165
167
  modelValue: l.flow.clientSecret,
@@ -168,17 +170,17 @@ const N = { class: "h-8 flex items-center justify-self-end" }, O = { class: "h-8
168
170
  "onUpdate:modelValue": e[8] || (e[8] = (t) => s(`flows.${l.flow.type}.clientSecret`, t))
169
171
  }, {
170
172
  default: o(() => e[18] || (e[18] = [
171
- u(" Client Secret ")
173
+ n(" Client Secret ")
172
174
  ])),
173
175
  _: 1
174
176
  }, 8, ["modelValue"])
175
177
  ]),
176
178
  _: 1
177
179
  })) : i("", !0),
178
- "x-usePkce" in l.flow ? (d(), m(r(n), { key: 3 }, {
180
+ "x-usePkce" in l.flow ? (d(), p(r(u), { key: 3 }, {
179
181
  default: o(() => [
180
182
  a(f, {
181
- enum: r(A),
183
+ enum: r(L),
182
184
  modelValue: l.flow["x-usePkce"],
183
185
  readOnly: "",
184
186
  "onUpdate:modelValue": e[9] || (e[9] = (t) => s(
@@ -187,16 +189,16 @@ const N = { class: "h-8 flex items-center justify-self-end" }, O = { class: "h-8
187
189
  ))
188
190
  }, {
189
191
  default: o(() => e[19] || (e[19] = [
190
- u(" Use PKCE ")
192
+ n(" Use PKCE ")
191
193
  ])),
192
194
  _: 1
193
195
  }, 8, ["enum", "modelValue"])
194
196
  ]),
195
197
  _: 1
196
198
  })) : i("", !0),
197
- Object.keys(l.flow.scopes ?? {}).length ? (d(), m(r(n), { key: 4 }, {
199
+ Object.keys(l.flow.scopes ?? {}).length ? (d(), p(r(u), { key: 4 }, {
198
200
  default: o(() => [
199
- a(F, {
201
+ a(R, {
200
202
  flow: l.flow,
201
203
  updateScheme: s
202
204
  }, null, 8, ["flow"])
@@ -204,21 +206,21 @@ const N = { class: "h-8 flex items-center justify-self-end" }, O = { class: "h-8
204
206
  _: 1
205
207
  })) : i("", !0)
206
208
  ], 64)),
207
- l.flow.token ? i("", !0) : (d(), m(r(n), {
209
+ l.flow.token ? i("", !0) : (d(), p(r(u), {
208
210
  key: 2,
209
211
  class: "min-w-full"
210
212
  }, {
211
213
  default: o(() => [
212
- v("div", O, [
214
+ g("div", b, [
213
215
  a(r($), {
214
216
  class: "p-0 py-0.5 px-2 mr-1",
215
- loading: r(p),
217
+ loading: r(w),
216
218
  size: "sm",
217
219
  variant: "outlined",
218
- onClick: T
220
+ onClick: S
219
221
  }, {
220
222
  default: o(() => e[20] || (e[20] = [
221
- u(" Authorize ")
223
+ n(" Authorize ")
222
224
  ])),
223
225
  _: 1
224
226
  }, 8, ["loading"])
@@ -230,5 +232,5 @@ const N = { class: "h-8 flex items-center justify-self-end" }, O = { class: "h-8
230
232
  }
231
233
  });
232
234
  export {
233
- Z as default
235
+ H as default
234
236
  };
@@ -1,12 +1,15 @@
1
+ import type { SelectedSecuritySchemeUids } from '@scalar/oas-utils/entities/shared';
2
+ import type { Collection, Operation, Server } from '@scalar/oas-utils/entities/spec';
3
+ import type { Workspace } from '@scalar/oas-utils/entities/workspace';
1
4
  type __VLS_Props = {
2
- selectedSecuritySchemeUids: string[];
3
- title: string;
5
+ collection: Collection;
4
6
  layout: 'client' | 'reference';
7
+ operation?: Operation;
8
+ selectedSecuritySchemeUids: SelectedSecuritySchemeUids;
9
+ server: Server | undefined;
10
+ title: string;
11
+ workspace: Workspace;
5
12
  };
6
- declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
7
- "update:selectedSecuritySchemeUids": (args_0: string[]) => any;
8
- }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
9
- "onUpdate:selectedSecuritySchemeUids"?: ((args_0: string[]) => any) | undefined;
10
- }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
13
+ 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>;
11
14
  export default _default;
12
15
  //# sourceMappingURL=RequestAuth.vue.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RequestAuth.vue.d.ts","sourceRoot":"","sources":["../../../../../src/views/Request/RequestSection/RequestAuth/RequestAuth.vue"],"names":[],"mappings":"AAkVA,KAAK,WAAW,GAAG;IACjB,0BAA0B,EAAE,MAAM,EAAE,CAAA;IACpC,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,QAAQ,GAAG,WAAW,CAAA;CAC/B,CAAC;;;;;;AAuYF,wBAQG"}
1
+ {"version":3,"file":"RequestAuth.vue.d.ts","sourceRoot":"","sources":["../../../../../src/views/Request/RequestSection/RequestAuth/RequestAuth.vue"],"names":[],"mappings":"AAuTA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAA;AACnF,OAAO,KAAK,EACV,UAAU,EACV,SAAS,EACT,MAAM,EACP,MAAM,iCAAiC,CAAA;AACxC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAA;AASrE,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,UAAU,CAAA;IACtB,MAAM,EAAE,QAAQ,GAAG,WAAW,CAAA;IAC9B,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB,0BAA0B,EAAE,0BAA0B,CAAA;IACtD,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,EAAE,SAAS,CAAA;CACrB,CAAC;;AAmWF,wBAOG"}
@@ -1,7 +1,7 @@
1
1
  import t from "./RequestAuth.vue2.js";
2
2
  /* empty css */
3
3
  import o from "../../../../_virtual/_plugin-vue_export-helper.js";
4
- const m = /* @__PURE__ */ o(t, [["__scopeId", "data-v-01b699f6"]]);
4
+ const m = /* @__PURE__ */ o(t, [["__scopeId", "data-v-c68c4902"]]);
5
5
  export {
6
6
  m as default
7
7
  };
@@ -1,139 +1,124 @@
1
- import { defineComponent as F, ref as _, computed as r, openBlock as M, createBlock as K, withCtx as m, createElementVNode as y, toDisplayString as q, createElementBlock as L, normalizeClass as N, createCommentVNode as z, createVNode as d, unref as n } from "vue";
2
- import W from "../../../../components/ViewLayout/ViewLayoutCollapse.vue.js";
3
- import { useLayout as H } from "../../../../hooks/useLayout.js";
4
- import { useActiveEntities as P } from "../../../../store/active-entities.js";
5
- import { useModal as G, ScalarComboboxMultiselect as J, ScalarButton as Q, ScalarIcon as X } from "@scalar/components";
6
- import { isDefined as U } from "@scalar/oas-utils/helpers";
7
- import Y from "./DeleteRequestAuthModal.vue.js";
8
- import Z from "./RequestAuthDataTable.vue.js";
9
- import { ADD_AUTH_OPTIONS as ee } from "../../consts/new-auth-options.js";
10
- import { useWorkspace as te } from "../../../../store/store.js";
11
- import { displaySchemeFormatter as g } from "../../libs/auth.js";
12
- const le = { class: "inline-flex gap-1 items-center" }, oe = { class: "flex flex-1 -mx-1" }, ie = { class: "text-c-1" }, ye = /* @__PURE__ */ F({
1
+ import { defineComponent as $, ref as b, computed as d, openBlock as q, createBlock as B, withCtx as a, createElementVNode as f, toDisplayString as S, createElementBlock as V, normalizeClass as L, createCommentVNode as T, createVNode as u, unref as c } from "vue";
2
+ import j from "../../../../components/ViewLayout/ViewLayoutCollapse.vue.js";
3
+ import { useLayout as z } from "../../../../hooks/useLayout.js";
4
+ import { useWorkspace as E } from "../../../../store/store.js";
5
+ import { useModal as I, ScalarComboboxMultiselect as K, ScalarButton as N, ScalarIcon as W } from "@scalar/components";
6
+ import { isDefined as F } from "@scalar/oas-utils/helpers";
7
+ import G from "./DeleteRequestAuthModal.vue.js";
8
+ import H from "./RequestAuthDataTable.vue.js";
9
+ import { getSecurityRequirements as J, formatComplexScheme as P, formatScheme as Q, getSchemeOptions as X } from "../../libs/auth.js";
10
+ const Y = { class: "inline-flex gap-1 items-center" }, Z = { class: "flex flex-1 -mx-1" }, _ = { class: "text-c-1" }, ae = /* @__PURE__ */ $({
13
11
  __name: "RequestAuth",
14
12
  props: {
13
+ collection: {},
14
+ layout: {},
15
+ operation: {},
15
16
  selectedSecuritySchemeUids: {},
17
+ server: {},
16
18
  title: {},
17
- layout: {}
19
+ workspace: {}
18
20
  },
19
- emits: ["update:selectedSecuritySchemeUids"],
20
- setup(h, { emit: O }) {
21
- const R = O, { layout: v } = H(), { activeCollection: a, activeRequest: f } = P(), {
22
- securitySchemes: k,
23
- securitySchemeMutators: $,
24
- requestMutators: B,
25
- collectionMutators: V
26
- } = te(), A = _(null), p = G(), S = _(null), D = r(() => {
27
- var l, i;
28
- const e = ((l = f.value) == null ? void 0 : l.security) ?? ((i = a.value) == null ? void 0 : i.security) ?? [];
29
- return { filteredRequirements: e.filter(
30
- (s) => Object.keys(s).length
31
- ), requirements: e };
32
- }), b = r(() => {
33
- const { filteredRequirements: e, requirements: t } = D.value;
21
+ setup(s) {
22
+ const { layout: h } = z(), {
23
+ securitySchemes: y,
24
+ securitySchemeMutators: R,
25
+ requestMutators: C,
26
+ collectionMutators: A
27
+ } = E(), g = b(null), m = I(), p = b(null), x = d(() => {
28
+ const e = J(s.operation, s.collection);
29
+ return { filteredRequirements: e.filter((o) => Object.keys(o).length), requirements: e };
30
+ }), v = d(() => {
31
+ const { filteredRequirements: e, requirements: t } = x.value;
34
32
  if (!t.length) return null;
35
- const l = e.length < t.length, i = l ? "Unlock" : "Lock", s = l ? "Optional" : "Required", u = `${e.length === 1 ? Object.keys(e[0] || {})[0] : ""} ${s}`;
36
- return { icon: i, text: u };
37
- }), c = r(
38
- () => h.selectedSecuritySchemeUids.map((e) => {
39
- const t = k[e ?? ""];
33
+ const o = e.length < t.length, n = o ? "Unlock" : "Lock", l = o ? "Optional" : "Required", U = `${e.length === 1 ? Object.keys(e[0] || {})[0] : ""} ${l}`;
34
+ return { icon: n, text: U };
35
+ }), r = d(
36
+ () => s.selectedSecuritySchemeUids.map((e) => {
37
+ if (Array.isArray(e)) return P(e, y);
38
+ const t = y[e ?? ""];
40
39
  if (t)
41
- return g(t);
42
- }).filter(U)
40
+ return Q(t);
41
+ }).filter(F)
43
42
  );
44
- function w(e) {
45
- var i, s;
46
- if (!((i = a.value) != null && i.uid) || !((s = f.value) != null && s.uid)) return;
47
- const t = e.find((o) => o.payload), l = e.filter((o) => !o.payload).map(({ id: o }) => o);
43
+ function D(e) {
44
+ var n;
45
+ const t = e.find((l) => l.payload), o = e.filter((l) => !l.payload).map(({ id: l }) => {
46
+ const i = l.split(",");
47
+ return i.length > 1 ? i : l;
48
+ });
48
49
  if (t != null && t.payload) {
49
- const o = $.add(
50
+ const l = R.add(
50
51
  t.payload,
51
- a.value.uid
52
+ (n = s.collection) == null ? void 0 : n.uid
52
53
  );
53
- o && l.push(o.uid);
54
+ l && o.push(l.uid);
54
55
  }
55
- C(l), R("update:selectedSecuritySchemeUids", l);
56
+ k(o);
56
57
  }
57
- const C = (e) => {
58
- !a.value || !f.value || (v === "modal" || h.layout === "reference" ? V.edit(
59
- a.value.uid,
60
- "selectedSecuritySchemeUids",
61
- e
62
- ) : B.edit(
63
- f.value.uid,
64
- "selectedSecuritySchemeUids",
65
- e
66
- ));
58
+ const k = (e) => {
59
+ var t;
60
+ h === "modal" || s.layout === "reference" ? A.edit(s.collection.uid, "selectedSecuritySchemeUids", e) : (t = s.operation) != null && t.uid && C.edit(s.operation.uid, "selectedSecuritySchemeUids", e);
67
61
  };
68
- function T(e) {
69
- S.value = e, p.show();
62
+ function w(e) {
63
+ p.value = e, m.show();
70
64
  }
71
- const E = (e) => {
72
- var l;
73
- const t = h.selectedSecuritySchemeUids.filter(
74
- (i) => i !== e
75
- );
76
- C(t), R("update:selectedSecuritySchemeUids", t), (l = A.value) == null || l.$el.focus(), p.hide();
77
- }, I = r(() => {
78
- var t;
79
- return (((t = a.value) == null ? void 0 : t.securitySchemes) ?? []).map((l) => k[l]).filter((l) => l);
80
- }), j = r(
65
+ const O = (e) => {
66
+ var o;
67
+ if (!e) return;
68
+ const t = s.selectedSecuritySchemeUids.filter((n) => {
69
+ const l = e.split(",");
70
+ return l.length > 1 && Array.isArray(n) && l.length === n.length ? n.every((i) => !l.includes(i)) : n !== e;
71
+ });
72
+ k(t), (o = g.value) == null || o.$el.focus(), m.hide();
73
+ }, M = d(
81
74
  () => {
82
- const e = [...I.value], t = [];
83
- D.value.filteredRequirements.forEach((o) => {
84
- const u = e.findIndex(
85
- (x) => (x == null ? void 0 : x.nameKey) === Object.keys(o)[0]
86
- );
87
- u > -1 && (t.push(e[u]), e.splice(u, 1));
88
- });
89
- const l = e.map((o) => o ? g(o) : void 0).filter(U), i = t.map((o) => o ? g(o) : void 0).filter(U), s = [
90
- { label: "Required authentication", options: i },
91
- { label: "Available authentication", options: l }
92
- ];
93
- return v === "modal" || h.layout === "reference" ? i.length ? s : l : (s.push({
94
- label: "Add new authentication",
95
- options: ee
96
- }), s);
75
+ var e;
76
+ return X(
77
+ x.value.filteredRequirements,
78
+ ((e = s.collection) == null ? void 0 : e.securitySchemes) ?? [],
79
+ y,
80
+ h === "modal" || s.layout === "reference"
81
+ );
97
82
  }
98
83
  );
99
- return (e, t) => (M(), K(W, {
84
+ return (e, t) => (q(), B(j, {
100
85
  class: "group/params",
101
- itemCount: c.value.length,
86
+ itemCount: r.value.length,
102
87
  layout: e.layout
103
88
  }, {
104
- title: m(() => [
105
- y("div", le, [
106
- y("span", null, q(e.title), 1),
107
- b.value ? (M(), L("span", {
89
+ title: a(() => [
90
+ f("div", Y, [
91
+ f("span", null, S(e.title), 1),
92
+ v.value ? (q(), V("span", {
108
93
  key: 0,
109
- class: N(["text-c-3 text-xs leading-[normal]", { "text-c-1": b.value.text === "Required" }])
110
- }, q(b.value.text), 3)) : z("", !0)
94
+ class: L(["text-c-3 text-xs leading-[normal]", { "text-c-1": v.value.text === "Required" }])
95
+ }, S(v.value.text), 3)) : T("", !0)
111
96
  ])
112
97
  ]),
113
- actions: m(() => [
114
- y("div", oe, [
115
- d(n(J), {
98
+ actions: a(() => [
99
+ f("div", Z, [
100
+ u(c(K), {
116
101
  class: "text-xs w-72",
117
- isDeletable: n(v) !== "modal" && e.layout !== "reference",
118
- modelValue: c.value,
102
+ isDeletable: c(h) !== "modal" && e.layout !== "reference",
103
+ modelValue: r.value,
119
104
  multiple: "",
120
- options: j.value,
121
- onDelete: T,
122
- "onUpdate:modelValue": w
105
+ options: M.value,
106
+ onDelete: w,
107
+ "onUpdate:modelValue": D
123
108
  }, {
124
- default: m(() => [
125
- d(n(Q), {
109
+ default: a(() => [
110
+ u(c(N), {
126
111
  ref_key: "comboboxButtonRef",
127
- ref: A,
112
+ ref: g,
128
113
  class: "h-auto px-1.5 py-0.75 hover:bg-b-3 text-c-1 hover:text-c-1 font-normal",
129
114
  fullWidth: "",
130
115
  variant: "ghost"
131
116
  }, {
132
- default: m(() => {
133
- var l;
117
+ default: a(() => {
118
+ var o;
134
119
  return [
135
- y("div", ie, q(c.value.length === 0 ? "Auth Type" : c.value.length === 1 ? (l = c.value[0]) == null ? void 0 : l.label : "Multiple"), 1),
136
- d(n(X), {
120
+ f("div", _, S(r.value.length === 0 ? "Auth Type" : r.value.length === 1 ? (o = r.value[0]) == null ? void 0 : o.label : "Multiple"), 1),
121
+ u(c(W), {
137
122
  class: "ml-1 shrink-0",
138
123
  icon: "ChevronDown",
139
124
  size: "sm"
@@ -147,18 +132,21 @@ const le = { class: "inline-flex gap-1 items-center" }, oe = { class: "flex flex
147
132
  }, 8, ["isDeletable", "modelValue", "options"])
148
133
  ])
149
134
  ]),
150
- default: m(() => [
151
- d(Z, {
135
+ default: a(() => [
136
+ u(H, {
137
+ collection: e.collection,
152
138
  layout: e.layout,
153
- selectedSecuritySchemeUids: e.selectedSecuritySchemeUids
154
- }, null, 8, ["layout", "selectedSecuritySchemeUids"]),
155
- d(Y, {
156
- scheme: S.value,
157
- state: n(p),
158
- onClose: t[0] || (t[0] = (l) => n(p).hide()),
159
- onDelete: t[1] || (t[1] = (l) => {
160
- var i;
161
- return E((i = S.value) == null ? void 0 : i.id);
139
+ selectedSchemeOptions: r.value,
140
+ server: e.server,
141
+ workspace: e.workspace
142
+ }, null, 8, ["collection", "layout", "selectedSchemeOptions", "server", "workspace"]),
143
+ u(G, {
144
+ scheme: p.value,
145
+ state: c(m),
146
+ onClose: t[0] || (t[0] = (o) => c(m).hide()),
147
+ onDelete: t[1] || (t[1] = (o) => {
148
+ var n;
149
+ return O((n = p.value) == null ? void 0 : n.id);
162
150
  })
163
151
  }, null, 8, ["scheme", "state"])
164
152
  ]),
@@ -167,5 +155,5 @@ const le = { class: "inline-flex gap-1 items-center" }, oe = { class: "flex flex
167
155
  }
168
156
  });
169
157
  export {
170
- ye as default
158
+ ae as default
171
159
  };