@scalar/api-client 2.19.2 → 2.19.3
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 +21 -0
- package/dist/components/CodeInput/CodeInput.vue.d.ts.map +1 -1
- package/dist/components/CommandPalette/TheCommandPalette.vue.d.ts.map +1 -1
- package/dist/components/CommandPalette/WatchModeToggle.vue.d.ts.map +1 -1
- package/dist/components/DataTable/DataTable.vue.d.ts.map +1 -1
- package/dist/components/DataTable/DataTableInput.vue.d.ts.map +1 -1
- package/dist/components/Form/Form.vue.d.ts.map +1 -1
- package/dist/components/HttpMethod/HttpMethod.vue.d.ts.map +1 -1
- package/dist/components/ImportCollection/ImportCollectionModal.vue.d.ts.map +1 -1
- package/dist/components/ScalarAsciiArt.vue.d.ts.map +1 -1
- package/dist/components/SectionFilterButton.vue.d.ts.map +1 -1
- package/dist/components/Server/ServerDropdownItem.vue.d.ts.map +1 -1
- package/dist/components/Server/ServerVariablesSelect.vue.d.ts.map +1 -1
- package/dist/components/SideNav/DownloadAppButton.vue.d.ts.map +1 -1
- package/dist/components/SideNav/SideNav.vue.d.ts.map +1 -1
- package/dist/components/SideNav/SideNavLink.vue.d.ts.map +1 -1
- package/dist/components/Sidebar/Sidebar.vue.d.ts.map +1 -1
- package/dist/components/TopNav/TopNavItem.vue.d.ts.map +1 -1
- package/dist/components/ViewLayout/ViewLayoutCollapse.vue.d.ts.map +1 -1
- package/dist/hooks/useFileDialog.d.ts +4 -4
- package/dist/layouts/App/MainLayout.vue.d.ts.map +1 -1
- package/dist/style.css +1 -1
- package/dist/v2/blocks/operation-block/helpers/build-request-parameters.d.ts +0 -1
- package/dist/v2/blocks/operation-block/helpers/build-request-parameters.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/helpers/build-request-parameters.js +96 -48
- package/dist/v2/blocks/operation-block/helpers/serialize-parameter.d.ts +96 -0
- package/dist/v2/blocks/operation-block/helpers/serialize-parameter.d.ts.map +1 -0
- package/dist/v2/blocks/operation-block/helpers/serialize-parameter.js +49 -0
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.d.ts.map +1 -1
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.js +16 -17
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-parameters.d.ts +1 -2
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-parameters.d.ts.map +1 -1
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-parameters.js +109 -152
- 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.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBodyPreview.vue.d.ts.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBodyToggle.vue.d.ts.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.d.ts.map +1 -1
- 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/OAuthScopesInput.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.d.ts.map +1 -1
- package/dist/v2/components/code-input/CodeInput.vue.d.ts.map +1 -1
- package/dist/v2/components/data-table/DataTable.vue.d.ts.map +1 -1
- package/dist/v2/components/data-table/DataTableInput.vue.d.ts.map +1 -1
- package/dist/v2/components/server/ServerDropdownItem.vue.d.ts.map +1 -1
- package/dist/v2/features/app/components/AppSidebar.vue.d.ts.map +1 -1
- package/dist/v2/features/app/components/DesktopTab.vue.d.ts.map +1 -1
- package/dist/v2/features/app/helpers/routes.d.ts +2 -2
- package/dist/v2/features/collection/components/Settings.vue.d.ts.map +1 -1
- package/dist/v2/features/collection/components/Settings.vue.js +9 -10
- package/dist/v2/features/command-palette/components/CommandPaletteImport.vue.d.ts +1 -3
- package/dist/v2/features/command-palette/components/CommandPaletteImport.vue.d.ts.map +1 -1
- package/dist/v2/features/command-palette/components/TheCommandPalette.vue.d.ts.map +1 -1
- package/dist/v2/features/command-palette/components/WatchModeToggle.vue.d.ts.map +1 -1
- package/dist/v2/features/environments/components/EnvironmentVariablesDropdown.vue.d.ts.map +1 -1
- 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 +2 -2
- package/dist/v2/features/modal/Modal.vue2.js +31 -31
- package/dist/v2/features/modal/helpers/map-hidden-clients-config.d.ts +8 -0
- package/dist/v2/features/modal/helpers/map-hidden-clients-config.d.ts.map +1 -0
- package/dist/v2/features/modal/helpers/map-hidden-clients-config.js +36 -0
- package/dist/v2/features/modal/index.d.ts +1 -0
- package/dist/v2/features/modal/index.d.ts.map +1 -1
- package/dist/v2/features/modal/index.js +4 -2
- package/dist/v2/features/operation/Operation.vue.d.ts +5 -2
- package/dist/v2/features/operation/Operation.vue.d.ts.map +1 -1
- package/dist/v2/features/operation/Operation.vue.js +48 -34
- package/dist/v2/features/operation/helpers/get-selected-server.d.ts +2 -1
- package/dist/v2/features/operation/helpers/get-selected-server.d.ts.map +1 -1
- package/dist/v2/features/operation/helpers/get-selected-server.js +2 -2
- package/dist/v2/features/search/components/SearchResult.vue.d.ts.map +1 -1
- package/dist/v2/features/settings/CollectionSettings.vue.d.ts +0 -2
- package/dist/v2/features/settings/CollectionSettings.vue.d.ts.map +1 -1
- package/dist/v2/features/settings/CollectionSettings.vue.js +110 -135
- package/dist/v2/features/settings/components/Appearance.vue.d.ts.map +1 -1
- package/dist/v2/helpers/get-servers.d.ts +23 -0
- package/dist/v2/helpers/get-servers.d.ts.map +1 -0
- package/dist/v2/helpers/get-servers.js +66 -0
- package/dist/v2/helpers/index.d.ts +1 -0
- package/dist/v2/helpers/index.d.ts.map +1 -1
- package/dist/v2/helpers/index.js +4 -2
- package/dist/views/Collection/components/EnvironmentForm.vue.d.ts.map +1 -1
- package/dist/views/Environment/Environment.vue.d.ts.map +1 -1
- package/dist/views/Environment/EnvironmentVariableDropdown.vue.d.ts.map +1 -1
- package/dist/views/Request/Request.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestRoot.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSection/RequestAuth/OAuthScopesInput.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSection/RequestAuth/RequestAuthTab.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSection/RequestParams.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSection/RequestTable.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSidebar.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSidebarItem.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSubpageHeader.vue.d.ts.map +1 -1
- package/dist/views/Request/ResponseSection/ResponseBodyPreview.vue.d.ts.map +1 -1
- package/dist/views/Request/ResponseSection/ResponseBodyToggle.vue.d.ts.map +1 -1
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue.d.ts.map +1 -1
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
- package/dist/views/Request/ResponseSection/ResponseSection.vue.d.ts.map +1 -1
- package/dist/views/Settings/SettingsGeneral.vue.d.ts.map +1 -1
- package/dist/views/Settings/components/SettingsAppearance.vue.d.ts.map +1 -1
- package/package.json +11 -11
- package/dist/v2/blocks/operation-block/helpers/get-delimiter.js +0 -15
|
@@ -9,7 +9,6 @@ import type { ParameterObject, ReferenceType } from '@scalar/workspace-store/sch
|
|
|
9
9
|
* @param parameters - Unfiltered parameters
|
|
10
10
|
* @param env - Environment variables flattened into a key-value object
|
|
11
11
|
* @param exampleKey - The key of the current example
|
|
12
|
-
* @param contentType - Content type for content based parameters
|
|
13
12
|
* @returns A set of headers, cookies and url params
|
|
14
13
|
*/
|
|
15
14
|
export declare const buildRequestParameters: (
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-request-parameters.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/build-request-parameters.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"build-request-parameters.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/build-request-parameters.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,aAAa,EAEnB,MAAM,qEAAqE,CAAA;AAE5E,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,8DAA8D,CAAA;AAmBlH;;;;;;;;;;GAUG;AACH,eAAO,MAAM,sBAAsB;AACjC,qBAAqB;AACrB,aAAY,aAAa,CAAC,eAAe,CAAC,EAAO;AACjD,8DAA8D;AAC9D,MAAK,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM;AAChC,qCAAqC;AACrC,aAAY,MAAkB,KAC7B;IACD,OAAO,EAAE,aAAa,EAAE,CAAA;IACxB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC/B,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACrC,SAAS,EAAE,eAAe,CAAA;CA8E3B,CAAA"}
|
|
@@ -1,56 +1,104 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { getExample as
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
1
|
+
import { isDefined as k } from "@scalar/helpers/array/is-defined";
|
|
2
|
+
import { replaceEnvVariables as y } from "@scalar/helpers/regex/replace-variables";
|
|
3
|
+
import { getResolvedRef as g } from "@scalar/workspace-store/helpers/get-resolved-ref";
|
|
4
|
+
import { xScalarCookieSchema as u } from "@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies";
|
|
5
|
+
import { coerceValue as S } from "@scalar/workspace-store/schemas/typebox-coerce";
|
|
6
|
+
import { isParamDisabled as m } from "../../request-block/helpers/is-param-disabled.js";
|
|
7
|
+
import { getExample as z } from "./get-example.js";
|
|
8
|
+
import { serializeSimpleStyle as h, serializeFormStyleForCookies as b, serializeContentValue as x, serializeDeepObjectStyle as v, serializeSpaceDelimitedStyle as C, serializePipeDelimitedStyle as D, serializeFormStyle as $ } from "./serialize-parameter.js";
|
|
9
|
+
const a = (o, s) => "explode" in o && o.explode !== void 0 ? o.explode : s, L = (o = [], s = {}, l = "default") => {
|
|
10
|
+
const e = {
|
|
11
|
+
cookies: [],
|
|
12
|
+
headers: {},
|
|
13
|
+
pathVariables: {},
|
|
14
|
+
urlParams: new URLSearchParams()
|
|
15
|
+
};
|
|
16
|
+
if (o.length === 0)
|
|
17
|
+
return e;
|
|
18
|
+
for (const c of o) {
|
|
19
|
+
const r = g(c), n = z(r, l, void 0);
|
|
20
|
+
if (!n || m(r, n))
|
|
21
|
+
continue;
|
|
22
|
+
const i = typeof n.value == "string" ? y(n.value, s) : n.value, t = y(r.name, s);
|
|
23
|
+
switch (r.in) {
|
|
24
|
+
case "header": {
|
|
25
|
+
if (t.toLowerCase() === "content-type" && i === "multipart/form-data")
|
|
26
|
+
break;
|
|
27
|
+
const f = h(i, a(r, !1));
|
|
28
|
+
if (!k(f))
|
|
29
|
+
break;
|
|
30
|
+
const p = String(f);
|
|
31
|
+
e.headers[t] ? e.headers[t] = `${e.headers[t]},${p}` : e.headers[t] = p;
|
|
32
|
+
break;
|
|
33
|
+
}
|
|
34
|
+
case "path": {
|
|
35
|
+
const d = h(i, a(r, !1));
|
|
36
|
+
e.pathVariables[t] = encodeURIComponent(String(d));
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
case "query": {
|
|
40
|
+
w(r, t, i, e.urlParams);
|
|
41
|
+
break;
|
|
25
42
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
t.urlParams.append(o, r);
|
|
30
|
-
else {
|
|
31
|
-
const m = t.urlParams.get(o);
|
|
32
|
-
if (m) {
|
|
33
|
-
const x = v(h);
|
|
34
|
-
t.urlParams.set(o, `${m}${x}${r}`);
|
|
35
|
-
} else
|
|
36
|
-
t.urlParams.set(o, r);
|
|
37
|
-
}
|
|
43
|
+
case "cookie": {
|
|
44
|
+
P(t, i, a(r, !0), e.cookies);
|
|
45
|
+
break;
|
|
38
46
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return e;
|
|
50
|
+
}, w = (o, s, l, e) => {
|
|
51
|
+
const c = "explode" in o && o.explode !== void 0 ? o.explode : !0, r = "style" in o && o.style ? o.style : "form";
|
|
52
|
+
if ("content" in o && o.content) {
|
|
53
|
+
const i = Object.keys(o.content)[0] ?? "application/json", t = x(l, i);
|
|
54
|
+
e.set(s, t);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
if (r === "deepObject" && c) {
|
|
58
|
+
const i = v(s, l);
|
|
59
|
+
for (const t of i)
|
|
60
|
+
e.append(t.key, t.value);
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
if (r === "spaceDelimited") {
|
|
64
|
+
const i = C(l), t = e.get(s);
|
|
65
|
+
e.set(s, t ? `${t} ${i}` : i);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
if (r === "pipeDelimited") {
|
|
69
|
+
const i = D(l), t = e.get(s);
|
|
70
|
+
e.set(s, t ? `${t}|${i}` : i);
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
const n = $(l, c);
|
|
74
|
+
if (Array.isArray(n))
|
|
75
|
+
for (const i of n) {
|
|
76
|
+
const t = i.key || s;
|
|
77
|
+
e.append(t, String(i.value));
|
|
78
|
+
}
|
|
79
|
+
else
|
|
80
|
+
e.append(s, String(n));
|
|
81
|
+
}, P = (o, s, l, e) => {
|
|
82
|
+
const c = b(s, l);
|
|
83
|
+
if (Array.isArray(c))
|
|
84
|
+
for (const r of c) {
|
|
85
|
+
const n = r.key || o;
|
|
86
|
+
e.push(
|
|
87
|
+
S(u, {
|
|
88
|
+
name: n,
|
|
89
|
+
value: String(r.value),
|
|
43
90
|
path: "/"
|
|
44
91
|
})
|
|
45
|
-
)
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
cookies: [],
|
|
49
|
-
headers: {},
|
|
50
|
-
pathVariables: {},
|
|
51
|
-
urlParams: new URLSearchParams()
|
|
92
|
+
);
|
|
52
93
|
}
|
|
53
|
-
|
|
94
|
+
else
|
|
95
|
+
e.push(
|
|
96
|
+
S(u, {
|
|
97
|
+
name: o,
|
|
98
|
+
value: String(c),
|
|
99
|
+
path: "/"
|
|
100
|
+
})
|
|
101
|
+
);
|
|
54
102
|
};
|
|
55
103
|
export {
|
|
56
104
|
L as buildRequestParameters
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared parameter serialization utilities for OpenAPI style values.
|
|
3
|
+
* Used by both build-request-parameters and process-parameters.
|
|
4
|
+
*
|
|
5
|
+
* @see https://spec.openapis.org/oas/v3.1.1.html#style-values
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Serializes a value based on the content type for content-based query parameters.
|
|
9
|
+
* Content-based query parameters do not use style serialization and instead follow
|
|
10
|
+
* their content type specification (e.g., application/json should be JSON.stringified).
|
|
11
|
+
*
|
|
12
|
+
* @param value - The value to serialize
|
|
13
|
+
* @param contentType - The content type to use for serialization
|
|
14
|
+
* @returns The serialized value as a string
|
|
15
|
+
*/
|
|
16
|
+
export declare const serializeContentValue: (value: unknown, contentType: string) => string;
|
|
17
|
+
/**
|
|
18
|
+
* Serializes a value according to OpenAPI simple style.
|
|
19
|
+
* Used for path and header parameters.
|
|
20
|
+
*
|
|
21
|
+
* Simple style with explode: false
|
|
22
|
+
* - Primitive: blue
|
|
23
|
+
* - Array: blue,black,brown
|
|
24
|
+
* - Object: R,100,G,200,B,150
|
|
25
|
+
*
|
|
26
|
+
* Simple style with explode: true
|
|
27
|
+
* - Primitive: blue
|
|
28
|
+
* - Array: blue,black,brown
|
|
29
|
+
* - Object: R=100,G=200,B=150
|
|
30
|
+
*/
|
|
31
|
+
export declare const serializeSimpleStyle: (value: unknown, explode: boolean) => unknown;
|
|
32
|
+
/**
|
|
33
|
+
* Serializes a value according to OpenAPI form style.
|
|
34
|
+
* Used for query and cookie parameters.
|
|
35
|
+
*
|
|
36
|
+
* Form style with explode: true (default for query)
|
|
37
|
+
* - Primitive: color=blue
|
|
38
|
+
* - Array: color=blue&color=black&color=brown (multiple entries)
|
|
39
|
+
* - Object: R=100&G=200&B=150 (multiple entries)
|
|
40
|
+
*
|
|
41
|
+
* Form style with explode: false
|
|
42
|
+
* - Primitive: color=blue
|
|
43
|
+
* - Array: color=blue,black,brown
|
|
44
|
+
* - Object: color=R,100,G,200,B,150
|
|
45
|
+
*/
|
|
46
|
+
export declare const serializeFormStyle: (value: unknown, explode: boolean) => unknown | Array<{
|
|
47
|
+
key: string;
|
|
48
|
+
value: unknown;
|
|
49
|
+
}>;
|
|
50
|
+
/**
|
|
51
|
+
* Serializes a value according to OpenAPI form style for cookies.
|
|
52
|
+
* This is similar to serializeFormStyle but handles nested objects recursively
|
|
53
|
+
* and treats null values specially for cookie serialization.
|
|
54
|
+
*
|
|
55
|
+
* Form style with explode: true (default for cookies)
|
|
56
|
+
* - Primitive: color=blue
|
|
57
|
+
* - Array: color=blue&color=black&color=brown (multiple entries)
|
|
58
|
+
* - Object: R=100&G=200&B=150 (multiple entries)
|
|
59
|
+
*
|
|
60
|
+
* Form style with explode: false
|
|
61
|
+
* - Primitive: color=blue
|
|
62
|
+
* - Array: color=blue,black,brown (null becomes "null")
|
|
63
|
+
* - Object: color=R,100,G,200,B,150 (recursively flattened)
|
|
64
|
+
*/
|
|
65
|
+
export declare const serializeFormStyleForCookies: (value: unknown, explode: boolean) => unknown | Array<{
|
|
66
|
+
key: string;
|
|
67
|
+
value: unknown;
|
|
68
|
+
}>;
|
|
69
|
+
/**
|
|
70
|
+
* Serializes a value according to OpenAPI spaceDelimited style.
|
|
71
|
+
* Only valid for query parameters with array or object values.
|
|
72
|
+
*
|
|
73
|
+
* SpaceDelimited array: blue black brown
|
|
74
|
+
* SpaceDelimited object: R 100 G 200 B 150
|
|
75
|
+
*/
|
|
76
|
+
export declare const serializeSpaceDelimitedStyle: (value: unknown) => string;
|
|
77
|
+
/**
|
|
78
|
+
* Serializes a value according to OpenAPI pipeDelimited style.
|
|
79
|
+
* Only valid for query parameters with array or object values.
|
|
80
|
+
*
|
|
81
|
+
* PipeDelimited array: blue|black|brown
|
|
82
|
+
* PipeDelimited object: R|100|G|200|B|150
|
|
83
|
+
*/
|
|
84
|
+
export declare const serializePipeDelimitedStyle: (value: unknown) => string;
|
|
85
|
+
/**
|
|
86
|
+
* Serializes a value according to OpenAPI deepObject style.
|
|
87
|
+
* Only valid for query parameters with explode: true.
|
|
88
|
+
*
|
|
89
|
+
* DeepObject: color[R]=100&color[G]=200&color[B]=150
|
|
90
|
+
* Nested: user[name][first]=Alex&user[name][last]=Smith&user[role]=admin
|
|
91
|
+
*/
|
|
92
|
+
export declare const serializeDeepObjectStyle: (paramName: string, value: unknown) => Array<{
|
|
93
|
+
key: string;
|
|
94
|
+
value: string;
|
|
95
|
+
}>;
|
|
96
|
+
//# sourceMappingURL=serialize-parameter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serialize-parameter.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/serialize-parameter.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB,GAAI,OAAO,OAAO,EAAE,aAAa,MAAM,KAAG,MAa3E,CAAA;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,oBAAoB,GAAI,OAAO,OAAO,EAAE,SAAS,OAAO,KAAG,OAqBvE,CAAA;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,kBAAkB,GAC7B,OAAO,OAAO,EACd,SAAS,OAAO,KACf,OAAO,GAAG,KAAK,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,CA4BjD,CAAA;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,4BAA4B,GACvC,OAAO,OAAO,EACd,SAAS,OAAO,KACf,OAAO,GAAG,KAAK,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,CA2CjD,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,GAAI,OAAO,OAAO,KAAG,MAe7D,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B,GAAI,OAAO,OAAO,KAAG,MAe5D,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,GAAI,WAAW,MAAM,EAAE,OAAO,OAAO,KAAG,KAAK,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAyBhH,CAAA"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
const c = (r, n) => typeof r == "string" ? r : n.includes("json") || typeof r == "object" && r !== null && !Array.isArray(r) ? JSON.stringify(r) : String(r), j = (r, n) => {
|
|
2
|
+
if (Array.isArray(r))
|
|
3
|
+
return r.join(",");
|
|
4
|
+
if (typeof r == "object" && r !== null) {
|
|
5
|
+
const t = Object.entries(r);
|
|
6
|
+
return n ? t.map(([e, i]) => `${e}=${i}`).join(",") : t.map(([e, i]) => `${e},${i}`).join(",");
|
|
7
|
+
}
|
|
8
|
+
return r;
|
|
9
|
+
}, p = (r, n) => Array.isArray(r) && n ? r.map((t) => ({ key: "", value: t })) : Array.isArray(r) ? r.join(",") : typeof r == "object" && r !== null && n ? Object.entries(r).map(([t, e]) => ({
|
|
10
|
+
key: t,
|
|
11
|
+
value: e
|
|
12
|
+
})) : typeof r == "object" && r !== null ? Object.entries(r).map(([t, e]) => `${t},${e}`).join(",") : r, A = (r, n) => {
|
|
13
|
+
if (Array.isArray(r) && n)
|
|
14
|
+
return r.map((t) => ({ key: "", value: t }));
|
|
15
|
+
if (Array.isArray(r))
|
|
16
|
+
return r.map((t) => t === null ? "null" : String(t)).join(",");
|
|
17
|
+
if (typeof r == "object" && r !== null && n)
|
|
18
|
+
return Object.entries(r).map(([t, e]) => ({
|
|
19
|
+
key: t,
|
|
20
|
+
value: e
|
|
21
|
+
}));
|
|
22
|
+
if (typeof r == "object" && r !== null) {
|
|
23
|
+
const t = (e) => {
|
|
24
|
+
const i = [];
|
|
25
|
+
for (const [y, o] of Object.entries(e))
|
|
26
|
+
typeof o == "object" && o !== null && !Array.isArray(o) ? i.push(y, ...t(o)) : i.push(y, o === null ? "null" : String(o));
|
|
27
|
+
return i;
|
|
28
|
+
};
|
|
29
|
+
return t(r).join(",");
|
|
30
|
+
}
|
|
31
|
+
return r;
|
|
32
|
+
}, b = (r) => Array.isArray(r) ? r.join(" ") : typeof r == "object" && r !== null ? Object.entries(r).map(([n, t]) => `${n} ${t}`).join(" ") : String(r), l = (r) => Array.isArray(r) ? r.join("|") : typeof r == "object" && r !== null ? Object.entries(r).flat().join("|") : String(r), S = (r, n) => {
|
|
33
|
+
const t = [], e = (i, y) => {
|
|
34
|
+
for (const [o, s] of Object.entries(i)) {
|
|
35
|
+
const f = `${y}[${o}]`;
|
|
36
|
+
typeof s == "object" && s !== null && !Array.isArray(s) ? e(s, f) : t.push({ key: f, value: String(s) });
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
return typeof n == "object" && n !== null && !Array.isArray(n) && e(n, r), t;
|
|
40
|
+
};
|
|
41
|
+
export {
|
|
42
|
+
c as serializeContentValue,
|
|
43
|
+
S as serializeDeepObjectStyle,
|
|
44
|
+
p as serializeFormStyle,
|
|
45
|
+
A as serializeFormStyleForCookies,
|
|
46
|
+
l as serializePipeDelimitedStyle,
|
|
47
|
+
j as serializeSimpleStyle,
|
|
48
|
+
b as serializeSpaceDelimitedStyle
|
|
49
|
+
};
|
package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operation-to-har.d.ts","sourceRoot":"","sources":["../../../../../../src/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AAEnE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qEAAqE,CAAA;AACxG,OAAO,KAAK,EACV,eAAe,EACf,oBAAoB,EACpB,YAAY,EACb,MAAM,8DAA8D,CAAA;AACrE,OAAO,KAAK,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,YAAY,CAAA;AAUvD,MAAM,MAAM,mBAAmB,GAAG;IAChC,+BAA+B;IAC/B,SAAS,EAAE,eAAe,CAAA;IAC1B,mCAAmC;IACnC,MAAM,EAAE,UAAU,CAAA;IAClB,4BAA4B;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,4BAA4B;IAC5B,MAAM,CAAC,EAAE,YAAY,GAAG,IAAI,CAAA;IAC5B,2EAA2E;IAC3E,eAAe,CAAC,EAAE,oBAAoB,EAAE,CAAA;IACxC,mCAAmC;IACnC,aAAa,CAAC,EAAE,aAAa,EAAE,CAAA;IAC/B;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAA;CAChC,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,cAAc,GAAI,mHAU5B,mBAAmB,KAAG,
|
|
1
|
+
{"version":3,"file":"operation-to-har.d.ts","sourceRoot":"","sources":["../../../../../../src/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AAEnE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qEAAqE,CAAA;AACxG,OAAO,KAAK,EACV,eAAe,EACf,oBAAoB,EACpB,YAAY,EACb,MAAM,8DAA8D,CAAA;AACrE,OAAO,KAAK,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,YAAY,CAAA;AAUvD,MAAM,MAAM,mBAAmB,GAAG;IAChC,+BAA+B;IAC/B,SAAS,EAAE,eAAe,CAAA;IAC1B,mCAAmC;IACnC,MAAM,EAAE,UAAU,CAAA;IAClB,4BAA4B;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,4BAA4B;IAC5B,MAAM,CAAC,EAAE,YAAY,GAAG,IAAI,CAAA;IAC5B,2EAA2E;IAC3E,eAAe,CAAC,EAAE,oBAAoB,EAAE,CAAA;IACxC,mCAAmC;IACnC,aAAa,CAAC,EAAE,aAAa,EAAE,CAAA;IAC/B;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAA;CAChC,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,cAAc,GAAI,mHAU5B,mBAAmB,KAAG,UA+FxB,CAAA"}
|
|
@@ -6,23 +6,23 @@ import { processParameters as H } from "./process-parameters.js";
|
|
|
6
6
|
import { processSecuritySchemes as z } from "./process-security-schemes.js";
|
|
7
7
|
import { processServerUrl as D } from "./process-server-url.js";
|
|
8
8
|
const w = ({
|
|
9
|
-
includeDefaultHeaders:
|
|
9
|
+
includeDefaultHeaders: u = !1,
|
|
10
10
|
operation: t,
|
|
11
|
-
contentType:
|
|
12
|
-
method:
|
|
11
|
+
contentType: f,
|
|
12
|
+
method: l,
|
|
13
13
|
path: p,
|
|
14
14
|
server: c = null,
|
|
15
15
|
example: a,
|
|
16
|
-
securitySchemes:
|
|
16
|
+
securitySchemes: n,
|
|
17
17
|
globalCookies: h
|
|
18
18
|
}) => {
|
|
19
|
-
const y =
|
|
20
|
-
method:
|
|
19
|
+
const y = u ? T({
|
|
20
|
+
method: l,
|
|
21
21
|
operation: t,
|
|
22
22
|
exampleKey: a ?? "default",
|
|
23
23
|
hideDisabledHeaders: !0
|
|
24
24
|
}).filter((e) => !e.isOverridden) : [], g = t["x-scalar-disable-parameters"]?.["global-cookies"]?.[a ?? "default"] ?? {}, v = D(c, p), r = {
|
|
25
|
-
method:
|
|
25
|
+
method: l,
|
|
26
26
|
url: v,
|
|
27
27
|
headers: y.map((e) => ({ name: e.name, value: e.defaultValue })),
|
|
28
28
|
queryString: [],
|
|
@@ -36,14 +36,13 @@ const w = ({
|
|
|
36
36
|
const { url: e, headers: s, queryString: o, cookies: S } = H({
|
|
37
37
|
harRequest: r,
|
|
38
38
|
parameters: t.parameters,
|
|
39
|
-
example: a
|
|
40
|
-
contentType: l
|
|
39
|
+
example: a
|
|
41
40
|
}), b = h?.filter((i) => q({ cookie: i, url: e, disabledGlobalCookies: g }))?.map((i) => ({ name: i.name, value: i.value })) ?? [];
|
|
42
41
|
r.url = e, r.headers = s, r.queryString = o, r.cookies = [...b, ...S];
|
|
43
42
|
}
|
|
44
|
-
const
|
|
45
|
-
if (
|
|
46
|
-
const e = C({ requestBody:
|
|
43
|
+
const d = k(t.requestBody);
|
|
44
|
+
if (d?.content) {
|
|
45
|
+
const e = C({ requestBody: d, contentType: f, example: a });
|
|
47
46
|
if (e && (r.postData = e, r.bodySize = e.text?.length ?? -1, e.mimeType)) {
|
|
48
47
|
const s = r.headers.find(
|
|
49
48
|
(o) => o.name.toLowerCase() === "content-type"
|
|
@@ -54,14 +53,14 @@ const w = ({
|
|
|
54
53
|
});
|
|
55
54
|
}
|
|
56
55
|
}
|
|
57
|
-
if (
|
|
58
|
-
const { headers: e, queryString: s, cookies: o } = z(
|
|
56
|
+
if (n) {
|
|
57
|
+
const { headers: e, queryString: s, cookies: o } = z(n);
|
|
59
58
|
r.headers.push(...e), r.queryString.push(...s), r.cookies.push(...o);
|
|
60
59
|
}
|
|
61
|
-
let
|
|
60
|
+
let m = 0;
|
|
62
61
|
for (const e of r.headers)
|
|
63
|
-
|
|
64
|
-
return r.headersSize =
|
|
62
|
+
m += (e.name?.length ?? 0) + 2 + (e.value?.length ?? 0) + 2;
|
|
63
|
+
return r.headersSize = m, r;
|
|
65
64
|
};
|
|
66
65
|
export {
|
|
67
66
|
w as operationToHar
|
package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-parameters.d.ts
CHANGED
|
@@ -12,12 +12,11 @@ type ProcessedParameters = {
|
|
|
12
12
|
*
|
|
13
13
|
* @see https://spec.openapis.org/oas/latest.html#style-values
|
|
14
14
|
*/
|
|
15
|
-
export declare const processParameters: ({ harRequest, parameters, example,
|
|
15
|
+
export declare const processParameters: ({ harRequest, parameters, example, }: {
|
|
16
16
|
harRequest: HarRequest;
|
|
17
17
|
parameters: OperationObject["parameters"];
|
|
18
18
|
/** The name of the example to use */
|
|
19
19
|
example?: string | undefined;
|
|
20
|
-
contentType?: string | undefined;
|
|
21
20
|
}) => ProcessedParameters;
|
|
22
21
|
export {};
|
|
23
22
|
//# sourceMappingURL=process-parameters.d.ts.map
|
package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-parameters.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process-parameters.d.ts","sourceRoot":"","sources":["../../../../../../src/v2/blocks/operation-code-sample/helpers/operation-to-har/process-parameters.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAmB,MAAM,8DAA8D,CAAA;AAEpH,OAAO,KAAK,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"process-parameters.d.ts","sourceRoot":"","sources":["../../../../../../src/v2/blocks/operation-code-sample/helpers/operation-to-har/process-parameters.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAmB,MAAM,8DAA8D,CAAA;AAEpH,OAAO,KAAK,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,YAAY,CAAA;AAcvD,KAAK,mBAAmB,GAAG;IACzB,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,EAAE,UAAU,CAAC,SAAS,CAAC,CAAA;IAC9B,WAAW,EAAE,UAAU,CAAC,aAAa,CAAC,CAAA;IACtC,OAAO,EAAE,UAAU,CAAC,SAAS,CAAC,CAAA;CAC/B,CAAA;AAuED;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,GAAI,sCAI/B;IACD,UAAU,EAAE,UAAU,CAAA;IACtB,UAAU,EAAE,eAAe,CAAC,YAAY,CAAC,CAAA;IACzC,qCAAqC;IACrC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAC7B,KAAG,mBAuHH,CAAA"}
|