@scalar/api-client 2.2.47 → 2.2.48
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 +31 -0
- package/README.md +1 -1
- package/dist/components/CodeInput/CodeInput.vue.d.ts.map +1 -1
- package/dist/components/CodeInput/CodeInput.vue.js +2 -2
- package/dist/components/CodeInput/CodeInput.vue2.js +57 -57
- package/dist/components/CommandPalette/CommandPaletteImport.vue.js +1 -1
- package/dist/components/CommandPalette/TheCommandPalette.vue.d.ts.map +1 -1
- package/dist/components/CommandPalette/TheCommandPalette.vue.js +2 -2
- package/dist/components/CommandPalette/TheCommandPalette.vue2.js +13 -13
- package/dist/components/DataTable/DataTableInputSelect.vue.d.ts.map +1 -1
- package/dist/components/DataTable/DataTableInputSelect.vue.js +27 -27
- package/dist/libs/send-request/create-request-operation.d.ts.map +1 -1
- package/dist/libs/send-request/create-request-operation.js +49 -53
- package/dist/libs/send-request/create-request-operation.test.d.ts.map +1 -1
- package/dist/style.css +1 -1
- package/dist/views/Environment/Environment.vue.d.ts.map +1 -1
- package/dist/views/Environment/Environment.vue2.js +4 -5
- 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 +1 -1
- package/dist/views/Request/RequestSidebarItem.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSidebarItem.vue.js +1 -1
- package/dist/views/Request/RequestSidebarItem.vue2.js +4 -5
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
- package/dist/views/Servers/Servers.vue.d.ts.map +1 -1
- package/dist/views/Servers/Servers.vue2.js +11 -12
- package/package.json +19 -19
|
@@ -1,53 +1,49 @@
|
|
|
1
|
-
import { ERRORS as
|
|
1
|
+
import { ERRORS as k, normalizeError as g } from "../errors.js";
|
|
2
2
|
import { normalizeHeaders as A } from "../normalize-headers.js";
|
|
3
3
|
import { createFetchBody as I } from "./create-fetch-body.js";
|
|
4
4
|
import { createFetchHeaders as Q } from "./create-fetch-headers.js";
|
|
5
5
|
import { createFetchQueryParams as V } from "./create-fetch-query-params.js";
|
|
6
6
|
import { decodeBuffer as X } from "./decode-buffer.js";
|
|
7
7
|
import { setRequestCookies as $, getCookieHeader as K } from "./set-request-cookies.js";
|
|
8
|
-
import { replaceTemplateVariables as
|
|
9
|
-
import { isDefined as M, mergeUrls as Y, shouldUseProxy as
|
|
8
|
+
import { replaceTemplateVariables as c } from "../string-template.js";
|
|
9
|
+
import { isDefined as M, mergeUrls as Y, shouldUseProxy as p } from "@scalar/oas-utils/helpers";
|
|
10
10
|
import { buildRequestSecurity as G } from "./build-request-security.js";
|
|
11
|
-
const
|
|
12
|
-
environment:
|
|
13
|
-
example:
|
|
14
|
-
globalCookies:
|
|
15
|
-
proxyUrl:
|
|
11
|
+
const ce = ({
|
|
12
|
+
environment: R,
|
|
13
|
+
example: a,
|
|
14
|
+
globalCookies: C,
|
|
15
|
+
proxyUrl: s,
|
|
16
16
|
request: d,
|
|
17
|
-
securitySchemes:
|
|
18
|
-
selectedSecuritySchemeUids:
|
|
17
|
+
securitySchemes: P,
|
|
18
|
+
selectedSecuritySchemeUids: T = [],
|
|
19
19
|
server: i,
|
|
20
|
-
status:
|
|
20
|
+
status: o
|
|
21
21
|
}) => {
|
|
22
22
|
try {
|
|
23
|
-
const t =
|
|
24
|
-
let
|
|
25
|
-
if (!
|
|
26
|
-
Object.entries((i == null ? void 0 : i.variables) ?? {}).forEach(([
|
|
27
|
-
|
|
28
|
-
[
|
|
23
|
+
const t = R ?? {}, y = new AbortController(), S = a.parameters.path.reduce((r, e) => (e.enabled && (r[e.key] = c(e.value, t)), r), {}), q = c((i == null ? void 0 : i.url) ?? "", t), h = c(d.path, S);
|
|
24
|
+
let n = q || h;
|
|
25
|
+
if (!n) throw k.URL_EMPTY;
|
|
26
|
+
Object.entries((i == null ? void 0 : i.variables) ?? {}).forEach(([r, e]) => {
|
|
27
|
+
n = c(n, {
|
|
28
|
+
[r]: S[r] || e.default
|
|
29
29
|
});
|
|
30
30
|
});
|
|
31
|
-
const
|
|
32
|
-
example:
|
|
31
|
+
const H = V(a, t), U = Q(a, t), { body: L } = I(d.method, a, t), { cookieParams: E } = $({
|
|
32
|
+
example: a,
|
|
33
33
|
env: t,
|
|
34
|
-
globalCookies:
|
|
35
|
-
serverUrl:
|
|
36
|
-
proxyUrl:
|
|
37
|
-
}),
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
});
|
|
41
|
-
const m = { ...n.headers, ...U }, D = [...H, ...n.cookies], _ = new URLSearchParams([
|
|
42
|
-
...q,
|
|
43
|
-
...n.urlParams
|
|
34
|
+
globalCookies: C,
|
|
35
|
+
serverUrl: n,
|
|
36
|
+
proxyUrl: s
|
|
37
|
+
}), D = T.flat().map((r) => P[r]).filter(M), l = G(D, t), m = { ...Object.entries(l.headers).reduce((r, [e, u]) => (r[e.toLowerCase()] = u, r), {}), ...U }, _ = [...E, ...l.cookies], z = new URLSearchParams([
|
|
38
|
+
...H,
|
|
39
|
+
...l.urlParams
|
|
44
40
|
]);
|
|
45
|
-
|
|
46
|
-
const f =
|
|
47
|
-
K(
|
|
41
|
+
n = Y(n, h, z);
|
|
42
|
+
const f = c(
|
|
43
|
+
K(_, m.Cookie),
|
|
48
44
|
t
|
|
49
45
|
);
|
|
50
|
-
f && (
|
|
46
|
+
f && (p(s, n) ? (console.warn(
|
|
51
47
|
"We’re using a `X-Scalar-Cookie` custom header to the request. The proxy will forward this as a `Cookie` header. We do this to avoid the browser omitting the `Cookie` header for cross-origin requests for security reasons."
|
|
52
48
|
), m["X-Scalar-Cookie"] = f) : (console.warn(
|
|
53
49
|
`We’re trying to add a Cookie header, but browsers often omit them for cross-origin requests for various security reasons. If it’s not working, that’s probably why. Here are the requirements for it to work:
|
|
@@ -56,56 +52,56 @@ const ie = ({
|
|
|
56
52
|
- The connection must be made over HTTPS.
|
|
57
53
|
`
|
|
58
54
|
), m.Cookie = f));
|
|
59
|
-
const F = new URLSearchParams([["scalar_url",
|
|
55
|
+
const F = new URLSearchParams([["scalar_url", n.toString()]]), B = p(s, n) ? `${s}?${F.toString()}` : n, b = new Request(B, {
|
|
60
56
|
method: d.method.toUpperCase(),
|
|
61
|
-
body:
|
|
57
|
+
body: L ?? null,
|
|
62
58
|
headers: m
|
|
63
59
|
});
|
|
64
60
|
return [
|
|
65
61
|
null,
|
|
66
62
|
{
|
|
67
|
-
request:
|
|
63
|
+
request: b,
|
|
68
64
|
sendRequest: async () => {
|
|
69
|
-
|
|
70
|
-
const
|
|
65
|
+
o == null || o.emit("start");
|
|
66
|
+
const r = Date.now();
|
|
71
67
|
try {
|
|
72
|
-
const e = await fetch(
|
|
73
|
-
signal:
|
|
68
|
+
const e = await fetch(b, {
|
|
69
|
+
signal: y.signal
|
|
74
70
|
});
|
|
75
|
-
|
|
76
|
-
const
|
|
71
|
+
o == null || o.emit("stop");
|
|
72
|
+
const u = A(
|
|
77
73
|
e.headers,
|
|
78
|
-
|
|
79
|
-
),
|
|
74
|
+
p(s, n)
|
|
75
|
+
), O = e.headers.get("content-type") ?? "text/plain;charset=UTF-8", w = await e.arrayBuffer(), W = X(w, O), j = "getSetCookie" in e.headers && typeof e.headers.getSetCookie == "function" ? e.headers.getSetCookie() : [];
|
|
80
76
|
return [
|
|
81
77
|
null,
|
|
82
78
|
{
|
|
83
79
|
timestamp: Date.now(),
|
|
84
|
-
request:
|
|
80
|
+
request: a,
|
|
85
81
|
response: {
|
|
86
82
|
...e,
|
|
87
|
-
headers:
|
|
83
|
+
headers: u,
|
|
88
84
|
cookieHeaderKeys: j,
|
|
89
85
|
data: W,
|
|
90
|
-
size:
|
|
91
|
-
duration: Date.now() -
|
|
86
|
+
size: w.byteLength,
|
|
87
|
+
duration: Date.now() - r,
|
|
92
88
|
method: d.method,
|
|
93
89
|
status: e.status,
|
|
94
|
-
path:
|
|
90
|
+
path: h
|
|
95
91
|
}
|
|
96
92
|
}
|
|
97
93
|
];
|
|
98
94
|
} catch (e) {
|
|
99
|
-
return
|
|
95
|
+
return o == null || o.emit("abort"), [g(e, k.REQUEST_FAILED), null];
|
|
100
96
|
}
|
|
101
97
|
},
|
|
102
|
-
controller:
|
|
98
|
+
controller: y
|
|
103
99
|
}
|
|
104
100
|
];
|
|
105
101
|
} catch (t) {
|
|
106
|
-
return console.error(t),
|
|
102
|
+
return console.error(t), o == null || o.emit("abort"), [g(t), null];
|
|
107
103
|
}
|
|
108
104
|
};
|
|
109
105
|
export {
|
|
110
|
-
|
|
106
|
+
ce as createRequestOperation
|
|
111
107
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-request-operation.test.d.ts","sourceRoot":"","sources":["../../../src/libs/send-request/create-request-operation.test.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,aAAa,EAElB,oBAAoB,EAIrB,MAAM,iCAAiC,CAAA;AAExC,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAO5B,eAAO,MAAM,QAAQ,0BAAkC,CAAA;AAEvD,KAAK,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAEjE,KAAK,kBAAkB,GAAG;IACxB,aAAa,CAAC,EAAE,aAAa,CAAA;IAC7B,cAAc,CAAC,EAAE,cAAc,CAAA;IAC/B,qBAAqB,CAAC,EAAE,qBAAqB,CAAA;IAC7C,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,qDAAqD;AACrD,eAAO,MAAM,oBAAoB,wBACX,kBAAkB;;;;;;;;;;;;;;;uBAi2BvB,CAAC;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"create-request-operation.test.d.ts","sourceRoot":"","sources":["../../../src/libs/send-request/create-request-operation.test.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,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