@scalar/api-client 2.22.0 → 2.22.2
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 +56 -0
- package/dist/hooks/useClientConfig.d.ts +6 -3
- package/dist/hooks/useClientConfig.d.ts.map +1 -1
- package/dist/style.css +1 -1
- package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.d.ts.map +1 -1
- package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.js +2 -2
- package/dist/v2/blocks/request-block/helpers/get-default-headers.js +1 -1
- 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 +2 -2
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue2.js +23 -29
- 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 +45 -43
- package/dist/v2/components/code-input/CodeInput.vue.d.ts +0 -6
- package/dist/v2/components/code-input/CodeInput.vue.d.ts.map +1 -1
- package/dist/v2/components/code-input/CodeInput.vue.js +1 -1
- package/dist/v2/components/code-input/CodeInput.vue2.js +50 -63
- package/dist/v2/components/sidebar/Sidebar.vue.d.ts +0 -3
- package/dist/v2/components/sidebar/Sidebar.vue.d.ts.map +1 -1
- package/dist/v2/components/sidebar/Sidebar.vue.js +55 -53
- package/dist/v2/features/app/App.vue.d.ts +3 -1
- package/dist/v2/features/app/App.vue.d.ts.map +1 -1
- package/dist/v2/features/app/App.vue.js +46 -43
- package/dist/v2/features/app/app-state.d.ts.map +1 -1
- package/dist/v2/features/app/app-state.js +33 -28
- package/dist/v2/features/app/components/AppSidebar.vue.d.ts.map +1 -1
- package/dist/v2/features/app/components/AppSidebar.vue.js +1 -1
- package/dist/v2/features/app/components/AppSidebar.vue2.js +137 -127
- package/dist/v2/features/app/index.d.ts +3 -0
- package/dist/v2/features/app/index.d.ts.map +1 -1
- package/dist/v2/features/app/index.js +17 -11
- package/dist/v2/features/command-palette/TheCommandPalette.vue.d.ts.map +1 -1
- package/dist/v2/features/command-palette/TheCommandPalette.vue.js +1 -1
- package/dist/v2/features/command-palette/TheCommandPalette.vue2.js +6 -6
- package/dist/v2/features/command-palette/hooks/use-command-palette-state.d.ts +2 -2
- package/dist/v2/features/command-palette/hooks/use-command-palette-state.d.ts.map +1 -1
- package/dist/v2/features/command-palette/hooks/use-command-palette-state.js +60 -56
- package/dist/v2/features/operation/Operation.vue.js +1 -1
- package/dist/v2/features/search/hooks/use-search-index.d.ts +3 -7
- package/dist/v2/features/search/hooks/use-search-index.d.ts.map +1 -1
- package/dist/v2/features/search/hooks/use-search-index.js +12 -18
- package/dist/v2/features/search/index.d.ts +1 -2
- package/dist/v2/features/search/index.d.ts.map +1 -1
- package/dist/v2/features/search/index.js +2 -4
- package/dist/v2/features/search/types.d.ts +1 -1
- package/dist/v2/features/search/types.d.ts.map +1 -1
- package/dist/v2/helpers/handle-hotkeys.js +1 -1
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
- package/dist/views/Request/libs/oauth2.d.ts.map +1 -1
- package/dist/views/Request/libs/oauth2.js +54 -52
- package/package.json +19 -19
- package/dist/v2/features/search/components/SearchButton.vue.d.ts +0 -12
- package/dist/v2/features/search/components/SearchButton.vue.d.ts.map +0 -1
- package/dist/v2/features/search/components/SearchButton.vue.js +0 -71
- package/dist/v2/features/search/components/SearchButton.vue2.js +0 -4
- package/dist/v2/features/search/components/SearchModal.vue.d.ts +0 -11
- package/dist/v2/features/search/components/SearchModal.vue.d.ts.map +0 -1
- package/dist/v2/features/search/components/SearchModal.vue.js +0 -7
- package/dist/v2/features/search/components/SearchModal.vue2.js +0 -102
- package/dist/v2/features/search/components/SearchResult.vue.d.ts +0 -10
- package/dist/v2/features/search/components/SearchResult.vue.d.ts.map +0 -1
- package/dist/v2/features/search/components/SearchResult.vue.js +0 -80
- package/dist/v2/features/search/components/SearchResult.vue2.js +0 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OperationCodeSample.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-code-sample/components/OperationCodeSample.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"OperationCodeSample.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-code-sample/components/OperationCodeSample.vue"],"names":[],"mappings":"AAycA,OAAO,KAAK,EAAE,UAAU,IAAI,cAAc,EAAE,MAAM,mCAAmC,CAAA;AAErF,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AACxD,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAEvE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qEAAqE,CAAA;AACxG,OAAO,KAAK,EACV,eAAe,EACf,oBAAoB,EACpB,YAAY,EACb,MAAM,8DAA8D,CAAA;AASrE,OAAO,KAAK,EAEV,iBAAiB,EAElB,MAAM,yCAAyC,CAAA;AAMhD,MAAM,MAAM,wBAAwB,GAAG;IACrC;;;OAGG;IACH,WAAW,CAAC,EAAE,QAAQ,GAAG,WAAW,CAAA;IACpC;;OAEG;IACH,aAAa,EAAE,iBAAiB,EAAE,CAAA;IAClC;;;;OAIG;IACH,cAAc,CAAC,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAA;IACzC;;OAEG;IACH,cAAc,CAAC,EAAE,YAAY,GAAG,IAAI,CAAA;IACpC;;;;;OAKG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB;;OAEG;IACH,QAAQ,EAAE,iBAAiB,CAAA;IAC3B;;OAEG;IACH,eAAe,EAAE,oBAAoB,EAAE,CAAA;IACvC;;OAEG;IACH,MAAM,EAAE,cAAc,CAAA;IACtB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IACZ;;OAEG;IACH,SAAS,EAAE,eAAe,CAAA;IAC1B;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,MAAM,CAAA;IAC5B;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB;;OAEG;IACH,aAAa,CAAC,EAAE,aAAa,EAAE,CAAA;CAChC,CAAA;AAED;;;;;;;;GAQG;;YAqBO,MAAM,OAAO;YACb,MAAM,OAAO;;AArBvB,wBA2fC;AAOD,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./OperationCodeSample.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import t from "../../../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const
|
|
4
|
+
const a = /* @__PURE__ */ t(o, [["__scopeId", "data-v-f278dde0"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
a as default
|
|
7
7
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { canMethodHaveBody as p } from "@scalar/helpers/http/can-method-have-body";
|
|
2
2
|
import { getResolvedRef as n } from "@scalar/workspace-store/helpers/get-resolved-ref";
|
|
3
3
|
import { isElectron as u } from "../../../../libs/electron.js";
|
|
4
|
-
const i = "2.22.
|
|
4
|
+
const i = "2.22.2", m = "application/json", h = "*/*", c = (r, t, a) => ({
|
|
5
5
|
name: r,
|
|
6
6
|
defaultValue: t,
|
|
7
7
|
isOverridden: a.has(r.toLowerCase())
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AddressBar.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-address-bar-block/components/AddressBar.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AddressBar.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-address-bar-block/components/AddressBar.vue"],"names":[],"mappings":"AAgbA,OAAO,KAAK,EAAE,UAAU,IAAI,cAAc,EAAE,MAAM,mCAAmC,CAAA;AAGrF,OAAO,KAAK,EAEV,iBAAiB,EAClB,MAAM,gCAAgC,CAAA;AACvC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AACnH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAWhG,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,SAAS,CAAA;AAM3C,OAA0B,EAAE,KAAK,OAAO,EAAE,MAAM,yBAAyB,CAAA;AAEzE,KAAK,WAAW,GAAG;IACjB,2BAA2B;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,6BAA6B;IAC7B,MAAM,EAAE,cAAc,CAAA;IACtB,gCAAgC;IAChC,MAAM,EAAE,YAAY,GAAG,IAAI,CAAA;IAC3B,mDAAmD;IACnD,OAAO,EAAE,YAAY,EAAE,CAAA;IACvB,8BAA8B;IAC9B,OAAO,EAAE,OAAO,EAAE,CAAA;IAClB,oBAAoB;IACpB,MAAM,EAAE,YAAY,CAAA;IACpB,gBAAgB;IAChB,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,kBAAkB;IAClB,WAAW,EAAE,kBAAkB,CAAA;CAChC,CAAC;;;;;;;;eAkB6C,MAAM;;;;;;eAAN,MAAM;;;AAqkBrD,wBAQG"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./AddressBar.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import r from "../../../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const
|
|
4
|
+
const a = /* @__PURE__ */ r(o, [["__scopeId", "data-v-35d07de1"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
a as default
|
|
7
7
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as F, useId as H, computed as k, ref as w, useTemplateRef as S, onMounted as W, onBeforeUnmount as O, createElementBlock as U, openBlock as h, unref as l, createElementVNode as o, normalizeClass as P, createVNode as a, createCommentVNode as
|
|
1
|
+
import { defineComponent as F, useId as H, computed as k, ref as w, useTemplateRef as S, onMounted as W, onBeforeUnmount as O, createElementBlock as U, openBlock as h, unref as l, createElementVNode as o, normalizeClass as P, createVNode as a, createCommentVNode as z, normalizeStyle as K, createBlock as Q, withCtx as R, createTextVNode as x, toDisplayString as c } from "vue";
|
|
2
2
|
import { ScalarButton as E, ScalarWrappingText as j, ScalarIcon as G } from "@scalar/components";
|
|
3
3
|
import { REQUEST_METHODS as J } from "@scalar/helpers/http/http-info";
|
|
4
4
|
import { ScalarIconCopy as X, ScalarIconWarningCircle as Y } from "@scalar/icons";
|
|
@@ -28,8 +28,8 @@ const se = ["id"], ae = { class: "pointer-events-none absolute top-0 left-0 bloc
|
|
|
28
28
|
environment: {}
|
|
29
29
|
},
|
|
30
30
|
emits: ["execute", "update:servers", "select:history:item"],
|
|
31
|
-
setup(e, { expose:
|
|
32
|
-
const d =
|
|
31
|
+
setup(e, { expose: $, emit: V }) {
|
|
32
|
+
const d = V, f = H(), { percentage: q, startLoading: b, stopLoading: v, isLoading: T } = ee(), I = k(() => ({
|
|
33
33
|
backgroundColor: `color-mix(in srgb, transparent 90%, ${J[e.method].colorVar})`,
|
|
34
34
|
transform: `translate3d(-${q.value}%,0,0)`
|
|
35
35
|
})), i = w(null), r = w(null), g = k(() => r.value || i.value), y = (n, t, s) => {
|
|
@@ -45,7 +45,7 @@ const se = ["id"], ae = { class: "pointer-events-none absolute top-0 left-0 bloc
|
|
|
45
45
|
},
|
|
46
46
|
s
|
|
47
47
|
);
|
|
48
|
-
},
|
|
48
|
+
}, L = (n) => y(n, i.value ?? e.path), A = (n) => {
|
|
49
49
|
const t = n.startsWith("/") ? n : `/${n}`;
|
|
50
50
|
y(r.value ?? e.method, t, {
|
|
51
51
|
debounceKey: `operation:update:pathMethod-${e.path}-${e.method}`
|
|
@@ -66,7 +66,7 @@ const se = ["id"], ae = { class: "pointer-events-none absolute top-0 left-0 bloc
|
|
|
66
66
|
_({ environment: e.environment, server: e.server, path: e.path, pathVariables: {} })
|
|
67
67
|
);
|
|
68
68
|
};
|
|
69
|
-
return
|
|
69
|
+
return $({
|
|
70
70
|
methodConflict: r,
|
|
71
71
|
pathConflict: i
|
|
72
72
|
}), (n, t) => (h(), U("div", {
|
|
@@ -81,7 +81,7 @@ const se = ["id"], ae = { class: "pointer-events-none absolute top-0 left-0 bloc
|
|
|
81
81
|
o("div", ae, [
|
|
82
82
|
o("div", {
|
|
83
83
|
class: "absolute top-0 left-0 z-[1002] h-full w-full",
|
|
84
|
-
style: K(
|
|
84
|
+
style: K(I.value)
|
|
85
85
|
}, null, 4)
|
|
86
86
|
]),
|
|
87
87
|
o("div", re, [
|
|
@@ -90,7 +90,7 @@ const se = ["id"], ae = { class: "pointer-events-none absolute top-0 left-0 bloc
|
|
|
90
90
|
isSquare: "",
|
|
91
91
|
method: r.value ?? e.method,
|
|
92
92
|
teleport: "",
|
|
93
|
-
onChange:
|
|
93
|
+
onChange: L
|
|
94
94
|
}, null, 8, ["isEditable", "method"])
|
|
95
95
|
]),
|
|
96
96
|
o("div", ie, [
|
|
@@ -103,8 +103,8 @@ const se = ["id"], ae = { class: "pointer-events-none absolute top-0 left-0 bloc
|
|
|
103
103
|
"onUpdate:selectedServer": t[0] || (t[0] = (s) => e.eventBus.emit("server:update:selected", s)),
|
|
104
104
|
"onUpdate:servers": t[1] || (t[1] = (s) => d("update:servers")),
|
|
105
105
|
"onUpdate:variable": t[2] || (t[2] = (s) => e.eventBus.emit("server:update:variables", s))
|
|
106
|
-
}, null, 8, ["layout", "server", "servers", "target"])) :
|
|
107
|
-
t[
|
|
106
|
+
}, null, 8, ["layout", "server", "servers", "target"])) : z("", !0),
|
|
107
|
+
t[6] || (t[6] = o("div", { class: "fade-left" }, null, -1)),
|
|
108
108
|
a(l(le), {
|
|
109
109
|
ref_key: "addressBarRef",
|
|
110
110
|
ref: u,
|
|
@@ -120,18 +120,12 @@ const se = ["id"], ae = { class: "pointer-events-none absolute top-0 left-0 bloc
|
|
|
120
120
|
importCurl: "",
|
|
121
121
|
layout: e.layout,
|
|
122
122
|
modelValue: e.path,
|
|
123
|
-
placeholder: e.server ? "" : "Enter a URL
|
|
123
|
+
placeholder: e.server ? "" : "Enter a URL",
|
|
124
124
|
server: "",
|
|
125
|
-
|
|
126
|
-
action: "import-curl-command",
|
|
127
|
-
payload: {
|
|
128
|
-
inputValue: s
|
|
129
|
-
}
|
|
130
|
-
})),
|
|
131
|
-
onSubmit: t[4] || (t[4] = (s) => d("execute")),
|
|
125
|
+
onSubmit: t[3] || (t[3] = (s) => d("execute")),
|
|
132
126
|
"onUpdate:modelValue": A
|
|
133
127
|
}, null, 8, ["disabled", "environment", "layout", "modelValue", "placeholder"]),
|
|
134
|
-
t[
|
|
128
|
+
t[7] || (t[7] = o("div", { class: "fade-right" }, null, -1))
|
|
135
129
|
]),
|
|
136
130
|
a(l(E), {
|
|
137
131
|
class: "hover:bg-b-3 mx-1",
|
|
@@ -139,46 +133,46 @@ const se = ["id"], ae = { class: "pointer-events-none absolute top-0 left-0 bloc
|
|
|
139
133
|
variant: "ghost",
|
|
140
134
|
onClick: N
|
|
141
135
|
}, {
|
|
142
|
-
default:
|
|
136
|
+
default: R(() => [
|
|
143
137
|
a(l(X)),
|
|
144
|
-
t[
|
|
138
|
+
t[8] || (t[8] = o("span", { class: "sr-only" }, "Copy URL", -1))
|
|
145
139
|
]),
|
|
146
140
|
_: 1
|
|
147
141
|
}),
|
|
148
142
|
a(te, {
|
|
149
143
|
history: e.history,
|
|
150
144
|
target: l(f),
|
|
151
|
-
"onSelect:history:item": t[
|
|
145
|
+
"onSelect:history:item": t[4] || (t[4] = (s) => d("select:history:item", s))
|
|
152
146
|
}, null, 8, ["history", "target"]),
|
|
153
147
|
g.value ? (h(), U("div", de, [
|
|
154
148
|
o("div", ue, [
|
|
155
149
|
a(l(Y), { size: "sm" }),
|
|
156
150
|
o("div", me, [
|
|
157
|
-
t[
|
|
151
|
+
t[9] || (t[9] = x(" A ", -1)),
|
|
158
152
|
o("em", null, c(r.value?.toUpperCase() ?? e.method.toUpperCase()), 1),
|
|
159
|
-
t[
|
|
153
|
+
t[10] || (t[10] = x(" request to ", -1)),
|
|
160
154
|
a(l(j), {
|
|
161
155
|
text: i.value ?? e.path
|
|
162
156
|
}, null, 8, ["text"]),
|
|
163
|
-
t[
|
|
157
|
+
t[11] || (t[11] = x(" already exists in this document ", -1))
|
|
164
158
|
])
|
|
165
159
|
])
|
|
166
|
-
])) :
|
|
160
|
+
])) : z("", !0),
|
|
167
161
|
a(l(E), {
|
|
168
162
|
ref_key: "sendButtonRef",
|
|
169
163
|
ref: B,
|
|
170
164
|
class: "z-context-plus relative h-auto shrink-0 overflow-hidden py-1 pr-2.5 pl-2 font-bold",
|
|
171
|
-
disabled: l(
|
|
172
|
-
onClick: t[
|
|
165
|
+
disabled: l(T),
|
|
166
|
+
onClick: t[5] || (t[5] = (s) => d("execute"))
|
|
173
167
|
}, {
|
|
174
|
-
default:
|
|
168
|
+
default: R(() => [
|
|
175
169
|
o("span", ce, [
|
|
176
170
|
a(l(G), {
|
|
177
171
|
class: "relative shrink-0 fill-current",
|
|
178
172
|
icon: "Play",
|
|
179
173
|
size: "xs"
|
|
180
174
|
}),
|
|
181
|
-
t[
|
|
175
|
+
t[12] || (t[12] = o("span", { class: "text-xxs hidden lg:flex" }, "Send", -1))
|
|
182
176
|
]),
|
|
183
177
|
o("span", fe, " Send " + c(e.method) + " request to " + c(e.server?.url ?? "") + c(e.path), 1)
|
|
184
178
|
]),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/helpers/oauth.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/helpers/oauth.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAGlH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AA8DlD;;;;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,CA+K/B,CAAA"}
|
|
@@ -1,25 +1,29 @@
|
|
|
1
|
+
import { isRelativePath as E } from "@scalar/helpers/url/is-relative-path";
|
|
1
2
|
import { makeUrlAbsolute as b } from "@scalar/helpers/url/make-url-absolute";
|
|
2
|
-
import { shouldUseProxy as
|
|
3
|
-
import { encode as
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
return
|
|
7
|
-
},
|
|
3
|
+
import { shouldUseProxy as S } from "@scalar/helpers/url/redirect-to-proxy";
|
|
4
|
+
import { encode as z, fromUint8Array as C } from "js-base64";
|
|
5
|
+
const A = (t) => {
|
|
6
|
+
const e = t?.url;
|
|
7
|
+
return e ? E(e) ? typeof window > "u" ? {} : { basePath: e } : { baseUrl: e } : {};
|
|
8
|
+
}, F = () => {
|
|
9
|
+
const t = new Uint8Array(32);
|
|
10
|
+
return crypto.getRandomValues(t), C(t, !0);
|
|
11
|
+
}, R = async (t, e) => {
|
|
8
12
|
if (e === "plain")
|
|
9
|
-
return
|
|
13
|
+
return t;
|
|
10
14
|
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(
|
|
15
|
+
return console.warn("SHA-256 is only supported when using https, using a plain text code challenge instead."), t;
|
|
16
|
+
const l = new TextEncoder().encode(t), f = await crypto.subtle.digest("SHA-256", l);
|
|
13
17
|
return C(new Uint8Array(f), !0);
|
|
14
|
-
},
|
|
15
|
-
const d =
|
|
18
|
+
}, W = async (t, e, g, l, f) => {
|
|
19
|
+
const d = t[e];
|
|
16
20
|
try {
|
|
17
21
|
if (!d)
|
|
18
22
|
return [new Error("Flow not found"), null];
|
|
19
23
|
const m = g.join(" ");
|
|
20
24
|
if (e === "clientCredentials" || e === "password")
|
|
21
25
|
return U(
|
|
22
|
-
|
|
26
|
+
t,
|
|
23
27
|
e,
|
|
24
28
|
m,
|
|
25
29
|
{
|
|
@@ -27,35 +31,33 @@ const S = () => {
|
|
|
27
31
|
},
|
|
28
32
|
l
|
|
29
33
|
);
|
|
30
|
-
const
|
|
31
|
-
baseUrl: l?.url
|
|
32
|
-
}), n = new URL(a);
|
|
34
|
+
const r = (Math.random() + 1).toString(36).substring(2, 10), a = b(t[e].authorizationUrl, A(l)), n = new URL(a);
|
|
33
35
|
let c = null;
|
|
34
36
|
if (e === "implicit")
|
|
35
37
|
n.searchParams.set("response_type", "token");
|
|
36
38
|
else if (e === "authorizationCode") {
|
|
37
|
-
const
|
|
38
|
-
if (n.searchParams.set("response_type", "code"),
|
|
39
|
-
const o =
|
|
39
|
+
const s = t[e];
|
|
40
|
+
if (n.searchParams.set("response_type", "code"), s["x-usePkce"] !== "no") {
|
|
41
|
+
const o = F(), u = await R(o, s["x-usePkce"]);
|
|
40
42
|
c = {
|
|
41
43
|
codeVerifier: o,
|
|
42
44
|
codeChallenge: u,
|
|
43
|
-
codeChallengeMethod:
|
|
45
|
+
codeChallengeMethod: s["x-usePkce"] === "SHA-256" ? "S256" : "plain"
|
|
44
46
|
}, n.searchParams.set("code_challenge", u), n.searchParams.set("code_challenge_method", c.codeChallengeMethod);
|
|
45
47
|
}
|
|
46
48
|
}
|
|
47
|
-
const i =
|
|
49
|
+
const i = t[e];
|
|
48
50
|
if (i["x-scalar-secret-redirect-uri"].startsWith("/")) {
|
|
49
|
-
const
|
|
51
|
+
const s = l?.url || window.location.origin + window.location.pathname, o = new URL(i["x-scalar-secret-redirect-uri"], s).toString();
|
|
50
52
|
n.searchParams.set("redirect_uri", o);
|
|
51
53
|
} else
|
|
52
54
|
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((
|
|
54
|
-
const o = d["x-scalar-security-query"]?.[
|
|
55
|
-
o && n.searchParams.set(
|
|
56
|
-
}), n.searchParams.set("client_id", d["x-scalar-secret-client-id"]), n.searchParams.set("state",
|
|
55
|
+
d["x-scalar-security-query"] && Object.keys(d["x-scalar-security-query"]).forEach((s) => {
|
|
56
|
+
const o = d["x-scalar-security-query"]?.[s];
|
|
57
|
+
o && n.searchParams.set(s, o);
|
|
58
|
+
}), n.searchParams.set("client_id", d["x-scalar-secret-client-id"]), n.searchParams.set("state", r), m && n.searchParams.set("scope", m);
|
|
57
59
|
const h = window.open(n, "openAuth2Window", "left=100,top=100,width=800,height=600");
|
|
58
|
-
return h ? new Promise((
|
|
60
|
+
return h ? new Promise((s) => {
|
|
59
61
|
const o = setInterval(() => {
|
|
60
62
|
let u = null, p = null, x = null, _ = null;
|
|
61
63
|
try {
|
|
@@ -67,12 +69,12 @@ const S = () => {
|
|
|
67
69
|
}
|
|
68
70
|
if (h.closed || u || p || x)
|
|
69
71
|
if (clearInterval(o), h.close(), x)
|
|
70
|
-
|
|
72
|
+
s([new Error(`OAuth error: ${x}${_ ? ` (${_})` : ""}`), null]);
|
|
71
73
|
else if (u) {
|
|
72
74
|
const w = h.location.href.match(/state=([^&]*)/)?.[1];
|
|
73
|
-
|
|
74
|
-
} else p && e === "authorizationCode" ? new URL(h.location.href).searchParams.get("state") ===
|
|
75
|
-
|
|
75
|
+
s(w === r ? [null, u] : [new Error("State mismatch"), null]);
|
|
76
|
+
} else p && e === "authorizationCode" ? new URL(h.location.href).searchParams.get("state") === r ? U(
|
|
77
|
+
t,
|
|
76
78
|
e,
|
|
77
79
|
m,
|
|
78
80
|
{
|
|
@@ -81,48 +83,48 @@ const S = () => {
|
|
|
81
83
|
proxyUrl: f
|
|
82
84
|
},
|
|
83
85
|
l
|
|
84
|
-
).then(
|
|
86
|
+
).then(s) : s([new Error("State mismatch"), null]) : (clearInterval(o), s([new Error("Window was closed without granting authorization"), null]));
|
|
85
87
|
}, 200);
|
|
86
88
|
}) : [new Error("Failed to open auth window"), null];
|
|
87
89
|
} catch {
|
|
88
90
|
return [new Error("Failed to authorize oauth2 flow"), null];
|
|
89
91
|
}
|
|
90
|
-
}, U = async (
|
|
92
|
+
}, U = async (t, e, g, {
|
|
91
93
|
code: l,
|
|
92
94
|
pkce: f,
|
|
93
95
|
proxyUrl: d
|
|
94
96
|
} = {}, m) => {
|
|
95
|
-
const
|
|
96
|
-
if (!
|
|
97
|
+
const r = t[e];
|
|
98
|
+
if (!r)
|
|
97
99
|
return [new Error("OAuth2 flow was not defined"), null];
|
|
98
100
|
const a = new URLSearchParams();
|
|
99
101
|
g && (e === "clientCredentials" || e === "password") && a.set("scope", g);
|
|
100
|
-
const n =
|
|
101
|
-
if (n && (a.set("client_id",
|
|
102
|
+
const n = r["x-scalar-credentials-location"] === "body";
|
|
103
|
+
if (n && (a.set("client_id", r["x-scalar-secret-client-id"]), a.set("client_secret", r["x-scalar-secret-client-secret"])), "x-scalar-secret-redirect-uri" in r && r["x-scalar-secret-redirect-uri"] && a.set("redirect_uri", r["x-scalar-secret-redirect-uri"]), l)
|
|
102
104
|
a.set("code", l), a.set("grant_type", "authorization_code"), f && a.set("code_verifier", f.codeVerifier);
|
|
103
105
|
else if (e === "password") {
|
|
104
|
-
const c =
|
|
106
|
+
const c = t[e];
|
|
105
107
|
a.set("grant_type", "password"), a.set("username", c["x-scalar-secret-username"]), a.set("password", c["x-scalar-secret-password"]);
|
|
106
108
|
} else
|
|
107
109
|
a.set("grant_type", "client_credentials");
|
|
108
|
-
|
|
110
|
+
r["x-scalar-security-body"] && Object.entries(r["x-scalar-security-body"]).forEach(([c, i]) => {
|
|
109
111
|
i && a.set(c, i);
|
|
110
112
|
});
|
|
111
113
|
try {
|
|
112
114
|
const c = {
|
|
113
115
|
"Content-Type": "application/x-www-form-urlencoded"
|
|
114
116
|
};
|
|
115
|
-
n || (c.Authorization = `Basic ${
|
|
116
|
-
const i = b(
|
|
117
|
+
n || (c.Authorization = `Basic ${z(`${r["x-scalar-secret-client-id"]}:${r["x-scalar-secret-client-secret"]}`)}`);
|
|
118
|
+
const i = b(r.tokenUrl, A(m)), y = S(d, i) ? `${d}?${new URLSearchParams([["scalar_url", i]]).toString()}` : i, s = await (await fetch(y, {
|
|
117
119
|
method: "POST",
|
|
118
120
|
headers: c,
|
|
119
121
|
body: a
|
|
120
|
-
})).json(), o =
|
|
121
|
-
return [null,
|
|
122
|
+
})).json(), o = r["x-tokenName"] || "access_token";
|
|
123
|
+
return [null, s[o]];
|
|
122
124
|
} catch {
|
|
123
125
|
return [new Error("Failed to get an access token. Please check your credentials."), null];
|
|
124
126
|
}
|
|
125
127
|
};
|
|
126
128
|
export {
|
|
127
|
-
|
|
129
|
+
W as authorizeOauth2
|
|
128
130
|
};
|
|
@@ -73,8 +73,6 @@ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<{
|
|
|
73
73
|
emitOnBlur?: boolean;
|
|
74
74
|
/** Enable environment variable pills */
|
|
75
75
|
withVariables?: boolean;
|
|
76
|
-
/** Detect and emit curl commands */
|
|
77
|
-
importCurl?: boolean;
|
|
78
76
|
/** Emit change event even if the value is the same */
|
|
79
77
|
alwaysEmitChange?: boolean;
|
|
80
78
|
/** Custom change handler, prevents default emit */
|
|
@@ -104,7 +102,6 @@ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<{
|
|
|
104
102
|
redirectToEnvironment: () => any;
|
|
105
103
|
"update:modelValue": (value: string) => any;
|
|
106
104
|
blur: (value: string) => any;
|
|
107
|
-
curl: (value: string) => any;
|
|
108
105
|
}, string, import("vue").PublicProps, Readonly<{
|
|
109
106
|
modelValue: CodeInputModelValue;
|
|
110
107
|
/** Environment for variable substitution. Pass undefined to disable environment variables */
|
|
@@ -151,8 +148,6 @@ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<{
|
|
|
151
148
|
emitOnBlur?: boolean;
|
|
152
149
|
/** Enable environment variable pills */
|
|
153
150
|
withVariables?: boolean;
|
|
154
|
-
/** Detect and emit curl commands */
|
|
155
|
-
importCurl?: boolean;
|
|
156
151
|
/** Emit change event even if the value is the same */
|
|
157
152
|
alwaysEmitChange?: boolean;
|
|
158
153
|
/** Custom change handler, prevents default emit */
|
|
@@ -166,7 +161,6 @@ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<{
|
|
|
166
161
|
onRedirectToEnvironment?: (() => any) | undefined;
|
|
167
162
|
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
168
163
|
onBlur?: ((value: string) => any) | undefined;
|
|
169
|
-
onCurl?: ((value: string) => any) | undefined;
|
|
170
164
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
171
165
|
warning?: (props: {}) => any;
|
|
172
166
|
} & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeInput.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/components/code-input/CodeInput.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CodeInput.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/components/code-input/CodeInput.vue"],"names":[],"mappings":"AA6pBA,OAAO,EAIL,KAAK,kBAAkB,EACvB,KAAK,SAAS,EACf,MAAM,wBAAwB,CAAA;AAC/B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AAEnH,OAAO,EAAyC,KAAK,GAAG,EAAE,MA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
|
import t from "../../../_virtual/_plugin-vue_export-helper.js";
|
|
5
|
-
const _ = /* @__PURE__ */ t(o, [["__scopeId", "data-v-
|
|
5
|
+
const _ = /* @__PURE__ */ t(o, [["__scopeId", "data-v-a0bd2752"]]);
|
|
6
6
|
export {
|
|
7
7
|
_ as default
|
|
8
8
|
};
|