@entifix/next-shell 0.17.0 → 0.18.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/lib/session/session-keepalive.d.ts +7 -1
- package/dist/lib/session/session-keepalive.d.ts.map +1 -1
- package/dist/lib/session/session-keepalive.js +2 -1
- package/dist/lib/session/session-keepalive.js.map +1 -1
- package/dist/lib/session/use-session-refresh.d.ts +19 -2
- package/dist/lib/session/use-session-refresh.d.ts.map +1 -1
- package/dist/lib/session/use-session-refresh.js +35 -13
- package/dist/lib/session/use-session-refresh.js.map +1 -1
- package/package.json +9 -9
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
export interface SessionKeepaliveProps {
|
|
2
2
|
/** Where this app mounts the shared refresh handler. */
|
|
3
3
|
readonly endpoint?: string;
|
|
4
|
+
/**
|
|
5
|
+
* Seconds left on the access token this page was rendered with, read on the
|
|
6
|
+
* server from its `exp`. Schedules the first refresh; every later one follows
|
|
7
|
+
* the `expiresIn` the refresh answers. See {@link useSessionRefresh}.
|
|
8
|
+
*/
|
|
9
|
+
readonly tokenExpiresInSeconds?: number;
|
|
4
10
|
/**
|
|
5
11
|
* What to do when the session is over. Defaults to reloading the page, which
|
|
6
12
|
* is almost always the right answer — see the note on {@link
|
|
@@ -46,5 +52,5 @@ export interface SessionKeepaliveProps {
|
|
|
46
52
|
* not an error; adding a semantic colour is a change to the token contract
|
|
47
53
|
* and does not belong in a session fix.
|
|
48
54
|
*/
|
|
49
|
-
export declare function SessionKeepalive({ endpoint, onExpired, }?: SessionKeepaliveProps): import("react").JSX.Element | null;
|
|
55
|
+
export declare function SessionKeepalive({ endpoint, tokenExpiresInSeconds, onExpired, }?: SessionKeepaliveProps): import("react").JSX.Element | null;
|
|
50
56
|
//# sourceMappingURL=session-keepalive.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-keepalive.d.ts","sourceRoot":"","sources":["../../../src/lib/session/session-keepalive.tsx"],"names":[],"mappings":"AAOA,MAAM,WAAW,qBAAqB;IACpC,wDAAwD;IACxD,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B;;;;OAIG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACjC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,QAAQ,EACR,SAAS,GACV,GAAE,qBAA0B,
|
|
1
|
+
{"version":3,"file":"session-keepalive.d.ts","sourceRoot":"","sources":["../../../src/lib/session/session-keepalive.tsx"],"names":[],"mappings":"AAOA,MAAM,WAAW,qBAAqB;IACpC,wDAAwD;IACxD,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B;;;;OAIG;IACH,QAAQ,CAAC,qBAAqB,CAAC,EAAE,MAAM,CAAC;IACxC;;;;OAIG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACjC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,QAAQ,EACR,qBAAqB,EACrB,SAAS,GACV,GAAE,qBAA0B,sCA8B5B"}
|
|
@@ -40,7 +40,7 @@ import { useSessionRefresh } from './use-session-refresh.js';
|
|
|
40
40
|
* ends in five minutes" would spend the one alarming colour on something that is
|
|
41
41
|
* not an error; adding a semantic colour is a change to the token contract
|
|
42
42
|
* and does not belong in a session fix.
|
|
43
|
-
*/ export function SessionKeepalive({ endpoint, onExpired } = {}) {
|
|
43
|
+
*/ export function SessionKeepalive({ endpoint, tokenExpiresInSeconds, onExpired } = {}) {
|
|
44
44
|
// A reload rather than a route change: middleware is what knows where a
|
|
45
45
|
// signed-out visitor goes, and `router.push` would keep the dead client-side
|
|
46
46
|
// tree around while it got there.
|
|
@@ -55,6 +55,7 @@ import { useSessionRefresh } from './use-session-refresh.js';
|
|
|
55
55
|
]);
|
|
56
56
|
const { expiringSoon, expired } = useSessionRefresh({
|
|
57
57
|
endpoint,
|
|
58
|
+
tokenExpiresInSeconds,
|
|
58
59
|
onExpired: expire
|
|
59
60
|
});
|
|
60
61
|
const t = useT('shell');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/session/session-keepalive.tsx"],"sourcesContent":["'use client';\n\nimport { useT } from '@entifix/react-controls';\nimport { useCallback } from 'react';\n\nimport { useSessionRefresh } from './use-session-refresh.js';\n\nexport interface SessionKeepaliveProps {\n /** Where this app mounts the shared refresh handler. */\n readonly endpoint?: string;\n /**\n * What to do when the session is over. Defaults to reloading the page, which\n * is almost always the right answer — see the note on {@link\n * SessionKeepalive}.\n */\n readonly onExpired?: () => void;\n}\n\n/**\n * Mounts {@link useSessionRefresh} and acts on what it reports.\n *\n * ⚠️ **This component is why the hook does anything at all.** The hook shipped\n * with its schedule, its idle gate, its countdown and a full spec, and was\n * referenced by nothing — no app, no shell, no layout. So no browser in the\n * fleet ever posted to `/api/auth/refresh`, and three separately reasonable\n * facts combined into a bug: the access token lives 15 minutes, both\n * cookies are sized to the seven-day session ceiling so that a cookie does not\n * sign everyone out every 15 minutes, and the middleware can only check that a\n * cookie is *present* because the edge cannot verify a signature. The visitor\n * was therefore admitted to pages that rendered fine while every call behind\n * them answered `401`.\n *\n * **Expiry reloads rather than routing anywhere**, and that is the smaller\n * change rather than the lazier one. By the time the hook reports `expired` the\n * refresh route has already cleared both cookies — a dead session clears them\n * instead of leaving the browser presenting a session id that will never\n * refresh again. A reload then meets the middleware with no cookie, and the\n * middleware redirects to sign-in with the right locale and the right\n * `redirect` parameter. Building that URL here would be a second copy of a rule\n * that already exists, and the two would drift the first time either changed.\n *\n * A form's unsaved work survives it, because a workspace draft is autosaved to\n * IndexedDB rather than held in the page.\n *\n * Renders nothing but a warning strip, and only inside the final window before\n * the ceiling. `role=\"status\"` rather than `role=\"alert\"`: the session ending\n * soon is a thing to notice, not an error to interrupt for, and an assertive\n * live region would talk over whatever the person is actually doing.\n *\n * Neutral surface tokens rather than a warning colour, because the contract has\n * no warning colour — it carries `danger` and its subtle and content pair, and\n * nothing between that and the neutrals. Borrowing `danger` for \"your session\n * ends in five minutes\" would spend the one alarming colour on something that is\n * not an error; adding a semantic colour is a change to the token contract\n * and does not belong in a session fix.\n */\nexport function SessionKeepalive({\n endpoint,\n onExpired,\n}: SessionKeepaliveProps = {}) {\n // A reload rather than a route change: middleware is what knows where a\n // signed-out visitor goes, and `router.push` would keep the dead client-side\n // tree around while it got there.\n const expire = useCallback(() => {\n if (onExpired) {\n onExpired();\n return;\n }\n window.location.reload();\n }, [onExpired]);\n\n const { expiringSoon, expired } = useSessionRefresh({\n endpoint,\n onExpired: expire,\n });\n const t = useT('shell');\n\n if (expired || !expiringSoon) return null;\n\n return (\n <div\n role=\"status\"\n data-testid=\"session-expiring\"\n className=\"border-b border-border bg-surface-elevated px-s py-2xs text-step-sm text-content\"\n >\n {t('session.expiringSoon')}\n </div>\n );\n}\n"],"names":["useT","useCallback","useSessionRefresh","SessionKeepalive","endpoint","onExpired","expire","window","location","reload","expiringSoon","expired","t","div","role","data-testid","className"],"mappings":"AAAA;;AAEA,SAASA,IAAI,QAAQ,0BAA0B;AAC/C,SAASC,WAAW,QAAQ,QAAQ;AAEpC,SAASC,iBAAiB,QAAQ,2BAA2B;
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/session/session-keepalive.tsx"],"sourcesContent":["'use client';\n\nimport { useT } from '@entifix/react-controls';\nimport { useCallback } from 'react';\n\nimport { useSessionRefresh } from './use-session-refresh.js';\n\nexport interface SessionKeepaliveProps {\n /** Where this app mounts the shared refresh handler. */\n readonly endpoint?: string;\n /**\n * Seconds left on the access token this page was rendered with, read on the\n * server from its `exp`. Schedules the first refresh; every later one follows\n * the `expiresIn` the refresh answers. See {@link useSessionRefresh}.\n */\n readonly tokenExpiresInSeconds?: number;\n /**\n * What to do when the session is over. Defaults to reloading the page, which\n * is almost always the right answer — see the note on {@link\n * SessionKeepalive}.\n */\n readonly onExpired?: () => void;\n}\n\n/**\n * Mounts {@link useSessionRefresh} and acts on what it reports.\n *\n * ⚠️ **This component is why the hook does anything at all.** The hook shipped\n * with its schedule, its idle gate, its countdown and a full spec, and was\n * referenced by nothing — no app, no shell, no layout. So no browser in the\n * fleet ever posted to `/api/auth/refresh`, and three separately reasonable\n * facts combined into a bug: the access token lives 15 minutes, both\n * cookies are sized to the seven-day session ceiling so that a cookie does not\n * sign everyone out every 15 minutes, and the middleware can only check that a\n * cookie is *present* because the edge cannot verify a signature. The visitor\n * was therefore admitted to pages that rendered fine while every call behind\n * them answered `401`.\n *\n * **Expiry reloads rather than routing anywhere**, and that is the smaller\n * change rather than the lazier one. By the time the hook reports `expired` the\n * refresh route has already cleared both cookies — a dead session clears them\n * instead of leaving the browser presenting a session id that will never\n * refresh again. A reload then meets the middleware with no cookie, and the\n * middleware redirects to sign-in with the right locale and the right\n * `redirect` parameter. Building that URL here would be a second copy of a rule\n * that already exists, and the two would drift the first time either changed.\n *\n * A form's unsaved work survives it, because a workspace draft is autosaved to\n * IndexedDB rather than held in the page.\n *\n * Renders nothing but a warning strip, and only inside the final window before\n * the ceiling. `role=\"status\"` rather than `role=\"alert\"`: the session ending\n * soon is a thing to notice, not an error to interrupt for, and an assertive\n * live region would talk over whatever the person is actually doing.\n *\n * Neutral surface tokens rather than a warning colour, because the contract has\n * no warning colour — it carries `danger` and its subtle and content pair, and\n * nothing between that and the neutrals. Borrowing `danger` for \"your session\n * ends in five minutes\" would spend the one alarming colour on something that is\n * not an error; adding a semantic colour is a change to the token contract\n * and does not belong in a session fix.\n */\nexport function SessionKeepalive({\n endpoint,\n tokenExpiresInSeconds,\n onExpired,\n}: SessionKeepaliveProps = {}) {\n // A reload rather than a route change: middleware is what knows where a\n // signed-out visitor goes, and `router.push` would keep the dead client-side\n // tree around while it got there.\n const expire = useCallback(() => {\n if (onExpired) {\n onExpired();\n return;\n }\n window.location.reload();\n }, [onExpired]);\n\n const { expiringSoon, expired } = useSessionRefresh({\n endpoint,\n tokenExpiresInSeconds,\n onExpired: expire,\n });\n const t = useT('shell');\n\n if (expired || !expiringSoon) return null;\n\n return (\n <div\n role=\"status\"\n data-testid=\"session-expiring\"\n className=\"border-b border-border bg-surface-elevated px-s py-2xs text-step-sm text-content\"\n >\n {t('session.expiringSoon')}\n </div>\n );\n}\n"],"names":["useT","useCallback","useSessionRefresh","SessionKeepalive","endpoint","tokenExpiresInSeconds","onExpired","expire","window","location","reload","expiringSoon","expired","t","div","role","data-testid","className"],"mappings":"AAAA;;AAEA,SAASA,IAAI,QAAQ,0BAA0B;AAC/C,SAASC,WAAW,QAAQ,QAAQ;AAEpC,SAASC,iBAAiB,QAAQ,2BAA2B;AAmB7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqCC,GACD,OAAO,SAASC,iBAAiB,EAC/BC,QAAQ,EACRC,qBAAqB,EACrBC,SAAS,EACa,GAAG,CAAC,CAAC;IAC3B,wEAAwE;IACxE,6EAA6E;IAC7E,kCAAkC;IAClC,MAAMC,SAASN,YAAY;QACzB,IAAIK,WAAW;YACbA;YACA;QACF;QACAE,OAAOC,QAAQ,CAACC,MAAM;IACxB,GAAG;QAACJ;KAAU;IAEd,MAAM,EAAEK,YAAY,EAAEC,OAAO,EAAE,GAAGV,kBAAkB;QAClDE;QACAC;QACAC,WAAWC;IACb;IACA,MAAMM,IAAIb,KAAK;IAEf,IAAIY,WAAW,CAACD,cAAc,OAAO;IAErC,qBACE,KAACG;QACCC,MAAK;QACLC,eAAY;QACZC,WAAU;kBAETJ,EAAE;;AAGT"}
|
|
@@ -1,8 +1,25 @@
|
|
|
1
1
|
export interface UseSessionRefreshOptions {
|
|
2
2
|
/** Where this app mounts the shared refresh handler. */
|
|
3
3
|
readonly endpoint?: string;
|
|
4
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* Access-token lifetime in seconds, assumed until the server says otherwise.
|
|
6
|
+
*
|
|
7
|
+
* Only a fallback: every refresh answers the `expiresIn` of the token it just
|
|
8
|
+
* minted, and the next refresh is scheduled from that. A server whose token
|
|
9
|
+
* lifetime is a configuration value would otherwise be refreshed on this
|
|
10
|
+
* number, and a token shorter than it would lapse between two refreshes.
|
|
11
|
+
*/
|
|
5
12
|
readonly tokenTtlSeconds?: number;
|
|
13
|
+
/**
|
|
14
|
+
* Seconds left on the token the page was rendered with, when the host knows
|
|
15
|
+
* it — read on the server from the token's `exp`.
|
|
16
|
+
*
|
|
17
|
+
* Schedules the **first** refresh. Without it the first one waits for a full
|
|
18
|
+
* `tokenTtlSeconds` lead, which is late for a page loaded on a token already
|
|
19
|
+
* part-way through its life, and later still for a token shorter than the
|
|
20
|
+
* fallback.
|
|
21
|
+
*/
|
|
22
|
+
readonly tokenExpiresInSeconds?: number;
|
|
6
23
|
/**
|
|
7
24
|
* How long without interaction before the timer stops asking.
|
|
8
25
|
*
|
|
@@ -29,7 +46,7 @@ export interface SessionRefreshState {
|
|
|
29
46
|
/**
|
|
30
47
|
* Keeps the access-token cookie fresh while someone is actually using the app.
|
|
31
48
|
*
|
|
32
|
-
* The refresh runs
|
|
49
|
+
* The refresh runs at 80% of the current token's life, but **only while the
|
|
33
50
|
* user has interacted recently**. That condition is the whole point: the server
|
|
34
51
|
* slides the session on refresh, so a timer that fired unconditionally would
|
|
35
52
|
* keep a forgotten tab's session alive forever and "idle timeout" would measure
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-session-refresh.d.ts","sourceRoot":"","sources":["../../../src/lib/session/use-session-refresh.ts"],"names":[],"mappings":"AA8BA,MAAM,WAAW,wBAAwB;IACvC,wDAAwD;IACxD,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B
|
|
1
|
+
{"version":3,"file":"use-session-refresh.d.ts","sourceRoot":"","sources":["../../../src/lib/session/use-session-refresh.ts"],"names":[],"mappings":"AA8BA,MAAM,WAAW,wBAAwB;IACvC,wDAAwD;IACxD,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B;;;;;;;OAOG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAClC;;;;;;;;OAQG;IACH,QAAQ,CAAC,qBAAqB,CAAC,EAAE,MAAM,CAAC;IACxC;;;;;;OAMG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAClC,sEAAsE;IACtE,QAAQ,CAAC,oBAAoB,CAAC,EAAE,MAAM,CAAC;IACvC,wDAAwD;IACxD,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IACnC,yEAAyE;IACzE,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACjC;AAED,MAAM,WAAW,mBAAmB;IAClC,sEAAsE;IACtE,QAAQ,CAAC,gBAAgB,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9C,yEAAyE;IACzE,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;IAC/B,8DAA8D;IAC9D,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,GAAE,wBAA6B,GACrC,mBAAmB,CAgIrB"}
|
|
@@ -25,7 +25,7 @@ const DEFAULT_REFRESH_LEAD_RATIO = 0.8;
|
|
|
25
25
|
/**
|
|
26
26
|
* Keeps the access-token cookie fresh while someone is actually using the app.
|
|
27
27
|
*
|
|
28
|
-
* The refresh runs
|
|
28
|
+
* The refresh runs at 80% of the current token's life, but **only while the
|
|
29
29
|
* user has interacted recently**. That condition is the whole point: the server
|
|
30
30
|
* slides the session on refresh, so a timer that fired unconditionally would
|
|
31
31
|
* keep a forgotten tab's session alive forever and "idle timeout" would measure
|
|
@@ -35,7 +35,7 @@ const DEFAULT_REFRESH_LEAD_RATIO = 0.8;
|
|
|
35
35
|
* The token itself is never visible here — it lives in an httpOnly cookie, and
|
|
36
36
|
* the endpoint below rewrites it server-side.
|
|
37
37
|
*/ export function useSessionRefresh(options = {}) {
|
|
38
|
-
const { endpoint = '/api/auth/refresh', tokenTtlSeconds = DEFAULT_TOKEN_TTL_SECONDS, idleStopSeconds = DEFAULT_IDLE_STOP_SECONDS, expiryWarningSeconds = DEFAULT_EXPIRY_WARNING_SECONDS, refreshLeadRatio = DEFAULT_REFRESH_LEAD_RATIO, onExpired } = options;
|
|
38
|
+
const { endpoint = '/api/auth/refresh', tokenTtlSeconds = DEFAULT_TOKEN_TTL_SECONDS, tokenExpiresInSeconds, idleStopSeconds = DEFAULT_IDLE_STOP_SECONDS, expiryWarningSeconds = DEFAULT_EXPIRY_WARNING_SECONDS, refreshLeadRatio = DEFAULT_REFRESH_LEAD_RATIO, onExpired } = options;
|
|
39
39
|
const [sessionExpiresIn, setSessionExpiresIn] = useState(undefined);
|
|
40
40
|
const [expired, setExpired] = useState(false);
|
|
41
41
|
// Seeded on mount rather than at construction: reading the clock during
|
|
@@ -72,42 +72,64 @@ const DEFAULT_REFRESH_LEAD_RATIO = 0.8;
|
|
|
72
72
|
]);
|
|
73
73
|
useEffect(()=>{
|
|
74
74
|
if (expired) return undefined;
|
|
75
|
-
const
|
|
75
|
+
/** When to ask, for a token that has `seconds` left. Never sooner than 1s. */ const leadMs = (seconds)=>Math.max(1, Math.floor(seconds * refreshLeadRatio)) * 1000;
|
|
76
76
|
let cancelled = false;
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
let timer;
|
|
78
|
+
const schedule = (ms)=>{
|
|
79
|
+
timer = setTimeout(()=>{
|
|
80
|
+
void tick();
|
|
81
|
+
}, ms);
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* One refresh, answering when the next one is due.
|
|
85
|
+
*
|
|
86
|
+
* ⚠️ **The delay comes from the token the server just minted**, not from
|
|
87
|
+
* a period fixed at mount. A fixed interval held the fallback lifetime
|
|
88
|
+
* for the life of the tab, so a server minting shorter tokens saw every
|
|
89
|
+
* one of them lapse before the browser asked again.
|
|
90
|
+
*/ const attempt = async ()=>{
|
|
79
91
|
const idleFor = (Date.now() - lastActivity.current) / 1000;
|
|
80
92
|
// Nobody is here. Skipping the refresh is what lets the session lapse.
|
|
81
|
-
if (idleFor > idleStopSeconds) return;
|
|
93
|
+
if (idleFor > idleStopSeconds) return leadMs(tokenTtlSeconds);
|
|
82
94
|
try {
|
|
83
95
|
const response = await fetch(endpoint, {
|
|
84
96
|
method: 'POST',
|
|
85
97
|
cache: 'no-store'
|
|
86
98
|
});
|
|
87
|
-
if (cancelled) return;
|
|
99
|
+
if (cancelled) return 0;
|
|
88
100
|
if (response.status === 401) {
|
|
89
101
|
expiredRef.current = true;
|
|
90
102
|
setExpired(true);
|
|
91
103
|
onExpiredRef.current == null ? void 0 : onExpiredRef.current.call(onExpiredRef);
|
|
92
|
-
return;
|
|
104
|
+
return 0;
|
|
93
105
|
}
|
|
94
|
-
|
|
106
|
+
// transient (503) — try again after a fallback lead
|
|
107
|
+
if (!response.ok) return leadMs(tokenTtlSeconds);
|
|
95
108
|
const body = await response.json();
|
|
96
|
-
if (
|
|
109
|
+
if (cancelled) return 0;
|
|
110
|
+
if (typeof body.sessionExpiresIn === 'number') {
|
|
97
111
|
setSessionExpiresIn(body.sessionExpiresIn);
|
|
98
112
|
}
|
|
113
|
+
return typeof body.expiresIn === 'number' && body.expiresIn > 0 ? leadMs(body.expiresIn) : leadMs(tokenTtlSeconds);
|
|
99
114
|
} catch (unused) {
|
|
100
|
-
|
|
115
|
+
// Offline or a dropped request: keep the schedule and retry.
|
|
116
|
+
return leadMs(tokenTtlSeconds);
|
|
101
117
|
}
|
|
102
118
|
};
|
|
103
|
-
const
|
|
119
|
+
const tick = async ()=>{
|
|
120
|
+
const next = await attempt();
|
|
121
|
+
if (cancelled || expiredRef.current) return;
|
|
122
|
+
schedule(next);
|
|
123
|
+
};
|
|
124
|
+
schedule(leadMs(tokenExpiresInSeconds != null ? tokenExpiresInSeconds : tokenTtlSeconds));
|
|
104
125
|
return ()=>{
|
|
105
126
|
cancelled = true;
|
|
106
|
-
|
|
127
|
+
clearTimeout(timer);
|
|
107
128
|
};
|
|
108
129
|
}, [
|
|
109
130
|
endpoint,
|
|
110
131
|
tokenTtlSeconds,
|
|
132
|
+
tokenExpiresInSeconds,
|
|
111
133
|
expired
|
|
112
134
|
]);
|
|
113
135
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/session/use-session-refresh.ts"],"sourcesContent":["'use client';\n\nimport { useCallback, useEffect, useRef, useState } from 'react';\n\n/** Browser events that count as a person being present. */\nconst ACTIVITY_EVENTS = [\n 'pointerdown',\n 'keydown',\n 'scroll',\n 'visibilitychange',\n] as const;\n\n/**\n * Session timing, as this shell assumes it when a host says nothing.\n *\n * ⚠️ **Defaults, not policy.** These four used to be imported from the\n * application's own session package, which made a framework hook carry one\n * product's security decisions — and meant a second application could not use\n * the hook at all without adopting the first one's token lifetime. A host that has a\n * session policy passes it in; a host that has not yet thought about it gets\n * numbers that are defensible rather than absent.\n *\n * The server is still the authority. These only decide when the browser *asks*;\n * the refresh endpoint decides whether the session actually slides.\n */\nconst DEFAULT_TOKEN_TTL_SECONDS = 60 * 15;\nconst DEFAULT_IDLE_STOP_SECONDS = 60 * 15;\nconst DEFAULT_EXPIRY_WARNING_SECONDS = 60 * 5;\nconst DEFAULT_REFRESH_LEAD_RATIO = 0.8;\n\nexport interface UseSessionRefreshOptions {\n /** Where this app mounts the shared refresh handler. */\n readonly endpoint?: string;\n /** Access-token lifetime in seconds; the schedule derives from it. */\n readonly tokenTtlSeconds?: number;\n /**\n * How long without interaction before the timer stops asking.\n *\n * This is what makes \"idle timeout\" measure whether a person is there rather\n * than whether a tab is open, so a host raising it is choosing to keep\n * forgotten tabs alive.\n */\n readonly idleStopSeconds?: number;\n /** How long before the absolute ceiling `expiringSoon` turns true. */\n readonly expiryWarningSeconds?: number;\n /** Fraction of the token's life at which to refresh. */\n readonly refreshLeadRatio?: number;\n /** Called when the session is gone and the user has to sign in again. */\n readonly onExpired?: () => void;\n}\n\nexport interface SessionRefreshState {\n /** Seconds left before the session's absolute ceiling, once known. */\n readonly sessionExpiresIn: number | undefined;\n /** True inside the final window before the ceiling — prompt the user. */\n readonly expiringSoon: boolean;\n /** True once a refresh has failed and the session is over. */\n readonly expired: boolean;\n}\n\n/**\n * Keeps the access-token cookie fresh while someone is actually using the app.\n *\n * The refresh runs on a timer at 80% of the token's life, but **only while the\n * user has interacted recently**. That condition is the whole point: the server\n * slides the session on refresh, so a timer that fired unconditionally would\n * keep a forgotten tab's session alive forever and \"idle timeout\" would measure\n * whether a tab is open rather than whether a person is there. Going quiet lets\n * the token lapse and the session age out on schedule.\n *\n * The token itself is never visible here — it lives in an httpOnly cookie, and\n * the endpoint below rewrites it server-side.\n */\nexport function useSessionRefresh(\n options: UseSessionRefreshOptions = {},\n): SessionRefreshState {\n const {\n endpoint = '/api/auth/refresh',\n tokenTtlSeconds = DEFAULT_TOKEN_TTL_SECONDS,\n idleStopSeconds = DEFAULT_IDLE_STOP_SECONDS,\n expiryWarningSeconds = DEFAULT_EXPIRY_WARNING_SECONDS,\n refreshLeadRatio = DEFAULT_REFRESH_LEAD_RATIO,\n onExpired,\n } = options;\n\n const [sessionExpiresIn, setSessionExpiresIn] = useState<number | undefined>(\n undefined,\n );\n const [expired, setExpired] = useState(false);\n // Seeded on mount rather than at construction: reading the clock during\n // render is impure, and the value is only ever consumed from an effect.\n const lastActivity = useRef(0);\n const onExpiredRef = useRef(onExpired);\n /**\n * Mirrors `expired` synchronously. The state update only tears the interval\n * down on the next render, so without this a burst of ticks fires — and\n * `onExpired` runs — several times over for one dead session.\n */\n const expiredRef = useRef(false);\n\n useEffect(() => {\n onExpiredRef.current = onExpired;\n }, [onExpired]);\n\n const markActive = useCallback(() => {\n lastActivity.current = Date.now();\n }, []);\n\n useEffect(() => {\n markActive();\n for (const event of ACTIVITY_EVENTS) {\n window.addEventListener(event, markActive, { passive: true });\n }\n return () => {\n for (const event of ACTIVITY_EVENTS) {\n window.removeEventListener(event, markActive);\n }\n };\n }, [markActive]);\n\n useEffect(() => {\n if (expired) return undefined;\n\n const periodMs =\n Math.max(1, Math.floor(tokenTtlSeconds * refreshLeadRatio)) * 1000;\n let cancelled = false;\n\n const tick = async () => {\n if (expiredRef.current) return;\n\n const idleFor = (Date.now() - lastActivity.current) / 1000;\n // Nobody is here. Skipping the refresh is what lets the session lapse.\n if (idleFor > idleStopSeconds) return;\n\n try {\n const response = await fetch(endpoint, {\n method: 'POST',\n cache: 'no-store',\n });\n if (cancelled) return;\n\n if (response.status === 401) {\n expiredRef.current = true;\n setExpired(true);\n onExpiredRef.current?.();\n return;\n }\n if (!response.ok) return; // transient (503) — try again next tick\n\n const body = (await response.json()) as { sessionExpiresIn?: number };\n if (!cancelled && typeof body.sessionExpiresIn === 'number') {\n setSessionExpiresIn(body.sessionExpiresIn);\n }\n } catch {\n // Offline or a dropped request: keep the schedule and retry.\n }\n };\n\n const timer = setInterval(tick, periodMs);\n return () => {\n cancelled = true;\n clearInterval(timer);\n };\n }, [endpoint, tokenTtlSeconds, expired]);\n\n return {\n sessionExpiresIn,\n expiringSoon:\n sessionExpiresIn !== undefined &&\n sessionExpiresIn <= expiryWarningSeconds,\n expired,\n };\n}\n"],"names":["useCallback","useEffect","useRef","useState","ACTIVITY_EVENTS","DEFAULT_TOKEN_TTL_SECONDS","DEFAULT_IDLE_STOP_SECONDS","DEFAULT_EXPIRY_WARNING_SECONDS","DEFAULT_REFRESH_LEAD_RATIO","useSessionRefresh","options","endpoint","tokenTtlSeconds","idleStopSeconds","expiryWarningSeconds","refreshLeadRatio","onExpired","sessionExpiresIn","setSessionExpiresIn","undefined","expired","setExpired","lastActivity","onExpiredRef","expiredRef","current","markActive","Date","now","event","window","addEventListener","passive","removeEventListener","periodMs","Math","max","floor","cancelled","tick","idleFor","response","fetch","method","cache","status","ok","body","json","timer","setInterval","clearInterval","expiringSoon"],"mappings":"AAAA;AAEA,SAASA,WAAW,EAAEC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAQ;AAEjE,yDAAyD,GACzD,MAAMC,kBAAkB;IACtB;IACA;IACA;IACA;CACD;AAED;;;;;;;;;;;;CAYC,GACD,MAAMC,4BAA4B,KAAK;AACvC,MAAMC,4BAA4B,KAAK;AACvC,MAAMC,iCAAiC,KAAK;AAC5C,MAAMC,6BAA6B;AAgCnC;;;;;;;;;;;;CAYC,GACD,OAAO,SAASC,kBACdC,UAAoC,CAAC,CAAC;IAEtC,MAAM,EACJC,WAAW,mBAAmB,EAC9BC,kBAAkBP,yBAAyB,EAC3CQ,kBAAkBP,yBAAyB,EAC3CQ,uBAAuBP,8BAA8B,EACrDQ,mBAAmBP,0BAA0B,EAC7CQ,SAAS,EACV,GAAGN;IAEJ,MAAM,CAACO,kBAAkBC,oBAAoB,GAAGf,SAC9CgB;IAEF,MAAM,CAACC,SAASC,WAAW,GAAGlB,SAAS;IACvC,wEAAwE;IACxE,wEAAwE;IACxE,MAAMmB,eAAepB,OAAO;IAC5B,MAAMqB,eAAerB,OAAOc;IAC5B;;;;GAIC,GACD,MAAMQ,aAAatB,OAAO;IAE1BD,UAAU;QACRsB,aAAaE,OAAO,GAAGT;IACzB,GAAG;QAACA;KAAU;IAEd,MAAMU,aAAa1B,YAAY;QAC7BsB,aAAaG,OAAO,GAAGE,KAAKC,GAAG;IACjC,GAAG,EAAE;IAEL3B,UAAU;QACRyB;QACA,KAAK,MAAMG,SAASzB,gBAAiB;YACnC0B,OAAOC,gBAAgB,CAACF,OAAOH,YAAY;gBAAEM,SAAS;YAAK;QAC7D;QACA,OAAO;YACL,KAAK,MAAMH,SAASzB,gBAAiB;gBACnC0B,OAAOG,mBAAmB,CAACJ,OAAOH;YACpC;QACF;IACF,GAAG;QAACA;KAAW;IAEfzB,UAAU;QACR,IAAImB,SAAS,OAAOD;QAEpB,MAAMe,WACJC,KAAKC,GAAG,CAAC,GAAGD,KAAKE,KAAK,CAACzB,kBAAkBG,qBAAqB;QAChE,IAAIuB,YAAY;QAEhB,MAAMC,OAAO;YACX,IAAIf,WAAWC,OAAO,EAAE;YAExB,MAAMe,UAAU,AAACb,CAAAA,KAAKC,GAAG,KAAKN,aAAaG,OAAO,AAAD,IAAK;YACtD,uEAAuE;YACvE,IAAIe,UAAU3B,iBAAiB;YAE/B,IAAI;gBACF,MAAM4B,WAAW,MAAMC,MAAM/B,UAAU;oBACrCgC,QAAQ;oBACRC,OAAO;gBACT;gBACA,IAAIN,WAAW;gBAEf,IAAIG,SAASI,MAAM,KAAK,KAAK;oBAC3BrB,WAAWC,OAAO,GAAG;oBACrBJ,WAAW;oBACXE,aAAaE,OAAO,oBAApBF,aAAaE,OAAO,MAApBF;oBACA;gBACF;gBACA,IAAI,CAACkB,SAASK,EAAE,EAAE,QAAQ,wCAAwC;gBAElE,MAAMC,OAAQ,MAAMN,SAASO,IAAI;gBACjC,IAAI,CAACV,aAAa,OAAOS,KAAK9B,gBAAgB,KAAK,UAAU;oBAC3DC,oBAAoB6B,KAAK9B,gBAAgB;gBAC3C;YACF,EAAE,eAAM;YACN,6DAA6D;YAC/D;QACF;QAEA,MAAMgC,QAAQC,YAAYX,MAAML;QAChC,OAAO;YACLI,YAAY;YACZa,cAAcF;QAChB;IACF,GAAG;QAACtC;QAAUC;QAAiBQ;KAAQ;IAEvC,OAAO;QACLH;QACAmC,cACEnC,qBAAqBE,aACrBF,oBAAoBH;QACtBM;IACF;AACF"}
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/session/use-session-refresh.ts"],"sourcesContent":["'use client';\n\nimport { useCallback, useEffect, useRef, useState } from 'react';\n\n/** Browser events that count as a person being present. */\nconst ACTIVITY_EVENTS = [\n 'pointerdown',\n 'keydown',\n 'scroll',\n 'visibilitychange',\n] as const;\n\n/**\n * Session timing, as this shell assumes it when a host says nothing.\n *\n * ⚠️ **Defaults, not policy.** These four used to be imported from the\n * application's own session package, which made a framework hook carry one\n * product's security decisions — and meant a second application could not use\n * the hook at all without adopting the first one's token lifetime. A host that has a\n * session policy passes it in; a host that has not yet thought about it gets\n * numbers that are defensible rather than absent.\n *\n * The server is still the authority. These only decide when the browser *asks*;\n * the refresh endpoint decides whether the session actually slides.\n */\nconst DEFAULT_TOKEN_TTL_SECONDS = 60 * 15;\nconst DEFAULT_IDLE_STOP_SECONDS = 60 * 15;\nconst DEFAULT_EXPIRY_WARNING_SECONDS = 60 * 5;\nconst DEFAULT_REFRESH_LEAD_RATIO = 0.8;\n\nexport interface UseSessionRefreshOptions {\n /** Where this app mounts the shared refresh handler. */\n readonly endpoint?: string;\n /**\n * Access-token lifetime in seconds, assumed until the server says otherwise.\n *\n * Only a fallback: every refresh answers the `expiresIn` of the token it just\n * minted, and the next refresh is scheduled from that. A server whose token\n * lifetime is a configuration value would otherwise be refreshed on this\n * number, and a token shorter than it would lapse between two refreshes.\n */\n readonly tokenTtlSeconds?: number;\n /**\n * Seconds left on the token the page was rendered with, when the host knows\n * it — read on the server from the token's `exp`.\n *\n * Schedules the **first** refresh. Without it the first one waits for a full\n * `tokenTtlSeconds` lead, which is late for a page loaded on a token already\n * part-way through its life, and later still for a token shorter than the\n * fallback.\n */\n readonly tokenExpiresInSeconds?: number;\n /**\n * How long without interaction before the timer stops asking.\n *\n * This is what makes \"idle timeout\" measure whether a person is there rather\n * than whether a tab is open, so a host raising it is choosing to keep\n * forgotten tabs alive.\n */\n readonly idleStopSeconds?: number;\n /** How long before the absolute ceiling `expiringSoon` turns true. */\n readonly expiryWarningSeconds?: number;\n /** Fraction of the token's life at which to refresh. */\n readonly refreshLeadRatio?: number;\n /** Called when the session is gone and the user has to sign in again. */\n readonly onExpired?: () => void;\n}\n\nexport interface SessionRefreshState {\n /** Seconds left before the session's absolute ceiling, once known. */\n readonly sessionExpiresIn: number | undefined;\n /** True inside the final window before the ceiling — prompt the user. */\n readonly expiringSoon: boolean;\n /** True once a refresh has failed and the session is over. */\n readonly expired: boolean;\n}\n\n/**\n * Keeps the access-token cookie fresh while someone is actually using the app.\n *\n * The refresh runs at 80% of the current token's life, but **only while the\n * user has interacted recently**. That condition is the whole point: the server\n * slides the session on refresh, so a timer that fired unconditionally would\n * keep a forgotten tab's session alive forever and \"idle timeout\" would measure\n * whether a tab is open rather than whether a person is there. Going quiet lets\n * the token lapse and the session age out on schedule.\n *\n * The token itself is never visible here — it lives in an httpOnly cookie, and\n * the endpoint below rewrites it server-side.\n */\nexport function useSessionRefresh(\n options: UseSessionRefreshOptions = {},\n): SessionRefreshState {\n const {\n endpoint = '/api/auth/refresh',\n tokenTtlSeconds = DEFAULT_TOKEN_TTL_SECONDS,\n tokenExpiresInSeconds,\n idleStopSeconds = DEFAULT_IDLE_STOP_SECONDS,\n expiryWarningSeconds = DEFAULT_EXPIRY_WARNING_SECONDS,\n refreshLeadRatio = DEFAULT_REFRESH_LEAD_RATIO,\n onExpired,\n } = options;\n\n const [sessionExpiresIn, setSessionExpiresIn] = useState<number | undefined>(\n undefined,\n );\n const [expired, setExpired] = useState(false);\n // Seeded on mount rather than at construction: reading the clock during\n // render is impure, and the value is only ever consumed from an effect.\n const lastActivity = useRef(0);\n const onExpiredRef = useRef(onExpired);\n /**\n * Mirrors `expired` synchronously. The state update only tears the interval\n * down on the next render, so without this a burst of ticks fires — and\n * `onExpired` runs — several times over for one dead session.\n */\n const expiredRef = useRef(false);\n\n useEffect(() => {\n onExpiredRef.current = onExpired;\n }, [onExpired]);\n\n const markActive = useCallback(() => {\n lastActivity.current = Date.now();\n }, []);\n\n useEffect(() => {\n markActive();\n for (const event of ACTIVITY_EVENTS) {\n window.addEventListener(event, markActive, { passive: true });\n }\n return () => {\n for (const event of ACTIVITY_EVENTS) {\n window.removeEventListener(event, markActive);\n }\n };\n }, [markActive]);\n\n useEffect(() => {\n if (expired) return undefined;\n\n /** When to ask, for a token that has `seconds` left. Never sooner than 1s. */\n const leadMs = (seconds: number) =>\n Math.max(1, Math.floor(seconds * refreshLeadRatio)) * 1000;\n\n let cancelled = false;\n let timer: ReturnType<typeof setTimeout> | undefined;\n\n const schedule = (ms: number) => {\n timer = setTimeout(() => {\n void tick();\n }, ms);\n };\n\n /**\n * One refresh, answering when the next one is due.\n *\n * ⚠️ **The delay comes from the token the server just minted**, not from\n * a period fixed at mount. A fixed interval held the fallback lifetime\n * for the life of the tab, so a server minting shorter tokens saw every\n * one of them lapse before the browser asked again.\n */\n const attempt = async (): Promise<number> => {\n const idleFor = (Date.now() - lastActivity.current) / 1000;\n // Nobody is here. Skipping the refresh is what lets the session lapse.\n if (idleFor > idleStopSeconds) return leadMs(tokenTtlSeconds);\n\n try {\n const response = await fetch(endpoint, {\n method: 'POST',\n cache: 'no-store',\n });\n if (cancelled) return 0;\n\n if (response.status === 401) {\n expiredRef.current = true;\n setExpired(true);\n onExpiredRef.current?.();\n return 0;\n }\n // transient (503) — try again after a fallback lead\n if (!response.ok) return leadMs(tokenTtlSeconds);\n\n const body = (await response.json()) as {\n expiresIn?: unknown;\n sessionExpiresIn?: unknown;\n };\n if (cancelled) return 0;\n if (typeof body.sessionExpiresIn === 'number') {\n setSessionExpiresIn(body.sessionExpiresIn);\n }\n return typeof body.expiresIn === 'number' && body.expiresIn > 0\n ? leadMs(body.expiresIn)\n : leadMs(tokenTtlSeconds);\n } catch {\n // Offline or a dropped request: keep the schedule and retry.\n return leadMs(tokenTtlSeconds);\n }\n };\n\n const tick = async () => {\n const next = await attempt();\n if (cancelled || expiredRef.current) return;\n schedule(next);\n };\n\n schedule(leadMs(tokenExpiresInSeconds ?? tokenTtlSeconds));\n return () => {\n cancelled = true;\n clearTimeout(timer);\n };\n }, [endpoint, tokenTtlSeconds, tokenExpiresInSeconds, expired]);\n\n return {\n sessionExpiresIn,\n expiringSoon:\n sessionExpiresIn !== undefined &&\n sessionExpiresIn <= expiryWarningSeconds,\n expired,\n };\n}\n"],"names":["useCallback","useEffect","useRef","useState","ACTIVITY_EVENTS","DEFAULT_TOKEN_TTL_SECONDS","DEFAULT_IDLE_STOP_SECONDS","DEFAULT_EXPIRY_WARNING_SECONDS","DEFAULT_REFRESH_LEAD_RATIO","useSessionRefresh","options","endpoint","tokenTtlSeconds","tokenExpiresInSeconds","idleStopSeconds","expiryWarningSeconds","refreshLeadRatio","onExpired","sessionExpiresIn","setSessionExpiresIn","undefined","expired","setExpired","lastActivity","onExpiredRef","expiredRef","current","markActive","Date","now","event","window","addEventListener","passive","removeEventListener","leadMs","seconds","Math","max","floor","cancelled","timer","schedule","ms","setTimeout","tick","attempt","idleFor","response","fetch","method","cache","status","ok","body","json","expiresIn","next","clearTimeout","expiringSoon"],"mappings":"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"}
|
package/package.json
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
|
-
"version": "0.
|
|
24
|
+
"version": "0.18.1",
|
|
25
25
|
"description": "Next.js application shell: back-office chrome, workspace tabs, CRUD screens derived from entity metadata, and session and proxy routes.",
|
|
26
26
|
"license": "MIT",
|
|
27
27
|
"repository": {
|
|
@@ -57,17 +57,17 @@
|
|
|
57
57
|
"react": "19.3.1",
|
|
58
58
|
"react-dom": "19.3.1",
|
|
59
59
|
"zustand": "^5.0.16",
|
|
60
|
-
"@entifix/testing-unit": "0.
|
|
60
|
+
"@entifix/testing-unit": "0.18.1"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
63
|
"idb": "^8.0.4",
|
|
64
|
-
"@entifix/
|
|
65
|
-
"@entifix/
|
|
66
|
-
"@entifix/core": "0.
|
|
67
|
-
"@entifix/
|
|
68
|
-
"@entifix/
|
|
69
|
-
"@entifix/react-integration": "0.
|
|
70
|
-
"@entifix/transactions": "0.
|
|
64
|
+
"@entifix/authz": "0.18.1",
|
|
65
|
+
"@entifix/business": "0.18.1",
|
|
66
|
+
"@entifix/core": "0.18.1",
|
|
67
|
+
"@entifix/i18n": "0.18.1",
|
|
68
|
+
"@entifix/react-controls": "0.18.1",
|
|
69
|
+
"@entifix/react-integration": "0.18.1",
|
|
70
|
+
"@entifix/transactions": "0.18.1"
|
|
71
71
|
},
|
|
72
72
|
"files": [
|
|
73
73
|
"dist",
|