@scalar/workspace-store 0.46.0 → 0.46.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 +14 -0
- package/dist/events/definitions/hooks.d.ts +2 -1
- package/dist/events/definitions/hooks.d.ts.map +1 -1
- package/dist/mutators/operation/helpers/fetch-request-to-har.d.ts +19 -29
- package/dist/mutators/operation/helpers/fetch-request-to-har.d.ts.map +1 -1
- package/dist/mutators/operation/helpers/fetch-request-to-har.js +74 -70
- package/dist/mutators/operation/history.js +1 -1
- package/dist/request-example/builder/build-request.d.ts +17 -5
- package/dist/request-example/builder/build-request.d.ts.map +1 -1
- package/dist/request-example/builder/build-request.js +18 -18
- package/dist/request-example/builder/index.d.ts +1 -1
- package/dist/request-example/builder/index.d.ts.map +1 -1
- package/dist/request-example/builder/resolve-request-factory-url.d.ts.map +1 -1
- package/dist/request-example/builder/resolve-request-factory-url.js +2 -1
- package/dist/request-example/context/get-request-example-context.d.ts.map +1 -1
- package/dist/request-example/context/get-request-example-context.js +1 -1
- package/dist/request-example/context/security/extract-security-scheme-secrets.d.ts.map +1 -1
- package/dist/request-example/context/security/extract-security-scheme-secrets.js +11 -5
- package/dist/request-example/context/security/get-security-schemes.d.ts +1 -1
- package/dist/request-example/context/security/get-security-schemes.d.ts.map +1 -1
- package/dist/request-example/context/security/get-security-schemes.js +2 -2
- package/dist/request-example/index.d.ts +2 -2
- package/dist/request-example/index.d.ts.map +1 -1
- package/dist/request-example/index.js +1 -1
- package/dist/schemas/inmemory-workspace.d.ts +1 -1
- package/dist/schemas/reference-config/index.d.ts +1 -1
- package/dist/schemas/workspace-specification/index.d.ts +1 -1
- package/dist/schemas/workspace.d.ts +2 -2
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @scalar/workspace-store
|
|
2
2
|
|
|
3
|
+
## 0.46.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#8927](https://github.com/scalar/scalar/pull/8927): Resolve environment variables in raw request paths when building request URLs, so address bar placeholders like `{{path}}` are substituted during send.
|
|
8
|
+
|
|
9
|
+
## 0.46.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#8862](https://github.com/scalar/scalar/pull/8862): add `python/aiohttp` as a supported code snippet client and expose it through shared snippet client types and config schemas
|
|
14
|
+
- [#8911](https://github.com/scalar/scalar/pull/8911): feat: switch from Request to RequestPayload to support body with GET
|
|
15
|
+
- [#8888](https://github.com/scalar/scalar/pull/8888): fix: resolve selected security schemes using selectedIndex
|
|
16
|
+
|
|
3
17
|
## 0.46.0
|
|
4
18
|
|
|
5
19
|
### Minor Changes
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { OperationExampleMeta } from '../../events/definitions/operation.js';
|
|
2
|
+
import type { RequestPayload } from '../../request-example/builder/build-request.js';
|
|
2
3
|
/**
|
|
3
4
|
* Event definitions for hooking into the API client lifecycle.
|
|
4
5
|
*
|
|
@@ -26,7 +27,7 @@ export type HooksEvents = {
|
|
|
26
27
|
'hooks:on:request:complete': {
|
|
27
28
|
payload: {
|
|
28
29
|
response: Response;
|
|
29
|
-
|
|
30
|
+
requestPayload: RequestPayload;
|
|
30
31
|
duration: number;
|
|
31
32
|
timestamp: number;
|
|
32
33
|
} | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../src/events/definitions/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAA;
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../src/events/definitions/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAA;AAC1E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAA;AAE7E;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB;;;;;OAKG;IACH,uBAAuB,EAAE;QACvB,IAAI,EAAE,oBAAoB,CAAA;KAC3B,CAAA;IACD;;;;;;OAMG;IACH,2BAA2B,EAAE;QAC3B,OAAO,EACH;YACE,QAAQ,EAAE,QAAQ,CAAA;YAClB,cAAc,EAAE,cAAc,CAAA;YAC9B,QAAQ,EAAE,MAAM,CAAA;YAChB,SAAS,EAAE,MAAM,CAAA;SAClB,GACD,SAAS,CAAA;QACb,IAAI,EAAE,oBAAoB,CAAA;KAC3B,CAAA;IACD;;;;OAIG;IACH,mCAAmC,EAAE;QACnC,IAAI,EAAE;YACJ,YAAY,EAAE,MAAM,CAAA;SACrB,CAAA;KACF,CAAA;CACF,CAAA"}
|
|
@@ -1,62 +1,52 @@
|
|
|
1
1
|
import type { HarRequest } from '@scalar/snippetz';
|
|
2
|
+
import type { RequestPayload } from '../../../request-example/builder/build-request.js';
|
|
2
3
|
type FetchRequestToHarProps = {
|
|
3
|
-
/** The
|
|
4
|
-
|
|
4
|
+
/** The [url, RequestInit] tuple to convert, as returned by buildRequest */
|
|
5
|
+
requestPayload: RequestPayload;
|
|
5
6
|
/**
|
|
6
7
|
* Whether to include the request body in the HAR postData.
|
|
7
|
-
* Note: Reading the body consumes it, so the request will be cloned automatically.
|
|
8
8
|
* @default true
|
|
9
9
|
*/
|
|
10
10
|
includeBody?: boolean;
|
|
11
11
|
/**
|
|
12
|
-
* HTTP version string to use (
|
|
12
|
+
* HTTP version string to use (Fetch API does not expose this).
|
|
13
13
|
* @default 'HTTP/1.1'
|
|
14
14
|
*/
|
|
15
15
|
httpVersion?: string;
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
18
|
-
*
|
|
17
|
+
* Maximum body size in bytes to capture in the HAR postData. Bodies larger
|
|
18
|
+
* than this are omitted and recorded with bodySize -1.
|
|
19
|
+
* @default 1048576 (1 MB)
|
|
19
20
|
*/
|
|
20
21
|
bodySizeLimit?: number;
|
|
21
22
|
};
|
|
22
23
|
/**
|
|
23
|
-
* Converts a
|
|
24
|
-
*
|
|
25
|
-
* This function transforms a standard JavaScript Fetch API Request into the
|
|
26
|
-
* HAR format, which is useful for:
|
|
27
|
-
* - Recording HTTP requests for replay or analysis
|
|
28
|
-
* - Creating request fixtures from real API calls
|
|
29
|
-
* - Debugging and monitoring HTTP traffic
|
|
30
|
-
* - Storing request history in a standard format
|
|
31
|
-
* - Generating API documentation from real requests
|
|
24
|
+
* Converts a RequestPayload (url + RequestInit tuple) to HAR (HTTP Archive) Request format.
|
|
32
25
|
*
|
|
33
26
|
* The conversion handles:
|
|
34
27
|
* - Request method and URL
|
|
35
|
-
* - Headers extraction
|
|
28
|
+
* - Headers extraction
|
|
36
29
|
* - Query parameters extraction from URL
|
|
37
30
|
* - Cookie extraction from headers
|
|
38
|
-
* - Request body reading (with automatic cloning to preserve the original)
|
|
39
31
|
* - Content-Type detection and MIME type extraction
|
|
40
32
|
* - Size calculations for headers and body
|
|
41
|
-
* -
|
|
42
|
-
* -
|
|
43
|
-
*
|
|
44
|
-
* Note: The Fetch API does not expose the HTTP version, so it defaults to HTTP/1.1
|
|
45
|
-
* unless specified otherwise.
|
|
33
|
+
* - FormData and URLSearchParams bodies are converted to a params array
|
|
34
|
+
* - String, Blob, and ArrayBuffer bodies are read as text
|
|
35
|
+
* - Binary (octet-stream) and ReadableStream bodies are skipped
|
|
46
36
|
*
|
|
47
37
|
* @see https://w3c.github.io/web-performance/specs/HAR/Overview.html
|
|
48
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/Request
|
|
49
38
|
*
|
|
50
39
|
* @example
|
|
51
|
-
* const
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
40
|
+
* const harRequest = await fetchRequestToHar({
|
|
41
|
+
* requestPayload: ['https://api.example.com/users', {
|
|
42
|
+
* method: 'POST',
|
|
43
|
+
* headers: { 'Content-Type': 'application/json' },
|
|
44
|
+
* body: JSON.stringify({ name: 'John' }),
|
|
45
|
+
* }],
|
|
55
46
|
* })
|
|
56
|
-
* const harRequest = await fetchRequestToHar({ request })
|
|
57
47
|
* console.log(harRequest.method) // 'POST'
|
|
58
48
|
* console.log(harRequest.postData?.text) // '{"name":"John"}'
|
|
59
49
|
*/
|
|
60
|
-
export declare const fetchRequestToHar: ({
|
|
50
|
+
export declare const fetchRequestToHar: ({ requestPayload, includeBody, httpVersion, bodySizeLimit, }: FetchRequestToHarProps) => Promise<HarRequest>;
|
|
61
51
|
export {};
|
|
62
52
|
//# sourceMappingURL=fetch-request-to-har.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch-request-to-har.d.ts","sourceRoot":"","sources":["../../../../src/mutators/operation/helpers/fetch-request-to-har.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAElD,KAAK,sBAAsB,GAAG;IAC5B,
|
|
1
|
+
{"version":3,"file":"fetch-request-to-har.d.ts","sourceRoot":"","sources":["../../../../src/mutators/operation/helpers/fetch-request-to-har.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAElD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAA;AAE7E,KAAK,sBAAsB,GAAG;IAC5B,2EAA2E;IAC3E,cAAc,EAAE,cAAc,CAAA;IAC9B;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,iBAAiB,GAAU,8DAKrC,sBAAsB,KAAG,OAAO,CAAC,UAAU,CAoD7C,CAAA"}
|
|
@@ -1,56 +1,46 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Converts a
|
|
3
|
-
*
|
|
4
|
-
* This function transforms a standard JavaScript Fetch API Request into the
|
|
5
|
-
* HAR format, which is useful for:
|
|
6
|
-
* - Recording HTTP requests for replay or analysis
|
|
7
|
-
* - Creating request fixtures from real API calls
|
|
8
|
-
* - Debugging and monitoring HTTP traffic
|
|
9
|
-
* - Storing request history in a standard format
|
|
10
|
-
* - Generating API documentation from real requests
|
|
2
|
+
* Converts a RequestPayload (url + RequestInit tuple) to HAR (HTTP Archive) Request format.
|
|
11
3
|
*
|
|
12
4
|
* The conversion handles:
|
|
13
5
|
* - Request method and URL
|
|
14
|
-
* - Headers extraction
|
|
6
|
+
* - Headers extraction
|
|
15
7
|
* - Query parameters extraction from URL
|
|
16
8
|
* - Cookie extraction from headers
|
|
17
|
-
* - Request body reading (with automatic cloning to preserve the original)
|
|
18
9
|
* - Content-Type detection and MIME type extraction
|
|
19
10
|
* - Size calculations for headers and body
|
|
20
|
-
* -
|
|
21
|
-
* -
|
|
22
|
-
*
|
|
23
|
-
* Note: The Fetch API does not expose the HTTP version, so it defaults to HTTP/1.1
|
|
24
|
-
* unless specified otherwise.
|
|
11
|
+
* - FormData and URLSearchParams bodies are converted to a params array
|
|
12
|
+
* - String, Blob, and ArrayBuffer bodies are read as text
|
|
13
|
+
* - Binary (octet-stream) and ReadableStream bodies are skipped
|
|
25
14
|
*
|
|
26
15
|
* @see https://w3c.github.io/web-performance/specs/HAR/Overview.html
|
|
27
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/Request
|
|
28
16
|
*
|
|
29
17
|
* @example
|
|
30
|
-
* const
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
18
|
+
* const harRequest = await fetchRequestToHar({
|
|
19
|
+
* requestPayload: ['https://api.example.com/users', {
|
|
20
|
+
* method: 'POST',
|
|
21
|
+
* headers: { 'Content-Type': 'application/json' },
|
|
22
|
+
* body: JSON.stringify({ name: 'John' }),
|
|
23
|
+
* }],
|
|
34
24
|
* })
|
|
35
|
-
* const harRequest = await fetchRequestToHar({ request })
|
|
36
25
|
* console.log(harRequest.method) // 'POST'
|
|
37
26
|
* console.log(harRequest.postData?.text) // '{"name":"John"}'
|
|
38
27
|
*/
|
|
39
|
-
export const fetchRequestToHar = async ({
|
|
40
|
-
|
|
41
|
-
bodySizeLimit = 1048576, }) => {
|
|
28
|
+
export const fetchRequestToHar = async ({ requestPayload, includeBody = true, httpVersion = 'HTTP/1.1', bodySizeLimit = 1048576, }) => {
|
|
29
|
+
const [originalUrl, requestInit] = requestPayload;
|
|
42
30
|
// Extract query string from URL
|
|
43
|
-
const url = new URL(
|
|
31
|
+
const url = new URL(originalUrl);
|
|
44
32
|
// Extract the query strings from the URL
|
|
45
33
|
const queryString = Array.from(url.searchParams.entries()).map(([name, value]) => ({ name, value }));
|
|
46
|
-
//
|
|
47
|
-
const
|
|
34
|
+
// Normalize HeadersInit to a Headers instance so we can call .get() and .entries() safely
|
|
35
|
+
const _headers = new Headers(requestInit.headers);
|
|
48
36
|
// Extract the MIME type from the request headers
|
|
49
|
-
const mimeType =
|
|
37
|
+
const mimeType = _headers.get('content-type')?.split(';')[0]?.trim() ?? 'text/plain';
|
|
38
|
+
// Extract the headers from the request
|
|
39
|
+
const { headers, headersSize, cookies } = processRequestHeaders(_headers);
|
|
50
40
|
// Read the request body if requested
|
|
51
41
|
const bodyDetails = await (async () => {
|
|
52
|
-
if (includeBody &&
|
|
53
|
-
const details = await processRequestBody(
|
|
42
|
+
if (includeBody && requestInit.body != null) {
|
|
43
|
+
const details = await processRequestBody(requestInit.body, mimeType);
|
|
54
44
|
if (details.size <= bodySizeLimit) {
|
|
55
45
|
return details;
|
|
56
46
|
}
|
|
@@ -59,8 +49,8 @@ bodySizeLimit = 1048576, }) => {
|
|
|
59
49
|
})();
|
|
60
50
|
// Create the HAR request object
|
|
61
51
|
const harRequest = {
|
|
62
|
-
method:
|
|
63
|
-
url:
|
|
52
|
+
method: requestInit.method ?? 'GET',
|
|
53
|
+
url: originalUrl,
|
|
64
54
|
httpVersion,
|
|
65
55
|
headers,
|
|
66
56
|
cookies,
|
|
@@ -79,50 +69,64 @@ bodySizeLimit = 1048576, }) => {
|
|
|
79
69
|
};
|
|
80
70
|
return harRequest;
|
|
81
71
|
};
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
acc.params.push({ name, value });
|
|
93
|
-
acc.size += value.length;
|
|
94
|
-
return acc;
|
|
95
|
-
}, { params: [], size: 0 });
|
|
72
|
+
/**
|
|
73
|
+
* Extracts HAR body details from a BodyInit value.
|
|
74
|
+
*
|
|
75
|
+
* Because we own the RequestInit tuple we can inspect the body by type directly —
|
|
76
|
+
* no stream cloning or header sniffing required.
|
|
77
|
+
*/
|
|
78
|
+
const processRequestBody = async (body, contentType) => {
|
|
79
|
+
// Structured form payloads become a params array so HAR viewers can render them as key/value tables
|
|
80
|
+
if (body instanceof FormData) {
|
|
81
|
+
return extractFormDataParams(body);
|
|
96
82
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
return { text: '', size: -1 };
|
|
83
|
+
if (body instanceof URLSearchParams) {
|
|
84
|
+
return extractUrlSearchParams(body);
|
|
100
85
|
}
|
|
101
|
-
//
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
return { size, text: new TextDecoder().decode(arrayBuffer) };
|
|
105
|
-
};
|
|
106
|
-
async function tryGetRequestFormData(request) {
|
|
107
|
-
if (typeof request.formData !== 'function') {
|
|
108
|
-
return null;
|
|
86
|
+
// HAR text fields cannot represent arbitrary binary; skip rather than corrupt the entry
|
|
87
|
+
if (contentType.includes('application/octet-stream')) {
|
|
88
|
+
return { text: '', size: -1 };
|
|
109
89
|
}
|
|
110
|
-
if (
|
|
111
|
-
|
|
90
|
+
if (typeof body === 'string') {
|
|
91
|
+
// Use byte length, not character length, to match what the wire sends for multi-byte UTF-8
|
|
92
|
+
const size = new TextEncoder().encode(body).byteLength;
|
|
93
|
+
return { text: body, size };
|
|
112
94
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
return
|
|
95
|
+
if (body instanceof Blob) {
|
|
96
|
+
const text = await body.text();
|
|
97
|
+
return { text, size: body.size };
|
|
116
98
|
}
|
|
117
|
-
|
|
118
|
-
return
|
|
99
|
+
if (body instanceof ArrayBuffer) {
|
|
100
|
+
return { text: new TextDecoder().decode(body), size: body.byteLength };
|
|
119
101
|
}
|
|
120
|
-
|
|
121
|
-
return
|
|
102
|
+
if (ArrayBuffer.isView(body)) {
|
|
103
|
+
return { text: new TextDecoder().decode(body), size: body.byteLength };
|
|
122
104
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
105
|
+
// ReadableStream cannot be read without consuming it
|
|
106
|
+
return { text: '', size: -1 };
|
|
107
|
+
};
|
|
108
|
+
const extractFormDataParams = (formData) => {
|
|
109
|
+
return Array.from(formData.entries()).reduce((acc, [name, value]) => {
|
|
110
|
+
if (value instanceof File) {
|
|
111
|
+
const fileName = `@${value.name}`;
|
|
112
|
+
acc.params.push({ name, value: fileName });
|
|
113
|
+
acc.size += fileName.length;
|
|
114
|
+
return acc;
|
|
115
|
+
}
|
|
116
|
+
acc.params.push({ name, value });
|
|
117
|
+
acc.size += value.length;
|
|
118
|
+
return acc;
|
|
119
|
+
}, { params: [], size: 0 });
|
|
120
|
+
};
|
|
121
|
+
const extractUrlSearchParams = (params) => {
|
|
122
|
+
return Array.from(params.entries()).reduce((acc, [name, value]) => {
|
|
123
|
+
acc.params.push({ name, value });
|
|
124
|
+
acc.size += name.length + value.length;
|
|
125
|
+
return acc;
|
|
126
|
+
}, { params: [], size: 0 });
|
|
127
|
+
};
|
|
128
|
+
const processRequestHeaders = (headers) => {
|
|
129
|
+
return Array.from(headers.entries()).reduce((acc, [name, value]) => {
|
|
126
130
|
if (name.toLowerCase() === 'cookie') {
|
|
127
131
|
const parsedCookies = parseCookieHeader(value);
|
|
128
132
|
acc.cookies.push(...parsedCookies.cookies);
|
|
@@ -24,7 +24,7 @@ export const addResponseToHistory = async (store, document, { payload, meta }) =
|
|
|
24
24
|
}
|
|
25
25
|
return acc;
|
|
26
26
|
}, {});
|
|
27
|
-
const requestHar = await fetchRequestToHar({
|
|
27
|
+
const requestHar = await fetchRequestToHar({ requestPayload: payload.requestPayload });
|
|
28
28
|
const responseHar = await fetchResponseToHar({ response: payload.response });
|
|
29
29
|
store?.history.addHistory(documentName, meta.path, meta.method, {
|
|
30
30
|
response: responseHar,
|
|
@@ -1,12 +1,24 @@
|
|
|
1
1
|
import type { RequestFactory } from '../../request-example/builder/request-factory.js';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
/**
|
|
3
|
+
* The payload to build a request, useful when bypassing limitations of the browser Request object
|
|
4
|
+
*/
|
|
5
|
+
export type RequestPayload = [string, RequestInit];
|
|
6
|
+
/**
|
|
7
|
+
* Built request response
|
|
8
|
+
*
|
|
9
|
+
* We no longer return a Request object, but a tuple of [url, init] that maps directly to the fetch() argument list so
|
|
10
|
+
* we can do things that the browser doesn't allow like GET + body
|
|
11
|
+
* */
|
|
12
|
+
type BuildRequestResponse = {
|
|
13
|
+
/** Create a new request payload object with the replaced values ready to be sent to the server */
|
|
14
|
+
requestPayload: RequestPayload;
|
|
7
15
|
/** The abort controller */
|
|
8
16
|
controller: AbortController;
|
|
9
17
|
/** The flag indicating if the request is being proxied */
|
|
10
18
|
isUsingProxy: boolean;
|
|
11
19
|
};
|
|
20
|
+
export declare const buildRequest: (request: RequestFactory, options: {
|
|
21
|
+
envVariables: Record<string, string>;
|
|
22
|
+
}) => BuildRequestResponse;
|
|
23
|
+
export {};
|
|
12
24
|
//# sourceMappingURL=build-request.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-request.d.ts","sourceRoot":"","sources":["../../../src/request-example/builder/build-request.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAA;AAK/E,eAAO,MAAM,YAAY,GACvB,SAAS,cAAc,EACvB,SAAS;IACP,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACrC
|
|
1
|
+
{"version":3,"file":"build-request.d.ts","sourceRoot":"","sources":["../../../src/request-example/builder/build-request.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAA;AAK/E;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAA;AAElD;;;;;KAKK;AACL,KAAK,oBAAoB,GAAG;IAC1B,kGAAkG;IAClG,cAAc,EAAE,cAAc,CAAA;IAC9B,2BAA2B;IAC3B,UAAU,EAAE,eAAe,CAAA;IAC3B,0DAA0D;IAC1D,YAAY,EAAE,OAAO,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,YAAY,GACvB,SAAS,cAAc,EACvB,SAAS;IACP,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACrC,KACA,oBA2JF,CAAA"}
|
|
@@ -3,8 +3,8 @@ import { redirectToProxy, shouldUseProxy } from '@scalar/helpers/url/redirect-to
|
|
|
3
3
|
import { encode as encodeBase64 } from 'js-base64';
|
|
4
4
|
import { buildRequestCookieHeader } from '../../request-example/builder/header/build-request-cookie-header.js';
|
|
5
5
|
import { applyAllowReservedToUrl } from '../../request-example/builder/helpers/apply-allow-reserved-to-url.js';
|
|
6
|
-
import { contextFunctions, isContextFunctionName } from '../../request-example/functions.js';
|
|
7
6
|
import { resolveRequestFactoryUrl } from '../../request-example/builder/resolve-request-factory-url.js';
|
|
7
|
+
import { contextFunctions, isContextFunctionName } from '../../request-example/functions.js';
|
|
8
8
|
export const buildRequest = (request, options) => {
|
|
9
9
|
/** Replace the value with the environment variable or context function */
|
|
10
10
|
const replace = (value) => {
|
|
@@ -72,11 +72,11 @@ export const buildRequest = (request, options) => {
|
|
|
72
72
|
})();
|
|
73
73
|
if (security.in === 'header') {
|
|
74
74
|
// Set the header (use replaced header name so {{ env }} placeholders work)
|
|
75
|
-
headers.
|
|
75
|
+
headers.append(name, securityValue);
|
|
76
76
|
return;
|
|
77
77
|
}
|
|
78
78
|
if (security.in === 'query') {
|
|
79
|
-
securityQueryParams.
|
|
79
|
+
securityQueryParams.append(name, securityValue);
|
|
80
80
|
return;
|
|
81
81
|
}
|
|
82
82
|
if (security.in === 'cookie') {
|
|
@@ -116,22 +116,22 @@ export const buildRequest = (request, options) => {
|
|
|
116
116
|
const encodedUrl = applyAllowReservedToUrl(requestUrl, request.allowedReservedQueryParameters ?? new Set());
|
|
117
117
|
const finalUrl = isUsingProxy ? redirectToProxy(request.proxyUrl, encodedUrl) : encodedUrl;
|
|
118
118
|
return {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
119
|
+
requestPayload: [
|
|
120
|
+
finalUrl,
|
|
121
|
+
{
|
|
122
|
+
/**
|
|
123
|
+
* Ensure that all methods are uppercased (though only needed for patch)
|
|
124
|
+
*
|
|
125
|
+
* @see https://github.com/whatwg/fetch/issues/50
|
|
126
|
+
*/
|
|
127
|
+
method: request.method.toUpperCase(),
|
|
128
|
+
headers,
|
|
129
|
+
body,
|
|
130
|
+
cache: request.cache,
|
|
131
|
+
signal: controller.signal,
|
|
132
|
+
},
|
|
133
|
+
],
|
|
133
134
|
controller,
|
|
134
|
-
/** The flag indicating if the request is being proxied */
|
|
135
135
|
isUsingProxy,
|
|
136
136
|
};
|
|
137
137
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { getExampleFromBody } from './body/get-request-body-example.js';
|
|
2
2
|
export { getSelectedBodyContentType } from './body/get-selected-body-content-type.js';
|
|
3
|
-
export { buildRequest } from './build-request.js';
|
|
3
|
+
export { type RequestPayload, buildRequest } from './build-request.js';
|
|
4
4
|
export { deSerializeParameter } from './header/de-serialize-parameter.js';
|
|
5
5
|
export { filterGlobalCookie } from './header/filter-global-cookies.js';
|
|
6
6
|
export { serializeContentValue, serializeDeepObjectStyle, serializeFormStyle, serializeFormStyleForCookies, serializePipeDelimitedStyle, serializeSimpleStyle, serializeSpaceDelimitedStyle, } from './header/serialize-parameter.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/request-example/builder/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAA;AACpE,OAAO,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAA;AAClF,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/request-example/builder/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAA;AACpE,OAAO,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAA;AAClF,OAAO,EAAE,KAAK,cAAc,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAA;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAA;AACnE,OAAO,EACL,qBAAqB,EACrB,wBAAwB,EACxB,kBAAkB,EAClB,4BAA4B,EAC5B,2BAA2B,EAC3B,oBAAoB,EACpB,4BAA4B,GAC7B,MAAM,8BAA8B,CAAA;AACrC,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAA;AAC7E,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAA;AACxE,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAA;AACnE,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAA;AACxE,YAAY,EACV,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,gCAAgC,EAChC,gCAAgC,EAChC,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACtB,yBAAyB,EACzB,0BAA0B,GAC3B,MAAM,yBAAyB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-request-factory-url.d.ts","sourceRoot":"","sources":["../../../src/request-example/builder/resolve-request-factory-url.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAA;AAE/E;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,GACnC,SAAS,cAAc,EACvB,SAAS;IACP,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC,CAAA;IACzE,mBAAmB,EAAE,eAAe,CAAA;CACrC,KACA,
|
|
1
|
+
{"version":3,"file":"resolve-request-factory-url.d.ts","sourceRoot":"","sources":["../../../src/request-example/builder/resolve-request-factory-url.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAA;AAE/E;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,GACnC,SAAS,cAAc,EACvB,SAAS;IACP,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC,CAAA;IACzE,mBAAmB,EAAE,eAAe,CAAA;CACrC,KACA,MAkCF,CAAA"}
|
|
@@ -12,7 +12,8 @@ export const resolveRequestFactoryUrl = (request, options) => {
|
|
|
12
12
|
encodeURIComponent(replaceEnvVariables(value, variables)),
|
|
13
13
|
]));
|
|
14
14
|
const baseUrl = replaceEnvVariables(request.baseUrl, variables);
|
|
15
|
-
const
|
|
15
|
+
const rawPath = replaceEnvVariables(request.path.raw, variables);
|
|
16
|
+
const path = replacePathVariables(rawPath, pathVariables);
|
|
16
17
|
const mergedUrl = mergeUrls(baseUrl, path);
|
|
17
18
|
// When rendered inside an iframe with srcdoc, the browser reports
|
|
18
19
|
// window.location.origin as the string "null" instead of a real origin.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-request-example-context.d.ts","sourceRoot":"","sources":["../../../src/request-example/context/get-request-example-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAA;AAE9E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAC9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AACvD,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAEpD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,iDAAiD,CAAA;AAIjG,OAAO,EAAE,KAAK,MAAM,EAAqB,MAAM,iCAAiC,CAAA;AAIhF,OAAO,EAAE,KAAK,qBAAqB,EAAiB,MAAM,mDAAmD,CAAA;AAE7G,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AACzE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qDAAqD,CAAA;AAC7F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+CAA+C,CAAA;AAClF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAA;AACtE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,4CAA4C,CAAA;AAC3F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAChE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAE5D,MAAM,MAAM,0BAA0B,GAAG;IACvC,SAAS,EAAE,eAAe,CAAA;IAC1B,WAAW,EAAE;QACX,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;QACnB,WAAW,EAAE,kBAAkB,CAAA;KAChC,CAAA;IACD,OAAO,EAAE;QACP,SAAS,EAAE,aAAa,EAAE,CAAA;QAC1B,QAAQ,EAAE,aAAa,EAAE,CAAA;KAC1B,CAAA;IACD,OAAO,EAAE;QACP,IAAI,EAAE,YAAY,EAAE,CAAA;QACpB,QAAQ,EAAE,YAAY,GAAG,IAAI,CAAA;QAC7B,IAAI,EAAE,UAAU,CAAA;KACjB,CAAA;IACD,KAAK,EAAE;QACL,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;KACnB,CAAA;IACD,OAAO,EAAE;QACP,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAChC,CAAA;IACD,QAAQ,EAAE;QACR,OAAO,EAAE,qBAAqB,CAAA;QAC9B,YAAY,EAAE,yBAAyB,EAAE,CAAA;QACzC,QAAQ,EAAE,gBAAgB,CAAA;QAC1B,eAAe,EAAE,0BAA0B,EAAE,CAAA;QAC7C,IAAI,EAAE,QAAQ,CAAA;KACf,CAAA;CACF,CAAA;AAED,eAAO,MAAM,wBAAwB,GACnC,gBAAgB,cAAc,EAC9B,cAAc,MAAM,EACpB,oBAAoB,kBAAkB,EACtC,UAAS,OAAO,CAAC;IACf,OAAO,EAAE,YAAY,EAAE,CAAA;IACvB,aAAa,EAAE,MAAM,CAAA;IACrB,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,OAAO,CAAA;IACnB,+CAA+C;IAC/C,cAAc,EAAE,2BAA2B,CAAA;IAC3C;;;;OAIG;IACH,gBAAgB,EAAE,iBAAiB,GAAG,IAAI,CAAA;CAC3C,CAAM,KACN,MAAM,CAAC,0BAA0B,
|
|
1
|
+
{"version":3,"file":"get-request-example-context.d.ts","sourceRoot":"","sources":["../../../src/request-example/context/get-request-example-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAA;AAE9E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAC9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AACvD,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAEpD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,iDAAiD,CAAA;AAIjG,OAAO,EAAE,KAAK,MAAM,EAAqB,MAAM,iCAAiC,CAAA;AAIhF,OAAO,EAAE,KAAK,qBAAqB,EAAiB,MAAM,mDAAmD,CAAA;AAE7G,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AACzE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qDAAqD,CAAA;AAC7F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+CAA+C,CAAA;AAClF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAA;AACtE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,4CAA4C,CAAA;AAC3F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAChE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAE5D,MAAM,MAAM,0BAA0B,GAAG;IACvC,SAAS,EAAE,eAAe,CAAA;IAC1B,WAAW,EAAE;QACX,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;QACnB,WAAW,EAAE,kBAAkB,CAAA;KAChC,CAAA;IACD,OAAO,EAAE;QACP,SAAS,EAAE,aAAa,EAAE,CAAA;QAC1B,QAAQ,EAAE,aAAa,EAAE,CAAA;KAC1B,CAAA;IACD,OAAO,EAAE;QACP,IAAI,EAAE,YAAY,EAAE,CAAA;QACpB,QAAQ,EAAE,YAAY,GAAG,IAAI,CAAA;QAC7B,IAAI,EAAE,UAAU,CAAA;KACjB,CAAA;IACD,KAAK,EAAE;QACL,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;KACnB,CAAA;IACD,OAAO,EAAE;QACP,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAChC,CAAA;IACD,QAAQ,EAAE;QACR,OAAO,EAAE,qBAAqB,CAAA;QAC9B,YAAY,EAAE,yBAAyB,EAAE,CAAA;QACzC,QAAQ,EAAE,gBAAgB,CAAA;QAC1B,eAAe,EAAE,0BAA0B,EAAE,CAAA;QAC7C,IAAI,EAAE,QAAQ,CAAA;KACf,CAAA;CACF,CAAA;AAED,eAAO,MAAM,wBAAwB,GACnC,gBAAgB,cAAc,EAC9B,cAAc,MAAM,EACpB,oBAAoB,kBAAkB,EACtC,UAAS,OAAO,CAAC;IACf,OAAO,EAAE,YAAY,EAAE,CAAA;IACvB,aAAa,EAAE,MAAM,CAAA;IACrB,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,OAAO,CAAA;IACnB,+CAA+C;IAC/C,cAAc,EAAE,2BAA2B,CAAA;IAC3C;;;;OAIG;IACH,gBAAgB,EAAE,iBAAiB,GAAG,IAAI,CAAA;CAC3C,CAAM,KACN,MAAM,CAAC,0BAA0B,CAuInC,CAAA"}
|
|
@@ -67,7 +67,7 @@ export const getRequestExampleContext = (workspaceStore, documentName, requestEx
|
|
|
67
67
|
const securityRequirements = getSecurityRequirements(document.security, operation.security);
|
|
68
68
|
const selectedSecurity = getSelectedSecurity(documentSelectedSecurity, operationSelectedSecurity, securityRequirements, securitySchemes, options.authentication?.preferredSecurityScheme);
|
|
69
69
|
/** The above selected requirements in scheme form */
|
|
70
|
-
const selectedSecuritySchemes = getSecuritySchemes(securitySchemes, selectedSecurity.selectedSchemes);
|
|
70
|
+
const selectedSecuritySchemes = getSecuritySchemes(securitySchemes, selectedSecurity.selectedSchemes[selectedSecurity.selectedIndex] ?? {});
|
|
71
71
|
const serverMeta = operation.servers != null ? { type: 'operation', path: path ?? '', method: method ?? 'get' } : { type: 'document' };
|
|
72
72
|
const authMeta = operationSelectedSecurity !== undefined
|
|
73
73
|
? { type: 'operation', path: path ?? '', method: method ?? 'get' }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extract-security-scheme-secrets.d.ts","sourceRoot":"","sources":["../../../../src/request-example/context/security/extract-security-scheme-secrets.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAC5D,OAAO,KAAK,EAAE,SAAS,EAA2C,MAAM,uCAAuC,CAAA;AAC/G,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iDAAiD,CAAA;AAQlF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8DAA8D,CAAA;AAExG,OAAO,KAAK,EAUV,0BAA0B,EAC3B,MAAM,iDAAiD,CAAA;AAExD,wGAAwG;AACxG,MAAM,MAAM,gBAAgB,GAAG,oBAAoB,GAAG,WAAW,CAAC,cAAc,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"extract-security-scheme-secrets.d.ts","sourceRoot":"","sources":["../../../../src/request-example/context/security/extract-security-scheme-secrets.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAC5D,OAAO,KAAK,EAAE,SAAS,EAA2C,MAAM,uCAAuC,CAAA;AAC/G,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iDAAiD,CAAA;AAQlF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8DAA8D,CAAA;AAExG,OAAO,KAAK,EAUV,0BAA0B,EAC3B,MAAM,iDAAiD,CAAA;AAExD,wGAAwG;AACxG,MAAM,MAAM,gBAAgB,GAAG,oBAAoB,GAAG,WAAW,CAAC,cAAc,CAAC,CAAA;AAiLjF,6DAA6D;AAC7D,eAAO,MAAM,4BAA4B,GAEvC,QAAQ,oBAAoB,GAAG,WAAW,CAAC,cAAc,CAAC,EAC1D,WAAW,SAAS,EACpB,MAAM,MAAM,EACZ,cAAc,MAAM,KACnB,0BA2DF,CAAA"}
|
|
@@ -15,11 +15,17 @@ const SECRET_TO_INPUT_FIELD_MAP = {
|
|
|
15
15
|
'x-scalar-secret-token-url': 'tokenUrl',
|
|
16
16
|
};
|
|
17
17
|
const mergeFlowSecrets = (properties, configSecrets, authStoreSecrets = {}) => Object.fromEntries(properties.map((property) => {
|
|
18
|
-
//
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
// Redirect URI is the only OAuth secret where an explicit empty value from
|
|
19
|
+
// store must be preserved. Other secrets use falsy fallback behavior for backwards-compatibility
|
|
20
|
+
// with config defaults when the casted auth store value is an empty string.
|
|
21
|
+
const authStoreValue = typeof authStoreSecrets[property] === 'string' ? authStoreSecrets[property] : undefined;
|
|
22
|
+
const configValue = typeof configSecrets[property] === 'string' ? configSecrets[property] : undefined;
|
|
23
|
+
const configInputValue = typeof configSecrets[SECRET_TO_INPUT_FIELD_MAP[property]] === 'string'
|
|
24
|
+
? configSecrets[SECRET_TO_INPUT_FIELD_MAP[property]]
|
|
25
|
+
: undefined;
|
|
26
|
+
const value = property === 'x-scalar-secret-redirect-uri'
|
|
27
|
+
? (authStoreValue ?? configValue ?? configInputValue ?? '')
|
|
28
|
+
: authStoreValue || configValue || configInputValue || '';
|
|
23
29
|
return [property, value];
|
|
24
30
|
}));
|
|
25
31
|
const extractRefreshTokenSecret = (authStoreSecrets = {}) => {
|
|
@@ -5,5 +5,5 @@ import type { SecurityRequirementObject } from '../../../schemas/v3.1/strict/sec
|
|
|
5
5
|
* Get the selected security schemes from security requirements.
|
|
6
6
|
* Takes security requirement objects and resolves them to actual security scheme objects.
|
|
7
7
|
*/
|
|
8
|
-
export declare const getSecuritySchemes: (securitySchemes: MergedSecuritySchemes, selectedSecurity: SecurityRequirementObject
|
|
8
|
+
export declare const getSecuritySchemes: (securitySchemes: MergedSecuritySchemes, selectedSecurity: SecurityRequirementObject) => SecuritySchemeObjectSecret[];
|
|
9
9
|
//# sourceMappingURL=get-security-schemes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-security-schemes.d.ts","sourceRoot":"","sources":["../../../../src/request-example/context/security/get-security-schemes.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,iDAAiD,CAAA;AACjG,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mDAAmD,CAAA;AAC9F,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,4CAA4C,CAAA;AAE3F;;;GAGG;AACH,eAAO,MAAM,kBAAkB,GAC7B,iBAAiB,qBAAqB,EACtC,kBAAkB,yBAAyB,
|
|
1
|
+
{"version":3,"file":"get-security-schemes.d.ts","sourceRoot":"","sources":["../../../../src/request-example/context/security/get-security-schemes.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,iDAAiD,CAAA;AACjG,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mDAAmD,CAAA;AAC9F,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,4CAA4C,CAAA;AAE3F;;;GAGG;AACH,eAAO,MAAM,kBAAkB,GAC7B,iBAAiB,qBAAqB,EACtC,kBAAkB,yBAAyB,KAC1C,0BAA0B,EAQzB,CAAA"}
|
|
@@ -4,10 +4,10 @@ import { getResolvedRef } from '../../../helpers/get-resolved-ref.js';
|
|
|
4
4
|
* Get the selected security schemes from security requirements.
|
|
5
5
|
* Takes security requirement objects and resolves them to actual security scheme objects.
|
|
6
6
|
*/
|
|
7
|
-
export const getSecuritySchemes = (securitySchemes, selectedSecurity) =>
|
|
7
|
+
export const getSecuritySchemes = (securitySchemes, selectedSecurity) => objectKeys(selectedSecurity).flatMap((key) => {
|
|
8
8
|
const scheme = getResolvedRef(securitySchemes?.[key]);
|
|
9
9
|
if (scheme) {
|
|
10
10
|
return scheme;
|
|
11
11
|
}
|
|
12
12
|
return [];
|
|
13
|
-
})
|
|
13
|
+
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export type { ApiKeyObjectSecret, HttpObjectSecret, OAuth2ObjectSecret, OAuthFlowAuthorizationCodeSecret, OAuthFlowClientCredentialsSecret, OAuthFlowImplicitSecret, OAuthFlowPasswordSecret, OAuthFlowsObjectSecret, OpenIdConnectObjectSecret, SecuritySchemeObjectSecret, } from './builder/index.js';
|
|
1
|
+
export type { ApiKeyObjectSecret, HttpObjectSecret, OAuth2ObjectSecret, OAuthFlowAuthorizationCodeSecret, OAuthFlowClientCredentialsSecret, OAuthFlowImplicitSecret, OAuthFlowPasswordSecret, OAuthFlowsObjectSecret, OpenIdConnectObjectSecret, RequestPayload, SecuritySchemeObjectSecret, } from './builder/index.js';
|
|
2
2
|
export { type RequestFactory, buildRequest, buildRequestSecurity, deSerializeParameter, filterGlobalCookie, getEnvironmentVariables, getExample, getExampleFromBody, getExampleFromSchema, getResolvedUrl, getSelectedBodyContentType, getServerVariables, requestFactory, serializeContentValue, serializeDeepObjectStyle, serializeFormStyle, serializeFormStyleForCookies, serializePipeDelimitedStyle, serializeSimpleStyle, serializeSpaceDelimitedStyle, } from './builder/index.js';
|
|
3
3
|
export type { MergedSecuritySchemes } from './context/index.js';
|
|
4
4
|
export { type BuildRequestExampleContext, combineParams, getActiveEnvironment, getActiveProxyUrl, getRequestExampleContext, getSecurityRequirements, getSecuritySchemes, getSelectedSecurity, getSelectedServer, getServers, isAuthOptional, mergeSecurity, } from './context/index.js';
|
|
5
|
+
export { CONTEXT_FUNCTION_NAMES, type ContextFunctionEntry, type ContextFunctionName, POPULAR_CONTEXT_FUNCTION_KEYS, contextFunctions, getContextFunctionComment, isContextFunctionName, } from './functions.js';
|
|
5
6
|
export { createVariablesStoreForRequest } from './variable-store/index.js';
|
|
6
7
|
export type { VariableEntry, VariablesStore } from './variable-store/types.js';
|
|
7
|
-
export { CONTEXT_FUNCTION_NAMES, type ContextFunctionEntry, type ContextFunctionName, POPULAR_CONTEXT_FUNCTION_KEYS, contextFunctions, getContextFunctionComment, isContextFunctionName, } from './functions.js';
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/request-example/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,gCAAgC,EAChC,gCAAgC,EAChC,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACtB,yBAAyB,EACzB,0BAA0B,GAC3B,MAAM,WAAW,CAAA;AAClB,OAAO,EACL,KAAK,cAAc,EACnB,YAAY,EACZ,oBAAoB,EACpB,oBAAoB,EACpB,kBAAkB,EAClB,uBAAuB,EACvB,UAAU,EACV,kBAAkB,EAClB,oBAAoB,EACpB,cAAc,EACd,0BAA0B,EAC1B,kBAAkB,EAClB,cAAc,EACd,qBAAqB,EACrB,wBAAwB,EACxB,kBAAkB,EAClB,4BAA4B,EAC5B,2BAA2B,EAC3B,oBAAoB,EACpB,4BAA4B,GAC7B,MAAM,WAAW,CAAA;AAClB,YAAY,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAA;AACtD,OAAO,EACL,KAAK,0BAA0B,EAC/B,aAAa,EACb,oBAAoB,EACpB,iBAAiB,EACjB,wBAAwB,EACxB,uBAAuB,EACvB,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,UAAU,EACV,cAAc,EACd,aAAa,GACd,MAAM,WAAW,CAAA;AAClB,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/request-example/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,gCAAgC,EAChC,gCAAgC,EAChC,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACtB,yBAAyB,EACzB,cAAc,EACd,0BAA0B,GAC3B,MAAM,WAAW,CAAA;AAClB,OAAO,EACL,KAAK,cAAc,EACnB,YAAY,EACZ,oBAAoB,EACpB,oBAAoB,EACpB,kBAAkB,EAClB,uBAAuB,EACvB,UAAU,EACV,kBAAkB,EAClB,oBAAoB,EACpB,cAAc,EACd,0BAA0B,EAC1B,kBAAkB,EAClB,cAAc,EACd,qBAAqB,EACrB,wBAAwB,EACxB,kBAAkB,EAClB,4BAA4B,EAC5B,2BAA2B,EAC3B,oBAAoB,EACpB,4BAA4B,GAC7B,MAAM,WAAW,CAAA;AAClB,YAAY,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAA;AACtD,OAAO,EACL,KAAK,0BAA0B,EAC/B,aAAa,EACb,oBAAoB,EACpB,iBAAiB,EACjB,wBAAwB,EACxB,uBAAuB,EACvB,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,UAAU,EACV,cAAc,EACd,aAAa,GACd,MAAM,WAAW,CAAA;AAClB,OAAO,EACL,sBAAsB,EACtB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,6BAA6B,EAC7B,gBAAgB,EAChB,yBAAyB,EACzB,qBAAqB,GACtB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,8BAA8B,EAAE,MAAM,kBAAkB,CAAA;AACjE,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { buildRequest, buildRequestSecurity, deSerializeParameter, filterGlobalCookie, getEnvironmentVariables, getExample, getExampleFromBody, getExampleFromSchema, getResolvedUrl, getSelectedBodyContentType, getServerVariables, requestFactory, serializeContentValue, serializeDeepObjectStyle, serializeFormStyle, serializeFormStyleForCookies, serializePipeDelimitedStyle, serializeSimpleStyle, serializeSpaceDelimitedStyle, } from './builder/index.js';
|
|
2
2
|
export { combineParams, getActiveEnvironment, getActiveProxyUrl, getRequestExampleContext, getSecurityRequirements, getSecuritySchemes, getSelectedSecurity, getSelectedServer, getServers, isAuthOptional, mergeSecurity, } from './context/index.js';
|
|
3
|
-
export { createVariablesStoreForRequest } from './variable-store/index.js';
|
|
4
3
|
export { CONTEXT_FUNCTION_NAMES, POPULAR_CONTEXT_FUNCTION_KEYS, contextFunctions, getContextFunctionComment, isContextFunctionName, } from './functions.js';
|
|
4
|
+
export { createVariablesStoreForRequest } from './variable-store/index.js';
|