@scalar/api-client 2.20.2 → 2.21.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 +29 -0
- package/dist/style.css +1 -1
- package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/OperationBlock.vue.js +56 -59
- package/dist/v2/blocks/operation-block/helpers/build-request-parameters.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/helpers/build-request-parameters.js +52 -51
- package/dist/v2/blocks/operation-block/helpers/de-serialize-parameter.d.ts +4 -0
- package/dist/v2/blocks/operation-block/helpers/de-serialize-parameter.d.ts.map +1 -0
- package/dist/v2/blocks/operation-block/helpers/de-serialize-parameter.js +23 -0
- 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 +24 -23
- package/dist/v2/blocks/request-block/helpers/get-default-headers.js +1 -1
- package/dist/v2/blocks/response-block/ResponseBlock.vue.d.ts +2 -8
- package/dist/v2/blocks/response-block/ResponseBlock.vue.d.ts.map +1 -1
- package/dist/v2/blocks/response-block/ResponseBlock.vue.js +2 -2
- package/dist/v2/blocks/response-block/ResponseBlock.vue2.js +57 -60
- package/dist/v2/blocks/response-block/components/ResponseBodyStreaming.vue.d.ts.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBodyStreaming.vue.js +61 -41
- package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.d.ts +0 -3
- package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.d.ts.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.js +1 -1
- package/dist/v2/blocks/response-block/components/ResponseEmpty.vue2.js +31 -34
- package/dist/v2/blocks/response-block/components/ResponseLoadingOverlay.vue.d.ts +3 -3
- package/dist/v2/blocks/response-block/components/ResponseLoadingOverlay.vue.d.ts.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseLoadingOverlay.vue.js +2 -2
- package/dist/v2/blocks/response-block/components/ResponseLoadingOverlay.vue2.js +26 -20
- package/dist/v2/blocks/response-block/components/ResponseMetaInformation.vue.d.ts +4 -2
- package/dist/v2/blocks/response-block/components/ResponseMetaInformation.vue.d.ts.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseMetaInformation.vue.js +39 -33
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.js +2 -2
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue2.js +64 -64
- package/dist/v2/blocks/scalar-address-bar-block/hooks/use-loading-animation.d.ts +1 -0
- package/dist/v2/blocks/scalar-address-bar-block/hooks/use-loading-animation.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-address-bar-block/hooks/use-loading-animation.js +12 -11
- package/dist/v2/components/code-input/CodeInput.vue.d.ts +152 -95
- package/dist/v2/components/code-input/CodeInput.vue.d.ts.map +1 -1
- package/dist/v2/components/code-input/CodeInput.vue.js +2 -2
- package/dist/v2/components/code-input/CodeInput.vue2.js +87 -99
- package/dist/v2/features/operation/Operation.vue.js +1 -1
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
- package/package.json +12 -12
|
@@ -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":"AAmYA,OAAO,KAAK,EAAE,UAAU,IAAI,cAAc,EAAE,MAAM,mCAAmC,CAAA;AAErF,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,wBAAwB,CAAA;AAE/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AACpE,OAAO,KAAK,EACV,QAAQ,EACR,iBAAiB,EAClB,MAAM,gCAAgC,CAAA;AACvC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AACnH,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;AAS3C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4CAA4C,CAAA;AAGtF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kEAAkE,CAAA;AAK7G,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAKxD;;;;;;;;;;;;GAYG;;IAGD,gBAAgB;cACN,iBAAiB;IAC3B,gCAAgC;sBACd,eAAe,CAAC,UAAU,CAAC;IAC7C,iCAAiC;8BACP,eAAe,CAAC,4BAA4B,CAAC;IACvE,0BAA0B;gBACd,MAAM;IAClB,iCAAiC;mBAClB,oBAAoB,EAAE;IACrC,2BAA2B;UACrB,MAAM;IACZ,6BAA6B;YACrB,cAAc;IACtB,mBAAmB;iBACN,gBAAgB;IAC7B,oBAAoB;YACZ,YAAY;IACpB,gCAAgC;YACxB,YAAY,GAAG,IAAI;IAC3B,gCAAgC;oBAChB,cAAc,CAAC,WAAW,CAAC,CAAC,yBAAyB,CAAC;IACtE,mDAAmD;aAC1C,YAAY,EAAE;IACvB,4CAA4C;uBACzB,OAAO;IAC1B,0BAA0B;kBACZ,MAAM,GAAG,IAAI;IAC3B,mEAAmE;kBACrD,MAAM;IACpB,oBAAoB;aACX,SAAS,GAAG,eAAe;IACpC,uBAAuB;eACZ,eAAe;IAC1B,qDAAqD;0BAC/B,OAAO;IAC7B,+DAA+D;gBACnD,MAAM;IAClB,2CAA2C;cACjC,QAAQ;IAClB,wCAAwC;qBACvB,qBAAqB;IACtC,qBAAqB;aACZ,YAAY,EAAE;IACvB,8CAA8C;iBACjC,kBAAkB;IAC/B,yCAAyC;cAC/B,MAAM;;;;IA/ChB,gBAAgB;cACN,iBAAiB;IAC3B,gCAAgC;sBACd,eAAe,CAAC,UAAU,CAAC;IAC7C,iCAAiC;8BACP,eAAe,CAAC,4BAA4B,CAAC;IACvE,0BAA0B;gBACd,MAAM;IAClB,iCAAiC;mBAClB,oBAAoB,EAAE;IACrC,2BAA2B;UACrB,MAAM;IACZ,6BAA6B;YACrB,cAAc;IACtB,mBAAmB;iBACN,gBAAgB;IAC7B,oBAAoB;YACZ,YAAY;IACpB,gCAAgC;YACxB,YAAY,GAAG,IAAI;IAC3B,gCAAgC;oBAChB,cAAc,CAAC,WAAW,CAAC,CAAC,yBAAyB,CAAC;IACtE,mDAAmD;aAC1C,YAAY,EAAE;IACvB,4CAA4C;uBACzB,OAAO;IAC1B,0BAA0B;kBACZ,MAAM,GAAG,IAAI;IAC3B,mEAAmE;kBACrD,MAAM;IACpB,oBAAoB;aACX,SAAS,GAAG,eAAe;IACpC,uBAAuB;eACZ,eAAe;IAC1B,qDAAqD;0BAC/B,OAAO;IAC7B,+DAA+D;gBACnD,MAAM;IAClB,2CAA2C;cACjC,QAAQ;IAClB,wCAAwC;qBACvB,qBAAqB;IACtC,qBAAqB;aACZ,YAAY,EAAE;IACvB,8CAA8C;iBACjC,kBAAkB;IAC/B,yCAAyC;cAC/B,MAAM;;;;AAjDlB,wBA2dC"}
|
|
@@ -1,25 +1,24 @@
|
|
|
1
|
-
import { defineComponent as K, computed as
|
|
1
|
+
import { defineComponent as K, computed as l, ref as m, onMounted as O, onBeforeUnmount as S, watch as V, createElementBlock as w, openBlock as T, createElementVNode as I, createVNode as u, withCtx as g, unref as B } from "vue";
|
|
2
2
|
import { AVAILABLE_CLIENTS as M } from "@scalar/types/snippetz";
|
|
3
3
|
import { useToasts as A } from "@scalar/use-toasts";
|
|
4
4
|
import L from "../../../components/ViewLayout/ViewLayout.vue.js";
|
|
5
5
|
import N from "../../../components/ViewLayout/ViewLayoutContent.vue.js";
|
|
6
6
|
import { ERRORS as P } from "../../../libs/errors.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
13
|
-
import z from "
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import
|
|
17
|
-
import X from "../
|
|
18
|
-
|
|
19
|
-
const Z = { class: "bg-b-1 flex h-full flex-col" }, p = { class: "lg:min-h-header flex w-full flex-wrap items-center justify-center p-2 lg:p-0" }, _ = {
|
|
7
|
+
import { buildRequest as H } from "./helpers/build-request.js";
|
|
8
|
+
import { getSecuritySchemes as F } from "./helpers/build-request-security.js";
|
|
9
|
+
import { harToFetchRequest as $ } from "./helpers/har-to-fetch-request.js";
|
|
10
|
+
import { harToFetchResponse as j } from "./helpers/har-to-fetch-response.js";
|
|
11
|
+
import { sendRequest as D } from "./helpers/send-request.js";
|
|
12
|
+
import Q from "./components/Header.vue.js";
|
|
13
|
+
import { generateClientOptions as z } from "../operation-code-sample/helpers/generate-client-options.js";
|
|
14
|
+
import { getSecurityRequirements as G } from "../../features/operation/helpers/get-security-requirements.js";
|
|
15
|
+
import { getSelectedSecurity as J } from "../../features/operation/helpers/get-selected-security.js";
|
|
16
|
+
import W from "../request-block/RequestBlock.vue.js";
|
|
17
|
+
import X from "../response-block/ResponseBlock.vue.js";
|
|
18
|
+
const Y = { class: "bg-b-1 flex h-full flex-col" }, Z = { class: "lg:min-h-header flex w-full flex-wrap items-center justify-center p-2 lg:p-0" }, p = {
|
|
20
19
|
name: "OperationBlock"
|
|
21
|
-
},
|
|
22
|
-
...
|
|
20
|
+
}, fe = /* @__PURE__ */ K({
|
|
21
|
+
...p,
|
|
23
22
|
props: {
|
|
24
23
|
eventBus: {},
|
|
25
24
|
documentSecurity: {},
|
|
@@ -47,42 +46,42 @@ const Z = { class: "bg-b-1 flex h-full flex-col" }, p = { class: "lg:min-h-heade
|
|
|
47
46
|
proxyUrl: {}
|
|
48
47
|
},
|
|
49
48
|
emits: ["update:servers"],
|
|
50
|
-
setup(e, { emit:
|
|
51
|
-
const R =
|
|
52
|
-
() =>
|
|
53
|
-
),
|
|
54
|
-
() =>
|
|
49
|
+
setup(e, { emit: q }) {
|
|
50
|
+
const R = q, C = l(() => z(e.httpClients)), d = l(
|
|
51
|
+
() => G(e.documentSecurity, e.operation.security)
|
|
52
|
+
), h = l(
|
|
53
|
+
() => J(
|
|
55
54
|
e.documentSelectedSecurity,
|
|
56
55
|
e.operation["x-scalar-selected-security"],
|
|
57
|
-
|
|
56
|
+
d.value,
|
|
58
57
|
e.setOperationSecurity
|
|
59
58
|
)
|
|
60
|
-
),
|
|
61
|
-
() =>
|
|
62
|
-
), { toast:
|
|
63
|
-
const [t, n] =
|
|
59
|
+
), v = l(
|
|
60
|
+
() => F(e.securitySchemes, h.value.selectedSchemes)
|
|
61
|
+
), { toast: y } = A(), f = m(null), a = m(null), s = m(null), i = () => f.value?.abort(P.REQUEST_ABORTED), c = async () => {
|
|
62
|
+
const [t, n] = H({
|
|
64
63
|
environment: e.environment,
|
|
65
64
|
exampleKey: e.exampleKey,
|
|
66
65
|
globalCookies: e.globalCookies,
|
|
67
66
|
method: e.method,
|
|
68
67
|
operation: e.operation,
|
|
69
68
|
path: e.path,
|
|
70
|
-
selectedSecuritySchemes:
|
|
69
|
+
selectedSecuritySchemes: v.value,
|
|
71
70
|
server: e.server,
|
|
72
71
|
proxyUrl: e.proxyUrl
|
|
73
72
|
});
|
|
74
73
|
if (t) {
|
|
75
|
-
|
|
74
|
+
y(t.message, "error");
|
|
76
75
|
return;
|
|
77
76
|
}
|
|
78
|
-
|
|
77
|
+
f.value = n.controller, a.value && "reader" in a.value && a.value.reader.cancel(), e.eventBus.emit("hooks:on:request:sent", {
|
|
79
78
|
meta: {
|
|
80
79
|
method: e.method,
|
|
81
80
|
path: e.path,
|
|
82
81
|
exampleKey: e.exampleKey
|
|
83
82
|
}
|
|
84
83
|
});
|
|
85
|
-
const [o, r] = await
|
|
84
|
+
const [o, r] = await D({
|
|
86
85
|
isUsingProxy: n.isUsingProxy,
|
|
87
86
|
operation: e.operation,
|
|
88
87
|
plugins: e.plugins,
|
|
@@ -101,17 +100,17 @@ const Z = { class: "bg-b-1 flex h-full flex-col" }, p = { class: "lg:min-h-heade
|
|
|
101
100
|
exampleKey: e.exampleKey
|
|
102
101
|
}
|
|
103
102
|
}), o) {
|
|
104
|
-
|
|
103
|
+
y(o.message, "error");
|
|
105
104
|
return;
|
|
106
105
|
}
|
|
107
|
-
|
|
106
|
+
a.value = r.response, s.value = r.request;
|
|
108
107
|
};
|
|
109
108
|
O(() => {
|
|
110
109
|
e.eventBus.on("operation:send:request:hotkey", c), e.eventBus.on("operation:cancel:request", i);
|
|
111
|
-
}),
|
|
110
|
+
}), S(() => {
|
|
112
111
|
e.eventBus.off("operation:send:request:hotkey", c), e.eventBus.off("operation:cancel:request", i);
|
|
113
112
|
});
|
|
114
|
-
const
|
|
113
|
+
const x = l(
|
|
115
114
|
() => (e.operation["x-scalar-history"] ?? []).map((t) => ({
|
|
116
115
|
method: t.request.method,
|
|
117
116
|
path: t.request.url,
|
|
@@ -127,16 +126,16 @@ const Z = { class: "bg-b-1 flex h-full flex-col" }, p = { class: "lg:min-h-heade
|
|
|
127
126
|
callback: async (U) => {
|
|
128
127
|
if (U === "error")
|
|
129
128
|
return;
|
|
130
|
-
const b =
|
|
129
|
+
const b = j({
|
|
131
130
|
harResponse: o.response,
|
|
132
131
|
url: o.request.url,
|
|
133
132
|
method: e.method,
|
|
134
133
|
path: e.path,
|
|
135
134
|
duration: o.time
|
|
136
|
-
}), E =
|
|
135
|
+
}), E = $({
|
|
137
136
|
harRequest: o.request
|
|
138
137
|
});
|
|
139
|
-
|
|
138
|
+
a.value = b, s.value = E;
|
|
140
139
|
}
|
|
141
140
|
});
|
|
142
141
|
e.eventBus.emit("operation:reload:history", {
|
|
@@ -149,17 +148,17 @@ const Z = { class: "bg-b-1 flex h-full flex-col" }, p = { class: "lg:min-h-heade
|
|
|
149
148
|
});
|
|
150
149
|
};
|
|
151
150
|
return V([() => e.path, () => e.method, () => e.exampleKey], () => {
|
|
152
|
-
|
|
153
|
-
}),
|
|
151
|
+
a.value = null, s.value = null, i();
|
|
152
|
+
}), S(() => {
|
|
154
153
|
i();
|
|
155
|
-
}), (t, n) => (T(), w("div",
|
|
156
|
-
I("div",
|
|
157
|
-
|
|
154
|
+
}), (t, n) => (T(), w("div", Y, [
|
|
155
|
+
I("div", Z, [
|
|
156
|
+
u(Q, {
|
|
158
157
|
documentUrl: e.documentUrl,
|
|
159
158
|
environment: e.environment,
|
|
160
159
|
eventBus: e.eventBus,
|
|
161
160
|
hideClientButton: e.hideClientButton,
|
|
162
|
-
history:
|
|
161
|
+
history: x.value,
|
|
163
162
|
integration: e.integration,
|
|
164
163
|
layout: e.layout,
|
|
165
164
|
method: e.method,
|
|
@@ -172,11 +171,11 @@ const Z = { class: "bg-b-1 flex h-full flex-col" }, p = { class: "lg:min-h-heade
|
|
|
172
171
|
"onUpdate:servers": n[0] || (n[0] = (o) => R("update:servers"))
|
|
173
172
|
}, null, 8, ["documentUrl", "environment", "eventBus", "hideClientButton", "history", "integration", "layout", "method", "path", "server", "servers", "source"])
|
|
174
173
|
]),
|
|
175
|
-
|
|
176
|
-
default:
|
|
177
|
-
|
|
178
|
-
default:
|
|
179
|
-
|
|
174
|
+
u(L, { class: "border-t" }, {
|
|
175
|
+
default: g(() => [
|
|
176
|
+
u(N, { class: "flex-1" }, {
|
|
177
|
+
default: g(() => [
|
|
178
|
+
u(B(W), {
|
|
180
179
|
authMeta: e.authMeta,
|
|
181
180
|
clientOptions: C.value,
|
|
182
181
|
environment: e.environment,
|
|
@@ -189,24 +188,22 @@ const Z = { class: "bg-b-1 flex h-full flex-col" }, p = { class: "lg:min-h-heade
|
|
|
189
188
|
path: e.path,
|
|
190
189
|
plugins: e.plugins,
|
|
191
190
|
proxyUrl: e.proxyUrl,
|
|
192
|
-
securityRequirements:
|
|
191
|
+
securityRequirements: d.value,
|
|
193
192
|
securitySchemes: e.securitySchemes,
|
|
194
193
|
selectedClient: e.selectedClient,
|
|
195
|
-
selectedSecurity:
|
|
196
|
-
selectedSecuritySchemes:
|
|
194
|
+
selectedSecurity: h.value,
|
|
195
|
+
selectedSecuritySchemes: v.value,
|
|
197
196
|
server: e.server
|
|
198
197
|
}, null, 8, ["authMeta", "clientOptions", "environment", "eventBus", "exampleKey", "globalCookies", "layout", "method", "operation", "path", "plugins", "proxyUrl", "securityRequirements", "securitySchemes", "selectedClient", "selectedSecurity", "selectedSecuritySchemes", "server"]),
|
|
199
|
-
|
|
198
|
+
u(B(X), {
|
|
200
199
|
appVersion: e.appVersion,
|
|
201
200
|
eventBus: e.eventBus,
|
|
202
|
-
events: d(H)(),
|
|
203
201
|
layout: e.layout,
|
|
204
202
|
plugins: e.plugins,
|
|
205
|
-
request:
|
|
206
|
-
response:
|
|
207
|
-
totalPerformedRequests:
|
|
208
|
-
|
|
209
|
-
}, null, 8, ["appVersion", "eventBus", "events", "layout", "plugins", "request", "response", "totalPerformedRequests"])
|
|
203
|
+
request: s.value,
|
|
204
|
+
response: a.value,
|
|
205
|
+
totalPerformedRequests: x.value.length
|
|
206
|
+
}, null, 8, ["appVersion", "eventBus", "layout", "plugins", "request", "response", "totalPerformedRequests"])
|
|
210
207
|
]),
|
|
211
208
|
_: 1
|
|
212
209
|
})
|
|
@@ -217,5 +214,5 @@ const Z = { class: "bg-b-1 flex h-full flex-col" }, p = { class: "lg:min-h-heade
|
|
|
217
214
|
}
|
|
218
215
|
});
|
|
219
216
|
export {
|
|
220
|
-
|
|
217
|
+
fe as default
|
|
221
218
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-request-parameters.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/build-request-parameters.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,aAAa,EAEnB,MAAM,qEAAqE,CAAA;AAE5E,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,8DAA8D,CAAA;
|
|
1
|
+
{"version":3,"file":"build-request-parameters.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/build-request-parameters.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,aAAa,EAEnB,MAAM,qEAAqE,CAAA;AAE5E,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,8DAA8D,CAAA;AAoBlH;;;;;;;;;;GAUG;AACH,eAAO,MAAM,sBAAsB;AACjC,qBAAqB;AACrB,aAAY,aAAa,CAAC,eAAe,CAAC,EAAO;AACjD,8DAA8D;AAC9D,MAAK,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM;AAChC,qCAAqC;AACrC,aAAY,MAAkB,KAC7B;IACD,OAAO,EAAE,aAAa,EAAE,CAAA;IACxB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC/B,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACrC,SAAS,EAAE,eAAe,CAAA;CAiF3B,CAAA"}
|
|
@@ -1,105 +1,106 @@
|
|
|
1
1
|
import { isDefined as k } from "@scalar/helpers/array/is-defined";
|
|
2
|
-
import { replaceEnvVariables as
|
|
3
|
-
import { getResolvedRef as
|
|
4
|
-
import { xScalarCookieSchema as
|
|
5
|
-
import { coerceValue as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
2
|
+
import { replaceEnvVariables as u } from "@scalar/helpers/regex/replace-variables";
|
|
3
|
+
import { getResolvedRef as z } from "@scalar/workspace-store/helpers/get-resolved-ref";
|
|
4
|
+
import { xScalarCookieSchema as S } from "@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies";
|
|
5
|
+
import { coerceValue as m } from "@scalar/workspace-store/schemas/typebox-coerce";
|
|
6
|
+
import { deSerializeParameter as g } from "./de-serialize-parameter.js";
|
|
7
|
+
import { isParamDisabled as b } from "../../request-block/helpers/is-param-disabled.js";
|
|
8
|
+
import { getExample as x } from "./get-example.js";
|
|
9
|
+
import { serializeSimpleStyle as h, serializeFormStyleForCookies as v, serializeContentValue as C, serializeDeepObjectStyle as D, serializeSpaceDelimitedStyle as P, serializePipeDelimitedStyle as V, serializeFormStyle as $ } from "./serialize-parameter.js";
|
|
10
|
+
const d = (t, r) => "explode" in t && t.explode !== void 0 ? t.explode : r, Q = (t = [], r = {}, l = "default") => {
|
|
10
11
|
const e = {
|
|
11
12
|
cookies: [],
|
|
12
13
|
headers: {},
|
|
13
14
|
pathVariables: {},
|
|
14
15
|
urlParams: new URLSearchParams()
|
|
15
16
|
};
|
|
16
|
-
if (
|
|
17
|
+
if (t.length === 0)
|
|
17
18
|
return e;
|
|
18
|
-
for (const c of
|
|
19
|
-
const
|
|
20
|
-
if (!n ||
|
|
19
|
+
for (const c of t) {
|
|
20
|
+
const o = z(c), n = x(o, l, void 0);
|
|
21
|
+
if (!n || b(o, n))
|
|
21
22
|
continue;
|
|
22
|
-
const
|
|
23
|
-
switch (
|
|
23
|
+
const s = typeof n.value == "string" ? u(n.value, r) : n.value, i = g(s, o), a = u(o.name, r);
|
|
24
|
+
switch (o.in) {
|
|
24
25
|
case "header": {
|
|
25
|
-
if (
|
|
26
|
+
if (a.toLowerCase() === "content-type" && i === "multipart/form-data")
|
|
26
27
|
break;
|
|
27
|
-
const
|
|
28
|
-
if (!k(
|
|
28
|
+
const p = h(i, d(o, !1));
|
|
29
|
+
if (!k(p))
|
|
29
30
|
break;
|
|
30
|
-
const
|
|
31
|
-
e.headers[
|
|
31
|
+
const y = String(p);
|
|
32
|
+
e.headers[a] ? e.headers[a] = `${e.headers[a]},${y}` : e.headers[a] = y;
|
|
32
33
|
break;
|
|
33
34
|
}
|
|
34
35
|
case "path": {
|
|
35
|
-
const
|
|
36
|
-
e.pathVariables[
|
|
36
|
+
const f = h(i, d(o, !1));
|
|
37
|
+
e.pathVariables[a] = encodeURIComponent(String(f));
|
|
37
38
|
break;
|
|
38
39
|
}
|
|
39
40
|
case "query": {
|
|
40
|
-
w(
|
|
41
|
+
w(o, a, i, e.urlParams);
|
|
41
42
|
break;
|
|
42
43
|
}
|
|
43
44
|
case "cookie": {
|
|
44
|
-
|
|
45
|
+
R(a, i, d(o, !0), e.cookies);
|
|
45
46
|
break;
|
|
46
47
|
}
|
|
47
48
|
}
|
|
48
49
|
}
|
|
49
50
|
return e;
|
|
50
|
-
}, w = (
|
|
51
|
-
const c = "explode" in
|
|
52
|
-
if ("content" in
|
|
53
|
-
const
|
|
54
|
-
e.set(
|
|
51
|
+
}, w = (t, r, l, e) => {
|
|
52
|
+
const c = "explode" in t && t.explode !== void 0 ? t.explode : !0, o = "style" in t && t.style ? t.style : "form";
|
|
53
|
+
if ("content" in t && t.content) {
|
|
54
|
+
const s = Object.keys(t.content)[0] ?? "application/json", i = C(l, s);
|
|
55
|
+
e.set(r, i);
|
|
55
56
|
return;
|
|
56
57
|
}
|
|
57
|
-
if (
|
|
58
|
-
const
|
|
59
|
-
for (const
|
|
60
|
-
e.append(
|
|
58
|
+
if (o === "deepObject" && c) {
|
|
59
|
+
const s = D(r, l);
|
|
60
|
+
for (const i of s)
|
|
61
|
+
e.append(i.key, i.value);
|
|
61
62
|
return;
|
|
62
63
|
}
|
|
63
|
-
if (
|
|
64
|
-
const
|
|
65
|
-
e.set(
|
|
64
|
+
if (o === "spaceDelimited") {
|
|
65
|
+
const s = P(l), i = e.get(r);
|
|
66
|
+
e.set(r, i ? `${i} ${s}` : s);
|
|
66
67
|
return;
|
|
67
68
|
}
|
|
68
|
-
if (
|
|
69
|
-
const
|
|
70
|
-
e.set(
|
|
69
|
+
if (o === "pipeDelimited") {
|
|
70
|
+
const s = V(l), i = e.get(r);
|
|
71
|
+
e.set(r, i ? `${i}|${s}` : s);
|
|
71
72
|
return;
|
|
72
73
|
}
|
|
73
74
|
const n = $(l, c);
|
|
74
75
|
if (Array.isArray(n))
|
|
75
|
-
for (const
|
|
76
|
-
const
|
|
77
|
-
e.append(
|
|
76
|
+
for (const s of n) {
|
|
77
|
+
const i = s.key || r;
|
|
78
|
+
e.append(i, String(s.value));
|
|
78
79
|
}
|
|
79
80
|
else
|
|
80
|
-
e.append(
|
|
81
|
-
},
|
|
82
|
-
const c =
|
|
81
|
+
e.append(r, String(n));
|
|
82
|
+
}, R = (t, r, l, e) => {
|
|
83
|
+
const c = v(r, l);
|
|
83
84
|
if (Array.isArray(c))
|
|
84
|
-
for (const
|
|
85
|
-
const n =
|
|
85
|
+
for (const o of c) {
|
|
86
|
+
const n = o.key || t;
|
|
86
87
|
e.push(
|
|
87
|
-
S
|
|
88
|
+
m(S, {
|
|
88
89
|
name: n,
|
|
89
|
-
value: String(
|
|
90
|
+
value: String(o.value),
|
|
90
91
|
path: "/"
|
|
91
92
|
})
|
|
92
93
|
);
|
|
93
94
|
}
|
|
94
95
|
else
|
|
95
96
|
e.push(
|
|
96
|
-
S
|
|
97
|
-
name:
|
|
97
|
+
m(S, {
|
|
98
|
+
name: t,
|
|
98
99
|
value: String(c),
|
|
99
100
|
path: "/"
|
|
100
101
|
})
|
|
101
102
|
);
|
|
102
103
|
};
|
|
103
104
|
export {
|
|
104
|
-
|
|
105
|
+
Q as buildRequestParameters
|
|
105
106
|
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ParameterObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
|
|
2
|
+
/** Helper that de-serializes the example value based on the parameter type */
|
|
3
|
+
export declare const deSerializeParameter: (example: unknown, param: ParameterObject) => any;
|
|
4
|
+
//# sourceMappingURL=de-serialize-parameter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"de-serialize-parameter.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/de-serialize-parameter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,eAAe,EAEhB,MAAM,8DAA8D,CAAA;AAErE,8EAA8E;AAC9E,eAAO,MAAM,oBAAoB,GAAI,SAAS,OAAO,EAAE,OAAO,eAAe,QAS5E,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { getResolvedRef as s } from "@scalar/workspace-store/helpers/get-resolved-ref";
|
|
2
|
+
const a = (e, t) => "content" in t ? i(e, Object.keys(t.content ?? {})[0] ?? "") : "schema" in t ? c(e, t.schema) : e, i = (e, t) => {
|
|
3
|
+
if (typeof e == "string" && t.includes("json"))
|
|
4
|
+
try {
|
|
5
|
+
return JSON.parse(e);
|
|
6
|
+
} catch {
|
|
7
|
+
}
|
|
8
|
+
return e;
|
|
9
|
+
}, o = /* @__PURE__ */ new Set(["array", "object", "boolean", "number", "integer", "null"]), c = (e, t) => {
|
|
10
|
+
const r = s(t);
|
|
11
|
+
if (typeof e == "string" && r && "type" in r) {
|
|
12
|
+
const n = Array.isArray(r.type) ? r.type[0] : r.type;
|
|
13
|
+
if (n && o.has(n))
|
|
14
|
+
try {
|
|
15
|
+
return JSON.parse(e);
|
|
16
|
+
} catch {
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return e;
|
|
20
|
+
};
|
|
21
|
+
export {
|
|
22
|
+
a as deSerializeParameter
|
|
23
|
+
};
|
package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-parameters.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process-parameters.d.ts","sourceRoot":"","sources":["../../../../../../src/v2/blocks/operation-code-sample/helpers/operation-to-har/process-parameters.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAmB,MAAM,8DAA8D,CAAA;AAEpH,OAAO,KAAK,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"process-parameters.d.ts","sourceRoot":"","sources":["../../../../../../src/v2/blocks/operation-code-sample/helpers/operation-to-har/process-parameters.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAmB,MAAM,8DAA8D,CAAA;AAEpH,OAAO,KAAK,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,YAAY,CAAA;AAevD,KAAK,mBAAmB,GAAG;IACzB,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,EAAE,UAAU,CAAC,SAAS,CAAC,CAAA;IAC9B,WAAW,EAAE,UAAU,CAAC,aAAa,CAAC,CAAA;IACtC,OAAO,EAAE,UAAU,CAAC,SAAS,CAAC,CAAA;CAC/B,CAAA;AAuED;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,GAAI,sCAI/B;IACD,UAAU,EAAE,UAAU,CAAA;IACtB,UAAU,EAAE,eAAe,CAAC,YAAY,CAAC,CAAA;IACzC,qCAAqC;IACrC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAC7B,KAAG,mBAuHH,CAAA"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { getResolvedRef as m } from "@scalar/workspace-store/helpers/get-resolved-ref";
|
|
2
|
-
import { getExampleFromSchema as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
2
|
+
import { getExampleFromSchema as S } from "../get-example-from-schema.js";
|
|
3
|
+
import { deSerializeParameter as k } from "../../../operation-block/helpers/de-serialize-parameter.js";
|
|
4
|
+
import { getExample as b } from "../../../operation-block/helpers/get-example.js";
|
|
5
|
+
import { serializeFormStyleForCookies as h, serializeSimpleStyle as v, serializeContentValue as p, serializeDeepObjectStyle as x, serializePipeDelimitedStyle as j, serializeSpaceDelimitedStyle as g, serializeFormStyle as z } from "../../../operation-block/helpers/serialize-parameter.js";
|
|
6
|
+
import { isParamDisabled as A } from "../../../request-block/helpers/is-param-disabled.js";
|
|
7
|
+
const P = (e) => (e ?? []).map((t) => m(t)), O = (e) => {
|
|
7
8
|
if (e.in === "header")
|
|
8
9
|
return { style: "simple", explode: "explode" in e && e.explode !== void 0 ? e.explode : !1 };
|
|
9
10
|
if (e.in === "cookie")
|
|
@@ -15,45 +16,45 @@ const A = (e) => (e ?? []).map((t) => m(t)), P = (e) => {
|
|
|
15
16
|
cookie: "form"
|
|
16
17
|
}[e.in], n = "style" in e && e.style ? e.style : t, d = "explode" in e && e.explode !== void 0 ? e.explode : n === "form";
|
|
17
18
|
return { style: n, explode: d };
|
|
18
|
-
},
|
|
19
|
-
const d =
|
|
20
|
-
if (
|
|
19
|
+
}, w = (e, t, n) => {
|
|
20
|
+
const d = b(e, t, n);
|
|
21
|
+
if (A(e, d))
|
|
21
22
|
return;
|
|
22
23
|
if (d?.value !== void 0)
|
|
23
|
-
return d.value;
|
|
24
|
+
return k(d.value, e);
|
|
24
25
|
if (!("schema" in e) || !e.schema)
|
|
25
26
|
return;
|
|
26
27
|
const s = e.in === "path" ? { emptyString: `{${e.name}}` } : {};
|
|
27
|
-
return
|
|
28
|
-
},
|
|
28
|
+
return S(m(e.schema), s);
|
|
29
|
+
}, U = ({
|
|
29
30
|
harRequest: e,
|
|
30
31
|
parameters: t,
|
|
31
32
|
example: n
|
|
32
33
|
}) => {
|
|
33
34
|
const d = [...e.headers], s = [...e.queryString];
|
|
34
35
|
let r = e.url;
|
|
35
|
-
const l =
|
|
36
|
+
const l = P(t);
|
|
36
37
|
for (const i of l) {
|
|
37
38
|
if (!i.in || !i.name)
|
|
38
39
|
continue;
|
|
39
|
-
const f =
|
|
40
|
+
const f = w(i, n, void 0);
|
|
40
41
|
if (f === void 0)
|
|
41
42
|
continue;
|
|
42
|
-
const { style: u, explode: y } =
|
|
43
|
+
const { style: u, explode: y } = O(i);
|
|
43
44
|
switch (i.in) {
|
|
44
45
|
case "path": {
|
|
45
|
-
r =
|
|
46
|
+
r = D(r, i, f, u, y);
|
|
46
47
|
break;
|
|
47
48
|
}
|
|
48
49
|
case "query": {
|
|
49
50
|
if ("content" in i && i.content) {
|
|
50
|
-
const o = Object.keys(i.content)[0] ?? "application/json", c =
|
|
51
|
+
const o = Object.keys(i.content)[0] ?? "application/json", c = p(f, o);
|
|
51
52
|
s.push({ name: i.name, value: c });
|
|
52
53
|
break;
|
|
53
54
|
}
|
|
54
55
|
switch (u) {
|
|
55
56
|
case "form": {
|
|
56
|
-
const o =
|
|
57
|
+
const o = z(f, y);
|
|
57
58
|
if (Array.isArray(o))
|
|
58
59
|
for (const c of o) {
|
|
59
60
|
const $ = c.key || i.name;
|
|
@@ -64,18 +65,18 @@ const A = (e) => (e ?? []).map((t) => m(t)), P = (e) => {
|
|
|
64
65
|
break;
|
|
65
66
|
}
|
|
66
67
|
case "spaceDelimited": {
|
|
67
|
-
const o =
|
|
68
|
+
const o = g(f);
|
|
68
69
|
s.push({ name: i.name, value: o });
|
|
69
70
|
break;
|
|
70
71
|
}
|
|
71
72
|
case "pipeDelimited": {
|
|
72
|
-
const o =
|
|
73
|
+
const o = j(f);
|
|
73
74
|
s.push({ name: i.name, value: o });
|
|
74
75
|
break;
|
|
75
76
|
}
|
|
76
77
|
case "deepObject": {
|
|
77
78
|
if (y) {
|
|
78
|
-
const o =
|
|
79
|
+
const o = x(i.name, f);
|
|
79
80
|
for (const c of o)
|
|
80
81
|
s.push({ name: c.key, value: c.value });
|
|
81
82
|
}
|
|
@@ -97,7 +98,7 @@ const A = (e) => (e ?? []).map((t) => m(t)), P = (e) => {
|
|
|
97
98
|
}
|
|
98
99
|
// Cookies only support 'form' style according to OpenAPI 3.1.1
|
|
99
100
|
case "cookie": {
|
|
100
|
-
const o =
|
|
101
|
+
const o = h(f, y);
|
|
101
102
|
if (Array.isArray(o))
|
|
102
103
|
for (const c of o) {
|
|
103
104
|
const $ = c.key || i.name, a = c.value === null ? "null" : String(c.value);
|
|
@@ -117,7 +118,7 @@ const A = (e) => (e ?? []).map((t) => m(t)), P = (e) => {
|
|
|
117
118
|
queryString: s,
|
|
118
119
|
cookies: e.cookies
|
|
119
120
|
};
|
|
120
|
-
},
|
|
121
|
+
}, D = (e, t, n, d, s) => {
|
|
121
122
|
switch (d) {
|
|
122
123
|
case "matrix": {
|
|
123
124
|
if (s) {
|
|
@@ -167,5 +168,5 @@ const A = (e) => (e ?? []).map((t) => m(t)), P = (e) => {
|
|
|
167
168
|
}
|
|
168
169
|
};
|
|
169
170
|
export {
|
|
170
|
-
|
|
171
|
+
U as processParameters
|
|
171
172
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { canMethodHaveBody as p } from "@scalar/helpers/http/can-method-have-body";
|
|
2
2
|
import { getResolvedRef as n } from "@scalar/workspace-store/helpers/get-resolved-ref";
|
|
3
3
|
import { isElectron as u } from "../../../../libs/electron.js";
|
|
4
|
-
const i = "2.
|
|
4
|
+
const i = "2.21.0", m = "application/json", h = "*/*", c = (r, t, a) => ({
|
|
5
5
|
name: r,
|
|
6
6
|
defaultValue: t,
|
|
7
7
|
isOverridden: a.has(r.toLowerCase())
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { ResponseInstance } from '@scalar/oas-utils/entities/spec';
|
|
2
2
|
import type { WorkspaceEventBus } from '@scalar/workspace-store/events';
|
|
3
3
|
import type { ClientLayout } from '../../../hooks/index.js';
|
|
4
|
-
import type { createStoreEvents } from '../../../store/events.js';
|
|
5
4
|
import type { ClientPlugin } from '../../../v2/helpers/plugins.js';
|
|
6
5
|
type __VLS_Props = {
|
|
7
6
|
/** Preprocessed response */
|
|
@@ -16,8 +15,7 @@ type __VLS_Props = {
|
|
|
16
15
|
appVersion: string;
|
|
17
16
|
/** Registered app plugins */
|
|
18
17
|
plugins: ClientPlugin[];
|
|
19
|
-
/**
|
|
20
|
-
events: ReturnType<typeof createStoreEvents>;
|
|
18
|
+
/** Workspace event bus */
|
|
21
19
|
eventBus: WorkspaceEventBus;
|
|
22
20
|
};
|
|
23
21
|
declare const responseSections: readonly ["Cookies", "Headers", "Body"];
|
|
@@ -39,10 +37,6 @@ declare const _default: import("vue").DefineComponent<__VLS_Props, {
|
|
|
39
37
|
shouldVirtualize: import("vue").ComputedRef<boolean>;
|
|
40
38
|
activeFilter: import("vue").Ref<Filter, Filter>;
|
|
41
39
|
filters: import("vue").ComputedRef<Filter[]>;
|
|
42
|
-
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
43
|
-
sendRequest: () => any;
|
|
44
|
-
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
45
|
-
onSendRequest?: (() => any) | undefined;
|
|
46
|
-
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
40
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
47
41
|
export default _default;
|
|
48
42
|
//# sourceMappingURL=ResponseBlock.vue.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResponseBlock.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/blocks/response-block/ResponseBlock.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ResponseBlock.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/blocks/response-block/ResponseBlock.vue"],"names":[],"mappings":"AAqRA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAA;AACvE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAKvE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAW3C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAExD,KAAK,WAAW,GAAG;IACjB,4BAA4B;IAC5B,QAAQ,EAAE,gBAAgB,GAAG,IAAI,CAAA;IACjC,gCAAgC;IAChC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAA;IACvB,oBAAoB;IACpB,MAAM,EAAE,YAAY,CAAA;IACpB,yCAAyC;IACzC,sBAAsB,EAAE,MAAM,CAAA;IAC9B,0BAA0B;IAC1B,UAAU,EAAE,MAAM,CAAA;IAClB,6BAA6B;IAC7B,OAAO,EAAE,YAAY,EAAE,CAAA;IACvB,0BAA0B;IAC1B,QAAQ,EAAE,iBAAiB,CAAA;CAC5B,CAAC;AAuBF,QAAA,MAAM,gBAAgB,yCAA0C,CAAA;AAChE,KAAK,MAAM,GAAG,KAAK,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAA;;;;;;;;;;;;;;;;;;;AA6YvD,wBAOG"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./ResponseBlock.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
|
-
import
|
|
4
|
-
const s = /* @__PURE__ */
|
|
3
|
+
import t from "../../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
+
const s = /* @__PURE__ */ t(o, [["__scopeId", "data-v-03d3fde7"]]);
|
|
5
5
|
export {
|
|
6
6
|
s as default
|
|
7
7
|
};
|