@scalar/api-client 2.36.0 → 2.36.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 +29 -0
- package/dist/style.css +1 -1
- 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 +28 -27
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-body.d.ts.map +1 -1
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-body.js +47 -42
- package/dist/v2/blocks/request-block/helpers/get-default-headers.js +1 -1
- 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 +65 -59
- 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 +57 -42
- 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 +44 -41
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/secret-types.d.ts +2 -2
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/secret-types.d.ts.map +1 -1
- package/dist/v2/components/sidebar/Sidebar.vue.d.ts.map +1 -1
- package/dist/v2/components/sidebar/Sidebar.vue.js +38 -34
- package/dist/v2/features/app/components/DesktopTabs.vue.d.ts.map +1 -1
- package/dist/v2/features/app/components/DesktopTabs.vue.js +34 -30
- package/dist/v2/features/operation/Operation.vue.js +1 -1
- package/dist/views/Components/CodeSnippet/helpers/get-har-request.d.ts.map +1 -1
- package/dist/views/Components/CodeSnippet/helpers/get-har-request.js +44 -45
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
- package/package.json +15 -15
|
@@ -2,82 +2,81 @@ import { REGEX as t } from "@scalar/oas-utils/helpers";
|
|
|
2
2
|
import { buildRequestSecurity as T } from "../../../../libs/send-request/build-request-security.js";
|
|
3
3
|
import { replaceTemplateVariables as a } from "../../../../libs/string-template.js";
|
|
4
4
|
import { convertToHarRequest as P } from "./convert-to-har-request.js";
|
|
5
|
-
const
|
|
6
|
-
operation:
|
|
7
|
-
example:
|
|
8
|
-
server:
|
|
9
|
-
securitySchemes:
|
|
10
|
-
environment:
|
|
5
|
+
const y = "YOUR_SECRET_TOKEN", h = ({
|
|
6
|
+
operation: c,
|
|
7
|
+
example: o,
|
|
8
|
+
server: s,
|
|
9
|
+
securitySchemes: m = [],
|
|
10
|
+
environment: n
|
|
11
11
|
}) => {
|
|
12
|
-
const
|
|
13
|
-
if (
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
const u = n && Array.isArray(n) ? Object.fromEntries(n.map((e) => [e.key, e.value])) : n || {}, A = (o?.parameters?.path ?? []).reduce((e, r) => {
|
|
13
|
+
if (r.enabled) {
|
|
14
|
+
const l = a(r.value, u);
|
|
15
|
+
e[r.key] = encodeURIComponent(l);
|
|
16
|
+
}
|
|
17
|
+
return e;
|
|
18
|
+
}, {}), v = (() => {
|
|
19
|
+
if (s?.url && (t.VARIABLES.test(s.url) || t.PATH.test(s.url))) {
|
|
20
|
+
const e = Object.entries(s?.variables || {}).reduce(
|
|
21
|
+
(r, [l, i]) => (A[l] ? r[l] = A[l] : i.default && (r[l] = a(i.default, u)), r),
|
|
19
22
|
{}
|
|
20
23
|
);
|
|
21
|
-
return a(a(
|
|
24
|
+
return a(a(s.url, u), e);
|
|
22
25
|
}
|
|
23
|
-
return
|
|
24
|
-
})(),
|
|
25
|
-
const e =
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
return e;
|
|
31
|
-
})(), i = T(c, r, S), f = [
|
|
32
|
-
...(s?.parameters.headers ?? []).map((e) => ({
|
|
26
|
+
return s?.url;
|
|
27
|
+
})(), p = (() => {
|
|
28
|
+
const e = c?.path ?? "/";
|
|
29
|
+
return e && (t.VARIABLES.test(e) || t.PATH.test(e)) ? a(a(e, u), A) : e;
|
|
30
|
+
})(), d = T(m, u, y), E = [
|
|
31
|
+
...(o?.parameters.headers ?? []).map((e) => ({
|
|
33
32
|
...e,
|
|
34
|
-
value: t.VARIABLES.test(e.value) || t.PATH.test(e.value) ? a(e.value,
|
|
33
|
+
value: t.VARIABLES.test(e.value) || t.PATH.test(e.value) ? a(e.value, u) : e.value
|
|
35
34
|
})) ?? [],
|
|
36
|
-
...Object.entries(
|
|
35
|
+
...Object.entries(d.headers).map(([e, r]) => ({
|
|
37
36
|
key: e,
|
|
38
|
-
value:
|
|
37
|
+
value: r,
|
|
39
38
|
enabled: !0
|
|
40
39
|
}))
|
|
41
40
|
], b = [
|
|
42
|
-
...(
|
|
41
|
+
...(o?.parameters.cookies ?? []).map((e) => ({
|
|
43
42
|
...e,
|
|
44
|
-
value: t.VARIABLES.test(e.value) || t.PATH.test(e.value) ? a(e.value,
|
|
43
|
+
value: t.VARIABLES.test(e.value) || t.PATH.test(e.value) ? a(e.value, u) : e.value
|
|
45
44
|
})) ?? [],
|
|
46
|
-
...
|
|
45
|
+
...d.cookies.map((e) => ({
|
|
47
46
|
key: e.name,
|
|
48
47
|
value: e.value,
|
|
49
48
|
enabled: !0
|
|
50
49
|
}))
|
|
51
|
-
],
|
|
52
|
-
...(
|
|
50
|
+
], f = [
|
|
51
|
+
...(o?.parameters.query ?? []).map((e) => ({
|
|
53
52
|
...e,
|
|
54
|
-
value: t.VARIABLES.test(e.value) || t.PATH.test(e.value) ? a(e.value,
|
|
53
|
+
value: t.VARIABLES.test(e.value) || t.PATH.test(e.value) ? a(e.value, u) : e.value
|
|
55
54
|
})) ?? [],
|
|
56
|
-
...Array.from(
|
|
55
|
+
...Array.from(d.urlParams.entries()).map(([e, r]) => ({
|
|
57
56
|
key: e,
|
|
58
|
-
value:
|
|
57
|
+
value: r,
|
|
59
58
|
enabled: !0
|
|
60
59
|
}))
|
|
61
|
-
],
|
|
62
|
-
const e =
|
|
60
|
+
], R = (() => {
|
|
61
|
+
const e = o?.body;
|
|
63
62
|
return e?.raw?.value && (t.VARIABLES.test(e.raw.value) || t.PATH.test(e.raw.value)) ? {
|
|
64
63
|
...e,
|
|
65
64
|
raw: {
|
|
66
65
|
...e.raw,
|
|
67
|
-
value: a(e.raw.value,
|
|
66
|
+
value: a(e.raw.value, u)
|
|
68
67
|
}
|
|
69
68
|
} : e;
|
|
70
69
|
})();
|
|
71
70
|
return P({
|
|
72
|
-
baseUrl:
|
|
73
|
-
method:
|
|
74
|
-
path:
|
|
75
|
-
body:
|
|
71
|
+
baseUrl: v,
|
|
72
|
+
method: c?.method ?? "get",
|
|
73
|
+
path: p,
|
|
74
|
+
body: R,
|
|
76
75
|
cookies: b,
|
|
77
|
-
headers:
|
|
78
|
-
query:
|
|
76
|
+
headers: E,
|
|
77
|
+
query: f
|
|
79
78
|
});
|
|
80
79
|
};
|
|
81
80
|
export {
|
|
82
|
-
|
|
81
|
+
h as getHarRequest
|
|
83
82
|
};
|
|
@@ -33,7 +33,7 @@ const W = { class: "flex-center relative flex flex-1 flex-col gap-6 p-2 capitali
|
|
|
33
33
|
}));
|
|
34
34
|
}, f = (u) => {
|
|
35
35
|
u?.createNew && g.name === "request" && p();
|
|
36
|
-
}, v = "2.36.
|
|
36
|
+
}, v = "2.36.1";
|
|
37
37
|
return q(() => a.hotKeys.on(f)), R(() => a.hotKeys.off(f)), (u, e) => (l(), n("div", W, [
|
|
38
38
|
s("div", {
|
|
39
39
|
class: y(["flex h-[calc(100%_-_50px)] flex-col items-center justify-center", {
|
package/package.json
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"rest",
|
|
19
19
|
"testing"
|
|
20
20
|
],
|
|
21
|
-
"version": "2.36.
|
|
21
|
+
"version": "2.36.1",
|
|
22
22
|
"engines": {
|
|
23
23
|
"node": ">=22"
|
|
24
24
|
},
|
|
@@ -334,26 +334,26 @@
|
|
|
334
334
|
"whatwg-mimetype": "4.0.0",
|
|
335
335
|
"yaml": "^2.8.0",
|
|
336
336
|
"zod": "^4.3.5",
|
|
337
|
-
"@scalar/analytics-client": "1.1.0",
|
|
338
337
|
"@scalar/draggable": "0.4.0",
|
|
339
|
-
"@scalar/helpers": "0.4.0",
|
|
340
|
-
"@scalar/components": "0.20.4",
|
|
341
|
-
"@scalar/import": "0.5.1",
|
|
342
|
-
"@scalar/json-magic": "0.12.2",
|
|
343
338
|
"@scalar/icons": "0.6.0",
|
|
344
|
-
"@scalar/
|
|
339
|
+
"@scalar/analytics-client": "1.1.0",
|
|
340
|
+
"@scalar/components": "0.20.5",
|
|
341
|
+
"@scalar/import": "0.5.1",
|
|
342
|
+
"@scalar/helpers": "0.4.0",
|
|
343
|
+
"@scalar/oas-utils": "0.10.4",
|
|
345
344
|
"@scalar/object-utils": "1.3.1",
|
|
346
345
|
"@scalar/openapi-parser": "0.25.2",
|
|
347
|
-
"@scalar/postman-to-openapi": "0.5.1",
|
|
348
346
|
"@scalar/openapi-types": "0.6.0",
|
|
349
|
-
"@scalar/sidebar": "0.8.
|
|
347
|
+
"@scalar/sidebar": "0.8.5",
|
|
348
|
+
"@scalar/postman-to-openapi": "0.5.1",
|
|
349
|
+
"@scalar/json-magic": "0.12.2",
|
|
350
|
+
"@scalar/snippetz": "0.7.3",
|
|
351
|
+
"@scalar/use-hooks": "0.4.0",
|
|
350
352
|
"@scalar/themes": "0.15.0",
|
|
351
|
-
"@scalar/
|
|
353
|
+
"@scalar/use-codemirror": "0.14.5",
|
|
352
354
|
"@scalar/types": "0.7.2",
|
|
353
|
-
"@scalar/use-codemirror": "0.14.4",
|
|
354
355
|
"@scalar/use-toasts": "0.10.0",
|
|
355
|
-
"@scalar/workspace-store": "0.39.
|
|
356
|
-
"@scalar/use-hooks": "0.4.0"
|
|
356
|
+
"@scalar/workspace-store": "0.39.1"
|
|
357
357
|
},
|
|
358
358
|
"devDependencies": {
|
|
359
359
|
"@tailwindcss/vite": "^4.1.18",
|
|
@@ -369,8 +369,8 @@
|
|
|
369
369
|
"vite-svg-loader": "5.1.0",
|
|
370
370
|
"vitest": "4.0.16",
|
|
371
371
|
"@scalar/build-tooling": "0.5.0",
|
|
372
|
-
"@scalar/
|
|
373
|
-
"@scalar/
|
|
372
|
+
"@scalar/galaxy": "0.6.0",
|
|
373
|
+
"@scalar/pre-post-request-scripts": "0.3.5"
|
|
374
374
|
},
|
|
375
375
|
"scripts": {
|
|
376
376
|
"build": "scalar-build-vite",
|