@scalar/api-client 2.17.7 → 2.18.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 +74 -0
- package/dist/components/CommandPalette/CommandActionInput.vue.js +1 -1
- package/dist/components/Sidebar/Actions/DeleteSidebarListElement.vue.js +5 -5
- package/dist/components/Sidebar/Actions/EditSidebarListCollection.vue.js +18 -18
- package/dist/components/Sidebar/Actions/EditSidebarListElement.vue.js +7 -7
- package/dist/components/Sidebar/Actions/SidebarListElementForm.vue.d.ts.map +1 -1
- package/dist/components/Sidebar/Actions/SidebarListElementForm.vue.js +44 -5
- package/dist/components/Sidebar/Actions/SidebarListElementForm.vue2.js +2 -44
- package/dist/style.css +1 -1
- package/dist/v2/blocks/operation-block/helpers/build-request.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/helpers/build-request.js +46 -51
- package/dist/v2/blocks/operation-block/helpers/get-environment-variables.d.ts +9 -0
- package/dist/v2/blocks/operation-block/helpers/get-environment-variables.d.ts.map +1 -0
- package/dist/v2/blocks/operation-block/helpers/get-environment-variables.js +7 -0
- package/dist/v2/blocks/operation-block/helpers/get-example.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/helpers/get-example.js +12 -10
- package/dist/v2/blocks/operation-block/helpers/get-server-url.d.ts +3 -0
- package/dist/v2/blocks/operation-block/helpers/get-server-url.d.ts.map +1 -0
- package/dist/v2/blocks/operation-block/helpers/get-server-url.js +12 -0
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.js +1 -1
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue2.js +87 -65
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts +18 -10
- 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 +149 -126
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesAddModal.vue.d.ts +20 -0
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesAddModal.vue.d.ts.map +1 -0
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesAddModal.vue.js +7 -0
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesAddModal.vue2.js +76 -0
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue.d.ts +22 -5
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue.js +79 -64
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.d.ts +16 -8
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.d.ts +2 -2
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.js +84 -82
- package/dist/v2/components/code-input/CodeInput.vue.d.ts +115 -144
- package/dist/v2/components/code-input/CodeInput.vue.d.ts.map +1 -1
- package/dist/v2/components/code-input/CodeInput.vue.js +2 -2
- package/dist/v2/components/code-input/CodeInput.vue2.js +120 -107
- package/dist/v2/components/data-table/DataTableInput.vue.d.ts +3 -3
- package/dist/v2/components/data-table/DataTableInput.vue.d.ts.map +1 -1
- package/dist/v2/components/data-table/DataTableInput.vue.js +2 -2
- package/dist/v2/components/data-table/DataTableInput.vue2.js +27 -27
- package/dist/v2/components/data-table/DataTableInputSelect.vue.d.ts +3 -2
- package/dist/v2/components/data-table/DataTableInputSelect.vue.d.ts.map +1 -1
- package/dist/v2/components/data-table/DataTableInputSelect.vue.js +42 -39
- package/dist/v2/components/forms/ConfirmationForm.vue.d.ts.map +1 -1
- package/dist/v2/components/forms/ConfirmationForm.vue.js +43 -5
- package/dist/v2/components/forms/ConfirmationForm.vue2.js +2 -43
- package/dist/v2/components/modals/DeleteModal.vue.js +11 -11
- package/dist/v2/components/sidebar/Sidebar.vue.d.ts +5 -3
- package/dist/v2/components/sidebar/Sidebar.vue.d.ts.map +1 -1
- package/dist/v2/components/sidebar/SidebarMenu.vue.d.ts +5 -3
- package/dist/v2/components/sidebar/SidebarMenu.vue.d.ts.map +1 -1
- package/dist/v2/components/sidebar/SidebarMenu.vue.js +25 -30
- package/dist/v2/features/app/App.vue.d.ts.map +1 -1
- package/dist/v2/features/app/App.vue.js +89 -141
- package/dist/v2/features/app/app-events.d.ts +22 -0
- package/dist/v2/features/app/app-events.d.ts.map +1 -0
- package/dist/v2/features/app/app-events.js +136 -0
- package/dist/v2/features/app/app-state.d.ts +135 -0
- package/dist/v2/features/app/app-state.d.ts.map +1 -0
- package/dist/v2/features/app/app-state.js +316 -0
- package/dist/v2/features/app/components/AppSidebar.vue.d.ts +6 -3
- 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 +4 -4
- package/dist/v2/features/app/components/DesktopTabs.vue.d.ts +4 -2
- package/dist/v2/features/app/components/DesktopTabs.vue.d.ts.map +1 -1
- package/dist/v2/features/app/components/DesktopTabs.vue.js +25 -22
- package/dist/v2/features/app/components/WebTopNav.vue.d.ts +9 -5
- package/dist/v2/features/app/components/WebTopNav.vue.d.ts.map +1 -1
- package/dist/v2/features/app/helpers/create-api-client-app.d.ts +62 -1
- 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 +14 -10
- package/dist/v2/features/app/helpers/routes.d.ts +5 -2
- package/dist/v2/features/app/helpers/routes.d.ts.map +1 -1
- package/dist/v2/features/collection/WorkspaceCollection.vue.js +7 -7
- package/dist/v2/features/collection/components/Form.vue.d.ts +1 -1
- package/dist/v2/features/collection/components/Form.vue.d.ts.map +1 -1
- package/dist/v2/features/collection/components/Servers.vue.d.ts.map +1 -1
- package/dist/v2/features/modal/Modal.vue.d.ts.map +1 -1
- package/dist/v2/features/modal/Modal.vue.js +2 -2
- package/dist/v2/features/modal/Modal.vue2.js +40 -41
- package/dist/v2/features/operation/Operation.vue.d.ts.map +1 -1
- package/dist/v2/features/operation/Operation.vue.js +38 -28
- package/dist/v2/features/operation/helpers/combine-params.d.ts +4 -0
- package/dist/v2/features/operation/helpers/combine-params.d.ts.map +1 -0
- package/dist/v2/features/operation/helpers/combine-params.js +13 -0
- package/dist/v2/features/operation/index.d.ts +1 -0
- package/dist/v2/features/operation/index.d.ts.map +1 -1
- package/dist/v2/features/operation/index.js +10 -8
- package/dist/v2/features/settings/DocumentSettings.vue.d.ts.map +1 -1
- package/dist/v2/features/settings/DocumentSettings.vue.js +104 -5
- package/dist/v2/features/settings/DocumentSettings.vue2.js +2 -104
- package/dist/v2/helpers/get-tab-details.d.ts +2 -2
- package/dist/v2/helpers/get-tab-details.d.ts.map +1 -1
- package/dist/views/Collection/CollectionSettings.vue.d.ts.map +1 -1
- package/dist/views/Collection/CollectionSettings.vue.js +1 -4
- package/dist/views/Collection/CollectionSettings.vue2.js +5 -5
- package/dist/views/Environment/EnvironmentColorModal.vue.js +6 -6
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
- package/package.json +17 -17
- package/dist/v2/features/app/hooks/use-app-sidebar.d.ts +0 -40
- package/dist/v2/features/app/hooks/use-app-sidebar.d.ts.map +0 -1
- package/dist/v2/features/app/hooks/use-app-sidebar.js +0 -134
- package/dist/v2/features/app/hooks/use-sync-path.d.ts +0 -11
- package/dist/v2/features/app/hooks/use-sync-path.d.ts.map +0 -1
- package/dist/v2/features/app/hooks/use-sync-path.js +0 -52
- package/dist/v2/features/app/hooks/use-tabs.d.ts +0 -31
- package/dist/v2/features/app/hooks/use-tabs.d.ts.map +0 -1
- package/dist/v2/features/app/hooks/use-tabs.js +0 -44
- package/dist/v2/features/app/hooks/use-workspace-client-app-events.d.ts +0 -18
- package/dist/v2/features/app/hooks/use-workspace-client-app-events.d.ts.map +0 -1
- package/dist/v2/features/app/hooks/use-workspace-client-app-events.js +0 -156
- package/dist/v2/features/app/hooks/use-workspace-selector.d.ts +0 -28
- package/dist/v2/features/app/hooks/use-workspace-selector.d.ts.map +0 -1
- package/dist/v2/features/app/hooks/use-workspace-selector.js +0 -81
|
@@ -1,115 +1,122 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { Disclosure as
|
|
3
|
-
import { ScalarButton as
|
|
1
|
+
import { defineComponent as T, computed as y, createBlock as p, openBlock as a, unref as s, withCtx as l, createElementVNode as r, createVNode as c, normalizeClass as j, toDisplayString as d, createCommentVNode as u, withModifiers as m, createTextVNode as f, createElementBlock as b, Fragment as z, renderList as B } from "vue";
|
|
2
|
+
import { Disclosure as N, DisclosureButton as M, DisclosurePanel as $ } from "@headlessui/vue";
|
|
3
|
+
import { useModal as E, ScalarButton as S, ScalarIcon as I } from "@scalar/components";
|
|
4
|
+
import P from "./OAuthScopesAddModal.vue.js";
|
|
4
5
|
import C from "../../../../components/DataTable/DataTableCell.vue.js";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
const
|
|
6
|
+
import R from "../../../../components/DataTable/DataTableRow.vue.js";
|
|
7
|
+
import U from "../../../../components/DataTable/DataTableCheckbox.vue.js";
|
|
8
|
+
const F = { class: "flex h-fit w-full" }, L = { class: "flex-1" }, _ = { class: "flex items-center gap-1.75" }, q = {
|
|
8
9
|
class: "grid auto-rows-auto",
|
|
9
10
|
style: { gridTemplateColumns: "1fr auto" }
|
|
10
|
-
},
|
|
11
|
+
}, G = { class: "font-code text-xs" }, H = { key: 0 }, ee = /* @__PURE__ */ T({
|
|
11
12
|
__name: "OAuthScopesInput",
|
|
12
13
|
props: {
|
|
14
|
+
flowType: {},
|
|
13
15
|
flow: {},
|
|
14
16
|
selectedScopes: {}
|
|
15
17
|
},
|
|
16
18
|
emits: ["update:selectedScopes"],
|
|
17
|
-
setup(
|
|
18
|
-
const i =
|
|
19
|
-
() => Object.entries(
|
|
20
|
-
id:
|
|
21
|
-
label:
|
|
22
|
-
description:
|
|
19
|
+
setup(n, { emit: A }) {
|
|
20
|
+
const i = A, V = y(
|
|
21
|
+
() => Object.entries(n.flow?.scopes ?? {}).map(([t, e]) => ({
|
|
22
|
+
id: t,
|
|
23
|
+
label: t,
|
|
24
|
+
description: e
|
|
23
25
|
}))
|
|
24
|
-
),
|
|
25
|
-
() =>
|
|
26
|
+
), h = y(
|
|
27
|
+
() => n.selectedScopes.length === Object.keys(n.flow?.scopes ?? {}).length
|
|
26
28
|
);
|
|
27
|
-
function
|
|
28
|
-
if (
|
|
29
|
+
function w(t, e) {
|
|
30
|
+
if (e)
|
|
29
31
|
return i("update:selectedScopes", {
|
|
30
|
-
scopes: Array.from(/* @__PURE__ */ new Set([...
|
|
32
|
+
scopes: Array.from(/* @__PURE__ */ new Set([...n.selectedScopes, t]))
|
|
31
33
|
});
|
|
32
34
|
i("update:selectedScopes", {
|
|
33
|
-
scopes:
|
|
35
|
+
scopes: n.selectedScopes.filter((o) => o !== t)
|
|
34
36
|
});
|
|
35
37
|
}
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
default: o(() => [
|
|
43
|
-
a("div", R, [
|
|
44
|
-
t[2] || (t[2] = a("div", { class: "text-c-1 h-full items-center" }, null, -1)),
|
|
45
|
-
r(s(z), {
|
|
38
|
+
const D = () => i("update:selectedScopes", { scopes: Object.keys(n.flow?.scopes ?? {}) }), O = () => i("update:selectedScopes", { scopes: [] }), v = E();
|
|
39
|
+
return (t, e) => (a(), p(s(C), { class: "h-auto !max-h-[initial] min-h-8 items-center" }, {
|
|
40
|
+
default: l(() => [
|
|
41
|
+
r("div", F, [
|
|
42
|
+
e[5] || (e[5] = r("div", { class: "text-c-1 h-full items-center" }, null, -1)),
|
|
43
|
+
c(s(N), {
|
|
46
44
|
as: "div",
|
|
47
45
|
class: "bl flex w-full flex-col"
|
|
48
46
|
}, {
|
|
49
|
-
default:
|
|
50
|
-
|
|
51
|
-
class:
|
|
47
|
+
default: l(() => [
|
|
48
|
+
c(s(M), {
|
|
49
|
+
class: j([
|
|
52
50
|
"group/scopes-accordion hover:text-c-1 flex h-auto min-h-8 cursor-pointer items-center gap-1.5 pr-2.25 pl-3 text-left",
|
|
53
|
-
(
|
|
51
|
+
(t.selectedScopes.length || 0) > 0 ? "text-c-1" : "text-c-3"
|
|
54
52
|
])
|
|
55
53
|
}, {
|
|
56
|
-
default:
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
54
|
+
default: l(({ open: o }) => [
|
|
55
|
+
r("div", L, " Scopes Selected " + d(t.selectedScopes.length || 0) + " / " + d(Object.keys(t.flow?.scopes ?? {}).length || 0), 1),
|
|
56
|
+
r("div", _, [
|
|
57
|
+
c(s(S), {
|
|
58
|
+
class: "pr-0.75 pl-1 transition-none",
|
|
59
|
+
size: "sm",
|
|
60
|
+
variant: "ghost",
|
|
61
|
+
onClick: e[0] || (e[0] = m((g) => s(v).show(), ["stop"]))
|
|
62
|
+
}, {
|
|
63
|
+
default: l(() => [...e[2] || (e[2] = [
|
|
64
|
+
f(" Add Scope ", -1)
|
|
65
|
+
])]),
|
|
66
|
+
_: 1
|
|
67
|
+
}),
|
|
68
|
+
h.value ? (a(), p(s(S), {
|
|
60
69
|
key: 0,
|
|
61
70
|
class: "pr-0.75 pl-1 transition-none",
|
|
62
71
|
size: "sm",
|
|
63
72
|
variant: "ghost",
|
|
64
|
-
onClick:
|
|
73
|
+
onClick: m(O, ["stop"])
|
|
65
74
|
}, {
|
|
66
|
-
default:
|
|
67
|
-
|
|
75
|
+
default: l(() => [...e[3] || (e[3] = [
|
|
76
|
+
f(" Deselect All ", -1)
|
|
68
77
|
])]),
|
|
69
78
|
_: 1
|
|
70
79
|
})) : u("", !0),
|
|
71
|
-
|
|
80
|
+
h.value ? u("", !0) : (a(), p(s(S), {
|
|
72
81
|
key: 1,
|
|
73
82
|
class: "pr-0.75 pl-1 transition-none",
|
|
74
83
|
size: "sm",
|
|
75
84
|
variant: "ghost",
|
|
76
|
-
onClick:
|
|
85
|
+
onClick: m(D, ["stop"])
|
|
77
86
|
}, {
|
|
78
|
-
default:
|
|
79
|
-
|
|
87
|
+
default: l(() => [...e[4] || (e[4] = [
|
|
88
|
+
f(" Select All ", -1)
|
|
80
89
|
])]),
|
|
81
90
|
_: 1
|
|
82
91
|
})),
|
|
83
|
-
|
|
92
|
+
c(s(I), {
|
|
84
93
|
class: "text-c-3 group-hover/scopes-accordion:text-c-2",
|
|
85
|
-
icon:
|
|
94
|
+
icon: o ? "ChevronDown" : "ChevronRight",
|
|
86
95
|
size: "md"
|
|
87
96
|
}, null, 8, ["icon"])
|
|
88
97
|
])
|
|
89
98
|
]),
|
|
90
99
|
_: 1
|
|
91
100
|
}, 8, ["class"]),
|
|
92
|
-
|
|
93
|
-
default:
|
|
94
|
-
|
|
95
|
-
(
|
|
96
|
-
key:
|
|
101
|
+
c(s($), { as: "template" }, {
|
|
102
|
+
default: l(() => [
|
|
103
|
+
r("table", q, [
|
|
104
|
+
(a(!0), b(z, null, B(V.value, ({ id: o, label: g, description: x }) => (a(), p(s(R), {
|
|
105
|
+
key: o,
|
|
97
106
|
class: "text-c-2",
|
|
98
|
-
onClick: (
|
|
107
|
+
onClick: (k) => w(o, !t.selectedScopes.includes(o))
|
|
99
108
|
}, {
|
|
100
|
-
default:
|
|
101
|
-
|
|
102
|
-
default:
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
m(" – " + p(h), 1)
|
|
106
|
-
])) : u("", !0)
|
|
109
|
+
default: l(() => [
|
|
110
|
+
c(s(C), { class: "hover:text-c-1 box-border !max-h-[initial] w-full cursor-pointer px-3 py-1.5" }, {
|
|
111
|
+
default: l(() => [
|
|
112
|
+
r("span", G, d(g), 1),
|
|
113
|
+
x ? (a(), b("span", H, " – " + d(x), 1)) : u("", !0)
|
|
107
114
|
]),
|
|
108
115
|
_: 2
|
|
109
116
|
}, 1024),
|
|
110
|
-
|
|
111
|
-
modelValue:
|
|
112
|
-
"onUpdate:modelValue": (
|
|
117
|
+
c(s(U), {
|
|
118
|
+
modelValue: t.selectedScopes.includes(o),
|
|
119
|
+
"onUpdate:modelValue": (k) => w(o, k)
|
|
113
120
|
}, null, 8, ["modelValue", "onUpdate:modelValue"])
|
|
114
121
|
]),
|
|
115
122
|
_: 2
|
|
@@ -121,12 +128,20 @@ const R = { class: "flex h-fit w-full" }, U = { class: "flex-1" }, F = { class:
|
|
|
121
128
|
]),
|
|
122
129
|
_: 1
|
|
123
130
|
})
|
|
124
|
-
])
|
|
131
|
+
]),
|
|
132
|
+
c(P, {
|
|
133
|
+
scopes: Object.keys(t.flow.scopes ?? {}),
|
|
134
|
+
state: s(v),
|
|
135
|
+
onSubmit: e[1] || (e[1] = (o) => i("update:selectedScopes", {
|
|
136
|
+
scopes: t.selectedScopes,
|
|
137
|
+
newScopePayload: { ...o, flowType: t.flowType }
|
|
138
|
+
}))
|
|
139
|
+
}, null, 8, ["scopes", "state"])
|
|
125
140
|
]),
|
|
126
141
|
_: 1
|
|
127
142
|
}));
|
|
128
143
|
}
|
|
129
144
|
});
|
|
130
145
|
export {
|
|
131
|
-
|
|
146
|
+
ee as default
|
|
132
147
|
};
|
|
@@ -14,6 +14,11 @@ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {
|
|
|
14
14
|
id: string[];
|
|
15
15
|
name: string;
|
|
16
16
|
scopes: string[];
|
|
17
|
+
newScopePayload?: {
|
|
18
|
+
name: string;
|
|
19
|
+
description: string;
|
|
20
|
+
flowType: keyof import("@scalar/workspace-store/schemas/v3.1/strict/oauthflows").OAuthFlowsObject;
|
|
21
|
+
};
|
|
17
22
|
meta: import("@scalar/workspace-store/mutators").AuthMeta;
|
|
18
23
|
}, "meta">) => any;
|
|
19
24
|
"update:securityScheme": (payload: ({
|
|
@@ -40,7 +45,6 @@ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {
|
|
|
40
45
|
[x: string]: string | undefined;
|
|
41
46
|
} | undefined;
|
|
42
47
|
'x-tokenName'?: string | undefined;
|
|
43
|
-
'x-scalar-credentials-location'?: "header" | "body" | undefined;
|
|
44
48
|
authorizationUrl?: string | undefined;
|
|
45
49
|
'x-scalar-secret-redirect-uri'?: string | undefined;
|
|
46
50
|
} | undefined;
|
|
@@ -58,11 +62,11 @@ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {
|
|
|
58
62
|
[x: string]: string | undefined;
|
|
59
63
|
} | undefined;
|
|
60
64
|
'x-tokenName'?: string | undefined;
|
|
61
|
-
'x-scalar-credentials-location'?: "header" | "body" | undefined;
|
|
62
65
|
tokenUrl?: string | undefined;
|
|
63
66
|
'x-scalar-secret-username'?: string | undefined;
|
|
64
67
|
'x-scalar-secret-password'?: string | undefined;
|
|
65
68
|
'x-scalar-secret-client-secret'?: string | undefined;
|
|
69
|
+
'x-scalar-credentials-location'?: "header" | "body" | undefined;
|
|
66
70
|
} | undefined;
|
|
67
71
|
clientCredentials?: {
|
|
68
72
|
refreshUrl?: string | undefined;
|
|
@@ -78,9 +82,9 @@ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {
|
|
|
78
82
|
[x: string]: string | undefined;
|
|
79
83
|
} | undefined;
|
|
80
84
|
'x-tokenName'?: string | undefined;
|
|
81
|
-
'x-scalar-credentials-location'?: "header" | "body" | undefined;
|
|
82
85
|
tokenUrl?: string | undefined;
|
|
83
86
|
'x-scalar-secret-client-secret'?: string | undefined;
|
|
87
|
+
'x-scalar-credentials-location'?: "header" | "body" | undefined;
|
|
84
88
|
} | undefined;
|
|
85
89
|
authorizationCode?: {
|
|
86
90
|
refreshUrl?: string | undefined;
|
|
@@ -96,12 +100,12 @@ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {
|
|
|
96
100
|
[x: string]: string | undefined;
|
|
97
101
|
} | undefined;
|
|
98
102
|
'x-tokenName'?: string | undefined;
|
|
99
|
-
'x-scalar-credentials-location'?: "header" | "body" | undefined;
|
|
100
103
|
authorizationUrl?: string | undefined;
|
|
101
104
|
tokenUrl?: string | undefined;
|
|
102
105
|
'x-scalar-secret-client-secret'?: string | undefined;
|
|
103
106
|
'x-scalar-secret-redirect-uri'?: string | undefined;
|
|
104
107
|
'x-usePkce'?: "SHA-256" | "plain" | "no" | undefined;
|
|
108
|
+
'x-scalar-credentials-location'?: "header" | "body" | undefined;
|
|
105
109
|
} | undefined;
|
|
106
110
|
} | undefined;
|
|
107
111
|
})) => any;
|
|
@@ -110,6 +114,11 @@ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {
|
|
|
110
114
|
id: string[];
|
|
111
115
|
name: string;
|
|
112
116
|
scopes: string[];
|
|
117
|
+
newScopePayload?: {
|
|
118
|
+
name: string;
|
|
119
|
+
description: string;
|
|
120
|
+
flowType: keyof import("@scalar/workspace-store/schemas/v3.1/strict/oauthflows").OAuthFlowsObject;
|
|
121
|
+
};
|
|
113
122
|
meta: import("@scalar/workspace-store/mutators").AuthMeta;
|
|
114
123
|
}, "meta">) => any) | undefined;
|
|
115
124
|
"onUpdate:securityScheme"?: ((payload: ({
|
|
@@ -136,7 +145,6 @@ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {
|
|
|
136
145
|
[x: string]: string | undefined;
|
|
137
146
|
} | undefined;
|
|
138
147
|
'x-tokenName'?: string | undefined;
|
|
139
|
-
'x-scalar-credentials-location'?: "header" | "body" | undefined;
|
|
140
148
|
authorizationUrl?: string | undefined;
|
|
141
149
|
'x-scalar-secret-redirect-uri'?: string | undefined;
|
|
142
150
|
} | undefined;
|
|
@@ -154,11 +162,11 @@ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {
|
|
|
154
162
|
[x: string]: string | undefined;
|
|
155
163
|
} | undefined;
|
|
156
164
|
'x-tokenName'?: string | undefined;
|
|
157
|
-
'x-scalar-credentials-location'?: "header" | "body" | undefined;
|
|
158
165
|
tokenUrl?: string | undefined;
|
|
159
166
|
'x-scalar-secret-username'?: string | undefined;
|
|
160
167
|
'x-scalar-secret-password'?: string | undefined;
|
|
161
168
|
'x-scalar-secret-client-secret'?: string | undefined;
|
|
169
|
+
'x-scalar-credentials-location'?: "header" | "body" | undefined;
|
|
162
170
|
} | undefined;
|
|
163
171
|
clientCredentials?: {
|
|
164
172
|
refreshUrl?: string | undefined;
|
|
@@ -174,9 +182,9 @@ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {
|
|
|
174
182
|
[x: string]: string | undefined;
|
|
175
183
|
} | undefined;
|
|
176
184
|
'x-tokenName'?: string | undefined;
|
|
177
|
-
'x-scalar-credentials-location'?: "header" | "body" | undefined;
|
|
178
185
|
tokenUrl?: string | undefined;
|
|
179
186
|
'x-scalar-secret-client-secret'?: string | undefined;
|
|
187
|
+
'x-scalar-credentials-location'?: "header" | "body" | undefined;
|
|
180
188
|
} | undefined;
|
|
181
189
|
authorizationCode?: {
|
|
182
190
|
refreshUrl?: string | undefined;
|
|
@@ -192,12 +200,12 @@ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {
|
|
|
192
200
|
[x: string]: string | undefined;
|
|
193
201
|
} | undefined;
|
|
194
202
|
'x-tokenName'?: string | undefined;
|
|
195
|
-
'x-scalar-credentials-location'?: "header" | "body" | undefined;
|
|
196
203
|
authorizationUrl?: string | undefined;
|
|
197
204
|
tokenUrl?: string | undefined;
|
|
198
205
|
'x-scalar-secret-client-secret'?: string | undefined;
|
|
199
206
|
'x-scalar-secret-redirect-uri'?: string | undefined;
|
|
200
207
|
'x-usePkce'?: "SHA-256" | "plain" | "no" | undefined;
|
|
208
|
+
'x-scalar-credentials-location'?: "header" | "body" | undefined;
|
|
201
209
|
} | undefined;
|
|
202
210
|
} | undefined;
|
|
203
211
|
})) => any) | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RequestAuthTab.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue"],"names":[],"mappings":"AAmTA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AACnH,OAAO,KAAK,EACV,YAAY,EACZ,gBAAgB,EAChB,UAAU,EACV,yBAAyB,EAEzB,YAAY,EACb,MAAM,8DAA8D,CAAA;AAcrE,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,kBAAkB,CAAA;IAC/B,yFAAyF;IACzF,QAAQ,EAAE,OAAO,CAAA;IACjB,QAAQ,EAAE,MAAM,CAAA;IAChB,uBAAuB,EAAE,yBAAyB,CAAA;IAClD,eAAe,EAAE,WAAW,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,CAAC,CAAA;IACjE,MAAM,EAAE,YAAY,GAAG,IAAI,CAAA;CAC5B,CAAC
|
|
1
|
+
{"version":3,"file":"RequestAuthTab.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue"],"names":[],"mappings":"AAmTA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AACnH,OAAO,KAAK,EACV,YAAY,EACZ,gBAAgB,EAChB,UAAU,EACV,yBAAyB,EAEzB,YAAY,EACb,MAAM,8DAA8D,CAAA;AAcrE,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,kBAAkB,CAAA;IAC/B,yFAAyF;IACzF,QAAQ,EAAE,OAAO,CAAA;IACjB,QAAQ,EAAE,MAAM,CAAA;IAChB,uBAAuB,EAAE,yBAAyB,CAAA;IAClD,eAAe,EAAE,WAAW,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,CAAC,CAAA;IACjE,MAAM,EAAE,YAAY,GAAG,IAAI,CAAA;CAC5B,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmiBF,wBAOG"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { OAuthFlowsObject, ServerObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
|
|
2
2
|
import type { ErrorResponse } from '../../../../libs/errors.js';
|
|
3
3
|
/** Oauth2 security schemes which are not implicit */
|
|
4
|
-
type
|
|
4
|
+
type NonImplicitFlows = Omit<OAuthFlowsObject, 'implicit'>;
|
|
5
5
|
type PKCEState = {
|
|
6
6
|
codeVerifier: string;
|
|
7
7
|
codeChallenge: string;
|
|
@@ -25,7 +25,7 @@ proxyUrl: string) => Promise<ErrorResponse<string>>;
|
|
|
25
25
|
* Makes the BE authorization call to grab the token server to server
|
|
26
26
|
* Used for clientCredentials and authorizationCode
|
|
27
27
|
*/
|
|
28
|
-
export declare const authorizeServers: (flows:
|
|
28
|
+
export declare const authorizeServers: (flows: NonImplicitFlows, type: keyof NonImplicitFlows, scopes: string, { code, pkce, proxyUrl, }: {
|
|
29
29
|
code?: string;
|
|
30
30
|
pkce?: PKCEState | null;
|
|
31
31
|
proxyUrl?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/helpers/oauth.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAGlH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAElD,qDAAqD;AACrD,KAAK,
|
|
1
|
+
{"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/helpers/oauth.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAGlH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAElD,qDAAqD;AACrD,KAAK,gBAAgB,GAAG,IAAI,CAAC,gBAAgB,EAAE,UAAU,CAAC,CAAA;AAE1D,KAAK,SAAS,GAAG;IACf,YAAY,EAAE,MAAM,CAAA;IACpB,aAAa,EAAE,MAAM,CAAA;IACrB,mBAAmB,EAAE,MAAM,CAAA;CAC5B,CAAA;AAgBD;;GAEG;AACH,eAAO,MAAM,qBAAqB,GAAU,UAAU,MAAM,EAAE,UAAU,SAAS,GAAG,OAAO,KAAG,OAAO,CAAC,MAAM,CAkB3G,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAC1B,OAAO,gBAAgB,EACvB,MAAM,MAAM,gBAAgB,EAC5B,gBAAgB,MAAM,EAAE;AACxB,wEAAwE;AACxE,cAAc,YAAY,GAAG,IAAI;AACjC,kCAAkC;AAClC,UAAU,MAAM,KACf,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,CAiL/B,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,gBAAgB,GAC3B,OAAO,gBAAgB,EACvB,MAAM,MAAM,gBAAgB,EAC5B,QAAQ,MAAM,EACd,2BAIG;IACD,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,SAAS,GAAG,IAAI,CAAA;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,YAAK,EACN,cAAc,YAAY,GAAG,IAAI,KAChC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,CAwF/B,CAAA"}
|
|
@@ -1,128 +1,130 @@
|
|
|
1
|
-
import { makeUrlAbsolute as
|
|
2
|
-
import { shouldUseProxy as
|
|
3
|
-
import { encode as
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
return crypto.getRandomValues(
|
|
7
|
-
}, z = async (
|
|
8
|
-
if (
|
|
9
|
-
return
|
|
1
|
+
import { makeUrlAbsolute as b } from "@scalar/helpers/url/make-url-absolute";
|
|
2
|
+
import { shouldUseProxy as E } from "@scalar/oas-utils/helpers";
|
|
3
|
+
import { encode as A, fromUint8Array as C } from "js-base64";
|
|
4
|
+
const S = () => {
|
|
5
|
+
const s = new Uint8Array(32);
|
|
6
|
+
return crypto.getRandomValues(s), C(s, !0);
|
|
7
|
+
}, z = async (s, e) => {
|
|
8
|
+
if (e === "plain")
|
|
9
|
+
return s;
|
|
10
10
|
if (typeof crypto?.subtle?.digest != "function")
|
|
11
|
-
return console.warn("SHA-256 is only supported when using https, using a plain text code challenge instead."),
|
|
12
|
-
const l = new TextEncoder().encode(
|
|
13
|
-
return
|
|
14
|
-
},
|
|
15
|
-
const d =
|
|
11
|
+
return console.warn("SHA-256 is only supported when using https, using a plain text code challenge instead."), s;
|
|
12
|
+
const l = new TextEncoder().encode(s), f = await crypto.subtle.digest("SHA-256", l);
|
|
13
|
+
return C(new Uint8Array(f), !0);
|
|
14
|
+
}, L = async (s, e, g, l, f) => {
|
|
15
|
+
const d = s[e];
|
|
16
16
|
try {
|
|
17
17
|
if (!d)
|
|
18
18
|
return [new Error("Flow not found"), null];
|
|
19
|
-
const
|
|
20
|
-
if (
|
|
19
|
+
const m = g.join(" ");
|
|
20
|
+
if (e === "clientCredentials" || e === "password")
|
|
21
21
|
return U(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
s,
|
|
23
|
+
e,
|
|
24
|
+
m,
|
|
25
25
|
{
|
|
26
|
-
proxyUrl:
|
|
26
|
+
proxyUrl: f
|
|
27
27
|
},
|
|
28
28
|
l
|
|
29
29
|
);
|
|
30
|
-
const
|
|
30
|
+
const t = (Math.random() + 1).toString(36).substring(2, 10), a = b(s[e].authorizationUrl, {
|
|
31
31
|
baseUrl: l?.url
|
|
32
32
|
}), n = new URL(a);
|
|
33
|
-
let
|
|
34
|
-
if (
|
|
33
|
+
let c = null;
|
|
34
|
+
if (e === "implicit")
|
|
35
35
|
n.searchParams.set("response_type", "token");
|
|
36
|
-
else if (
|
|
37
|
-
const
|
|
38
|
-
if (n.searchParams.set("response_type", "code"),
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
codeVerifier:
|
|
42
|
-
codeChallenge:
|
|
43
|
-
codeChallengeMethod:
|
|
44
|
-
}, n.searchParams.set("code_challenge",
|
|
36
|
+
else if (e === "authorizationCode") {
|
|
37
|
+
const r = s[e];
|
|
38
|
+
if (n.searchParams.set("response_type", "code"), r["x-usePkce"] !== "no") {
|
|
39
|
+
const o = S(), u = await z(o, r["x-usePkce"]);
|
|
40
|
+
c = {
|
|
41
|
+
codeVerifier: o,
|
|
42
|
+
codeChallenge: u,
|
|
43
|
+
codeChallengeMethod: r["x-usePkce"] === "SHA-256" ? "S256" : "plain"
|
|
44
|
+
}, n.searchParams.set("code_challenge", u), n.searchParams.set("code_challenge_method", c.codeChallengeMethod);
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
const
|
|
48
|
-
if (
|
|
49
|
-
const
|
|
50
|
-
n.searchParams.set("redirect_uri",
|
|
47
|
+
const i = s[e];
|
|
48
|
+
if (i["x-scalar-secret-redirect-uri"].startsWith("/")) {
|
|
49
|
+
const r = l?.url || window.location.origin + window.location.pathname, o = new URL(i["x-scalar-secret-redirect-uri"], r).toString();
|
|
50
|
+
n.searchParams.set("redirect_uri", o);
|
|
51
51
|
} else
|
|
52
|
-
n.searchParams.set("redirect_uri",
|
|
53
|
-
d["x-scalar-security-query"] && Object.keys(d["x-scalar-security-query"]).forEach((
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
}), n.searchParams.set("client_id", d["x-scalar-secret-client-id"]), n.searchParams.set("state",
|
|
57
|
-
const
|
|
58
|
-
return
|
|
59
|
-
const
|
|
60
|
-
let
|
|
52
|
+
n.searchParams.set("redirect_uri", i["x-scalar-secret-redirect-uri"]);
|
|
53
|
+
d["x-scalar-security-query"] && Object.keys(d["x-scalar-security-query"]).forEach((r) => {
|
|
54
|
+
const o = d["x-scalar-security-query"]?.[r];
|
|
55
|
+
o && n.searchParams.set(r, o);
|
|
56
|
+
}), n.searchParams.set("client_id", d["x-scalar-secret-client-id"]), n.searchParams.set("state", t), m && n.searchParams.set("scope", m);
|
|
57
|
+
const h = window.open(n, "openAuth2Window", "left=100,top=100,width=800,height=600");
|
|
58
|
+
return h ? new Promise((r) => {
|
|
59
|
+
const o = setInterval(() => {
|
|
60
|
+
let u = null, p = null, x = null, _ = null;
|
|
61
61
|
try {
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
const
|
|
65
|
-
|
|
62
|
+
const w = new URL(h.location.href).searchParams, k = d["x-tokenName"] || "access_token";
|
|
63
|
+
u = w.get(k), p = w.get("code"), x = w.get("error"), _ = w.get("error_description");
|
|
64
|
+
const P = new URLSearchParams(h.location.href.split("#")[1]);
|
|
65
|
+
u ||= P.get(k), p ||= P.get("code"), x ||= P.get("error"), _ ||= P.get("error_description");
|
|
66
66
|
} catch {
|
|
67
67
|
}
|
|
68
|
-
if (
|
|
69
|
-
if (clearInterval(
|
|
70
|
-
|
|
71
|
-
else if (
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
} else
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
68
|
+
if (h.closed || u || p || x)
|
|
69
|
+
if (clearInterval(o), h.close(), x)
|
|
70
|
+
r([new Error(`OAuth error: ${x}${_ ? ` (${_})` : ""}`), null]);
|
|
71
|
+
else if (u) {
|
|
72
|
+
const w = h.location.href.match(/state=([^&]*)/)?.[1];
|
|
73
|
+
r(w === t ? [null, u] : [new Error("State mismatch"), null]);
|
|
74
|
+
} else p && e === "authorizationCode" ? new URL(h.location.href).searchParams.get("state") === t ? U(
|
|
75
|
+
s,
|
|
76
|
+
e,
|
|
77
|
+
m,
|
|
78
78
|
{
|
|
79
|
-
code:
|
|
80
|
-
pkce:
|
|
81
|
-
proxyUrl:
|
|
79
|
+
code: p,
|
|
80
|
+
pkce: c,
|
|
81
|
+
proxyUrl: f
|
|
82
82
|
},
|
|
83
83
|
l
|
|
84
|
-
).then(
|
|
84
|
+
).then(r) : r([new Error("State mismatch"), null]) : (clearInterval(o), r([new Error("Window was closed without granting authorization"), null]));
|
|
85
85
|
}, 200);
|
|
86
86
|
}) : [new Error("Failed to open auth window"), null];
|
|
87
87
|
} catch {
|
|
88
88
|
return [new Error("Failed to authorize oauth2 flow"), null];
|
|
89
89
|
}
|
|
90
|
-
}, U = async (
|
|
90
|
+
}, U = async (s, e, g, {
|
|
91
91
|
code: l,
|
|
92
|
-
pkce:
|
|
92
|
+
pkce: f,
|
|
93
93
|
proxyUrl: d
|
|
94
|
-
} = {},
|
|
95
|
-
const
|
|
96
|
-
if (!
|
|
94
|
+
} = {}, m) => {
|
|
95
|
+
const t = s[e];
|
|
96
|
+
if (!t)
|
|
97
97
|
return [new Error("OAuth2 flow was not defined"), null];
|
|
98
98
|
const a = new URLSearchParams();
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
99
|
+
g && (e === "clientCredentials" || e === "password") && a.set("scope", g);
|
|
100
|
+
const n = t["x-scalar-credentials-location"] === "body";
|
|
101
|
+
if (n && (a.set("client_id", t["x-scalar-secret-client-id"]), a.set("client_secret", t["x-scalar-secret-client-secret"])), "x-scalar-secret-redirect-uri" in t && t["x-scalar-secret-redirect-uri"] && a.set("redirect_uri", t["x-scalar-secret-redirect-uri"]), l)
|
|
102
|
+
a.set("code", l), a.set("grant_type", "authorization_code"), f && a.set("code_verifier", f.codeVerifier);
|
|
103
|
+
else if (e === "password") {
|
|
104
|
+
const c = s[e];
|
|
105
|
+
a.set("grant_type", "password"), a.set("username", c["x-scalar-secret-username"]), a.set("password", c["x-scalar-secret-password"]);
|
|
104
106
|
} else
|
|
105
107
|
a.set("grant_type", "client_credentials");
|
|
106
|
-
|
|
107
|
-
|
|
108
|
+
t["x-scalar-security-body"] && Object.entries(t["x-scalar-security-body"]).forEach(([c, i]) => {
|
|
109
|
+
i && a.set(c, i);
|
|
108
110
|
});
|
|
109
111
|
try {
|
|
110
|
-
const
|
|
112
|
+
const c = {
|
|
111
113
|
"Content-Type": "application/x-www-form-urlencoded"
|
|
112
114
|
};
|
|
113
|
-
|
|
114
|
-
const
|
|
115
|
+
n || (c.Authorization = `Basic ${A(`${t["x-scalar-secret-client-id"]}:${t["x-scalar-secret-client-secret"]}`)}`);
|
|
116
|
+
const i = b(t.tokenUrl, { baseUrl: m?.url }), y = E(d, i) ? `${d}?${new URLSearchParams([["scalar_url", i]]).toString()}` : i, r = await (await fetch(y, {
|
|
115
117
|
method: "POST",
|
|
116
|
-
headers:
|
|
118
|
+
headers: c,
|
|
117
119
|
body: a
|
|
118
|
-
})).json(),
|
|
119
|
-
return [null,
|
|
120
|
+
})).json(), o = t["x-tokenName"] || "access_token";
|
|
121
|
+
return [null, r[o]];
|
|
120
122
|
} catch {
|
|
121
123
|
return [new Error("Failed to get an access token. Please check your credentials."), null];
|
|
122
124
|
}
|
|
123
125
|
};
|
|
124
126
|
export {
|
|
125
|
-
|
|
127
|
+
L as authorizeOauth2,
|
|
126
128
|
U as authorizeServers,
|
|
127
129
|
z as generateCodeChallenge
|
|
128
130
|
};
|