@scalar/api-client 2.41.0 → 2.43.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 +22 -0
- package/dist/hooks/useClientConfig.d.ts +3 -3
- package/dist/libs/normalize-headers.d.ts.map +1 -1
- package/dist/libs/normalize-headers.js +1 -0
- package/dist/libs/normalize-headers.js.map +1 -1
- package/dist/style.css +124 -36
- package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts +2 -0
- package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/OperationBlock.vue.js.map +1 -1
- package/dist/v2/blocks/operation-block/OperationBlock.vue.script.js +24 -10
- package/dist/v2/blocks/operation-block/OperationBlock.vue.script.js.map +1 -1
- package/dist/v2/blocks/operation-block/helpers/send-request.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/helpers/send-request.js +23 -2
- package/dist/v2/blocks/operation-block/helpers/send-request.js.map +1 -1
- 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 +18 -7
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-parameters.js.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseCookies.vue.d.ts.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseCookies.vue.js.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseCookies.vue.script.js +32 -9
- package/dist/v2/blocks/response-block/components/ResponseCookies.vue.script.js.map +1 -1
- 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 +1 -1
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.js.map +1 -1
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.script.js +8 -1
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.script.js.map +1 -1
- package/dist/v2/components/sidebar/Sidebar.vue.d.ts.map +1 -1
- package/dist/v2/components/sidebar/Sidebar.vue.js.map +1 -1
- package/dist/v2/components/sidebar/Sidebar.vue.script.js +9 -4
- package/dist/v2/components/sidebar/Sidebar.vue.script.js.map +1 -1
- package/dist/v2/constants.js +1 -1
- package/dist/v2/features/app/app-events.d.ts.map +1 -1
- package/dist/v2/features/app/app-events.js +8 -0
- package/dist/v2/features/app/app-events.js.map +1 -1
- 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.vue.js.map +1 -1
- package/dist/v2/features/app/components/AppSidebar.vue.script.js +19 -10
- package/dist/v2/features/app/components/AppSidebar.vue.script.js.map +1 -1
- package/dist/v2/features/app/components/SidebarItemMenu.vue.d.ts +3 -0
- package/dist/v2/features/app/components/SidebarItemMenu.vue.d.ts.map +1 -1
- package/dist/v2/features/app/components/SidebarItemMenu.vue.js.map +1 -1
- package/dist/v2/features/app/components/SidebarItemMenu.vue.script.js +30 -30
- package/dist/v2/features/app/components/SidebarItemMenu.vue.script.js.map +1 -1
- package/dist/v2/features/app/helpers/create-temp-operation.d.ts +14 -0
- package/dist/v2/features/app/helpers/create-temp-operation.d.ts.map +1 -0
- package/dist/v2/features/app/helpers/create-temp-operation.js +52 -0
- package/dist/v2/features/app/helpers/create-temp-operation.js.map +1 -0
- package/dist/v2/features/app/helpers/routes.d.ts +5 -0
- package/dist/v2/features/app/helpers/routes.d.ts.map +1 -1
- package/dist/v2/features/app/helpers/routes.js +5 -0
- package/dist/v2/features/app/helpers/routes.js.map +1 -1
- package/dist/v2/features/collection/components/DocumentScriptsEditors.vue.d.ts +12 -0
- package/dist/v2/features/collection/components/DocumentScriptsEditors.vue.d.ts.map +1 -0
- package/dist/v2/features/collection/components/DocumentScriptsEditors.vue.js +9 -0
- package/dist/v2/features/collection/components/DocumentScriptsEditors.vue.js.map +1 -0
- package/dist/v2/features/collection/components/DocumentScriptsEditors.vue.script.js +174 -0
- package/dist/v2/features/collection/components/DocumentScriptsEditors.vue.script.js.map +1 -0
- package/dist/v2/features/collection/components/Scripts.vue.d.ts +16 -0
- package/dist/v2/features/collection/components/Scripts.vue.d.ts.map +1 -0
- package/dist/v2/features/collection/components/Scripts.vue.js +7 -0
- package/dist/v2/features/collection/components/Scripts.vue.js.map +1 -0
- package/dist/v2/features/collection/components/Scripts.vue.script.js +47 -0
- package/dist/v2/features/collection/components/Scripts.vue.script.js.map +1 -0
- package/dist/v2/features/collection/components/Tabs.vue.d.ts.map +1 -1
- package/dist/v2/features/collection/components/Tabs.vue.js.map +1 -1
- package/dist/v2/features/collection/components/Tabs.vue.script.js +2 -1
- package/dist/v2/features/collection/components/Tabs.vue.script.js.map +1 -1
- 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/operation/Operation.vue.d.ts.map +1 -1
- package/dist/v2/features/operation/Operation.vue.js.map +1 -1
- package/dist/v2/features/operation/Operation.vue.script.js +3 -1
- package/dist/v2/features/operation/Operation.vue.script.js.map +1 -1
- package/dist/v2/workspace-events.d.ts.map +1 -1
- package/dist/v2/workspace-events.js +1 -0
- package/dist/v2/workspace-events.js.map +1 -1
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue.script.js +1 -1
- package/package.json +13 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @scalar/api-client
|
|
2
2
|
|
|
3
|
+
## 2.43.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#8761](https://github.com/scalar/scalar/pull/8761): feat: improve UX for creating a new operation
|
|
8
|
+
- [#8773](https://github.com/scalar/scalar/pull/8773): feat: suport for set-cookie header
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- [#8778](https://github.com/scalar/scalar/pull/8778): fix: hide examples on modal and always show the http badge on modal
|
|
13
|
+
|
|
14
|
+
## 2.42.0
|
|
15
|
+
|
|
16
|
+
### Minor Changes
|
|
17
|
+
|
|
18
|
+
- [#8748](https://github.com/scalar/scalar/pull/8748): feat: support `allowReserved` for code samples
|
|
19
|
+
- [#8695](https://github.com/scalar/scalar/pull/8695): feat: suport pre/post request scripts
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- [#8760](https://github.com/scalar/scalar/pull/8760): feat: exported routePayload type
|
|
24
|
+
|
|
3
25
|
## 2.41.0
|
|
4
26
|
|
|
5
27
|
### Minor Changes
|
|
@@ -41,7 +41,7 @@ export declare const useClientConfig: () => Ref<{
|
|
|
41
41
|
}, import("zod/v4/core").$strip>>;
|
|
42
42
|
hooks: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
43
43
|
onBeforeRequest: import("zod").ZodOptional<import("zod").ZodFunction<import("zod").ZodTuple<readonly [import("zod").ZodObject<{
|
|
44
|
-
request: import("zod").
|
|
44
|
+
request: import("zod").ZodAny;
|
|
45
45
|
}, import("zod/v4/core").$strip>], null>, import("zod/v4/core").$ZodFunctionOut>>;
|
|
46
46
|
onResponseReceived: import("zod").ZodOptional<import("zod").ZodFunction<import("zod").ZodTuple<readonly [import("zod").ZodObject<{
|
|
47
47
|
response: import("zod").ZodCustom<Response, Response>;
|
|
@@ -102,7 +102,7 @@ export declare const useClientConfig: () => Ref<{
|
|
|
102
102
|
}, import("zod/v4/core").$strip>>;
|
|
103
103
|
hooks: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
104
104
|
onBeforeRequest: import("zod").ZodOptional<import("zod").ZodFunction<import("zod").ZodTuple<readonly [import("zod").ZodObject<{
|
|
105
|
-
request: import("zod").
|
|
105
|
+
request: import("zod").ZodAny;
|
|
106
106
|
}, import("zod/v4/core").$strip>], null>, import("zod/v4/core").$ZodFunctionOut>>;
|
|
107
107
|
onResponseReceived: import("zod").ZodOptional<import("zod").ZodFunction<import("zod").ZodTuple<readonly [import("zod").ZodObject<{
|
|
108
108
|
response: import("zod").ZodCustom<Response, Response>;
|
|
@@ -163,7 +163,7 @@ export declare const useClientConfig: () => Ref<{
|
|
|
163
163
|
}, import("zod/v4/core").$strip>>;
|
|
164
164
|
hooks: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
165
165
|
onBeforeRequest: import("zod").ZodOptional<import("zod").ZodFunction<import("zod").ZodTuple<readonly [import("zod").ZodObject<{
|
|
166
|
-
request: import("zod").
|
|
166
|
+
request: import("zod").ZodAny;
|
|
167
167
|
}, import("zod/v4/core").$strip>], null>, import("zod/v4/core").$ZodFunctionOut>>;
|
|
168
168
|
onResponseReceived: import("zod").ZodOptional<import("zod").ZodFunction<import("zod").ZodTuple<readonly [import("zod").ZodObject<{
|
|
169
169
|
response: import("zod").ZodCustom<Response, Response>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize-headers.d.ts","sourceRoot":"","sources":["../../src/libs/normalize-headers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,eAAO,MAAM,gBAAgB,GAAI,UAAU,OAAO,EAAE,4BAA0B,KAAG,MAAM,CAAC,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"normalize-headers.d.ts","sourceRoot":"","sources":["../../src/libs/normalize-headers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,eAAO,MAAM,gBAAgB,GAAI,UAAU,OAAO,EAAE,4BAA0B,KAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAoErG,CAAA;AAED,mEAAmE;AACnE,eAAO,MAAM,eAAe,GAAI,KAAK,MAAM,WAM7B,CAAA"}
|
|
@@ -18,6 +18,7 @@ var normalizeHeaders = (_headers, removeProxyHeaders = false) => {
|
|
|
18
18
|
"Access-Control-Allow-Origin",
|
|
19
19
|
"Access-Control-Expose-Headers"
|
|
20
20
|
].map((header) => header.toLowerCase()).forEach((header) => delete headers[header]);
|
|
21
|
+
delete headers["x-scalar-set-cookie"];
|
|
21
22
|
/** Exact key of the modified headers header */
|
|
22
23
|
const modifiedHeaderKey = Object.keys(headers).find((key) => key.toLowerCase() === "x-scalar-modified-headers");
|
|
23
24
|
/** List of modified headers */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize-headers.js","names":[],"sources":["../../src/libs/normalize-headers.ts"],"sourcesContent":["/**\n * Normalize headers:\n *\n * - Electron modifies the headers to allow CORS, this function hides the modifications\n * - Restores original headers\n * - Normalizes the header keys\n * - Sorts headers alphabetically\n * - converts to an object\n *\n */\nexport const normalizeHeaders = (_headers: Headers, removeProxyHeaders = false): Record<string, string> => {\n // Convert headers to an object\n const headers = Object.fromEntries(_headers)\n\n // Remove headers, that are added by the proxy\n if (removeProxyHeaders) {\n const headersToRemove = [\n 'Access-Control-Allow-Credentials',\n 'Access-Control-Allow-Headers',\n 'Access-Control-Allow-Methods',\n 'Access-Control-Allow-Origin',\n 'Access-Control-Expose-Headers',\n ]\n\n headersToRemove.map((header) => header.toLowerCase()).forEach((header) => delete headers[header])\n }\n\n /** Exact key of the modified headers header */\n const modifiedHeaderKey = Object.keys(headers).find((key) => key.toLowerCase() === 'x-scalar-modified-headers')\n\n /** List of modified headers */\n const modifiedHeaders = modifiedHeaderKey\n ? (headers[modifiedHeaderKey]\n ?.toString()\n .split(', ')\n ?.map((value: string) => value.toLowerCase()) ?? [])\n : []\n\n // Remove headers listed in `X-Scalar-Modified-Headers`\n Object.keys(headers).forEach((key) => {\n if (modifiedHeaders.includes(key.toLowerCase())) {\n delete headers[key]\n }\n })\n\n // Remove `X-Scalar-Modified-Headers` header\n if (modifiedHeaderKey) {\n delete headers[modifiedHeaderKey]\n }\n\n // Restore original headers (remove the `X-Scalar-Original-` prefix)\n Object.keys(headers).forEach((key) => {\n // Case-insensitive regular expression\n const ORIGINAL_KEY_REGEX = /^x-scalar-original-/i\n\n if (ORIGINAL_KEY_REGEX.test(key)) {\n const originalKey = key.replace(ORIGINAL_KEY_REGEX, '')\n if (headers[key]) {\n headers[originalKey] = headers[key]\n delete headers[key]\n }\n }\n })\n\n // Normalizes the header keys\n Object.keys(headers).forEach((key) => {\n const formattedKey = formatHeaderKey(key)\n if (key !== formattedKey && headers[key]) {\n headers[formattedKey] = headers[key]\n delete headers[key]\n }\n })\n\n // Sort headers alphebetically by key\n return Object.fromEntries(Object.entries(headers).sort(([a], [b]) => a.localeCompare(b)))\n}\n\n/** Make the first letter and all letters after a dash uppercase */\nexport const formatHeaderKey = (key: string) =>\n key\n .split('-')\n .map((word) => {\n return word.charAt(0).toUpperCase() + word.toLowerCase().slice(1)\n })\n .join('-')\n"],"mappings":";;;;;;;;;;;AAUA,IAAa,oBAAoB,UAAmB,qBAAqB,UAAkC;CAEzG,MAAM,UAAU,OAAO,YAAY,SAAS;AAG5C,KAAI,mBACsB;EACtB;EACA;EACA;EACA;EACA;EACD,CAEe,KAAK,WAAW,OAAO,aAAa,CAAC,CAAC,SAAS,WAAW,OAAO,QAAQ,QAAQ;;
|
|
1
|
+
{"version":3,"file":"normalize-headers.js","names":[],"sources":["../../src/libs/normalize-headers.ts"],"sourcesContent":["/**\n * Normalize headers:\n *\n * - Electron modifies the headers to allow CORS, this function hides the modifications\n * - Restores original headers\n * - Normalizes the header keys\n * - Sorts headers alphabetically\n * - converts to an object\n *\n */\nexport const normalizeHeaders = (_headers: Headers, removeProxyHeaders = false): Record<string, string> => {\n // Convert headers to an object\n const headers = Object.fromEntries(_headers)\n\n // Remove headers, that are added by the proxy\n if (removeProxyHeaders) {\n const headersToRemove = [\n 'Access-Control-Allow-Credentials',\n 'Access-Control-Allow-Headers',\n 'Access-Control-Allow-Methods',\n 'Access-Control-Allow-Origin',\n 'Access-Control-Expose-Headers',\n ]\n\n headersToRemove.map((header) => header.toLowerCase()).forEach((header) => delete headers[header])\n }\n\n // Remove the custom set-cookie header, we will handle this separately\n delete headers['x-scalar-set-cookie']\n\n /** Exact key of the modified headers header */\n const modifiedHeaderKey = Object.keys(headers).find((key) => key.toLowerCase() === 'x-scalar-modified-headers')\n\n /** List of modified headers */\n const modifiedHeaders = modifiedHeaderKey\n ? (headers[modifiedHeaderKey]\n ?.toString()\n .split(', ')\n ?.map((value: string) => value.toLowerCase()) ?? [])\n : []\n\n // Remove headers listed in `X-Scalar-Modified-Headers`\n Object.keys(headers).forEach((key) => {\n if (modifiedHeaders.includes(key.toLowerCase())) {\n delete headers[key]\n }\n })\n\n // Remove `X-Scalar-Modified-Headers` header\n if (modifiedHeaderKey) {\n delete headers[modifiedHeaderKey]\n }\n\n // Restore original headers (remove the `X-Scalar-Original-` prefix)\n Object.keys(headers).forEach((key) => {\n // Case-insensitive regular expression\n const ORIGINAL_KEY_REGEX = /^x-scalar-original-/i\n\n if (ORIGINAL_KEY_REGEX.test(key)) {\n const originalKey = key.replace(ORIGINAL_KEY_REGEX, '')\n if (headers[key]) {\n headers[originalKey] = headers[key]\n delete headers[key]\n }\n }\n })\n\n // Normalizes the header keys\n Object.keys(headers).forEach((key) => {\n const formattedKey = formatHeaderKey(key)\n if (key !== formattedKey && headers[key]) {\n headers[formattedKey] = headers[key]\n delete headers[key]\n }\n })\n\n // Sort headers alphebetically by key\n return Object.fromEntries(Object.entries(headers).sort(([a], [b]) => a.localeCompare(b)))\n}\n\n/** Make the first letter and all letters after a dash uppercase */\nexport const formatHeaderKey = (key: string) =>\n key\n .split('-')\n .map((word) => {\n return word.charAt(0).toUpperCase() + word.toLowerCase().slice(1)\n })\n .join('-')\n"],"mappings":";;;;;;;;;;;AAUA,IAAa,oBAAoB,UAAmB,qBAAqB,UAAkC;CAEzG,MAAM,UAAU,OAAO,YAAY,SAAS;AAG5C,KAAI,mBACsB;EACtB;EACA;EACA;EACA;EACA;EACD,CAEe,KAAK,WAAW,OAAO,aAAa,CAAC,CAAC,SAAS,WAAW,OAAO,QAAQ,QAAQ;AAInG,QAAO,QAAQ;;CAGf,MAAM,oBAAoB,OAAO,KAAK,QAAQ,CAAC,MAAM,QAAQ,IAAI,aAAa,KAAK,4BAA4B;;CAG/G,MAAM,kBAAkB,oBACnB,QAAQ,oBACL,UAAU,CACX,MAAM,KAAK,EACV,KAAK,UAAkB,MAAM,aAAa,CAAC,IAAI,EAAE,GACrD,EAAE;AAGN,QAAO,KAAK,QAAQ,CAAC,SAAS,QAAQ;AACpC,MAAI,gBAAgB,SAAS,IAAI,aAAa,CAAC,CAC7C,QAAO,QAAQ;GAEjB;AAGF,KAAI,kBACF,QAAO,QAAQ;AAIjB,QAAO,KAAK,QAAQ,CAAC,SAAS,QAAQ;EAEpC,MAAM,qBAAqB;AAE3B,MAAI,mBAAmB,KAAK,IAAI,EAAE;GAChC,MAAM,cAAc,IAAI,QAAQ,oBAAoB,GAAG;AACvD,OAAI,QAAQ,MAAM;AAChB,YAAQ,eAAe,QAAQ;AAC/B,WAAO,QAAQ;;;GAGnB;AAGF,QAAO,KAAK,QAAQ,CAAC,SAAS,QAAQ;EACpC,MAAM,eAAe,gBAAgB,IAAI;AACzC,MAAI,QAAQ,gBAAgB,QAAQ,MAAM;AACxC,WAAQ,gBAAgB,QAAQ;AAChC,UAAO,QAAQ;;GAEjB;AAGF,QAAO,OAAO,YAAY,OAAO,QAAQ,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,EAAE,CAAC,CAAC;;;AAI3F,IAAa,mBAAmB,QAC9B,IACG,MAAM,IAAI,CACV,KAAK,SAAS;AACb,QAAO,KAAK,OAAO,EAAE,CAAC,aAAa,GAAG,KAAK,aAAa,CAAC,MAAM,EAAE;EACjE,CACD,KAAK,IAAI"}
|
package/dist/style.css
CHANGED
|
@@ -1027,6 +1027,7 @@ input[data-v-c1a50a6e]::placeholder {
|
|
|
1027
1027
|
--scalar-text-decoration-hover: underline;
|
|
1028
1028
|
--scalar-link-font-weight: inherit;
|
|
1029
1029
|
--scalar-sidebar-indent: 20px;
|
|
1030
|
+
--scalar-sidebar-padding: 12px;
|
|
1030
1031
|
}
|
|
1031
1032
|
|
|
1032
1033
|
.dark-mode {
|
|
@@ -1474,6 +1475,16 @@ input[data-v-c1a50a6e]::placeholder {
|
|
|
1474
1475
|
}
|
|
1475
1476
|
}
|
|
1476
1477
|
|
|
1478
|
+
@keyframes border-bottom {
|
|
1479
|
+
from {
|
|
1480
|
+
border-bottom-width: 0;
|
|
1481
|
+
}
|
|
1482
|
+
|
|
1483
|
+
to {
|
|
1484
|
+
border-bottom-width: var(--scalar-border-width);
|
|
1485
|
+
}
|
|
1486
|
+
}
|
|
1487
|
+
|
|
1477
1488
|
@property --tw-font-weight {
|
|
1478
1489
|
syntax: "*";
|
|
1479
1490
|
inherits: false
|
|
@@ -3269,6 +3280,12 @@ input[data-v-c1a50a6e]::placeholder {
|
|
|
3269
3280
|
display: flex;
|
|
3270
3281
|
}
|
|
3271
3282
|
|
|
3283
|
+
.animate-sidebar-border-bottom {
|
|
3284
|
+
animation: forwards border-bottom;
|
|
3285
|
+
animation-timeline: scroll();
|
|
3286
|
+
animation-range-end: 1px;
|
|
3287
|
+
}
|
|
3288
|
+
|
|
3272
3289
|
.group\/sidebar-section:first-of-type > .group\/spacer-before, .group\/sidebar-section:last-of-type > .group\/spacer-after {
|
|
3273
3290
|
height: 0;
|
|
3274
3291
|
}
|
|
@@ -3524,6 +3541,10 @@ input[data-v-c1a50a6e]::placeholder {
|
|
|
3524
3541
|
top: var(--nested-items-offset) !important;
|
|
3525
3542
|
}
|
|
3526
3543
|
|
|
3544
|
+
.scalar-app .top-\(--scalar-sidebar-sticky-offset\,0\) {
|
|
3545
|
+
top: var(--scalar-sidebar-sticky-offset, 0);
|
|
3546
|
+
}
|
|
3547
|
+
|
|
3527
3548
|
.scalar-app .top-0\.5 {
|
|
3528
3549
|
top: 2px;
|
|
3529
3550
|
}
|
|
@@ -3636,6 +3657,10 @@ input[data-v-c1a50a6e]::placeholder {
|
|
|
3636
3657
|
}
|
|
3637
3658
|
}
|
|
3638
3659
|
|
|
3660
|
+
.scalar-app .-m-\(--scalar-sidebar-padding\) {
|
|
3661
|
+
margin: calc(var(--scalar-sidebar-padding) * -1);
|
|
3662
|
+
}
|
|
3663
|
+
|
|
3639
3664
|
.scalar-app .-m-1 {
|
|
3640
3665
|
margin: -4px;
|
|
3641
3666
|
}
|
|
@@ -3803,6 +3828,10 @@ input[data-v-c1a50a6e]::placeholder {
|
|
|
3803
3828
|
min-height: 48px;
|
|
3804
3829
|
}
|
|
3805
3830
|
|
|
3831
|
+
.scalar-app .w-\(--scalar-sidebar-width\) {
|
|
3832
|
+
width: var(--scalar-sidebar-width);
|
|
3833
|
+
}
|
|
3834
|
+
|
|
3806
3835
|
.scalar-app .w-12 {
|
|
3807
3836
|
width: 48px;
|
|
3808
3837
|
}
|
|
@@ -4043,6 +4072,10 @@ input[data-v-c1a50a6e]::placeholder {
|
|
|
4043
4072
|
border-color: var(--scalar-sidebar-search-border-color, var(--scalar-border-color));
|
|
4044
4073
|
}
|
|
4045
4074
|
|
|
4075
|
+
.scalar-app .border-b-sidebar-border {
|
|
4076
|
+
border-bottom-color: var(--scalar-sidebar-border-color, var(--scalar-border-color));
|
|
4077
|
+
}
|
|
4078
|
+
|
|
4046
4079
|
.scalar-app .bg-\(--bg-light\) {
|
|
4047
4080
|
background-color: var(--bg-light);
|
|
4048
4081
|
}
|
|
@@ -4176,6 +4209,10 @@ input[data-v-c1a50a6e]::placeholder {
|
|
|
4176
4209
|
mask-repeat: repeat;
|
|
4177
4210
|
}
|
|
4178
4211
|
|
|
4212
|
+
.scalar-app .p-\(--scalar-sidebar-padding\) {
|
|
4213
|
+
padding: var(--scalar-sidebar-padding);
|
|
4214
|
+
}
|
|
4215
|
+
|
|
4179
4216
|
.scalar-app .p-0\.25 {
|
|
4180
4217
|
padding: 1px;
|
|
4181
4218
|
}
|
|
@@ -4437,12 +4474,12 @@ input[data-v-c1a50a6e]::placeholder {
|
|
|
4437
4474
|
font-family: inherit;
|
|
4438
4475
|
}
|
|
4439
4476
|
|
|
4440
|
-
.scalar-app .first\:rounded-t-\[inherit\]:first-child
|
|
4477
|
+
.scalar-app .first\:rounded-t-\[inherit\]:first-child {
|
|
4441
4478
|
border-top-left-radius: inherit;
|
|
4442
4479
|
border-top-right-radius: inherit;
|
|
4443
4480
|
}
|
|
4444
4481
|
|
|
4445
|
-
.scalar-app .last\:rounded-b-\[inherit\]:last-child
|
|
4482
|
+
.scalar-app .last\:rounded-b-\[inherit\]:last-child {
|
|
4446
4483
|
border-bottom-right-radius: inherit;
|
|
4447
4484
|
border-bottom-left-radius: inherit;
|
|
4448
4485
|
}
|
|
@@ -4638,6 +4675,10 @@ input[data-v-c1a50a6e]::placeholder {
|
|
|
4638
4675
|
initial-value: "";
|
|
4639
4676
|
}
|
|
4640
4677
|
|
|
4678
|
+
:where(.scalar-app) [class*="rotate-"], :where(.scalar-app) [class*="translate-"], :where(.scalar-app) [class*="scale-"] {
|
|
4679
|
+
transform: none;
|
|
4680
|
+
}
|
|
4681
|
+
|
|
4641
4682
|
.scalar-app .pointer-events-auto {
|
|
4642
4683
|
pointer-events: auto;
|
|
4643
4684
|
}
|
|
@@ -5532,6 +5573,10 @@ input[data-v-c1a50a6e]::placeholder {
|
|
|
5532
5573
|
min-height: 80px;
|
|
5533
5574
|
}
|
|
5534
5575
|
|
|
5576
|
+
.scalar-app .min-h-\[4rem\] {
|
|
5577
|
+
min-height: 4rem;
|
|
5578
|
+
}
|
|
5579
|
+
|
|
5535
5580
|
.scalar-app .min-h-\[64px\] {
|
|
5536
5581
|
min-height: 64px;
|
|
5537
5582
|
}
|
|
@@ -5540,6 +5585,10 @@ input[data-v-c1a50a6e]::placeholder {
|
|
|
5540
5585
|
min-height: 65px;
|
|
5541
5586
|
}
|
|
5542
5587
|
|
|
5588
|
+
.scalar-app .min-h-\[300px\] {
|
|
5589
|
+
min-height: 300px;
|
|
5590
|
+
}
|
|
5591
|
+
|
|
5543
5592
|
.scalar-app .min-h-\[calc\(1rem\*4\)\] {
|
|
5544
5593
|
min-height: 4rem;
|
|
5545
5594
|
}
|
|
@@ -5572,6 +5621,10 @@ input[data-v-c1a50a6e]::placeholder {
|
|
|
5572
5621
|
width: 50%;
|
|
5573
5622
|
}
|
|
5574
5623
|
|
|
5624
|
+
.scalar-app .w-2 {
|
|
5625
|
+
width: 8px;
|
|
5626
|
+
}
|
|
5627
|
+
|
|
5575
5628
|
.scalar-app .w-2\.5 {
|
|
5576
5629
|
width: 10px;
|
|
5577
5630
|
}
|
|
@@ -6336,7 +6389,7 @@ input[data-v-c1a50a6e]::placeholder {
|
|
|
6336
6389
|
border-color: var(--scalar-color-alert);
|
|
6337
6390
|
}
|
|
6338
6391
|
|
|
6339
|
-
.scalar-app .border-border {
|
|
6392
|
+
.scalar-app .border-\[var\(--scalar-border-color\)\], .scalar-app .border-border {
|
|
6340
6393
|
border-color: var(--scalar-border-color);
|
|
6341
6394
|
}
|
|
6342
6395
|
|
|
@@ -6384,6 +6437,22 @@ input[data-v-c1a50a6e]::placeholder {
|
|
|
6384
6437
|
background-color: var(--scalar-background-alert);
|
|
6385
6438
|
}
|
|
6386
6439
|
|
|
6440
|
+
.scalar-app .bg-\[var\(--scalar-background-1\)\] {
|
|
6441
|
+
background-color: var(--scalar-background-1);
|
|
6442
|
+
}
|
|
6443
|
+
|
|
6444
|
+
.scalar-app .bg-\[var\(--scalar-background-2\)\] {
|
|
6445
|
+
background-color: var(--scalar-background-2);
|
|
6446
|
+
}
|
|
6447
|
+
|
|
6448
|
+
.scalar-app .bg-\[var\(--scalar-background-3\)\] {
|
|
6449
|
+
background-color: var(--scalar-background-3);
|
|
6450
|
+
}
|
|
6451
|
+
|
|
6452
|
+
.scalar-app .bg-\[var\(--scalar-color-green\)\] {
|
|
6453
|
+
background-color: var(--scalar-color-green);
|
|
6454
|
+
}
|
|
6455
|
+
|
|
6387
6456
|
.scalar-app .bg-b-1 {
|
|
6388
6457
|
background-color: var(--scalar-background-1);
|
|
6389
6458
|
}
|
|
@@ -7247,6 +7316,11 @@ input[data-v-c1a50a6e]::placeholder {
|
|
|
7247
7316
|
box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
|
|
7248
7317
|
}
|
|
7249
7318
|
|
|
7319
|
+
.scalar-app .shadow-\[var\(--scalar-shadow-1\)\] {
|
|
7320
|
+
--tw-shadow: var(--scalar-shadow-1);
|
|
7321
|
+
box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
|
|
7322
|
+
}
|
|
7323
|
+
|
|
7250
7324
|
.scalar-app .shadow-border {
|
|
7251
7325
|
--tw-shadow: inset 0 0 0 var(--tw-shadow-color, var(--scalar-border-width)) var(--scalar-border-color);
|
|
7252
7326
|
box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
|
|
@@ -7323,6 +7397,12 @@ input[data-v-c1a50a6e]::placeholder {
|
|
|
7323
7397
|
transition-duration: var(--tw-duration, var(--default-transition-duration));
|
|
7324
7398
|
}
|
|
7325
7399
|
|
|
7400
|
+
.scalar-app .transition-all {
|
|
7401
|
+
transition-property: all;
|
|
7402
|
+
transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
|
|
7403
|
+
transition-duration: var(--tw-duration, var(--default-transition-duration));
|
|
7404
|
+
}
|
|
7405
|
+
|
|
7326
7406
|
.scalar-app .transition-colors {
|
|
7327
7407
|
transition-property: color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to;
|
|
7328
7408
|
transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
|
|
@@ -7790,6 +7870,10 @@ input[data-v-c1a50a6e]::placeholder {
|
|
|
7790
7870
|
border-color: inherit;
|
|
7791
7871
|
}
|
|
7792
7872
|
|
|
7873
|
+
.scalar-app .hover\:bg-\[var\(--scalar-background-3\)\]:hover {
|
|
7874
|
+
background-color: var(--scalar-background-3);
|
|
7875
|
+
}
|
|
7876
|
+
|
|
7793
7877
|
.scalar-app .hover\:bg-b-2:hover, .scalar-app .hover\:bg-b-2\/40:hover {
|
|
7794
7878
|
background-color: var(--scalar-background-2);
|
|
7795
7879
|
}
|
|
@@ -8731,51 +8815,51 @@ input[data-v-c1a50a6e]::placeholder {
|
|
|
8731
8815
|
margin-top: 0;
|
|
8732
8816
|
}
|
|
8733
8817
|
|
|
8734
|
-
[data-v-
|
|
8818
|
+
[data-v-0ec7147f] .cm-editor {
|
|
8735
8819
|
height: 100%;
|
|
8736
8820
|
outline: none;
|
|
8737
8821
|
width: 100%;
|
|
8738
8822
|
}
|
|
8739
|
-
[data-v-
|
|
8823
|
+
[data-v-0ec7147f] .cm-line {
|
|
8740
8824
|
padding: 0;
|
|
8741
8825
|
}
|
|
8742
|
-
[data-v-
|
|
8826
|
+
[data-v-0ec7147f] .cm-content {
|
|
8743
8827
|
padding: 0;
|
|
8744
8828
|
display: flex;
|
|
8745
8829
|
align-items: center;
|
|
8746
8830
|
font-size: var(--scalar-small);
|
|
8747
8831
|
}
|
|
8748
|
-
.scroll-timeline-x[data-v-
|
|
8832
|
+
.scroll-timeline-x[data-v-0ec7147f] {
|
|
8749
8833
|
scroll-timeline: --scroll-timeline x;
|
|
8750
8834
|
/* Firefox supports */
|
|
8751
8835
|
scroll-timeline: --scroll-timeline horizontal;
|
|
8752
8836
|
-ms-overflow-style: none; /* IE and Edge */
|
|
8753
8837
|
}
|
|
8754
|
-
.scroll-timeline-x-hidden[data-v-
|
|
8838
|
+
.scroll-timeline-x-hidden[data-v-0ec7147f] {
|
|
8755
8839
|
overflow-x: auto;
|
|
8756
8840
|
}
|
|
8757
|
-
.scroll-timeline-x-hidden[data-v-
|
|
8841
|
+
.scroll-timeline-x-hidden[data-v-0ec7147f] .cm-scroller {
|
|
8758
8842
|
scrollbar-width: none;
|
|
8759
8843
|
-ms-overflow-style: none;
|
|
8760
8844
|
padding-right: 20px;
|
|
8761
8845
|
overflow: auto;
|
|
8762
8846
|
}
|
|
8763
|
-
.scroll-timeline-x-hidden[data-v-
|
|
8847
|
+
.scroll-timeline-x-hidden[data-v-0ec7147f]::-webkit-scrollbar {
|
|
8764
8848
|
width: 0;
|
|
8765
8849
|
height: 0;
|
|
8766
8850
|
display: none;
|
|
8767
8851
|
}
|
|
8768
|
-
.scroll-timeline-x-hidden[data-v-
|
|
8852
|
+
.scroll-timeline-x-hidden[data-v-0ec7147f] .cm-scroller::-webkit-scrollbar {
|
|
8769
8853
|
width: 0;
|
|
8770
8854
|
height: 0;
|
|
8771
8855
|
display: none;
|
|
8772
8856
|
}
|
|
8773
|
-
.scroll-timeline-x-address[data-v-
|
|
8857
|
+
.scroll-timeline-x-address[data-v-0ec7147f] {
|
|
8774
8858
|
line-height: 27px;
|
|
8775
8859
|
scrollbar-width: none; /* Firefox */
|
|
8776
8860
|
}
|
|
8777
8861
|
/* make clickable are to left of send button */
|
|
8778
|
-
.scroll-timeline-x-address[data-v-
|
|
8862
|
+
.scroll-timeline-x-address[data-v-0ec7147f]:after {
|
|
8779
8863
|
content: '';
|
|
8780
8864
|
position: absolute;
|
|
8781
8865
|
height: 100%;
|
|
@@ -8783,24 +8867,24 @@ input[data-v-c1a50a6e]::placeholder {
|
|
|
8783
8867
|
right: 0;
|
|
8784
8868
|
cursor: text;
|
|
8785
8869
|
}
|
|
8786
|
-
.scroll-timeline-x-address[data-v-
|
|
8870
|
+
.scroll-timeline-x-address[data-v-0ec7147f]:empty:before {
|
|
8787
8871
|
content: 'Enter URL or cURL request';
|
|
8788
8872
|
color: var(--scalar-color-3);
|
|
8789
8873
|
pointer-events: none;
|
|
8790
8874
|
}
|
|
8791
|
-
.fade-left[data-v-
|
|
8792
|
-
.fade-right[data-v-
|
|
8875
|
+
.fade-left[data-v-0ec7147f],
|
|
8876
|
+
.fade-right[data-v-0ec7147f] {
|
|
8793
8877
|
content: '';
|
|
8794
8878
|
position: sticky;
|
|
8795
8879
|
height: 100%;
|
|
8796
|
-
animation-name: fadein-
|
|
8880
|
+
animation-name: fadein-0ec7147f;
|
|
8797
8881
|
animation-duration: 1ms;
|
|
8798
8882
|
animation-direction: reverse;
|
|
8799
8883
|
animation-timeline: --scroll-timeline;
|
|
8800
8884
|
pointer-events: none;
|
|
8801
8885
|
z-index: 1;
|
|
8802
8886
|
}
|
|
8803
|
-
.fade-left[data-v-
|
|
8887
|
+
.fade-left[data-v-0ec7147f] {
|
|
8804
8888
|
background: linear-gradient(
|
|
8805
8889
|
-90deg,
|
|
8806
8890
|
color-mix(in srgb, var(--scalar-address-bar-bg), transparent 100%) 0%,
|
|
@@ -8811,7 +8895,7 @@ input[data-v-c1a50a6e]::placeholder {
|
|
|
8811
8895
|
min-width: 6px;
|
|
8812
8896
|
animation-direction: normal;
|
|
8813
8897
|
}
|
|
8814
|
-
.fade-right[data-v-
|
|
8898
|
+
.fade-right[data-v-0ec7147f] {
|
|
8815
8899
|
background: linear-gradient(
|
|
8816
8900
|
90deg,
|
|
8817
8901
|
color-mix(in srgb, var(--scalar-address-bar-bg), transparent 100%) 0%,
|
|
@@ -8821,7 +8905,7 @@ input[data-v-c1a50a6e]::placeholder {
|
|
|
8821
8905
|
right: -1px;
|
|
8822
8906
|
min-width: 24px;
|
|
8823
8907
|
}
|
|
8824
|
-
@keyframes fadein-
|
|
8908
|
+
@keyframes fadein-0ec7147f {
|
|
8825
8909
|
0% {
|
|
8826
8910
|
opacity: 0;
|
|
8827
8911
|
}
|
|
@@ -8829,7 +8913,7 @@ input[data-v-c1a50a6e]::placeholder {
|
|
|
8829
8913
|
opacity: 1;
|
|
8830
8914
|
}
|
|
8831
8915
|
}
|
|
8832
|
-
.address-bar-bg-states[data-v-
|
|
8916
|
+
.address-bar-bg-states[data-v-0ec7147f] {
|
|
8833
8917
|
--scalar-address-bar-bg: color-mix(
|
|
8834
8918
|
in srgb,
|
|
8835
8919
|
var(--scalar-background-1),
|
|
@@ -8837,14 +8921,14 @@ input[data-v-c1a50a6e]::placeholder {
|
|
|
8837
8921
|
);
|
|
8838
8922
|
background: var(--scalar-address-bar-bg);
|
|
8839
8923
|
}
|
|
8840
|
-
.address-bar-bg-states[data-v-
|
|
8924
|
+
.address-bar-bg-states[data-v-0ec7147f]:has(.cm-focused) {
|
|
8841
8925
|
--scalar-address-bar-bg: var(--scalar-background-1);
|
|
8842
8926
|
border-color: var(--scalar-border-color);
|
|
8843
8927
|
outline-width: 1px;
|
|
8844
8928
|
outline-style: solid;
|
|
8845
8929
|
}
|
|
8846
|
-
.address-bar-bg-states:has(.cm-focused) .fade-left[data-v-
|
|
8847
|
-
.address-bar-bg-states:has(.cm-focused) .fade-right[data-v-
|
|
8930
|
+
.address-bar-bg-states:has(.cm-focused) .fade-left[data-v-0ec7147f],
|
|
8931
|
+
.address-bar-bg-states:has(.cm-focused) .fade-right[data-v-0ec7147f] {
|
|
8848
8932
|
--scalar-address-bar-bg: var(--scalar-background-1);
|
|
8849
8933
|
}
|
|
8850
8934
|
|
|
@@ -9274,27 +9358,27 @@ to {
|
|
|
9274
9358
|
background: linear-gradient(rgba(0, 0, 0, 0.15), rgba(255, 255, 255, 0.1));
|
|
9275
9359
|
}
|
|
9276
9360
|
|
|
9277
|
-
.empty-sidebar-item-content[data-v-
|
|
9361
|
+
.empty-sidebar-item-content[data-v-96a54993] {
|
|
9278
9362
|
display: none;
|
|
9279
9363
|
}
|
|
9280
|
-
.empty-sidebar-item .empty-sidebar-item-content[data-v-
|
|
9364
|
+
.empty-sidebar-item .empty-sidebar-item-content[data-v-96a54993] {
|
|
9281
9365
|
display: block;
|
|
9282
9366
|
}
|
|
9283
|
-
.rabbitjump[data-v-
|
|
9367
|
+
.rabbitjump[data-v-96a54993] {
|
|
9284
9368
|
opacity: 0;
|
|
9285
9369
|
}
|
|
9286
|
-
.empty-sidebar-item:hover .rabbitjump[data-v-
|
|
9370
|
+
.empty-sidebar-item:hover .rabbitjump[data-v-96a54993] {
|
|
9287
9371
|
opacity: 1;
|
|
9288
|
-
animation: rabbitAnimation-
|
|
9372
|
+
animation: rabbitAnimation-96a54993 0.5s steps(1) infinite;
|
|
9289
9373
|
}
|
|
9290
|
-
.empty-sidebar-item:hover .rabbitsit[data-v-
|
|
9374
|
+
.empty-sidebar-item:hover .rabbitsit[data-v-96a54993] {
|
|
9291
9375
|
opacity: 0;
|
|
9292
|
-
animation: rabbitAnimation2-
|
|
9376
|
+
animation: rabbitAnimation2-96a54993 0.5s steps(1) infinite;
|
|
9293
9377
|
}
|
|
9294
|
-
.empty-sidebar-item:hover .rabbit-ascii[data-v-
|
|
9295
|
-
animation: rabbitRun-
|
|
9378
|
+
.empty-sidebar-item:hover .rabbit-ascii[data-v-96a54993] {
|
|
9379
|
+
animation: rabbitRun-96a54993 8s infinite linear;
|
|
9296
9380
|
}
|
|
9297
|
-
@keyframes rabbitRun-
|
|
9381
|
+
@keyframes rabbitRun-96a54993 {
|
|
9298
9382
|
0% {
|
|
9299
9383
|
transform: translate3d(0, 0, 0);
|
|
9300
9384
|
}
|
|
@@ -9314,7 +9398,7 @@ to {
|
|
|
9314
9398
|
transform: translate3d(0, 0, 0);
|
|
9315
9399
|
}
|
|
9316
9400
|
}
|
|
9317
|
-
@keyframes rabbitAnimation-
|
|
9401
|
+
@keyframes rabbitAnimation-96a54993 {
|
|
9318
9402
|
0%,
|
|
9319
9403
|
100% {
|
|
9320
9404
|
opacity: 1;
|
|
@@ -9323,7 +9407,7 @@ to {
|
|
|
9323
9407
|
opacity: 0;
|
|
9324
9408
|
}
|
|
9325
9409
|
}
|
|
9326
|
-
@keyframes rabbitAnimation2-
|
|
9410
|
+
@keyframes rabbitAnimation2-96a54993 {
|
|
9327
9411
|
0%,
|
|
9328
9412
|
100% {
|
|
9329
9413
|
opacity: 0;
|
|
@@ -10481,4 +10565,8 @@ to {
|
|
|
10481
10565
|
justify-content: flex-end;
|
|
10482
10566
|
gap: 1rem;
|
|
10483
10567
|
}
|
|
10568
|
+
|
|
10569
|
+
.document-scripts-editors__container[data-v-8c8fa790] {
|
|
10570
|
+
min-height: 300px;
|
|
10571
|
+
}
|
|
10484
10572
|
/*$vite$:1*/
|
|
@@ -31,6 +31,8 @@ export type OperationBlockProps = {
|
|
|
31
31
|
eventBus: WorkspaceEventBus;
|
|
32
32
|
/** Application version */
|
|
33
33
|
appVersion: string;
|
|
34
|
+
/** Openapi document */
|
|
35
|
+
document: OpenApiDocument;
|
|
34
36
|
/** Workspace cookies */
|
|
35
37
|
workspaceCookies: XScalarCookie[];
|
|
36
38
|
/** Document cookies */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OperationBlock.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/blocks/operation-block/OperationBlock.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"OperationBlock.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/blocks/operation-block/OperationBlock.vue"],"names":[],"mappings":"AAgfA,OAAO,KAAK,EAAE,UAAU,IAAI,cAAc,EAAE,MAAM,mCAAmC,CAAA;AAErF,OAAO,EAAe,KAAK,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC1E,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,wBAAwB,CAAA;AAE/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AACpE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAA;AAC7E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iDAAiD,CAAA;AACnF,OAAO,KAAK,EACV,QAAQ,EACR,UAAU,EACV,iBAAiB,EAClB,MAAM,gCAAgC,CAAA;AACvC,OAAO,EAKL,KAAK,qBAAqB,EAC1B,KAAK,0BAA0B,EAChC,MAAM,yCAAyC,CAAA;AAChD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AACnH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qEAAqE,CAAA;AACxG,OAAO,KAAK,EACV,eAAe,EACf,YAAY,EACb,MAAM,8DAA8D,CAAA;AACrE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uDAAuD,CAAA;AAK5F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAoB3C;;;;;;;;;;;;GAYG;wBACkB,OAAO,YAAY;AAAxC,wBAAyC;AAMzC,MAAM,MAAM,mBAAmB,GAAG;IAChC,gBAAgB;IAChB,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,0BAA0B;IAC1B,UAAU,EAAE,MAAM,CAAA;IAClB,uBAAuB;IACvB,QAAQ,EAAE,eAAe,CAAA;IACzB,wBAAwB;IACxB,gBAAgB,EAAE,aAAa,EAAE,CAAA;IACjC,uBAAuB;IACvB,eAAe,EAAE,aAAa,EAAE,CAAA;IAChC,2BAA2B;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,6BAA6B;IAC7B,MAAM,EAAE,cAAc,CAAA;IACtB,mBAAmB;IACnB,WAAW,EAAE,gBAAgB,CAAA;IAC7B,oCAAoC;IACpC,OAAO,CAAC,EAAE,YAAY,EAAE,CAAA;IACxB,oBAAoB;IACpB,MAAM,EAAE,YAAY,CAAA;IACpB,gCAAgC;IAChC,MAAM,EAAE,YAAY,GAAG,IAAI,CAAA;IAC3B,gCAAgC;IAChC,cAAc,EAAE,cAAc,CAAC,WAAW,CAAC,CAAC,yBAAyB,CAAC,CAAA;IACtE,mDAAmD;IACnD,OAAO,EAAE,YAAY,EAAE,CAAA;IACvB,sCAAsC;IACtC,UAAU,EAAE,UAAU,CAAA;IACtB,4CAA4C;IAC5C,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,0BAA0B;IAC1B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,mEAAmE;IACnE,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,oBAAoB;IACpB,MAAM,CAAC,EAAE,SAAS,GAAG,eAAe,CAAA;IACpC,uBAAuB;IACvB,SAAS,EAAE,eAAe,CAAA;IAC1B,+DAA+D;IAC/D,UAAU,EAAE,MAAM,CAAA;IAClB,2CAA2C;IAC3C,QAAQ,EAAE,QAAQ,CAAA;IAClB,wCAAwC;IACxC,eAAe,EAAE,qBAAqB,CAAA;IACtC,qBAAqB;IACrB,OAAO,EAAE,YAAY,EAAE,CAAA;IACvB,uBAAuB;IACvB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAA;IACvB,qCAAqC;IACrC,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,8CAA8C;IAC9C,WAAW,EAAE,kBAAkB,CAAA;IAC/B,yCAAyC;IACzC,QAAQ,EAAE,MAAM,CAAA;IAChB,kCAAkC;IAClC,gBAAgB,EAAE,gBAAgB,CAAA;IAClC,0CAA0C;IAC1C,uBAAuB,EAAE,0BAA0B,EAAE,CAAA;IACrD,4BAA4B;IAC5B,oBAAoB,EAAE,eAAe,CAAC,UAAU,CAAC,CAAA;IACjD,sBAAsB;IACtB,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACtC,sEAAsE;IACtE,+BAA+B,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACzD,CAAA;AACD,QAAA,MAAM,YAAY,kTAwed,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OperationBlock.vue.js","names":[],"sources":["../../../../src/v2/blocks/operation-block/OperationBlock.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * OperationBlock\n *\n * Orchestrates the operation view by wiring together the Header, OperationBlock,\n * and ResponseBlock. Forwards user interactions to the workspace event bus and\n * passes through configuration such as auth, servers, plugins, and environment.\n * This component keeps the Operation page lean by centralizing event emission\n * and prop wiring between the blocks.\n *\n * Notable behavior:\n * - Uses operation['x-scalar-method'] and operation['x-scalar-path'] to provide\n * draft overrides for the UI when present.\n */\nexport default {\n name: 'OperationBlock',\n}\n\nexport type OperationBlockProps = {\n /** Event bus */\n eventBus: WorkspaceEventBus\n /** Application version */\n appVersion: string\n /** Workspace cookies */\n workspaceCookies: XScalarCookie[]\n /** Document cookies */\n documentCookies: XScalarCookie[]\n /** Current request path */\n path: string\n /** Current request method */\n method: HttpMethodType\n /** HTTP clients */\n httpClients: AvailableClients\n /** The history for the operation */\n history?: HistoryEntry[]\n /** Client layout */\n layout: ClientLayout\n /** Currently selected server */\n server: ServerObject | null\n /** Currently selected client */\n selectedClient: WorkspaceStore['workspace']['x-scalar-default-client']\n /** Server list available for operation/document */\n servers: ServerObject[]\n /** Meta information for the server */\n serverMeta: ServerMeta\n /** Hides the client button on the header */\n hideClientButton?: boolean\n /** Client integration */\n integration?: string | null\n /** Openapi document url for `modal` mode to open the client app */\n documentUrl?: string\n /** Client source */\n source?: 'gitbook' | 'api-reference'\n /** Operation object */\n operation: OperationObject\n /** Currently selected example key for the current operation */\n exampleKey: string\n /** Meta information for the auth update */\n authMeta: AuthMeta\n /** Document defined security schemes */\n securitySchemes: MergedSecuritySchemes\n /** Client plugins */\n plugins: ClientPlugin[]\n /** Environment list */\n environments?: string[]\n /** Currently selected environment */\n activeEnvironment?: string\n /** For environment variables in the inputs */\n environment: XScalarEnvironment\n /** The proxy URL for sending requests */\n proxyUrl: string\n /** Currently selected security */\n selectedSecurity: SelectedSecurity\n /** Currently selected security schemes */\n selectedSecuritySchemes: SecuritySchemeObjectSecret[]\n /** Security requirements */\n securityRequirements: OpenApiDocument['security']\n /** Default headers */\n defaultHeaders: Record<string, string>\n /** Selected anyOf/oneOf request-body variants keyed by schema path */\n requestBodyCompositionSelection?: Record<string, number>\n}\n</script>\n<script setup lang=\"ts\">\nimport type { HttpMethod as HttpMethodType } from '@scalar/helpers/http/http-methods'\nimport type { ResponseInstance } from '@scalar/oas-utils/entities/spec'\nimport { executeHook, type ClientPlugin } from '@scalar/oas-utils/helpers'\nimport {\n AVAILABLE_CLIENTS,\n type AvailableClients,\n} from '@scalar/types/snippetz'\nimport { useToasts } from '@scalar/use-toasts'\nimport type { WorkspaceStore } from '@scalar/workspace-store/client'\nimport type { SelectedSecurity } from '@scalar/workspace-store/entities/auth'\nimport type { HistoryEntry } from '@scalar/workspace-store/entities/history/schema'\nimport type {\n AuthMeta,\n ServerMeta,\n WorkspaceEventBus,\n} from '@scalar/workspace-store/events'\nimport {\n buildRequest,\n getEnvironmentVariables,\n requestFactory,\n type MergedSecuritySchemes,\n type SecuritySchemeObjectSecret,\n} from '@scalar/workspace-store/request-example'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport type { XScalarCookie } from '@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies'\nimport type {\n OpenApiDocument,\n ServerObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport type { OperationObject } from '@scalar/workspace-store/schemas/v3.1/strict/operation'\nimport { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue'\n\nimport ViewLayout from '@/components/ViewLayout/ViewLayout.vue'\nimport ViewLayoutContent from '@/components/ViewLayout/ViewLayoutContent.vue'\nimport type { ClientLayout } from '@/hooks'\nimport { isElectron } from '@/libs/electron'\nimport { ERRORS } from '@/libs/errors'\nimport { harToFetchRequest } from '@/v2/blocks/operation-block/helpers/har-to-fetch-request'\nimport { harToFetchResponse } from '@/v2/blocks/operation-block/helpers/har-to-fetch-response'\nimport {\n getOperationExampleKey,\n isStreamingResponse,\n responseCache,\n} from '@/v2/blocks/operation-block/helpers/response-cache'\nimport { sendRequest } from '@/v2/blocks/operation-block/helpers/send-request'\nimport { validatePathParameters } from '@/v2/blocks/operation-block/helpers/validate-path-parameters'\nimport { generateClientOptions } from '@/v2/blocks/operation-code-sample'\nimport { RequestBlock } from '@/v2/blocks/request-block'\nimport { ResponseBlock } from '@/v2/blocks/response-block'\nimport { type History } from '@/v2/blocks/scalar-address-bar-block'\n\nimport Header from './components/Header.vue'\n\nconst {\n authMeta,\n environment,\n eventBus,\n exampleKey,\n workspaceCookies = [],\n documentCookies = [],\n hideClientButton,\n httpClients = AVAILABLE_CLIENTS,\n history = [],\n method,\n operation,\n path,\n plugins = [],\n proxyUrl,\n requestBodyCompositionSelection,\n securitySchemes,\n selectedClient,\n server,\n environments,\n activeEnvironment,\n serverMeta,\n selectedSecurity,\n selectedSecuritySchemes,\n securityRequirements,\n defaultHeaders,\n} = defineProps<OperationBlockProps>()\n\n/** Hoist up client generation so it doesn't get re-generated on every operation */\nconst clientOptions = computed(() => generateClientOptions(httpClients))\n\nconst { toast } = useToasts()\n\n// Refs\nconst abortController = ref<AbortController | null>(null)\nconst response = ref<ResponseInstance | null>(null)\nconst request = ref<Request | null>(null)\n\n/** Cancel the request */\nconst cancelRequest = () => abortController.value?.abort(ERRORS.REQUEST_ABORTED)\n\n/** Execute the current operation example */\nconst handleExecute = async () => {\n const pathValidation = validatePathParameters(\n operation.parameters ?? [],\n exampleKey,\n )\n if (pathValidation.ok === false) {\n toast('Path parameters must have values.', 'error')\n return\n }\n\n const globalCookies = [...workspaceCookies, ...documentCookies]\n\n const { request: requestBuilder } = requestFactory({\n defaultHeaders,\n environment,\n exampleName: exampleKey,\n globalCookies,\n method,\n operation,\n path,\n proxyUrl,\n server,\n selectedSecuritySchemes,\n isElectron: isElectron(),\n requestBodyCompositionSelection,\n })\n\n // Stop any previous streaming response\n if (response.value && 'reader' in response.value) {\n response.value.reader.cancel()\n }\n\n // Build the actual request we will send\n const requestResult = (() => {\n try {\n return {\n ok: true,\n result: buildRequest(requestBuilder, {\n envVariables: getEnvironmentVariables(environment),\n }),\n } as const\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error)\n return {\n ok: false,\n error: message,\n } as const\n }\n })()\n\n if (requestResult.ok === false) {\n toast(requestResult.error, 'error')\n return\n }\n\n // Store the abort controller for cancellation\n abortController.value = requestResult.result.controller\n\n // Execute the hooks\n eventBus.emit('hooks:on:request:sent', {\n meta: {\n method,\n path,\n exampleKey,\n },\n })\n\n // Execute the beforeRequest hook\n const { request: finalRequest } = await executeHook(\n { request: requestResult.result.request },\n 'beforeRequest',\n plugins,\n )\n\n /** Execute the request */\n const [sendError, sendResult] = await sendRequest({\n isUsingProxy: requestResult.result.isUsingProxy,\n request: finalRequest,\n })\n\n if (sendResult) {\n // Execute the responseReceived hook\n await executeHook(\n {\n response: sendResult.originalResponse.clone(),\n request: sendResult.request.clone(),\n operation,\n },\n 'responseReceived',\n plugins,\n )\n }\n\n // Execute the hooks\n eventBus.emit('hooks:on:request:complete', {\n payload: sendResult\n ? {\n response: sendResult.originalResponse.clone(),\n request: sendResult.request.clone(),\n duration: sendResult.response.duration,\n timestamp: sendResult.timestamp,\n }\n : undefined,\n meta: {\n method,\n path,\n exampleKey,\n },\n })\n\n if (sendError) {\n // clean up the response and request\n response.value = null\n request.value = null\n abortController.value = null\n\n toast(sendError.message, 'error')\n return\n }\n\n // Store the response\n response.value = sendResult.response\n request.value = sendResult.request\n\n // Cache non-streaming responses so they can be restored when navigating back\n if (!isStreamingResponse(sendResult.response)) {\n responseCache.set(getOperationExampleKey(method, path, exampleKey), {\n response: sendResult.response,\n request: sendResult.request,\n })\n }\n}\n\nonMounted(() => {\n eventBus.on('operation:send:request:hotkey', handleExecute)\n eventBus.on('operation:cancel:request', cancelRequest)\n})\nonBeforeUnmount(() => {\n eventBus.off('operation:send:request:hotkey', handleExecute)\n eventBus.off('operation:cancel:request', cancelRequest)\n})\n\nconst operationHistory = computed<History[]>(() =>\n history\n .map((entry) => ({\n method: entry.request.method as HttpMethodType,\n path: entry.request.url,\n duration: entry.time,\n status: entry.response.status,\n }))\n .reverse(),\n)\n\nconst handleSelectHistoryItem = ({ index }: { index: number }) => {\n const transformedIndex = (history.length ?? 0) - index - 1\n const historyItem = history[transformedIndex]\n if (!historyItem) {\n return\n }\n\n const navigate = () =>\n eventBus.emit('ui:navigate', {\n page: 'example',\n method,\n path,\n exampleName: 'draft',\n callback: (status) => {\n // Do not replace the response if the navigation was not successful\n if (status !== 'success') {\n return\n }\n // Reconstruct the response\n const fetchResponse = harToFetchResponse({\n harResponse: historyItem.response,\n url: historyItem.request.url,\n method,\n path,\n duration: historyItem.time,\n })\n\n // Reconstruct the request\n const fetchRequest = harToFetchRequest({\n harRequest: historyItem.request,\n })\n\n // Update the response and request\n response.value = fetchResponse\n request.value = fetchRequest\n },\n })\n\n eventBus.emit('operation:reload:history', {\n meta: {\n path,\n method,\n },\n index: transformedIndex,\n callback: navigate,\n })\n}\n\n/**\n * When the path, method, or example key changes: save current response to\n * cache (so it can be restored when navigating back), then restore from cache\n * for the new operation or clear if no cached response. Response is only\n * cleared on page refresh or when making a new request for that operation.\n */\nwatch(\n [() => path, () => method, () => exampleKey],\n ([newPath, newMethod, newExampleKey]) => {\n const newKey = getOperationExampleKey(newMethod, newPath, newExampleKey)\n const cached = responseCache.get(newKey)\n if (cached) {\n response.value = cached.response\n request.value = cached.request\n } else {\n response.value = null\n request.value = null\n }\n\n // Cancel any in-flight request\n cancelRequest()\n },\n { immediate: true },\n)\n\nonBeforeUnmount(() => {\n // We cancel the request if the component is unmounted\n cancelRequest()\n})\n</script>\n<template>\n <div class=\"bg-b-1 flex h-full flex-col\">\n <div\n class=\"lg:min-h-header flex w-full flex-wrap items-center justify-center p-2 lg:p-0\">\n <!-- Address Bar -->\n <Header\n :activeEnvironment\n :documentUrl\n :environment\n :environments\n :eventBus\n :hideClientButton\n :history=\"operationHistory\"\n :integration\n :layout\n :method\n :path\n :server\n :serverMeta\n :servers\n :source\n @execute=\"handleExecute\"\n @select:history:item=\"handleSelectHistoryItem\" />\n </div>\n\n <ViewLayout class=\"border-t\">\n <ViewLayoutContent class=\"flex-1\">\n <!-- Request Section -->\n <RequestBlock\n :authMeta\n :clientOptions\n :defaultHeaders\n :documentCookies\n :environment\n :eventBus\n :exampleKey\n :layout\n :method\n :operation\n :path\n :plugins\n :proxyUrl\n :requestBodyCompositionSelection\n :securityRequirements\n :securitySchemes\n :selectedClient\n :selectedSecurity\n :selectedSecuritySchemes\n :server\n :workspaceCookies />\n\n <!-- Response Section -->\n <ResponseBlock\n :appVersion\n :eventBus\n :layout\n :plugins\n :request\n :response\n :totalPerformedRequests=\"operationHistory.length\" />\n </ViewLayoutContent>\n </ViewLayout>\n </div>\n</template>\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"OperationBlock.vue.js","names":[],"sources":["../../../../src/v2/blocks/operation-block/OperationBlock.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * OperationBlock\n *\n * Orchestrates the operation view by wiring together the Header, OperationBlock,\n * and ResponseBlock. Forwards user interactions to the workspace event bus and\n * passes through configuration such as auth, servers, plugins, and environment.\n * This component keeps the Operation page lean by centralizing event emission\n * and prop wiring between the blocks.\n *\n * Notable behavior:\n * - Uses operation['x-scalar-method'] and operation['x-scalar-path'] to provide\n * draft overrides for the UI when present.\n */\nexport default {\n name: 'OperationBlock',\n}\n\nexport type OperationBlockProps = {\n /** Event bus */\n eventBus: WorkspaceEventBus\n /** Application version */\n appVersion: string\n /** Openapi document */\n document: OpenApiDocument\n /** Workspace cookies */\n workspaceCookies: XScalarCookie[]\n /** Document cookies */\n documentCookies: XScalarCookie[]\n /** Current request path */\n path: string\n /** Current request method */\n method: HttpMethodType\n /** HTTP clients */\n httpClients: AvailableClients\n /** The history for the operation */\n history?: HistoryEntry[]\n /** Client layout */\n layout: ClientLayout\n /** Currently selected server */\n server: ServerObject | null\n /** Currently selected client */\n selectedClient: WorkspaceStore['workspace']['x-scalar-default-client']\n /** Server list available for operation/document */\n servers: ServerObject[]\n /** Meta information for the server */\n serverMeta: ServerMeta\n /** Hides the client button on the header */\n hideClientButton?: boolean\n /** Client integration */\n integration?: string | null\n /** Openapi document url for `modal` mode to open the client app */\n documentUrl?: string\n /** Client source */\n source?: 'gitbook' | 'api-reference'\n /** Operation object */\n operation: OperationObject\n /** Currently selected example key for the current operation */\n exampleKey: string\n /** Meta information for the auth update */\n authMeta: AuthMeta\n /** Document defined security schemes */\n securitySchemes: MergedSecuritySchemes\n /** Client plugins */\n plugins: ClientPlugin[]\n /** Environment list */\n environments?: string[]\n /** Currently selected environment */\n activeEnvironment?: string\n /** For environment variables in the inputs */\n environment: XScalarEnvironment\n /** The proxy URL for sending requests */\n proxyUrl: string\n /** Currently selected security */\n selectedSecurity: SelectedSecurity\n /** Currently selected security schemes */\n selectedSecuritySchemes: SecuritySchemeObjectSecret[]\n /** Security requirements */\n securityRequirements: OpenApiDocument['security']\n /** Default headers */\n defaultHeaders: Record<string, string>\n /** Selected anyOf/oneOf request-body variants keyed by schema path */\n requestBodyCompositionSelection?: Record<string, number>\n}\n</script>\n<script setup lang=\"ts\">\nimport type { HttpMethod as HttpMethodType } from '@scalar/helpers/http/http-methods'\nimport type { ResponseInstance } from '@scalar/oas-utils/entities/spec'\nimport { executeHook, type ClientPlugin } from '@scalar/oas-utils/helpers'\nimport {\n AVAILABLE_CLIENTS,\n type AvailableClients,\n} from '@scalar/types/snippetz'\nimport { useToasts } from '@scalar/use-toasts'\nimport type { WorkspaceStore } from '@scalar/workspace-store/client'\nimport type { SelectedSecurity } from '@scalar/workspace-store/entities/auth'\nimport type { HistoryEntry } from '@scalar/workspace-store/entities/history/schema'\nimport type {\n AuthMeta,\n ServerMeta,\n WorkspaceEventBus,\n} from '@scalar/workspace-store/events'\nimport {\n buildRequest,\n createVariablesStoreForRequest,\n getEnvironmentVariables,\n requestFactory,\n type MergedSecuritySchemes,\n type SecuritySchemeObjectSecret,\n} from '@scalar/workspace-store/request-example'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport type { XScalarCookie } from '@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies'\nimport type {\n OpenApiDocument,\n ServerObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport type { OperationObject } from '@scalar/workspace-store/schemas/v3.1/strict/operation'\nimport { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue'\n\nimport ViewLayout from '@/components/ViewLayout/ViewLayout.vue'\nimport ViewLayoutContent from '@/components/ViewLayout/ViewLayoutContent.vue'\nimport type { ClientLayout } from '@/hooks'\nimport { isElectron } from '@/libs/electron'\nimport { ERRORS } from '@/libs/errors'\nimport { harToFetchRequest } from '@/v2/blocks/operation-block/helpers/har-to-fetch-request'\nimport { harToFetchResponse } from '@/v2/blocks/operation-block/helpers/har-to-fetch-response'\nimport {\n getOperationExampleKey,\n isStreamingResponse,\n responseCache,\n} from '@/v2/blocks/operation-block/helpers/response-cache'\nimport { sendRequest } from '@/v2/blocks/operation-block/helpers/send-request'\nimport { validatePathParameters } from '@/v2/blocks/operation-block/helpers/validate-path-parameters'\nimport { generateClientOptions } from '@/v2/blocks/operation-code-sample'\nimport { RequestBlock } from '@/v2/blocks/request-block'\nimport { ResponseBlock } from '@/v2/blocks/response-block'\nimport { type History } from '@/v2/blocks/scalar-address-bar-block'\n\nimport Header from './components/Header.vue'\n\nconst {\n authMeta,\n environment,\n eventBus,\n exampleKey,\n document,\n workspaceCookies = [],\n documentCookies = [],\n hideClientButton,\n httpClients = AVAILABLE_CLIENTS,\n history = [],\n method,\n operation,\n path,\n plugins = [],\n proxyUrl,\n requestBodyCompositionSelection,\n securitySchemes,\n selectedClient,\n server,\n environments,\n activeEnvironment,\n serverMeta,\n selectedSecurity,\n selectedSecuritySchemes,\n securityRequirements,\n defaultHeaders,\n} = defineProps<OperationBlockProps>()\n\n/** Hoist up client generation so it doesn't get re-generated on every operation */\nconst clientOptions = computed(() => generateClientOptions(httpClients))\n\nconst { toast } = useToasts()\n\n// Refs\nconst abortController = ref<AbortController | null>(null)\nconst response = ref<ResponseInstance | null>(null)\nconst request = ref<Request | null>(null)\n\n/** Cancel the request */\nconst cancelRequest = () => abortController.value?.abort(ERRORS.REQUEST_ABORTED)\n\n/** Execute the current operation example */\nconst handleExecute = async () => {\n const pathValidation = validatePathParameters(\n operation.parameters ?? [],\n exampleKey,\n )\n if (pathValidation.ok === false) {\n toast('Path parameters must have values.', 'error')\n return\n }\n\n const globalCookies = [...workspaceCookies, ...documentCookies]\n\n const { request: requestBuilder } = requestFactory({\n defaultHeaders,\n environment,\n exampleName: exampleKey,\n globalCookies,\n method,\n operation,\n path,\n proxyUrl,\n server,\n selectedSecuritySchemes,\n isElectron: isElectron(),\n requestBodyCompositionSelection,\n })\n\n // Stop any previous streaming response\n if (response.value && 'reader' in response.value) {\n response.value.reader.cancel()\n }\n\n // Execute the hooks\n eventBus.emit('hooks:on:request:sent', {\n meta: {\n method,\n path,\n exampleKey,\n },\n })\n\n const variablesStore = createVariablesStoreForRequest()\n\n // Execute the beforeRequest hook (plugins receive RequestFactory, not fetch Request)\n await executeHook(\n {\n requestBuilder,\n document,\n operation,\n variablesStore,\n },\n 'beforeRequest',\n plugins,\n )\n\n const envVariables = {\n ...getEnvironmentVariables(environment),\n ...variablesStore.getVariables(),\n }\n\n // Build the fetch Request after hooks may have mutated the factory\n const requestResult = (() => {\n try {\n return {\n ok: true,\n result: buildRequest(requestBuilder, {\n envVariables,\n }),\n } as const\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error)\n return {\n ok: false,\n error: message,\n } as const\n }\n })()\n\n if (requestResult.ok === false) {\n toast(requestResult.error, 'error')\n return\n }\n\n // Store the abort controller for cancellation\n abortController.value = requestResult.result.controller\n\n /** Execute the request */\n const [sendError, sendResult] = await sendRequest({\n isUsingProxy: requestResult.result.isUsingProxy,\n request: requestResult.result.request,\n })\n\n if (sendResult) {\n // Execute the responseReceived hook\n await executeHook(\n {\n response: sendResult.originalResponse.clone(),\n requestBuilder,\n request: sendResult.request.clone(),\n document,\n operation,\n variablesStore,\n },\n 'responseReceived',\n plugins,\n )\n }\n\n // Execute the hooks\n eventBus.emit('hooks:on:request:complete', {\n payload: sendResult\n ? {\n response: sendResult.originalResponse.clone(),\n request: sendResult.request.clone(),\n duration: sendResult.response.duration,\n timestamp: sendResult.timestamp,\n }\n : undefined,\n meta: {\n method,\n path,\n exampleKey,\n },\n })\n\n if (sendError) {\n // clean up the response and request\n response.value = null\n request.value = null\n abortController.value = null\n\n toast(sendError.message, 'error')\n return\n }\n\n // Store the response\n response.value = sendResult.response\n request.value = sendResult.request\n\n // Cache non-streaming responses so they can be restored when navigating back\n if (!isStreamingResponse(sendResult.response)) {\n responseCache.set(getOperationExampleKey(method, path, exampleKey), {\n response: sendResult.response,\n request: sendResult.request,\n })\n }\n}\n\nonMounted(() => {\n eventBus.on('operation:send:request:hotkey', handleExecute)\n eventBus.on('operation:cancel:request', cancelRequest)\n})\nonBeforeUnmount(() => {\n eventBus.off('operation:send:request:hotkey', handleExecute)\n eventBus.off('operation:cancel:request', cancelRequest)\n})\n\nconst operationHistory = computed<History[]>(() =>\n history\n .map((entry) => ({\n method: entry.request.method as HttpMethodType,\n path: entry.request.url,\n duration: entry.time,\n status: entry.response.status,\n }))\n .reverse(),\n)\n\nconst handleSelectHistoryItem = ({ index }: { index: number }) => {\n const transformedIndex = (history.length ?? 0) - index - 1\n const historyItem = history[transformedIndex]\n if (!historyItem) {\n return\n }\n\n const navigate = () =>\n eventBus.emit('ui:navigate', {\n page: 'example',\n method,\n path,\n exampleName: 'draft',\n callback: (status) => {\n // Do not replace the response if the navigation was not successful\n if (status !== 'success') {\n return\n }\n // Reconstruct the response\n const fetchResponse = harToFetchResponse({\n harResponse: historyItem.response,\n url: historyItem.request.url,\n method,\n path,\n duration: historyItem.time,\n })\n\n // Reconstruct the request\n const fetchRequest = harToFetchRequest({\n harRequest: historyItem.request,\n })\n\n // Update the response and request\n response.value = fetchResponse\n request.value = fetchRequest\n },\n })\n\n eventBus.emit('operation:reload:history', {\n meta: {\n path,\n method,\n },\n index: transformedIndex,\n callback: navigate,\n })\n}\n\n/**\n * When the path, method, or example key changes: save current response to\n * cache (so it can be restored when navigating back), then restore from cache\n * for the new operation or clear if no cached response. Response is only\n * cleared on page refresh or when making a new request for that operation.\n */\nwatch(\n [() => path, () => method, () => exampleKey],\n ([newPath, newMethod, newExampleKey]) => {\n const newKey = getOperationExampleKey(newMethod, newPath, newExampleKey)\n const cached = responseCache.get(newKey)\n if (cached) {\n response.value = cached.response\n request.value = cached.request\n } else {\n response.value = null\n request.value = null\n }\n\n // Cancel any in-flight request\n cancelRequest()\n },\n { immediate: true },\n)\n\nonBeforeUnmount(() => {\n // We cancel the request if the component is unmounted\n cancelRequest()\n})\n</script>\n<template>\n <div class=\"bg-b-1 flex h-full flex-col\">\n <div\n class=\"lg:min-h-header flex w-full flex-wrap items-center justify-center p-2 lg:p-0\">\n <!-- Address Bar -->\n <Header\n :activeEnvironment\n :documentUrl\n :environment\n :environments\n :eventBus\n :hideClientButton\n :history=\"operationHistory\"\n :integration\n :layout\n :method\n :path\n :server\n :serverMeta\n :servers\n :source\n @execute=\"handleExecute\"\n @select:history:item=\"handleSelectHistoryItem\" />\n </div>\n\n <ViewLayout class=\"border-t\">\n <ViewLayoutContent class=\"flex-1\">\n <!-- Request Section -->\n <RequestBlock\n :authMeta\n :clientOptions\n :defaultHeaders\n :documentCookies\n :environment\n :eventBus\n :exampleKey\n :layout\n :method\n :operation\n :path\n :plugins\n :proxyUrl\n :requestBodyCompositionSelection\n :securityRequirements\n :securitySchemes\n :selectedClient\n :selectedSecurity\n :selectedSecuritySchemes\n :server\n :workspaceCookies />\n\n <!-- Response Section -->\n <ResponseBlock\n :appVersion\n :eventBus\n :layout\n :plugins\n :request\n :response\n :totalPerformedRequests=\"operationHistory.length\" />\n </ViewLayoutContent>\n </ViewLayout>\n </div>\n</template>\n"],"mappings":""}
|