@scalar/api-client 2.19.3 → 2.20.0
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 +34 -0
- package/dist/style.css +1 -1
- package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts +0 -9
- package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/OperationBlock.vue.js +126 -67
- package/dist/v2/blocks/operation-block/components/Header.vue.d.ts +6 -0
- package/dist/v2/blocks/operation-block/components/Header.vue.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/components/Header.vue.js +2 -2
- package/dist/v2/blocks/operation-block/components/Header.vue2.js +25 -24
- package/dist/v2/blocks/operation-block/helpers/build-request-cookie-header.d.ts +1 -1
- package/dist/v2/blocks/operation-block/helpers/build-request-cookie-header.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/helpers/build-request-cookie-header.js +1 -1
- package/dist/v2/blocks/operation-block/helpers/build-request.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/helpers/build-request.js +41 -39
- package/dist/v2/blocks/operation-block/helpers/har-to-fetch-request.d.ts +42 -0
- package/dist/v2/blocks/operation-block/helpers/har-to-fetch-request.d.ts.map +1 -0
- package/dist/v2/blocks/operation-block/helpers/har-to-fetch-request.js +31 -0
- package/dist/v2/blocks/operation-block/helpers/har-to-fetch-response.d.ts +66 -0
- package/dist/v2/blocks/operation-block/helpers/har-to-fetch-response.d.ts.map +1 -0
- package/dist/v2/blocks/operation-block/helpers/har-to-fetch-response.js +43 -0
- package/dist/v2/blocks/operation-block/helpers/send-request.d.ts +1 -0
- package/dist/v2/blocks/operation-block/helpers/send-request.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/helpers/send-request.js +40 -38
- 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 +6 -0
- 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 +24 -23
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.d.ts +2 -3
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.js +2 -2
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue2.js +20 -20
- package/dist/v2/components/sidebar/Sidebar.vue.d.ts +5 -0
- package/dist/v2/components/sidebar/Sidebar.vue.d.ts.map +1 -1
- package/dist/v2/components/sidebar/Sidebar.vue.js +60 -54
- package/dist/v2/features/app/app-events.d.ts.map +1 -1
- package/dist/v2/features/app/app-events.js +53 -42
- package/dist/v2/features/app/app-state.d.ts.map +1 -1
- package/dist/v2/features/app/app-state.js +72 -72
- 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 +84 -76
- package/dist/v2/features/collection/DocumentCollection.vue.d.ts.map +1 -1
- package/dist/v2/features/collection/DocumentCollection.vue.js +82 -43
- package/dist/v2/features/operation/Operation.vue.d.ts.map +1 -1
- package/dist/v2/features/operation/Operation.vue.js +2 -3
- package/dist/v2/workspace-events.d.ts.map +1 -1
- package/dist/v2/workspace-events.js +12 -6
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
- package/package.json +13 -13
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { HarRequest } from '@scalar/snippetz';
|
|
2
|
+
type HarToFetchRequestProps = {
|
|
3
|
+
/** The HAR Request object to convert */
|
|
4
|
+
harRequest: HarRequest;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Converts a HAR (HTTP Archive) Request to a Fetch API Request object.
|
|
8
|
+
*
|
|
9
|
+
* This function is the reverse of fetchRequestToHar - it takes a HAR request
|
|
10
|
+
* and converts it into a standard JavaScript Fetch API Request object.
|
|
11
|
+
*
|
|
12
|
+
* The conversion handles:
|
|
13
|
+
* - Request method and URL reconstruction
|
|
14
|
+
* - Headers reconstruction from HAR headers array
|
|
15
|
+
* - Cookies conversion to Cookie header
|
|
16
|
+
* - Form data (params) conversion to FormData or URLSearchParams
|
|
17
|
+
* - Body decoding
|
|
18
|
+
* - Content-Type and other header restoration
|
|
19
|
+
* - Query parameters (already embedded in the URL)
|
|
20
|
+
*
|
|
21
|
+
* Use cases:
|
|
22
|
+
* - Replaying recorded HTTP requests
|
|
23
|
+
* - Creating mock requests from HAR files
|
|
24
|
+
* - Testing with fixtures
|
|
25
|
+
* - Request caching and restoration
|
|
26
|
+
* - Re-executing historical API calls
|
|
27
|
+
*
|
|
28
|
+
* Note: The Fetch API Request object does not support setting the HTTP version,
|
|
29
|
+
* so that information from the HAR is not preserved in the returned Request.
|
|
30
|
+
* Query parameters are expected to be already part of the URL in the HAR.
|
|
31
|
+
*
|
|
32
|
+
* @see https://w3c.github.io/web-performance/specs/HAR/Overview.html
|
|
33
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Request
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* const harRequest = { method: 'POST', url: 'https://api.example.com', ... }
|
|
37
|
+
* const request = harToFetchRequest({ harRequest })
|
|
38
|
+
* const response = await fetch(request)
|
|
39
|
+
*/
|
|
40
|
+
export declare const harToFetchRequest: ({ harRequest }: HarToFetchRequestProps) => Request;
|
|
41
|
+
export {};
|
|
42
|
+
//# sourceMappingURL=har-to-fetch-request.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"har-to-fetch-request.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/har-to-fetch-request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAElD,KAAK,sBAAsB,GAAG;IAC5B,wCAAwC;IACxC,UAAU,EAAE,UAAU,CAAA;CACvB,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,eAAO,MAAM,iBAAiB,GAAI,gBAAgB,sBAAsB,KAAG,OAS1E,CAAA"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
const l = ({ harRequest: e }) => {
|
|
2
|
+
const n = s(e), o = d(e.postData);
|
|
3
|
+
return new Request(e.url, {
|
|
4
|
+
method: e.method,
|
|
5
|
+
headers: n,
|
|
6
|
+
body: o
|
|
7
|
+
});
|
|
8
|
+
}, s = (e) => {
|
|
9
|
+
const n = new Headers();
|
|
10
|
+
if (e.headers.forEach(({ name: o, value: t }) => {
|
|
11
|
+
n.append(o, t);
|
|
12
|
+
}), e.cookies?.length) {
|
|
13
|
+
const o = e.cookies.map(({ name: t, value: r }) => `${t}=${r}`).join("; ");
|
|
14
|
+
n.append("Cookie", o);
|
|
15
|
+
}
|
|
16
|
+
return n;
|
|
17
|
+
}, d = (e) => {
|
|
18
|
+
if (!e)
|
|
19
|
+
return null;
|
|
20
|
+
const { params: n, text: o, mimeType: t } = e;
|
|
21
|
+
if (n?.length) {
|
|
22
|
+
const c = t?.includes("multipart/form-data") ? new FormData() : new URLSearchParams();
|
|
23
|
+
return n.forEach(({ name: a, value: i }) => {
|
|
24
|
+
c.append(a, i || "");
|
|
25
|
+
}), c;
|
|
26
|
+
}
|
|
27
|
+
return o ? new TextEncoder().encode(o) : null;
|
|
28
|
+
};
|
|
29
|
+
export {
|
|
30
|
+
l as harToFetchRequest
|
|
31
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { HttpMethod } from '@scalar/helpers/http/http-methods';
|
|
2
|
+
import type { HarResponse } from '@scalar/snippetz';
|
|
3
|
+
import type { ResponseInstance } from '../../../../v2/blocks/operation-block/helpers/send-request.js';
|
|
4
|
+
type HarToFetchResponseProps = {
|
|
5
|
+
/** The HAR Response object to convert */
|
|
6
|
+
harResponse: HarResponse;
|
|
7
|
+
/** Optional URL to set on the Response object */
|
|
8
|
+
url?: string;
|
|
9
|
+
/** The HTTP method used for the request */
|
|
10
|
+
method: HttpMethod;
|
|
11
|
+
/** The request path */
|
|
12
|
+
path: string;
|
|
13
|
+
/** Time in ms the request took */
|
|
14
|
+
duration?: number;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Converts a HAR (HTTP Archive) Response back to a ResponseInstance object.
|
|
18
|
+
*
|
|
19
|
+
* This function is the reverse of fetchResponseToHar - it takes a HAR response
|
|
20
|
+
* and converts it back into a ResponseInstance object that includes both the
|
|
21
|
+
* standard Fetch API Response properties and additional metadata.
|
|
22
|
+
*
|
|
23
|
+
* The conversion handles:
|
|
24
|
+
* - Status code and status text restoration
|
|
25
|
+
* - Headers reconstruction from HAR headers array
|
|
26
|
+
* - Body decoding
|
|
27
|
+
* - Content-Type and other header restoration
|
|
28
|
+
* - URL property setting (if provided)
|
|
29
|
+
* - Cookie header detection
|
|
30
|
+
* - Duration tracking
|
|
31
|
+
* - Response size calculation in bytes
|
|
32
|
+
*
|
|
33
|
+
* Body Handling:
|
|
34
|
+
* - Plain text (no encoding): Text-based responses under 1MB from fetchResponseToHar
|
|
35
|
+
* - Base64 encoded: Binary or legacy data (note: new HAR files won't contain binary data)
|
|
36
|
+
* - Empty: Streaming responses, large responses (>1MB), or responses without bodies
|
|
37
|
+
*
|
|
38
|
+
* Use cases:
|
|
39
|
+
* - Replaying recorded HTTP responses
|
|
40
|
+
* - Creating mock responses from HAR files
|
|
41
|
+
* - Testing with fixtures
|
|
42
|
+
* - Response caching and restoration
|
|
43
|
+
*
|
|
44
|
+
* Note: The Fetch API Response object does not support setting the HTTP version,
|
|
45
|
+
* so that information from the HAR is not preserved in the returned Response.
|
|
46
|
+
* The URL property is set using Object.defineProperty since it is read-only
|
|
47
|
+
* in the standard Response constructor.
|
|
48
|
+
*
|
|
49
|
+
* @see https://w3c.github.io/web-performance/specs/HAR/Overview.html
|
|
50
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Response
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* const harResponse = { status: 200, statusText: 'OK', ... }
|
|
54
|
+
* const response = harToFetchResponse({
|
|
55
|
+
* harResponse,
|
|
56
|
+
* url: 'https://api.example.com',
|
|
57
|
+
* method: 'GET',
|
|
58
|
+
* path: '/users',
|
|
59
|
+
* duration: 250
|
|
60
|
+
* })
|
|
61
|
+
* console.log(response.url) // 'https://api.example.com'
|
|
62
|
+
* console.log(response.duration) // 250
|
|
63
|
+
*/
|
|
64
|
+
export declare const harToFetchResponse: ({ harResponse, url, method, path, duration, }: HarToFetchResponseProps) => ResponseInstance;
|
|
65
|
+
export {};
|
|
66
|
+
//# sourceMappingURL=har-to-fetch-response.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"har-to-fetch-response.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/har-to-fetch-response.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AACnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAGnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kDAAkD,CAAA;AAExF,KAAK,uBAAuB,GAAG;IAC7B,yCAAyC;IACzC,WAAW,EAAE,WAAW,CAAA;IACxB,iDAAiD;IACjD,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,2CAA2C;IAC3C,MAAM,EAAE,UAAU,CAAA;IAClB,uBAAuB;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,kCAAkC;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AAWD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,eAAO,MAAM,kBAAkB,GAAI,+CAMhC,uBAAuB,KAAG,gBAwB5B,CAAA"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { getCookieHeaderKeys as i } from "./get-cookie-header-keys.js";
|
|
2
|
+
const l = ({
|
|
3
|
+
harResponse: t,
|
|
4
|
+
url: e = "",
|
|
5
|
+
method: n,
|
|
6
|
+
path: s,
|
|
7
|
+
duration: r = 0
|
|
8
|
+
}) => {
|
|
9
|
+
const o = b(t), { body: d, data: a, size: c } = x(t), u = i(o);
|
|
10
|
+
return {
|
|
11
|
+
...new Response(d, {
|
|
12
|
+
status: t.status,
|
|
13
|
+
statusText: t.statusText,
|
|
14
|
+
headers: o
|
|
15
|
+
}),
|
|
16
|
+
headers: Object.fromEntries(o.entries()),
|
|
17
|
+
cookieHeaderKeys: u,
|
|
18
|
+
duration: r,
|
|
19
|
+
status: t.status,
|
|
20
|
+
statusText: t.statusText,
|
|
21
|
+
method: n,
|
|
22
|
+
path: s,
|
|
23
|
+
data: a,
|
|
24
|
+
size: c,
|
|
25
|
+
url: e
|
|
26
|
+
};
|
|
27
|
+
}, b = (t) => {
|
|
28
|
+
const e = new Headers();
|
|
29
|
+
return t.headers.forEach(({ name: n, value: s }) => {
|
|
30
|
+
e.append(n, s);
|
|
31
|
+
}), e;
|
|
32
|
+
}, x = (t) => {
|
|
33
|
+
if (!t.content.text)
|
|
34
|
+
return { body: null, data: "", size: 0 };
|
|
35
|
+
const { text: e, encoding: n } = t.content;
|
|
36
|
+
if (n)
|
|
37
|
+
return { body: null, data: e, size: e.length };
|
|
38
|
+
const s = new TextEncoder().encode(e).buffer;
|
|
39
|
+
return { body: s, data: e, size: s.byteLength };
|
|
40
|
+
};
|
|
41
|
+
export {
|
|
42
|
+
l as harToFetchResponse
|
|
43
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"send-request.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/send-request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AAEnE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8DAA8D,CAAA;AAEnG,OAAO,EAAU,KAAK,aAAa,EAAkB,MAAM,eAAe,CAAA;AAE1E,OAAO,EAAE,KAAK,YAAY,EAAe,MAAM,sBAAsB,CAAA;AAKrE,0DAA0D;AAC1D,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,QAAQ,EAAE,SAAS,CAAC,GAAG;IACzD,iEAAiE;IACjE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC/B,wCAAwC;IACxC,gBAAgB,EAAE,MAAM,EAAE,CAAA;IAC1B,kCAAkC;IAClC,QAAQ,EAAE,MAAM,CAAA;IAChB,0BAA0B;IAC1B,MAAM,EAAE,MAAM,CAAA;IACd,+BAA+B;IAC/B,UAAU,EAAE,MAAM,CAAA;IAClB,0BAA0B;IAC1B,MAAM,EAAE,UAAU,CAAA;IAClB,uBAAuB;IACvB,IAAI,EAAE,MAAM,CAAA;CACb,GAAG,CACE;IACE,wBAAwB;IACxB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,iCAAiC;IACjC,IAAI,EAAE,MAAM,CAAA;CACb,GACD;IACE,qDAAqD;IACrD,MAAM,EAAE,2BAA2B,CAAC,UAAU,CAAC,CAAA;CAChD,CACJ,CAAA;AAKH;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,WAAW,GAAU,gDAK/B;IACD,YAAY,EAAE,OAAO,CAAA;IACrB,SAAS,EAAE,eAAe,CAAA;IAC1B,OAAO,EAAE,YAAY,EAAE,CAAA;IACvB,OAAO,EAAE,OAAO,CAAA;CACjB,KAAG,OAAO,CACT,aAAa,CAAC;IACZ,QAAQ,EAAE,gBAAgB,CAAA;IAC1B,OAAO,EAAE,OAAO,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"send-request.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/send-request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AAEnE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8DAA8D,CAAA;AAEnG,OAAO,EAAU,KAAK,aAAa,EAAkB,MAAM,eAAe,CAAA;AAE1E,OAAO,EAAE,KAAK,YAAY,EAAe,MAAM,sBAAsB,CAAA;AAKrE,0DAA0D;AAC1D,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,QAAQ,EAAE,SAAS,CAAC,GAAG;IACzD,iEAAiE;IACjE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC/B,wCAAwC;IACxC,gBAAgB,EAAE,MAAM,EAAE,CAAA;IAC1B,kCAAkC;IAClC,QAAQ,EAAE,MAAM,CAAA;IAChB,0BAA0B;IAC1B,MAAM,EAAE,MAAM,CAAA;IACd,+BAA+B;IAC/B,UAAU,EAAE,MAAM,CAAA;IAClB,0BAA0B;IAC1B,MAAM,EAAE,UAAU,CAAA;IAClB,uBAAuB;IACvB,IAAI,EAAE,MAAM,CAAA;CACb,GAAG,CACE;IACE,wBAAwB;IACxB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,iCAAiC;IACjC,IAAI,EAAE,MAAM,CAAA;CACb,GACD;IACE,qDAAqD;IACrD,MAAM,EAAE,2BAA2B,CAAC,UAAU,CAAC,CAAA;CAChD,CACJ,CAAA;AAKH;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,WAAW,GAAU,gDAK/B;IACD,YAAY,EAAE,OAAO,CAAA;IACrB,SAAS,EAAE,eAAe,CAAA;IAC1B,OAAO,EAAE,YAAY,EAAE,CAAA;IACvB,OAAO,EAAE,OAAO,CAAA;CACjB,KAAG,OAAO,CACT,aAAa,CAAC;IACZ,QAAQ,EAAE,gBAAgB,CAAA;IAC1B,OAAO,EAAE,OAAO,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;IACjB,gBAAgB,EAAE,QAAQ,CAAA;CAC3B,CAAC,CA0DH,CAAA"}
|
|
@@ -6,47 +6,47 @@ import { decodeBuffer as D } from "./decode-buffer.js";
|
|
|
6
6
|
import { getCookieHeaderKeys as T } from "./get-cookie-header-keys.js";
|
|
7
7
|
const E = [204, 205, 304], v = async ({
|
|
8
8
|
isUsingProxy: t,
|
|
9
|
-
operation:
|
|
10
|
-
request:
|
|
11
|
-
plugins:
|
|
9
|
+
operation: n,
|
|
10
|
+
request: p,
|
|
11
|
+
plugins: r
|
|
12
12
|
}) => {
|
|
13
13
|
try {
|
|
14
|
-
const { request: s } = await f({ request:
|
|
14
|
+
const { request: s } = await f({ request: p }, "beforeRequest", r), l = Date.now(), e = await fetch(s.clone()), a = Date.now(), c = a - l, d = e.headers.get("content-type"), o = x(e.headers, t), u = new URL(e.url), m = u.pathname + u.search, i = e.statusText || S[e.status]?.name || "", h = s.method, R = E.includes(e.status);
|
|
15
15
|
return d?.startsWith("text/event-stream") && e.body ? H({
|
|
16
16
|
response: e,
|
|
17
17
|
modifiedRequest: s,
|
|
18
|
-
operation:
|
|
19
|
-
plugins:
|
|
18
|
+
operation: n,
|
|
19
|
+
plugins: r,
|
|
20
20
|
endTime: a,
|
|
21
21
|
duration: c,
|
|
22
22
|
responseHeaders: o,
|
|
23
|
-
statusText:
|
|
24
|
-
method:
|
|
25
|
-
fullPath:
|
|
26
|
-
}) :
|
|
23
|
+
statusText: i,
|
|
24
|
+
method: h,
|
|
25
|
+
fullPath: m
|
|
26
|
+
}) : g({
|
|
27
27
|
response: e,
|
|
28
28
|
modifiedRequest: s,
|
|
29
|
-
operation:
|
|
30
|
-
plugins:
|
|
29
|
+
operation: n,
|
|
30
|
+
plugins: r,
|
|
31
31
|
endTime: a,
|
|
32
32
|
duration: c,
|
|
33
33
|
responseHeaders: o,
|
|
34
|
-
statusText:
|
|
35
|
-
method:
|
|
36
|
-
fullPath:
|
|
34
|
+
statusText: i,
|
|
35
|
+
method: h,
|
|
36
|
+
fullPath: m,
|
|
37
37
|
contentType: d,
|
|
38
|
-
shouldSkipBody:
|
|
38
|
+
shouldSkipBody: R
|
|
39
39
|
});
|
|
40
40
|
} catch (s) {
|
|
41
41
|
return [b(s, q.REQUEST_FAILED), null];
|
|
42
42
|
}
|
|
43
43
|
}, H = async ({
|
|
44
44
|
response: t,
|
|
45
|
-
modifiedRequest:
|
|
46
|
-
operation:
|
|
47
|
-
plugins:
|
|
45
|
+
modifiedRequest: n,
|
|
46
|
+
operation: p,
|
|
47
|
+
plugins: r,
|
|
48
48
|
endTime: s,
|
|
49
|
-
duration:
|
|
49
|
+
duration: l,
|
|
50
50
|
responseHeaders: e,
|
|
51
51
|
statusText: a,
|
|
52
52
|
method: c,
|
|
@@ -57,31 +57,32 @@ const E = [204, 205, 304], v = async ({
|
|
|
57
57
|
statusText: a,
|
|
58
58
|
headers: t.headers
|
|
59
59
|
});
|
|
60
|
-
await f({ response: o, request:
|
|
60
|
+
await f({ response: o, request: n, operation: p }, "responseReceived", r);
|
|
61
61
|
const u = T(o.headers);
|
|
62
62
|
return [
|
|
63
63
|
null,
|
|
64
64
|
{
|
|
65
65
|
timestamp: s,
|
|
66
|
-
request:
|
|
66
|
+
request: n,
|
|
67
67
|
response: {
|
|
68
68
|
...o,
|
|
69
69
|
headers: e,
|
|
70
70
|
cookieHeaderKeys: u,
|
|
71
71
|
reader: t.body.getReader(),
|
|
72
|
-
duration:
|
|
72
|
+
duration: l,
|
|
73
73
|
method: c,
|
|
74
74
|
path: d
|
|
75
|
-
}
|
|
75
|
+
},
|
|
76
|
+
originalResponse: o.clone()
|
|
76
77
|
}
|
|
77
78
|
];
|
|
78
|
-
},
|
|
79
|
+
}, g = async ({
|
|
79
80
|
response: t,
|
|
80
|
-
modifiedRequest:
|
|
81
|
-
operation:
|
|
82
|
-
plugins:
|
|
81
|
+
modifiedRequest: n,
|
|
82
|
+
operation: p,
|
|
83
|
+
plugins: r,
|
|
83
84
|
endTime: s,
|
|
84
|
-
duration:
|
|
85
|
+
duration: l,
|
|
85
86
|
responseHeaders: e,
|
|
86
87
|
statusText: a,
|
|
87
88
|
method: c,
|
|
@@ -89,29 +90,30 @@ const E = [204, 205, 304], v = async ({
|
|
|
89
90
|
contentType: o,
|
|
90
91
|
shouldSkipBody: u
|
|
91
92
|
}) => {
|
|
92
|
-
const
|
|
93
|
+
const i = await t.clone().arrayBuffer(), R = D(i, o ?? "text/plain;charset=UTF-8"), y = new Response(u ? null : i, {
|
|
93
94
|
status: t.status,
|
|
94
95
|
statusText: a,
|
|
95
96
|
headers: t.headers
|
|
96
97
|
});
|
|
97
|
-
await f({ response:
|
|
98
|
-
const w = T(
|
|
98
|
+
await f({ response: y, request: n, operation: p }, "responseReceived", r);
|
|
99
|
+
const w = T(y.headers);
|
|
99
100
|
return [
|
|
100
101
|
null,
|
|
101
102
|
{
|
|
102
103
|
timestamp: s,
|
|
103
|
-
request:
|
|
104
|
+
request: n,
|
|
104
105
|
response: {
|
|
105
|
-
...
|
|
106
|
+
...y,
|
|
106
107
|
headers: e,
|
|
107
108
|
cookieHeaderKeys: w,
|
|
108
|
-
data:
|
|
109
|
-
size:
|
|
110
|
-
duration:
|
|
109
|
+
data: R,
|
|
110
|
+
size: i.byteLength,
|
|
111
|
+
duration: l,
|
|
111
112
|
method: c,
|
|
112
113
|
status: t.status,
|
|
113
114
|
path: d
|
|
114
|
-
}
|
|
115
|
+
},
|
|
116
|
+
originalResponse: t.clone()
|
|
115
117
|
}
|
|
116
118
|
];
|
|
117
119
|
};
|
|
@@ -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.
|
|
4
|
+
const i = "2.20.0", m = "application/json", h = "*/*", c = (r, t, a) => ({
|
|
5
5
|
name: r,
|
|
6
6
|
defaultValue: t,
|
|
7
7
|
isOverridden: a.has(r.toLowerCase())
|
|
@@ -28,9 +28,15 @@ declare const _default: import("vue").DefineComponent<__VLS_Props, {
|
|
|
28
28
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
29
29
|
execute: () => any;
|
|
30
30
|
"update:servers": () => any;
|
|
31
|
+
"select:history:item": (payload: {
|
|
32
|
+
index: number;
|
|
33
|
+
}) => any;
|
|
31
34
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
32
35
|
onExecute?: (() => any) | undefined;
|
|
33
36
|
"onUpdate:servers"?: (() => any) | undefined;
|
|
37
|
+
"onSelect:history:item"?: ((payload: {
|
|
38
|
+
index: number;
|
|
39
|
+
}) => any) | undefined;
|
|
34
40
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
35
41
|
export default _default;
|
|
36
42
|
//# sourceMappingURL=AddressBar.vue.d.ts.map
|
|
@@ -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":"AAwbA,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;;;AAglBrD,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-80d05ddf"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
a as default
|
|
7
7
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as D, useId as F, computed as w, ref as S, useTemplateRef as U, onMounted as H, onBeforeUnmount as W, createElementBlock as R, openBlock as h, unref as l, createElementVNode as o, normalizeClass as O, createVNode as a, createCommentVNode as z, normalizeStyle as P, createBlock as K, withCtx as E, createTextVNode as x, toDisplayString as
|
|
1
|
+
import { defineComponent as D, useId as F, computed as w, ref as S, useTemplateRef as U, onMounted as H, onBeforeUnmount as W, createElementBlock as R, openBlock as h, unref as l, createElementVNode as o, normalizeClass as O, createVNode as a, createCommentVNode as z, normalizeStyle as P, createBlock as K, withCtx as E, createTextVNode as x, toDisplayString as c } from "vue";
|
|
2
2
|
import { ScalarButton as $, ScalarWrappingText as Q, ScalarIcon as j } from "@scalar/components";
|
|
3
3
|
import { REQUEST_METHODS as G } from "@scalar/helpers/http/http-info";
|
|
4
4
|
import { ScalarIconCopy as J, ScalarIconWarningCircle as X } from "@scalar/icons";
|
|
@@ -27,20 +27,20 @@ const le = ["id"], se = { class: "pointer-events-none absolute top-0 left-0 bloc
|
|
|
27
27
|
eventBus: {},
|
|
28
28
|
environment: {}
|
|
29
29
|
},
|
|
30
|
-
emits: ["execute", "update:servers"],
|
|
30
|
+
emits: ["execute", "update:servers", "select:history:item"],
|
|
31
31
|
setup(e, { expose: V, emit: q }) {
|
|
32
|
-
const
|
|
32
|
+
const d = q, f = F(), { percentage: b, startLoading: g, stopLoading: v } = _(), T = w(() => ({
|
|
33
33
|
backgroundColor: `color-mix(in srgb, transparent 90%, ${G[e.method].colorVar})`,
|
|
34
34
|
transform: `translate3d(-${b.value}%,0,0)`
|
|
35
35
|
})), i = S(null), r = S(null), y = w(() => r.value || i.value), B = (n, t, s) => {
|
|
36
|
-
const N =
|
|
36
|
+
const N = u.value?.cursorPosition();
|
|
37
37
|
e.eventBus.emit(
|
|
38
38
|
"operation:update:pathMethod",
|
|
39
39
|
{
|
|
40
40
|
meta: { method: e.method, path: e.path },
|
|
41
41
|
payload: { method: n, path: t },
|
|
42
|
-
callback: (
|
|
43
|
-
(
|
|
42
|
+
callback: (m) => {
|
|
43
|
+
(m === "success" || m === "no-change") && (r.value = null, i.value = null), m === "success" ? e.eventBus.emit("ui:focus:address-bar", { position: N }) : m === "conflict" && (n !== e.method && (r.value = n), t !== e.path && (i.value = t));
|
|
44
44
|
}
|
|
45
45
|
},
|
|
46
46
|
s
|
|
@@ -50,11 +50,11 @@ const le = ["id"], se = { class: "pointer-events-none absolute top-0 left-0 bloc
|
|
|
50
50
|
B(r.value ?? e.method, t, {
|
|
51
51
|
debounceKey: `operation:update:pathMethod-${e.path}-${e.method}`
|
|
52
52
|
});
|
|
53
|
-
}, C = U("sendButtonRef"),
|
|
54
|
-
if (
|
|
53
|
+
}, C = U("sendButtonRef"), u = U("addressBarRef"), p = () => C.value?.$el?.focus(), k = (n) => {
|
|
54
|
+
if (u.value?.isFocused && e.layout !== "desktop")
|
|
55
55
|
return;
|
|
56
56
|
const t = n && "position" in n ? n.position : "end";
|
|
57
|
-
|
|
57
|
+
u.value?.focus(t), n && "event" in n && n.event.preventDefault();
|
|
58
58
|
};
|
|
59
59
|
H(() => {
|
|
60
60
|
e.eventBus.on("ui:focus:address-bar", k), e.eventBus.on("ui:focus:send-button", p), e.eventBus.on("hooks:on:request:sent", g), e.eventBus.on("hooks:on:request:complete", v);
|
|
@@ -101,13 +101,13 @@ const le = ["id"], se = { class: "pointer-events-none absolute top-0 left-0 bloc
|
|
|
101
101
|
servers: e.servers,
|
|
102
102
|
target: l(f),
|
|
103
103
|
"onUpdate:selectedServer": t[0] || (t[0] = (s) => e.eventBus.emit("server:update:selected", s)),
|
|
104
|
-
"onUpdate:servers": t[1] || (t[1] = (s) =>
|
|
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
106
|
}, null, 8, ["layout", "server", "servers", "target"])) : z("", !0),
|
|
107
|
-
t[
|
|
107
|
+
t[7] || (t[7] = o("div", { class: "fade-left" }, null, -1)),
|
|
108
108
|
a(l(oe), {
|
|
109
109
|
ref_key: "addressBarRef",
|
|
110
|
-
ref:
|
|
110
|
+
ref: u,
|
|
111
111
|
alwaysEmitChange: "",
|
|
112
112
|
"aria-label": "Path",
|
|
113
113
|
class: "min-w-fit outline-none",
|
|
@@ -128,10 +128,10 @@ const le = ["id"], se = { class: "pointer-events-none absolute top-0 left-0 bloc
|
|
|
128
128
|
curl: s
|
|
129
129
|
}
|
|
130
130
|
})),
|
|
131
|
-
onSubmit: t[4] || (t[4] = (s) =>
|
|
131
|
+
onSubmit: t[4] || (t[4] = (s) => d("execute")),
|
|
132
132
|
"onUpdate:modelValue": L
|
|
133
133
|
}, null, 8, ["disabled", "environment", "layout", "modelValue", "placeholder"]),
|
|
134
|
-
t[
|
|
134
|
+
t[8] || (t[8] = o("div", { class: "fade-right" }, null, -1))
|
|
135
135
|
]),
|
|
136
136
|
a(l($), {
|
|
137
137
|
class: "hover:bg-b-3 mx-1",
|
|
@@ -141,25 +141,26 @@ const le = ["id"], se = { class: "pointer-events-none absolute top-0 left-0 bloc
|
|
|
141
141
|
}, {
|
|
142
142
|
default: E(() => [
|
|
143
143
|
a(l(J)),
|
|
144
|
-
t[
|
|
144
|
+
t[9] || (t[9] = o("span", { class: "sr-only" }, "Copy URL", -1))
|
|
145
145
|
]),
|
|
146
146
|
_: 1
|
|
147
147
|
}),
|
|
148
148
|
a(ee, {
|
|
149
149
|
history: e.history,
|
|
150
|
-
target: l(f)
|
|
150
|
+
target: l(f),
|
|
151
|
+
"onSelect:history:item": t[5] || (t[5] = (s) => d("select:history:item", s))
|
|
151
152
|
}, null, 8, ["history", "target"]),
|
|
152
153
|
y.value ? (h(), R("div", ie, [
|
|
153
154
|
o("div", de, [
|
|
154
155
|
a(l(X), { size: "sm" }),
|
|
155
156
|
o("div", ue, [
|
|
156
|
-
t[
|
|
157
|
-
o("em", null,
|
|
158
|
-
t[
|
|
157
|
+
t[10] || (t[10] = x(" A ", -1)),
|
|
158
|
+
o("em", null, c(r.value?.toUpperCase() ?? e.method.toUpperCase()), 1),
|
|
159
|
+
t[11] || (t[11] = x(" request to ", -1)),
|
|
159
160
|
a(l(Q), {
|
|
160
161
|
text: i.value ?? e.path
|
|
161
162
|
}, null, 8, ["text"]),
|
|
162
|
-
t[
|
|
163
|
+
t[12] || (t[12] = x(" already exists in this document ", -1))
|
|
163
164
|
])
|
|
164
165
|
])
|
|
165
166
|
])) : z("", !0),
|
|
@@ -168,7 +169,7 @@ const le = ["id"], se = { class: "pointer-events-none absolute top-0 left-0 bloc
|
|
|
168
169
|
ref: C,
|
|
169
170
|
class: "z-context-plus relative h-auto shrink-0 overflow-hidden py-1 pr-2.5 pl-2 font-bold",
|
|
170
171
|
disabled: l(b) < 100,
|
|
171
|
-
onClick: t[
|
|
172
|
+
onClick: t[6] || (t[6] = (s) => d("execute"))
|
|
172
173
|
}, {
|
|
173
174
|
default: E(() => [
|
|
174
175
|
o("span", me, [
|
|
@@ -177,9 +178,9 @@ const le = ["id"], se = { class: "pointer-events-none absolute top-0 left-0 bloc
|
|
|
177
178
|
icon: "Play",
|
|
178
179
|
size: "xs"
|
|
179
180
|
}),
|
|
180
|
-
t[
|
|
181
|
+
t[13] || (t[13] = o("span", { class: "text-xxs hidden lg:flex" }, "Send", -1))
|
|
181
182
|
]),
|
|
182
|
-
o("span", ce, " Send " +
|
|
183
|
+
o("span", ce, " Send " + c(e.method) + " request to " + c(e.server?.url ?? "") + c(e.path), 1)
|
|
183
184
|
]),
|
|
184
185
|
_: 1
|
|
185
186
|
}, 8, ["disabled"])
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { HttpMethod as HttpMethodType } from '@scalar/helpers/http/http-methods';
|
|
2
2
|
export type History = {
|
|
3
|
-
id: string;
|
|
4
3
|
method: HttpMethodType;
|
|
5
4
|
path: string;
|
|
6
5
|
duration: number;
|
|
@@ -13,11 +12,11 @@ type __VLS_Props = {
|
|
|
13
12
|
history: History[];
|
|
14
13
|
};
|
|
15
14
|
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
16
|
-
|
|
15
|
+
"select:history:item": (payload: {
|
|
17
16
|
index: number;
|
|
18
17
|
}) => any;
|
|
19
18
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
20
|
-
|
|
19
|
+
"onSelect:history:item"?: ((payload: {
|
|
21
20
|
index: number;
|
|
22
21
|
}) => any) | undefined;
|
|
23
22
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AddressBarHistory.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AddressBarHistory.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue"],"names":[],"mappings":"AA2GA,OAAO,KAAK,EAAE,UAAU,IAAI,cAAc,EAAE,MAAM,mCAAmC,CAAA;AAQrF,MAAM,MAAM,OAAO,GAAG;IACpB,MAAM,EAAE,cAAc,CAAA;IACtB,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AAED,KAAK,WAAW,GAAG;IACjB,qEAAqE;IACrE,MAAM,EAAE,MAAM,CAAA;IACd,wCAAwC;IACxC,OAAO,EAAE,OAAO,EAAE,CAAA;CACnB,CAAC;;;eAK6C,MAAM;;;;eAAN,MAAM;;;AAyOrD,wBAOG"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./AddressBarHistory.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import r from "../../../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const
|
|
4
|
+
const d = /* @__PURE__ */ r(o, [["__scopeId", "data-v-b45f1e9d"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
d as default
|
|
7
7
|
};
|