zudoku 0.40.1 → 0.41.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/dist/app/ZuploBuildConfig.d.ts +155 -0
- package/dist/app/ZuploBuildConfig.js +29 -0
- package/dist/app/ZuploBuildConfig.js.map +1 -0
- package/dist/app/env.d.ts +33 -0
- package/dist/app/env.js +29 -0
- package/dist/app/env.js.map +1 -0
- package/dist/app/main.js +7 -4
- package/dist/app/main.js.map +1 -1
- package/dist/cli/cli.js +12 -1
- package/dist/cli/cli.js.map +1 -1
- package/dist/cli/common/machine-id/lib.js +1 -0
- package/dist/cli/common/machine-id/lib.js.map +1 -1
- package/dist/config/loader.js +0 -3
- package/dist/config/loader.js.map +1 -1
- package/dist/config/validators/common.d.ts +17 -11
- package/dist/config/validators/common.js +1 -1
- package/dist/config/validators/common.js.map +1 -1
- package/dist/config/validators/validate.d.ts +7 -5
- package/dist/lib/authentication/providers/openid.d.ts +3 -1
- package/dist/lib/authentication/providers/openid.js +17 -11
- package/dist/lib/authentication/providers/openid.js.map +1 -1
- package/dist/lib/components/BuildCheck.d.ts +4 -0
- package/dist/lib/components/BuildCheck.js +22 -0
- package/dist/lib/components/BuildCheck.js.map +1 -0
- package/dist/lib/components/Search.js +1 -1
- package/dist/lib/components/Search.js.map +1 -1
- package/dist/lib/components/Zudoku.js +1 -3
- package/dist/lib/components/Zudoku.js.map +1 -1
- package/dist/lib/components/context/ViewportAnchorContext.js +8 -9
- package/dist/lib/components/context/ViewportAnchorContext.js.map +1 -1
- package/dist/lib/components/index.d.ts +4 -0
- package/dist/lib/components/index.js +2 -0
- package/dist/lib/components/index.js.map +1 -1
- package/dist/lib/components/navigation/PoweredByZudoku.js +2 -1
- package/dist/lib/components/navigation/PoweredByZudoku.js.map +1 -1
- package/dist/lib/components/navigation/ZuploLogo.d.ts +3 -0
- package/dist/lib/components/navigation/ZuploLogo.js +4 -0
- package/dist/lib/components/navigation/ZuploLogo.js.map +1 -0
- package/dist/lib/oas/parser/index.d.ts +1 -1
- package/dist/lib/oas/parser/index.js +3 -2
- package/dist/lib/oas/parser/index.js.map +1 -1
- package/dist/lib/plugins/openapi/OperationList.d.ts +1 -1
- package/dist/lib/plugins/openapi/OperationList.js +6 -4
- package/dist/lib/plugins/openapi/OperationList.js.map +1 -1
- package/dist/lib/plugins/openapi/util/getRoutes.js +20 -13
- package/dist/lib/plugins/openapi/util/getRoutes.js.map +1 -1
- package/dist/lib/util/ensureArray.d.ts +1 -0
- package/dist/lib/util/ensureArray.js +2 -0
- package/dist/lib/util/ensureArray.js.map +1 -0
- package/dist/vite/api/SchemaManager.d.ts +36 -0
- package/dist/vite/api/SchemaManager.js +120 -0
- package/dist/vite/api/SchemaManager.js.map +1 -0
- package/dist/vite/api/SchemaManager.test.d.ts +1 -0
- package/dist/vite/api/SchemaManager.test.js +106 -0
- package/dist/vite/api/SchemaManager.test.js.map +1 -0
- package/dist/vite/config.js +5 -1
- package/dist/vite/config.js.map +1 -1
- package/dist/vite/plugin-api.js +38 -110
- package/dist/vite/plugin-api.js.map +1 -1
- package/dist/vite/plugin-sidebar.d.ts +3 -1
- package/dist/vite/plugin-sidebar.js +8 -2
- package/dist/vite/plugin-sidebar.js.map +1 -1
- package/dist/zuplo/with-zuplo-processors.js +1 -1
- package/dist/zuplo/with-zuplo-processors.js.map +1 -1
- package/dist/zuplo/with-zuplo.d.ts +3 -0
- package/dist/zuplo/with-zuplo.js +6 -9
- package/dist/zuplo/with-zuplo.js.map +1 -1
- package/lib/{Markdown-C5h6bxbE.js → Markdown-DqDbGCj2.js} +314 -315
- package/lib/{Markdown-C5h6bxbE.js.map → Markdown-DqDbGCj2.js.map} +1 -1
- package/lib/{MdxPage-B66ht0D_.js → MdxPage-B7MyVLV5.js} +5 -5
- package/lib/{MdxPage-B66ht0D_.js.map → MdxPage-B7MyVLV5.js.map} +1 -1
- package/lib/{OasProvider-BKPF0Pbt.js → OasProvider-DY8kA-9x.js} +2 -2
- package/lib/{OasProvider-BKPF0Pbt.js.map → OasProvider-DY8kA-9x.js.map} +1 -1
- package/lib/{OperationList-0bhBU7ME.js → OperationList-BNneqYos.js} +798 -794
- package/lib/{OperationList-0bhBU7ME.js.map → OperationList-BNneqYos.js.map} +1 -1
- package/lib/{Pagination-Bt1czAiJ.js → Pagination-9TA5cwCh.js} +2 -2
- package/lib/{Pagination-Bt1czAiJ.js.map → Pagination-9TA5cwCh.js.map} +1 -1
- package/lib/{SchemaList-CsTIT1pi.js → SchemaList-CbFxph_p.js} +5 -5
- package/lib/{SchemaList-CsTIT1pi.js.map → SchemaList-CbFxph_p.js.map} +1 -1
- package/lib/{SchemaView-DCSWtnYr.js → SchemaView-DwlVvFfp.js} +2 -2
- package/lib/{SchemaView-DCSWtnYr.js.map → SchemaView-DwlVvFfp.js.map} +1 -1
- package/lib/{SlotletProvider-VUmTNmLZ.js → SlotletProvider-p4XaFFOh.js} +2 -2
- package/lib/{SlotletProvider-VUmTNmLZ.js.map → SlotletProvider-p4XaFFOh.js.map} +1 -1
- package/lib/{Toc-BK39DQvI.js → Toc-BVdRaIC0.js} +2 -2
- package/lib/{Toc-BK39DQvI.js.map → Toc-BVdRaIC0.js.map} +1 -1
- package/lib/{createServer-DLN7APz_.js → createServer-D_5UkLtY.js} +1459 -1485
- package/lib/createServer-D_5UkLtY.js.map +1 -0
- package/lib/{index-tpbiZmWp.js → index-BPmAnNGI.js} +686 -648
- package/lib/index-BPmAnNGI.js.map +1 -0
- package/lib/index-BpThvE5R.js +66 -0
- package/lib/index-BpThvE5R.js.map +1 -0
- package/lib/{index-Ba_X7EnR.js → index-pAogBEk7.js} +255 -249
- package/lib/{index-Ba_X7EnR.js.map → index-pAogBEk7.js.map} +1 -1
- package/lib/index-ueM1dihS.js +247 -0
- package/lib/index-ueM1dihS.js.map +1 -0
- package/lib/{index-DcHeSvkE.js → public-api-CrAQFYc4.js} +651 -684
- package/lib/public-api-CrAQFYc4.js.map +1 -0
- package/lib/zudoku.auth-openid.js +144 -138
- package/lib/zudoku.auth-openid.js.map +1 -1
- package/lib/zudoku.components.js +23 -22
- package/lib/zudoku.plugin-api-catalog.js +2 -2
- package/lib/zudoku.plugin-api-keys.js +1 -1
- package/lib/zudoku.plugin-custom-pages.js +1 -1
- package/lib/zudoku.plugin-markdown.js +1 -1
- package/lib/zudoku.plugin-openapi.js +1 -1
- package/package.json +2 -2
- package/src/app/ZuploBuildConfig.ts +33 -0
- package/src/app/env.ts +35 -0
- package/src/app/main.tsx +12 -1
- package/src/lib/authentication/providers/openid.tsx +23 -12
- package/src/lib/components/BuildCheck.tsx +60 -0
- package/src/lib/components/Search.tsx +1 -1
- package/src/lib/components/Zudoku.tsx +1 -3
- package/src/lib/components/context/ViewportAnchorContext.tsx +8 -15
- package/src/lib/components/index.ts +2 -0
- package/src/lib/components/navigation/PoweredByZudoku.tsx +8 -3
- package/src/lib/components/navigation/ZuploLogo.tsx +14 -0
- package/src/lib/oas/parser/index.ts +4 -2
- package/src/lib/plugins/openapi/OperationList.tsx +15 -3
- package/src/lib/plugins/openapi/util/getRoutes.tsx +21 -13
- package/src/lib/util/ensureArray.ts +3 -0
- package/client.d.ts +0 -8
- package/dist/lib/oas/parser/upgrade/index.d.ts +0 -9
- package/dist/lib/oas/parser/upgrade/index.js +0 -90
- package/dist/lib/oas/parser/upgrade/index.js.map +0 -1
- package/dist/zuplo/env.d.ts +0 -7
- package/dist/zuplo/env.js +0 -12
- package/dist/zuplo/env.js.map +0 -1
- package/lib/createServer-DLN7APz_.js.map +0 -1
- package/lib/index-DcHeSvkE.js.map +0 -1
- package/lib/index-tpbiZmWp.js.map +0 -1
- package/src/lib/oas/parser/upgrade/index.ts +0 -103
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
1
|
+
var Ce = Object.defineProperty;
|
|
2
|
+
var Le = (t, e, n) => e in t ? Ce(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
+
var w = (t, e, n) => Le(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
4
|
import { j as B } from "./jsx-runtime-C5mzlN2N.js";
|
|
5
|
-
import { g as
|
|
5
|
+
import { g as xe } from "./_commonjsHelpers-B4e78b8K.js";
|
|
6
6
|
import { C as Ie } from "./ClientOnly-E7hGysn1.js";
|
|
7
|
-
import { d as je, f as ie, u as
|
|
7
|
+
import { d as je, f as ie, u as L } from "./hook-pPrHCB6G.js";
|
|
8
8
|
import { A as Je } from "./AuthenticationPlugin-CJOFRBk3.js";
|
|
9
9
|
import { N as Oe } from "./chunk-KNED5TY2-BUPjb3LQ.js";
|
|
10
10
|
import { Z as ze } from "./invariant-Caa8-XvF.js";
|
|
@@ -37,7 +37,7 @@ function Ne() {
|
|
|
37
37
|
function p() {
|
|
38
38
|
console.log && (console.log.apply ? console.log.apply(console, arguments) : Function.prototype.apply.apply(console.log, [console, arguments])), console.trace && console.trace();
|
|
39
39
|
}
|
|
40
|
-
function
|
|
40
|
+
function _(l) {
|
|
41
41
|
return l === "debug" && (l = "log"), typeof console === n ? !1 : l === "trace" && o ? p : console[l] !== void 0 ? c(console, l) : console.log !== void 0 ? c(console, "log") : e;
|
|
42
42
|
}
|
|
43
43
|
function f() {
|
|
@@ -53,14 +53,14 @@ function Ne() {
|
|
|
53
53
|
typeof console !== n && (f.call(this), this[l].apply(this, arguments));
|
|
54
54
|
};
|
|
55
55
|
}
|
|
56
|
-
function
|
|
57
|
-
return
|
|
56
|
+
function b(l, m, u) {
|
|
57
|
+
return _(l) || v.apply(this, arguments);
|
|
58
58
|
}
|
|
59
|
-
function
|
|
59
|
+
function d(l, m) {
|
|
60
60
|
var u = this, J, $, U, S = "loglevel";
|
|
61
61
|
typeof l == "string" ? S += ":" + l : typeof l == "symbol" && (S = void 0);
|
|
62
|
-
function Re(
|
|
63
|
-
var y = (a[
|
|
62
|
+
function Re(h) {
|
|
63
|
+
var y = (a[h] || "silent").toUpperCase();
|
|
64
64
|
if (!(typeof window === n || !S)) {
|
|
65
65
|
try {
|
|
66
66
|
window.localStorage[S] = y;
|
|
@@ -74,21 +74,21 @@ function Ne() {
|
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
function ne() {
|
|
77
|
-
var
|
|
77
|
+
var h;
|
|
78
78
|
if (!(typeof window === n || !S)) {
|
|
79
79
|
try {
|
|
80
|
-
|
|
80
|
+
h = window.localStorage[S];
|
|
81
81
|
} catch {
|
|
82
82
|
}
|
|
83
|
-
if (typeof
|
|
83
|
+
if (typeof h === n)
|
|
84
84
|
try {
|
|
85
85
|
var y = window.document.cookie, O = encodeURIComponent(S), oe = y.indexOf(O + "=");
|
|
86
|
-
oe !== -1 && (
|
|
86
|
+
oe !== -1 && (h = /^([^;]+)/.exec(
|
|
87
87
|
y.slice(oe + O.length + 1)
|
|
88
88
|
)[1]);
|
|
89
89
|
} catch {
|
|
90
90
|
}
|
|
91
|
-
return u.levels[
|
|
91
|
+
return u.levels[h] === void 0 && (h = void 0), h;
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
function Pe() {
|
|
@@ -103,11 +103,11 @@ function Ne() {
|
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
|
-
function
|
|
107
|
-
var y =
|
|
106
|
+
function C(h) {
|
|
107
|
+
var y = h;
|
|
108
108
|
if (typeof y == "string" && u.levels[y.toUpperCase()] !== void 0 && (y = u.levels[y.toUpperCase()]), typeof y == "number" && y >= 0 && y <= u.levels.SILENT)
|
|
109
109
|
return y;
|
|
110
|
-
throw new TypeError("log.setLevel() called with invalid level: " +
|
|
110
|
+
throw new TypeError("log.setLevel() called with invalid level: " + h);
|
|
111
111
|
}
|
|
112
112
|
u.name = l, u.levels = {
|
|
113
113
|
TRACE: 0,
|
|
@@ -116,33 +116,33 @@ function Ne() {
|
|
|
116
116
|
WARN: 3,
|
|
117
117
|
ERROR: 4,
|
|
118
118
|
SILENT: 5
|
|
119
|
-
}, u.methodFactory = m ||
|
|
119
|
+
}, u.methodFactory = m || b, u.getLevel = function() {
|
|
120
120
|
return U ?? $ ?? J;
|
|
121
|
-
}, u.setLevel = function(
|
|
122
|
-
return U =
|
|
123
|
-
}, u.setDefaultLevel = function(
|
|
124
|
-
$ =
|
|
121
|
+
}, u.setLevel = function(h, y) {
|
|
122
|
+
return U = C(h), y !== !1 && Re(U), f.call(u);
|
|
123
|
+
}, u.setDefaultLevel = function(h) {
|
|
124
|
+
$ = C(h), ne() || u.setLevel(h, !1);
|
|
125
125
|
}, u.resetLevel = function() {
|
|
126
126
|
U = null, Pe(), f.call(u);
|
|
127
|
-
}, u.enableAll = function(
|
|
128
|
-
u.setLevel(u.levels.TRACE,
|
|
129
|
-
}, u.disableAll = function(
|
|
130
|
-
u.setLevel(u.levels.SILENT,
|
|
127
|
+
}, u.enableAll = function(h) {
|
|
128
|
+
u.setLevel(u.levels.TRACE, h);
|
|
129
|
+
}, u.disableAll = function(h) {
|
|
130
|
+
u.setLevel(u.levels.SILENT, h);
|
|
131
131
|
}, u.rebuild = function() {
|
|
132
|
-
if (i !== u && (J =
|
|
133
|
-
for (var
|
|
134
|
-
r[
|
|
135
|
-
}, J =
|
|
132
|
+
if (i !== u && (J = C(i.getLevel())), f.call(u), i === u)
|
|
133
|
+
for (var h in r)
|
|
134
|
+
r[h].rebuild();
|
|
135
|
+
}, J = C(
|
|
136
136
|
i ? i.getLevel() : "WARN"
|
|
137
137
|
);
|
|
138
138
|
var re = ne();
|
|
139
|
-
re != null && (U =
|
|
139
|
+
re != null && (U = C(re)), f.call(u);
|
|
140
140
|
}
|
|
141
|
-
i = new
|
|
141
|
+
i = new d(), i.getLogger = function(m) {
|
|
142
142
|
if (typeof m != "symbol" && typeof m != "string" || m === "")
|
|
143
143
|
throw new TypeError("You must supply a name when creating a logger.");
|
|
144
144
|
var u = r[m];
|
|
145
|
-
return u || (u = r[m] = new
|
|
145
|
+
return u || (u = r[m] = new d(
|
|
146
146
|
m,
|
|
147
147
|
i.methodFactory
|
|
148
148
|
)), u;
|
|
@@ -157,7 +157,7 @@ function Ne() {
|
|
|
157
157
|
}(D)), D.exports;
|
|
158
158
|
}
|
|
159
159
|
var We = Ne();
|
|
160
|
-
const se = /* @__PURE__ */
|
|
160
|
+
const se = /* @__PURE__ */ xe(We);
|
|
161
161
|
let V;
|
|
162
162
|
var z, we;
|
|
163
163
|
(typeof navigator > "u" || !((we = (z = navigator.userAgent) == null ? void 0 : z.startsWith) != null && we.call(z, "Mozilla/5.0 "))) && (V = "oauth4webapi/v2.17.0");
|
|
@@ -192,7 +192,7 @@ function Ve(t) {
|
|
|
192
192
|
throw new s("The input to be decoded is not correctly encoded.", { cause: e });
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
|
-
function
|
|
195
|
+
function A(t) {
|
|
196
196
|
return typeof t == "string" ? Ve(t) : Be(t);
|
|
197
197
|
}
|
|
198
198
|
class Ge {
|
|
@@ -249,7 +249,7 @@ function Q(t) {
|
|
|
249
249
|
}
|
|
250
250
|
return t;
|
|
251
251
|
}
|
|
252
|
-
function
|
|
252
|
+
function x(t) {
|
|
253
253
|
return !(t === null || typeof t != "object" || Array.isArray(t));
|
|
254
254
|
}
|
|
255
255
|
function K(t) {
|
|
@@ -308,7 +308,7 @@ async function tt(t, e) {
|
|
|
308
308
|
} catch (o) {
|
|
309
309
|
throw new s('failed to parse "response" body as JSON', { cause: o });
|
|
310
310
|
}
|
|
311
|
-
if (!
|
|
311
|
+
if (!x(n))
|
|
312
312
|
throw new s('"response" body must be a top level object');
|
|
313
313
|
if (!g(n.issuer))
|
|
314
314
|
throw new s('"response" body "issuer" property must be a non-empty string');
|
|
@@ -317,7 +317,7 @@ async function tt(t, e) {
|
|
|
317
317
|
return n;
|
|
318
318
|
}
|
|
319
319
|
function X() {
|
|
320
|
-
return
|
|
320
|
+
return A(crypto.getRandomValues(new Uint8Array(32)));
|
|
321
321
|
}
|
|
322
322
|
function nt() {
|
|
323
323
|
return X();
|
|
@@ -328,7 +328,7 @@ function rt() {
|
|
|
328
328
|
async function ot(t) {
|
|
329
329
|
if (!g(t))
|
|
330
330
|
throw new TypeError('"codeVerifier" must be a non-empty string');
|
|
331
|
-
return
|
|
331
|
+
return A(await crypto.subtle.digest("SHA-256", E(t)));
|
|
332
332
|
}
|
|
333
333
|
function ue(t) {
|
|
334
334
|
return encodeURIComponent(t).replace(/%20/g, "+");
|
|
@@ -418,7 +418,7 @@ function le(t) {
|
|
|
418
418
|
throw new TypeError('"client.client_secret" property must be a non-empty string');
|
|
419
419
|
return t;
|
|
420
420
|
}
|
|
421
|
-
function
|
|
421
|
+
function he(t, e) {
|
|
422
422
|
if (e !== void 0)
|
|
423
423
|
throw new TypeError(`"client.client_secret" property must not be provided when ${t} client authentication method is used.`);
|
|
424
424
|
}
|
|
@@ -434,25 +434,25 @@ async function lt(t, e, n, o, a) {
|
|
|
434
434
|
break;
|
|
435
435
|
}
|
|
436
436
|
case "private_key_jwt":
|
|
437
|
-
throw
|
|
437
|
+
throw he("private_key_jwt", e.client_secret), new TypeError('"options.clientPrivateKey" must be provided when "client.token_endpoint_auth_method" is "private_key_jwt"');
|
|
438
438
|
case "tls_client_auth":
|
|
439
439
|
case "self_signed_tls_client_auth":
|
|
440
440
|
case "none": {
|
|
441
|
-
|
|
441
|
+
he(e.token_endpoint_auth_method, e.client_secret), e.token_endpoint_auth_method, n.set("client_id", e.client_id);
|
|
442
442
|
break;
|
|
443
443
|
}
|
|
444
444
|
default:
|
|
445
445
|
throw new T("unsupported client token_endpoint_auth_method");
|
|
446
446
|
}
|
|
447
447
|
}
|
|
448
|
-
async function
|
|
448
|
+
async function ht(t, e, n) {
|
|
449
449
|
if (!n.usages.includes("sign"))
|
|
450
450
|
throw new TypeError('CryptoKey instances used for signing assertions must include "sign" in their "usages"');
|
|
451
|
-
const o = `${
|
|
451
|
+
const o = `${A(E(JSON.stringify(t)))}.${A(E(JSON.stringify(e)))}`, a = A(await crypto.subtle.sign(Ae(n), n, E(o)));
|
|
452
452
|
return `${o}.${a}`;
|
|
453
453
|
}
|
|
454
|
-
async function
|
|
455
|
-
var
|
|
454
|
+
async function dt(t, e, n, o, a, r) {
|
|
455
|
+
var b;
|
|
456
456
|
const { privateKey: i, publicKey: c, nonce: p = ge.get(n.origin) } = e;
|
|
457
457
|
if (!Ze(i))
|
|
458
458
|
throw new TypeError('"DPoP.privateKey" must be a private CryptoKey');
|
|
@@ -462,19 +462,19 @@ async function ht(t, e, n, o, a, r) {
|
|
|
462
462
|
throw new TypeError('"DPoP.nonce" must be a non-empty string or undefined');
|
|
463
463
|
if (!c.extractable)
|
|
464
464
|
throw new TypeError('"DPoP.publicKey.extractable" must be true');
|
|
465
|
-
const
|
|
465
|
+
const _ = ee() + a, f = {
|
|
466
466
|
alg: ut(i),
|
|
467
467
|
typ: "dpop+jwt",
|
|
468
468
|
jwk: await pt(c)
|
|
469
469
|
}, v = {
|
|
470
|
-
iat:
|
|
470
|
+
iat: _,
|
|
471
471
|
jti: X(),
|
|
472
472
|
htm: o,
|
|
473
473
|
nonce: p,
|
|
474
474
|
htu: `${n.origin}${n.pathname}`,
|
|
475
|
-
ath: r ?
|
|
475
|
+
ath: r ? A(await crypto.subtle.digest("SHA-256", E(r))) : void 0
|
|
476
476
|
};
|
|
477
|
-
(
|
|
477
|
+
(b = e[He]) == null || b.call(e, f, v), t.set("dpop", await ht(f, v, i));
|
|
478
478
|
}
|
|
479
479
|
let N;
|
|
480
480
|
async function ft(t) {
|
|
@@ -484,13 +484,13 @@ async function ft(t) {
|
|
|
484
484
|
async function pt(t) {
|
|
485
485
|
return N || (N = /* @__PURE__ */ new WeakMap()), N.get(t) || ft(t);
|
|
486
486
|
}
|
|
487
|
-
function
|
|
487
|
+
function de(t, e, n) {
|
|
488
488
|
if (typeof t != "string")
|
|
489
489
|
throw n ? new TypeError(`"as.mtls_endpoint_aliases.${e}" must be a string`) : new TypeError(`"as.${e}" must be a string`);
|
|
490
490
|
return new URL(t);
|
|
491
491
|
}
|
|
492
492
|
function be(t, e, n = !1) {
|
|
493
|
-
return n && t.mtls_endpoint_aliases && e in t.mtls_endpoint_aliases ?
|
|
493
|
+
return n && t.mtls_endpoint_aliases && e in t.mtls_endpoint_aliases ? de(t.mtls_endpoint_aliases[e], e, n) : de(t[e], e, n);
|
|
494
494
|
}
|
|
495
495
|
function _e(t, e) {
|
|
496
496
|
return !!(t.use_mtls_endpoint_aliases || e != null && e[Fe]);
|
|
@@ -504,7 +504,7 @@ async function wt(t, e, n, o, a, r) {
|
|
|
504
504
|
throw new TypeError('"accessToken" must be a non-empty string');
|
|
505
505
|
if (!(n instanceof URL))
|
|
506
506
|
throw new TypeError('"url" must be an instance of URL');
|
|
507
|
-
return o = K(o), (r == null ? void 0 : r.DPoP) === void 0 ? o.set("authorization", `Bearer ${t}`) : (await
|
|
507
|
+
return o = K(o), (r == null ? void 0 : r.DPoP) === void 0 ? o.set("authorization", `Bearer ${t}`) : (await dt(o, r.DPoP, n, e.toUpperCase(), H({ [W]: r == null ? void 0 : r[W] }), t), o.set("authorization", `DPoP ${t}`)), ((r == null ? void 0 : r[Z]) || fetch)(n.href, {
|
|
508
508
|
body: a,
|
|
509
509
|
headers: Object.fromEntries(o.entries()),
|
|
510
510
|
method: e,
|
|
@@ -566,7 +566,7 @@ async function Te(t, e, n, o = !1, a = !1) {
|
|
|
566
566
|
} catch (i) {
|
|
567
567
|
throw new s('failed to parse "response" body as JSON', { cause: i });
|
|
568
568
|
}
|
|
569
|
-
if (!
|
|
569
|
+
if (!x(r))
|
|
570
570
|
throw new s('"response" body must be a top level object');
|
|
571
571
|
if (!g(r.access_token))
|
|
572
572
|
throw new s('"response" body "access_token" property must be a non-empty string');
|
|
@@ -584,7 +584,7 @@ async function Te(t, e, n, o = !1, a = !1) {
|
|
|
584
584
|
if (r.id_token !== void 0 && !g(r.id_token))
|
|
585
585
|
throw new s('"response" body "id_token" property must be a non-empty string');
|
|
586
586
|
if (r.id_token) {
|
|
587
|
-
const { claims: i, jwt: c } = await
|
|
587
|
+
const { claims: i, jwt: c } = await xt(r.id_token, It.bind(void 0, e.id_token_signed_response_alg, t.id_token_signing_alg_values_supported), Ee, H(e), ye(e), e[$e]).then(Et.bind(void 0, ["aud", "exp", "iat", "iss", "sub"])).then(St.bind(void 0, t.issuer)).then(vt.bind(void 0, e.client_id));
|
|
588
588
|
if (Array.isArray(i.aud) && i.aud.length !== 1) {
|
|
589
589
|
if (i.azp === void 0)
|
|
590
590
|
throw new s('ID Token "aud" (audience) claim includes additional untrusted audiences');
|
|
@@ -614,24 +614,24 @@ function St(t, e) {
|
|
|
614
614
|
throw new s('unexpected JWT "iss" (issuer) claim value');
|
|
615
615
|
return e;
|
|
616
616
|
}
|
|
617
|
-
const
|
|
617
|
+
const ke = /* @__PURE__ */ new WeakSet();
|
|
618
618
|
function Tt(t) {
|
|
619
|
-
return
|
|
619
|
+
return ke.add(t), t;
|
|
620
620
|
}
|
|
621
|
-
async function
|
|
622
|
-
if (I(t), j(e), !
|
|
621
|
+
async function kt(t, e, n, o, a, r) {
|
|
622
|
+
if (I(t), j(e), !ke.has(n))
|
|
623
623
|
throw new TypeError('"callbackParameters" must be an instance of URLSearchParams obtained from "validateAuthResponse()", or "validateJwtAuthResponse()');
|
|
624
624
|
if (!g(o))
|
|
625
625
|
throw new TypeError('"redirectUri" must be a non-empty string');
|
|
626
626
|
if (!g(a))
|
|
627
627
|
throw new TypeError('"codeVerifier" must be a non-empty string');
|
|
628
|
-
const i =
|
|
628
|
+
const i = k(n, "code");
|
|
629
629
|
if (!i)
|
|
630
630
|
throw new s('no authorization code in "callbackParameters"');
|
|
631
631
|
const c = new URLSearchParams(r == null ? void 0 : r.additionalParameters);
|
|
632
632
|
return c.set("redirect_uri", o), c.set("code_verifier", a), c.set("code", i), ve(t, e, "authorization_code", c, r);
|
|
633
633
|
}
|
|
634
|
-
const
|
|
634
|
+
const At = {
|
|
635
635
|
aud: "audience",
|
|
636
636
|
c_hash: "code hash",
|
|
637
637
|
client_id: "client id",
|
|
@@ -650,7 +650,7 @@ const kt = {
|
|
|
650
650
|
function Et(t, e) {
|
|
651
651
|
for (const n of t)
|
|
652
652
|
if (e.claims[n] === void 0)
|
|
653
|
-
throw new s(`JWT "${n}" (${
|
|
653
|
+
throw new s(`JWT "${n}" (${At[n]}) claim missing`);
|
|
654
654
|
return e;
|
|
655
655
|
}
|
|
656
656
|
const Rt = Symbol(), F = Symbol();
|
|
@@ -696,7 +696,7 @@ async function Ut(t) {
|
|
|
696
696
|
te(t);
|
|
697
697
|
try {
|
|
698
698
|
const e = await t.json();
|
|
699
|
-
if (
|
|
699
|
+
if (x(e) && typeof e.error == "string" && e.error.length)
|
|
700
700
|
return e.error_description !== void 0 && typeof e.error_description != "string" && delete e.error_description, e.error_uri !== void 0 && typeof e.error_uri != "string" && delete e.error_uri, e.algs !== void 0 && typeof e.algs != "string" && delete e.algs, e.scope !== void 0 && typeof e.scope != "string" && delete e.scope, e;
|
|
701
701
|
} catch {
|
|
702
702
|
}
|
|
@@ -706,7 +706,7 @@ function fe(t) {
|
|
|
706
706
|
if (typeof t.modulusLength != "number" || t.modulusLength < 2048)
|
|
707
707
|
throw new s(`${t.name} modulusLength must be at least 2048 bits`);
|
|
708
708
|
}
|
|
709
|
-
function
|
|
709
|
+
function Ct(t) {
|
|
710
710
|
switch (t) {
|
|
711
711
|
case "P-256":
|
|
712
712
|
return "SHA-256";
|
|
@@ -718,12 +718,12 @@ function Lt(t) {
|
|
|
718
718
|
throw new T();
|
|
719
719
|
}
|
|
720
720
|
}
|
|
721
|
-
function
|
|
721
|
+
function Ae(t) {
|
|
722
722
|
switch (t.algorithm.name) {
|
|
723
723
|
case "ECDSA":
|
|
724
724
|
return {
|
|
725
725
|
name: t.algorithm.name,
|
|
726
|
-
hash:
|
|
726
|
+
hash: Ct(t.algorithm.namedCurve)
|
|
727
727
|
};
|
|
728
728
|
case "RSA-PSS":
|
|
729
729
|
switch (fe(t.algorithm), t.algorithm.hash.name) {
|
|
@@ -746,61 +746,61 @@ function ke(t) {
|
|
|
746
746
|
throw new T();
|
|
747
747
|
}
|
|
748
748
|
const Ee = Symbol();
|
|
749
|
-
async function
|
|
749
|
+
async function Lt(t, e, n, o) {
|
|
750
750
|
const a = `${t}.${e}`;
|
|
751
|
-
if (!await crypto.subtle.verify(
|
|
751
|
+
if (!await crypto.subtle.verify(Ae(n), n, o, E(a)))
|
|
752
752
|
throw new s("JWT signature verification failed");
|
|
753
753
|
}
|
|
754
|
-
async function
|
|
755
|
-
let { 0: i, 1: c, 2: p, length:
|
|
756
|
-
if (
|
|
754
|
+
async function xt(t, e, n, o, a, r) {
|
|
755
|
+
let { 0: i, 1: c, 2: p, length: _ } = t.split(".");
|
|
756
|
+
if (_ === 5)
|
|
757
757
|
if (r !== void 0)
|
|
758
|
-
t = await r(t), { 0: i, 1: c, 2: p, length:
|
|
758
|
+
t = await r(t), { 0: i, 1: c, 2: p, length: _ } = t.split(".");
|
|
759
759
|
else
|
|
760
760
|
throw new T("JWE structure JWTs are not supported");
|
|
761
|
-
if (
|
|
761
|
+
if (_ !== 3)
|
|
762
762
|
throw new s("Invalid JWT");
|
|
763
763
|
let f;
|
|
764
764
|
try {
|
|
765
|
-
f = JSON.parse(E(
|
|
765
|
+
f = JSON.parse(E(A(i)));
|
|
766
766
|
} catch (l) {
|
|
767
767
|
throw new s("failed to parse JWT Header body as base64url encoded JSON", { cause: l });
|
|
768
768
|
}
|
|
769
|
-
if (!
|
|
769
|
+
if (!x(f))
|
|
770
770
|
throw new s("JWT Header must be a top level object");
|
|
771
771
|
if (e(f), f.crit !== void 0)
|
|
772
772
|
throw new s('unexpected JWT "crit" header parameter');
|
|
773
|
-
const v =
|
|
774
|
-
let
|
|
775
|
-
n !== Ee && (
|
|
776
|
-
let
|
|
773
|
+
const v = A(p);
|
|
774
|
+
let b;
|
|
775
|
+
n !== Ee && (b = await n(f), await Lt(i, c, b, v));
|
|
776
|
+
let d;
|
|
777
777
|
try {
|
|
778
|
-
|
|
778
|
+
d = JSON.parse(E(A(c)));
|
|
779
779
|
} catch (l) {
|
|
780
780
|
throw new s("failed to parse JWT Payload body as base64url encoded JSON", { cause: l });
|
|
781
781
|
}
|
|
782
|
-
if (!
|
|
782
|
+
if (!x(d))
|
|
783
783
|
throw new s("JWT Payload must be a top level object");
|
|
784
784
|
const P = ee() + o;
|
|
785
|
-
if (
|
|
786
|
-
if (typeof
|
|
785
|
+
if (d.exp !== void 0) {
|
|
786
|
+
if (typeof d.exp != "number")
|
|
787
787
|
throw new s('unexpected JWT "exp" (expiration time) claim type');
|
|
788
|
-
if (
|
|
788
|
+
if (d.exp <= P - a)
|
|
789
789
|
throw new s('unexpected JWT "exp" (expiration time) claim value, timestamp is <= now()');
|
|
790
790
|
}
|
|
791
|
-
if (
|
|
791
|
+
if (d.iat !== void 0 && typeof d.iat != "number")
|
|
792
792
|
throw new s('unexpected JWT "iat" (issued at) claim type');
|
|
793
|
-
if (
|
|
793
|
+
if (d.iss !== void 0 && typeof d.iss != "string")
|
|
794
794
|
throw new s('unexpected JWT "iss" (issuer) claim type');
|
|
795
|
-
if (
|
|
796
|
-
if (typeof
|
|
795
|
+
if (d.nbf !== void 0) {
|
|
796
|
+
if (typeof d.nbf != "number")
|
|
797
797
|
throw new s('unexpected JWT "nbf" (not before) claim type');
|
|
798
|
-
if (
|
|
798
|
+
if (d.nbf > P + a)
|
|
799
799
|
throw new s('unexpected JWT "nbf" (not before) claim value, timestamp is > now()');
|
|
800
800
|
}
|
|
801
|
-
if (
|
|
801
|
+
if (d.aud !== void 0 && typeof d.aud != "string" && !Array.isArray(d.aud))
|
|
802
802
|
throw new s('unexpected JWT "aud" (audience) claim type');
|
|
803
|
-
return { header: f, claims:
|
|
803
|
+
return { header: f, claims: d, signature: v, key: b, jwt: t };
|
|
804
804
|
}
|
|
805
805
|
function It(t, e, n) {
|
|
806
806
|
if (t !== void 0) {
|
|
@@ -816,7 +816,7 @@ function It(t, e, n) {
|
|
|
816
816
|
if (n.alg !== "RS256")
|
|
817
817
|
throw new s('unexpected JWT "alg" header parameter');
|
|
818
818
|
}
|
|
819
|
-
function
|
|
819
|
+
function k(t, e) {
|
|
820
820
|
const { 0: n, length: o } = t.getAll(e);
|
|
821
821
|
if (o > 1)
|
|
822
822
|
throw new s(`"${e}" parameter must be provided only once`);
|
|
@@ -826,9 +826,9 @@ const jt = Symbol(), Jt = Symbol();
|
|
|
826
826
|
function Ot(t, e, n, o) {
|
|
827
827
|
if (I(t), j(e), n instanceof URL && (n = n.searchParams), !(n instanceof URLSearchParams))
|
|
828
828
|
throw new TypeError('"parameters" must be an instance of URLSearchParams, or URL');
|
|
829
|
-
if (
|
|
829
|
+
if (k(n, "response"))
|
|
830
830
|
throw new s('"parameters" contains a JARM response, use validateJwtAuthResponse() instead of validateAuthResponse()');
|
|
831
|
-
const a =
|
|
831
|
+
const a = k(n, "iss"), r = k(n, "state");
|
|
832
832
|
if (!a && t.authorization_response_iss_parameter_supported)
|
|
833
833
|
throw new s('response parameter "iss" (issuer) missing');
|
|
834
834
|
if (a && a !== t.issuer)
|
|
@@ -849,14 +849,14 @@ function Ot(t, e, n, o) {
|
|
|
849
849
|
if (r !== o)
|
|
850
850
|
throw new s('unexpected "state" response parameter value');
|
|
851
851
|
}
|
|
852
|
-
const i =
|
|
852
|
+
const i = k(n, "error");
|
|
853
853
|
if (i)
|
|
854
854
|
return {
|
|
855
855
|
error: i,
|
|
856
|
-
error_description:
|
|
857
|
-
error_uri:
|
|
856
|
+
error_description: k(n, "error_description"),
|
|
857
|
+
error_uri: k(n, "error_uri")
|
|
858
858
|
};
|
|
859
|
-
const c =
|
|
859
|
+
const c = k(n, "id_token"), p = k(n, "token");
|
|
860
860
|
if (c !== void 0 || p !== void 0)
|
|
861
861
|
throw new T("implicit and hybrid flows are not supported");
|
|
862
862
|
return Tt(new URLSearchParams(n));
|
|
@@ -914,23 +914,25 @@ class Nt {
|
|
|
914
914
|
basePath: c,
|
|
915
915
|
scopes: p
|
|
916
916
|
}) {
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
917
|
+
w(this, "client");
|
|
918
|
+
w(this, "issuer");
|
|
919
|
+
w(this, "authorizationServer");
|
|
920
|
+
w(this, "absoluteCallbackUrlPath");
|
|
921
|
+
w(this, "relativeCallbackUrlPath");
|
|
922
|
+
w(this, "logoutRedirectUrlPath");
|
|
923
|
+
w(this, "onAuthorizationUrl");
|
|
924
|
+
w(this, "redirectToAfterSignUp");
|
|
925
|
+
w(this, "redirectToAfterSignIn");
|
|
926
|
+
w(this, "redirectToAfterSignOut");
|
|
927
|
+
w(this, "audience");
|
|
928
|
+
w(this, "scopes");
|
|
929
|
+
w(this, "root");
|
|
930
|
+
w(this, "signRequest", async (e) => {
|
|
929
931
|
const n = await this.getAccessToken();
|
|
930
932
|
return e.headers.set("Authorization", `Bearer ${n}`), e;
|
|
931
933
|
});
|
|
932
|
-
|
|
933
|
-
|
|
934
|
+
w(this, "signOut", async () => {
|
|
935
|
+
L.setState({
|
|
934
936
|
isAuthenticated: !1,
|
|
935
937
|
isPending: !1,
|
|
936
938
|
profile: void 0,
|
|
@@ -946,7 +948,7 @@ class Nt {
|
|
|
946
948
|
n.toString()
|
|
947
949
|
)) : o = n;
|
|
948
950
|
});
|
|
949
|
-
|
|
951
|
+
w(this, "handleCallback", async () => {
|
|
950
952
|
const e = new URL(window.location.href), n = e.searchParams.get("state"), o = sessionStorage.getItem(q);
|
|
951
953
|
if (sessionStorage.removeItem(q), n !== o)
|
|
952
954
|
throw new R("Invalid state parameter");
|
|
@@ -965,34 +967,34 @@ class Nt {
|
|
|
965
967
|
i
|
|
966
968
|
);
|
|
967
969
|
const c = new URL(e);
|
|
968
|
-
c.pathname = this.
|
|
969
|
-
const p = await
|
|
970
|
+
c.pathname = this.absoluteCallbackUrlPath, c.search = "";
|
|
971
|
+
const p = await kt(
|
|
970
972
|
r,
|
|
971
973
|
this.client,
|
|
972
974
|
i,
|
|
973
975
|
c.toString(),
|
|
974
976
|
a
|
|
975
|
-
),
|
|
977
|
+
), _ = await Pt(
|
|
976
978
|
r,
|
|
977
979
|
this.client,
|
|
978
980
|
p
|
|
979
981
|
);
|
|
980
|
-
this.setTokensFromResponse(
|
|
981
|
-
const f = await this.getAccessToken(),
|
|
982
|
+
this.setTokensFromResponse(_);
|
|
983
|
+
const f = await this.getAccessToken(), b = await (await gt(
|
|
982
984
|
r,
|
|
983
985
|
this.client,
|
|
984
986
|
f
|
|
985
|
-
)).json(),
|
|
986
|
-
sub:
|
|
987
|
-
email:
|
|
988
|
-
name:
|
|
989
|
-
emailVerified:
|
|
990
|
-
pictureUrl:
|
|
987
|
+
)).json(), d = {
|
|
988
|
+
sub: b.sub,
|
|
989
|
+
email: b.email,
|
|
990
|
+
name: b.name,
|
|
991
|
+
emailVerified: b.email_verified ?? !1,
|
|
992
|
+
pictureUrl: b.picture
|
|
991
993
|
};
|
|
992
|
-
|
|
994
|
+
L.setState({
|
|
993
995
|
isAuthenticated: !0,
|
|
994
996
|
isPending: !1,
|
|
995
|
-
profile:
|
|
997
|
+
profile: d
|
|
996
998
|
});
|
|
997
999
|
const P = sessionStorage.getItem("redirect-to") ?? "/";
|
|
998
1000
|
return sessionStorage.removeItem("redirect-to"), P;
|
|
@@ -1000,9 +1002,10 @@ class Nt {
|
|
|
1000
1002
|
this.client = {
|
|
1001
1003
|
client_id: o,
|
|
1002
1004
|
token_endpoint_auth_method: "none"
|
|
1003
|
-
}, this.audience = n, this.issuer = e, this.
|
|
1004
|
-
|
|
1005
|
-
|
|
1005
|
+
}, this.audience = n, this.issuer = e, this.relativeCallbackUrlPath = "/oauth/callback", this.absoluteCallbackUrlPath = ie(
|
|
1006
|
+
c,
|
|
1007
|
+
this.relativeCallbackUrlPath
|
|
1008
|
+
), this.scopes = p ?? ["openid", "profile", "email"], this.root = ie(c, "/"), this.logoutRedirectUrlPath = this.root, this.redirectToAfterSignUp = a ?? this.root, this.redirectToAfterSignIn = r ?? this.root, this.redirectToAfterSignOut = i ?? this.root;
|
|
1006
1009
|
}
|
|
1007
1010
|
async getAuthServer() {
|
|
1008
1011
|
if (!this.authorizationServer) {
|
|
@@ -1030,7 +1033,7 @@ class Nt {
|
|
|
1030
1033
|
expiresOn: new Date(Date.now() + e.expires_in * 1e3),
|
|
1031
1034
|
tokenType: e.token_type
|
|
1032
1035
|
};
|
|
1033
|
-
|
|
1036
|
+
L.setState({
|
|
1034
1037
|
providerData: n
|
|
1035
1038
|
});
|
|
1036
1039
|
}
|
|
@@ -1057,10 +1060,10 @@ class Nt {
|
|
|
1057
1060
|
sessionStorage.setItem(M, r);
|
|
1058
1061
|
const c = new URL(
|
|
1059
1062
|
a.authorization_endpoint
|
|
1060
|
-
), p = e.startsWith(window.location.origin) ? e.slice(window.location.origin.length) : e;
|
|
1063
|
+
), p = e.startsWith(window.location.origin) ? this.root !== "/" && e.startsWith(window.location.origin + this.root) ? e.slice(window.location.origin.length + this.root.length) : e.slice(window.location.origin.length) : e;
|
|
1061
1064
|
sessionStorage.setItem("redirect-to", p);
|
|
1062
|
-
const
|
|
1063
|
-
|
|
1065
|
+
const _ = new URL(window.location.origin);
|
|
1066
|
+
_.pathname = this.absoluteCallbackUrlPath, _.search = "", c.searchParams.set("client_id", this.client.client_id), c.searchParams.set("redirect_uri", _.toString()), c.searchParams.set("response_type", "code"), c.searchParams.set("scope", this.scopes.join(" ")), c.searchParams.set("code_challenge", i), c.searchParams.set(
|
|
1064
1067
|
"code_challenge_method",
|
|
1065
1068
|
o
|
|
1066
1069
|
), this.audience && c.searchParams.set("audience", this.audience), (v = this.onAuthorizationUrl) == null || v.call(this, c, {
|
|
@@ -1071,13 +1074,13 @@ class Nt {
|
|
|
1071
1074
|
sessionStorage.setItem(q, f), c.searchParams.set("state", f), location.href = c.href;
|
|
1072
1075
|
}
|
|
1073
1076
|
async getAccessToken() {
|
|
1074
|
-
const e = await this.getAuthServer(), { providerData: n } =
|
|
1077
|
+
const e = await this.getAuthServer(), { providerData: n } = L.getState();
|
|
1075
1078
|
if (!n)
|
|
1076
1079
|
throw new R("User is not authenticated");
|
|
1077
1080
|
const o = n;
|
|
1078
1081
|
if (new Date(o.expiresOn) < /* @__PURE__ */ new Date()) {
|
|
1079
1082
|
if (!o.refreshToken)
|
|
1080
|
-
return
|
|
1083
|
+
return L.setState({
|
|
1081
1084
|
isAuthenticated: !1,
|
|
1082
1085
|
isPending: !1,
|
|
1083
1086
|
profile: null,
|
|
@@ -1099,7 +1102,10 @@ class Nt {
|
|
|
1099
1102
|
return o.accessToken;
|
|
1100
1103
|
}
|
|
1101
1104
|
getAuthenticationPlugin() {
|
|
1102
|
-
return new Dt(
|
|
1105
|
+
return new Dt(
|
|
1106
|
+
this.relativeCallbackUrlPath,
|
|
1107
|
+
this.handleCallback
|
|
1108
|
+
);
|
|
1103
1109
|
}
|
|
1104
1110
|
}
|
|
1105
1111
|
const Vt = (t) => new Nt(t);
|