@pontive/server 1.23.1 → 1.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/README.md +43 -1
  2. package/dist/authorization.cjs +1 -1
  3. package/dist/authorization.js +2 -2
  4. package/dist/client-D80_tH4S.cjs +2 -0
  5. package/dist/client-D80_tH4S.cjs.map +1 -0
  6. package/dist/client-DWO-uz9e.js +6689 -0
  7. package/dist/client-DWO-uz9e.js.map +1 -0
  8. package/dist/env.d.cts +2 -0
  9. package/dist/env.d.ts +2 -0
  10. package/dist/index.cjs +4 -4
  11. package/dist/index.cjs.map +1 -1
  12. package/dist/index.d.cts +4 -0
  13. package/dist/index.d.ts +4 -0
  14. package/dist/index.js +219 -248
  15. package/dist/index.js.map +1 -1
  16. package/dist/management/client.d.cts +68 -0
  17. package/dist/management/client.d.ts +68 -0
  18. package/dist/management/core.d.cts +112 -0
  19. package/dist/management/core.d.ts +112 -0
  20. package/dist/management/errors.d.cts +78 -0
  21. package/dist/management/errors.d.ts +78 -0
  22. package/dist/management/generated/namespaces.d.cts +5400 -0
  23. package/dist/management/generated/namespaces.d.ts +5400 -0
  24. package/dist/management/generated/types.d.cts +14884 -0
  25. package/dist/management/generated/types.d.ts +14884 -0
  26. package/dist/management/index.d.cts +10 -0
  27. package/dist/management/index.d.ts +10 -0
  28. package/dist/management-credential--CmS8XaV.cjs +2 -0
  29. package/dist/management-credential--CmS8XaV.cjs.map +1 -0
  30. package/dist/management-credential-CynS93TR.js +166 -0
  31. package/dist/management-credential-CynS93TR.js.map +1 -0
  32. package/dist/management.cjs +2 -0
  33. package/dist/management.cjs.map +1 -0
  34. package/dist/management.js +20 -0
  35. package/dist/management.js.map +1 -0
  36. package/dist/resource-server.cjs +1 -1
  37. package/dist/resource-server.cjs.map +1 -1
  38. package/dist/resource-server.js +3 -4
  39. package/dist/resource-server.js.map +1 -1
  40. package/package.json +12 -2
  41. package/dist/management-credential-BNyhHagG.cjs +0 -2
  42. package/dist/management-credential-BNyhHagG.cjs.map +0 -1
  43. package/dist/management-credential-VhmMzGDl.js +0 -39
  44. package/dist/management-credential-VhmMzGDl.js.map +0 -1
  45. package/dist/oidc--We55Nrh.cjs +0 -2
  46. package/dist/oidc--We55Nrh.cjs.map +0 -1
  47. package/dist/oidc-CB0FqjFz.js +0 -131
  48. package/dist/oidc-CB0FqjFz.js.map +0 -1
package/dist/index.js CHANGED
@@ -1,8 +1,10 @@
1
- import { readKeylessRecord as ve, KeylessUnavailableError as se, claimLinkFor as Ee, PontiveApiError as W, goneMessage as oe, ensureKeylessInstance as ye, loopbackCallbacks as ke, keylessMessage as _e, KEYLESS_FILE as ge, ENV_FILE as Ie, KeylessInstanceGoneError as Pe } from "./keyless.js";
2
- import { v as Te, s as ie, u as be, r as K, T as G, a as $, b as Re, p as Ue, e as Ce, c as Ne, d as Oe } from "./oidc-CB0FqjFz.js";
3
- import { decodeJwt as Ae, jwtDecrypt as Le, EncryptJWT as $e } from "jose";
1
+ import { p as fe, w as we, k as me, i as ve } from "./client-DWO-uz9e.js";
2
+ import { h as yt, d as gt, e as Et, f as _t } from "./client-DWO-uz9e.js";
3
+ import { readKeylessRecord as Se, KeylessUnavailableError as te, claimLinkFor as ke, PontiveApiError as D, goneMessage as ne, ensureKeylessInstance as ye, loopbackCallbacks as ge, keylessMessage as Ee, KEYLESS_FILE as _e, ENV_FILE as Pe, KeylessInstanceGoneError as be } from "./keyless.js";
4
+ import { v as Ie, s as re, u as Te, r as F, T as j, e as $, f as Re, p as Ue, g as Ce, h as Ae, i as Ne } from "./management-credential-CynS93TR.js";
5
+ import { decodeJwt as $e, jwtDecrypt as Oe, EncryptJWT as Le } from "jose";
4
6
  const xe = 10080 * 60;
