@plitzi/sdk-auth 0.39.0 → 0.39.2
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 +20 -0
- package/dist/AuthContext.mjs +1 -2
- package/dist/AuthContextProvider.mjs +38 -37
- package/dist/AuthManager.mjs +1 -2
- package/dist/AuthProvider.d.ts +3 -1
- package/dist/AuthProvider.mjs +2 -2
- package/dist/helpers/SessionStore.mjs +1 -2
- package/dist/helpers/publishedSession.mjs +1 -2
- package/dist/helpers/resolveAuthSettings.mjs +1 -2
- package/dist/helpers/sessionHint.mjs +1 -2
- package/dist/helpers/sessionViews.mjs +1 -2
- package/dist/helpers/tokenClaims.mjs +1 -2
- package/dist/hooks/useAuth/index.mjs +1 -2
- package/dist/hooks/useAuth/useAuth.d.ts +1 -0
- package/dist/hooks/useAuth/useAuth.mjs +25 -22
- package/dist/hooks/useSessionQueryReset/index.mjs +1 -2
- package/dist/hooks/useSessionQueryReset/useSessionQueryReset.mjs +1 -2
- package/dist/index.mjs +8 -8
- package/dist/providers/BasicAuthProvider.mjs +1 -2
- package/dist/providers/ServerAuthProvider.mjs +1 -2
- package/package.json +12 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @plitzi/sdk-auth
|
|
2
2
|
|
|
3
|
+
## 0.39.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- fad1264: Released with every `@plitzi` package at this version. What changed in each, and what to do when you upgrade, is in
|
|
8
|
+
`@plitzi/cli`'s `CHANGELOG.md`: one copy of the notes, not one per package.
|
|
9
|
+
- Updated dependencies [fad1264]
|
|
10
|
+
- @plitzi/sdk-navigation@0.39.2
|
|
11
|
+
- @plitzi/sdk-shared@0.39.2
|
|
12
|
+
|
|
13
|
+
## 0.39.1
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- f174a61: Released with every `@plitzi` package at this version. What changed in each, and what to do when you upgrade, is in
|
|
18
|
+
`@plitzi/cli`'s `CHANGELOG.md`: one copy of the notes, not one per package.
|
|
19
|
+
- Updated dependencies [f174a61]
|
|
20
|
+
- @plitzi/sdk-navigation@0.39.1
|
|
21
|
+
- @plitzi/sdk-shared@0.39.1
|
|
22
|
+
|
|
3
23
|
## 0.39.0
|
|
4
24
|
|
|
5
25
|
### Minor Changes
|
package/dist/AuthContext.mjs
CHANGED
|
@@ -4,14 +4,14 @@ import { resolveAuthSettings as n } from "./helpers/resolveAuthSettings.mjs";
|
|
|
4
4
|
import { testAccountAuth as r } from "./helpers/sessionViews.mjs";
|
|
5
5
|
import i from "./hooks/useAuth/index.mjs";
|
|
6
6
|
import a from "./hooks/useSessionQueryReset/index.mjs";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
7
|
+
import { use as o, useMemo as s, useRef as c } from "react";
|
|
8
|
+
import { useNavigation as l } from "@plitzi/sdk-navigation";
|
|
9
|
+
import { evaluateRuleGroup as u } from "@plitzi/sdk-shared/conditions";
|
|
10
10
|
import { processTwig as d } from "@plitzi/sdk-shared/helpers/twigWrapper";
|
|
11
|
-
import { NetworkContext as f } from "@plitzi/sdk-shared/network";
|
|
11
|
+
import { NetworkContext as f } from "@plitzi/sdk-shared/network/react";
|
|
12
12
|
import { useCommonStore as p, useRenderSettings as m } from "@plitzi/sdk-shared/store";
|
|
13
13
|
import { jsx as h } from "react/jsx-runtime";
|
|
14
|
-
|
|
14
|
+
// src/AuthContextProvider.tsx
|
|
15
15
|
var g = [
|
|
16
16
|
"loginUrl",
|
|
17
17
|
"userUrl",
|
|
@@ -32,7 +32,7 @@ var g = [
|
|
|
32
32
|
let n = e, r = t;
|
|
33
33
|
return [.../* @__PURE__ */ new Set([...Object.keys(n), ...Object.keys(r)])].every((e) => JSON.stringify(n[e]) === JSON.stringify(r[e]));
|
|
34
34
|
}, v = ({ children: v, server: y }) => {
|
|
35
|
-
let { previewMode: b, isHydrating: x, environment: S } = m(), { webKey: C } =
|
|
35
|
+
let { previewMode: b, isHydrating: x, environment: S } = m(), { webKey: C } = o(f), [[w, T]] = p(["schema.settings", "schema.variables"]), { queryParams: E, hostname: D } = l({ server: y }), O = s(() => ({
|
|
36
36
|
queryParams: E,
|
|
37
37
|
hostname: D,
|
|
38
38
|
environment: S
|
|
@@ -40,13 +40,13 @@ var g = [
|
|
|
40
40
|
E,
|
|
41
41
|
D,
|
|
42
42
|
S
|
|
43
|
-
]), k =
|
|
43
|
+
]), k = s(() => Array.isArray(T) ? T.reduce((e, t) => {
|
|
44
44
|
let { name: n, value: r, subValues: i } = t;
|
|
45
45
|
if (!Array.isArray(i) || i.length === 0) return {
|
|
46
46
|
...e,
|
|
47
47
|
[n]: r
|
|
48
48
|
};
|
|
49
|
-
let a = i.find((e) =>
|
|
49
|
+
let a = i.find((e) => u(e.when, O));
|
|
50
50
|
return a ? {
|
|
51
51
|
...e,
|
|
52
52
|
[n]: a.value
|
|
@@ -54,14 +54,14 @@ var g = [
|
|
|
54
54
|
...e,
|
|
55
55
|
[n]: r
|
|
56
56
|
};
|
|
57
|
-
}, {}) : {}, [T, O]), A =
|
|
57
|
+
}, {}) : {}, [T, O]), A = s(() => {
|
|
58
58
|
let e = Object.fromEntries(g.map((e) => [e, w[e]]));
|
|
59
59
|
try {
|
|
60
60
|
return JSON.parse(d(JSON.stringify(e), k));
|
|
61
61
|
} catch {
|
|
62
62
|
return e;
|
|
63
63
|
}
|
|
64
|
-
}, [w, k]), { provider: j, settings: M } =
|
|
64
|
+
}, [w, k]), { provider: j, settings: M } = s(() => {
|
|
65
65
|
let e = n(w.userProvider, {
|
|
66
66
|
...A,
|
|
67
67
|
tokenStorage: w.tokenStorage ?? "localStorage",
|
|
@@ -80,34 +80,34 @@ var g = [
|
|
|
80
80
|
w,
|
|
81
81
|
C,
|
|
82
82
|
y.auth
|
|
83
|
-
]), N =
|
|
83
|
+
]), N = c(M), P = s(() => (_(N.current, M) || (N.current = M), N.current), [M]), { manager: F, loading: I, authenticated: L, signedOutHere: R, state: z, bootstrapUser: B, bootstrapToken: V, peekedUser: H, peekedToken: U } = i({
|
|
84
84
|
server: y,
|
|
85
85
|
isHydrating: x,
|
|
86
86
|
provider: j,
|
|
87
87
|
settings: P
|
|
88
|
-
}),
|
|
89
|
-
state:
|
|
88
|
+
}), W = F.getProvider(), { user: G, accessToken: K } = t({
|
|
89
|
+
state: z,
|
|
90
90
|
provider: {
|
|
91
|
-
user:
|
|
92
|
-
accessToken:
|
|
91
|
+
user: W?.user,
|
|
92
|
+
accessToken: W?.token?.accessToken
|
|
93
93
|
},
|
|
94
94
|
bootstrap: {
|
|
95
|
-
user:
|
|
96
|
-
accessToken:
|
|
95
|
+
user: B,
|
|
96
|
+
accessToken: V
|
|
97
97
|
},
|
|
98
98
|
peeked: {
|
|
99
|
-
user:
|
|
100
|
-
accessToken:
|
|
99
|
+
user: H,
|
|
100
|
+
accessToken: U
|
|
101
101
|
}
|
|
102
|
-
}),
|
|
103
|
-
let e =
|
|
104
|
-
details:
|
|
105
|
-
accessToken:
|
|
106
|
-
} : void 0, t =
|
|
107
|
-
return t?.accessToken === e?.accessToken && _(t?.details, e?.details) || (
|
|
108
|
-
}, [
|
|
109
|
-
a(L ? String(
|
|
110
|
-
let
|
|
102
|
+
}), q = c(void 0), J = s(() => {
|
|
103
|
+
let e = G ? {
|
|
104
|
+
details: G,
|
|
105
|
+
accessToken: K
|
|
106
|
+
} : void 0, t = q.current;
|
|
107
|
+
return t?.accessToken === e?.accessToken && _(t?.details, e?.details) || (q.current = e), q.current;
|
|
108
|
+
}, [G, K]);
|
|
109
|
+
a(L ? String(J?.details?.id ?? "") : "");
|
|
110
|
+
let Y = s(() => ({
|
|
111
111
|
login: F.login.bind(F),
|
|
112
112
|
refresh: F.refresh.bind(F),
|
|
113
113
|
revalidate: F.revalidate.bind(F),
|
|
@@ -116,24 +116,25 @@ var g = [
|
|
|
116
116
|
logout: F.logout.bind(F),
|
|
117
117
|
logoutEverywhere: F.logoutEverywhere.bind(F),
|
|
118
118
|
provider: F.getProviderType(),
|
|
119
|
-
state:
|
|
119
|
+
state: z,
|
|
120
120
|
authenticated: L || !b,
|
|
121
|
-
|
|
121
|
+
signedOutHere: R && b,
|
|
122
|
+
user: J
|
|
122
123
|
}), [
|
|
123
124
|
F,
|
|
124
|
-
|
|
125
|
+
z,
|
|
125
126
|
L,
|
|
127
|
+
R,
|
|
126
128
|
b,
|
|
127
|
-
q
|
|
128
|
-
]), [Y, X] = p("runtime.testAccount"), Z = c(() => Y ? r(J, Y, () => X(void 0)) : J, [
|
|
129
|
-
Y,
|
|
130
|
-
X,
|
|
131
129
|
J
|
|
130
|
+
]), [X, Z] = p("runtime.testAccount"), Q = s(() => X ? r(Y, X, () => Z(void 0)) : Y, [
|
|
131
|
+
X,
|
|
132
|
+
Z,
|
|
133
|
+
Y
|
|
132
134
|
]);
|
|
133
135
|
return /* @__PURE__ */ h(e, {
|
|
134
|
-
value:
|
|
136
|
+
value: Q,
|
|
135
137
|
children: !I && v
|
|
136
138
|
});
|
|
137
139
|
};
|
|
138
|
-
//#endregion
|
|
139
140
|
export { v as default };
|
package/dist/AuthManager.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import e from "./providers/BasicAuthProvider.mjs";
|
|
2
2
|
import t from "./providers/ServerAuthProvider.mjs";
|
|
3
|
-
|
|
3
|
+
// src/AuthManager.ts
|
|
4
4
|
var n = /* @__PURE__ */ new Map([["basic", (t) => new e(t)], ["server", (e) => new t(e)]]), r = (e, t) => {
|
|
5
5
|
n.set(e, t);
|
|
6
6
|
}, i = () => [...n.keys()], a = class {
|
|
@@ -70,5 +70,4 @@ var n = /* @__PURE__ */ new Map([["basic", (t) => new e(t)], ["server", (e) => n
|
|
|
70
70
|
return this.provider?.on(e);
|
|
71
71
|
}
|
|
72
72
|
};
|
|
73
|
-
//#endregion
|
|
74
73
|
export { a as AuthManager, i as getAuthProviderNames, r as registerAuthProvider };
|
package/dist/AuthProvider.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AuthFailureReason, AuthResult, AuthState, LoginResult, MfaChallenge, Schema, SessionScope, TokenResult } from '@plitzi/sdk-shared';
|
|
2
2
|
/** Why a state changed. Not control flow — it is what makes an auth trace readable, and every transition below
|
|
3
3
|
* names one, because "it went to guest" is not a diagnosis and "the hint cookie was gone" is. */
|
|
4
|
-
export type AuthStateReason = 'bootstrap' | 'restored' | 'granted' | 'renewed' | 'identity' | 'redirect' | 'exchanged' | 'no-provider' | 'skip-auth' | 'hint-missing' | 'no-evidence' | 'signed-out' | 'another-tab' | 'settled' | 'authenticating';
|
|
4
|
+
export type AuthStateReason = 'bootstrap' | 'restored' | 'granted' | 'renewed' | 'identity' | 'redirect' | 'exchanged' | 'no-provider' | 'skip-auth' | 'hint-missing' | 'server-found-nobody' | 'no-evidence' | 'signed-out' | 'another-tab' | 'settled' | 'authenticating';
|
|
5
5
|
export type AuthEvent = {
|
|
6
6
|
type: 'state';
|
|
7
7
|
state: AuthState;
|
|
@@ -22,6 +22,8 @@ export type AuthBootstrap<U> = {
|
|
|
22
22
|
accessToken?: string;
|
|
23
23
|
expiresAt?: number;
|
|
24
24
|
skipAuth?: boolean;
|
|
25
|
+
/** The server rendered this page, resolved this very request's session, and found nobody (`server.authenticated`). */
|
|
26
|
+
serverFoundNobody?: boolean;
|
|
25
27
|
};
|
|
26
28
|
export type AuthProviderProps = {
|
|
27
29
|
/** The credential naming the space this SDK instance renders, forwarded on requests made on the space's behalf —
|
package/dist/AuthProvider.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { readSessionHint as e } from "./helpers/sessionHint.mjs";
|
|
|
2
2
|
import t from "./helpers/SessionStore.mjs";
|
|
3
3
|
import { nowInSeconds as n, toSeconds as r, tokenExpiresAt as i } from "./helpers/tokenClaims.mjs";
|
|
4
4
|
import { onAuthFailure as a, sameRegistrableDomain as o } from "@plitzi/sdk-shared/auth";
|
|
5
|
-
|
|
5
|
+
// src/AuthProvider.ts
|
|
6
6
|
var s = 60, c = 300, l = 2147483647, u = class {
|
|
7
7
|
state = "init";
|
|
8
8
|
session = { validatedAt: 0 };
|
|
@@ -96,6 +96,7 @@ var s = 60, c = 300, l = 2147483647, u = class {
|
|
|
96
96
|
token: r?.token,
|
|
97
97
|
validatedAt: r?.validatedAt ?? 0
|
|
98
98
|
}, this.hintCookie && !i) this.endSession(void 0, "hint-missing");
|
|
99
|
+
else if (t.serverFoundNobody && this.hintCookie && this.hasLiveToken() && this.session.user) this.setState("initLoading", "server-found-nobody"), await this.revalidate(!0);
|
|
99
100
|
else if (this.hasLiveToken() && this.session.user) {
|
|
100
101
|
this.setState("authenticated", "restored"), this.scheduleRenewal();
|
|
101
102
|
let e = this.isFresh() && this.gate !== "strict" ? void 0 : this.revalidate(!0);
|
|
@@ -258,5 +259,4 @@ var s = 60, c = 300, l = 2147483647, u = class {
|
|
|
258
259
|
}, !1);
|
|
259
260
|
}
|
|
260
261
|
};
|
|
261
|
-
//#endregion
|
|
262
262
|
export { u as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/helpers/SessionStore.ts
|
|
2
2
|
var e = (e) => typeof e == "object" && !!e && e.version === 1, t = class {
|
|
3
3
|
kind;
|
|
4
4
|
key;
|
|
@@ -41,5 +41,4 @@ var e = (e) => typeof e == "object" && !!e && e.version === 1, t = class {
|
|
|
41
41
|
return window.addEventListener("storage", t), () => window.removeEventListener("storage", t);
|
|
42
42
|
}
|
|
43
43
|
};
|
|
44
|
-
//#endregion
|
|
45
44
|
export { t as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/helpers/publishedSession.ts
|
|
2
2
|
var e = (e) => {
|
|
3
3
|
let { state: t, provider: n, bootstrap: r, peeked: i } = e;
|
|
4
4
|
return n?.user ? {
|
|
@@ -12,5 +12,4 @@ var e = (e) => {
|
|
|
12
12
|
accessToken: i.accessToken
|
|
13
13
|
} : {};
|
|
14
14
|
};
|
|
15
|
-
//#endregion
|
|
16
15
|
export { e as publishedSession };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/helpers/sessionHint.ts
|
|
2
2
|
var e = (e) => {
|
|
3
3
|
let [t, n] = e.split("."), r = Number(t);
|
|
4
4
|
if (!Number.isFinite(r) || r <= 0) return;
|
|
@@ -13,5 +13,4 @@ var e = (e) => {
|
|
|
13
13
|
if (r !== -1 && n.slice(0, r).trim() === t) return e(decodeURIComponent(n.slice(r + 1).trim()));
|
|
14
14
|
}
|
|
15
15
|
};
|
|
16
|
-
//#endregion
|
|
17
16
|
export { t as readSessionHint };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { omit as e } from "@plitzi/plitzi-ui/helpers";
|
|
2
|
-
|
|
2
|
+
// src/helpers/sessionViews.ts
|
|
3
3
|
var t = (t) => ({
|
|
4
4
|
...e(t, ["user"]),
|
|
5
5
|
authenticated: !1,
|
|
@@ -27,5 +27,4 @@ var t = (t) => ({
|
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
29
|
};
|
|
30
|
-
//#endregion
|
|
31
30
|
export { t as guestAuth, n as testAccountAuth };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/helpers/tokenClaims.ts
|
|
2
2
|
var e = (e) => {
|
|
3
3
|
try {
|
|
4
4
|
let t = e.replaceAll("-", "+").replaceAll("_", "/"), n = t.padEnd(t.length + (4 - t.length % 4) % 4, "="), r = JSON.parse(atob(n));
|
|
@@ -15,5 +15,4 @@ var e = (e) => {
|
|
|
15
15
|
}, n = () => Math.floor(Date.now() / 1e3), r = 1e11, i = (e) => {
|
|
16
16
|
if (!(typeof e != "number" || !Number.isFinite(e) || e <= 0)) return Math.floor(e > r ? e / 1e3 : e);
|
|
17
17
|
};
|
|
18
|
-
//#endregion
|
|
19
18
|
export { n as nowInSeconds, i as toSeconds, t as tokenExpiresAt };
|
|
@@ -1,53 +1,56 @@
|
|
|
1
1
|
import { AuthManager as e } from "../../AuthManager.mjs";
|
|
2
2
|
import { useCallback as t, useEffect as n, useMemo as r, useRef as i, useState as a } from "react";
|
|
3
|
-
|
|
3
|
+
// src/hooks/useAuth/useAuth.ts
|
|
4
4
|
var o = /* @__PURE__ */ new Set([
|
|
5
5
|
"authenticating",
|
|
6
6
|
"signed-out",
|
|
7
7
|
"another-tab"
|
|
8
8
|
]), s = ({ server: s, isHydrating: c = !1, provider: l = "", settings: u }) => {
|
|
9
|
-
let [d, f] = a(!1), p = i(!1), m = s?.authenticated ? s.user?.details : void 0, h = typeof s?.user?.accessToken == "string" ? s.user.accessToken : void 0, g = d ? void 0 : m, _ = d ? void 0 : h, [v, y] = a("init"), b = t((e) => {
|
|
10
|
-
e.type === "state" && (y(e.state), e.reason !== void 0 && o.has(e.reason) && (p.current = !0, f(!0)));
|
|
11
|
-
}, []),
|
|
9
|
+
let [d, f] = a(!1), p = i(!1), m = s?.authenticated ? s.user?.details : void 0, h = typeof s?.user?.accessToken == "string" ? s.user.accessToken : void 0, g = d ? void 0 : m, _ = d ? void 0 : h, [v, y] = a("init"), [b, x] = a(!1), S = t((e) => {
|
|
10
|
+
e.type === "logout" && x(!0), e.type === "state" && (y(e.state), e.state === "authenticated" && x(!1), e.reason !== void 0 && o.has(e.reason) && (p.current = !0, f(!0)));
|
|
11
|
+
}, []), C = r(() => new e(l, S, u), [
|
|
12
12
|
l,
|
|
13
|
-
|
|
13
|
+
S,
|
|
14
14
|
u
|
|
15
|
-
]),
|
|
16
|
-
|
|
15
|
+
]), w = r(() => c || g ? void 0 : C.peek(), [
|
|
16
|
+
C,
|
|
17
17
|
c,
|
|
18
18
|
g
|
|
19
|
-
]),
|
|
19
|
+
]), T = v !== "init" && v !== "initLoading" || !!g || c || w?.state === "authenticated" || w?.state === "guest";
|
|
20
20
|
return n(() => {
|
|
21
21
|
let e = !p.current;
|
|
22
|
-
return
|
|
22
|
+
return C.init({
|
|
23
23
|
user: e ? m : void 0,
|
|
24
24
|
accessToken: e ? h : void 0,
|
|
25
25
|
expiresAt: e ? s?.user?.expiresAt : void 0,
|
|
26
|
-
skipAuth: s?.skipAuth
|
|
27
|
-
|
|
26
|
+
skipAuth: s?.skipAuth,
|
|
27
|
+
serverFoundNobody: e && s?.authenticated === !1
|
|
28
|
+
}), () => C.dispose();
|
|
28
29
|
}, [
|
|
29
|
-
|
|
30
|
+
C,
|
|
30
31
|
m,
|
|
31
32
|
h,
|
|
32
33
|
s?.user?.expiresAt,
|
|
33
|
-
s?.skipAuth
|
|
34
|
+
s?.skipAuth,
|
|
35
|
+
s?.authenticated
|
|
34
36
|
]), r(() => ({
|
|
35
|
-
manager:
|
|
37
|
+
manager: C,
|
|
36
38
|
state: v,
|
|
37
39
|
bootstrapUser: g,
|
|
38
40
|
bootstrapToken: _,
|
|
39
|
-
peekedUser:
|
|
40
|
-
peekedToken:
|
|
41
|
-
loading: v === "initLoading" || !
|
|
42
|
-
authenticated: v === "authenticated" || v === "init" && (!!g ||
|
|
41
|
+
peekedUser: w?.user,
|
|
42
|
+
peekedToken: w?.token?.accessToken,
|
|
43
|
+
loading: v === "initLoading" || !T,
|
|
44
|
+
authenticated: v === "authenticated" || v === "init" && (!!g || w?.state === "authenticated"),
|
|
45
|
+
signedOutHere: b
|
|
43
46
|
}), [
|
|
44
|
-
|
|
47
|
+
C,
|
|
45
48
|
v,
|
|
46
49
|
g,
|
|
47
50
|
_,
|
|
48
|
-
|
|
49
|
-
|
|
51
|
+
T,
|
|
52
|
+
w,
|
|
53
|
+
b
|
|
50
54
|
]);
|
|
51
55
|
};
|
|
52
|
-
//#endregion
|
|
53
56
|
export { s as default };
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { useRef as e } from "react";
|
|
2
2
|
import { useIsomorphicLayoutEffect as t } from "@plitzi/nexus/react";
|
|
3
3
|
import { queryCache as n } from "@plitzi/sdk-shared/queries";
|
|
4
|
-
|
|
4
|
+
// src/hooks/useSessionQueryReset/useSessionQueryReset.ts
|
|
5
5
|
var r = (r) => {
|
|
6
6
|
let i = e(r);
|
|
7
7
|
t(() => {
|
|
8
8
|
i.current !== r && (i.current = r, n.reset({ refetch: r !== "" }));
|
|
9
9
|
}, [r]);
|
|
10
10
|
};
|
|
11
|
-
//#endregion
|
|
12
11
|
export { r as default };
|
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { AuthContext as e } from "./AuthContext.mjs";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import o from "./
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import d from "./
|
|
9
|
-
export { e as AuthContext,
|
|
2
|
+
import t from "./AuthContextProvider.mjs";
|
|
3
|
+
import n from "./AuthProvider.mjs";
|
|
4
|
+
import r from "./hooks/useAuth/index.mjs";
|
|
5
|
+
import { AuthManager as i, getAuthProviderNames as a, registerAuthProvider as o } from "./AuthManager.mjs";
|
|
6
|
+
import { readSessionHint as s } from "./helpers/sessionHint.mjs";
|
|
7
|
+
import { guestAuth as c, testAccountAuth as l } from "./helpers/sessionViews.mjs";
|
|
8
|
+
import { nowInSeconds as u, tokenExpiresAt as d } from "./helpers/tokenClaims.mjs";
|
|
9
|
+
export { e as AuthContext, t as AuthContextProvider, i as AuthManager, n as AuthProvider, a as getAuthProviderNames, c as guestAuth, u as nowInSeconds, s as readSessionHint, o as registerAuthProvider, l as testAccountAuth, d as tokenExpiresAt, r as useAuth };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import e from "../AuthProvider.mjs";
|
|
2
2
|
import { get as t } from "@plitzi/plitzi-ui/helpers";
|
|
3
3
|
import { authFailureFromResponse as n } from "@plitzi/sdk-shared/auth";
|
|
4
|
-
|
|
4
|
+
// src/providers/BasicAuthProvider.ts
|
|
5
5
|
var r = (e, n) => t(e, n, void 0), i = (e, t) => {
|
|
6
6
|
let n = r(e, t);
|
|
7
7
|
return typeof n == "string" && n !== "" ? n : null;
|
|
@@ -206,5 +206,4 @@ var r = (e, n) => t(e, n, void 0), i = (e, t) => {
|
|
|
206
206
|
};
|
|
207
207
|
}
|
|
208
208
|
};
|
|
209
|
-
//#endregion
|
|
210
209
|
export { s as default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import e from "../AuthProvider.mjs";
|
|
2
|
-
|
|
2
|
+
// src/providers/ServerAuthProvider.ts
|
|
3
3
|
var t = class extends e {
|
|
4
4
|
name = "server";
|
|
5
5
|
loginUrl;
|
|
@@ -52,5 +52,4 @@ var t = class extends e {
|
|
|
52
52
|
return Promise.resolve(this.getState() === "authenticated");
|
|
53
53
|
}
|
|
54
54
|
};
|
|
55
|
-
//#endregion
|
|
56
55
|
export { t as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plitzi/sdk-auth",
|
|
3
|
-
"version": "0.39.
|
|
3
|
+
"version": "0.39.2",
|
|
4
4
|
"license": "AGPL-3.0",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -9,19 +9,21 @@
|
|
|
9
9
|
".": {
|
|
10
10
|
"@plitzi/source": "./src/index.ts",
|
|
11
11
|
"types": "./dist/index.d.ts",
|
|
12
|
-
"import": "./dist/index.mjs"
|
|
12
|
+
"import": "./dist/index.mjs",
|
|
13
|
+
"default": "./dist/index.mjs"
|
|
13
14
|
},
|
|
14
15
|
"./*": {
|
|
15
16
|
"@plitzi/source": "./src/*/index.ts",
|
|
16
17
|
"types": "./dist/*/index.d.ts",
|
|
17
|
-
"import": "./dist/*/index.mjs"
|
|
18
|
+
"import": "./dist/*/index.mjs",
|
|
19
|
+
"default": "./dist/*/index.mjs"
|
|
18
20
|
}
|
|
19
21
|
},
|
|
20
22
|
"type": "module",
|
|
21
23
|
"sideEffects": false,
|
|
22
24
|
"scripts": {
|
|
23
|
-
"lint": "eslint ./src",
|
|
24
|
-
"typecheck": "tsc -p tsconfig.app.json --noEmit",
|
|
25
|
+
"lint": "eslint --cache --cache-location .eslintcache --cache-strategy content ./src",
|
|
26
|
+
"typecheck": "tsc -p tsconfig.app.json --noEmit --incremental --tsBuildInfoFile .tsbuildinfo/app.tsbuildinfo",
|
|
25
27
|
"test": "vitest run",
|
|
26
28
|
"test:watch": "vitest",
|
|
27
29
|
"test:ui": "vitest --ui",
|
|
@@ -31,16 +33,16 @@
|
|
|
31
33
|
},
|
|
32
34
|
"dependencies": {
|
|
33
35
|
"@plitzi/nexus": "^1.4.0",
|
|
34
|
-
"@plitzi/plitzi-ui": "^1.6.
|
|
35
|
-
"@plitzi/sdk-navigation": "0.39.
|
|
36
|
-
"@plitzi/sdk-shared": "0.39.
|
|
36
|
+
"@plitzi/plitzi-ui": "^1.6.38",
|
|
37
|
+
"@plitzi/sdk-navigation": "0.39.2",
|
|
38
|
+
"@plitzi/sdk-shared": "0.39.2"
|
|
37
39
|
},
|
|
38
40
|
"devDependencies": {
|
|
39
41
|
"eslint": "^9.39.5",
|
|
40
42
|
"react": "^19.3.1",
|
|
41
43
|
"typescript": "^6.0.3",
|
|
42
|
-
"vite": "^8.3.
|
|
43
|
-
"vitest": "^5.0
|
|
44
|
+
"vite": "^8.3.7",
|
|
45
|
+
"vitest": "^5.1.0"
|
|
44
46
|
},
|
|
45
47
|
"peerDependencies": {
|
|
46
48
|
"react": "^19"
|