@scalar/api-client 2.26.1 → 2.27.1
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 +102 -0
- package/dist/components/Server/ServerSelector.vue.js +6 -6
- package/dist/components/ViewLayout/ViewLayoutCollapse.vue.js +6 -6
- package/dist/style.css +1 -1
- package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts +1 -1
- package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/OperationBlock.vue.js +48 -43
- package/dist/v2/blocks/operation-block/components/Header.vue.js +2 -2
- package/dist/v2/blocks/operation-block/components/Header.vue2.js +10 -10
- package/dist/v2/blocks/operation-block/helpers/build-request-body.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/helpers/build-request-body.js +29 -25
- package/dist/v2/blocks/operation-block/helpers/get-example.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/helpers/get-example.js +15 -15
- package/dist/v2/blocks/operation-block/helpers/get-selected-body-content-type.d.ts +10 -0
- package/dist/v2/blocks/operation-block/helpers/get-selected-body-content-type.d.ts.map +1 -0
- package/dist/v2/blocks/operation-block/helpers/get-selected-body-content-type.js +4 -0
- package/dist/v2/blocks/operation-block/helpers/send-request.d.ts +1 -1
- package/dist/v2/blocks/operation-block/helpers/send-request.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/helpers/send-request.js +1 -1
- package/dist/v2/blocks/request-block/RequestBlock.vue.d.ts +1 -1
- package/dist/v2/blocks/request-block/RequestBlock.vue.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/RequestBlock.vue.js +1 -1
- package/dist/v2/blocks/request-block/RequestBlock.vue2.js +101 -100
- 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 +62 -69
- package/dist/v2/blocks/request-block/components/RequestParams.vue.js +6 -6
- package/dist/v2/blocks/request-block/components/RequestTable.vue.d.ts +36 -2
- package/dist/v2/blocks/request-block/components/RequestTable.vue.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestTable.vue.js +1 -1
- package/dist/v2/blocks/request-block/components/RequestTableRow.vue.d.ts +38 -3
- package/dist/v2/blocks/request-block/components/RequestTableRow.vue.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/helpers/get-default-headers.js +1 -1
- package/dist/v2/blocks/response-block/ResponseBlock.vue.d.ts +1 -1
- package/dist/v2/blocks/response-block/ResponseBlock.vue.d.ts.map +1 -1
- package/dist/v2/blocks/response-block/ResponseBlock.vue.js +1 -1
- package/dist/v2/blocks/response-block/ResponseBlock.vue2.js +68 -69
- package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.d.ts.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.js +1 -1
- package/dist/v2/blocks/response-block/components/ResponseEmpty.vue2.js +31 -40
- package/dist/v2/blocks/scalar-address-bar-block/components/EnvironmentSelector.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-address-bar-block/components/EnvironmentSelector.vue.js +35 -41
- package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.js +37 -41
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts +3 -2
- 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 +107 -87
- package/dist/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue.d.ts +21 -0
- package/dist/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue.d.ts.map +1 -0
- package/dist/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue.js +91 -0
- package/dist/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue2.js +4 -0
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.js +107 -93
- 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 +87 -65
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/fetch-openid-connect-discovery.d.ts +36 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/fetch-openid-connect-discovery.d.ts.map +1 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/fetch-openid-connect-discovery.js +35 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/merge-security.d.ts +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/merge-security.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/merge-security.js +18 -10
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/openid-discovery-to-flows.d.ts +5 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/openid-discovery-to-flows.d.ts.map +1 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/openid-discovery-to-flows.js +27 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/secret-types.d.ts +3 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/secret-types.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.d.ts +1 -2
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.js +29 -37
- package/dist/v2/components/layout/CollapsibleSection.vue.js +1 -1
- package/dist/v2/components/modals/ModalClientContainer.vue.d.ts +2 -2
- package/dist/v2/components/modals/ModalClientContainer.vue.d.ts.map +1 -1
- package/dist/v2/components/modals/ModalClientContainer.vue.js +1 -1
- package/dist/v2/components/modals/ModalClientContainer.vue2.js +45 -42
- package/dist/v2/components/sidebar/Sidebar.vue.d.ts +2 -0
- package/dist/v2/components/sidebar/Sidebar.vue.d.ts.map +1 -1
- package/dist/v2/components/sidebar/Sidebar.vue.js +25 -24
- package/dist/v2/components/sidebar/SidebarMenu.vue.d.ts +2 -0
- package/dist/v2/components/sidebar/SidebarMenu.vue.d.ts.map +1 -1
- package/dist/v2/components/sidebar/SidebarMenu.vue.js +30 -30
- package/dist/v2/features/app/App.vue.d.ts +6 -1
- package/dist/v2/features/app/App.vue.d.ts.map +1 -1
- package/dist/v2/features/app/App.vue.js +48 -46
- package/dist/v2/features/app/app-events.d.ts +1 -1
- package/dist/v2/features/app/app-events.d.ts.map +1 -1
- package/dist/v2/features/app/app-events.js +95 -56
- package/dist/v2/features/app/components/AppSidebar.vue.d.ts.map +1 -1
- package/dist/v2/features/app/components/AppSidebar.vue.js +3 -3
- package/dist/v2/features/app/components/AppSidebar.vue2.js +111 -105
- package/dist/v2/features/app/helpers/create-api-client-app.d.ts +12 -2
- package/dist/v2/features/app/helpers/create-api-client-app.d.ts.map +1 -1
- package/dist/v2/features/app/helpers/create-api-client-app.js +12 -10
- package/dist/v2/features/app/helpers/routes.d.ts +3 -1
- package/dist/v2/features/app/helpers/routes.d.ts.map +1 -1
- package/dist/v2/features/app/hooks/use-theme.d.ts +42 -0
- package/dist/v2/features/app/hooks/use-theme.d.ts.map +1 -0
- package/dist/v2/features/app/hooks/use-theme.js +34 -0
- package/dist/v2/features/app/index.d.ts +0 -1
- package/dist/v2/features/app/index.d.ts.map +1 -1
- package/dist/v2/features/collection/DocumentCollection.vue.d.ts.map +1 -1
- package/dist/v2/features/collection/DocumentCollection.vue.js +27 -26
- package/dist/v2/features/collection/WorkspaceCollection.vue.js +13 -12
- package/dist/v2/features/collection/components/Authentication.vue.d.ts.map +1 -1
- package/dist/v2/features/collection/components/Authentication.vue.js +2 -2
- package/dist/v2/features/collection/components/Authentication.vue2.js +49 -40
- package/dist/v2/features/collection/components/Cookies.vue.d.ts.map +1 -1
- package/dist/v2/features/collection/components/Cookies.vue.js +26 -13
- package/dist/v2/features/collection/components/Environment.vue.d.ts.map +1 -1
- package/dist/v2/features/collection/components/Environment.vue.js +27 -15
- package/dist/v2/features/collection/components/Overview.vue.d.ts.map +1 -1
- package/dist/v2/features/collection/components/Overview.vue.js +2 -2
- package/dist/v2/features/collection/components/Overview.vue2.js +68 -61
- package/dist/v2/features/collection/components/Servers.vue.d.ts.map +1 -1
- package/dist/v2/features/collection/components/Servers.vue.js +93 -88
- package/dist/v2/features/collection/components/Settings.vue.d.ts.map +1 -1
- package/dist/v2/features/collection/components/Settings.vue.js +19 -17
- package/dist/v2/features/environments/EnvironmentsList.vue.js +1 -1
- package/dist/v2/features/global-cookies/components/CookiesTable.vue.d.ts.map +1 -1
- package/dist/v2/features/global-cookies/components/CookiesTable.vue.js +2 -2
- package/dist/v2/features/global-cookies/components/CookiesTable.vue2.js +8 -8
- package/dist/v2/features/modal/Modal.vue.d.ts +1 -1
- package/dist/v2/features/modal/Modal.vue.d.ts.map +1 -1
- package/dist/v2/features/modal/Modal.vue.js +15 -15
- package/dist/v2/features/modal/helpers/create-api-client-modal.d.ts +1 -1
- package/dist/v2/features/modal/helpers/create-api-client-modal.d.ts.map +1 -1
- package/dist/v2/features/operation/Operation.vue.d.ts.map +1 -1
- package/dist/v2/features/operation/Operation.vue.js +31 -34
- package/dist/v2/features/settings/CollectionSettings.vue.d.ts +10 -7
- package/dist/v2/features/settings/CollectionSettings.vue.d.ts.map +1 -1
- package/dist/v2/features/settings/CollectionSettings.vue.js +183 -149
- package/dist/v2/features/settings/DocumentSettings.vue.d.ts.map +1 -1
- package/dist/v2/features/settings/DocumentSettings.vue.js +88 -79
- package/dist/v2/features/settings/components/Section.vue.d.ts +2 -1
- package/dist/v2/features/settings/components/Section.vue.d.ts.map +1 -1
- package/dist/v2/features/settings/components/Section.vue.js +26 -15
- package/dist/v2/features/settings/helpers/get-theme-colors.d.ts +4 -3
- package/dist/v2/features/settings/helpers/get-theme-colors.d.ts.map +1 -1
- package/dist/v2/features/settings/helpers/get-theme-colors.js +6 -7
- package/dist/v2/helpers/handle-hotkeys.d.ts.map +1 -1
- package/dist/v2/helpers/handle-hotkeys.js +2 -2
- package/dist/v2/helpers/index.d.ts +0 -1
- package/dist/v2/helpers/index.d.ts.map +1 -1
- package/dist/v2/hooks/use-global-hot-keys.d.ts +3 -1
- package/dist/v2/hooks/use-global-hot-keys.d.ts.map +1 -1
- package/dist/v2/hooks/use-global-hot-keys.js +8 -6
- package/dist/v2/workspace-events.d.ts.map +1 -1
- package/dist/v2/workspace-events.js +10 -0
- package/dist/views/Request/RequestSidebar.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSidebar.vue.js +2 -2
- package/dist/views/Request/RequestSidebar.vue2.js +139 -155
- package/dist/views/Request/RequestSidebarItem.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSidebarItem.vue.js +2 -2
- package/dist/views/Request/RequestSidebarItem.vue2.js +104 -101
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
- package/package.json +20 -18
- package/dist/v2/helpers/plugins.d.ts +0 -65
- package/dist/v2/helpers/plugins.d.ts.map +0 -1
- package/dist/v2/helpers/plugins.js +0 -11
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { ScalarMarkdownSummary as
|
|
3
|
-
import { getResolvedRef as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
1
|
+
import { defineComponent as Q, computed as $, ref as q, createElementBlock as i, openBlock as o, Fragment as d, renderList as C, createBlock as y, createCommentVNode as v, unref as c, withCtx as r, createVNode as u, createElementVNode as b, toDisplayString as j, createTextVNode as f, normalizeClass as D, capitalize as E } from "vue";
|
|
2
|
+
import { ScalarMarkdownSummary as H } from "@scalar/components";
|
|
3
|
+
import { getResolvedRef as L } from "@scalar/workspace-store/helpers/get-resolved-ref";
|
|
4
|
+
import G from "./OAuth2.vue.js";
|
|
5
|
+
import J from "./OpenIDConnect.vue.js";
|
|
6
|
+
import x from "./RequestAuthDataTableInput.vue.js";
|
|
6
7
|
import m from "../../../components/data-table/DataTableRow.vue.js";
|
|
7
|
-
import
|
|
8
|
-
const
|
|
8
|
+
import K from "../../../components/data-table/DataTableCell.vue.js";
|
|
9
|
+
const W = { class: "bg-b-1 text-c-2 outline-b-3 top-0 z-1 h-full w-full overflow-hidden px-3 py-1.25 text-ellipsis group-hover/auth:absolute group-hover/auth:h-auto group-hover/auth:border-b *:first:line-clamp-1 *:first:text-ellipsis group-hover/auth:*:first:line-clamp-none" }, X = { class: "flex min-h-8 border-t text-base" }, Y = { class: "flex h-8 max-w-full gap-2.5 overflow-x-auto px-3" }, Z = ["onClick"], _ = { class: "relative z-10" }, ee = {
|
|
10
|
+
key: 5,
|
|
11
|
+
class: "text-c-3 flex items-center justify-center border-t p-4 px-4 text-center text-xs text-balance"
|
|
12
|
+
}, ie = /* @__PURE__ */ Q({
|
|
9
13
|
__name: "RequestAuthTab",
|
|
10
14
|
props: {
|
|
11
15
|
environment: {},
|
|
@@ -17,69 +21,72 @@ const L = { class: "bg-b-1 text-c-2 outline-b-3 top-0 z-1 h-full w-full overflow
|
|
|
17
21
|
eventBus: {}
|
|
18
22
|
},
|
|
19
23
|
emits: ["update:selectedScopes"],
|
|
20
|
-
setup(
|
|
21
|
-
const
|
|
22
|
-
() => Object.entries(
|
|
23
|
-
scheme:
|
|
24
|
-
name:
|
|
24
|
+
setup(n, { emit: A }) {
|
|
25
|
+
const O = A, w = $(
|
|
26
|
+
() => Object.entries(n.selectedSecuritySchemas).map(([a, e = []]) => ({
|
|
27
|
+
scheme: L(n.securitySchemes[a]),
|
|
28
|
+
name: a,
|
|
25
29
|
scopes: e
|
|
26
30
|
}))
|
|
27
|
-
),
|
|
28
|
-
|
|
31
|
+
), h = q(""), k = $(() => w.value.flatMap(({ scheme: e }) => e?.type !== "oauth2" && e?.type !== "openIdConnect" ? [] : Object.keys(e.flows ?? {})).includes(h.value) ? h.value : ""), N = (a) => {
|
|
32
|
+
h.value = a;
|
|
33
|
+
}, B = $(() => w.value.length > 1), F = (a, e) => {
|
|
34
|
+
const t = E(a), l = e.description ? `: ${e.description}` : "";
|
|
29
35
|
switch (e.type) {
|
|
30
36
|
case "apiKey":
|
|
31
|
-
return `${t}${
|
|
37
|
+
return `${t}${l || `: ${e.in}`}`;
|
|
38
|
+
case "openIdConnect":
|
|
32
39
|
case "oauth2": {
|
|
33
|
-
const
|
|
34
|
-
return `${t}: ${s}${
|
|
40
|
+
const U = Object.keys(e.flows ?? {})[0], s = k.value || U;
|
|
41
|
+
return s ? `${t}: ${s}${l}` : `${t}${l}`;
|
|
35
42
|
}
|
|
36
43
|
case "http":
|
|
37
|
-
return `${t}: ${e.scheme}${
|
|
44
|
+
return `${t}: ${e.scheme}${l}`;
|
|
38
45
|
default:
|
|
39
|
-
return `${t}${
|
|
46
|
+
return `${t}${l}`;
|
|
40
47
|
}
|
|
41
|
-
},
|
|
42
|
-
payload: { type: "http", ...
|
|
48
|
+
}, T = (a, e) => k.value === a || e === 0 && !k.value, V = () => n.isStatic && "border-t", S = (a, e) => n.eventBus.emit("auth:update:security-scheme-secrets", {
|
|
49
|
+
payload: { type: "http", ...a },
|
|
43
50
|
name: e
|
|
44
|
-
}),
|
|
45
|
-
payload: { type: "apiKey", ...
|
|
51
|
+
}), R = (a, e) => n.eventBus.emit("auth:update:security-scheme-secrets", {
|
|
52
|
+
payload: { type: "apiKey", ...a },
|
|
46
53
|
name: e
|
|
47
|
-
}),
|
|
48
|
-
payload: { type: "apiKey", ...
|
|
54
|
+
}), z = (a, e) => n.eventBus.emit("auth:update:security-scheme", {
|
|
55
|
+
payload: { type: "apiKey", ...a },
|
|
49
56
|
name: e
|
|
50
|
-
}), M = (
|
|
51
|
-
|
|
52
|
-
id: Object.keys(
|
|
53
|
-
name:
|
|
57
|
+
}), M = (a, e) => {
|
|
58
|
+
O("update:selectedScopes", {
|
|
59
|
+
id: Object.keys(n.selectedSecuritySchemas),
|
|
60
|
+
name: a,
|
|
54
61
|
...e
|
|
55
62
|
});
|
|
56
|
-
},
|
|
63
|
+
}, P = (a, e) => {
|
|
57
64
|
const t = "floating-bg text-c-3 relative cursor-pointer border-b border-transparent py-1 text-base font-medium";
|
|
58
|
-
return
|
|
65
|
+
return T(a, e) ? `${t} !text-c-1 !rounded-none border-b !border-current ${n.isStatic ? "opacity-100" : ""}` : t;
|
|
59
66
|
};
|
|
60
|
-
return (
|
|
61
|
-
|
|
67
|
+
return (a, e) => (o(!0), i(d, null, C(w.value, ({ scheme: t, name: l, scopes: U }) => (o(), i(d, { key: l }, [
|
|
68
|
+
B.value && t ? (o(), y(c(m), { key: 0 }, {
|
|
62
69
|
default: r(() => [
|
|
63
|
-
|
|
64
|
-
"aria-label":
|
|
70
|
+
u(c(K), {
|
|
71
|
+
"aria-label": F(l, t),
|
|
65
72
|
class: "text-c-2 group/auth flex items-center leading-[22px] whitespace-nowrap outline-none hover:whitespace-normal"
|
|
66
73
|
}, {
|
|
67
74
|
default: r(() => [
|
|
68
|
-
|
|
75
|
+
b("p", W, j(F(l, t)), 1)
|
|
69
76
|
]),
|
|
70
77
|
_: 2
|
|
71
78
|
}, 1032, ["aria-label"])
|
|
72
79
|
]),
|
|
73
80
|
_: 2
|
|
74
81
|
}, 1024)) : v("", !0),
|
|
75
|
-
t?.description && !
|
|
82
|
+
t?.description && !B.value ? (o(), y(c(m), { key: 1 }, {
|
|
76
83
|
default: r(() => [
|
|
77
|
-
|
|
84
|
+
u(c(K), {
|
|
78
85
|
"aria-label": t.description,
|
|
79
86
|
class: "max-h-[auto]"
|
|
80
87
|
}, {
|
|
81
88
|
default: r(() => [
|
|
82
|
-
|
|
89
|
+
u(c(H), {
|
|
83
90
|
class: "auth-description bg-b-1 text-c-2 min-w-0 flex-1 px-3 py-1.25",
|
|
84
91
|
value: t.description
|
|
85
92
|
}, null, 8, ["value"])
|
|
@@ -89,54 +96,54 @@ const L = { class: "bg-b-1 text-c-2 outline-b-3 top-0 z-1 h-full w-full overflow
|
|
|
89
96
|
]),
|
|
90
97
|
_: 2
|
|
91
98
|
}, 1024)) : v("", !0),
|
|
92
|
-
t?.type === "http" ? (
|
|
93
|
-
t.scheme === "bearer" ? (
|
|
99
|
+
t?.type === "http" ? (o(), i(d, { key: 2 }, [
|
|
100
|
+
t.scheme === "bearer" ? (o(), y(c(m), { key: 0 }, {
|
|
94
101
|
default: r(() => [
|
|
95
|
-
|
|
96
|
-
containerClass:
|
|
97
|
-
environment:
|
|
102
|
+
u(x, {
|
|
103
|
+
containerClass: V(),
|
|
104
|
+
environment: n.environment,
|
|
98
105
|
modelValue: t["x-scalar-secret-token"],
|
|
99
106
|
placeholder: "Token",
|
|
100
107
|
type: "password",
|
|
101
|
-
"onUpdate:modelValue": (s) => S({ "x-scalar-secret-token": s },
|
|
108
|
+
"onUpdate:modelValue": (s) => S({ "x-scalar-secret-token": s }, l)
|
|
102
109
|
}, {
|
|
103
110
|
default: r(() => [...e[0] || (e[0] = [
|
|
104
|
-
|
|
111
|
+
f(" Bearer Token ", -1)
|
|
105
112
|
])]),
|
|
106
113
|
_: 1
|
|
107
114
|
}, 8, ["containerClass", "environment", "modelValue", "onUpdate:modelValue"])
|
|
108
115
|
]),
|
|
109
116
|
_: 2
|
|
110
|
-
}, 1024)) : t?.scheme === "basic" ? (
|
|
111
|
-
|
|
117
|
+
}, 1024)) : t?.scheme === "basic" ? (o(), i(d, { key: 1 }, [
|
|
118
|
+
u(c(m), null, {
|
|
112
119
|
default: r(() => [
|
|
113
|
-
|
|
120
|
+
u(x, {
|
|
114
121
|
class: "text-c-2",
|
|
115
|
-
environment:
|
|
122
|
+
environment: n.environment,
|
|
116
123
|
modelValue: t["x-scalar-secret-username"],
|
|
117
124
|
placeholder: "janedoe",
|
|
118
125
|
required: "",
|
|
119
|
-
"onUpdate:modelValue": (s) => S({ "x-scalar-secret-username": s },
|
|
126
|
+
"onUpdate:modelValue": (s) => S({ "x-scalar-secret-username": s }, l)
|
|
120
127
|
}, {
|
|
121
128
|
default: r(() => [...e[1] || (e[1] = [
|
|
122
|
-
|
|
129
|
+
f(" Username ", -1)
|
|
123
130
|
])]),
|
|
124
131
|
_: 1
|
|
125
132
|
}, 8, ["environment", "modelValue", "onUpdate:modelValue"])
|
|
126
133
|
]),
|
|
127
134
|
_: 2
|
|
128
135
|
}, 1024),
|
|
129
|
-
|
|
136
|
+
u(c(m), null, {
|
|
130
137
|
default: r(() => [
|
|
131
|
-
|
|
132
|
-
environment:
|
|
138
|
+
u(x, {
|
|
139
|
+
environment: n.environment,
|
|
133
140
|
modelValue: t["x-scalar-secret-password"],
|
|
134
141
|
placeholder: "********",
|
|
135
142
|
type: "password",
|
|
136
|
-
"onUpdate:modelValue": (s) => S({ "x-scalar-secret-password": s },
|
|
143
|
+
"onUpdate:modelValue": (s) => S({ "x-scalar-secret-password": s }, l)
|
|
137
144
|
}, {
|
|
138
145
|
default: r(() => [...e[2] || (e[2] = [
|
|
139
|
-
|
|
146
|
+
f(" Password ", -1)
|
|
140
147
|
])]),
|
|
141
148
|
_: 1
|
|
142
149
|
}, 8, ["environment", "modelValue", "onUpdate:modelValue"])
|
|
@@ -144,80 +151,87 @@ const L = { class: "bg-b-1 text-c-2 outline-b-3 top-0 z-1 h-full w-full overflow
|
|
|
144
151
|
_: 2
|
|
145
152
|
}, 1024)
|
|
146
153
|
], 64)) : v("", !0)
|
|
147
|
-
], 64)) : t?.type === "apiKey" ? (
|
|
148
|
-
|
|
154
|
+
], 64)) : t?.type === "apiKey" ? (o(), i(d, { key: 3 }, [
|
|
155
|
+
u(c(m), null, {
|
|
149
156
|
default: r(() => [
|
|
150
|
-
|
|
151
|
-
containerClass:
|
|
152
|
-
environment:
|
|
157
|
+
u(x, {
|
|
158
|
+
containerClass: V(),
|
|
159
|
+
environment: n.environment,
|
|
153
160
|
modelValue: t.name,
|
|
154
161
|
placeholder: "api-key",
|
|
155
|
-
"onUpdate:modelValue": (s) =>
|
|
162
|
+
"onUpdate:modelValue": (s) => z({ name: s }, l)
|
|
156
163
|
}, {
|
|
157
164
|
default: r(() => [...e[3] || (e[3] = [
|
|
158
|
-
|
|
165
|
+
f(" Name ", -1)
|
|
159
166
|
])]),
|
|
160
167
|
_: 1
|
|
161
168
|
}, 8, ["containerClass", "environment", "modelValue", "onUpdate:modelValue"])
|
|
162
169
|
]),
|
|
163
170
|
_: 2
|
|
164
171
|
}, 1024),
|
|
165
|
-
|
|
172
|
+
u(c(m), null, {
|
|
166
173
|
default: r(() => [
|
|
167
|
-
|
|
168
|
-
environment:
|
|
174
|
+
u(x, {
|
|
175
|
+
environment: n.environment,
|
|
169
176
|
modelValue: t["x-scalar-secret-token"],
|
|
170
177
|
placeholder: "QUxMIFlPVVIgQkFTRSBBUkUgQkVMT05HIFRPIFVT",
|
|
171
178
|
type: "password",
|
|
172
|
-
"onUpdate:modelValue": (s) =>
|
|
179
|
+
"onUpdate:modelValue": (s) => R({ "x-scalar-secret-token": s }, l)
|
|
173
180
|
}, {
|
|
174
181
|
default: r(() => [...e[4] || (e[4] = [
|
|
175
|
-
|
|
182
|
+
f(" Value ", -1)
|
|
176
183
|
])]),
|
|
177
184
|
_: 1
|
|
178
185
|
}, 8, ["environment", "modelValue", "onUpdate:modelValue"])
|
|
179
186
|
]),
|
|
180
187
|
_: 2
|
|
181
188
|
}, 1024)
|
|
182
|
-
], 64)) : t?.type === "oauth2" ? (
|
|
183
|
-
Object.keys(t.flows).length
|
|
189
|
+
], 64)) : t?.type === "oauth2" || t?.type === "openIdConnect" ? (o(), i(d, { key: 4 }, [
|
|
190
|
+
t?.type === "openIdConnect" && !Object.keys(t.flows ?? {}).length ? (o(), y(J, {
|
|
191
|
+
key: 0,
|
|
192
|
+
environment: n.environment,
|
|
193
|
+
eventBus: n.eventBus,
|
|
194
|
+
getStaticBorderClass: V,
|
|
195
|
+
name: l,
|
|
196
|
+
proxyUrl: n.proxyUrl,
|
|
197
|
+
scheme: t
|
|
198
|
+
}, null, 8, ["environment", "eventBus", "name", "proxyUrl", "scheme"])) : v("", !0),
|
|
199
|
+
Object.keys(t.flows ?? {}).length > 1 ? (o(), y(c(m), { key: 1 }, {
|
|
184
200
|
default: r(() => [
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
(
|
|
201
|
+
b("div", X, [
|
|
202
|
+
b("div", Y, [
|
|
203
|
+
(o(!0), i(d, null, C(t.flows, (s, p, g) => (o(), i("button", {
|
|
188
204
|
key: p,
|
|
189
|
-
class:
|
|
205
|
+
class: D(P(p, g)),
|
|
190
206
|
type: "button",
|
|
191
|
-
onClick: (
|
|
207
|
+
onClick: (I) => N(p)
|
|
192
208
|
}, [
|
|
193
|
-
|
|
194
|
-
], 10,
|
|
209
|
+
b("span", _, j(p), 1)
|
|
210
|
+
], 10, Z))), 128))
|
|
195
211
|
])
|
|
196
212
|
])
|
|
197
213
|
]),
|
|
198
214
|
_: 2
|
|
199
215
|
}, 1024)) : v("", !0),
|
|
200
|
-
(
|
|
201
|
-
|
|
216
|
+
(o(!0), i(d, null, C(t.flows, (s, p, g) => (o(), i(d, { key: p }, [
|
|
217
|
+
t.flows && T(p, g) ? (o(), y(G, {
|
|
202
218
|
key: 0,
|
|
203
|
-
environment:
|
|
204
|
-
eventBus:
|
|
219
|
+
environment: n.environment,
|
|
220
|
+
eventBus: n.eventBus,
|
|
205
221
|
flows: t.flows,
|
|
206
|
-
name:
|
|
207
|
-
proxyUrl:
|
|
208
|
-
|
|
209
|
-
|
|
222
|
+
name: l,
|
|
223
|
+
proxyUrl: n.proxyUrl,
|
|
224
|
+
scheme: t,
|
|
225
|
+
selectedScopes: U,
|
|
226
|
+
server: n.server,
|
|
210
227
|
type: p,
|
|
211
|
-
"onUpdate:selectedScopes": (
|
|
212
|
-
}, null, 8, ["environment", "eventBus", "flows", "name", "proxyUrl", "selectedScopes", "server", "type", "onUpdate:selectedScopes"])) : v("", !0)
|
|
228
|
+
"onUpdate:selectedScopes": (I) => M(l, I)
|
|
229
|
+
}, null, 8, ["environment", "eventBus", "flows", "name", "proxyUrl", "scheme", "selectedScopes", "server", "type", "onUpdate:selectedScopes"])) : v("", !0)
|
|
213
230
|
], 64))), 128))
|
|
214
|
-
], 64)) :
|
|
215
|
-
key: 5,
|
|
216
|
-
class: K(["text-c-3 bg-b-1 flex min-h-[calc(4rem+1px)] items-center justify-center border-t border-b-0 px-4 text-base", { "rounded-b-lg": a.isStatic }])
|
|
217
|
-
}, " Coming soon ", 2)) : v("", !0)
|
|
231
|
+
], 64)) : (o(), i("div", ee, " The security scheme is missing a type, please double check your OpenAPI document or Authentication Configuration "))
|
|
218
232
|
], 64))), 128));
|
|
219
233
|
}
|
|
220
234
|
});
|
|
221
235
|
export {
|
|
222
|
-
|
|
236
|
+
ie as default
|
|
223
237
|
};
|
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":"
|
|
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;AAOlF,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;AA0HjF,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,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isObject as p } from "@scalar/helpers/object/is-object";
|
|
2
|
+
import { objectEntries as x } from "@scalar/helpers/object/object-entries";
|
|
2
3
|
const u = {
|
|
3
4
|
"x-scalar-secret-client-id": "x-scalar-client-id",
|
|
4
5
|
"x-scalar-secret-client-secret": "clientSecret",
|
|
@@ -6,80 +7,101 @@ const u = {
|
|
|
6
7
|
"x-scalar-secret-redirect-uri": "x-scalar-redirect-uri",
|
|
7
8
|
"x-scalar-secret-token": "token",
|
|
8
9
|
"x-scalar-secret-username": "username"
|
|
9
|
-
},
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
}, n = (t, c, i = {}) => Object.fromEntries(
|
|
11
|
+
t.map((a) => {
|
|
12
|
+
const r = i[a] || c[a] || c[u[a]] || "";
|
|
13
|
+
return [a, r];
|
|
14
|
+
})
|
|
15
|
+
), d = (t, c) => {
|
|
16
|
+
const i = /* @__PURE__ */ new Set();
|
|
17
|
+
return { flows: x(t ?? {}).reduce((r, [e, s]) => {
|
|
18
|
+
if (!p(s))
|
|
19
|
+
return r;
|
|
20
|
+
const o = s.selectedScopes;
|
|
21
|
+
return Array.isArray(o) && o.forEach((l) => typeof l == "string" && i.add(l)), e === "implicit" && (r.implicit = {
|
|
22
|
+
...s,
|
|
23
|
+
...n(
|
|
24
|
+
["x-scalar-secret-client-id", "x-scalar-secret-redirect-uri", "x-scalar-secret-token"],
|
|
25
|
+
s,
|
|
26
|
+
c?.implicit
|
|
27
|
+
)
|
|
28
|
+
}), e === "password" && (r[e] = {
|
|
29
|
+
...s,
|
|
30
|
+
...n(
|
|
31
|
+
[
|
|
32
|
+
"x-scalar-secret-client-id",
|
|
33
|
+
"x-scalar-secret-client-secret",
|
|
34
|
+
"x-scalar-secret-username",
|
|
35
|
+
"x-scalar-secret-password",
|
|
36
|
+
"x-scalar-secret-token"
|
|
37
|
+
],
|
|
38
|
+
s,
|
|
39
|
+
c?.password
|
|
40
|
+
)
|
|
41
|
+
}), e === "clientCredentials" && (r[e] = {
|
|
42
|
+
...s,
|
|
43
|
+
...n(
|
|
44
|
+
["x-scalar-secret-client-id", "x-scalar-secret-client-secret", "x-scalar-secret-token"],
|
|
45
|
+
s,
|
|
46
|
+
c?.clientCredentials
|
|
47
|
+
)
|
|
48
|
+
}), e === "authorizationCode" && (r[e] = {
|
|
49
|
+
...s,
|
|
50
|
+
...n(
|
|
51
|
+
[
|
|
52
|
+
"x-scalar-secret-client-id",
|
|
53
|
+
"x-scalar-secret-client-secret",
|
|
54
|
+
"x-scalar-secret-redirect-uri",
|
|
55
|
+
"x-scalar-secret-token"
|
|
56
|
+
],
|
|
57
|
+
s,
|
|
58
|
+
c?.authorizationCode
|
|
59
|
+
)
|
|
60
|
+
}), r;
|
|
61
|
+
}, {}), selectedScopes: Array.from(i) };
|
|
62
|
+
}, w = (t, c, i, a) => {
|
|
63
|
+
const r = c.getAuthSecrets(a, i);
|
|
64
|
+
if (t.type === "apiKey") {
|
|
65
|
+
const e = r?.type === "apiKey" ? r : void 0;
|
|
66
|
+
return {
|
|
67
|
+
...t,
|
|
68
|
+
"x-scalar-secret-token": e?.["x-scalar-secret-token"] || t.value || ""
|
|
69
|
+
};
|
|
14
70
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const s = l.getAuthSecrets(i, d);
|
|
18
|
-
if (e.type === "apiKey") {
|
|
19
|
-
const r = s?.type === "apiKey" ? s : void 0;
|
|
71
|
+
if (t.type === "http") {
|
|
72
|
+
const e = r?.type === "http" ? r : void 0;
|
|
20
73
|
return {
|
|
21
|
-
...
|
|
22
|
-
"x-scalar-secret-token":
|
|
74
|
+
...t,
|
|
75
|
+
"x-scalar-secret-token": e?.["x-scalar-secret-token"] || t.token || "",
|
|
76
|
+
"x-scalar-secret-username": e?.["x-scalar-secret-username"] || t.username || "",
|
|
77
|
+
"x-scalar-secret-password": e?.["x-scalar-secret-password"] || t.password || ""
|
|
23
78
|
};
|
|
24
79
|
}
|
|
25
|
-
if (
|
|
26
|
-
const
|
|
80
|
+
if (t.type === "oauth2") {
|
|
81
|
+
const e = r?.type === "oauth2" ? r : void 0, s = d(t.flows, e);
|
|
27
82
|
return {
|
|
28
|
-
...
|
|
29
|
-
|
|
30
|
-
"x-
|
|
31
|
-
"x-scalar-secret-password": r?.["x-scalar-secret-password"] || e.password || ""
|
|
83
|
+
...t,
|
|
84
|
+
flows: s.flows,
|
|
85
|
+
"x-default-scopes": s.selectedScopes
|
|
32
86
|
};
|
|
33
87
|
}
|
|
34
|
-
if (
|
|
35
|
-
const
|
|
88
|
+
if (t.type === "openIdConnect") {
|
|
89
|
+
const e = r?.type === "openIdConnect" ? r : void 0, s = d(
|
|
90
|
+
{
|
|
91
|
+
implicit: e?.implicit,
|
|
92
|
+
password: e?.password,
|
|
93
|
+
clientCredentials: e?.clientCredentials,
|
|
94
|
+
authorizationCode: e?.authorizationCode
|
|
95
|
+
},
|
|
96
|
+
e
|
|
97
|
+
);
|
|
36
98
|
return {
|
|
37
|
-
...
|
|
38
|
-
|
|
39
|
-
...t,
|
|
40
|
-
...o(
|
|
41
|
-
["x-scalar-secret-client-id", "x-scalar-secret-redirect-uri", "x-scalar-secret-token"],
|
|
42
|
-
t,
|
|
43
|
-
r?.implicit
|
|
44
|
-
)
|
|
45
|
-
}), c === "password" && (a[c] = {
|
|
46
|
-
...t,
|
|
47
|
-
...o(
|
|
48
|
-
[
|
|
49
|
-
"x-scalar-secret-client-id",
|
|
50
|
-
"x-scalar-secret-client-secret",
|
|
51
|
-
"x-scalar-secret-username",
|
|
52
|
-
"x-scalar-secret-password",
|
|
53
|
-
"x-scalar-secret-token"
|
|
54
|
-
],
|
|
55
|
-
t,
|
|
56
|
-
r?.password
|
|
57
|
-
)
|
|
58
|
-
}), c === "clientCredentials" && (a[c] = {
|
|
59
|
-
...t,
|
|
60
|
-
...o(
|
|
61
|
-
["x-scalar-secret-client-id", "x-scalar-secret-client-secret", "x-scalar-secret-token"],
|
|
62
|
-
t,
|
|
63
|
-
r?.clientCredentials
|
|
64
|
-
)
|
|
65
|
-
}), c === "authorizationCode" && (a[c] = {
|
|
66
|
-
...t,
|
|
67
|
-
...o(
|
|
68
|
-
[
|
|
69
|
-
"x-scalar-secret-client-id",
|
|
70
|
-
"x-scalar-secret-client-secret",
|
|
71
|
-
"x-scalar-secret-redirect-uri",
|
|
72
|
-
"x-scalar-secret-token"
|
|
73
|
-
],
|
|
74
|
-
t,
|
|
75
|
-
r?.authorizationCode
|
|
76
|
-
)
|
|
77
|
-
})), a), {}),
|
|
78
|
-
"x-default-scopes": Array.from(n)
|
|
99
|
+
...t,
|
|
100
|
+
...x(s.flows).length ? { flows: s.flows } : {}
|
|
79
101
|
};
|
|
80
102
|
}
|
|
81
|
-
return
|
|
103
|
+
return t;
|
|
82
104
|
};
|
|
83
105
|
export {
|
|
84
|
-
|
|
106
|
+
w as extractSecuritySchemeSecrets
|
|
85
107
|
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { type Static } from '@scalar/typebox';
|
|
2
|
+
import type { ErrorResponse } from '../../../../libs/errors.js';
|
|
3
|
+
/**
|
|
4
|
+
* OpenID Connect Discovery Document (subset)
|
|
5
|
+
* Represents the metadata fields consumed by the auth selector flow conversion.
|
|
6
|
+
*
|
|
7
|
+
* @see https://openid.net/specs/openid-connect-discovery-1_0.html
|
|
8
|
+
*/
|
|
9
|
+
declare const OpenIDConnectDiscoverySchema: import("@scalar/typebox").TObject<{
|
|
10
|
+
/** URL of the OAuth 2.0 Authorization Endpoint */
|
|
11
|
+
authorization_endpoint: import("@scalar/typebox").TOptional<import("@scalar/typebox").TString>;
|
|
12
|
+
/** URL of the OAuth 2.0 Token Endpoint */
|
|
13
|
+
token_endpoint: import("@scalar/typebox").TOptional<import("@scalar/typebox").TString>;
|
|
14
|
+
/** List of OAuth 2.0 scope values that this server supports */
|
|
15
|
+
scopes_supported: import("@scalar/typebox").TOptional<import("@scalar/typebox").TArray<import("@scalar/typebox").TString>>;
|
|
16
|
+
/** List of OAuth 2.0 grant type values that this server supports */
|
|
17
|
+
grant_types_supported: import("@scalar/typebox").TOptional<import("@scalar/typebox").TArray<import("@scalar/typebox").TString>>;
|
|
18
|
+
/** Supported PKCE code challenge methods (RFC 7636) */
|
|
19
|
+
code_challenge_methods_supported: import("@scalar/typebox").TOptional<import("@scalar/typebox").TArray<import("@scalar/typebox").TString>>;
|
|
20
|
+
}>;
|
|
21
|
+
export type OpenIDConnectDiscovery = Static<typeof OpenIDConnectDiscoverySchema>;
|
|
22
|
+
/**
|
|
23
|
+
* The required scope for OpenID Connect requests.
|
|
24
|
+
* If this scope is present, the request is an OIDC request; otherwise, it is a standard OAuth 2.0 request.
|
|
25
|
+
*/
|
|
26
|
+
export declare const OPENID_SCOPE = "openid";
|
|
27
|
+
/**
|
|
28
|
+
* Fetches the OpenID Connect discovery document from the specified URL.
|
|
29
|
+
* Supports both full discovery URLs and issuer URLs.
|
|
30
|
+
*
|
|
31
|
+
* @param url - The OpenID Connect discovery URL or issuer URL
|
|
32
|
+
* @returns The discovery document or an error
|
|
33
|
+
*/
|
|
34
|
+
export declare const fetchOpenIDConnectDiscovery: (url: string, proxyUrl: string) => Promise<ErrorResponse<OpenIDConnectDiscovery>>;
|
|
35
|
+
export {};
|
|
36
|
+
//# sourceMappingURL=fetch-openid-connect-discovery.d.ts.map
|
package/dist/v2/blocks/scalar-auth-selector-block/helpers/fetch-openid-connect-discovery.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetch-openid-connect-discovery.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/helpers/fetch-openid-connect-discovery.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAAQ,MAAM,iBAAiB,CAAA;AAGnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAElD;;;;;GAKG;AACH,QAAA,MAAM,4BAA4B;IAChC,kDAAkD;;IAElD,0CAA0C;;IAE1C,+DAA+D;;IAE/D,oEAAoE;;IAEpE,uDAAuD;;EAEvD,CAAA;AAEF,MAAM,MAAM,sBAAsB,GAAG,MAAM,CAAC,OAAO,4BAA4B,CAAC,CAAA;AAEhF;;;GAGG;AACH,eAAO,MAAM,YAAY,WAAW,CAAA;AAEpC;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B,GACtC,KAAK,MAAM,EACX,UAAU,MAAM,KACf,OAAO,CAAC,aAAa,CAAC,sBAAsB,CAAC,CA2C/C,CAAA"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { redirectToProxy as a } from "@scalar/helpers/url/redirect-to-proxy";
|
|
2
|
+
import { Type as n } from "@scalar/typebox";
|
|
3
|
+
import { coerceValue as p } from "@scalar/workspace-store/schemas/typebox-coerce";
|
|
4
|
+
const s = n.Object({
|
|
5
|
+
/** URL of the OAuth 2.0 Authorization Endpoint */
|
|
6
|
+
authorization_endpoint: n.Optional(n.String()),
|
|
7
|
+
/** URL of the OAuth 2.0 Token Endpoint */
|
|
8
|
+
token_endpoint: n.Optional(n.String()),
|
|
9
|
+
/** List of OAuth 2.0 scope values that this server supports */
|
|
10
|
+
scopes_supported: n.Optional(n.Array(n.String())),
|
|
11
|
+
/** List of OAuth 2.0 grant type values that this server supports */
|
|
12
|
+
grant_types_supported: n.Optional(n.Array(n.String())),
|
|
13
|
+
/** Supported PKCE code challenge methods (RFC 7636) */
|
|
14
|
+
code_challenge_methods_supported: n.Optional(n.Array(n.String()))
|
|
15
|
+
}), f = async (o, i) => {
|
|
16
|
+
try {
|
|
17
|
+
let e = o.trim();
|
|
18
|
+
if (!e)
|
|
19
|
+
return [new Error("URL cannot be empty"), null];
|
|
20
|
+
e.endsWith("/") && (e = e.slice(0, -1)), e.includes("/.well-known/openid-configuration") || (e = `${e}/.well-known/openid-configuration`);
|
|
21
|
+
const c = a(i, e), t = await fetch(c);
|
|
22
|
+
if (!t.ok)
|
|
23
|
+
return [
|
|
24
|
+
new Error(`Failed to fetch OpenID Connect discovery document: ${t.status} ${t.statusText}`),
|
|
25
|
+
null
|
|
26
|
+
];
|
|
27
|
+
const r = p(s, await t.json());
|
|
28
|
+
return !r.authorization_endpoint && !r.token_endpoint ? [new Error("Invalid OpenID Connect discovery document: missing required endpoints"), null] : [null, r];
|
|
29
|
+
} catch (e) {
|
|
30
|
+
return e instanceof Error ? [e, null] : [new Error("Failed to fetch OpenID Connect discovery document"), null];
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
export {
|
|
34
|
+
f as fetchOpenIDConnectDiscovery
|
|
35
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AuthenticationConfiguration } from '@scalar/types/api-reference';
|
|
2
2
|
import type { AuthStore } from '@scalar/workspace-store/entities/auth';
|
|
3
|
-
import type
|
|
3
|
+
import { type ComponentsObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
|
|
4
4
|
import type { SecuritySchemeObjectSecret } from './secret-types';
|
|
5
5
|
/** Document security merged with the config security schemes */
|
|
6
6
|
export type MergedSecuritySchemes = Record<string, SecuritySchemeObjectSecret>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merge-security.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/helpers/merge-security.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAA;AAC9E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uCAAuC,CAAA;
|
|
1
|
+
{"version":3,"file":"merge-security.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/helpers/merge-security.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAA;AAC9E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uCAAuC,CAAA;AAKtE,OAAO,EACL,KAAK,gBAAgB,EAGtB,MAAM,8DAA8D,CAAA;AAGrE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAA;AAEhE,gEAAgE;AAChE,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,0BAA0B,CAAC,CAAA;AAE9E,kGAAkG;AAClG,eAAO,MAAM,aAAa,GACxB,yBAAyB,gBAAgB,CAAC,iBAAiB,CAAM,EACjE,uBAAuB,2BAA2B,CAAC,iBAAiB,CAAM,EAC1E,WAAW,SAAS,EACpB,cAAc,MAAM,KACnB,qBA2BF,CAAA"}
|
|
@@ -1,15 +1,23 @@
|
|
|
1
|
-
import { objectEntries as
|
|
1
|
+
import { objectEntries as c } from "@scalar/helpers/object/object-entries";
|
|
2
|
+
import { deepClone as f } from "@scalar/workspace-store/helpers/deep-clone";
|
|
2
3
|
import { getResolvedRef as p } from "@scalar/workspace-store/helpers/get-resolved-ref";
|
|
3
|
-
import { mergeObjects as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
import { mergeObjects as g } from "@scalar/workspace-store/helpers/merge-object";
|
|
5
|
+
import { coerceValue as h } from "@scalar/workspace-store/schemas/typebox-coerce";
|
|
6
|
+
import { SecuritySchemeObjectSchema as l } from "@scalar/workspace-store/schemas/v3.1/strict/openapi-document";
|
|
7
|
+
import { extractSecuritySchemeSecrets as y } from "./extract-security-scheme-secrets.js";
|
|
8
|
+
const D = (m = {}, s = {}, i, n) => {
|
|
9
|
+
const d = c(m).reduce(
|
|
10
|
+
(e, [r, o]) => {
|
|
11
|
+
const t = f(p(o));
|
|
12
|
+
return t && (e[r] = t), e;
|
|
13
|
+
},
|
|
9
14
|
{}
|
|
10
|
-
),
|
|
11
|
-
return
|
|
15
|
+
), u = g(d, s) ?? {};
|
|
16
|
+
return c(u).reduce((e, [r, o]) => {
|
|
17
|
+
const S = { ...h(l, o), ...o };
|
|
18
|
+
return e[r] = y(S, i, r, n), e;
|
|
19
|
+
}, {});
|
|
12
20
|
};
|
|
13
21
|
export {
|
|
14
|
-
|
|
22
|
+
D as mergeSecurity
|
|
15
23
|
};
|