@scalar/api-client 2.36.2 → 2.38.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.
- package/CHANGELOG.md +47 -0
- package/dist/style.css +1 -1
- package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/OperationBlock.vue.js +87 -78
- package/dist/v2/blocks/operation-block/helpers/response-cache.d.ts +30 -0
- package/dist/v2/blocks/operation-block/helpers/response-cache.d.ts.map +1 -0
- package/dist/v2/blocks/operation-block/helpers/response-cache.js +12 -0
- package/dist/v2/blocks/request-block/components/RequestBody.vue.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestBody.vue.js +2 -2
- package/dist/v2/blocks/request-block/components/RequestBody.vue2.js +65 -61
- package/dist/v2/blocks/request-block/components/RequestBodyForm.vue.d.ts +3 -1
- package/dist/v2/blocks/request-block/components/RequestBodyForm.vue.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestBodyForm.vue.js +42 -32
- package/dist/v2/blocks/request-block/helpers/get-default-headers.js +1 -1
- package/dist/v2/blocks/request-block/helpers/get-form-body-rows.d.ts +4 -7
- package/dist/v2/blocks/request-block/helpers/get-form-body-rows.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/helpers/get-form-body-rows.js +27 -7
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.js +19 -14
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/extract-security-scheme-secrets.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/extract-security-scheme-secrets.js +72 -66
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/secret-types.d.ts +4 -4
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/secret-types.d.ts.map +1 -1
- package/dist/v2/features/collection/components/Editor/hooks/use-editor-state.d.ts +1 -1
- package/dist/v2/features/collection/components/Editor/hooks/use-editor-state.js +3 -3
- package/dist/v2/features/operation/Operation.vue.js +1 -1
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
- package/package.json +10 -10
|
@@ -1,47 +1,57 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as R, ref as h, watch as y, createBlock as r, openBlock as s } from "vue";
|
|
2
2
|
import v from "./RequestTable.vue.js";
|
|
3
|
-
import { getFormBodyRows as
|
|
3
|
+
import { getFormBodyRows as w } from "../helpers/get-form-body-rows.js";
|
|
4
4
|
import { useFileDialog as F } from "../../../../hooks/useFileDialog.js";
|
|
5
|
-
const
|
|
5
|
+
const C = /* @__PURE__ */ R({
|
|
6
6
|
__name: "RequestBodyForm",
|
|
7
7
|
props: {
|
|
8
8
|
example: {},
|
|
9
|
+
bodySchema: {},
|
|
9
10
|
selectedContentType: {},
|
|
10
11
|
environment: {}
|
|
11
12
|
},
|
|
12
13
|
emits: ["update:formValue"],
|
|
13
|
-
setup(
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
() =>
|
|
17
|
-
(t) => {
|
|
18
|
-
e.value =
|
|
14
|
+
setup(o, { emit: d }) {
|
|
15
|
+
const c = d, e = h([]);
|
|
16
|
+
y(
|
|
17
|
+
() => [o.example, o.bodySchema, o.selectedContentType],
|
|
18
|
+
([a, t, n]) => {
|
|
19
|
+
e.value = w(a, n, t);
|
|
19
20
|
},
|
|
20
21
|
{ immediate: !0 }
|
|
21
22
|
);
|
|
22
|
-
const
|
|
23
|
-
|
|
23
|
+
const u = (a) => {
|
|
24
|
+
c(
|
|
25
|
+
"update:formValue",
|
|
26
|
+
a.map((t) => ({
|
|
27
|
+
name: t.name,
|
|
28
|
+
value: t.value,
|
|
29
|
+
isDisabled: t.isDisabled ?? !1
|
|
30
|
+
}))
|
|
31
|
+
);
|
|
32
|
+
}, m = (a, t) => {
|
|
33
|
+
if (a >= e.value.length) {
|
|
24
34
|
e.value = [
|
|
25
35
|
...e.value,
|
|
26
|
-
{ name: "", value: "", ...
|
|
27
|
-
], u(
|
|
36
|
+
{ name: "", value: "", ...t, isDisabled: !1 }
|
|
37
|
+
], u(e.value);
|
|
28
38
|
return;
|
|
29
39
|
}
|
|
30
40
|
e.value = e.value.map(
|
|
31
|
-
(n, l) => l ===
|
|
32
|
-
), u(
|
|
33
|
-
},
|
|
41
|
+
(n, l) => l === a ? { ...n, ...t } : n
|
|
42
|
+
), u(e.value);
|
|
43
|
+
}, i = (a) => {
|
|
34
44
|
e.value = e.value.filter(
|
|
35
|
-
(
|
|
36
|
-
), u(
|
|
37
|
-
}, p = (
|
|
38
|
-
const { open:
|
|
45
|
+
(t, n) => n !== a
|
|
46
|
+
), u(e.value);
|
|
47
|
+
}, p = (a) => {
|
|
48
|
+
const { open: t } = F({
|
|
39
49
|
onChange: (n) => {
|
|
40
50
|
const l = n?.[0];
|
|
41
51
|
if (l) {
|
|
42
|
-
const
|
|
43
|
-
m(
|
|
44
|
-
name:
|
|
52
|
+
const f = e.value[a];
|
|
53
|
+
m(a, {
|
|
54
|
+
name: f?.name || l.name,
|
|
45
55
|
value: l
|
|
46
56
|
});
|
|
47
57
|
}
|
|
@@ -49,26 +59,26 @@ const D = /* @__PURE__ */ f({
|
|
|
49
59
|
multiple: !1,
|
|
50
60
|
accept: "*/*"
|
|
51
61
|
});
|
|
52
|
-
|
|
62
|
+
t();
|
|
53
63
|
};
|
|
54
|
-
return (
|
|
64
|
+
return (a, t) => o.selectedContentType === "multipart/form-data" ? (s(), r(v, {
|
|
55
65
|
key: 0,
|
|
56
66
|
data: e.value,
|
|
57
|
-
environment:
|
|
67
|
+
environment: o.environment,
|
|
58
68
|
showUploadButton: "",
|
|
59
|
-
onDeleteRow:
|
|
60
|
-
onRemoveFile:
|
|
69
|
+
onDeleteRow: i,
|
|
70
|
+
onRemoveFile: t[0] || (t[0] = (n) => m(n, { value: void 0 })),
|
|
61
71
|
onUploadFile: p,
|
|
62
72
|
onUpsertRow: m
|
|
63
|
-
}, null, 8, ["data", "environment"])) : (s(),
|
|
73
|
+
}, null, 8, ["data", "environment"])) : (s(), r(v, {
|
|
64
74
|
key: 1,
|
|
65
75
|
data: e.value,
|
|
66
|
-
environment:
|
|
67
|
-
onDeleteRow:
|
|
76
|
+
environment: o.environment,
|
|
77
|
+
onDeleteRow: i,
|
|
68
78
|
onUpsertRow: m
|
|
69
79
|
}, null, 8, ["data", "environment"]));
|
|
70
80
|
}
|
|
71
81
|
});
|
|
72
82
|
export {
|
|
73
|
-
|
|
83
|
+
C as default
|
|
74
84
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { canMethodHaveBody as m } from "@scalar/helpers/http/can-method-have-body";
|
|
2
2
|
import { getResolvedRef as r } from "@scalar/workspace-store/helpers/get-resolved-ref";
|
|
3
3
|
import { isElectron as y } from "../../../../libs/electron.js";
|
|
4
|
-
const l = "2.
|
|
4
|
+
const l = "2.38.0", T = "application/json", C = "*/*", a = (n, s, o) => ({
|
|
5
5
|
name: n,
|
|
6
6
|
defaultValue: s,
|
|
7
7
|
isOverridden: o.has(n.toLowerCase())
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import type { ExampleObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
value: any;
|
|
6
|
-
isDisabled: boolean;
|
|
7
|
-
}[];
|
|
1
|
+
import type { ExampleObject, SchemaObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
|
|
2
|
+
import type { TableRow } from '../../../../v2/blocks/request-block/components/RequestTableRow.vue.js';
|
|
3
|
+
/** Build the table rows for the form data, optionally enriched with schema (e.g. enum) per property */
|
|
4
|
+
export declare const getFormBodyRows: (example: ExampleObject | undefined | null, contentType: string, formBodySchema?: SchemaObject) => TableRow[];
|
|
8
5
|
//# sourceMappingURL=get-form-body-rows.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-form-body-rows.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/request-block/helpers/get-form-body-rows.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-form-body-rows.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/request-block/helpers/get-form-body-rows.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAG/G,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0DAA0D,CAAA;AAExF,uGAAuG;AACvG,eAAO,MAAM,eAAe,GAC1B,SAAS,aAAa,GAAG,SAAS,GAAG,IAAI,EACzC,aAAa,MAAM,EACnB,iBAAiB,YAAY,KAC5B,QAAQ,EAqDV,CAAA"}
|
|
@@ -1,9 +1,29 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { isObject as f } from "@scalar/helpers/object/is-object";
|
|
2
|
+
import { objectEntries as d } from "@scalar/helpers/object/object-entries";
|
|
3
|
+
import { resolve as b } from "@scalar/workspace-store/resolve";
|
|
4
|
+
import { isObjectSchema as p } from "@scalar/workspace-store/schemas/v3.1/strict/type-guards";
|
|
5
|
+
const S = (i, c, n) => {
|
|
6
|
+
if (!i?.value || c !== "multipart/form-data" && c !== "application/x-www-form-urlencoded")
|
|
7
|
+
return [];
|
|
8
|
+
const s = n && p(n) ? n : void 0, v = s ? new Set(s.required ?? []) : void 0, u = ({
|
|
9
|
+
name: r,
|
|
10
|
+
value: o,
|
|
11
|
+
isDisabled: e = !1
|
|
12
|
+
}) => {
|
|
13
|
+
const t = { name: r, value: o, isDisabled: e };
|
|
14
|
+
if (!s || !r)
|
|
15
|
+
return t;
|
|
16
|
+
const a = b.schema(s.properties?.[r]);
|
|
17
|
+
return t.schema = a, t.description = a?.description, t.isRequired = v?.has(r), t.isDisabled = e, t;
|
|
18
|
+
};
|
|
19
|
+
return Array.isArray(i.value) ? i.value.map((r) => {
|
|
20
|
+
if (f(r)) {
|
|
21
|
+
const o = String(r.name), e = r.value instanceof File ? r.value : String(r.value), t = !!r.isDisabled;
|
|
22
|
+
return u({ name: o, value: e, isDisabled: t });
|
|
23
|
+
}
|
|
24
|
+
return { name: "", value: r, isDisabled: !1 };
|
|
25
|
+
}) : typeof i.value == "object" && i.value ? d(i.value).map(([r, o]) => u({ name: String(r), value: o })) : [];
|
|
26
|
+
};
|
|
7
27
|
export {
|
|
8
|
-
|
|
28
|
+
S as getFormBodyRows
|
|
9
29
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OAuth2.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"OAuth2.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue"],"names":[],"mappings":"AAiaA,OAAO,KAAK,EAEV,iBAAiB,EAClB,MAAM,gCAAgC,CAAA;AACvC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AAGnH,OAAO,KAAK,EAEV,YAAY,EACb,MAAM,8DAA8D,CAAA;AAOrE,OAAO,KAAK,EAIV,sBAAsB,EACtB,0BAA0B,EAC3B,MAAM,6DAA6D,CAAA;AAIpE,KAAK,WAAW,GAAG;IACjB,wCAAwC;IACxC,WAAW,EAAE,kBAAkB,CAAA;IAC/B,kBAAkB;IAClB,KAAK,EAAE,sBAAsB,CAAA;IAC7B,6BAA6B;IAC7B,IAAI,EAAE,MAAM,sBAAsB,CAAA;IAClC,sBAAsB;IACtB,cAAc,EAAE,MAAM,EAAE,CAAA;IACxB,sBAAsB;IACtB,MAAM,EAAE,0BAA0B,CAAA;IAClC,mCAAmC;IACnC,MAAM,EAAE,YAAY,GAAG,IAAI,CAAA;IAC3B,gBAAgB;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,kCAAkC;IAClC,IAAI,EAAE,MAAM,CAAA;IACZ,2CAA2C;IAC3C,QAAQ,EAAE,iBAAiB,CAAA;CAC5B,CAAC;AA4wBF,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;kFAGhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useLoadingState as
|
|
3
|
-
import { pkceOptions as
|
|
1
|
+
import { defineComponent as I, computed as C, ref as L, watch as O, createElementBlock as k, openBlock as m, Fragment as p, createVNode as r, unref as o, withCtx as l, createTextVNode as u, createElementVNode as S, createBlock as v, createCommentVNode as f } from "vue";
|
|
2
|
+
import { useLoadingState as P, ScalarButton as V } from "@scalar/components";
|
|
3
|
+
import { pkceOptions as R } from "@scalar/oas-utils/entities/spec";
|
|
4
4
|
import { useToasts as F } from "@scalar/use-toasts";
|
|
5
5
|
import { getEnvironmentVariables as A } from "../../operation-block/helpers/get-environment-variables.js";
|
|
6
6
|
import E from "./OAuthScopesInput.vue.js";
|
|
@@ -8,7 +8,7 @@ import E from "./OAuthScopesInput.vue.js";
|
|
|
8
8
|
import { authorizeOauth2 as N } from "../helpers/oauth.js";
|
|
9
9
|
import c from "./RequestAuthDataTableInput.vue.js";
|
|
10
10
|
import i from "../../../../components/DataTable/DataTableRow.vue.js";
|
|
11
|
-
const j = { class: "flex h-8 items-center justify-end gap-2 border-t" }, Q = { class: "flex h-8 w-full items-center justify-end border-t" }, J = /* @__PURE__ */
|
|
11
|
+
const j = { class: "flex h-8 items-center justify-end gap-2 border-t" }, Q = { class: "flex h-8 w-full items-center justify-end border-t" }, J = /* @__PURE__ */ I({
|
|
12
12
|
__name: "OAuth2",
|
|
13
13
|
props: {
|
|
14
14
|
environment: {},
|
|
@@ -23,7 +23,7 @@ const j = { class: "flex h-8 items-center justify-end gap-2 border-t" }, Q = { c
|
|
|
23
23
|
},
|
|
24
24
|
emits: ["update:selectedScopes"],
|
|
25
25
|
setup(t, { emit: T }) {
|
|
26
|
-
const g = T, x =
|
|
26
|
+
const g = T, x = P(), { toast: B } = F(), n = C(() => t.flows[t.type]), w = C(
|
|
27
27
|
() => t.selectedScopes.filter((s) => s in (n.value.scopes ?? {}))
|
|
28
28
|
), y = (s) => {
|
|
29
29
|
if (t.scheme.type === "openIdConnect")
|
|
@@ -45,8 +45,8 @@ const j = { class: "flex h-8 items-center justify-end gap-2 border-t" }, Q = { c
|
|
|
45
45
|
name: t.name
|
|
46
46
|
}), b = () => t.eventBus.emit("auth:clear:security-scheme-secrets", {
|
|
47
47
|
name: t.name
|
|
48
|
-
}), U =
|
|
49
|
-
|
|
48
|
+
}), U = L(!1);
|
|
49
|
+
O(
|
|
50
50
|
() => n.value["x-scalar-secret-redirect-uri"],
|
|
51
51
|
(s) => {
|
|
52
52
|
U.value || s || typeof window > "u" || !("x-scalar-secret-redirect-uri" in n.value) || (U.value = !0, d({
|
|
@@ -55,7 +55,7 @@ const j = { class: "flex h-8 items-center justify-end gap-2 border-t" }, Q = { c
|
|
|
55
55
|
},
|
|
56
56
|
{ immediate: !0 }
|
|
57
57
|
);
|
|
58
|
-
const
|
|
58
|
+
const h = async () => {
|
|
59
59
|
if (x.isLoading)
|
|
60
60
|
return;
|
|
61
61
|
x.start();
|
|
@@ -71,9 +71,14 @@ const j = { class: "flex h-8 items-center justify-end gap-2 border-t" }, Q = { c
|
|
|
71
71
|
"x-scalar-secret-token": e.accessToken,
|
|
72
72
|
...e.refreshToken ? { "x-scalar-secret-refresh-token": e.refreshToken } : {}
|
|
73
73
|
}) : (console.error(s), B(s?.message ?? "Failed to authorize", "error"));
|
|
74
|
-
},
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
}, z = (s) => {
|
|
75
|
+
const e = s === "body" ? "body" : "header";
|
|
76
|
+
t.scheme.type !== "openIdConnect" && y({
|
|
77
|
+
"x-scalar-credentials-location": e
|
|
78
|
+
}), d({
|
|
79
|
+
"x-scalar-credentials-location": e
|
|
80
|
+
});
|
|
81
|
+
};
|
|
77
82
|
return (s, e) => n.value["x-scalar-secret-token"] ? (m(), k(p, { key: 0 }, [
|
|
78
83
|
r(o(i), null, {
|
|
79
84
|
default: l(() => [
|
|
@@ -240,7 +245,7 @@ const j = { class: "flex h-8 items-center justify-end gap-2 border-t" }, Q = { c
|
|
|
240
245
|
"x-usePkce" in n.value ? (m(), v(o(i), { key: 3 }, {
|
|
241
246
|
default: l(() => [
|
|
242
247
|
r(c, {
|
|
243
|
-
enum: o(
|
|
248
|
+
enum: o(R),
|
|
244
249
|
environment: t.environment,
|
|
245
250
|
modelValue: n.value["x-usePkce"],
|
|
246
251
|
readOnly: "",
|
|
@@ -264,7 +269,7 @@ const j = { class: "flex h-8 items-center justify-end gap-2 border-t" }, Q = { c
|
|
|
264
269
|
modelValue: n.value["x-scalar-credentials-location"] || "header",
|
|
265
270
|
placeholder: "header",
|
|
266
271
|
readOnly: "",
|
|
267
|
-
"onUpdate:modelValue": e[10] || (e[10] = (a) =>
|
|
272
|
+
"onUpdate:modelValue": e[10] || (e[10] = (a) => z(a))
|
|
268
273
|
}, {
|
|
269
274
|
default: l(() => [...e[22] || (e[22] = [
|
|
270
275
|
u(" Credentials Location ", -1)
|
|
@@ -306,7 +311,7 @@ const j = { class: "flex h-8 items-center justify-end gap-2 border-t" }, Q = { c
|
|
|
306
311
|
loader: o(x),
|
|
307
312
|
size: "sm",
|
|
308
313
|
variant: "outlined",
|
|
309
|
-
onClick:
|
|
314
|
+
onClick: h
|
|
310
315
|
}, {
|
|
311
316
|
default: l(() => [...e[24] || (e[24] = [
|
|
312
317
|
u(" Authorize ", -1)
|
package/dist/v2/blocks/scalar-auth-selector-block/helpers/extract-security-scheme-secrets.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extract-security-scheme-secrets.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/helpers/extract-security-scheme-secrets.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAC5D,OAAO,KAAK,EAAE,SAAS,EAA2C,MAAM,uCAAuC,CAAA;AAC/G,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iDAAiD,CAAA;
|
|
1
|
+
{"version":3,"file":"extract-security-scheme-secrets.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/helpers/extract-security-scheme-secrets.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAC5D,OAAO,KAAK,EAAE,SAAS,EAA2C,MAAM,uCAAuC,CAAA;AAC/G,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iDAAiD,CAAA;AAQlF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8DAA8D,CAAA;AAExG,OAAO,KAAK,EAUV,0BAA0B,EAC3B,MAAM,gBAAgB,CAAA;AAEvB,wGAAwG;AACxG,MAAM,MAAM,gBAAgB,GAAG,oBAAoB,GAAG,WAAW,CAAC,cAAc,CAAC,CAAA;AAyKjF,6DAA6D;AAC7D,eAAO,MAAM,4BAA4B,GAEvC,QAAQ,oBAAoB,GAAG,WAAW,CAAC,cAAc,CAAC,EAC1D,WAAW,SAAS,EACpB,MAAM,MAAM,EACZ,cAAc,MAAM,KACnB,0BAuDF,CAAA"}
|
package/dist/v2/blocks/scalar-auth-selector-block/helpers/extract-security-scheme-secrets.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { isObject as
|
|
2
|
-
import { objectEntries as
|
|
3
|
-
const
|
|
1
|
+
import { isObject as f } from "@scalar/helpers/object/is-object";
|
|
2
|
+
import { objectEntries as p } from "@scalar/helpers/object/object-entries";
|
|
3
|
+
const C = {
|
|
4
4
|
"x-scalar-secret-client-id": "x-scalar-client-id",
|
|
5
5
|
"x-scalar-secret-client-secret": "clientSecret",
|
|
6
6
|
"x-scalar-secret-password": "password",
|
|
@@ -9,22 +9,25 @@ const f = {
|
|
|
9
9
|
"x-scalar-secret-username": "username",
|
|
10
10
|
"x-scalar-secret-auth-url": "authorizationUrl",
|
|
11
11
|
"x-scalar-secret-token-url": "tokenUrl"
|
|
12
|
-
}, i = (
|
|
13
|
-
|
|
14
|
-
const
|
|
15
|
-
return [
|
|
12
|
+
}, i = (e, t, c = {}) => Object.fromEntries(
|
|
13
|
+
e.map((n) => {
|
|
14
|
+
const a = c[n] || t[n] || t[C[n]] || "";
|
|
15
|
+
return [n, a];
|
|
16
16
|
})
|
|
17
|
-
), l = (
|
|
18
|
-
const
|
|
19
|
-
return typeof
|
|
20
|
-
},
|
|
21
|
-
const
|
|
22
|
-
return {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
17
|
+
), l = (e = {}) => {
|
|
18
|
+
const t = e["x-scalar-secret-refresh-token"];
|
|
19
|
+
return typeof t == "string" ? { "x-scalar-secret-refresh-token": t } : {};
|
|
20
|
+
}, o = (e, t = {}) => {
|
|
21
|
+
const c = t["x-scalar-credentials-location"] ?? e["x-scalar-credentials-location"];
|
|
22
|
+
return c ? { "x-scalar-credentials-location": c } : {};
|
|
23
|
+
}, u = (e, t) => {
|
|
24
|
+
const c = /* @__PURE__ */ new Set();
|
|
25
|
+
return { flows: p(e ?? {}).reduce((a, [r, s]) => {
|
|
26
|
+
if (!f(s))
|
|
27
|
+
return a;
|
|
28
|
+
const d = s.selectedScopes;
|
|
29
|
+
return Array.isArray(d) && d.forEach((x) => typeof x == "string" && c.add(x)), r === "implicit" && (a.implicit = {
|
|
30
|
+
...s,
|
|
28
31
|
...i(
|
|
29
32
|
[
|
|
30
33
|
"x-scalar-secret-client-id",
|
|
@@ -32,12 +35,12 @@ const f = {
|
|
|
32
35
|
"x-scalar-secret-token",
|
|
33
36
|
"x-scalar-secret-auth-url"
|
|
34
37
|
],
|
|
35
|
-
|
|
36
|
-
|
|
38
|
+
s,
|
|
39
|
+
t?.implicit
|
|
37
40
|
),
|
|
38
|
-
...l(
|
|
39
|
-
}),
|
|
40
|
-
...
|
|
41
|
+
...l(t?.implicit)
|
|
42
|
+
}), r === "password" && (a[r] = {
|
|
43
|
+
...s,
|
|
41
44
|
...i(
|
|
42
45
|
[
|
|
43
46
|
"x-scalar-secret-client-id",
|
|
@@ -47,12 +50,13 @@ const f = {
|
|
|
47
50
|
"x-scalar-secret-token",
|
|
48
51
|
"x-scalar-secret-token-url"
|
|
49
52
|
],
|
|
50
|
-
|
|
51
|
-
|
|
53
|
+
s,
|
|
54
|
+
t?.password
|
|
52
55
|
),
|
|
53
|
-
...
|
|
54
|
-
|
|
55
|
-
|
|
56
|
+
...o(s, t?.password),
|
|
57
|
+
...l(t?.password)
|
|
58
|
+
}), r === "clientCredentials" && (a[r] = {
|
|
59
|
+
...s,
|
|
56
60
|
...i(
|
|
57
61
|
[
|
|
58
62
|
"x-scalar-secret-client-id",
|
|
@@ -60,12 +64,13 @@ const f = {
|
|
|
60
64
|
"x-scalar-secret-token",
|
|
61
65
|
"x-scalar-secret-token-url"
|
|
62
66
|
],
|
|
63
|
-
|
|
64
|
-
|
|
67
|
+
s,
|
|
68
|
+
t?.clientCredentials
|
|
65
69
|
),
|
|
66
|
-
...
|
|
67
|
-
|
|
68
|
-
|
|
70
|
+
...o(s, t?.clientCredentials),
|
|
71
|
+
...l(t?.clientCredentials)
|
|
72
|
+
}), r === "authorizationCode" && (a[r] = {
|
|
73
|
+
...s,
|
|
69
74
|
...i(
|
|
70
75
|
[
|
|
71
76
|
"x-scalar-secret-client-id",
|
|
@@ -75,55 +80,56 @@ const f = {
|
|
|
75
80
|
"x-scalar-secret-auth-url",
|
|
76
81
|
"x-scalar-secret-token-url"
|
|
77
82
|
],
|
|
78
|
-
|
|
79
|
-
|
|
83
|
+
s,
|
|
84
|
+
t?.authorizationCode
|
|
80
85
|
),
|
|
81
|
-
...
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
},
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
86
|
+
...o(s, t?.authorizationCode),
|
|
87
|
+
...l(t?.authorizationCode)
|
|
88
|
+
}), a;
|
|
89
|
+
}, {}), selectedScopes: Array.from(c) };
|
|
90
|
+
}, h = (e, t, c, n) => {
|
|
91
|
+
const a = t.getAuthSecrets(n, c);
|
|
92
|
+
if (e.type === "apiKey") {
|
|
93
|
+
const r = a?.type === "apiKey" ? a : void 0;
|
|
88
94
|
return {
|
|
89
|
-
...
|
|
90
|
-
"x-scalar-secret-token":
|
|
95
|
+
...e,
|
|
96
|
+
"x-scalar-secret-token": r?.["x-scalar-secret-token"] || e.value || ""
|
|
91
97
|
};
|
|
92
98
|
}
|
|
93
|
-
if (
|
|
94
|
-
const
|
|
99
|
+
if (e.type === "http") {
|
|
100
|
+
const r = a?.type === "http" ? a : void 0;
|
|
95
101
|
return {
|
|
96
|
-
...
|
|
97
|
-
"x-scalar-secret-token":
|
|
98
|
-
"x-scalar-secret-username":
|
|
99
|
-
"x-scalar-secret-password":
|
|
102
|
+
...e,
|
|
103
|
+
"x-scalar-secret-token": r?.["x-scalar-secret-token"] || e.token || "",
|
|
104
|
+
"x-scalar-secret-username": r?.["x-scalar-secret-username"] || e.username || "",
|
|
105
|
+
"x-scalar-secret-password": r?.["x-scalar-secret-password"] || e.password || ""
|
|
100
106
|
};
|
|
101
107
|
}
|
|
102
|
-
if (
|
|
103
|
-
const
|
|
108
|
+
if (e.type === "oauth2") {
|
|
109
|
+
const r = a?.type === "oauth2" ? a : void 0, s = u(e.flows, r);
|
|
104
110
|
return {
|
|
105
|
-
...
|
|
106
|
-
flows:
|
|
107
|
-
"x-default-scopes":
|
|
111
|
+
...e,
|
|
112
|
+
flows: s.flows,
|
|
113
|
+
"x-default-scopes": s.selectedScopes
|
|
108
114
|
};
|
|
109
115
|
}
|
|
110
|
-
if (
|
|
111
|
-
const
|
|
116
|
+
if (e.type === "openIdConnect") {
|
|
117
|
+
const r = a?.type === "openIdConnect" ? a : void 0, s = u(
|
|
112
118
|
{
|
|
113
|
-
implicit:
|
|
114
|
-
password:
|
|
115
|
-
clientCredentials:
|
|
116
|
-
authorizationCode:
|
|
119
|
+
implicit: r?.implicit,
|
|
120
|
+
password: r?.password,
|
|
121
|
+
clientCredentials: r?.clientCredentials,
|
|
122
|
+
authorizationCode: r?.authorizationCode
|
|
117
123
|
},
|
|
118
|
-
|
|
124
|
+
r
|
|
119
125
|
);
|
|
120
126
|
return {
|
|
121
|
-
...
|
|
122
|
-
...
|
|
127
|
+
...e,
|
|
128
|
+
...p(s.flows).length ? { flows: s.flows } : {}
|
|
123
129
|
};
|
|
124
130
|
}
|
|
125
|
-
return
|
|
131
|
+
return e;
|
|
126
132
|
};
|
|
127
133
|
export {
|
|
128
|
-
|
|
134
|
+
h as extractSecuritySchemeSecrets
|
|
129
135
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { XScalarAuthUrl, XScalarSecretClientId, XScalarSecretClientSecret, XScalarSecretHTTP, XScalarSecretRedirectUri, XScalarSecretRefreshToken, XScalarSecretToken, XScalarTokenUrl } from '@scalar/workspace-store/schemas/extensions/security';
|
|
1
|
+
import type { XScalarAuthUrl, XScalarCredentialsLocation, XScalarSecretClientId, XScalarSecretClientSecret, XScalarSecretHTTP, XScalarSecretRedirectUri, XScalarSecretRefreshToken, XScalarSecretToken, XScalarTokenUrl } from '@scalar/workspace-store/schemas/extensions/security';
|
|
2
2
|
import type { OAuthFlowAuthorizationCode, OAuthFlowClientCredentials, OAuthFlowImplicit, OAuthFlowPassword } from '@scalar/workspace-store/schemas/v3.1/strict/oauth-flow';
|
|
3
3
|
import type { ApiKeyObject, HttpObject, OAuth2Object, OpenIdConnectObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
|
|
4
4
|
type OAuthFlowCommonSecret = XScalarSecretClientId & XScalarSecretToken & XScalarSecretRefreshToken & XScalarAuthUrl & XScalarTokenUrl;
|
|
5
5
|
export type OAuthFlowImplicitSecret = OAuthFlowImplicit & OAuthFlowCommonSecret & XScalarSecretRedirectUri;
|
|
6
|
-
export type OAuthFlowPasswordSecret = OAuthFlowPassword & OAuthFlowCommonSecret & XScalarSecretHTTP & XScalarSecretClientSecret;
|
|
7
|
-
export type OAuthFlowClientCredentialsSecret = OAuthFlowClientCredentials & OAuthFlowCommonSecret & XScalarSecretClientSecret;
|
|
8
|
-
export type OAuthFlowAuthorizationCodeSecret = OAuthFlowAuthorizationCode & OAuthFlowCommonSecret & XScalarSecretClientSecret & XScalarSecretRedirectUri;
|
|
6
|
+
export type OAuthFlowPasswordSecret = OAuthFlowPassword & OAuthFlowCommonSecret & XScalarSecretHTTP & XScalarSecretClientSecret & XScalarCredentialsLocation;
|
|
7
|
+
export type OAuthFlowClientCredentialsSecret = OAuthFlowClientCredentials & OAuthFlowCommonSecret & XScalarSecretClientSecret & XScalarCredentialsLocation;
|
|
8
|
+
export type OAuthFlowAuthorizationCodeSecret = OAuthFlowAuthorizationCode & OAuthFlowCommonSecret & XScalarSecretClientSecret & XScalarSecretRedirectUri & XScalarCredentialsLocation;
|
|
9
9
|
export type OAuthFlowsObjectSecret = {
|
|
10
10
|
implicit?: OAuthFlowImplicitSecret;
|
|
11
11
|
password?: OAuthFlowPasswordSecret;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"secret-types.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/helpers/secret-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,qBAAqB,EACrB,yBAAyB,EACzB,iBAAiB,EACjB,wBAAwB,EACxB,yBAAyB,EACzB,kBAAkB,EAClB,eAAe,EAChB,MAAM,qDAAqD,CAAA;AAC5D,OAAO,KAAK,EACV,0BAA0B,EAC1B,0BAA0B,EAC1B,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,wDAAwD,CAAA;AAC/D,OAAO,KAAK,EACV,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,mBAAmB,EACpB,MAAM,8DAA8D,CAAA;AAErE,KAAK,qBAAqB,GAAG,qBAAqB,GAChD,kBAAkB,GAClB,yBAAyB,GACzB,cAAc,GACd,eAAe,CAAA;AAEjB,MAAM,MAAM,uBAAuB,GAAG,iBAAiB,GAAG,qBAAqB,GAAG,wBAAwB,CAAA;AAE1G,MAAM,MAAM,uBAAuB,GAAG,iBAAiB,GACrD,qBAAqB,GACrB,iBAAiB,GACjB,yBAAyB,CAAA;
|
|
1
|
+
{"version":3,"file":"secret-types.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/helpers/secret-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,0BAA0B,EAC1B,qBAAqB,EACrB,yBAAyB,EACzB,iBAAiB,EACjB,wBAAwB,EACxB,yBAAyB,EACzB,kBAAkB,EAClB,eAAe,EAChB,MAAM,qDAAqD,CAAA;AAC5D,OAAO,KAAK,EACV,0BAA0B,EAC1B,0BAA0B,EAC1B,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,wDAAwD,CAAA;AAC/D,OAAO,KAAK,EACV,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,mBAAmB,EACpB,MAAM,8DAA8D,CAAA;AAErE,KAAK,qBAAqB,GAAG,qBAAqB,GAChD,kBAAkB,GAClB,yBAAyB,GACzB,cAAc,GACd,eAAe,CAAA;AAEjB,MAAM,MAAM,uBAAuB,GAAG,iBAAiB,GAAG,qBAAqB,GAAG,wBAAwB,CAAA;AAE1G,MAAM,MAAM,uBAAuB,GAAG,iBAAiB,GACrD,qBAAqB,GACrB,iBAAiB,GACjB,yBAAyB,GACzB,0BAA0B,CAAA;AAE5B,MAAM,MAAM,gCAAgC,GAAG,0BAA0B,GACvE,qBAAqB,GACrB,yBAAyB,GACzB,0BAA0B,CAAA;AAE5B,MAAM,MAAM,gCAAgC,GAAG,0BAA0B,GACvE,qBAAqB,GACrB,yBAAyB,GACzB,wBAAwB,GACxB,0BAA0B,CAAA;AAE5B,MAAM,MAAM,sBAAsB,GAAG;IACnC,QAAQ,CAAC,EAAE,uBAAuB,CAAA;IAClC,QAAQ,CAAC,EAAE,uBAAuB,CAAA;IAClC,iBAAiB,CAAC,EAAE,gCAAgC,CAAA;IACpD,iBAAiB,CAAC,EAAE,gCAAgC,CAAA;CACrD,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG,YAAY,GAAG,kBAAkB,CAAA;AAClE,MAAM,MAAM,gBAAgB,GAAG,UAAU,GAAG,iBAAiB,GAAG,kBAAkB,CAAA;AAClF,MAAM,MAAM,kBAAkB,GAAG,IAAI,CAAC,YAAY,EAAE,OAAO,CAAC,GAAG;IAAE,KAAK,EAAE,sBAAsB,CAAA;CAAE,CAAA;AAChG,MAAM,MAAM,yBAAyB,GAAG,mBAAmB,GAAG;IAAE,KAAK,CAAC,EAAE,sBAAsB,CAAA;CAAE,CAAA;AAEhG,MAAM,MAAM,0BAA0B,GAClC,kBAAkB,GAClB,gBAAgB,GAChB,kBAAkB,GAClB,yBAAyB,CAAA"}
|
|
@@ -7,7 +7,7 @@ export declare const useEditorState: () => {
|
|
|
7
7
|
isEditorMaximized: import("vue").Ref<boolean, boolean>;
|
|
8
8
|
isYamlMode: import("vue").ComputedRef<boolean>;
|
|
9
9
|
editorBottomPadding: import("vue").ComputedRef<46 | 155>;
|
|
10
|
-
editorRootClass: import("vue").ComputedRef<"" | "fixed inset-0 z-50 h-screen w-screen border bg-b-1 p-3">;
|
|
10
|
+
editorRootClass: import("vue").ComputedRef<"" | "fixed inset-0 z-50 h-screen w-screen border bg-b-1 p-3 mac:pt-12">;
|
|
11
11
|
getLanguageToggleClass: (isActive: boolean) => string;
|
|
12
12
|
toggleEditorMaximized: () => void;
|
|
13
13
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ref as e, computed as o } from "vue";
|
|
2
|
-
const g = 46, u = 155,
|
|
2
|
+
const g = 46, u = 155, p = () => {
|
|
3
3
|
const n = e(!1), a = e(!1), s = e("json"), i = e(!1), t = e(!1), c = o(() => s.value === "yaml"), r = o(
|
|
4
4
|
() => i.value ? u : g
|
|
5
5
|
), d = o(
|
|
6
|
-
() => t.value ? "fixed inset-0 z-50 h-screen w-screen border bg-b-1 p-3" : ""
|
|
6
|
+
() => t.value ? "fixed inset-0 z-50 h-screen w-screen border bg-b-1 p-3 mac:pt-12" : ""
|
|
7
7
|
);
|
|
8
8
|
return {
|
|
9
9
|
isAutoSaveEnabled: n,
|
|
@@ -21,5 +21,5 @@ const g = 46, u = 155, E = () => {
|
|
|
21
21
|
};
|
|
22
22
|
};
|
|
23
23
|
export {
|
|
24
|
-
|
|
24
|
+
p as useEditorState
|
|
25
25
|
};
|
|
@@ -84,7 +84,7 @@ const V = {
|
|
|
84
84
|
)
|
|
85
85
|
)), g = t(
|
|
86
86
|
() => b(a(e.options)?.hiddenClients)
|
|
87
|
-
), x = "2.
|
|
87
|
+
), x = "2.38.0";
|
|
88
88
|
return (n, o) => e.path && e.method && e.exampleName && r.value ? (m(), C(c(R), {
|
|
89
89
|
key: 0,
|
|
90
90
|
activeEnvironment: e.workspaceStore.workspace["x-scalar-active-environment"],
|
|
@@ -33,7 +33,7 @@ const W = { class: "flex-center relative flex flex-1 flex-col gap-6 p-2 capitali
|
|
|
33
33
|
}));
|
|
34
34
|
}, f = (u) => {
|
|
35
35
|
u?.createNew && g.name === "request" && p();
|
|
36
|
-
}, v = "2.
|
|
36
|
+
}, v = "2.38.0";
|
|
37
37
|
return q(() => a.hotKeys.on(f)), R(() => a.hotKeys.off(f)), (u, e) => (l(), n("div", W, [
|
|
38
38
|
s("div", {
|
|
39
39
|
class: y(["flex h-[calc(100%_-_50px)] flex-col items-center justify-center", {
|
package/package.json
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"rest",
|
|
19
19
|
"testing"
|
|
20
20
|
],
|
|
21
|
-
"version": "2.
|
|
21
|
+
"version": "2.38.0",
|
|
22
22
|
"engines": {
|
|
23
23
|
"node": ">=22"
|
|
24
24
|
},
|
|
@@ -340,26 +340,26 @@
|
|
|
340
340
|
"whatwg-mimetype": "4.0.0",
|
|
341
341
|
"yaml": "^2.8.0",
|
|
342
342
|
"zod": "^4.3.5",
|
|
343
|
-
"@scalar/components": "0.20.6",
|
|
344
343
|
"@scalar/analytics-client": "1.1.0",
|
|
345
344
|
"@scalar/helpers": "0.4.1",
|
|
346
345
|
"@scalar/draggable": "0.4.0",
|
|
346
|
+
"@scalar/components": "0.20.8",
|
|
347
347
|
"@scalar/icons": "0.6.0",
|
|
348
348
|
"@scalar/import": "0.5.2",
|
|
349
349
|
"@scalar/json-magic": "0.12.3",
|
|
350
|
+
"@scalar/oas-utils": "0.10.7",
|
|
350
351
|
"@scalar/object-utils": "1.3.2",
|
|
351
|
-
"@scalar/
|
|
352
|
+
"@scalar/sidebar": "0.8.8",
|
|
352
353
|
"@scalar/openapi-types": "0.6.0",
|
|
354
|
+
"@scalar/openapi-parser": "0.25.3",
|
|
353
355
|
"@scalar/snippetz": "0.7.4",
|
|
354
|
-
"@scalar/
|
|
356
|
+
"@scalar/postman-to-openapi": "0.5.2",
|
|
355
357
|
"@scalar/themes": "0.15.0",
|
|
356
358
|
"@scalar/types": "0.7.3",
|
|
357
|
-
"@scalar/
|
|
358
|
-
"@scalar/postman-to-openapi": "0.5.2",
|
|
359
|
-
"@scalar/use-codemirror": "0.14.6",
|
|
359
|
+
"@scalar/use-codemirror": "0.14.8",
|
|
360
360
|
"@scalar/use-hooks": "0.4.0",
|
|
361
|
-
"@scalar/
|
|
362
|
-
"@scalar/
|
|
361
|
+
"@scalar/use-toasts": "0.10.0",
|
|
362
|
+
"@scalar/workspace-store": "0.40.1"
|
|
363
363
|
},
|
|
364
364
|
"devDependencies": {
|
|
365
365
|
"@tailwindcss/vite": "^4.1.18",
|
|
@@ -376,7 +376,7 @@
|
|
|
376
376
|
"vitest": "4.0.16",
|
|
377
377
|
"@scalar/build-tooling": "0.5.0",
|
|
378
378
|
"@scalar/galaxy": "0.6.0",
|
|
379
|
-
"@scalar/pre-post-request-scripts": "0.3.
|
|
379
|
+
"@scalar/pre-post-request-scripts": "0.3.8"
|
|
380
380
|
},
|
|
381
381
|
"scripts": {
|
|
382
382
|
"build": "scalar-build-vite",
|