5
- function ae(e) {
7
+ function se(e) {
6
8
  const t = e.clientSecret ? "server" : "browser", n = ["issuer", "clientId"];
7
9
  t === "server" && n.push("sessionSecret");
8
10
  for (const s of n)
@@ -42,42 +44,8 @@ function ae(e) {
42
44
  logger: e.logger ?? console
43
45
  };
44
46
  }
45
- const U = {
46
- issuer: "PONTIVE_ISSUER",
47
- clientId: "PONTIVE_CLIENT_ID",
48
- clientSecret: "PONTIVE_CLIENT_SECRET",
49
- sessionSecret: "PONTIVE_SESSION_SECRET",
50
- secretKey: "PONTIVE_SECRET_KEY",
51
- instanceId: "PONTIVE_INSTANCE_ID",
52
- apiUrl: "PONTIVE_API_URL",
53
- region: "PONTIVE_REGION",
54
- keyless: "PONTIVE_KEYLESS"
55
- };
56
- function V() {
57
- try {
58
- return globalThis.process?.env ?? {};
59
- } catch {
60
- return {};
61
- }
62
- }
63
- const L = (e) => e && e.trim() ? e.trim() : void 0;
64
- function Ve(e, t = V()) {
65
- return {
66
- ...e,
67
- issuer: e.issuer || L(t[U.issuer]),
68
- clientId: e.clientId || L(t[U.clientId]),
69
- clientSecret: e.clientSecret || L(t[U.clientSecret]),
70
- sessionSecret: e.sessionSecret || L(t[U.sessionSecret])
71
- };
72
- }
73
- function ce(e = V()) {
74
- return e.NODE_ENV === "development";
75
- }
76
- function Me(e, t = V()) {
77
- return ce(t) && !e.issuer && t[U.keyless]?.trim() !== "0";
78
- }
79
- const D = 3500, z = 16;
80
- function b(e) {
47
+ const x = 3500, V = 16;
48
+ function T(e) {
81
49
  const t = /* @__PURE__ */ new Map();
82
50
  if (!e) return t;
83
51
  for (const n of e.split(";")) {
@@ -88,74 +56,74 @@ function b(e) {
88
56
  }
89
57
  return t;
90
58
  }
91
- function B(e) {
59
+ function W(e) {
92
60
  return [...e].map(([t, n]) => `${t}=${n}`).join("; ");
93
61
  }
94
- function N(e, t, n) {
62
+ function C(e, t, n) {
95
63
  const s = n.sameSite ?? "Lax", c = [`${e}=${t}`, "Path=/", "HttpOnly", `SameSite=${s}`, `Max-Age=${n.maxAge}`];
96
64
  return (n.secure || s === "None") && c.push("Secure"), c.join("; ");
97
65
  }
98
- function C(e, t) {
66
+ function U(e, t) {
99
67
  return t === 0 ? e : `${e}.${t}`;
100
68
  }
101
- function De(e, t) {
69
+ function Me(e, t) {
102
70
  const n = e.get(t);
103
71
  if (n === void 0) return null;
104
72
  let s = n;
105
- for (let c = 1; c < z; c++) {
106
- const a = e.get(C(t, c));
73
+ for (let c = 1; c < V; c++) {
74
+ const a = e.get(U(t, c));
107
75
  if (a === void 0) break;
108
76
  s += a;
109
77
  }
110
78
  return s;
111
79
  }
112
- function He(e, t, n, s) {
113
- const c = [], a = Math.max(1, Math.ceil(n.length / D));
80
+ function Ve(e, t, n, s) {
81
+ const c = [], a = Math.max(1, Math.ceil(n.length / x));
114
82
  for (let i = 0; i < a; i++) {
115
- const l = n.slice(i * D, (i + 1) * D);
116
- e.set(C(t, i), l), c.push(N(C(t, i), l, s));
83
+ const l = n.slice(i * x, (i + 1) * x);
84
+ e.set(U(t, i), l), c.push(C(U(t, i), l, s));
117
85
  }
118
- for (let i = a; i < z; i++) {
119
- const l = C(t, i);
86
+ for (let i = a; i < V; i++) {
87
+ const l = U(t, i);
120
88
  if (!e.has(l)) break;
121
- e.delete(l), c.push(N(l, "", { ...s, maxAge: 0 }));
89
+ e.delete(l), c.push(C(l, "", { ...s, maxAge: 0 }));
122
90
  }
123
91
  return c;
124
92
  }
125
- function J(e, t, n) {
93
+ function G(e, t, n) {
126
94
  const s = [];
127
- for (let c = 0; c < z; c++) {
128
- const a = C(t, c);
95
+ for (let c = 0; c < V; c++) {
96
+ const a = U(t, c);
129
97
  if (!e.has(a)) {
130
98
  if (c > 0) break;
131
99
  continue;
132
100
  }
133
- e.delete(a), s.push(N(a, "", { ...n, maxAge: 0 }));
101
+ e.delete(a), s.push(C(a, "", { ...n, maxAge: 0 }));
134
102
  }
135
103
  return s;
136
104
  }
137
- const F = "switch-organization", ze = "organization_error", Y = (e) => Array.isArray(e) ? e.filter((t) => typeof t == "string") : [];
138
- function le(e) {
105
+ const H = "switch-organization", He = "organization_error", K = (e) => Array.isArray(e) ? e.filter((t) => typeof t == "string") : [];
106
+ function oe(e) {
139
107
  const t = e.org_id;
140
108
  return typeof t != "string" || t === "" ? null : {
141
109
  id: t,
142
- roles: Y(e.roles),
143
- permissions: Y(e.permissions)
110
+ roles: K(e.roles),
111
+ permissions: K(e.permissions)
144
112
  };
145
113
  }
146
- function Fe(e) {
114
+ function ze(e) {
147
115
  try {
148
- return Ae(e);
116
+ return $e(e);
149
117
  } catch {
150
118
  return {};
151
119
  }
152
120
  }
153
- function St(e, t, n = "/") {
121
+ function mt(e, t, n = "/") {
154
122
  const s = new URLSearchParams({ organization_id: t, returnTo: n });
155
- return `${e}/${F}?${s.toString()}`;
123
+ return `${e}/${H}?${s.toString()}`;
156
124
  }
157
- const je = "__Host-pontive_access", We = "__Secure-pontive_session_state";
158
- function Ke(e) {
125
+ const De = "__Host-pontive_access", Fe = "__Secure-pontive_session_state";
126
+ function je(e) {
159
127
  const t = (n) => typeof e[n] == "string" ? e[n] : void 0;
160
128
  return {
161
129
  id: t("sub") ?? "",
@@ -166,7 +134,7 @@ function Ke(e) {
166
134
  emailVerified: e.email_verified === !0
167
135
  };
168
136
  }
169
- function Ge(e) {
137
+ function We(e) {
170
138
  const t = { issuer: e.issuer, clientId: e.clientId }, n = /* @__PURE__ */ new Map();
171
139
  function s(i) {
172
140
  for (const [l, d] of n)
@@ -175,17 +143,17 @@ function Ge(e) {
175
143
  async function c(i, l) {
176
144
  const d = Date.now();
177
145
  s(d);
178
- const u = await ie(i), p = n.get(u);
146
+ const u = await re(i), p = n.get(u);
179
147
  if (p) return p.profile;
180
- const m = be(t, e.fetch, i).catch((v) => (n.delete(u), e.logger.warn("[pontive] could not read the user's profile:", v instanceof Error ? v.message : String(v)), null));
148
+ const m = Te(t, e.fetch, i).catch((S) => (n.delete(u), e.logger.warn("[pontive] could not read the user's profile:", S instanceof Error ? S.message : String(S)), null));
181
149
  return n.set(u, { expiresAt: l, profile: m }), m;
182
150
  }
183
151
  async function a(i) {
184
- const l = b(i).get(je);
152
+ const l = T(i).get(De);
185
153
  if (!l) return null;
186
154
  let d;
187
155
  try {
188
- d = await Te(t, e.fetch, l);
156
+ d = await Ie(t, e.fetch, l);
189
157
  } catch (m) {
190
158
  return m.code !== "ERR_JWT_EXPIRED" && e.logger.warn("[pontive] access token cookie refused:", m instanceof Error ? m.message : String(m)), null;
191
159
  }
@@ -193,11 +161,11 @@ function Ge(e) {
193
161
  return {
194
162
  // The token's own claims win for sub: the profile describes the user the
195
163
  // token names, never another one.
196
- user: Ke({ ...p, ...d, sub: d.sub }),
164
+ user: je({ ...p, ...d, sub: d.sub }),
197
165
  accessToken: l,
198
166
  expiresAt: u,
199
167
  sessionId: typeof d.sid == "string" ? d.sid : void 0,
200
- organization: le(d),
168
+ organization: oe(d),
201
169
  claims: d
202
170
  };
203
171
  }
@@ -209,28 +177,28 @@ function Ge(e) {
209
177
  // refresh token. A refused switch comes back with organization_error.
210
178
  async handle(i) {
211
179
  const l = new URL(i.url);
212
- if (l.pathname !== `${e.basePath}/${F}`) return null;
213
- const d = l.searchParams.get("organization_id"), u = Be(l.searchParams.get("returnTo"));
214
- if (!d) return X(u);
180
+ if (l.pathname !== `${e.basePath}/${H}`) return null;
181
+ const d = l.searchParams.get("organization_id"), u = Ge(l.searchParams.get("returnTo"));
182
+ if (!d) return B(u);
215
183
  const p = new URL(`${e.authPath}/oauth2/session`, l.origin);
216
- return p.searchParams.set("client_id", e.clientId), p.searchParams.set("return_to", u), p.searchParams.set("organization_id", d), X(p.pathname + p.search);
184
+ return p.searchParams.set("client_id", e.clientId), p.searchParams.set("return_to", u), p.searchParams.set("organization_id", d), B(p.pathname + p.search);
217
185
  },
218
186
  getSession: a,
219
187
  async refresh(i) {
220
188
  const l = i.headers.get("cookie"), d = await a(l), u = { session: d, setCookies: [], cookieHeader: l ?? "" };
221
- if (d || !b(l).has(We)) return u;
189
+ if (d || !T(l).has(Fe)) return u;
222
190
  const p = new URL(i.url), m = new URL(`${e.authPath}/oauth2/session`, p.origin);
223
191
  return m.searchParams.set("client_id", e.clientId), m.searchParams.set("return_to", p.pathname + p.search), { ...u, handshake: m.pathname + m.search };
224
192
  }
225
193
  };
226
194
  }
227
- function Be(e) {
195
+ function Ge(e) {
228
196
  return e && e.startsWith("/") && !e.startsWith("//") && !e.startsWith("/\\") ? e : "/";
229
197
  }
230
- function X(e) {
198
+ function B(e) {
231
199
  return new Response(null, { status: 302, headers: { location: e, "cache-control": "no-store" } });
232
200
  }
233
- const Je = [
201
+ const Ke = [
234
202
  "lovable.app",
235
203
  "lovableproject.com",
236
204
  "lovable.dev",
@@ -245,11 +213,11 @@ const Je = [
245
213
  "bolt.host",
246
214
  "csb.app"
247
215
  ];
248
- function Ye(e) {
216
+ function Be(e) {
249
217
  const t = e.toLowerCase().replace(/\.$/, "");
250
- return Je.some((n) => t === n || t.endsWith(`.${n}`));
218
+ return Ke.some((n) => t === n || t.endsWith(`.${n}`));
251
219
  }
252
- const Xe = {
220
+ const Je = {
253
221
  lovable: ["*.lovableproject.com", "*.lovable.app", "*.lovable.dev"],
254
222
  v0: ["*.vusercontent.net", "*.lite.vusercontent.net", "*.v0.app", "*.v0.dev"],
255
223
  vercel: ["*.vercel.app"],
@@ -261,8 +229,8 @@ const Xe = {
261
229
  "*.local-corp.webcontainer-api.io"
262
230
  ],
263
231
  codesandbox: ["*.csb.app"]
264
- }, Ze = "/oauth2/preview-callback", Qe = "pontive:authorization-response", qe = /^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/;
265
- function et(e) {
232
+ }, Xe = "/oauth2/preview-callback", Ye = "pontive:authorization-response", Ze = /^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/;
233
+ function Qe(e) {
266
234
  let t;
267
235
  try {
268
236
  t = new URL(e);
@@ -271,27 +239,27 @@ function et(e) {
271
239
  }
272
240
  if (t.protocol !== "https:" || t.port !== "" || t.origin !== e) return null;
273
241
  const n = t.hostname.split(".");
274
- for (const [s, c] of Object.entries(Xe))
242
+ for (const [s, c] of Object.entries(Je))
275
243
  for (const a of c) {
276
244
  const i = a.split(".");
277
- if (i.length === n.length && i.every((l, d) => l === "*" ? qe.test(n[d]) : l === n[d]))
245
+ if (i.length === n.length && i.every((l, d) => l === "*" ? Ze.test(n[d]) : l === n[d]))
278
246
  return s;
279
247
  }
280
248
  return null;
281
249
  }
282
- function tt(e, t) {
283
- return `${e.replace(/\/$/, "")}${Ze}?origin=${encodeURIComponent(t)}`;
250
+ function qe(e, t) {
251
+ return `${e.replace(/\/$/, "")}${Xe}?origin=${encodeURIComponent(t)}`;
284
252
  }
285
- const nt = 3e4;
286
- class rt {
287
- constructor(t = nt) {
253
+ const et = 3e4;
254
+ class tt {
255
+ constructor(t = et) {
288
256
  this.recentMs = t;
289
257
  }
290
258
  recentMs;
291
259
  inFlight = /* @__PURE__ */ new Map();
292
260
  recent = /* @__PURE__ */ new Map();
293
261
  async run(t, n) {
294
- const s = await ie(t);
262
+ const s = await re(t);
295
263
  this.sweep();
296
264
  const c = this.recent.get(s);
297
265
  if (c) return c.result;
@@ -304,34 +272,34 @@ class rt {
304
272
  s.at < t && this.recent.delete(n);
305
273
  }
306
274
  }
307
- const Z = /* @__PURE__ */ new Map();
308
- function ue(e) {
309
- let t = Z.get(e);
310
- return t || (t = crypto.subtle.digest("SHA-256", new TextEncoder().encode(e)).then((n) => new Uint8Array(n)), Z.set(e, t)), t;
275
+ const J = /* @__PURE__ */ new Map();
276
+ function ie(e) {
277
+ let t = J.get(e);
278
+ return t || (t = crypto.subtle.digest("SHA-256", new TextEncoder().encode(e)).then((n) => new Uint8Array(n)), J.set(e, t)), t;
311
279
  }
312
- async function Q(e, t, n) {
313
- return new $e(e).setProtectedHeader({ alg: "dir", enc: "A256GCM" }).setIssuedAt().setExpirationTime(`${n}s`).encrypt(await ue(t));
280
+ async function X(e, t, n) {
281
+ return new Le(e).setProtectedHeader({ alg: "dir", enc: "A256GCM" }).setIssuedAt().setExpirationTime(`${n}s`).encrypt(await ie(t));
314
282
  }
315
- async function q(e, t) {
283
+ async function Y(e, t) {
316
284
  try {
317
- const { payload: n } = await Le(e, await ue(t));
285
+ const { payload: n } = await Oe(e, await ie(t));
318
286
  return n;
319
287
  } catch {
320
288
  return null;
321
289
  }
322
290
  }
323
- const st = 900, ee = 600;
324
- function te(e, t) {
291
+ const nt = 900, Z = 600;
292
+ function Q(e, t) {
325
293
  return e && e.startsWith("/") && !e.startsWith("//") && !e.startsWith("/\\") ? e : t;
326
294
  }
327
- function P(e, t = []) {
295
+ function b(e, t = []) {
328
296
  const n = new Headers({ location: e, "cache-control": "no-store" });
329
297
  for (const s of t) n.append("set-cookie", s);
330
298
  return new Response(null, { status: 302, headers: n });
331
299
  }
332
- const ot = "pontive:popup-complete";
333
- function it(e, t, n) {
334
- const c = `<!doctype html><meta charset="utf-8"><title>Signing in</title><script type="application/json" id="pontive-popup">${JSON.stringify({ message: { type: ot, url: e }, origin: t }).replace(/</g, "\\u003c")}<\/script><script>(function(){var d=JSON.parse(document.getElementById("pontive-popup").textContent);var go=function(){window.location.replace(d.message.url)};if(window.opener&&window.opener!==window){try{window.opener.postMessage(d.message,d.origin)}catch(e){}window.close();setTimeout(go,1000)}else{go()}})()<\/script>`, a = new Headers({
300
+ const rt = "pontive:popup-complete";
301
+ function st(e, t, n) {
302
+ const c = `<!doctype html><meta charset="utf-8"><title>Signing in</title><script type="application/json" id="pontive-popup">${JSON.stringify({ message: { type: rt, url: e }, origin: t }).replace(/</g, "\\u003c")}<\/script><script>(function(){var d=JSON.parse(document.getElementById("pontive-popup").textContent);var go=function(){window.location.replace(d.message.url)};if(window.opener&&window.opener!==window){try{window.opener.postMessage(d.message,d.origin)}catch(e){}window.close();setTimeout(go,1000)}else{go()}})()<\/script>`, a = new Headers({
335
303
  "content-type": "text/html; charset=utf-8",
336
304
  "cache-control": "no-store",
337
305
  "content-security-policy": "default-src 'none'; script-src 'unsafe-inline'",
@@ -340,8 +308,8 @@ function it(e, t, n) {
340
308
  for (const i of n) a.append("set-cookie", i);
341
309
  return new Response(c, { status: 200, headers: a });
342
310
  }
343
- function at(e) {
344
- const t = $(), s = `<!doctype html><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><title>Sign in</title><style>body{font-family:system-ui,sans-serif;margin:4rem auto;max-width:28rem;padding:0 1rem}</style><p>This preview signs in in a new window.</p><p><button id="go" type="button">Sign in</button></p><p id="status"></p><script type="application/json" id="pontive-preview-signin">${JSON.stringify({ ...e, type: Qe }).replace(/</g, "\\u003c")}<\/script><script nonce="${t}">(function(){var d=JSON.parse(document.getElementById("pontive-preview-signin").textContent);var s=document.getElementById("status");var w=null;window.addEventListener("message",function(e){if(!w||e.source!==w||e.origin!==d.authOrigin)return;var m=e.data;if(!m||m.type!==d.type||!m.response||typeof m.response!=="object")return;var u=new URL(d.callbackUrl);["code","state","iss","error","error_description","error_uri"].forEach(function(k){var v=m.response[k];if(typeof v==="string")u.searchParams.set(k,v)});try{w.close()}catch(x){}if(u.origin===location.origin)location.replace(u.toString())});document.getElementById("go").addEventListener("click",function(){w=window.open(d.popupUrl,"pontive_signin_popup","popup=yes,width=500,height=680");s.textContent=w?"Finish signing in in the new window.":"The sign-in window was blocked. Allow popups for this site and try again."})})()<\/script>`;
311
+ function ot(e) {
312
+ const t = $(), s = `<!doctype html><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><title>Sign in</title><style>body{font-family:system-ui,sans-serif;margin:4rem auto;max-width:28rem;padding:0 1rem}</style><p>This preview signs in in a new window.</p><p><button id="go" type="button">Sign in</button></p><p id="status"></p><script type="application/json" id="pontive-preview-signin">${JSON.stringify({ ...e, type: Ye }).replace(/</g, "\\u003c")}<\/script><script nonce="${t}">(function(){var d=JSON.parse(document.getElementById("pontive-preview-signin").textContent);var s=document.getElementById("status");var w=null;window.addEventListener("message",function(e){if(!w||e.source!==w||e.origin!==d.authOrigin)return;var m=e.data;if(!m||m.type!==d.type||!m.response||typeof m.response!=="object")return;var u=new URL(d.callbackUrl);["code","state","iss","error","error_description","error_uri"].forEach(function(k){var v=m.response[k];if(typeof v==="string")u.searchParams.set(k,v)});try{w.close()}catch(x){}if(u.origin===location.origin)location.replace(u.toString())});document.getElementById("go").addEventListener("click",function(){w=window.open(d.popupUrl,"pontive_signin_popup","popup=yes,width=500,height=680");s.textContent=w?"Finish signing in in the new window.":"The sign-in window was blocked. Allow popups for this site and try again."})})()<\/script>`;
345
313
  return new Response(s, {
346
314
  status: 200,
347
315
  headers: {
@@ -353,7 +321,7 @@ function at(e) {
353
321
  }
354
322
  });
355
323
  }
356
- function g(e, t) {
324
+ function _(e, t) {
357
325
  if (e.baseUrl) return e.baseUrl;
358
326
  const n = t.headers.get("x-forwarded-host")?.split(",")[0]?.trim() || t.headers.get("host")?.trim();
359
327
  if (n) {
@@ -365,7 +333,7 @@ function g(e, t) {
365
333
  }
366
334
  return new URL(t.url).origin;
367
335
  }
368
- function ct(e) {
336
+ function it(e) {
369
337
  const t = (s) => typeof e[s] == "string" ? e[s] : void 0, n = t("name") ?? ([t("given_name"), t("family_name")].filter(Boolean).join(" ") || void 0) ?? t("email");
370
338
  return {
371
339
  id: e.sub ?? "",
@@ -376,55 +344,55 @@ function ct(e) {
376
344
  emailVerified: e.email_verified === !0
377
345
  };
378
346
  }
379
- function ne(e) {
380
- return Date.now() + (e.expires_in ?? st) * 1e3;
347
+ function q(e) {
348
+ return Date.now() + (e.expires_in ?? nt) * 1e3;
381
349
  }
382
- function pe(e) {
383
- return e.mode === "browser" ? Ge(e) : lt(e);
350
+ function ae(e) {
351
+ return e.mode === "browser" ? We(e) : at(e);
384
352
  }
385
- function lt(e) {
386
- const t = { issuer: e.issuer, clientId: e.clientId, clientSecret: e.clientSecret }, n = `${e.cookieName}_tx`, s = new rt(), c = (r) => e.secureCookies ?? g(e, r).startsWith("https:"), a = (r) => e.iframeSafe === !0 || e.iframeSafe === "auto" && Ye(new URL(g(e, r)).hostname), i = (r, o) => a(r) ? { maxAge: o, secure: !0, sameSite: "None" } : { maxAge: o, secure: c(r) }, l = (r) => e.previewCallback === "always" || e.previewCallback === "auto" && et(g(e, r)) !== null, d = (r) => `${g(e, r)}${e.basePath}/callback`, u = (r) => l(r) ? tt(e.issuer, g(e, r)) : e.redirectUri ?? d(r), p = (r, o) => {
387
- const h = new URL(e.signInPath, g(e, r));
353
+ function at(e) {
354
+ const t = { issuer: e.issuer, clientId: e.clientId, clientSecret: e.clientSecret }, n = `${e.cookieName}_tx`, s = new tt(), c = (r) => e.secureCookies ?? _(e, r).startsWith("https:"), a = (r) => e.iframeSafe === !0 || e.iframeSafe === "auto" && Be(new URL(_(e, r)).hostname), i = (r, o) => a(r) ? { maxAge: o, secure: !0, sameSite: "None" } : { maxAge: o, secure: c(r) }, l = (r) => e.previewCallback === "always" || e.previewCallback === "auto" && Qe(_(e, r)) !== null, d = (r) => `${_(e, r)}${e.basePath}/callback`, u = (r) => l(r) ? qe(e.issuer, _(e, r)) : e.redirectUri ?? d(r), p = (r, o) => {
355
+ const h = new URL(e.signInPath, _(e, r));
388
356
  return o && h.searchParams.set("error", o), h.toString();
389
357
  };
390
358
  async function m(r) {
391
- const o = De(r, e.cookieName);
359
+ const o = Me(r, e.cookieName);
392
360
  if (o === null) return null;
393
- const h = await q(o, e.sessionSecret);
361
+ const h = await Y(o, e.sessionSecret);
394
362
  return h || e.logger.warn("[pontive] session cookie could not be read (sealed with another secret, or truncated)"), h;
395
363
  }
396
- async function v(r, o, h) {
397
- const f = await Q({ ...o }, e.sessionSecret, e.sessionMaxAgeSeconds);
398
- return He(r, e.cookieName, f, i(h, e.sessionMaxAgeSeconds));
364
+ async function S(r, o, h) {
365
+ const f = await X({ ...o }, e.sessionSecret, e.sessionMaxAgeSeconds);
366
+ return Ve(r, e.cookieName, f, i(h, e.sessionMaxAgeSeconds));
399
367
  }
400
- function I(r) {
401
- const { refreshToken: o, ...h } = r, f = Fe(r.accessToken);
402
- return { ...h, organization: le(f), claims: f };
368
+ function P(r) {
369
+ const { refreshToken: o, ...h } = r, f = ze(r.accessToken);
370
+ return { ...h, organization: oe(f), claims: f };
403
371
  }
404
372
  async function R(r) {
405
373
  const o = new URL(r.url), h = l(r), f = o.searchParams.get("popup") === "1";
406
374
  if (h && !f) {
407
- const S = new URL(`${e.basePath}/login`, g(e, r));
408
- return o.searchParams.forEach((y, T) => S.searchParams.set(T, y)), S.searchParams.set("popup", "1"), at({
409
- popupUrl: S.toString(),
375
+ const v = new URL(`${e.basePath}/login`, _(e, r));
376
+ return o.searchParams.forEach((y, I) => v.searchParams.set(I, y)), v.searchParams.set("popup", "1"), ot({
377
+ popupUrl: v.toString(),
410
378
  authOrigin: new URL(e.issuer).origin,
411
379
  callbackUrl: d(r)
412
380
  });
413
381
  }
414
- const E = {
382
+ const k = {
415
383
  state: $(),
416
384
  verifier: $(),
417
385
  nonce: $(),
418
- returnTo: te(o.searchParams.get("returnTo") ?? o.searchParams.get("next"), e.afterSignInPath),
386
+ returnTo: Q(o.searchParams.get("returnTo") ?? o.searchParams.get("next"), e.afterSignInPath),
419
387
  popup: f,
420
388
  redirectUri: u(r),
421
389
  previewCallback: h
422
390
  }, w = await Re(t, e.fetch, {
423
- redirectUri: E.redirectUri,
391
+ redirectUri: k.redirectUri,
424
392
  scopes: e.scopes,
425
- state: E.state,
426
- nonce: E.nonce,
427
- codeChallenge: await Ue(E.verifier),
393
+ state: k.state,
394
+ nonce: k.nonce,
395
+ codeChallenge: await Ue(k.verifier),
428
396
  prompt: e.prompt,
429
397
  // The organization the app wants this sign-in to start in; the user is
430
398
  // never asked to pick one.
@@ -432,81 +400,81 @@ function lt(e) {
432
400
  // Pre-fills the sign-in page with the address the user is expected to
433
401
  // sign in with — an accepted invitation sends its invitee here with it.
434
402
  loginHint: o.searchParams.get("login_hint") ?? void 0
435
- }), _ = await Q({ ...E }, e.sessionSecret, ee);
436
- return P(w, [N(n, _, i(r, ee))]);
403
+ }), E = await X({ ...k }, e.sessionSecret, Z);
404
+ return b(w, [C(n, E, i(r, Z))]);
437
405
  }
438
- async function O(r) {
439
- const o = new URL(r.url), h = b(r.headers.get("cookie")), f = [N(n, "", i(r, 0))], E = h.get(n), w = E ? await q(E, e.sessionSecret) : null, _ = o.searchParams.get("code"), S = (k) => w?.popup && !w.previewCallback ? it(k, g(e, r), f) : P(k, f), y = o.searchParams.get("error");
440
- if (y) return S(p(r, y));
441
- if (!w || !_ || o.searchParams.get("state") !== w.state)
442
- return S(p(r, "invalid_state"));
443
- const T = o.searchParams.get("iss");
444
- if (w.previewCallback && T !== null && T !== e.issuer)
445
- return S(p(r, "invalid_issuer"));
406
+ async function A(r) {
407
+ const o = new URL(r.url), h = T(r.headers.get("cookie")), f = [C(n, "", i(r, 0))], k = h.get(n), w = k ? await Y(k, e.sessionSecret) : null, E = o.searchParams.get("code"), v = (g) => w?.popup && !w.previewCallback ? st(g, _(e, r), f) : b(g, f), y = o.searchParams.get("error");
408
+ if (y) return v(p(r, y));
409
+ if (!w || !E || o.searchParams.get("state") !== w.state)
410
+ return v(p(r, "invalid_state"));
411
+ const I = o.searchParams.get("iss");
412
+ if (w.previewCallback && I !== null && I !== e.issuer)
413
+ return v(p(r, "invalid_issuer"));
446
414
  try {
447
- const k = await Ce(t, e.fetch, {
448
- code: _,
415
+ const g = await Ce(t, e.fetch, {
416
+ code: E,
449
417
  codeVerifier: w.verifier,
450
418
  // Exactly as the authorization request named it.
451
419
  redirectUri: w.redirectUri ?? u(r)
452
420
  });
453
- if (!k.id_token) throw new Error("the token response carried no id_token; is the openid scope requested?");
454
- const M = await Ne(t, e.fetch, k.id_token, w.nonce), Se = {
455
- user: ct(M),
456
- accessToken: k.access_token,
457
- refreshToken: k.refresh_token,
458
- expiresAt: ne(k),
459
- sessionId: typeof M.sid == "string" ? M.sid : void 0
421
+ if (!g.id_token) throw new Error("the token response carried no id_token; is the openid scope requested?");
422
+ const L = await Ae(t, e.fetch, g.id_token, w.nonce), de = {
423
+ user: it(L),
424
+ accessToken: g.access_token,
425
+ refreshToken: g.refresh_token,
426
+ expiresAt: q(g),
427
+ sessionId: typeof L.sid == "string" ? L.sid : void 0
460
428
  };
461
- f.push(...await v(h, Se, r));
462
- } catch (k) {
463
- return e.logger.warn("[pontive] sign-in failed:", k instanceof Error ? k.message : String(k)), S(p(r, "exchange_failed"));
429
+ f.push(...await S(h, de, r));
430
+ } catch (g) {
431
+ return e.logger.warn("[pontive] sign-in failed:", g instanceof Error ? g.message : String(g)), v(p(r, "exchange_failed"));
464
432
  }
465
- return S(new URL(w.returnTo, g(e, r)).toString());
433
+ return v(new URL(w.returnTo, _(e, r)).toString());
466
434
  }
467
- async function A(r) {
468
- const o = b(r.headers.get("cookie")), h = await m(o), f = J(o, e.cookieName, i(r, 0));
469
- let E = p(r);
435
+ async function N(r) {
436
+ const o = T(r.headers.get("cookie")), h = await m(o), f = G(o, e.cookieName, i(r, 0));
437
+ let k = p(r);
470
438
  try {
471
- E = await Oe(t, e.fetch, {
439
+ k = await Ne(t, e.fetch, {
472
440
  postLogoutRedirectUri: p(r),
473
441
  sessionId: h?.sessionId
474
- }) ?? E;
442
+ }) ?? k;
475
443
  } catch (w) {
476
444
  e.logger.warn("[pontive] could not reach the issuer to end its session:", w instanceof Error ? w.message : String(w));
477
445
  }
478
- return P(E, f);
446
+ return b(k, f);
479
447
  }
480
- function j(r, o) {
448
+ function z(r, o) {
481
449
  return {
482
450
  ...r,
483
451
  accessToken: o.access_token,
484
452
  // A response without one means rotation is off: the token in hand is still current.
485
453
  refreshToken: o.refresh_token ?? r.refreshToken,
486
- expiresAt: ne(o)
454
+ expiresAt: q(o)
487
455
  };
488
456
  }
489
- async function we(r) {
490
- const o = new URL(r.url), h = b(r.headers.get("cookie")), f = te(o.searchParams.get("returnTo"), e.afterSignInPath), E = o.searchParams.get("organization_id"), w = (y) => {
491
- const T = new URL(f, g(e, r));
492
- return y && T.searchParams.set(ze, y), T.toString();
493
- }, _ = await m(h);
494
- if (!_?.refreshToken) return P(p(r));
495
- if (!E) return P(w("invalid_request"));
496
- let S;
457
+ async function pe(r) {
458
+ const o = new URL(r.url), h = T(r.headers.get("cookie")), f = Q(o.searchParams.get("returnTo"), e.afterSignInPath), k = o.searchParams.get("organization_id"), w = (y) => {
459
+ const I = new URL(f, _(e, r));
460
+ return y && I.searchParams.set(He, y), I.toString();
461
+ }, E = await m(h);
462
+ if (!E?.refreshToken) return b(p(r));
463
+ if (!k) return b(w("invalid_request"));
464
+ let v;
497
465
  try {
498
- S = await K(t, e.fetch, _.refreshToken, E);
466
+ v = await F(t, e.fetch, E.refreshToken, k);
499
467
  } catch (y) {
500
- return y instanceof G && y.code === "invalid_request" ? P(w("not_a_member")) : (e.logger.warn("[pontive] organization switch failed:", y instanceof Error ? y.message : String(y)), P(w("switch_failed")));
468
+ return y instanceof j && y.code === "invalid_request" ? b(w("not_a_member")) : (e.logger.warn("[pontive] organization switch failed:", y instanceof Error ? y.message : String(y)), b(w("switch_failed")));
501
469
  }
502
- return P(w(), await v(h, j(_, S), r));
470
+ return b(w(), await S(h, z(E, v), r));
503
471
  }
504
- async function me(r) {
472
+ async function he(r) {
505
473
  try {
506
- const o = await K(t, e.fetch, r.refreshToken);
507
- return j(r, o);
474
+ const o = await F(t, e.fetch, r.refreshToken);
475
+ return z(r, o);
508
476
  } catch (o) {
509
- if (o instanceof G && o.status >= 400 && o.status < 500)
477
+ if (o instanceof j && o.status >= 400 && o.status < 500)
510
478
  return e.logger.warn("[pontive] refresh refused; signing out:", o.message), null;
511
479
  throw o;
512
480
  }
@@ -516,71 +484,71 @@ function lt(e) {
516
484
  const { pathname: o } = new URL(r.url);
517
485
  if (!o.startsWith(`${e.basePath}/`)) return null;
518
486
  const h = o.slice(e.basePath.length + 1);
519
- return h === "login" && r.method === "GET" ? R(r) : h === "callback" && r.method === "GET" ? O(r) : h === "logout" && (r.method === "GET" || r.method === "POST") ? A(r) : h === F && (r.method === "GET" || r.method === "POST") ? we(r) : null;
487
+ return h === "login" && r.method === "GET" ? R(r) : h === "callback" && r.method === "GET" ? A(r) : h === "logout" && (r.method === "GET" || r.method === "POST") ? N(r) : h === H && (r.method === "GET" || r.method === "POST") ? pe(r) : null;
520
488
  },
521
489
  async getSession(r) {
522
- const o = await m(b(r));
490
+ const o = await m(T(r));
523
491
  return o ? Date.now() >= o.expiresAt ? (e.logger.warn(
524
492
  "[pontive] the session's access token has expired and getSession cannot refresh it. Run the SDK's middleware on this path so it refreshes before the request is handled."
525
- ), null) : I(o) : null;
493
+ ), null) : P(o) : null;
526
494
  },
527
495
  async refresh(r) {
528
- const o = b(r.headers.get("cookie")), h = (S) => ({
529
- session: S,
496
+ const o = T(r.headers.get("cookie")), h = (v) => ({
497
+ session: v,
530
498
  setCookies: [],
531
499
  cookieHeader: r.headers.get("cookie") ?? ""
532
500
  }), f = await m(o);
533
501
  if (!f) return h(null);
534
502
  if (new URL(r.url).pathname.startsWith(`${e.basePath}/`))
535
- return h(Date.now() < f.expiresAt ? I(f) : null);
536
- if (Date.now() < f.expiresAt - e.refreshSkewSeconds * 1e3) return h(I(f));
537
- const E = () => ({ session: null, setCookies: J(o, e.cookieName, i(r, 0)), cookieHeader: B(o) });
538
- if (!f.refreshToken) return E();
503
+ return h(Date.now() < f.expiresAt ? P(f) : null);
504
+ if (Date.now() < f.expiresAt - e.refreshSkewSeconds * 1e3) return h(P(f));
505
+ const k = () => ({ session: null, setCookies: G(o, e.cookieName, i(r, 0)), cookieHeader: W(o) });
506
+ if (!f.refreshToken) return k();
539
507
  let w;
540
508
  try {
541
- w = await s.run(f.refreshToken, () => me(f));
542
- } catch (S) {
543
- return e.logger.warn("[pontive] refresh failed, will retry:", S instanceof Error ? S.message : String(S)), h(Date.now() < f.expiresAt ? I(f) : null);
509
+ w = await s.run(f.refreshToken, () => he(f));
510
+ } catch (v) {
511
+ return e.logger.warn("[pontive] refresh failed, will retry:", v instanceof Error ? v.message : String(v)), h(Date.now() < f.expiresAt ? P(f) : null);
544
512
  }
545
- if (!w) return E();
546
- const _ = await v(o, w, r);
547
- return { session: I(w), setCookies: _, cookieHeader: B(o) };
513
+ if (!w) return k();
514
+ const E = await S(o, w, r);
515
+ return { session: P(w), setCookies: E, cookieHeader: W(o) };
548
516
  }
549
517
  };
550
518
  }
551
- const ut = "1.23.1", pt = "claim";
519
+ const ct = "1.25.0", lt = "claim";
552
520
  function vt(e = {}, t = {}) {
553
- const n = V(), s = Ve(e, n);
554
- if (Me(s, n)) return ht(s, t);
555
- const c = ae(s), a = ce(n) ? () => de(he(t), c.issuer) : async () => null;
556
- return fe(c, pe(c), a);
521
+ const n = fe(), s = we(e, n);
522
+ if (me(s, n)) return ut(s, t);
523
+ const c = se(s), a = ve(n) ? () => le(ce(t), c.issuer) : async () => null;
524
+ return ue(c, ae(c), a);
557
525
  }
558
- function he(e) {
526
+ function ce(e) {
559
527
  if (e.projectDir) return e.projectDir;
560
528
  const t = globalThis.process;
561
- if (typeof t?.cwd != "function") throw new se("keyless mode needs a project directory (process.cwd)");
529
+ if (typeof t?.cwd != "function") throw new te("keyless mode needs a project directory (process.cwd)");
562
530
  return t.cwd();
563
531
  }
564
- async function de(e, t) {
532
+ async function le(e, t) {
565
533
  try {
566
- const n = await ve(e);
534
+ const n = await Se(e);
567
535
  return n?.claim_token && n.issuer.replace(/\/+$/, "") === t ? n : null;
568
536
  } catch {
569
537
  return null;
570
538
  }
571
539
  }
572
- function x(e, t) {
540
+ function O(e, t) {
573
541
  return new Response(`${t}
574
542
  `, { status: e, headers: { "content-type": "text/plain; charset=utf-8", "cache-control": "no-store" } });
575
543
  }
576
- function fe(e, t, n) {
577
- const s = `${e.basePath}/${pt}`;
544
+ function ue(e, t, n) {
545
+ const s = `${e.basePath}/${lt}`;
578
546
  async function c(a) {
579
547
  try {
580
- const i = await Ee(a, { fetch: e.fetch });
548
+ const i = await ke(a, { fetch: e.fetch });
581
549
  return new Response(null, { status: 302, headers: { location: i.url, "cache-control": "no-store", "referrer-policy": "no-referrer" } });
582
550
  } catch (i) {
583
- return i instanceof W && i.status === 409 ? x(409, "This Pontive instance has already been claimed. Nothing in your app changes; manage it in the Pontive dashboard.") : i instanceof W && i.status === 404 ? x(410, oe(a, "expired")) : (e.logger.warn("[pontive] could not create a claim link:", i instanceof Error ? i.message : String(i)), x(502, "Pontive could not create a claim link just now. Try again, or run `npx pontive claim`."));
551
+ return i instanceof D && i.status === 409 ? O(409, "This Pontive instance has already been claimed. Nothing in your app changes; manage it in the Pontive dashboard.") : i instanceof D && i.status === 404 ? O(410, ne(a, "expired")) : (e.logger.warn("[pontive] could not create a claim link:", i instanceof Error ? i.message : String(i)), O(502, "Pontive could not create a claim link just now. Try again, or run `npx pontive claim`."));
584
552
  }
585
553
  }
586
554
  return {
@@ -603,48 +571,48 @@ function fe(e, t, n) {
603
571
  }
604
572
  };
605
573
  }
606
- const H = /* @__PURE__ */ new Map(), re = /* @__PURE__ */ new Set();
607
- function ht(e, t) {
574
+ const M = /* @__PURE__ */ new Map(), ee = /* @__PURE__ */ new Set();
575
+ function ut(e, t) {
608
576
  const n = e.logger ?? console;
609
577
  let s, c, a = !1;
610
578
  async function i() {
611
- const u = he(t), p = (e.basePath ?? "/api/auth").replace(/\/+$/, "");
612
- let m = H.get(u);
579
+ const u = ce(t), p = (e.basePath ?? "/api/auth").replace(/\/+$/, "");
580
+ let m = M.get(u);
613
581
  m || (m = ye({
614
582
  dir: u,
615
- redirectUris: e.redirectUri ? [e.redirectUri] : ke(p),
616
- client: { name: t.clientName ?? "@pontive/server", version: ut },
583
+ redirectUris: e.redirectUri ? [e.redirectUri] : ge(p),
584
+ client: { name: t.clientName ?? "@pontive/server", version: ct },
617
585
  fetch: e.fetch
618
- }), H.set(u, m), m.catch(() => H.delete(u)));
619
- const v = await m;
620
- re.has(u) || (re.add(u), n.warn(`
621
- ${_e(v.record, { created: v.created })}
586
+ }), M.set(u, m), m.catch(() => M.delete(u)));
587
+ const S = await m;
588
+ ee.has(u) || (ee.add(u), n.warn(`
589
+ ${Ee(S.record, { created: S.created })}
622
590
  `));
623
- const I = globalThis.process;
624
- if (I?.env)
625
- for (const [O, A] of Object.entries(v.env))
626
- A !== void 0 && !I.env[O] && (I.env[O] = A);
627
- if (!e.clientSecret && !v.env.PONTIVE_CLIENT_SECRET)
591
+ const P = globalThis.process;
592
+ if (P?.env)
593
+ for (const [A, N] of Object.entries(S.env))
594
+ N !== void 0 && !P.env[A] && (P.env[A] = N);
595
+ if (!e.clientSecret && !S.env.PONTIVE_CLIENT_SECRET)
628
596
  throw new Error(
629
- `@pontive/server: ${ge} names ${v.record.instance_id}, but PONTIVE_CLIENT_SECRET is neither in ${Ie} nor in the environment. Put it back, or run \`npx pontive init --reset\`.`
597
+ `@pontive/server: ${_e} names ${S.record.instance_id}, but PONTIVE_CLIENT_SECRET is neither in ${Pe} nor in the environment. Put it back, or run \`npx pontive init --reset\`.`
630
598
  );
631
- const R = ae({
599
+ const R = se({
632
600
  ...e,
633
- issuer: e.issuer || v.env.PONTIVE_ISSUER,
634
- clientId: e.clientId || v.env.PONTIVE_CLIENT_ID,
635
- clientSecret: e.clientSecret || v.env.PONTIVE_CLIENT_SECRET,
636
- sessionSecret: e.sessionSecret || v.env.PONTIVE_SESSION_SECRET,
637
- fetch: dt(e.fetch, v.record, n)
601
+ issuer: e.issuer || S.env.PONTIVE_ISSUER,
602
+ clientId: e.clientId || S.env.PONTIVE_CLIENT_ID,
603
+ clientSecret: e.clientSecret || S.env.PONTIVE_CLIENT_SECRET,
604
+ sessionSecret: e.sessionSecret || S.env.PONTIVE_SESSION_SECRET,
605
+ fetch: pt(e.fetch, S.record, n)
638
606
  });
639
- return fe(R, pe(R), () => de(u, R.issuer));
607
+ return ue(R, ae(R), () => le(u, R.issuer));
640
608
  }
641
609
  function l() {
642
610
  return c ? Promise.reject(c) : (s ??= i().catch((u) => {
643
- throw s = void 0, u instanceof Pe && (c = u), u;
611
+ throw s = void 0, u instanceof be && (c = u), u;
644
612
  }), s);
645
613
  }
646
614
  function d(u) {
647
- return u instanceof se ? (a || (a = !0, n.warn(
615
+ return u instanceof te ? (a || (a = !0, n.warn(
648
616
  `[pontive] ${u.message}. Requests here proceed without a session until the dev server restarts with the PONTIVE_* variables keyless mode wrote to .env.local.`
649
617
  )), !0) : !1;
650
618
  }
@@ -653,7 +621,7 @@ ${_e(v.record, { created: v.created })}
653
621
  try {
654
622
  return await (await l()).handle(u);
655
623
  } catch (p) {
656
- if (d(p)) return x(503, "Pontive keyless mode can't run in this runtime; restart the dev server.");
624
+ if (d(p)) return O(503, "Pontive keyless mode can't run in this runtime; restart the dev server.");
657
625
  throw p;
658
626
  }
659
627
  },
@@ -678,23 +646,26 @@ ${_e(v.record, { created: v.created })}
678
646
  }
679
647
  };
680
648
  }
681
- function dt(e, t, n) {
649
+ function pt(e, t, n) {
682
650
  const s = e ?? ((...a) => fetch(...a));
683
651
  let c = !1;
684
652
  return async (a, i) => {
685
653
  const l = await s(a, i);
686
- return l.status === 401 && !c && (typeof a == "string" ? a : a instanceof URL ? a.toString() : a.url).startsWith(t.issuer) && (c = !0, n.warn(`[pontive] ${oe(t, "refused")}`)), l;
654
+ return l.status === 401 && !c && (typeof a == "string" ? a : a instanceof URL ? a.toString() : a.url).startsWith(t.issuer) && (c = !0, n.warn(`[pontive] ${ne(t, "refused")}`)), l;
687
655
  };
688
656
  }
689
657
  export {
690
- je as ACCESS_COOKIE,
691
- pt as CLAIM_ROUTE,
692
- ze as ORGANIZATION_ERROR_PARAM,
693
- U as PONTIVE_ENV,
694
- ut as PONTIVE_SERVER_VERSION,
695
- We as SESSION_HINT_COOKIE,
696
- F as SWITCH_ORGANIZATION_ROUTE,
658
+ De as ACCESS_COOKIE,
659
+ lt as CLAIM_ROUTE,
660
+ He as ORGANIZATION_ERROR_PARAM,
661
+ yt as PONTIVE_ENV,
662
+ ct as PONTIVE_SERVER_VERSION,
663
+ gt as Pontive,
664
+ Et as PontiveAPIError,
665
+ _t as PontiveConnectionError,
666
+ Fe as SESSION_HINT_COOKIE,
667
+ H as SWITCH_ORGANIZATION_ROUTE,
697
668
  vt as createServerAuth,
698
- St as switchOrganizationPath
669
+ mt as switchOrganizationPath
699
670
  };
700
671
  //# sourceMappingURL=index.js.map