@scalar/blocks 0.10.0 → 0.11.1
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 +28 -0
- package/dist/code-example/components/CodeExample.vue.d.ts.map +1 -1
- package/dist/code-example/components/CodeExample.vue.js +1 -1
- package/dist/code-example/components/CodeExample.vue_vue_type_script_setup_true_lang.js +1 -2
- package/dist/code-example/components/CodeExample.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/code-example/helpers/operation-to-har/process-parameters.d.ts.map +1 -1
- package/dist/code-example/helpers/operation-to-har/process-parameters.js +131 -158
- package/dist/code-example/helpers/operation-to-har/process-parameters.js.map +1 -1
- package/dist/code-example/mount.d.ts +1 -1
- package/dist/code-example/mount.d.ts.map +1 -1
- package/dist/code-example/mount.js +49 -39
- package/dist/code-example/mount.js.map +1 -1
- package/dist/constants.js +1 -1
- package/dist/schema/Schema.vue.d.ts.map +1 -1
- package/dist/schema/Schema.vue.js +1 -1
- package/dist/schema/Schema.vue_vue_type_script_setup_true_lang.js +40 -39
- package/dist/schema/Schema.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/schema/SchemaObjectProperties.vue.d.ts.map +1 -1
- package/dist/schema/SchemaObjectProperties.vue_vue_type_script_setup_true_lang.js +30 -22
- package/dist/schema/SchemaObjectProperties.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/schema/SchemaProperty.vue.d.ts +5 -0
- package/dist/schema/SchemaProperty.vue.d.ts.map +1 -1
- package/dist/schema/SchemaProperty.vue.js +1 -1
- package/dist/schema/SchemaProperty.vue_vue_type_script_setup_true_lang.js +3 -0
- package/dist/schema/SchemaProperty.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/schema/SchemaPropertyHeading.vue.d.ts +6 -4
- package/dist/schema/SchemaPropertyHeading.vue.d.ts.map +1 -1
- package/dist/schema/SchemaPropertyHeading.vue.js +1 -1
- package/dist/schema/SchemaPropertyHeading.vue_vue_type_script_setup_true_lang.js +155 -132
- package/dist/schema/SchemaPropertyHeading.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/schema/helpers/dynamic-scope.d.ts +3 -1
- package/dist/schema/helpers/dynamic-scope.d.ts.map +1 -1
- package/dist/schema/helpers/dynamic-scope.js +19 -4
- package/dist/schema/helpers/dynamic-scope.js.map +1 -1
- package/dist/schema/helpers/get-compositions-to-render.d.ts.map +1 -1
- package/dist/schema/helpers/get-compositions-to-render.js +24 -24
- package/dist/schema/helpers/get-compositions-to-render.js.map +1 -1
- package/dist/schema/helpers/index.d.ts +1 -0
- package/dist/schema/helpers/index.d.ts.map +1 -1
- package/dist/schema/helpers/index.js +14 -13
- package/dist/schema/helpers/optimize-value-for-display.d.ts.map +1 -1
- package/dist/schema/helpers/optimize-value-for-display.js +11 -11
- package/dist/schema/helpers/optimize-value-for-display.js.map +1 -1
- package/dist/schema/helpers/partition-all-of-compositions.d.ts.map +1 -1
- package/dist/schema/helpers/partition-all-of-compositions.js +24 -14
- package/dist/schema/helpers/partition-all-of-compositions.js.map +1 -1
- package/dist/schema/helpers/should-render-array-item-composition.d.ts +2 -0
- package/dist/schema/helpers/should-render-array-item-composition.d.ts.map +1 -1
- package/dist/schema/helpers/should-render-array-item-composition.js +2 -6
- package/dist/schema/helpers/should-render-array-item-composition.js.map +1 -1
- package/dist/style.css +67 -42
- package/dist/vue-styles.css +1 -1
- package/package.json +10 -10
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { assertReservedPathUrl as h,
|
|
6
|
-
import { getParameterExample as
|
|
7
|
-
import { getQuerystringParameter as
|
|
1
|
+
import { deSerializeParameter as e, filterDisabledProperties as t, getExampleFromSchema as n, isParamDisabled as r, serializeContentValue as i, serializeCookieStyle as a, serializeDeepObjectStyle as o, serializeFormStyle as s, serializeFormStyleForCookies as c, serializePipeDelimitedStyle as l, serializeSimpleStyle as u, serializeSpaceDelimitedStyle as d } from "@scalar/workspace-store/request-example";
|
|
2
|
+
import { getResolvedRef as f } from "@scalar/workspace-store/helpers/get-resolved-ref";
|
|
3
|
+
import { getCookieSerializationError as p } from "@scalar/helpers/http/get-cookie-serialization-error";
|
|
4
|
+
import { replacePathVariables as m } from "@scalar/helpers/regex/replace-variables";
|
|
5
|
+
import { assertReservedPathUrl as h, hasPathDotSegment as g, includesUndefinedPathPrefix as _, serializePathParameter as v, serializeReservedPathParameter as y } from "@scalar/workspace-store/helpers/encode-path-parameter";
|
|
6
|
+
import { getParameterExample as b } from "@scalar/workspace-store/helpers/get-parameter-example";
|
|
7
|
+
import { getQuerystringParameter as x, serializeQuerystringParameter as S } from "@scalar/workspace-store/helpers/querystring-parameter";
|
|
8
8
|
// src/code-example/helpers/operation-to-har/process-parameters.ts
|
|
9
|
-
var
|
|
9
|
+
var C = class extends Error {}, w = (e) => (e ?? []).map((e) => f(e)).filter((e) => e !== void 0), T = (e) => "allowReserved" in e && e.allowReserved !== void 0 ? e.allowReserved : "schema" in e && e.schema && typeof e.schema == "object" && "allowReserved" in e.schema ? e.schema.allowReserved === !0 : !1, E = (e) => {
|
|
10
10
|
if (e.in === "header") return {
|
|
11
11
|
style: "simple",
|
|
12
12
|
explode: "explode" in e && e.explode !== void 0 && e.explode
|
|
@@ -29,234 +29,207 @@ var b = class extends Error {}, x = (e) => (e ?? []).map((e) => p(e)).filter((e)
|
|
|
29
29
|
style: n,
|
|
30
30
|
explode: "explode" in e && e.explode !== void 0 ? e.explode : n === "form"
|
|
31
31
|
};
|
|
32
|
-
},
|
|
33
|
-
let l =
|
|
34
|
-
if (d) return
|
|
35
|
-
if (i
|
|
36
|
-
if (l.value !== void 0) return
|
|
37
|
-
if (!("schema" in
|
|
38
|
-
let
|
|
32
|
+
}, D = (i, a, o, s, c) => {
|
|
33
|
+
let l = b(i, a), u = l.example, d = i.in === "query" && !l.serialized && !l.mediaSerialized ? u?.["x-scalar-disabled-properties"] : void 0;
|
|
34
|
+
if (d) return t(e(l.value, i), d, r(i, u, o));
|
|
35
|
+
if (r(i, u, o)) return;
|
|
36
|
+
if (l.value !== void 0) return e(l.value, i);
|
|
37
|
+
if (!("schema" in i) || !i.schema) return;
|
|
38
|
+
let p = {
|
|
39
39
|
openapiVersion: s,
|
|
40
40
|
jsonSchemaDialect: c,
|
|
41
|
-
...
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
|
|
41
|
+
...i.in === "path" ? {
|
|
42
|
+
emptyString: `{${i.name}}`,
|
|
43
|
+
preserveStringFallback: !0
|
|
44
|
+
} : {}
|
|
45
|
+
}, m = f(i.schema);
|
|
46
|
+
return m ? n(m, p) : void 0;
|
|
47
|
+
}, O = ({ harRequest: t, parameters: n, example: f, defaultDisabled: O, openapiVersion: k, jsonSchemaDialect: A }) => {
|
|
48
|
+
let j = [...t.headers], M = [...t.queryString], N = [...t.cookies], P = [], F = t.url, I = t.url, L = !1, R = !1, z = [], B = [], V = (e, t, n = !1) => {
|
|
49
|
+
F = m(F, { [e]: t }), I = m(I, { [e]: n ? `x${t}` : t }), L ||= n;
|
|
50
|
+
}, H = (e, t, n) => {
|
|
51
|
+
T(n) ? z.push(`${encodeURIComponent(e)}=${t}`) : M.push({
|
|
47
52
|
name: e,
|
|
48
53
|
value: t
|
|
49
54
|
});
|
|
50
|
-
},
|
|
51
|
-
for (let
|
|
52
|
-
if (!
|
|
53
|
-
if (
|
|
54
|
-
let
|
|
55
|
-
defaultDisabled:
|
|
56
|
-
openapiVersion:
|
|
57
|
-
jsonSchemaDialect:
|
|
55
|
+
}, U = w(n);
|
|
56
|
+
for (let t of U) {
|
|
57
|
+
if (!t.in || !t.name) continue;
|
|
58
|
+
if (t.in === "querystring") {
|
|
59
|
+
let e = x(t, f, {
|
|
60
|
+
defaultDisabled: O,
|
|
61
|
+
openapiVersion: k,
|
|
62
|
+
jsonSchemaDialect: A
|
|
58
63
|
});
|
|
59
|
-
if (
|
|
60
|
-
let
|
|
61
|
-
|
|
64
|
+
if (e) {
|
|
65
|
+
let t = F.indexOf("#"), n = t === -1 ? "" : F.slice(t), r = (t === -1 ? F : F.slice(0, t)).split("?")[0], i = S(e);
|
|
66
|
+
F = `${r}${i ? `?${i}` : ""}${n}`;
|
|
62
67
|
}
|
|
63
68
|
continue;
|
|
64
69
|
}
|
|
65
|
-
let
|
|
66
|
-
if (
|
|
67
|
-
let
|
|
68
|
-
switch (
|
|
70
|
+
let n = b(t, f);
|
|
71
|
+
if (n.serialized && !r(t, n.example, O)) {
|
|
72
|
+
let e = String(n.value);
|
|
73
|
+
switch (t.in) {
|
|
69
74
|
case "path":
|
|
70
|
-
|
|
75
|
+
V(t.name, e);
|
|
71
76
|
break;
|
|
72
77
|
case "query":
|
|
73
|
-
|
|
78
|
+
z.push(e);
|
|
74
79
|
break;
|
|
75
80
|
case "header":
|
|
76
|
-
|
|
77
|
-
name:
|
|
78
|
-
value:
|
|
81
|
+
j.push({
|
|
82
|
+
name: t.name,
|
|
83
|
+
value: e
|
|
79
84
|
});
|
|
80
85
|
break;
|
|
81
|
-
case "cookie":
|
|
86
|
+
case "cookie": B.push(e);
|
|
82
87
|
}
|
|
83
88
|
continue;
|
|
84
89
|
}
|
|
85
|
-
if (
|
|
86
|
-
let
|
|
87
|
-
switch (
|
|
90
|
+
if (n.mediaSerialized && !r(t, n.example, O)) {
|
|
91
|
+
let e = String(n.value);
|
|
92
|
+
switch (t.in) {
|
|
88
93
|
case "query":
|
|
89
|
-
|
|
94
|
+
H(t.name, e, t);
|
|
90
95
|
break;
|
|
91
96
|
case "header":
|
|
92
|
-
|
|
93
|
-
name:
|
|
94
|
-
value:
|
|
97
|
+
j.push({
|
|
98
|
+
name: t.name,
|
|
99
|
+
value: e
|
|
95
100
|
});
|
|
96
101
|
break;
|
|
97
102
|
case "path":
|
|
98
|
-
|
|
103
|
+
V(t.name, encodeURIComponent(e));
|
|
99
104
|
break;
|
|
100
|
-
case "cookie":
|
|
101
|
-
name:
|
|
102
|
-
value:
|
|
105
|
+
case "cookie": N.push({
|
|
106
|
+
name: t.name,
|
|
107
|
+
value: e
|
|
103
108
|
});
|
|
104
109
|
}
|
|
105
110
|
continue;
|
|
106
111
|
}
|
|
107
|
-
let h =
|
|
108
|
-
if (
|
|
109
|
-
let { style: x, explode: S } = C(e);
|
|
110
|
-
switch (e.in) {
|
|
112
|
+
let { style: m, explode: h } = E(t), g = t.in === "path" && (m === "matrix" || m === "label"), w = g ? e(n.value, t) : D(t, f, O, k, A);
|
|
113
|
+
if (!(g ? !n.example || r(t, n.example, O) : w === void 0)) switch (t.in) {
|
|
111
114
|
case "path": {
|
|
112
|
-
let
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
115
|
+
let e = k?.startsWith("3.2.") && "schema" in t && t.allowReserved === !0;
|
|
116
|
+
if (R ||= !!e, g) {
|
|
117
|
+
let n = v(t.name, {
|
|
118
|
+
value: w,
|
|
119
|
+
style: m,
|
|
120
|
+
explode: h,
|
|
121
|
+
includeUndefinedPrefix: _(k)
|
|
122
|
+
}, void 0, e), r = m === "matrix" ? ";" : ".";
|
|
123
|
+
V(F.includes(`{${t.name}}`) ? t.name : `${r}${t.name}`, n, m === "label" && !e);
|
|
124
|
+
} else if (e) V(t.name, y(t.name, {
|
|
125
|
+
value: w,
|
|
126
|
+
style: m,
|
|
127
|
+
explode: h
|
|
128
|
+
}));
|
|
129
|
+
else {
|
|
130
|
+
let e = m === "simple" ? u(w, h) : w;
|
|
131
|
+
V(t.name, String(e));
|
|
132
|
+
}
|
|
120
133
|
break;
|
|
121
134
|
}
|
|
122
135
|
case "query":
|
|
123
|
-
if ("content" in
|
|
124
|
-
let
|
|
125
|
-
|
|
136
|
+
if ("content" in t && t.content) {
|
|
137
|
+
let e = Object.keys(t.content)[0] ?? "application/json", n = i(w, e);
|
|
138
|
+
H(t.name, n, t);
|
|
126
139
|
break;
|
|
127
140
|
}
|
|
128
|
-
switch (
|
|
141
|
+
switch (m) {
|
|
129
142
|
case "form": {
|
|
130
|
-
let
|
|
131
|
-
if (Array.isArray(
|
|
132
|
-
else
|
|
143
|
+
let e = s(w, h);
|
|
144
|
+
if (Array.isArray(e)) for (let n of e) H(n.key || t.name, String(n.value), t);
|
|
145
|
+
else H(t.name, String(e), t);
|
|
133
146
|
break;
|
|
134
147
|
}
|
|
135
148
|
case "spaceDelimited": {
|
|
136
|
-
let
|
|
137
|
-
|
|
149
|
+
let e = d(w);
|
|
150
|
+
H(t.name, e, t);
|
|
138
151
|
break;
|
|
139
152
|
}
|
|
140
153
|
case "pipeDelimited": {
|
|
141
|
-
let
|
|
142
|
-
|
|
154
|
+
let e = l(w);
|
|
155
|
+
H(t.name, e, t);
|
|
143
156
|
break;
|
|
144
157
|
}
|
|
145
158
|
case "deepObject":
|
|
146
|
-
if (Array.isArray(
|
|
147
|
-
let
|
|
148
|
-
if (Array.isArray(
|
|
149
|
-
else
|
|
159
|
+
if (Array.isArray(w)) {
|
|
160
|
+
let e = s(w, !0);
|
|
161
|
+
if (Array.isArray(e)) for (let n of e) H(n.key || t.name, String(n.value), t);
|
|
162
|
+
else H(t.name, String(e), t);
|
|
150
163
|
} else {
|
|
151
|
-
let
|
|
152
|
-
for (let n of
|
|
164
|
+
let e = o(t.name, w);
|
|
165
|
+
for (let n of e) H(n.key, n.value, t);
|
|
153
166
|
}
|
|
154
167
|
break;
|
|
155
|
-
default:
|
|
168
|
+
default: H(t.name, String(w), t);
|
|
156
169
|
}
|
|
157
170
|
break;
|
|
158
171
|
case "header": {
|
|
159
|
-
let
|
|
160
|
-
|
|
161
|
-
name:
|
|
162
|
-
value: String(
|
|
172
|
+
let e = u(w, h);
|
|
173
|
+
j.push({
|
|
174
|
+
name: t.name,
|
|
175
|
+
value: String(e)
|
|
163
176
|
});
|
|
164
177
|
break;
|
|
165
178
|
}
|
|
166
179
|
case "cookie": {
|
|
167
|
-
let [
|
|
168
|
-
if (r) throw new
|
|
169
|
-
if (
|
|
170
|
-
|
|
180
|
+
let [e, n] = (k ?? "").split("."), r = e === "3" && n === "2" && !("content" in t) ? p(t, w) : void 0;
|
|
181
|
+
if (r) throw new C(r);
|
|
182
|
+
if (m === "cookie") {
|
|
183
|
+
P.push(...a(t.name, w, h));
|
|
171
184
|
break;
|
|
172
185
|
}
|
|
173
|
-
let i =
|
|
174
|
-
if (Array.isArray(i)) for (let
|
|
175
|
-
let n =
|
|
176
|
-
|
|
186
|
+
let i = c(w, h);
|
|
187
|
+
if (Array.isArray(i)) for (let e of i) {
|
|
188
|
+
let n = e.key || t.name, r = e.value === null ? "null" : String(e.value);
|
|
189
|
+
N.push({
|
|
177
190
|
name: n,
|
|
178
191
|
value: r
|
|
179
192
|
});
|
|
180
193
|
}
|
|
181
194
|
else {
|
|
182
|
-
let
|
|
183
|
-
|
|
184
|
-
name:
|
|
185
|
-
value:
|
|
195
|
+
let e = i === null ? "null" : String(i);
|
|
196
|
+
N.push({
|
|
197
|
+
name: t.name,
|
|
198
|
+
value: e
|
|
186
199
|
});
|
|
187
200
|
}
|
|
188
201
|
break;
|
|
189
202
|
}
|
|
190
203
|
}
|
|
191
204
|
}
|
|
192
|
-
if (
|
|
205
|
+
if (P.length || B.length) {
|
|
193
206
|
let e = [
|
|
194
|
-
...
|
|
195
|
-
...
|
|
196
|
-
...
|
|
197
|
-
].join("; "), t =
|
|
198
|
-
t ?
|
|
207
|
+
...N.map((e) => `${encodeURIComponent(e.name)}=${encodeURIComponent(e.value)}`),
|
|
208
|
+
...P.map((e) => `${e.name}=${e.value}`),
|
|
209
|
+
...B
|
|
210
|
+
].join("; "), t = j.find((e) => e.name.toLowerCase() === "cookie");
|
|
211
|
+
t ? j.splice(j.indexOf(t), 1, {
|
|
199
212
|
...t,
|
|
200
213
|
value: t.value ? `${t.value}; ${e}` : e
|
|
201
|
-
}) :
|
|
214
|
+
}) : j.push({
|
|
202
215
|
name: "Cookie",
|
|
203
216
|
value: e
|
|
204
217
|
});
|
|
205
218
|
}
|
|
206
|
-
if (
|
|
207
|
-
let e =
|
|
208
|
-
|
|
219
|
+
if (z.length) {
|
|
220
|
+
let e = F.indexOf("#"), t = e < 0 ? "" : F.slice(e), n = e < 0 ? F : F.slice(0, e);
|
|
221
|
+
F = `${n}${n.includes("?") ? "&" : "?"}${z.join("&")}${t}`;
|
|
209
222
|
}
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
223
|
+
if (R && h(F), L && g(F, I)) throw URIError("A label-style path parameter produces a dot segment that browsers remove.");
|
|
224
|
+
return {
|
|
225
|
+
url: F,
|
|
226
|
+
headers: j,
|
|
227
|
+
queryString: M,
|
|
228
|
+
cookies: P.length || B.length ? [] : N,
|
|
229
|
+
hasCookieStyleEntries: P.length > 0 || B.length > 0,
|
|
230
|
+
...z.length ? { hasSerializedQuery: !0 } : {}
|
|
217
231
|
};
|
|
218
|
-
}, E = (t, n, r, i, a) => {
|
|
219
|
-
switch (i) {
|
|
220
|
-
case "matrix":
|
|
221
|
-
if (a) {
|
|
222
|
-
if (Array.isArray(r)) {
|
|
223
|
-
let e = r.map((e) => `${n.name}=${e}`).join(";");
|
|
224
|
-
return t.replace(`{;${n.name}}`, `;${e}`);
|
|
225
|
-
}
|
|
226
|
-
if (e(r)) {
|
|
227
|
-
let e = Object.entries(r).map(([e, t]) => `${e}=${t}`).join(";");
|
|
228
|
-
return t.replace(`{;${n.name}}`, `;${e}`);
|
|
229
|
-
}
|
|
230
|
-
return t.replace(`{;${n.name}}`, `;${n.name}=${r}`);
|
|
231
|
-
}
|
|
232
|
-
if (Array.isArray(r)) return t.replace(`{;${n.name}}`, `;${n.name}=${r.join(",")}`);
|
|
233
|
-
if (e(r)) {
|
|
234
|
-
let e = Object.entries(r).map(([e, t]) => `${e},${t}`).join(",");
|
|
235
|
-
return t.replace(`{;${n.name}}`, `;${n.name}=${e}`);
|
|
236
|
-
}
|
|
237
|
-
return t.replace(`{;${n.name}}`, `;${n.name}=${r}`);
|
|
238
|
-
case "label":
|
|
239
|
-
if (a) {
|
|
240
|
-
if (Array.isArray(r)) return t.replace(`{.${n.name}}`, `.${r.join(".")}`);
|
|
241
|
-
if (e(r)) {
|
|
242
|
-
let e = Object.entries(r).map(([e, t]) => `${e}=${t}`).join(".");
|
|
243
|
-
return t.replace(`{.${n.name}}`, `.${e}`);
|
|
244
|
-
}
|
|
245
|
-
return t.replace(`{.${n.name}}`, `.${r}`);
|
|
246
|
-
}
|
|
247
|
-
if (Array.isArray(r)) return t.replace(`{.${n.name}}`, `.${r.join(",")}`);
|
|
248
|
-
if (e(r)) {
|
|
249
|
-
let e = Object.entries(r).map(([e, t]) => `${e},${t}`).join(",");
|
|
250
|
-
return t.replace(`{.${n.name}}`, `.${e}`);
|
|
251
|
-
}
|
|
252
|
-
return t.replace(`{.${n.name}}`, `.${r}`);
|
|
253
|
-
case "simple": {
|
|
254
|
-
let e = d(r, a);
|
|
255
|
-
return t.replace(`{${n.name}}`, String(e));
|
|
256
|
-
}
|
|
257
|
-
default: return t.replace(`{${n.name}}`, String(r));
|
|
258
|
-
}
|
|
259
232
|
};
|
|
260
|
-
export {
|
|
233
|
+
export { C as CookieSerializationError, O as processParameters };
|
|
261
234
|
|
|
262
235
|
//# sourceMappingURL=process-parameters.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process-parameters.js","names":["CookieSerializationError","deReferenceParams","params","getResolvedRef","param","isAllowReserved","getParameterStyleAndExplode","explode","defaultStyle","style","getParameterValue","selected","getParameterExample","example","exampleValue","propertyStates","filterDisabledProperties","deSerializeParameter","isParamDisabled","defaultDisabled","options","schema","getExampleFromSchema","processParameters","newHeaders","harRequest","newQueryString","newCookies","cookieStyleEntries","newUrl","hasReservedPathParameter","serializedQuery","serializedCookies","appendQueryParameter","name","value","deReferencedParams","parameters","querystring","getQuerystringParameter","hashIndex","hash","base","query","serializeQuerystringParameter","wireValue","text","paramValue","openapiVersion","jsonSchemaDialect","allowReserved","pathValue","serializeReservedPathParameter","processPathParameters","paramContentType","serializedValue","serializeContentValue","serialized","serializeFormStyle","entry","serializeSpaceDelimitedStyle","serializePipeDelimitedStyle","entries","serializeDeepObjectStyle","serializeSimpleStyle","major","minor","error","getCookieSerializationError","serializeCookieStyle","serializeFormStyleForCookies","key","cookieValue","cookie","existing","header","assertReservedPathUrl","values","v","url","isObjectLike","k"],"sources":["../../../../src/code-example/helpers/operation-to-har/process-parameters.ts"],"sourcesContent":["import { getCookieSerializationError } from '@scalar/helpers/http/get-cookie-serialization-error'\nimport { isObjectLike } from '@scalar/helpers/object/is-object'\nimport {\n assertReservedPathUrl,\n serializeReservedPathParameter,\n} from '@scalar/workspace-store/helpers/encode-path-parameter'\nimport { getParameterExample } from '@scalar/workspace-store/helpers/get-parameter-example'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport {\n getQuerystringParameter,\n serializeQuerystringParameter,\n} from '@scalar/workspace-store/helpers/querystring-parameter'\nimport {\n deSerializeParameter,\n filterDisabledProperties,\n getExampleFromSchema,\n isParamDisabled,\n serializeContentValue,\n serializeCookieStyle,\n serializeDeepObjectStyle,\n serializeFormStyle,\n serializeFormStyleForCookies,\n serializePipeDelimitedStyle,\n serializeSimpleStyle,\n serializeSpaceDelimitedStyle,\n} from '@scalar/workspace-store/request-example'\nimport type { OperationObject, ParameterObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport type { Request as HarRequest } from 'har-format'\n\n/** An invalid cookie declaration that authors can repair before generating a sample. */\nexport class CookieSerializationError extends Error {}\n\ntype ProcessedParameters = {\n /** Named serialized examples already embedded in the URL. */\n hasSerializedQuery?: boolean\n url: string\n headers: HarRequest['headers']\n queryString: HarRequest['queryString']\n cookies: HarRequest['cookies']\n /** Whether serialized cookie-style values require a complete Cookie header. */\n hasCookieStyleEntries: boolean\n}\n\n/** Ensures we don't have any references in the parameters */\nconst deReferenceParams = (params: OperationObject['parameters']): ParameterObject[] =>\n (params ?? []).map((param) => getResolvedRef(param)).filter((param) => param !== undefined)\n\n/** Whether the parameter allows reserved characters (from param or schema). */\nconst isAllowReserved = (param: ParameterObject): boolean => {\n if ('allowReserved' in param && param.allowReserved !== undefined) {\n return param.allowReserved\n }\n if ('schema' in param && param.schema && typeof param.schema === 'object' && 'allowReserved' in param.schema) {\n return (param.schema as { allowReserved?: boolean }).allowReserved === true\n }\n return false\n}\n\n/**\n * Get the style and explode values for a parameter according to OpenAPI 3.1.1 specification.\n * Handles defaults and validation for parameter location restrictions.\n */\nconst getParameterStyleAndExplode = (param: ParameterObject): { style: string; explode: boolean } => {\n // Headers only support 'simple' style\n if (param.in === 'header') {\n const explode = 'explode' in param && param.explode !== undefined ? param.explode : false\n return { style: 'simple', explode }\n }\n\n // Cookies default to form for compatibility and also support cookie style.\n if (param.in === 'cookie') {\n const explode = 'explode' in param && param.explode !== undefined ? param.explode : true\n return { style: 'style' in param && param.style === 'cookie' ? 'cookie' : 'form', explode }\n }\n\n const defaultStyle = {\n path: 'simple',\n query: 'form',\n querystring: 'form',\n header: 'simple',\n cookie: 'form',\n }[param.in]\n\n // Use provided style or default based on location\n const style = 'style' in param && param.style ? param.style : defaultStyle\n\n // Determine explode value: use provided value or default based on style\n const explode = 'explode' in param && param.explode !== undefined ? param.explode : style === 'form'\n\n return { style, explode }\n}\n\n/**\n * Extract the value for a parameter from example data or schema.\n * Prioritizes example data over schema examples.\n * Returns null if the parameter is disabled so we can skip it.\n */\nconst getParameterValue = (\n param: ParameterObject,\n example: string | undefined,\n defaultDisabled: boolean,\n openapiVersion?: string,\n jsonSchemaDialect?: string,\n): unknown => {\n // Try to get value from example first\n const selected = getParameterExample(param, example)\n const exampleValue = selected.example\n\n const propertyStates =\n param.in === 'query' && !selected.serialized && !selected.mediaSerialized\n ? exampleValue?.['x-scalar-disabled-properties']\n : undefined\n if (propertyStates) {\n return filterDisabledProperties(\n deSerializeParameter(selected.value, param),\n propertyStates,\n isParamDisabled(param, exampleValue, defaultDisabled),\n )\n }\n\n // If the parameter is disabled, return undefined so we can skip it.\n if (isParamDisabled(param, exampleValue, defaultDisabled)) {\n return undefined\n }\n\n // If the example value is set, return it.\n if (selected.value !== undefined) {\n return deSerializeParameter(selected.value, param)\n }\n\n // Fall back to schema example if available\n if (!('schema' in param) || !param.schema) {\n return undefined\n }\n\n const options = {\n openapiVersion,\n jsonSchemaDialect,\n ...(param.in === 'path' ? { emptyString: `{${param.name}}` } : {}),\n }\n const schema = getResolvedRef(param.schema)\n return schema ? getExampleFromSchema(schema, options) : undefined\n}\n\n/**\n * Process OpenAPI parameters and return the updated properties.\n * Handles path, query, and header parameters with various styles and explode options.\n *\n * @see https://spec.openapis.org/oas/latest.html#style-values\n */\nexport const processParameters = ({\n harRequest,\n parameters,\n example,\n defaultDisabled,\n openapiVersion,\n jsonSchemaDialect,\n}: {\n harRequest: HarRequest\n parameters: OperationObject['parameters']\n /** The name of the example to use */\n example?: string | undefined\n /** Whether to disable parameters by default. */\n defaultDisabled: boolean\n /** Originating API description version. */\n openapiVersion?: string\n jsonSchemaDialect?: string\n}): ProcessedParameters => {\n // Create copies of the arrays to avoid modifying the input\n const newHeaders = [...harRequest.headers]\n const newQueryString = [...harRequest.queryString]\n const newCookies = [...harRequest.cookies]\n const cookieStyleEntries: HarRequest['cookies'] = []\n let newUrl = harRequest.url\n let hasReservedPathParameter = false\n const serializedQuery: string[] = []\n const serializedCookies: string[] = []\n\n const appendQueryParameter = (name: string, value: string, param: ParameterObject): void => {\n if (isAllowReserved(param)) {\n // HTTP clients cannot infer reserved expansion from a HAR name/value pair.\n serializedQuery.push(`${encodeURIComponent(name)}=${value}`)\n } else {\n newQueryString.push({ name, value })\n }\n }\n\n // Filter out references\n const deReferencedParams = deReferenceParams(parameters)\n\n for (const param of deReferencedParams) {\n if (!param.in || !param.name) {\n continue\n }\n\n if (param.in === 'querystring') {\n const querystring = getQuerystringParameter(param, example, {\n defaultDisabled,\n openapiVersion,\n jsonSchemaDialect,\n })\n if (querystring) {\n const hashIndex = newUrl.indexOf('#')\n const hash = hashIndex === -1 ? '' : newUrl.slice(hashIndex)\n const base = (hashIndex === -1 ? newUrl : newUrl.slice(0, hashIndex)).split('?')[0]\n const query = serializeQuerystringParameter(querystring)\n newUrl = `${base}${query ? `?${query}` : ''}${hash}`\n }\n continue\n }\n\n const selected = getParameterExample(param, example)\n if (selected.serialized && !isParamDisabled(param, selected.example, defaultDisabled)) {\n const wireValue = String(selected.value)\n switch (param.in) {\n case 'path':\n newUrl = newUrl.replaceAll(`{${param.name}}`, () => wireValue)\n break\n case 'query':\n serializedQuery.push(wireValue)\n break\n case 'header':\n newHeaders.push({ name: param.name, value: wireValue })\n break\n case 'cookie':\n serializedCookies.push(wireValue)\n break\n }\n continue\n }\n if (selected.mediaSerialized && !isParamDisabled(param, selected.example, defaultDisabled)) {\n const text = String(selected.value)\n switch (param.in) {\n case 'query':\n appendQueryParameter(param.name, text, param)\n break\n case 'header':\n newHeaders.push({ name: param.name, value: text })\n break\n case 'path':\n newUrl = newUrl.replaceAll(`{${param.name}}`, () => encodeURIComponent(text))\n break\n case 'cookie':\n newCookies.push({ name: param.name, value: text })\n break\n }\n continue\n }\n const paramValue = getParameterValue(param, example, defaultDisabled, openapiVersion, jsonSchemaDialect)\n if (paramValue === undefined) {\n continue\n }\n\n const { style, explode } = getParameterStyleAndExplode(param)\n\n switch (param.in) {\n case 'path': {\n const allowReserved = openapiVersion?.startsWith('3.2.') && 'schema' in param && param.allowReserved === true\n hasReservedPathParameter ||= Boolean(allowReserved)\n const pathValue = allowReserved\n ? serializeReservedPathParameter(param.name, { value: paramValue, style, explode })\n : undefined\n newUrl =\n pathValue === undefined\n ? processPathParameters(newUrl, param, paramValue, style, explode)\n : newUrl.replaceAll(`{${param.name}}`, () => pathValue)\n break\n }\n\n case 'query': {\n // Content type parameters should be serialized according to the parameter's own content type\n if ('content' in param && param.content) {\n // We grab the first for now but eventually we should support selecting the content type per parameter\n const paramContentType = Object.keys(param.content)[0] ?? 'application/json'\n const serializedValue = serializeContentValue(paramValue, paramContentType)\n appendQueryParameter(param.name, serializedValue, param)\n break\n }\n\n // Handle query parameters\n switch (style) {\n case 'form': {\n const serialized = serializeFormStyle(paramValue, explode)\n\n // If serialized is an array of key-value pairs (exploded object or array)\n if (Array.isArray(serialized)) {\n for (const entry of serialized) {\n const key = entry.key || param.name\n appendQueryParameter(key, String(entry.value), param)\n }\n }\n // Otherwise, convert to string\n else {\n appendQueryParameter(param.name, String(serialized), param)\n }\n break\n }\n case 'spaceDelimited': {\n const serialized = serializeSpaceDelimitedStyle(paramValue)\n appendQueryParameter(param.name, serialized, param)\n break\n }\n case 'pipeDelimited': {\n const serialized = serializePipeDelimitedStyle(paramValue)\n appendQueryParameter(param.name, serialized, param)\n break\n }\n case 'deepObject': {\n // OAS marks deepObject-on-array and deepObject+explode:false as undefined.\n // Mirror process-body: fall back to form/explode:true for arrays and always\n // invoke the serializer for objects so authors get useful output instead of\n // a silently-dropped parameter.\n if (Array.isArray(paramValue)) {\n const serialized = serializeFormStyle(paramValue, true)\n if (Array.isArray(serialized)) {\n for (const entry of serialized) {\n const key = entry.key || param.name\n appendQueryParameter(key, String(entry.value), param)\n }\n } else {\n appendQueryParameter(param.name, String(serialized), param)\n }\n } else {\n const entries = serializeDeepObjectStyle(param.name, paramValue)\n for (const entry of entries) {\n appendQueryParameter(entry.key, entry.value, param)\n }\n }\n break\n }\n\n // Default to form style\n default:\n appendQueryParameter(param.name, String(paramValue), param)\n }\n break\n }\n\n // Headers only support 'simple' style according to OpenAPI 3.1.1\n // For arrays, simple style always produces comma-separated values regardless of explode\n // The explode parameter only affects object serialization\n case 'header': {\n const serialized = serializeSimpleStyle(paramValue, explode)\n newHeaders.push({ name: param.name, value: String(serialized) })\n break\n }\n\n // Keep cookie style separate so snippet generators cannot percent-encode it.\n case 'cookie': {\n const [major, minor] = (openapiVersion ?? '').split('.')\n const error =\n major === '3' && minor === '2' && !('content' in param)\n ? getCookieSerializationError(param, paramValue)\n : undefined\n if (error) {\n throw new CookieSerializationError(error)\n }\n if (style === 'cookie') {\n cookieStyleEntries.push(...serializeCookieStyle(param.name, paramValue, explode))\n break\n }\n const serialized = serializeFormStyleForCookies(paramValue, explode)\n\n // If serialized is an array of key-value pairs (exploded object or array)\n if (Array.isArray(serialized)) {\n for (const entry of serialized) {\n const key = entry.key || param.name\n const value = entry.value === null ? 'null' : String(entry.value)\n newCookies.push({ name: key, value })\n }\n }\n // Otherwise, convert to string\n else {\n const value = serialized === null ? 'null' : String(serialized)\n newCookies.push({ name: param.name, value })\n }\n break\n }\n }\n }\n\n // HAR cookie entries are encoded by snippet generators. Use a complete header\n // when cookie style is present, preserving legacy encoding for other cookies.\n if (cookieStyleEntries.length || serializedCookies.length) {\n const cookieValue = [\n ...newCookies.map((cookie) => `${encodeURIComponent(cookie.name)}=${encodeURIComponent(cookie.value)}`),\n ...cookieStyleEntries.map((cookie) => `${cookie.name}=${cookie.value}`),\n ...serializedCookies,\n ].join('; ')\n const existing = newHeaders.find((header) => header.name.toLowerCase() === 'cookie')\n if (existing) {\n newHeaders.splice(newHeaders.indexOf(existing), 1, {\n ...existing,\n value: existing.value ? `${existing.value}; ${cookieValue}` : cookieValue,\n })\n } else {\n newHeaders.push({ name: 'Cookie', value: cookieValue })\n }\n }\n\n if (serializedQuery.length) {\n const hashIndex = newUrl.indexOf('#')\n const hash = hashIndex < 0 ? '' : newUrl.slice(hashIndex)\n const base = hashIndex < 0 ? newUrl : newUrl.slice(0, hashIndex)\n newUrl = `${base}${base.includes('?') ? '&' : '?'}${serializedQuery.join('&')}${hash}`\n }\n\n if (hasReservedPathParameter) {\n assertReservedPathUrl(newUrl)\n }\n\n return {\n url: newUrl,\n headers: newHeaders,\n queryString: newQueryString,\n cookies: cookieStyleEntries.length || serializedCookies.length ? [] : newCookies,\n hasCookieStyleEntries: cookieStyleEntries.length > 0 || serializedCookies.length > 0,\n ...(serializedQuery.length ? { hasSerializedQuery: true } : {}),\n }\n}\n\n/**\n * Process path parameters according to OpenAPI specification.\n * Handles matrix, label, and simple styles with explode options.\n *\n * @param url - The URL to process\n * @param param - The parameter object\n * @param paramValue - The value of the parameter\n * @param style - The style of the parameter (matrix, label, simple)\n * @param explode - Whether to explode the parameter\n * @returns The updated URL with processed path parameters\n */\nconst processPathParameters = (\n url: string,\n param: ParameterObject,\n paramValue: unknown,\n style: string,\n explode: boolean,\n): string => {\n switch (style) {\n case 'matrix': {\n if (explode) {\n // Matrix explode array: ;color=blue;color=black;color=brown\n if (Array.isArray(paramValue)) {\n const values = paramValue.map((v: unknown) => `${param.name}=${v}`).join(';')\n return url.replace(`{;${param.name}}`, `;${values}`)\n }\n\n // Matrix explode object: ;R=100;G=200;B=150\n if (isObjectLike(paramValue)) {\n const values = Object.entries(paramValue)\n .map(([k, v]) => `${k}=${v}`)\n .join(';')\n return url.replace(`{;${param.name}}`, `;${values}`)\n }\n\n // Matrix explode primitive: ;color=blue\n return url.replace(`{;${param.name}}`, `;${param.name}=${paramValue}`)\n }\n\n // Matrix no explode array: ;color=blue,black,brown\n if (Array.isArray(paramValue)) {\n return url.replace(`{;${param.name}}`, `;${param.name}=${paramValue.join(',')}`)\n }\n\n // Matrix no explode object: ;color=R,100,G,200,B,150\n if (isObjectLike(paramValue)) {\n const values = Object.entries(paramValue)\n .map(([k, v]) => `${k},${v}`)\n .join(',')\n return url.replace(`{;${param.name}}`, `;${param.name}=${values}`)\n }\n\n // Matrix no explode primitive: ;color=blue\n return url.replace(`{;${param.name}}`, `;${param.name}=${paramValue}`)\n }\n case 'label': {\n if (explode) {\n // Label explode array: .blue.black.brown\n if (Array.isArray(paramValue)) {\n return url.replace(`{.${param.name}}`, `.${paramValue.join('.')}`)\n }\n\n // Label explode object: .R=100.G=200.B=150\n if (isObjectLike(paramValue)) {\n const values = Object.entries(paramValue)\n .map(([k, v]) => `${k}=${v}`)\n .join('.')\n\n return url.replace(`{.${param.name}}`, `.${values}`)\n }\n\n // Label explode primitive: .blue\n return url.replace(`{.${param.name}}`, `.${paramValue}`)\n }\n\n // Label no explode array: .blue,black,brown\n if (Array.isArray(paramValue)) {\n return url.replace(`{.${param.name}}`, `.${paramValue.join(',')}`)\n }\n\n // Label no explode object: .R,100,G,200,B,150\n if (isObjectLike(paramValue)) {\n const values = Object.entries(paramValue)\n .map(([k, v]) => `${k},${v}`)\n .join(',')\n\n return url.replace(`{.${param.name}}`, `.${values}`)\n }\n\n // Label no explode primitive: .blue\n return url.replace(`{.${param.name}}`, `.${paramValue}`)\n }\n\n case 'simple': {\n const serialized = serializeSimpleStyle(paramValue, explode)\n return url.replace(`{${param.name}}`, String(serialized))\n }\n\n // Default to simple style\n default:\n return url.replace(`{${param.name}}`, String(paramValue))\n }\n}\n"],"mappings":";;;;;;;;AA8BA,IAAaA,IAAb,cAA8C,MAAM,CAAC,GAc/CC,KAAqB,OACxBC,KAAU,CAAC,EAAA,CAAG,KAAK,MAAUC,EAAeC,CAAK,CAAC,CAAC,CAAC,QAAQ,MAAUA,MAAU,KAAA,CAAS,GAGtFC,KAAmB,MACnB,mBAAmBD,KAASA,EAAM,kBAAkB,KAAA,IAC/CA,EAAM,gBAEX,YAAYA,KAASA,EAAM,UAAU,OAAOA,EAAM,UAAW,YAAY,mBAAmBA,EAAM,SAC5FA,EAAM,OAAuC,kBAAkB,KAElE,IAOHE,KAA+B,MAAgE;CAEnG,IAAIF,EAAM,OAAO,UAEf,OAAO;EAAE,OAAO;EAAU,SADV,aAAaA,KAASA,EAAM,YAAY,KAAA,KAAYA,EAAM;CACxC;CAIpC,IAAIA,EAAM,OAAO,UAAU;EACzB,IAAMG,IAAU,aAAaH,KAASA,EAAM,YAAY,KAAA,IAAYA,EAAM,UAAU;EACpF,OAAO;GAAE,OAAO,WAAWA,KAASA,EAAM,UAAU,WAAW,WAAW;GAAQ;EAAQ;CAC5F;CAEA,IAAMI,IAAe;EACnB,MAAM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AO;GAC3D,OAAOwE,EAAI,QAAQ,IAAI3E,EAAM,KAAK,IAAI,OAAOqD,CAAU,CAAC;EAC1D;EAGA,SACE,OAAOsB,EAAI,QAAQ,IAAI3E,EAAM,KAAK,IAAI,OAAO2C,CAAU,CAAC;CAC5D;AACF"}
|
|
1
|
+
{"version":3,"file":"process-parameters.js","names":["CookieSerializationError","deReferenceParams","params","getResolvedRef","param","isAllowReserved","getParameterStyleAndExplode","explode","defaultStyle","style","getParameterValue","selected","getParameterExample","example","exampleValue","propertyStates","filterDisabledProperties","deSerializeParameter","isParamDisabled","defaultDisabled","options","schema","getExampleFromSchema","processParameters","newHeaders","harRequest","newQueryString","newCookies","cookieStyleEntries","newUrl","markedPathUrl","hasStyledLabel","hasReservedPathParameter","serializedQuery","serializedCookies","substitutePathParameter","replacePathVariables","name","value","markLabel","appendQueryParameter","deReferencedParams","parameters","querystring","getQuerystringParameter","hashIndex","hash","base","query","serializeQuerystringParameter","wireValue","text","isStyledPath","paramValue","openapiVersion","jsonSchemaDialect","allowReserved","serializePathParameter","includesUndefinedPathPrefix","operator","serializeReservedPathParameter","serializeSimpleStyle","paramContentType","serializedValue","serializeContentValue","serialized","serializeFormStyle","entry","serializeSpaceDelimitedStyle","serializePipeDelimitedStyle","entries","serializeDeepObjectStyle","major","minor","error","getCookieSerializationError","serializeCookieStyle","serializeFormStyleForCookies","key","cookieValue","cookie","existing","header","assertReservedPathUrl","hasPathDotSegment"],"sources":["../../../../src/code-example/helpers/operation-to-har/process-parameters.ts"],"sourcesContent":["import { getCookieSerializationError } from '@scalar/helpers/http/get-cookie-serialization-error'\nimport { replacePathVariables } from '@scalar/helpers/regex/replace-variables'\nimport {\n assertReservedPathUrl,\n hasPathDotSegment,\n includesUndefinedPathPrefix,\n serializePathParameter,\n serializeReservedPathParameter,\n} from '@scalar/workspace-store/helpers/encode-path-parameter'\nimport { getParameterExample } from '@scalar/workspace-store/helpers/get-parameter-example'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport {\n getQuerystringParameter,\n serializeQuerystringParameter,\n} from '@scalar/workspace-store/helpers/querystring-parameter'\nimport {\n deSerializeParameter,\n filterDisabledProperties,\n getExampleFromSchema,\n isParamDisabled,\n serializeContentValue,\n serializeCookieStyle,\n serializeDeepObjectStyle,\n serializeFormStyle,\n serializeFormStyleForCookies,\n serializePipeDelimitedStyle,\n serializeSimpleStyle,\n serializeSpaceDelimitedStyle,\n} from '@scalar/workspace-store/request-example'\nimport type { OperationObject, ParameterObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport type { Request as HarRequest } from 'har-format'\n\n/** An invalid cookie declaration that authors can repair before generating a sample. */\nexport class CookieSerializationError extends Error {}\n\ntype ProcessedParameters = {\n /** Named serialized examples already embedded in the URL. */\n hasSerializedQuery?: boolean\n url: string\n headers: HarRequest['headers']\n queryString: HarRequest['queryString']\n cookies: HarRequest['cookies']\n /** Whether serialized cookie-style values require a complete Cookie header. */\n hasCookieStyleEntries: boolean\n}\n\n/** Ensures we don't have any references in the parameters */\nconst deReferenceParams = (params: OperationObject['parameters']): ParameterObject[] =>\n (params ?? []).map((param) => getResolvedRef(param)).filter((param) => param !== undefined)\n\n/** Whether the parameter allows reserved characters (from param or schema). */\nconst isAllowReserved = (param: ParameterObject): boolean => {\n if ('allowReserved' in param && param.allowReserved !== undefined) {\n return param.allowReserved\n }\n if ('schema' in param && param.schema && typeof param.schema === 'object' && 'allowReserved' in param.schema) {\n return (param.schema as { allowReserved?: boolean }).allowReserved === true\n }\n return false\n}\n\n/**\n * Get the style and explode values for a parameter according to OpenAPI 3.1.1 specification.\n * Handles defaults and validation for parameter location restrictions.\n */\nconst getParameterStyleAndExplode = (param: ParameterObject): { style: string; explode: boolean } => {\n // Headers only support 'simple' style\n if (param.in === 'header') {\n const explode = 'explode' in param && param.explode !== undefined ? param.explode : false\n return { style: 'simple', explode }\n }\n\n // Cookies default to form for compatibility and also support cookie style.\n if (param.in === 'cookie') {\n const explode = 'explode' in param && param.explode !== undefined ? param.explode : true\n return { style: 'style' in param && param.style === 'cookie' ? 'cookie' : 'form', explode }\n }\n\n const defaultStyle = {\n path: 'simple',\n query: 'form',\n querystring: 'form',\n header: 'simple',\n cookie: 'form',\n }[param.in]\n\n // Use provided style or default based on location\n const style = 'style' in param && param.style ? param.style : defaultStyle\n\n // Determine explode value: use provided value or default based on style\n const explode = 'explode' in param && param.explode !== undefined ? param.explode : style === 'form'\n\n return { style, explode }\n}\n\n/**\n * Extract the value for a parameter from example data or schema.\n * Prioritizes example data over schema examples.\n * Returns null if the parameter is disabled so we can skip it.\n */\nconst getParameterValue = (\n param: ParameterObject,\n example: string | undefined,\n defaultDisabled: boolean,\n openapiVersion?: string,\n jsonSchemaDialect?: string,\n): unknown => {\n // Try to get value from example first\n const selected = getParameterExample(param, example)\n const exampleValue = selected.example\n\n const propertyStates =\n param.in === 'query' && !selected.serialized && !selected.mediaSerialized\n ? exampleValue?.['x-scalar-disabled-properties']\n : undefined\n if (propertyStates) {\n return filterDisabledProperties(\n deSerializeParameter(selected.value, param),\n propertyStates,\n isParamDisabled(param, exampleValue, defaultDisabled),\n )\n }\n\n // If the parameter is disabled, return undefined so we can skip it.\n if (isParamDisabled(param, exampleValue, defaultDisabled)) {\n return undefined\n }\n\n // If the example value is set, return it.\n if (selected.value !== undefined) {\n return deSerializeParameter(selected.value, param)\n }\n\n // Fall back to schema example if available\n if (!('schema' in param) || !param.schema) {\n return undefined\n }\n\n const options = {\n openapiVersion,\n jsonSchemaDialect,\n ...(param.in === 'path' ? { emptyString: `{${param.name}}`, preserveStringFallback: true } : {}),\n }\n const schema = getResolvedRef(param.schema)\n return schema ? getExampleFromSchema(schema, options) : undefined\n}\n\n/**\n * Process OpenAPI parameters and return the updated properties.\n * Handles path, query, and header parameters with various styles and explode options.\n *\n * @see https://spec.openapis.org/oas/latest.html#style-values\n */\nexport const processParameters = ({\n harRequest,\n parameters,\n example,\n defaultDisabled,\n openapiVersion,\n jsonSchemaDialect,\n}: {\n harRequest: HarRequest\n parameters: OperationObject['parameters']\n /** The name of the example to use */\n example?: string | undefined\n /** Whether to disable parameters by default. */\n defaultDisabled: boolean\n /** Originating API description version. */\n openapiVersion?: string\n jsonSchemaDialect?: string\n}): ProcessedParameters => {\n // Create copies of the arrays to avoid modifying the input\n const newHeaders = [...harRequest.headers]\n const newQueryString = [...harRequest.queryString]\n const newCookies = [...harRequest.cookies]\n const cookieStyleEntries: HarRequest['cookies'] = []\n let newUrl = harRequest.url\n let markedPathUrl = harRequest.url\n let hasStyledLabel = false\n let hasReservedPathParameter = false\n const serializedQuery: string[] = []\n const serializedCookies: string[] = []\n\n const substitutePathParameter = (name: string, value: string, markLabel = false): void => {\n newUrl = replacePathVariables(newUrl, { [name]: value })\n // Mark only label substitutions so literal dot segments keep their usual URL semantics.\n markedPathUrl = replacePathVariables(markedPathUrl, { [name]: markLabel ? `x${value}` : value })\n hasStyledLabel ||= markLabel\n }\n\n const appendQueryParameter = (name: string, value: string, param: ParameterObject): void => {\n if (isAllowReserved(param)) {\n // HTTP clients cannot infer reserved expansion from a HAR name/value pair.\n serializedQuery.push(`${encodeURIComponent(name)}=${value}`)\n } else {\n newQueryString.push({ name, value })\n }\n }\n\n // Filter out references\n const deReferencedParams = deReferenceParams(parameters)\n\n for (const param of deReferencedParams) {\n if (!param.in || !param.name) {\n continue\n }\n\n if (param.in === 'querystring') {\n const querystring = getQuerystringParameter(param, example, {\n defaultDisabled,\n openapiVersion,\n jsonSchemaDialect,\n })\n if (querystring) {\n const hashIndex = newUrl.indexOf('#')\n const hash = hashIndex === -1 ? '' : newUrl.slice(hashIndex)\n const base = (hashIndex === -1 ? newUrl : newUrl.slice(0, hashIndex)).split('?')[0]\n const query = serializeQuerystringParameter(querystring)\n newUrl = `${base}${query ? `?${query}` : ''}${hash}`\n }\n continue\n }\n\n const selected = getParameterExample(param, example)\n if (selected.serialized && !isParamDisabled(param, selected.example, defaultDisabled)) {\n const wireValue = String(selected.value)\n switch (param.in) {\n case 'path':\n substitutePathParameter(param.name, wireValue)\n break\n case 'query':\n serializedQuery.push(wireValue)\n break\n case 'header':\n newHeaders.push({ name: param.name, value: wireValue })\n break\n case 'cookie':\n serializedCookies.push(wireValue)\n break\n }\n continue\n }\n if (selected.mediaSerialized && !isParamDisabled(param, selected.example, defaultDisabled)) {\n const text = String(selected.value)\n switch (param.in) {\n case 'query':\n appendQueryParameter(param.name, text, param)\n break\n case 'header':\n newHeaders.push({ name: param.name, value: text })\n break\n case 'path':\n substitutePathParameter(param.name, encodeURIComponent(text))\n break\n case 'cookie':\n newCookies.push({ name: param.name, value: text })\n break\n }\n continue\n }\n const { style, explode } = getParameterStyleAndExplode(param)\n const isStyledPath = param.in === 'path' && (style === 'matrix' || style === 'label')\n // Like Test Request, leave the template visible when no example supplies a styled path value.\n const paramValue = isStyledPath\n ? deSerializeParameter(selected.value, param)\n : getParameterValue(param, example, defaultDisabled, openapiVersion, jsonSchemaDialect)\n if (\n isStyledPath\n ? !selected.example || isParamDisabled(param, selected.example, defaultDisabled)\n : paramValue === undefined\n ) {\n continue\n }\n\n switch (param.in) {\n case 'path': {\n const allowReserved = openapiVersion?.startsWith('3.2.') && 'schema' in param && param.allowReserved === true\n hasReservedPathParameter ||= Boolean(allowReserved)\n\n if (isStyledPath) {\n const value = serializePathParameter(\n param.name,\n {\n value: paramValue,\n style,\n explode,\n includeUndefinedPrefix: includesUndefinedPathPrefix(openapiVersion),\n },\n undefined,\n allowReserved,\n )\n // Support older samples that include a URI template operator in the path.\n const operator = style === 'matrix' ? ';' : '.'\n const name = newUrl.includes(`{${param.name}}`) ? param.name : `${operator}${param.name}`\n substitutePathParameter(name, value, style === 'label' && !allowReserved)\n } else if (allowReserved) {\n substitutePathParameter(\n param.name,\n serializeReservedPathParameter(param.name, { value: paramValue, style, explode }),\n )\n } else {\n const value = style === 'simple' ? serializeSimpleStyle(paramValue, explode) : paramValue\n substitutePathParameter(param.name, String(value))\n }\n break\n }\n\n case 'query': {\n // Content type parameters should be serialized according to the parameter's own content type\n if ('content' in param && param.content) {\n // We grab the first for now but eventually we should support selecting the content type per parameter\n const paramContentType = Object.keys(param.content)[0] ?? 'application/json'\n const serializedValue = serializeContentValue(paramValue, paramContentType)\n appendQueryParameter(param.name, serializedValue, param)\n break\n }\n\n // Handle query parameters\n switch (style) {\n case 'form': {\n const serialized = serializeFormStyle(paramValue, explode)\n\n // If serialized is an array of key-value pairs (exploded object or array)\n if (Array.isArray(serialized)) {\n for (const entry of serialized) {\n const key = entry.key || param.name\n appendQueryParameter(key, String(entry.value), param)\n }\n }\n // Otherwise, convert to string\n else {\n appendQueryParameter(param.name, String(serialized), param)\n }\n break\n }\n case 'spaceDelimited': {\n const serialized = serializeSpaceDelimitedStyle(paramValue)\n appendQueryParameter(param.name, serialized, param)\n break\n }\n case 'pipeDelimited': {\n const serialized = serializePipeDelimitedStyle(paramValue)\n appendQueryParameter(param.name, serialized, param)\n break\n }\n case 'deepObject': {\n // OAS marks deepObject-on-array and deepObject+explode:false as undefined.\n // Mirror process-body: fall back to form/explode:true for arrays and always\n // invoke the serializer for objects so authors get useful output instead of\n // a silently-dropped parameter.\n if (Array.isArray(paramValue)) {\n const serialized = serializeFormStyle(paramValue, true)\n if (Array.isArray(serialized)) {\n for (const entry of serialized) {\n const key = entry.key || param.name\n appendQueryParameter(key, String(entry.value), param)\n }\n } else {\n appendQueryParameter(param.name, String(serialized), param)\n }\n } else {\n const entries = serializeDeepObjectStyle(param.name, paramValue)\n for (const entry of entries) {\n appendQueryParameter(entry.key, entry.value, param)\n }\n }\n break\n }\n\n // Default to form style\n default:\n appendQueryParameter(param.name, String(paramValue), param)\n }\n break\n }\n\n // Headers only support 'simple' style according to OpenAPI 3.1.1\n // For arrays, simple style always produces comma-separated values regardless of explode\n // The explode parameter only affects object serialization\n case 'header': {\n const serialized = serializeSimpleStyle(paramValue, explode)\n newHeaders.push({ name: param.name, value: String(serialized) })\n break\n }\n\n // Keep cookie style separate so snippet generators cannot percent-encode it.\n case 'cookie': {\n const [major, minor] = (openapiVersion ?? '').split('.')\n const error =\n major === '3' && minor === '2' && !('content' in param)\n ? getCookieSerializationError(param, paramValue)\n : undefined\n if (error) {\n throw new CookieSerializationError(error)\n }\n if (style === 'cookie') {\n cookieStyleEntries.push(...serializeCookieStyle(param.name, paramValue, explode))\n break\n }\n const serialized = serializeFormStyleForCookies(paramValue, explode)\n\n // If serialized is an array of key-value pairs (exploded object or array)\n if (Array.isArray(serialized)) {\n for (const entry of serialized) {\n const key = entry.key || param.name\n const value = entry.value === null ? 'null' : String(entry.value)\n newCookies.push({ name: key, value })\n }\n }\n // Otherwise, convert to string\n else {\n const value = serialized === null ? 'null' : String(serialized)\n newCookies.push({ name: param.name, value })\n }\n break\n }\n }\n }\n\n // HAR cookie entries are encoded by snippet generators. Use a complete header\n // when cookie style is present, preserving legacy encoding for other cookies.\n if (cookieStyleEntries.length || serializedCookies.length) {\n const cookieValue = [\n ...newCookies.map((cookie) => `${encodeURIComponent(cookie.name)}=${encodeURIComponent(cookie.value)}`),\n ...cookieStyleEntries.map((cookie) => `${cookie.name}=${cookie.value}`),\n ...serializedCookies,\n ].join('; ')\n const existing = newHeaders.find((header) => header.name.toLowerCase() === 'cookie')\n if (existing) {\n newHeaders.splice(newHeaders.indexOf(existing), 1, {\n ...existing,\n value: existing.value ? `${existing.value}; ${cookieValue}` : cookieValue,\n })\n } else {\n newHeaders.push({ name: 'Cookie', value: cookieValue })\n }\n }\n\n if (serializedQuery.length) {\n const hashIndex = newUrl.indexOf('#')\n const hash = hashIndex < 0 ? '' : newUrl.slice(hashIndex)\n const base = hashIndex < 0 ? newUrl : newUrl.slice(0, hashIndex)\n newUrl = `${base}${base.includes('?') ? '&' : '?'}${serializedQuery.join('&')}${hash}`\n }\n\n if (hasReservedPathParameter) {\n assertReservedPathUrl(newUrl)\n }\n if (hasStyledLabel && hasPathDotSegment(newUrl, markedPathUrl)) {\n throw new URIError('A label-style path parameter produces a dot segment that browsers remove.')\n }\n\n return {\n url: newUrl,\n headers: newHeaders,\n queryString: newQueryString,\n cookies: cookieStyleEntries.length || serializedCookies.length ? [] : newCookies,\n hasCookieStyleEntries: cookieStyleEntries.length > 0 || serializedCookies.length > 0,\n ...(serializedQuery.length ? { hasSerializedQuery: true } : {}),\n }\n}\n"],"mappings":";;;;;;;;AAiCA,IAAaA,IAAb,cAA8C,MAAM,CAAC,GAc/CC,KAAqB,OACxBC,KAAU,CAAC,EAAA,CAAG,KAAK,MAAUC,EAAeC,CAAK,CAAC,CAAC,CAAC,QAAQ,MAAUA,MAAU,KAAA,CAAS,GAGtFC,KAAmB,MACnB,mBAAmBD,KAASA,EAAM,kBAAkB,KAAA,IAC/CA,EAAM,gBAEX,YAAYA,KAASA,EAAM,UAAU,OAAOA,EAAM,UAAW,YAAY,mBAAmBA,EAAM,SAC5FA,EAAM,OAAuC,kBAAkB,KAElE,IAOHE,KAA+B,MAAgE;CAEnG,IAAIF,EAAM,OAAO,UAEf,OAAO;EAAE,OAAO;EAAU,SADV,aAAaA,KAASA,EAAM,YAAY,KAAA,KAAYA,EAAM;CACxC;CAIpC,IAAIA,EAAM,OAAO,UAAU;EACzB,IAAMG,IAAU,aAAaH,KAASA,EAAM,YAAY,KAAA,IAAYA,EAAM,UAAU;EACpF,OAAO;GAAE,OAAO,WAAWA,KAASA,EAAM,UAAU,WAAW,WAAW;GAAQ;EAAQ;CAC5F;CAEA,IAAMI,IAAe;EACnB,MAAM;EACN,OAAO;EACP,aAAa;EACb,QAAQ;EACR,QAAQ;CACV,EAAEJ,EAAM,KAGFK,IAAQ,WAAWL,KAASA,EAAM,QAAQA,EAAM,QAAQI;CAK9D,OAAO;EAAE;EAAO,SAFA,aAAaJ,KAASA,EAAM,YAAY,KAAA,IAAYA,EAAM,UAAUK,MAAU;CAEtE;AAC1B,GAOMC,KACJ,GACA,GACA,GACA,GACA,MACY;CAEZ,IAAMC,IAAWC,EAAoBR,GAAOS,CAAO,GAC7CC,IAAeH,EAAS,SAEx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AAID,IACFzD,EAAW,OAAOA,EAAW,QAAQyD,CAAQ,GAAG,GAAG;GACjD,GAAGA;GACH,OAAOA,EAAS,QAAQ,GAAGA,EAAS,MAAM,IAAIF,MAAgBA;EAChE,CAAC,IAEDvD,EAAW,KAAK;GAAE,MAAM;GAAU,OAAOuD;EAAY,CAAC;CAE1D;CAEA,IAAI9C,EAAgB,QAAQ;EAC1B,IAAMY,IAAYhB,EAAO,QAAQ,GAAG,GAC9BiB,IAAOD,IAAY,IAAI,KAAKhB,EAAO,MAAMgB,CAAS,GAClDE,IAAOF,IAAY,IAAIhB,IAASA,EAAO,MAAM,GAAGgB,CAAS;EAC/D,IAAS,GAAGE,IAAOA,EAAK,SAAS,GAAG,IAAI,MAAM,MAAMd,EAAgB,KAAK,GAAG,IAAIa;CAClF;CAKA,IAHId,KACFmD,EAAsBtD,CAAM,GAE1BE,KAAkBqD,EAAkBvD,GAAQC,CAAa,GAC3D,MAAU,SAAS,2EAA2E;CAGhG,OAAO;EACL,KAAKD;EACL,SAASL;EACT,aAAaE;EACb,SAASE,EAAmB,UAAUM,EAAkB,SAAS,CAAC,IAAIP;EACtE,uBAAuBC,EAAmB,SAAS,KAAKM,EAAkB,SAAS;EACnF,GAAID,EAAgB,SAAS,EAAE,oBAAoB,GAAK,IAAI,CAAC;CAC/D;AACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AvailableClients } from '@scalar/snippetz';
|
|
2
2
|
import type { WorkspaceStore } from '@scalar/workspace-store/client';
|
|
3
|
-
import type
|
|
3
|
+
import { type SecuritySchemeObjectSecret } from '@scalar/workspace-store/request-example';
|
|
4
4
|
import type { ServerObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document';
|
|
5
5
|
import { type App } from 'vue';
|
|
6
6
|
import { type CreateAsyncApiCodeExampleOptions } from './mount-asyncapi';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mount.d.ts","sourceRoot":"","sources":["../../src/code-example/mount.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