@scalar/api-client 3.0.0 → 3.1.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 +14 -0
- package/README.md +41 -0
- package/dist/plugins/posthog/index.d.ts +23 -0
- package/dist/plugins/posthog/index.d.ts.map +1 -0
- package/dist/plugins/posthog/index.js +58 -0
- package/dist/plugins/posthog/index.js.map +1 -0
- package/dist/style.css +78 -18
- 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 +14 -12
- package/dist/v2/blocks/operation-block/OperationBlock.vue.script.js.map +1 -1
- package/dist/v2/blocks/operation-block/helpers/decode-buffer.d.ts +5 -2
- package/dist/v2/blocks/operation-block/helpers/decode-buffer.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/helpers/decode-buffer.js +5 -2
- package/dist/v2/blocks/operation-block/helpers/decode-buffer.js.map +1 -1
- package/dist/v2/blocks/operation-block/helpers/har-to-fetch-request.d.ts +8 -9
- package/dist/v2/blocks/operation-block/helpers/har-to-fetch-request.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/helpers/har-to-fetch-request.js +8 -10
- package/dist/v2/blocks/operation-block/helpers/har-to-fetch-request.js.map +1 -1
- package/dist/v2/blocks/operation-block/helpers/response-cache.d.ts +2 -1
- package/dist/v2/blocks/operation-block/helpers/response-cache.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/helpers/response-cache.js.map +1 -1
- package/dist/v2/blocks/operation-block/helpers/send-request.d.ts +7 -3
- package/dist/v2/blocks/operation-block/helpers/send-request.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/helpers/send-request.js +19 -12
- package/dist/v2/blocks/operation-block/helpers/send-request.js.map +1 -1
- package/dist/v2/blocks/request-block/RequestBlock.vue.script.js +1 -1
- package/dist/v2/blocks/request-block/RequestBlock.vue.script.js.map +1 -1
- package/dist/v2/blocks/request-block/helpers/get-default-headers.js +1 -1
- package/dist/v2/blocks/response-block/ResponseBlock.vue.d.ts +3 -2
- package/dist/v2/blocks/response-block/ResponseBlock.vue.d.ts.map +1 -1
- package/dist/v2/blocks/response-block/ResponseBlock.vue.js +1 -1
- package/dist/v2/blocks/response-block/ResponseBlock.vue.js.map +1 -1
- package/dist/v2/blocks/response-block/ResponseBlock.vue.script.js +12 -6
- package/dist/v2/blocks/response-block/ResponseBlock.vue.script.js.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBody.vue.d.ts +2 -0
- package/dist/v2/blocks/response-block/components/ResponseBody.vue.d.ts.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBody.vue.js +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBody.vue.js.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBody.vue.script.js +34 -14
- package/dist/v2/blocks/response-block/components/ResponseBody.vue.script.js.map +1 -1
- package/dist/v2/blocks/response-block/helpers/process-response-body.d.ts +1 -1
- package/dist/v2/blocks/response-block/helpers/process-response-body.js +2 -3
- package/dist/v2/blocks/response-block/helpers/process-response-body.js.map +1 -1
- package/dist/v2/blocks/response-block/helpers/resolve-response-body-handler.d.ts +11 -0
- package/dist/v2/blocks/response-block/helpers/resolve-response-body-handler.d.ts.map +1 -0
- package/dist/v2/blocks/response-block/helpers/resolve-response-body-handler.js +44 -0
- package/dist/v2/blocks/response-block/helpers/resolve-response-body-handler.js.map +1 -0
- package/dist/v2/blocks/response-block/helpers/resolve-response-content-type.d.ts +14 -0
- package/dist/v2/blocks/response-block/helpers/resolve-response-content-type.d.ts.map +1 -0
- package/dist/v2/blocks/response-block/helpers/resolve-response-content-type.js +13 -0
- package/dist/v2/blocks/response-block/helpers/resolve-response-content-type.js.map +1 -0
- package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.script.js.map +1 -1
- package/dist/v2/constants.js +1 -1
- package/dist/v2/features/app/App.vue.d.ts.map +1 -1
- package/dist/v2/features/app/App.vue.js.map +1 -1
- package/dist/v2/features/app/App.vue.script.js +15 -3
- package/dist/v2/features/app/App.vue.script.js.map +1 -1
- package/dist/v2/features/app/helpers/create-temp-operation.d.ts.map +1 -1
- package/dist/v2/features/app/helpers/create-temp-operation.js +4 -1
- package/dist/v2/features/app/helpers/create-temp-operation.js.map +1 -1
- package/dist/v2/features/collection/components/Runner/hooks/use-runner-execution.js +1 -1
- package/dist/v2/features/collection/components/Runner/hooks/use-runner-execution.js.map +1 -1
- package/dist/v2/features/command-palette/components/CommandPaletteImport.vue.d.ts.map +1 -1
- package/dist/v2/features/command-palette/components/CommandPaletteImport.vue.js.map +1 -1
- package/dist/v2/features/command-palette/components/CommandPaletteImport.vue.script.js +1 -1
- package/dist/v2/features/command-palette/components/CommandPaletteImport.vue.script.js.map +1 -1
- package/dist/v2/features/command-palette/components/CommandPaletteImportPostman.vue.d.ts.map +1 -1
- package/dist/v2/features/command-palette/components/CommandPaletteImportPostman.vue.js.map +1 -1
- package/dist/v2/features/command-palette/components/CommandPaletteImportPostman.vue.script.js +26 -21
- package/dist/v2/features/command-palette/components/CommandPaletteImportPostman.vue.script.js.map +1 -1
- package/dist/v2/features/command-palette/components/PostmanImportPreview.vue.js +1 -1
- package/dist/v2/features/command-palette/components/PostmanImportPreview.vue.js.map +1 -1
- package/dist/v2/features/command-palette/components/PostmanImportPreview.vue.script.js +1 -1
- package/dist/v2/features/command-palette/components/PostmanImportPreview.vue.script.js.map +1 -1
- package/dist/v2/features/command-palette/helpers/get-postman-convert-options.d.ts +14 -0
- package/dist/v2/features/command-palette/helpers/get-postman-convert-options.d.ts.map +1 -0
- package/dist/v2/features/command-palette/helpers/get-postman-convert-options.js +19 -0
- package/dist/v2/features/command-palette/helpers/get-postman-convert-options.js.map +1 -0
- package/dist/v2/features/command-palette/helpers/get-postman-document-details.js +1 -1
- package/dist/v2/features/command-palette/helpers/get-postman-document-details.js.map +1 -1
- package/dist/v2/features/command-palette/helpers/load-document-from-source.d.ts.map +1 -1
- package/dist/v2/features/command-palette/helpers/load-document-from-source.js +1 -1
- package/dist/v2/features/command-palette/helpers/load-document-from-source.js.map +1 -1
- package/dist/v2/features/modal/helpers/create-api-client-modal.d.ts.map +1 -1
- package/dist/v2/features/modal/helpers/create-api-client-modal.js +11 -0
- package/dist/v2/features/modal/helpers/create-api-client-modal.js.map +1 -1
- package/package.json +19 -14
- package/dist/v2/features/command-palette/helpers/is-postman-collection.d.ts +0 -11
- package/dist/v2/features/command-palette/helpers/is-postman-collection.d.ts.map +0 -1
- package/dist/v2/features/command-palette/helpers/is-postman-collection.js +0 -24
- package/dist/v2/features/command-palette/helpers/is-postman-collection.js.map +0 -1
- package/dist/v2/posthog.d.ts +0 -3
- package/dist/v2/posthog.d.ts.map +0 -1
- package/dist/v2/posthog.js +0 -20
- package/dist/v2/posthog.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @scalar/api-client
|
|
2
2
|
|
|
3
|
+
## 3.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#8865](https://github.com/scalar/scalar/pull/8865): feat: add plugin support for custom response body content types
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- [#8810](https://github.com/scalar/scalar/pull/8810): refactor: move telemetry to an optional plugin
|
|
12
|
+
- [#8912](https://github.com/scalar/scalar/pull/8912): fix: provide a default summary when creating a new temp operation
|
|
13
|
+
- [#8903](https://github.com/scalar/scalar/pull/8903): fix: share Postman collection detection from postman-to-openapi
|
|
14
|
+
- [#8911](https://github.com/scalar/scalar/pull/8911): feat: switch from Request to RequestPayload to support body with GET
|
|
15
|
+
- [#8887](https://github.com/scalar/scalar/pull/8887): fix: invalid json body handling and add root document for bulk operation selection
|
|
16
|
+
|
|
3
17
|
## 3.0.0
|
|
4
18
|
|
|
5
19
|
### Major Changes
|
package/README.md
CHANGED
|
@@ -165,6 +165,47 @@ The `createApiClientModal` call returns:
|
|
|
165
165
|
```
|
|
166
166
|
|
|
167
167
|
|
|
168
|
+
## Plugins
|
|
169
|
+
|
|
170
|
+
The `plugins` option accepts an array of `ClientPlugin` objects that extend the API Client with custom behavior. Plugins can add lifecycle hooks, custom UI components, and custom response body handlers for content types that the client does not natively support.
|
|
171
|
+
|
|
172
|
+
### Custom Response Body Handling
|
|
173
|
+
|
|
174
|
+
When your API returns a non-standard content type (for example, MessagePack), you can register a plugin with a `responseBody` handler to decode and display it:
|
|
175
|
+
|
|
176
|
+
```ts
|
|
177
|
+
import type { ClientPlugin } from '@scalar/oas-utils/helpers'
|
|
178
|
+
|
|
179
|
+
const msgpackPlugin: ClientPlugin = {
|
|
180
|
+
responseBody: [
|
|
181
|
+
{
|
|
182
|
+
mimeTypes: ['application/msgpack', 'application/x-msgpack'],
|
|
183
|
+
decode: async (buffer) => {
|
|
184
|
+
const { decode } = await import('@msgpack/msgpack')
|
|
185
|
+
const decoded = decode(new Uint8Array(buffer))
|
|
186
|
+
return JSON.stringify(decoded, null, 2)
|
|
187
|
+
},
|
|
188
|
+
language: 'json',
|
|
189
|
+
},
|
|
190
|
+
],
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
createApiClientApp(el, {
|
|
194
|
+
layout: 'web',
|
|
195
|
+
plugins: [msgpackPlugin],
|
|
196
|
+
})
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
Each handler in `responseBody` supports:
|
|
200
|
+
|
|
201
|
+
| Property | Description |
|
|
202
|
+
|---|---|
|
|
203
|
+
| `mimeTypes` | MIME type patterns to match (exact or wildcard like `application/vnd.*+json`). |
|
|
204
|
+
| `decode` | Transforms the raw `ArrayBuffer` into a string or Blob for display. |
|
|
205
|
+
| `language` | CodeMirror language hint for the built-in raw renderer (for example, `json`). |
|
|
206
|
+
| `rawComponent` | A custom Vue component for the raw view (mutually exclusive with `language`). |
|
|
207
|
+
| `previewComponent` | A custom Vue component for the preview view. |
|
|
208
|
+
|
|
168
209
|
## Community
|
|
169
210
|
|
|
170
211
|
We are API nerds. You too? Let's chat on Discord: <https://discord.gg/scalar>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ClientPlugin } from '@scalar/oas-utils/helpers';
|
|
2
|
+
import type { ConfigDefaults } from 'posthog-js';
|
|
3
|
+
export type PostHogConfig = {
|
|
4
|
+
/** Your PostHog project API key */
|
|
5
|
+
apiKey: string;
|
|
6
|
+
/** The PostHog API host URL */
|
|
7
|
+
apiHost: string;
|
|
8
|
+
/** The PostHog UI host URL (for session recordings, surveys, etc.) */
|
|
9
|
+
uiHost?: string;
|
|
10
|
+
/** PostHog defaults version identifier */
|
|
11
|
+
defaults?: ConfigDefaults;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* PostHog analytics plugin for the API Client.
|
|
15
|
+
*
|
|
16
|
+
* Loading this plugin opts in to analytics. If the plugin is not loaded,
|
|
17
|
+
* no tracking occurs.
|
|
18
|
+
*
|
|
19
|
+
* Respects the `telemetry` configuration option — when set to `false`,
|
|
20
|
+
* capturing is disabled. Reacts dynamically to config changes at runtime.
|
|
21
|
+
*/
|
|
22
|
+
export declare const PostHogClientPlugin: (config: PostHogConfig) => ClientPlugin;
|
|
23
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/posthog/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAW,MAAM,YAAY,CAAA;AAGzD,MAAM,MAAM,aAAa,GAAG;IAC1B,mCAAmC;IACnC,MAAM,EAAE,MAAM,CAAA;IACd,+BAA+B;IAC/B,OAAO,EAAE,MAAM,CAAA;IACf,sEAAsE;IACtE,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,0CAA0C;IAC1C,QAAQ,CAAC,EAAE,cAAc,CAAA;CAC1B,CAAA;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,GAAI,QAAQ,aAAa,KAAG,YA4D3D,CAAA"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import ph from "posthog-js";
|
|
2
|
+
//#region src/plugins/posthog/index.ts
|
|
3
|
+
/**
|
|
4
|
+
* PostHog analytics plugin for the API Client.
|
|
5
|
+
*
|
|
6
|
+
* Loading this plugin opts in to analytics. If the plugin is not loaded,
|
|
7
|
+
* no tracking occurs.
|
|
8
|
+
*
|
|
9
|
+
* Respects the `telemetry` configuration option — when set to `false`,
|
|
10
|
+
* capturing is disabled. Reacts dynamically to config changes at runtime.
|
|
11
|
+
*/
|
|
12
|
+
var PostHogClientPlugin = (config) => {
|
|
13
|
+
let posthog = null;
|
|
14
|
+
return {
|
|
15
|
+
on: {
|
|
16
|
+
"hooks:on:request:sent": () => posthog?.capture("hooks:on:request:sent"),
|
|
17
|
+
"operation:create:operation": () => posthog?.capture("operation:create:operation"),
|
|
18
|
+
"operation:delete:operation": () => posthog?.capture("operation:delete:operation"),
|
|
19
|
+
"document:create:empty-document": () => posthog?.capture("document:create:empty-document"),
|
|
20
|
+
"document:delete:document": () => posthog?.capture("document:delete:document"),
|
|
21
|
+
"tag:create:tag": () => posthog?.capture("tag:create:tag"),
|
|
22
|
+
"server:add:server": () => posthog?.capture("server:add:server"),
|
|
23
|
+
"auth:update:selected-security-schemes": () => posthog?.capture("auth:update:selected-security-schemes"),
|
|
24
|
+
"environment:upsert:environment": () => posthog?.capture("environment:upsert:environment"),
|
|
25
|
+
"ui:open:client-modal": () => posthog?.capture("ui:open:client-modal"),
|
|
26
|
+
"ui:download:document": () => posthog?.capture("ui:download:document")
|
|
27
|
+
},
|
|
28
|
+
lifecycle: {
|
|
29
|
+
onInit(context) {
|
|
30
|
+
if (typeof window === "undefined") return;
|
|
31
|
+
const instance = ph.init(config.apiKey, {
|
|
32
|
+
api_host: config.apiHost,
|
|
33
|
+
...config.uiHost ? { ui_host: config.uiHost } : {},
|
|
34
|
+
...config.defaults ? { defaults: config.defaults } : {},
|
|
35
|
+
opt_out_capturing_by_default: true
|
|
36
|
+
}, "scalar-api-client");
|
|
37
|
+
if (instance) {
|
|
38
|
+
posthog = instance;
|
|
39
|
+
posthog.register({ product: "api-client" });
|
|
40
|
+
if (context?.config.telemetry !== false) posthog.opt_in_capturing();
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
onConfigChange(context) {
|
|
44
|
+
if (!posthog) return;
|
|
45
|
+
if (context.config.telemetry === false) posthog.opt_out_capturing();
|
|
46
|
+
else posthog.opt_in_capturing();
|
|
47
|
+
},
|
|
48
|
+
onDestroy() {
|
|
49
|
+
posthog?.reset();
|
|
50
|
+
posthog = null;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
//#endregion
|
|
56
|
+
export { PostHogClientPlugin };
|
|
57
|
+
|
|
58
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/plugins/posthog/index.ts"],"sourcesContent":["import type { ClientPlugin } from '@scalar/oas-utils/helpers'\nimport type { ConfigDefaults, PostHog } from 'posthog-js'\nimport ph from 'posthog-js'\n\nexport type PostHogConfig = {\n /** Your PostHog project API key */\n apiKey: string\n /** The PostHog API host URL */\n apiHost: string\n /** The PostHog UI host URL (for session recordings, surveys, etc.) */\n uiHost?: string\n /** PostHog defaults version identifier */\n defaults?: ConfigDefaults\n}\n\n/**\n * PostHog analytics plugin for the API Client.\n *\n * Loading this plugin opts in to analytics. If the plugin is not loaded,\n * no tracking occurs.\n *\n * Respects the `telemetry` configuration option — when set to `false`,\n * capturing is disabled. Reacts dynamically to config changes at runtime.\n */\nexport const PostHogClientPlugin = (config: PostHogConfig): ClientPlugin => {\n let posthog: PostHog | null = null\n\n return {\n on: {\n 'hooks:on:request:sent': () => posthog?.capture('hooks:on:request:sent'),\n 'operation:create:operation': () => posthog?.capture('operation:create:operation'),\n 'operation:delete:operation': () => posthog?.capture('operation:delete:operation'),\n 'document:create:empty-document': () => posthog?.capture('document:create:empty-document'),\n 'document:delete:document': () => posthog?.capture('document:delete:document'),\n 'tag:create:tag': () => posthog?.capture('tag:create:tag'),\n 'server:add:server': () => posthog?.capture('server:add:server'),\n 'auth:update:selected-security-schemes': () => posthog?.capture('auth:update:selected-security-schemes'),\n 'environment:upsert:environment': () => posthog?.capture('environment:upsert:environment'),\n 'ui:open:client-modal': () => posthog?.capture('ui:open:client-modal'),\n 'ui:download:document': () => posthog?.capture('ui:download:document'),\n },\n lifecycle: {\n onInit(context) {\n if (typeof window === 'undefined') {\n return\n }\n\n const instance = ph.init(\n config.apiKey,\n {\n api_host: config.apiHost,\n ...(config.uiHost ? { ui_host: config.uiHost } : {}),\n ...(config.defaults ? { defaults: config.defaults } : {}),\n opt_out_capturing_by_default: true,\n },\n 'scalar-api-client',\n )\n\n if (instance) {\n posthog = instance\n posthog.register({ product: 'api-client' })\n\n if (context?.config.telemetry !== false) {\n posthog.opt_in_capturing()\n }\n }\n },\n onConfigChange(context) {\n if (!posthog) {\n return\n }\n\n if (context.config.telemetry === false) {\n posthog.opt_out_capturing()\n } else {\n posthog.opt_in_capturing()\n }\n },\n onDestroy() {\n posthog?.reset()\n posthog = null\n },\n },\n }\n}\n"],"mappings":";;;;;;;;;;;AAwBA,IAAa,uBAAuB,WAAwC;CAC1E,IAAI,UAA0B;AAE9B,QAAO;EACL,IAAI;GACF,+BAA+B,SAAS,QAAQ,wBAAwB;GACxE,oCAAoC,SAAS,QAAQ,6BAA6B;GAClF,oCAAoC,SAAS,QAAQ,6BAA6B;GAClF,wCAAwC,SAAS,QAAQ,iCAAiC;GAC1F,kCAAkC,SAAS,QAAQ,2BAA2B;GAC9E,wBAAwB,SAAS,QAAQ,iBAAiB;GAC1D,2BAA2B,SAAS,QAAQ,oBAAoB;GAChE,+CAA+C,SAAS,QAAQ,wCAAwC;GACxG,wCAAwC,SAAS,QAAQ,iCAAiC;GAC1F,8BAA8B,SAAS,QAAQ,uBAAuB;GACtE,8BAA8B,SAAS,QAAQ,uBAAuB;GACvE;EACD,WAAW;GACT,OAAO,SAAS;AACd,QAAI,OAAO,WAAW,YACpB;IAGF,MAAM,WAAW,GAAG,KAClB,OAAO,QACP;KACE,UAAU,OAAO;KACjB,GAAI,OAAO,SAAS,EAAE,SAAS,OAAO,QAAQ,GAAG,EAAE;KACnD,GAAI,OAAO,WAAW,EAAE,UAAU,OAAO,UAAU,GAAG,EAAE;KACxD,8BAA8B;KAC/B,EACD,oBACD;AAED,QAAI,UAAU;AACZ,eAAU;AACV,aAAQ,SAAS,EAAE,SAAS,cAAc,CAAC;AAE3C,SAAI,SAAS,OAAO,cAAc,MAChC,SAAQ,kBAAkB;;;GAIhC,eAAe,SAAS;AACtB,QAAI,CAAC,QACH;AAGF,QAAI,QAAQ,OAAO,cAAc,MAC/B,SAAQ,mBAAmB;QAE3B,SAAQ,kBAAkB;;GAG9B,YAAY;AACV,aAAS,OAAO;AAChB,cAAU;;GAEb;EACF"}
|
package/dist/style.css
CHANGED
|
@@ -1010,8 +1010,8 @@
|
|
|
1010
1010
|
background-color: var(--scalar-sidebar-indent-border-hover, var(--scalar-border-color));
|
|
1011
1011
|
}
|
|
1012
1012
|
|
|
1013
|
-
.scalar-app .group-hover\/button\:text-c-1:is(:where(.group\/button):hover *) {
|
|
1014
|
-
color: var(--scalar-color-1);
|
|
1013
|
+
.scalar-app .group-hover\/button\:text-c-header-1:is(:where(.group\/button):hover *) {
|
|
1014
|
+
color: var(--scalar-header-color-1, var(--scalar-color-1));
|
|
1015
1015
|
}
|
|
1016
1016
|
|
|
1017
1017
|
.scalar-app .hover\:bg-b-2:hover {
|
|
@@ -1022,10 +1022,24 @@
|
|
|
1022
1022
|
background-color: var(--scalar-background-3);
|
|
1023
1023
|
}
|
|
1024
1024
|
|
|
1025
|
+
.scalar-app .hover\:bg-b-header-2:hover {
|
|
1026
|
+
background-color: var(--scalar-header-background-2, var(--scalar-background-2));
|
|
1027
|
+
}
|
|
1028
|
+
|
|
1025
1029
|
.scalar-app .hover\:bg-h-btn:hover {
|
|
1026
1030
|
background-color: var(--scalar-button-1-hover);
|
|
1027
1031
|
}
|
|
1028
1032
|
|
|
1033
|
+
.scalar-app .hover\:bg-h-header-cta:hover {
|
|
1034
|
+
background-color: var(--scalar-header-call-to-action-color, var(--scalar-button-1));
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1037
|
+
@supports (color: color-mix(in lab, red, red)) {
|
|
1038
|
+
.scalar-app .hover\:bg-h-header-cta:hover {
|
|
1039
|
+
background-color: color-mix(in srgb, var(--scalar-header-call-to-action-color, var(--scalar-button-1)), var(--scalar-header-background-1, var(--scalar-background-1)) 15%);
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1029
1043
|
.scalar-app .hover\:bg-sidebar-b-1:hover {
|
|
1030
1044
|
background-color: var(--scalar-sidebar-background-1, var(--scalar-background-1));
|
|
1031
1045
|
}
|
|
@@ -1066,6 +1080,10 @@
|
|
|
1066
1080
|
color: var(--scalar-color-1);
|
|
1067
1081
|
}
|
|
1068
1082
|
|
|
1083
|
+
.scalar-app .hover\:text-c-header-1:hover {
|
|
1084
|
+
color: var(--scalar-header-color-1, var(--scalar-color-1));
|
|
1085
|
+
}
|
|
1086
|
+
|
|
1069
1087
|
.scalar-app .hover\:text-sidebar-c-1:hover {
|
|
1070
1088
|
color: var(--scalar-sidebar-color-1, var(--scalar-color-1));
|
|
1071
1089
|
}
|
|
@@ -3441,6 +3459,10 @@
|
|
|
3441
3459
|
border-width: 1px;
|
|
3442
3460
|
}
|
|
3443
3461
|
|
|
3462
|
+
.scalar-app .border-border-header {
|
|
3463
|
+
border-color: var(--scalar-header-border-color, var(--scalar-border-color));
|
|
3464
|
+
}
|
|
3465
|
+
|
|
3444
3466
|
.scalar-app .border-c-alert {
|
|
3445
3467
|
border-color: var(--scalar-color-alert);
|
|
3446
3468
|
}
|
|
@@ -3483,6 +3505,14 @@
|
|
|
3483
3505
|
background-color: var(--scalar-button-1);
|
|
3484
3506
|
}
|
|
3485
3507
|
|
|
3508
|
+
.scalar-app .bg-b-header-1 {
|
|
3509
|
+
background-color: var(--scalar-header-background-1, var(--scalar-background-1));
|
|
3510
|
+
}
|
|
3511
|
+
|
|
3512
|
+
.scalar-app .bg-b-header-cta {
|
|
3513
|
+
background-color: var(--scalar-header-call-to-action-color, var(--scalar-button-1));
|
|
3514
|
+
}
|
|
3515
|
+
|
|
3486
3516
|
.scalar-app .bg-b-tooltip {
|
|
3487
3517
|
background-color: var(--scalar-tooltip-background);
|
|
3488
3518
|
}
|
|
@@ -3666,6 +3696,18 @@
|
|
|
3666
3696
|
overflow-wrap: break-word;
|
|
3667
3697
|
}
|
|
3668
3698
|
|
|
3699
|
+
.scalar-app .text-c-header-1 {
|
|
3700
|
+
color: var(--scalar-header-color-1, var(--scalar-color-1));
|
|
3701
|
+
}
|
|
3702
|
+
|
|
3703
|
+
.scalar-app .text-c-header-2 {
|
|
3704
|
+
color: var(--scalar-header-color-2, var(--scalar-color-2));
|
|
3705
|
+
}
|
|
3706
|
+
|
|
3707
|
+
.scalar-app .text-c-header-cta {
|
|
3708
|
+
color: var(--scalar-button-1-color);
|
|
3709
|
+
}
|
|
3710
|
+
|
|
3669
3711
|
.scalar-app .text-c-tooltip {
|
|
3670
3712
|
color: var(--scalar-tooltip-color);
|
|
3671
3713
|
}
|
|
@@ -3764,8 +3806,8 @@
|
|
|
3764
3806
|
justify-content: center;
|
|
3765
3807
|
}
|
|
3766
3808
|
|
|
3767
|
-
:is(.scalar-app .\*\:gap-
|
|
3768
|
-
gap:
|
|
3809
|
+
:is(.scalar-app .\*\:gap-1 > *) {
|
|
3810
|
+
gap: 4px;
|
|
3769
3811
|
}
|
|
3770
3812
|
|
|
3771
3813
|
:is(.scalar-app .\*\:rounded > *) {
|
|
@@ -3804,8 +3846,8 @@
|
|
|
3804
3846
|
background-color: var(--scalar-sidebar-indent-border-hover, var(--scalar-border-color));
|
|
3805
3847
|
}
|
|
3806
3848
|
|
|
3807
|
-
.scalar-app .group-hover\/button\:text-c-1:is(:where(.group\/button):hover *) {
|
|
3808
|
-
color: var(--scalar-color-1);
|
|
3849
|
+
.scalar-app .group-hover\/button\:text-c-header-1:is(:where(.group\/button):hover *) {
|
|
3850
|
+
color: var(--scalar-header-color-1, var(--scalar-color-1));
|
|
3809
3851
|
}
|
|
3810
3852
|
}
|
|
3811
3853
|
|
|
@@ -3881,10 +3923,24 @@
|
|
|
3881
3923
|
background-color: var(--scalar-background-3);
|
|
3882
3924
|
}
|
|
3883
3925
|
|
|
3926
|
+
.scalar-app .hover\:bg-b-header-2:hover {
|
|
3927
|
+
background-color: var(--scalar-header-background-2, var(--scalar-background-2));
|
|
3928
|
+
}
|
|
3929
|
+
|
|
3884
3930
|
.scalar-app .hover\:bg-h-btn:hover {
|
|
3885
3931
|
background-color: var(--scalar-button-1-hover);
|
|
3886
3932
|
}
|
|
3887
3933
|
|
|
3934
|
+
.scalar-app .hover\:bg-h-header-cta:hover {
|
|
3935
|
+
background-color: var(--scalar-header-call-to-action-color, var(--scalar-button-1));
|
|
3936
|
+
}
|
|
3937
|
+
|
|
3938
|
+
@supports (color: color-mix(in lab, red, red)) {
|
|
3939
|
+
.scalar-app .hover\:bg-h-header-cta:hover {
|
|
3940
|
+
background-color: color-mix(in srgb, var(--scalar-header-call-to-action-color, var(--scalar-button-1)), var(--scalar-header-background-1, var(--scalar-background-1)) 15%);
|
|
3941
|
+
}
|
|
3942
|
+
}
|
|
3943
|
+
|
|
3888
3944
|
.scalar-app .hover\:bg-sidebar-b-1:hover {
|
|
3889
3945
|
background-color: var(--scalar-sidebar-background-1, var(--scalar-background-1));
|
|
3890
3946
|
}
|
|
@@ -3925,6 +3981,10 @@
|
|
|
3925
3981
|
color: var(--scalar-color-1);
|
|
3926
3982
|
}
|
|
3927
3983
|
|
|
3984
|
+
.scalar-app .hover\:text-c-header-1:hover {
|
|
3985
|
+
color: var(--scalar-header-color-1, var(--scalar-color-1));
|
|
3986
|
+
}
|
|
3987
|
+
|
|
3928
3988
|
.scalar-app .hover\:text-sidebar-c-1:hover {
|
|
3929
3989
|
color: var(--scalar-sidebar-color-1, var(--scalar-color-1));
|
|
3930
3990
|
}
|
|
@@ -4711,6 +4771,10 @@
|
|
|
4711
4771
|
height: 68px;
|
|
4712
4772
|
}
|
|
4713
4773
|
|
|
4774
|
+
.scalar-app .h-\[300px\] {
|
|
4775
|
+
height: 300px;
|
|
4776
|
+
}
|
|
4777
|
+
|
|
4714
4778
|
.scalar-app .h-\[calc\(100\%_-_50px\)\] {
|
|
4715
4779
|
height: calc(100% - 50px);
|
|
4716
4780
|
}
|
|
@@ -4779,10 +4843,6 @@
|
|
|
4779
4843
|
max-height: 60svh;
|
|
4780
4844
|
}
|
|
4781
4845
|
|
|
4782
|
-
.scalar-app .max-h-\[300px\] {
|
|
4783
|
-
max-height: 300px;
|
|
4784
|
-
}
|
|
4785
|
-
|
|
4786
4846
|
.scalar-app .max-h-\[auto\] {
|
|
4787
4847
|
max-height: auto;
|
|
4788
4848
|
}
|
|
@@ -8092,7 +8152,7 @@ input[data-v-3157c3c7]::placeholder {
|
|
|
8092
8152
|
min-width: 100%;
|
|
8093
8153
|
}
|
|
8094
8154
|
|
|
8095
|
-
.scalar-code-block[data-v-
|
|
8155
|
+
.scalar-code-block[data-v-30c34ea4] .hljs * {
|
|
8096
8156
|
font-size: var(--scalar-small);
|
|
8097
8157
|
}
|
|
8098
8158
|
|
|
@@ -8165,11 +8225,11 @@ to {
|
|
|
8165
8225
|
opacity: 0;
|
|
8166
8226
|
}
|
|
8167
8227
|
|
|
8168
|
-
.animate-response-heading .response-heading[data-v-
|
|
8169
|
-
animation: push-response-
|
|
8228
|
+
.animate-response-heading .response-heading[data-v-82f4df98] {
|
|
8229
|
+
animation: push-response-82f4df98 0.2s ease-in-out forwards;
|
|
8170
8230
|
opacity: 1;
|
|
8171
8231
|
}
|
|
8172
|
-
@keyframes push-response-
|
|
8232
|
+
@keyframes push-response-82f4df98 {
|
|
8173
8233
|
from {
|
|
8174
8234
|
opacity: 1;
|
|
8175
8235
|
transform: translateY(0);
|
|
@@ -8179,11 +8239,11 @@ to {
|
|
|
8179
8239
|
transform: translateY(-4px);
|
|
8180
8240
|
}
|
|
8181
8241
|
}
|
|
8182
|
-
.animate-response-heading .animate-response-children[data-v-
|
|
8183
|
-
animation: response-spans-
|
|
8242
|
+
.animate-response-heading .animate-response-children[data-v-82f4df98] {
|
|
8243
|
+
animation: response-spans-82f4df98 0.2s ease-in-out forwards 0.05s;
|
|
8184
8244
|
opacity: 0;
|
|
8185
8245
|
}
|
|
8186
|
-
@keyframes response-spans-
|
|
8246
|
+
@keyframes response-spans-82f4df98 {
|
|
8187
8247
|
from {
|
|
8188
8248
|
opacity: 0;
|
|
8189
8249
|
transform: translateY(4px);
|
|
@@ -8812,7 +8872,7 @@ to {
|
|
|
8812
8872
|
display: none;
|
|
8813
8873
|
}
|
|
8814
8874
|
|
|
8815
|
-
.postman-import-path-conflict-callout[data-v-
|
|
8875
|
+
.postman-import-path-conflict-callout[data-v-cc4f666d] {
|
|
8816
8876
|
border-color: var(--scalar-color-red);
|
|
8817
8877
|
background-color: var(--scalar-background-danger);
|
|
8818
8878
|
color: var(--scalar-color-1);
|
|
@@ -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":"AA6fA,OAAO,KAAK,EAAE,UAAU,IAAI,cAAc,EAAE,MAAM,mCAAmC,CAAA;AACrF,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,EAE1B,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;AAqB5F,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAKrD;;;;;;;;;;;;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;IACxD,6CAA6C;IAC7C,OAAO,CAAC,EAAE,UAAU,CAAC,SAAS,CAAC,CAAA;CAChC,CAAA;AACD,QAAA,MAAM,YAAY,kTA6ed,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 /** 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 /** Subset of config options for the modal */\n options?: ModalProps['options']\n}\n</script>\n<script setup lang=\"ts\">\nimport { ERRORS } from '@scalar/helpers/errors/normalize-error'\nimport { isElectron } from '@scalar/helpers/general/is-electron'\nimport type { HttpMethod as HttpMethodType } from '@scalar/helpers/http/http-methods'\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, toValue, watch } from 'vue'\n\nimport ViewLayout from '@/components/ViewLayout/ViewLayout.vue'\nimport ViewLayoutContent from '@/components/ViewLayout/ViewLayoutContent.vue'\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 {\n sendRequest,\n type ResponseInstance,\n} 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'\nimport type { ModalProps } from '@/v2/features/modal/Modal.vue'\nimport type { ClientLayout } from '@/v2/types/layout'\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 options,\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 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 hooks\n eventBus.emit('hooks:on:request:sent', {\n meta: {\n method,\n path,\n exampleKey,\n },\n })\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 :options=\"toValue(options)\"\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 /** Subset of config options for the modal */\n options?: ModalProps['options']\n}\n</script>\n<script setup lang=\"ts\">\nimport { ERRORS } from '@scalar/helpers/errors/normalize-error'\nimport { isElectron } from '@scalar/helpers/general/is-electron'\nimport { buildSafeBodyRequest } from '@scalar/helpers/http/can-method-have-body'\nimport type { HttpMethod as HttpMethodType } from '@scalar/helpers/http/http-methods'\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 RequestPayload,\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, toValue, watch } from 'vue'\n\nimport ViewLayout from '@/components/ViewLayout/ViewLayout.vue'\nimport ViewLayoutContent from '@/components/ViewLayout/ViewLayoutContent.vue'\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 {\n sendRequest,\n type ResponseInstance,\n} 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'\nimport type { ModalProps } from '@/v2/features/modal/Modal.vue'\nimport type { ClientLayout } from '@/v2/types/layout'\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 options,\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 requestPayload = ref<RequestPayload | 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 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 hooks\n eventBus.emit('hooks:on:request:sent', {\n meta: {\n method,\n path,\n exampleKey,\n },\n })\n\n /** Execute the request */\n const [sendError, sendResult] = await sendRequest({\n isUsingProxy: requestResult.result.isUsingProxy,\n requestPayload: requestResult.result.requestPayload,\n plugins,\n })\n\n if (sendResult) {\n // Execute the responseReceived hook\n await executeHook(\n {\n response: sendResult.originalResponse.clone(),\n requestBuilder,\n request: buildSafeBodyRequest(...sendResult.requestPayload),\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 requestPayload: sendResult.requestPayload,\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 requestPayload.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 requestPayload.value = sendResult.requestPayload\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 requestPayload: sendResult.requestPayload,\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 requestPayload.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 requestPayload.value = cached.requestPayload\n } else {\n response.value = null\n requestPayload.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 :options=\"toValue(options)\"\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 :requestPayload\n :response\n :totalPerformedRequests=\"operationHistory.length\" />\n </ViewLayoutContent>\n </ViewLayout>\n </div>\n</template>\n"],"mappings":""}
|
|
@@ -12,6 +12,7 @@ import Header_default from "./components/Header.vue.js";
|
|
|
12
12
|
import { computed, createElementBlock, createElementVNode, createVNode, defineComponent, onBeforeUnmount, onMounted, openBlock, ref, toValue, unref, watch, withCtx } from "vue";
|
|
13
13
|
import { ERRORS } from "@scalar/helpers/errors/normalize-error";
|
|
14
14
|
import { isElectron } from "@scalar/helpers/general/is-electron";
|
|
15
|
+
import { buildSafeBodyRequest } from "@scalar/helpers/http/can-method-have-body";
|
|
15
16
|
import { executeHook } from "@scalar/oas-utils/helpers";
|
|
16
17
|
import { AVAILABLE_CLIENTS } from "@scalar/types/snippetz";
|
|
17
18
|
import { useToasts } from "@scalar/use-toasts";
|
|
@@ -62,7 +63,7 @@ var OperationBlock_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
|
|
|
62
63
|
const { toast } = useToasts();
|
|
63
64
|
const abortController = ref(null);
|
|
64
65
|
const response = ref(null);
|
|
65
|
-
const
|
|
66
|
+
const requestPayload = ref(null);
|
|
66
67
|
/** Cancel the request */
|
|
67
68
|
const cancelRequest = () => abortController.value?.abort(ERRORS.REQUEST_ABORTED);
|
|
68
69
|
/** Execute the current operation example */
|
|
@@ -124,12 +125,13 @@ var OperationBlock_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
|
|
|
124
125
|
/** Execute the request */
|
|
125
126
|
const [sendError, sendResult] = await sendRequest({
|
|
126
127
|
isUsingProxy: requestResult.result.isUsingProxy,
|
|
127
|
-
|
|
128
|
+
requestPayload: requestResult.result.requestPayload,
|
|
129
|
+
plugins: __props.plugins
|
|
128
130
|
});
|
|
129
131
|
if (sendResult) await executeHook({
|
|
130
132
|
response: sendResult.originalResponse.clone(),
|
|
131
133
|
requestBuilder,
|
|
132
|
-
request: sendResult.
|
|
134
|
+
request: buildSafeBodyRequest(...sendResult.requestPayload),
|
|
133
135
|
document: __props.document,
|
|
134
136
|
operation: __props.operation,
|
|
135
137
|
variablesStore
|
|
@@ -137,7 +139,7 @@ var OperationBlock_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
|
|
|
137
139
|
__props.eventBus.emit("hooks:on:request:complete", {
|
|
138
140
|
payload: sendResult ? {
|
|
139
141
|
response: sendResult.originalResponse.clone(),
|
|
140
|
-
|
|
142
|
+
requestPayload: sendResult.requestPayload,
|
|
141
143
|
duration: sendResult.response.duration,
|
|
142
144
|
timestamp: sendResult.timestamp
|
|
143
145
|
} : void 0,
|
|
@@ -149,16 +151,16 @@ var OperationBlock_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
|
|
|
149
151
|
});
|
|
150
152
|
if (sendError) {
|
|
151
153
|
response.value = null;
|
|
152
|
-
|
|
154
|
+
requestPayload.value = null;
|
|
153
155
|
abortController.value = null;
|
|
154
156
|
toast(sendError.message, "error");
|
|
155
157
|
return;
|
|
156
158
|
}
|
|
157
159
|
response.value = sendResult.response;
|
|
158
|
-
|
|
160
|
+
requestPayload.value = sendResult.requestPayload;
|
|
159
161
|
if (!isStreamingResponse(sendResult.response)) responseCache.set(getOperationExampleKey(__props.method, __props.path, __props.exampleKey), {
|
|
160
162
|
response: sendResult.response,
|
|
161
|
-
|
|
163
|
+
requestPayload: sendResult.requestPayload
|
|
162
164
|
});
|
|
163
165
|
};
|
|
164
166
|
onMounted(() => {
|
|
@@ -195,7 +197,7 @@ var OperationBlock_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
|
|
|
195
197
|
});
|
|
196
198
|
const fetchRequest = harToFetchRequest({ harRequest: historyItem.request });
|
|
197
199
|
response.value = fetchResponse;
|
|
198
|
-
|
|
200
|
+
requestPayload.value = fetchRequest;
|
|
199
201
|
}
|
|
200
202
|
});
|
|
201
203
|
__props.eventBus.emit("operation:reload:history", {
|
|
@@ -222,10 +224,10 @@ var OperationBlock_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
|
|
|
222
224
|
const cached = responseCache.get(newKey);
|
|
223
225
|
if (cached) {
|
|
224
226
|
response.value = cached.response;
|
|
225
|
-
|
|
227
|
+
requestPayload.value = cached.requestPayload;
|
|
226
228
|
} else {
|
|
227
229
|
response.value = null;
|
|
228
|
-
|
|
230
|
+
requestPayload.value = null;
|
|
229
231
|
}
|
|
230
232
|
cancelRequest();
|
|
231
233
|
}, { immediate: true });
|
|
@@ -320,7 +322,7 @@ var OperationBlock_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
|
|
|
320
322
|
eventBus: __props.eventBus,
|
|
321
323
|
layout: __props.layout,
|
|
322
324
|
plugins: __props.plugins,
|
|
323
|
-
|
|
325
|
+
requestPayload: requestPayload.value,
|
|
324
326
|
response: response.value,
|
|
325
327
|
totalPerformedRequests: operationHistory.value.length
|
|
326
328
|
}, null, 8, [
|
|
@@ -328,7 +330,7 @@ var OperationBlock_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
|
|
|
328
330
|
"eventBus",
|
|
329
331
|
"layout",
|
|
330
332
|
"plugins",
|
|
331
|
-
"
|
|
333
|
+
"requestPayload",
|
|
332
334
|
"response",
|
|
333
335
|
"totalPerformedRequests"
|
|
334
336
|
])]),
|