@scalar/api-client 2.31.2 → 2.31.3
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 +42 -0
- package/dist/style.css +1 -1
- package/dist/v2/blocks/operation-code-sample/helpers/get-example-from-schema.d.ts.map +1 -1
- package/dist/v2/blocks/operation-code-sample/helpers/get-example-from-schema.js +73 -74
- package/dist/v2/blocks/request-block/helpers/get-default-headers.js +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.js +42 -40
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.d.ts +3 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.js +65 -59
- package/dist/v2/features/operation/Operation.vue.js +1 -1
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
- package/dist/views/Request/libs/oauth2.d.ts +7 -0
- package/dist/views/Request/libs/oauth2.d.ts.map +1 -1
- package/dist/views/Request/libs/oauth2.js +76 -64
- package/package.json +18 -18
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-example-from-schema.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-code-sample/helpers/get-example-from-schema.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-example-from-schema.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-code-sample/helpers/get-example-from-schema.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AA6bhG,KAAK,2BAA2B,GAAG;IACjC,+CAA+C;IAC/C,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,4CAA4C;IAC5C,GAAG,CAAC,EAAE,OAAO,CAAA;IACb,uDAAuD;IACvD,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;IACvB,iEAAiE;IACjE,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACnC,qDAAqD;IACrD,8BAA8B,CAAC,EAAE,OAAO,CAAA;CACzC,CAAA;AAYD;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,oBAAoB,GAC/B,QAAQ,YAAY,EACpB,UAAU,2BAA2B,EACrC,uCAKG,OAAO,CAAC;IACT,KAAK,EAAE,MAAM,CAAA;IACb,YAAY,EAAE,YAAY,CAAA;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,CAAA;CACtB,CAAM,KACN,OAuJF,CAAA"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { isDefined as
|
|
2
|
-
import {
|
|
3
|
-
import { unpackOverridesProxy as N } from "@scalar/workspace-store/helpers/overrides-proxy";
|
|
1
|
+
import { isDefined as v } from "@scalar/helpers/array/is-defined";
|
|
2
|
+
import { unpackProxyObject as D } from "@scalar/workspace-store/helpers/unpack-proxy";
|
|
4
3
|
import { resolve as y } from "@scalar/workspace-store/resolve";
|
|
5
|
-
const
|
|
4
|
+
const T = 10, q = "additionalProperty", j = (/* @__PURE__ */ new Date()).toISOString(), k = j.split("T")[0], C = j.split("T")[1].split(".")[0], M = {
|
|
6
5
|
"date-time": j,
|
|
7
6
|
date: k,
|
|
8
7
|
email: "hello@example.com",
|
|
@@ -22,14 +21,14 @@ const q = 10, T = "additionalProperty", j = (/* @__PURE__ */ new Date()).toISOSt
|
|
|
22
21
|
// https://tools.ietf.org/html/draft-handrews-relative-json-pointer-01
|
|
23
22
|
"relative-json-pointer": "1/nested/objects",
|
|
24
23
|
// full-time in https://tools.ietf.org/html/rfc3339#section-5.6
|
|
25
|
-
time:
|
|
24
|
+
time: C,
|
|
26
25
|
// either a URI or relative-reference https://tools.ietf.org/html/rfc3986#section-4.1
|
|
27
26
|
"uri-reference": "../folder",
|
|
28
27
|
"uri-template": "https://example.com/{id}",
|
|
29
28
|
uri: "https://example.com",
|
|
30
29
|
uuid: "123e4567-e89b-12d3-a456-426614174000",
|
|
31
30
|
"object-id": "6592008029c8c3e4dc76256c"
|
|
32
|
-
},
|
|
31
|
+
}, S = (e, i = !1, o = "") => "type" in e && e.type === "string" && "format" in e && e.format === "binary" ? "@filename" : i && "format" in e && e.format ? M[e.format] ?? o : o, A = /* @__PURE__ */ new WeakMap(), P = /* @__PURE__ */ new WeakMap(), N = (e) => D(e, { depth: 1 }), I = (e) => {
|
|
33
32
|
if (!e)
|
|
34
33
|
return;
|
|
35
34
|
const i = P.get(e);
|
|
@@ -42,39 +41,39 @@ const q = 10, T = "additionalProperty", j = (/* @__PURE__ */ new Date()).toISOSt
|
|
|
42
41
|
return P.set(e, l), l;
|
|
43
42
|
}
|
|
44
43
|
}
|
|
45
|
-
},
|
|
44
|
+
}, d = (e, i, o) => {
|
|
46
45
|
if (typeof i != "object" || i === null)
|
|
47
46
|
return i;
|
|
48
|
-
const l =
|
|
49
|
-
return
|
|
50
|
-
},
|
|
47
|
+
const l = N(e), f = A.get(l) ?? /* @__PURE__ */ new Map();
|
|
48
|
+
return f && f.set(o, i), A.set(l, f), i;
|
|
49
|
+
}, R = (e) => !!(e.allOf || e.oneOf || e.anyOf), _ = (e, i, o, l) => {
|
|
51
50
|
if (e.deprecated || l?.mode === "write" && e.readOnly || l?.mode === "read" && e.writeOnly)
|
|
52
51
|
return !0;
|
|
53
|
-
if (l?.omitEmptyAndOptionalProperties !== !0 || "type" in e && (e.type === "object" || e.type === "array") ||
|
|
52
|
+
if (l?.omitEmptyAndOptionalProperties !== !0 || "type" in e && (e.type === "object" || e.type === "array") || R(e) || "examples" in e && Array.isArray(e.examples) && e.examples.length > 0 || "example" in e && e.example !== void 0 || "default" in e && e.default !== void 0 || "const" in e && e.const !== void 0 || "enum" in e && Array.isArray(e.enum) && e.enum.length > 0)
|
|
54
53
|
return !1;
|
|
55
|
-
const r = o ?? e.title ?? "", t =
|
|
54
|
+
const r = o ?? e.title ?? "", t = I(i);
|
|
56
55
|
return !(t ? t.has(r) : !1);
|
|
57
|
-
},
|
|
56
|
+
}, E = (e, i) => Array.isArray(e) && Array.isArray(i) ? [...e, ...i] : e && typeof e == "object" && i && typeof i == "object" ? { ...e, ...i } : i, F = (e, i, o, l, f) => {
|
|
58
57
|
const r = {};
|
|
59
58
|
if ("properties" in e && e.properties) {
|
|
60
59
|
const t = Object.keys(e.properties), n = t.length;
|
|
61
60
|
for (let a = 0; a < n; a++) {
|
|
62
|
-
const
|
|
61
|
+
const g = t[a], u = y.schema(e.properties[g]);
|
|
63
62
|
if (!u)
|
|
64
63
|
continue;
|
|
65
|
-
const
|
|
64
|
+
const s = i?.xml && "xml" in u ? u.xml?.name : void 0, m = c(u, i, {
|
|
66
65
|
level: o + 1,
|
|
67
66
|
parentSchema: e,
|
|
68
|
-
name:
|
|
67
|
+
name: g,
|
|
69
68
|
seen: l
|
|
70
69
|
});
|
|
71
|
-
typeof m < "u" && (r[
|
|
70
|
+
typeof m < "u" && (r[s ?? g] = m);
|
|
72
71
|
}
|
|
73
72
|
}
|
|
74
73
|
if ("patternProperties" in e && e.patternProperties)
|
|
75
74
|
for (const t of Object.keys(e.patternProperties)) {
|
|
76
75
|
const n = y.schema(e.patternProperties[t]);
|
|
77
|
-
n && (r[t] =
|
|
76
|
+
n && (r[t] = c(n, i, {
|
|
78
77
|
level: o + 1,
|
|
79
78
|
parentSchema: e,
|
|
80
79
|
name: t,
|
|
@@ -82,8 +81,8 @@ const q = 10, T = "additionalProperty", j = (/* @__PURE__ */ new Date()).toISOSt
|
|
|
82
81
|
}));
|
|
83
82
|
}
|
|
84
83
|
if ("additionalProperties" in e && e.additionalProperties) {
|
|
85
|
-
const t = typeof e.additionalProperties == "boolean" ? e.additionalProperties : y.schema(e.additionalProperties), n = e.additionalProperties === !0 || typeof e.additionalProperties == "object" && Object.keys(e.additionalProperties).length === 0, a = typeof t == "object" && "x-additionalPropertiesName" in t && typeof t["x-additionalPropertiesName"] == "string" && t["x-additionalPropertiesName"].trim().length > 0 ? t["x-additionalPropertiesName"].trim() :
|
|
86
|
-
r[a] = n ? "anything" : typeof t == "object" ?
|
|
84
|
+
const t = typeof e.additionalProperties == "boolean" ? e.additionalProperties : y.schema(e.additionalProperties), n = e.additionalProperties === !0 || typeof e.additionalProperties == "object" && Object.keys(e.additionalProperties).length === 0, a = typeof t == "object" && "x-additionalPropertiesName" in t && typeof t["x-additionalPropertiesName"] == "string" && t["x-additionalPropertiesName"].trim().length > 0 ? t["x-additionalPropertiesName"].trim() : q;
|
|
85
|
+
r[a] = n ? "anything" : typeof t == "object" ? c(t, i, {
|
|
87
86
|
level: o + 1,
|
|
88
87
|
seen: l
|
|
89
88
|
}) : "anything";
|
|
@@ -91,7 +90,7 @@ const q = 10, T = "additionalProperty", j = (/* @__PURE__ */ new Date()).toISOSt
|
|
|
91
90
|
if (e.oneOf?.[0])
|
|
92
91
|
Object.assign(
|
|
93
92
|
r,
|
|
94
|
-
|
|
93
|
+
c(y.schema(e.oneOf[0]), i, {
|
|
95
94
|
level: o + 1,
|
|
96
95
|
seen: l
|
|
97
96
|
})
|
|
@@ -99,7 +98,7 @@ const q = 10, T = "additionalProperty", j = (/* @__PURE__ */ new Date()).toISOSt
|
|
|
99
98
|
else if (e.anyOf?.[0])
|
|
100
99
|
Object.assign(
|
|
101
100
|
r,
|
|
102
|
-
|
|
101
|
+
c(y.schema(e.anyOf[0]), i, {
|
|
103
102
|
level: o + 1,
|
|
104
103
|
seen: l
|
|
105
104
|
})
|
|
@@ -107,72 +106,72 @@ const q = 10, T = "additionalProperty", j = (/* @__PURE__ */ new Date()).toISOSt
|
|
|
107
106
|
else if (Array.isArray(e.allOf) && e.allOf.length > 0) {
|
|
108
107
|
let t = r;
|
|
109
108
|
for (const n of e.allOf) {
|
|
110
|
-
const a =
|
|
109
|
+
const a = c(y.schema(n), i, {
|
|
111
110
|
level: o + 1,
|
|
112
111
|
parentSchema: e,
|
|
113
112
|
seen: l
|
|
114
113
|
});
|
|
115
|
-
t =
|
|
114
|
+
t = E(t, a);
|
|
116
115
|
}
|
|
117
116
|
t && typeof t == "object" && Object.assign(r, t);
|
|
118
117
|
}
|
|
119
118
|
if (i?.xml && "xml" in e && e.xml?.name && o === 0) {
|
|
120
119
|
const t = {};
|
|
121
|
-
return t[e.xml.name] = r,
|
|
120
|
+
return t[e.xml.name] = r, d(e, t, f);
|
|
122
121
|
}
|
|
123
|
-
return
|
|
124
|
-
}, L = (e, i, o, l,
|
|
122
|
+
return d(e, r, f);
|
|
123
|
+
}, L = (e, i, o, l, f) => {
|
|
125
124
|
const r = "items" in e ? y.schema(e.items) : void 0, t = r && typeof r == "object" && "xml" in r ? r.xml?.name : void 0, n = !!(i?.xml && "xml" in e && e.xml?.wrapped && t);
|
|
126
125
|
if (e.example !== void 0)
|
|
127
|
-
return
|
|
126
|
+
return d(e, n ? { [t]: e.example } : e.example, f);
|
|
128
127
|
if (r && typeof r == "object") {
|
|
129
128
|
if (Array.isArray(r.allOf) && r.allOf.length > 0) {
|
|
130
|
-
const
|
|
129
|
+
const s = r.allOf.filter(v), m = y.schema(s[0]);
|
|
131
130
|
if (m && typeof m == "object" && "type" in m && m.type === "object") {
|
|
132
|
-
const b =
|
|
131
|
+
const b = c({ type: "object", allOf: s }, i, {
|
|
133
132
|
level: o + 1,
|
|
134
133
|
parentSchema: e,
|
|
135
134
|
seen: l
|
|
136
135
|
});
|
|
137
|
-
return
|
|
136
|
+
return d(e, n ? [{ [t]: b }] : [b], f);
|
|
138
137
|
}
|
|
139
|
-
const
|
|
140
|
-
(p) =>
|
|
138
|
+
const O = s.map(
|
|
139
|
+
(p) => c(y.schema(p), i, {
|
|
141
140
|
level: o + 1,
|
|
142
141
|
parentSchema: e,
|
|
143
142
|
seen: l
|
|
144
143
|
})
|
|
145
|
-
).filter(
|
|
146
|
-
return
|
|
144
|
+
).filter(v);
|
|
145
|
+
return d(
|
|
147
146
|
e,
|
|
148
|
-
n ?
|
|
149
|
-
|
|
147
|
+
n ? O.map((p) => ({ [t]: p })) : O,
|
|
148
|
+
f
|
|
150
149
|
);
|
|
151
150
|
}
|
|
152
151
|
const u = r.anyOf || r.oneOf;
|
|
153
152
|
if (u && u.length > 0) {
|
|
154
|
-
const
|
|
153
|
+
const s = u[0], m = c(y.schema(s), i, {
|
|
155
154
|
level: o + 1,
|
|
156
155
|
parentSchema: e,
|
|
157
156
|
seen: l
|
|
158
157
|
});
|
|
159
|
-
return
|
|
158
|
+
return d(e, n ? [{ [t]: m }] : [m], f);
|
|
160
159
|
}
|
|
161
160
|
}
|
|
162
|
-
const a = r && typeof r == "object" && ("type" in r && r.type === "object" || "properties" in r),
|
|
163
|
-
if (r && typeof r == "object" && ("type" in r && r.type || a ||
|
|
164
|
-
const u =
|
|
161
|
+
const a = r && typeof r == "object" && ("type" in r && r.type === "object" || "properties" in r), g = r && typeof r == "object" && ("type" in r && r.type === "array" || "items" in r);
|
|
162
|
+
if (r && typeof r == "object" && ("type" in r && r.type || a || g)) {
|
|
163
|
+
const u = c(r, i, {
|
|
165
164
|
level: o + 1,
|
|
166
165
|
seen: l
|
|
167
166
|
});
|
|
168
|
-
return
|
|
167
|
+
return d(e, n ? [{ [t]: u }] : [u], f);
|
|
169
168
|
}
|
|
170
|
-
return
|
|
169
|
+
return d(e, [], f);
|
|
171
170
|
}, U = (e, i, o) => {
|
|
172
171
|
if ("type" in e && e.type && !Array.isArray(e.type))
|
|
173
172
|
switch (e.type) {
|
|
174
173
|
case "string":
|
|
175
|
-
return
|
|
174
|
+
return S(e, i, o ?? "");
|
|
176
175
|
case "boolean":
|
|
177
176
|
return !0;
|
|
178
177
|
case "integer":
|
|
@@ -192,7 +191,7 @@ const q = 10, T = "additionalProperty", j = (/* @__PURE__ */ new Date()).toISOSt
|
|
|
192
191
|
if (l)
|
|
193
192
|
switch (l) {
|
|
194
193
|
case "string":
|
|
195
|
-
return
|
|
194
|
+
return S(e, i, o ?? "");
|
|
196
195
|
case "boolean":
|
|
197
196
|
return !0;
|
|
198
197
|
case "integer":
|
|
@@ -211,44 +210,44 @@ const q = 10, T = "additionalProperty", j = (/* @__PURE__ */ new Date()).toISOSt
|
|
|
211
210
|
mode: e?.mode,
|
|
212
211
|
variables: e?.variables,
|
|
213
212
|
omitEmptyAndOptionalProperties: e?.omitEmptyAndOptionalProperties
|
|
214
|
-
}),
|
|
213
|
+
}), c = (e, i, {
|
|
215
214
|
level: o = 0,
|
|
216
215
|
parentSchema: l,
|
|
217
|
-
name:
|
|
216
|
+
name: f,
|
|
218
217
|
seen: r = /* @__PURE__ */ new WeakSet()
|
|
219
218
|
} = {}) => {
|
|
220
219
|
const t = y.schema(e);
|
|
221
|
-
if (!
|
|
220
|
+
if (!v(t))
|
|
222
221
|
return;
|
|
223
|
-
const n =
|
|
222
|
+
const n = N(t);
|
|
224
223
|
if (r.has(n))
|
|
225
224
|
return;
|
|
226
225
|
r.add(n);
|
|
227
|
-
const a = X(i),
|
|
228
|
-
if (typeof
|
|
229
|
-
return r.delete(n),
|
|
230
|
-
if (o >
|
|
226
|
+
const a = X(i), g = A.get(n)?.get(a);
|
|
227
|
+
if (typeof g < "u")
|
|
228
|
+
return r.delete(n), g;
|
|
229
|
+
if (o > T)
|
|
231
230
|
return r.delete(n), "[Max Depth Exceeded]";
|
|
232
231
|
const u = !!i?.emptyString;
|
|
233
|
-
if (_(t, l,
|
|
232
|
+
if (_(t, l, f, i)) {
|
|
234
233
|
r.delete(n);
|
|
235
234
|
return;
|
|
236
235
|
}
|
|
237
236
|
if ("x-variable" in t && t["x-variable"]) {
|
|
238
237
|
const p = i?.variables?.[t["x-variable"]];
|
|
239
238
|
if (p !== void 0)
|
|
240
|
-
return "type" in t && (t.type === "number" || t.type === "integer") ? (r.delete(n),
|
|
239
|
+
return "type" in t && (t.type === "number" || t.type === "integer") ? (r.delete(n), d(t, Number(p), a)) : (r.delete(n), d(t, p, a));
|
|
241
240
|
}
|
|
242
241
|
if (Array.isArray(t.examples) && t.examples.length > 0)
|
|
243
|
-
return r.delete(n),
|
|
242
|
+
return r.delete(n), d(t, t.examples[0], a);
|
|
244
243
|
if (t.example !== void 0)
|
|
245
|
-
return r.delete(n),
|
|
244
|
+
return r.delete(n), d(t, t.example, a);
|
|
246
245
|
if (t.default !== void 0)
|
|
247
|
-
return r.delete(n),
|
|
246
|
+
return r.delete(n), d(t, t.default, a);
|
|
248
247
|
if (t.const !== void 0)
|
|
249
|
-
return r.delete(n),
|
|
248
|
+
return r.delete(n), d(t, t.const, a);
|
|
250
249
|
if (Array.isArray(t.enum) && t.enum.length > 0)
|
|
251
|
-
return r.delete(n),
|
|
250
|
+
return r.delete(n), d(t, t.enum[0], a);
|
|
252
251
|
if ("properties" in t || "type" in t && t.type === "object") {
|
|
253
252
|
const p = F(t, i, o, r, a);
|
|
254
253
|
return r.delete(n), p;
|
|
@@ -257,41 +256,41 @@ const q = 10, T = "additionalProperty", j = (/* @__PURE__ */ new Date()).toISOSt
|
|
|
257
256
|
const p = L(t, i, o, r, a);
|
|
258
257
|
return r.delete(n), p;
|
|
259
258
|
}
|
|
260
|
-
const
|
|
261
|
-
if (
|
|
262
|
-
return r.delete(n),
|
|
259
|
+
const s = U(t, u, i?.emptyString);
|
|
260
|
+
if (s !== void 0)
|
|
261
|
+
return r.delete(n), d(t, s, a);
|
|
263
262
|
const m = t.oneOf || t.anyOf;
|
|
264
263
|
if (Array.isArray(m) && m.length > 0) {
|
|
265
264
|
for (const p of m) {
|
|
266
265
|
const b = y.schema(p);
|
|
267
266
|
if (b && (!("type" in b) || b.type !== "null"))
|
|
268
|
-
return r.delete(n),
|
|
267
|
+
return r.delete(n), d(
|
|
269
268
|
t,
|
|
270
|
-
|
|
269
|
+
c(b, i, {
|
|
271
270
|
level: o + 1,
|
|
272
271
|
seen: r
|
|
273
272
|
}),
|
|
274
273
|
a
|
|
275
274
|
);
|
|
276
275
|
}
|
|
277
|
-
return r.delete(n),
|
|
276
|
+
return r.delete(n), d(t, null, a);
|
|
278
277
|
}
|
|
279
278
|
if (Array.isArray(t.allOf) && t.allOf.length > 0) {
|
|
280
279
|
let p;
|
|
281
280
|
const b = t.allOf;
|
|
282
|
-
for (const
|
|
283
|
-
const
|
|
281
|
+
for (const w of b) {
|
|
282
|
+
const x = c(w, i, {
|
|
284
283
|
level: o + 1,
|
|
285
284
|
parentSchema: t,
|
|
286
285
|
seen: r
|
|
287
286
|
});
|
|
288
|
-
p === void 0 ? p =
|
|
287
|
+
p === void 0 ? p = x : p && typeof p == "object" && x && typeof x == "object" ? p = E(p, x) : x !== void 0 && (p = x);
|
|
289
288
|
}
|
|
290
|
-
return r.delete(n),
|
|
289
|
+
return r.delete(n), d(t, p ?? null, a);
|
|
291
290
|
}
|
|
292
|
-
const
|
|
293
|
-
return
|
|
291
|
+
const O = W(t, u, i?.emptyString);
|
|
292
|
+
return O !== void 0 ? (r.delete(n), d(t, O, a)) : (r.delete(n), d(t, null, a));
|
|
294
293
|
};
|
|
295
294
|
export {
|
|
296
|
-
|
|
295
|
+
c as getExampleFromSchema
|
|
297
296
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { canMethodHaveBody as m } from "@scalar/helpers/http/can-method-have-body";
|
|
2
2
|
import { getResolvedRef as r } from "@scalar/workspace-store/helpers/get-resolved-ref";
|
|
3
3
|
import { isElectron as y } from "../../../../libs/electron.js";
|
|
4
|
-
const l = "2.31.
|
|
4
|
+
const l = "2.31.3", T = "application/json", C = "*/*", a = (n, s, o) => ({
|
|
5
5
|
name: n,
|
|
6
6
|
defaultValue: s,
|
|
7
7
|
isOverridden: o.has(n.toLowerCase())
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OAuth2.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"OAuth2.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue"],"names":[],"mappings":"AAoYA,OAAO,KAAK,EAEV,iBAAiB,EAClB,MAAM,gCAAgC,CAAA;AACvC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AAGnH,OAAO,KAAK,EAEV,YAAY,EACb,MAAM,8DAA8D,CAAA;AAOrE,OAAO,KAAK,EAIV,sBAAsB,EACtB,0BAA0B,EAC3B,MAAM,6DAA6D,CAAA;AAIpE,KAAK,WAAW,GAAG;IACjB,wCAAwC;IACxC,WAAW,EAAE,kBAAkB,CAAA;IAC/B,kBAAkB;IAClB,KAAK,EAAE,sBAAsB,CAAA;IAC7B,6BAA6B;IAC7B,IAAI,EAAE,MAAM,sBAAsB,CAAA;IAClC,sBAAsB;IACtB,cAAc,EAAE,MAAM,EAAE,CAAA;IACxB,sBAAsB;IACtB,MAAM,EAAE,0BAA0B,CAAA;IAClC,mCAAmC;IACnC,MAAM,EAAE,YAAY,GAAG,IAAI,CAAA;IAC3B,gBAAgB;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,kCAAkC;IAClC,IAAI,EAAE,MAAM,CAAA;IACZ,2CAA2C;IAC3C,QAAQ,EAAE,iBAAiB,CAAA;CAC5B,CAAC;AA+uBF,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;kFAGhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
|
@@ -2,12 +2,13 @@ import { defineComponent as P, computed as C, ref as R, watch as I, createElemen
|
|
|
2
2
|
import { useLoadingState as L, ScalarButton as k } from "@scalar/components";
|
|
3
3
|
import { pkceOptions as F } from "@scalar/oas-utils/entities/spec";
|
|
4
4
|
import { useToasts as A } from "@scalar/use-toasts";
|
|
5
|
-
import h from "
|
|
5
|
+
import { getEnvironmentVariables as h } from "../../operation-block/helpers/get-environment-variables.js";
|
|
6
|
+
import E from "./OAuthScopesInput.vue.js";
|
|
6
7
|
/* empty css */
|
|
7
8
|
import { authorizeOauth2 as N } from "../helpers/oauth.js";
|
|
8
9
|
import c from "./RequestAuthDataTableInput.vue.js";
|
|
9
10
|
import u from "../../../../components/DataTable/DataTableRow.vue.js";
|
|
10
|
-
const j = { class: "flex h-8 items-center justify-end gap-2 border-t" },
|
|
11
|
+
const j = { class: "flex h-8 items-center justify-end gap-2 border-t" }, Q = { class: "flex h-8 w-full items-center justify-end border-t" }, J = /* @__PURE__ */ P({
|
|
11
12
|
__name: "OAuth2",
|
|
12
13
|
props: {
|
|
13
14
|
environment: {},
|
|
@@ -22,8 +23,8 @@ const j = { class: "flex h-8 items-center justify-end gap-2 border-t" }, E = { c
|
|
|
22
23
|
},
|
|
23
24
|
emits: ["update:selectedScopes"],
|
|
24
25
|
setup(t, { emit: g }) {
|
|
25
|
-
const z = g, y = L(), { toast: B } = A(),
|
|
26
|
-
() => t.selectedScopes.filter((s) => s in (
|
|
26
|
+
const z = g, y = L(), { toast: B } = A(), n = C(() => t.flows[t.type]), U = C(
|
|
27
|
+
() => t.selectedScopes.filter((s) => s in (n.value.scopes ?? {}))
|
|
27
28
|
), x = (s) => {
|
|
28
29
|
if (t.scheme.type === "openIdConnect")
|
|
29
30
|
return i(s);
|
|
@@ -46,9 +47,9 @@ const j = { class: "flex h-8 items-center justify-end gap-2 border-t" }, E = { c
|
|
|
46
47
|
name: t.name
|
|
47
48
|
}), w = R(!1);
|
|
48
49
|
I(
|
|
49
|
-
() =>
|
|
50
|
+
() => n.value["x-scalar-secret-redirect-uri"],
|
|
50
51
|
(s) => {
|
|
51
|
-
w.value || s || typeof window > "u" || !("x-scalar-secret-redirect-uri" in
|
|
52
|
+
w.value || s || typeof window > "u" || !("x-scalar-secret-redirect-uri" in n.value) || (w.value = !0, i({
|
|
52
53
|
"x-scalar-secret-redirect-uri": window.location.origin + window.location.pathname
|
|
53
54
|
}));
|
|
54
55
|
},
|
|
@@ -63,22 +64,23 @@ const j = { class: "flex h-8 items-center justify-end gap-2 border-t" }, E = { c
|
|
|
63
64
|
t.type,
|
|
64
65
|
U.value,
|
|
65
66
|
t.server,
|
|
66
|
-
t.proxyUrl
|
|
67
|
+
t.proxyUrl,
|
|
68
|
+
h(t.environment)
|
|
67
69
|
);
|
|
68
70
|
await y.clear(), e ? i({ "x-scalar-secret-token": e }) : (console.error(s), B(s?.message ?? "Failed to authorize", "error"));
|
|
69
71
|
}, O = (s) => x({
|
|
70
72
|
"x-scalar-credentials-location": s === "body" ? "body" : "header"
|
|
71
73
|
});
|
|
72
|
-
return (s, e) =>
|
|
74
|
+
return (s, e) => n.value["x-scalar-secret-token"] ? (m(), p(V, { key: 0 }, [
|
|
73
75
|
r(o(u), null, {
|
|
74
76
|
default: l(() => [
|
|
75
77
|
r(c, {
|
|
76
78
|
class: "border-r-transparent",
|
|
77
79
|
environment: t.environment,
|
|
78
|
-
modelValue:
|
|
80
|
+
modelValue: n.value["x-scalar-secret-token"],
|
|
79
81
|
placeholder: "QUxMIFlPVVIgQkFTRSBBUkUgQkVMT05HIFRPIFVT",
|
|
80
82
|
type: "password",
|
|
81
|
-
"onUpdate:modelValue": e[0] || (e[0] = (
|
|
83
|
+
"onUpdate:modelValue": e[0] || (e[0] = (a) => i({ "x-scalar-secret-token": a }))
|
|
82
84
|
}, {
|
|
83
85
|
default: l(() => [...e[12] || (e[12] = [
|
|
84
86
|
d(" Access Token ", -1)
|
|
@@ -110,25 +112,25 @@ const j = { class: "flex h-8 items-center justify-end gap-2 border-t" }, E = { c
|
|
|
110
112
|
], 64)) : (m(), p(V, { key: 1 }, [
|
|
111
113
|
r(o(u), null, {
|
|
112
114
|
default: l(() => [
|
|
113
|
-
"authorizationUrl" in
|
|
115
|
+
"authorizationUrl" in n.value ? (m(), f(c, {
|
|
114
116
|
key: 0,
|
|
115
117
|
containerClass: "border-r-0",
|
|
116
118
|
environment: t.environment,
|
|
117
|
-
modelValue:
|
|
119
|
+
modelValue: n.value.authorizationUrl,
|
|
118
120
|
placeholder: "https://galaxy.scalar.com/authorize",
|
|
119
|
-
"onUpdate:modelValue": e[2] || (e[2] = (
|
|
121
|
+
"onUpdate:modelValue": e[2] || (e[2] = (a) => x({ authorizationUrl: a }))
|
|
120
122
|
}, {
|
|
121
123
|
default: l(() => [...e[14] || (e[14] = [
|
|
122
124
|
d(" Auth URL ", -1)
|
|
123
125
|
])]),
|
|
124
126
|
_: 1
|
|
125
127
|
}, 8, ["environment", "modelValue"])) : v("", !0),
|
|
126
|
-
"tokenUrl" in
|
|
128
|
+
"tokenUrl" in n.value ? (m(), f(c, {
|
|
127
129
|
key: 1,
|
|
128
130
|
environment: t.environment,
|
|
129
|
-
modelValue:
|
|
131
|
+
modelValue: n.value.tokenUrl,
|
|
130
132
|
placeholder: "https://galaxy.scalar.com/token",
|
|
131
|
-
"onUpdate:modelValue": e[3] || (e[3] = (
|
|
133
|
+
"onUpdate:modelValue": e[3] || (e[3] = (a) => x({ tokenUrl: a }))
|
|
132
134
|
}, {
|
|
133
135
|
default: l(() => [...e[15] || (e[15] = [
|
|
134
136
|
d(" Token URL ", -1)
|
|
@@ -138,13 +140,13 @@ const j = { class: "flex h-8 items-center justify-end gap-2 border-t" }, E = { c
|
|
|
138
140
|
]),
|
|
139
141
|
_: 1
|
|
140
142
|
}),
|
|
141
|
-
"x-scalar-secret-redirect-uri" in
|
|
143
|
+
"x-scalar-secret-redirect-uri" in n.value ? (m(), f(o(u), { key: 0 }, {
|
|
142
144
|
default: l(() => [
|
|
143
145
|
r(c, {
|
|
144
146
|
environment: t.environment,
|
|
145
|
-
modelValue:
|
|
147
|
+
modelValue: n.value["x-scalar-secret-redirect-uri"],
|
|
146
148
|
placeholder: "https://galaxy.scalar.com/callback",
|
|
147
|
-
"onUpdate:modelValue": e[4] || (e[4] = (
|
|
149
|
+
"onUpdate:modelValue": e[4] || (e[4] = (a) => i({ "x-scalar-secret-redirect-uri": a }))
|
|
148
150
|
}, {
|
|
149
151
|
default: l(() => [...e[16] || (e[16] = [
|
|
150
152
|
d(" Redirect URL ", -1)
|
|
@@ -154,15 +156,15 @@ const j = { class: "flex h-8 items-center justify-end gap-2 border-t" }, E = { c
|
|
|
154
156
|
]),
|
|
155
157
|
_: 1
|
|
156
158
|
})) : v("", !0),
|
|
157
|
-
"x-scalar-secret-username" in
|
|
159
|
+
"x-scalar-secret-username" in n.value && "x-scalar-secret-password" in n.value ? (m(), p(V, { key: 1 }, [
|
|
158
160
|
r(o(u), null, {
|
|
159
161
|
default: l(() => [
|
|
160
162
|
r(c, {
|
|
161
163
|
class: "text-c-2",
|
|
162
164
|
environment: t.environment,
|
|
163
|
-
modelValue:
|
|
165
|
+
modelValue: n.value["x-scalar-secret-username"],
|
|
164
166
|
placeholder: "janedoe",
|
|
165
|
-
"onUpdate:modelValue": e[5] || (e[5] = (
|
|
167
|
+
"onUpdate:modelValue": e[5] || (e[5] = (a) => i({ "x-scalar-secret-username": a }))
|
|
166
168
|
}, {
|
|
167
169
|
default: l(() => [...e[17] || (e[17] = [
|
|
168
170
|
d(" Username ", -1)
|
|
@@ -176,10 +178,10 @@ const j = { class: "flex h-8 items-center justify-end gap-2 border-t" }, E = { c
|
|
|
176
178
|
default: l(() => [
|
|
177
179
|
r(c, {
|
|
178
180
|
environment: t.environment,
|
|
179
|
-
modelValue:
|
|
181
|
+
modelValue: n.value["x-scalar-secret-password"],
|
|
180
182
|
placeholder: "********",
|
|
181
183
|
type: "password",
|
|
182
|
-
"onUpdate:modelValue": e[6] || (e[6] = (
|
|
184
|
+
"onUpdate:modelValue": e[6] || (e[6] = (a) => i({ "x-scalar-secret-password": a }))
|
|
183
185
|
}, {
|
|
184
186
|
default: l(() => [...e[18] || (e[18] = [
|
|
185
187
|
d(" Password ", -1)
|
|
@@ -194,9 +196,9 @@ const j = { class: "flex h-8 items-center justify-end gap-2 border-t" }, E = { c
|
|
|
194
196
|
default: l(() => [
|
|
195
197
|
r(c, {
|
|
196
198
|
environment: t.environment,
|
|
197
|
-
modelValue:
|
|
199
|
+
modelValue: n.value["x-scalar-secret-client-id"],
|
|
198
200
|
placeholder: "12345",
|
|
199
|
-
"onUpdate:modelValue": e[7] || (e[7] = (
|
|
201
|
+
"onUpdate:modelValue": e[7] || (e[7] = (a) => i({ "x-scalar-secret-client-id": a }))
|
|
200
202
|
}, {
|
|
201
203
|
default: l(() => [...e[19] || (e[19] = [
|
|
202
204
|
d(" Client ID ", -1)
|
|
@@ -206,14 +208,14 @@ const j = { class: "flex h-8 items-center justify-end gap-2 border-t" }, E = { c
|
|
|
206
208
|
]),
|
|
207
209
|
_: 1
|
|
208
210
|
}),
|
|
209
|
-
"x-scalar-secret-client-secret" in
|
|
211
|
+
"x-scalar-secret-client-secret" in n.value ? (m(), f(o(u), { key: 2 }, {
|
|
210
212
|
default: l(() => [
|
|
211
213
|
r(c, {
|
|
212
214
|
environment: t.environment,
|
|
213
|
-
modelValue:
|
|
215
|
+
modelValue: n.value["x-scalar-secret-client-secret"],
|
|
214
216
|
placeholder: "XYZ123",
|
|
215
217
|
type: "password",
|
|
216
|
-
"onUpdate:modelValue": e[8] || (e[8] = (
|
|
218
|
+
"onUpdate:modelValue": e[8] || (e[8] = (a) => i({ "x-scalar-secret-client-secret": a }))
|
|
217
219
|
}, {
|
|
218
220
|
default: l(() => [...e[20] || (e[20] = [
|
|
219
221
|
d(" Client Secret ", -1)
|
|
@@ -223,15 +225,15 @@ const j = { class: "flex h-8 items-center justify-end gap-2 border-t" }, E = { c
|
|
|
223
225
|
]),
|
|
224
226
|
_: 1
|
|
225
227
|
})) : v("", !0),
|
|
226
|
-
"x-usePkce" in
|
|
228
|
+
"x-usePkce" in n.value ? (m(), f(o(u), { key: 3 }, {
|
|
227
229
|
default: l(() => [
|
|
228
230
|
r(c, {
|
|
229
231
|
enum: o(F),
|
|
230
232
|
environment: t.environment,
|
|
231
|
-
modelValue:
|
|
233
|
+
modelValue: n.value["x-usePkce"],
|
|
232
234
|
readOnly: "",
|
|
233
|
-
"onUpdate:modelValue": e[9] || (e[9] = (
|
|
234
|
-
"x-usePkce":
|
|
235
|
+
"onUpdate:modelValue": e[9] || (e[9] = (a) => x({
|
|
236
|
+
"x-usePkce": a
|
|
235
237
|
}))
|
|
236
238
|
}, {
|
|
237
239
|
default: l(() => [...e[21] || (e[21] = [
|
|
@@ -247,10 +249,10 @@ const j = { class: "flex h-8 items-center justify-end gap-2 border-t" }, E = { c
|
|
|
247
249
|
r(c, {
|
|
248
250
|
enum: ["header", "body"],
|
|
249
251
|
environment: t.environment,
|
|
250
|
-
modelValue:
|
|
252
|
+
modelValue: n.value["x-scalar-credentials-location"] || "header",
|
|
251
253
|
placeholder: "header",
|
|
252
254
|
readOnly: "",
|
|
253
|
-
"onUpdate:modelValue": e[10] || (e[10] = (
|
|
255
|
+
"onUpdate:modelValue": e[10] || (e[10] = (a) => O(a))
|
|
254
256
|
}, {
|
|
255
257
|
default: l(() => [...e[22] || (e[22] = [
|
|
256
258
|
d(" Credentials Location ", -1)
|
|
@@ -262,18 +264,18 @@ const j = { class: "flex h-8 items-center justify-end gap-2 border-t" }, E = { c
|
|
|
262
264
|
})) : v("", !0),
|
|
263
265
|
r(o(u), null, {
|
|
264
266
|
default: l(() => [
|
|
265
|
-
r(
|
|
266
|
-
flow:
|
|
267
|
+
r(E, {
|
|
268
|
+
flow: n.value,
|
|
267
269
|
flowType: t.type,
|
|
268
270
|
selectedScopes: U.value,
|
|
269
|
-
"onUpdate:selectedScopes": e[11] || (e[11] = (
|
|
271
|
+
"onUpdate:selectedScopes": e[11] || (e[11] = (a) => z("update:selectedScopes", a))
|
|
270
272
|
}, null, 8, ["flow", "flowType", "selectedScopes"])
|
|
271
273
|
]),
|
|
272
274
|
_: 1
|
|
273
275
|
}),
|
|
274
276
|
r(o(u), { class: "min-w-full" }, {
|
|
275
277
|
default: l(() => [
|
|
276
|
-
S("div",
|
|
278
|
+
S("div", Q, [
|
|
277
279
|
t.scheme.type === "openIdConnect" ? (m(), f(o(k), {
|
|
278
280
|
key: 0,
|
|
279
281
|
class: "mr-1 p-0 px-2 py-0.5",
|
|
@@ -307,5 +309,5 @@ const j = { class: "flex h-8 items-center justify-end gap-2 border-t" }, E = { c
|
|
|
307
309
|
}
|
|
308
310
|
});
|
|
309
311
|
export {
|
|
310
|
-
|
|
312
|
+
J as default
|
|
311
313
|
};
|
|
@@ -10,5 +10,7 @@ export declare const authorizeOauth2: (flows: OAuthFlowsObjectSecret, type: keyo
|
|
|
10
10
|
/** We use the active server to set a base for relative redirect uris */
|
|
11
11
|
activeServer: ServerObject | null,
|
|
12
12
|
/** If we want to use the proxy */
|
|
13
|
-
proxyUrl: string
|
|
13
|
+
proxyUrl: string,
|
|
14
|
+
/** Flattened environment variables used to resolve server URL templates like `{protocol}` */
|
|
15
|
+
environmentVariables?: Record<string, string>) => Promise<ErrorResponse<string>>;
|
|
14
16
|
//# sourceMappingURL=oauth.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/helpers/oauth.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAGhG,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAClD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6DAA6D,CAAA;
|
|
1
|
+
{"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/helpers/oauth.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAGhG,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAClD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6DAA6D,CAAA;AA+DzG;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAC1B,OAAO,sBAAsB,EAC7B,MAAM,MAAM,sBAAsB,EAClC,gBAAgB,MAAM,EAAE;AACxB,wEAAwE;AACxE,cAAc,YAAY,GAAG,IAAI;AACjC,kCAAkC;AAClC,UAAU,MAAM;AAChB,6FAA6F;AAC7F,uBAAsB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,KAChD,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,CAqL/B,CAAA"}
|