@genesislcap/foundation-comms 15.50.1 → 15.50.3-holiday-picker.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sessionRefresh.d.ts","sourceRoot":"","sources":["../../../src/connect/sessionRefresh.ts"],"names":[],"mappings":"AAQA;;;GAGG;AACH,oBAAY,oBAAoB;IAC9B,yCAAyC;IACzC,OAAO,YAAY;IACnB,wCAAwC;IACxC,MAAM,WAAW;IACjB,0CAA0C;IAC1C,oBAAoB,yBAAyB;IAC7C,gCAAgC;IAChC,aAAa,kBAAkB;CAChC;
|
|
1
|
+
{"version":3,"file":"sessionRefresh.d.ts","sourceRoot":"","sources":["../../../src/connect/sessionRefresh.ts"],"names":[],"mappings":"AAQA;;;GAGG;AACH,eAAO,MAAM,sBAAsB,QAAS,CAAC;AAE7C;;;GAGG;AACH,oBAAY,oBAAoB;IAC9B,yCAAyC;IACzC,OAAO,YAAY;IACnB,wCAAwC;IACxC,MAAM,WAAW;IACjB,0CAA0C;IAC1C,oBAAoB,yBAAyB;IAC7C,gCAAgC;IAChC,aAAa,kBAAkB;CAChC;AAiED;;;;;;;;;GASG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,GAAE;IAAE,eAAe,CAAC,EAAE,OAAO,CAAA;CAAO,GAC1C,OAAO,CAAC,oBAAoB,CAAC,CA+B/B;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CASzE"}
|
|
@@ -3,7 +3,12 @@ import { LOGIN_DETAILS_URL, LOGIN_URL } from '@genesislcap/foundation-utils';
|
|
|
3
3
|
import { DI } from '@genesislcap/web-core';
|
|
4
4
|
import { Http } from './http';
|
|
5
5
|
const REAUTH_ACTION_LOCK_KEY = 'reauthActionLock';
|
|
6
|
-
const
|
|
6
|
+
const HTTP_STATUS_UNAUTHORIZED = 401;
|
|
7
|
+
/**
|
|
8
|
+
* How long a reauth lock is honoured before {@link tryRefreshSession} treats it as abandoned and clears it.
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
export const REAUTH_LOCK_TIMEOUT_MS = 30000;
|
|
7
12
|
/**
|
|
8
13
|
* Result of a session refresh attempt.
|
|
9
14
|
* @public
|
|
@@ -25,7 +30,7 @@ export var SessionRefreshResult;
|
|
|
25
30
|
*/
|
|
26
31
|
function clearStaleLock() {
|
|
27
32
|
const lockTimestamp = parseInt(localStorage.getItem(REAUTH_ACTION_LOCK_KEY) || '0');
|
|
28
|
-
if (Date.now() - lockTimestamp >
|
|
33
|
+
if (Date.now() - lockTimestamp > REAUTH_LOCK_TIMEOUT_MS) {
|
|
29
34
|
localStorage.removeItem(REAUTH_ACTION_LOCK_KEY);
|
|
30
35
|
}
|
|
31
36
|
}
|
|
@@ -55,6 +60,10 @@ function releaseLock() {
|
|
|
55
60
|
function isAuthenticated() {
|
|
56
61
|
return __awaiter(this, void 0, void 0, function* () {
|
|
57
62
|
const loginDetailsFetch = yield fetch(LOGIN_DETAILS_URL, { credentials: 'include' });
|
|
63
|
+
// An expired session can answer 401 without a JSON body; that still means "refresh needed".
|
|
64
|
+
if (loginDetailsFetch.status === HTTP_STATUS_UNAUTHORIZED) {
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
58
67
|
const loginDetails = yield loginDetailsFetch.json();
|
|
59
68
|
return loginDetails.MESSAGE_TYPE === 'EVENT_LOGIN_DETAILS_ACK';
|
|
60
69
|
});
|
|
@@ -33388,6 +33388,33 @@
|
|
|
33388
33388
|
"endIndex": 4
|
|
33389
33389
|
}
|
|
33390
33390
|
},
|
|
33391
|
+
{
|
|
33392
|
+
"kind": "Variable",
|
|
33393
|
+
"canonicalReference": "@genesislcap/foundation-comms!REAUTH_LOCK_TIMEOUT_MS:var",
|
|
33394
|
+
"docComment": "/**\n * How long a reauth lock is honoured before {@link tryRefreshSession} treats it as abandoned and clears it.\n *\n * @public\n */\n",
|
|
33395
|
+
"excerptTokens": [
|
|
33396
|
+
{
|
|
33397
|
+
"kind": "Content",
|
|
33398
|
+
"text": "REAUTH_LOCK_TIMEOUT_MS = "
|
|
33399
|
+
},
|
|
33400
|
+
{
|
|
33401
|
+
"kind": "Content",
|
|
33402
|
+
"text": "30000"
|
|
33403
|
+
}
|
|
33404
|
+
],
|
|
33405
|
+
"fileUrlPath": "src/connect/sessionRefresh.ts",
|
|
33406
|
+
"initializerTokenRange": {
|
|
33407
|
+
"startIndex": 1,
|
|
33408
|
+
"endIndex": 2
|
|
33409
|
+
},
|
|
33410
|
+
"isReadonly": true,
|
|
33411
|
+
"releaseTag": "Public",
|
|
33412
|
+
"name": "REAUTH_LOCK_TIMEOUT_MS",
|
|
33413
|
+
"variableTypeTokenRange": {
|
|
33414
|
+
"startIndex": 0,
|
|
33415
|
+
"endIndex": 0
|
|
33416
|
+
}
|
|
33417
|
+
},
|
|
33391
33418
|
{
|
|
33392
33419
|
"kind": "TypeAlias",
|
|
33393
33420
|
"canonicalReference": "@genesislcap/foundation-comms!RefreshAuthInfo:type",
|
|
@@ -4456,6 +4456,12 @@ export declare type RawDataServerResult = {
|
|
|
4456
4456
|
SEQUENCE_ID: number;
|
|
4457
4457
|
};
|
|
4458
4458
|
|
|
4459
|
+
/**
|
|
4460
|
+
* How long a reauth lock is honoured before {@link tryRefreshSession} treats it as abandoned and clears it.
|
|
4461
|
+
* @public
|
|
4462
|
+
*/
|
|
4463
|
+
export declare const REAUTH_LOCK_TIMEOUT_MS = 30000;
|
|
4464
|
+
|
|
4459
4465
|
/**
|
|
4460
4466
|
* Represents refresh token authentication information.
|
|
4461
4467
|
* @public
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@genesislcap/foundation-comms",
|
|
3
3
|
"description": "Genesis Foundation UI Comms",
|
|
4
|
-
"version": "15.50.1",
|
|
4
|
+
"version": "15.50.3-holiday-picker.1",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"license": "SEE LICENSE IN license.txt",
|
|
7
7
|
"main": "dist/esm/index.js",
|
|
@@ -74,23 +74,23 @@
|
|
|
74
74
|
}
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
|
-
"@genesislcap/foundation-testing": "15.50.1",
|
|
78
|
-
"@genesislcap/genx": "15.50.1",
|
|
79
|
-
"@genesislcap/ts-builder": "15.50.1",
|
|
80
|
-
"@genesislcap/uvu-playwright-builder": "15.50.1",
|
|
81
|
-
"@genesislcap/vite-builder": "15.50.1",
|
|
82
|
-
"@genesislcap/webpack-builder": "15.50.1",
|
|
77
|
+
"@genesislcap/foundation-testing": "15.50.3-holiday-picker.1",
|
|
78
|
+
"@genesislcap/genx": "15.50.3-holiday-picker.1",
|
|
79
|
+
"@genesislcap/ts-builder": "15.50.3-holiday-picker.1",
|
|
80
|
+
"@genesislcap/uvu-playwright-builder": "15.50.3-holiday-picker.1",
|
|
81
|
+
"@genesislcap/vite-builder": "15.50.3-holiday-picker.1",
|
|
82
|
+
"@genesislcap/webpack-builder": "15.50.3-holiday-picker.1",
|
|
83
83
|
"@types/js-cookie": "^3.0.2",
|
|
84
84
|
"@types/json-schema": "^7.0.11",
|
|
85
85
|
"@types/webappsec-credential-management": "^0.6.2",
|
|
86
86
|
"sinon": "^17.0.1"
|
|
87
87
|
},
|
|
88
88
|
"dependencies": {
|
|
89
|
-
"@genesislcap/foundation-broadcast-channel": "15.50.1",
|
|
90
|
-
"@genesislcap/foundation-logger": "15.50.1",
|
|
91
|
-
"@genesislcap/foundation-user": "15.50.1",
|
|
92
|
-
"@genesislcap/foundation-utils": "15.50.1",
|
|
93
|
-
"@genesislcap/web-core": "15.50.1",
|
|
89
|
+
"@genesislcap/foundation-broadcast-channel": "15.50.3-holiday-picker.1",
|
|
90
|
+
"@genesislcap/foundation-logger": "15.50.3-holiday-picker.1",
|
|
91
|
+
"@genesislcap/foundation-user": "15.50.3-holiday-picker.1",
|
|
92
|
+
"@genesislcap/foundation-utils": "15.50.3-holiday-picker.1",
|
|
93
|
+
"@genesislcap/web-core": "15.50.3-holiday-picker.1",
|
|
94
94
|
"@microsoft/fast-element": "1.14.0",
|
|
95
95
|
"@microsoft/fast-foundation": "2.50.0",
|
|
96
96
|
"bowser": "^2.11.0",
|