@genesislcap/foundation-comms 14.372.0 → 14.373.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.
- package/dist/dts/connect/http.connect.d.ts +26 -0
- package/dist/dts/connect/http.connect.d.ts.map +1 -1
- package/dist/dts/connect/http.d.ts +8 -0
- package/dist/dts/connect/http.d.ts.map +1 -1
- package/dist/dts/connect/index.d.ts +5 -4
- package/dist/dts/connect/index.d.ts.map +1 -1
- package/dist/dts/connect/sessionRefresh.d.ts +35 -0
- package/dist/dts/connect/sessionRefresh.d.ts.map +1 -0
- package/dist/dts/connect/socket.d.ts +0 -2
- package/dist/dts/connect/socket.d.ts.map +1 -1
- package/dist/esm/connect/connect.js +2 -2
- package/dist/esm/connect/http.connect.js +107 -5
- package/dist/esm/connect/http.js +12 -0
- package/dist/esm/connect/index.js +5 -4
- package/dist/esm/connect/sessionRefresh.js +135 -0
- package/dist/esm/connect/socket.js +10 -45
- package/dist/foundation-comms.api.json +291 -0
- package/dist/foundation-comms.d.ts +82 -12
- package/docs/api/foundation-comms.httperror.md +74 -0
- package/docs/api/foundation-comms.httperror.message.md +11 -0
- package/docs/api/foundation-comms.httperror.status.md +11 -0
- package/docs/api/foundation-comms.md +44 -0
- package/docs/api/foundation-comms.onothertabreauthcomplete.md +56 -0
- package/docs/api/foundation-comms.sessionrefreshresult.md +98 -0
- package/docs/api/foundation-comms.tryrefreshsession.md +58 -0
- package/docs/api-report.md.api.md +34 -10
- package/package.json +14 -13
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@genesislcap/foundation-comms](./foundation-comms.md) > [onOtherTabReauthComplete](./foundation-comms.onothertabreauthcomplete.md)
|
|
4
|
+
|
|
5
|
+
## onOtherTabReauthComplete() function
|
|
6
|
+
|
|
7
|
+
Subscribes to storage events to detect when another tab has finished reauthenticating.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
export declare function onOtherTabReauthComplete(callback: () => void): () => void;
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Parameters
|
|
16
|
+
|
|
17
|
+
<table><thead><tr><th>
|
|
18
|
+
|
|
19
|
+
Parameter
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
</th><th>
|
|
23
|
+
|
|
24
|
+
Type
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
</th><th>
|
|
28
|
+
|
|
29
|
+
Description
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
</th></tr></thead>
|
|
33
|
+
<tbody><tr><td>
|
|
34
|
+
|
|
35
|
+
callback
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
</td><td>
|
|
39
|
+
|
|
40
|
+
() => void
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
</td><td>
|
|
44
|
+
|
|
45
|
+
Called when the other tab finishes reauthentication
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
</td></tr>
|
|
49
|
+
</tbody></table>
|
|
50
|
+
|
|
51
|
+
**Returns:**
|
|
52
|
+
|
|
53
|
+
() => void
|
|
54
|
+
|
|
55
|
+
A function to unsubscribe from the storage events
|
|
56
|
+
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@genesislcap/foundation-comms](./foundation-comms.md) > [SessionRefreshResult](./foundation-comms.sessionrefreshresult.md)
|
|
4
|
+
|
|
5
|
+
## SessionRefreshResult enum
|
|
6
|
+
|
|
7
|
+
Result of a session refresh attempt.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
export declare enum SessionRefreshResult
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Enumeration Members
|
|
16
|
+
|
|
17
|
+
<table><thead><tr><th>
|
|
18
|
+
|
|
19
|
+
Member
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
</th><th>
|
|
23
|
+
|
|
24
|
+
Value
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
</th><th>
|
|
28
|
+
|
|
29
|
+
Description
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
</th></tr></thead>
|
|
33
|
+
<tbody><tr><td>
|
|
34
|
+
|
|
35
|
+
ALREADY\_VALID
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
</td><td>
|
|
39
|
+
|
|
40
|
+
`"ALREADY_VALID"`
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
</td><td>
|
|
44
|
+
|
|
45
|
+
Session was already valid
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
</td></tr>
|
|
49
|
+
<tr><td>
|
|
50
|
+
|
|
51
|
+
FAILED
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
</td><td>
|
|
55
|
+
|
|
56
|
+
`"FAILED"`
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
</td><td>
|
|
60
|
+
|
|
61
|
+
Refresh failed - page will reload
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
</td></tr>
|
|
65
|
+
<tr><td>
|
|
66
|
+
|
|
67
|
+
HANDLED\_BY\_OTHER\_TAB
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
</td><td>
|
|
71
|
+
|
|
72
|
+
`"HANDLED_BY_OTHER_TAB"`
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
</td><td>
|
|
76
|
+
|
|
77
|
+
Another tab is handling the refresh
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
</td></tr>
|
|
81
|
+
<tr><td>
|
|
82
|
+
|
|
83
|
+
SUCCESS
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
</td><td>
|
|
87
|
+
|
|
88
|
+
`"SUCCESS"`
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
</td><td>
|
|
92
|
+
|
|
93
|
+
Session was successfully refreshed
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
</td></tr>
|
|
97
|
+
</tbody></table>
|
|
98
|
+
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@genesislcap/foundation-comms](./foundation-comms.md) > [tryRefreshSession](./foundation-comms.tryrefreshsession.md)
|
|
4
|
+
|
|
5
|
+
## tryRefreshSession() function
|
|
6
|
+
|
|
7
|
+
Attempts to refresh the session when authentication has expired. Uses a localStorage-based lock mechanism to prevent multiple tabs from trying to reauthenticate simultaneously.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
export declare function tryRefreshSession(options?: {
|
|
13
|
+
reloadOnFailure?: boolean;
|
|
14
|
+
}): Promise<SessionRefreshResult>;
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Parameters
|
|
18
|
+
|
|
19
|
+
<table><thead><tr><th>
|
|
20
|
+
|
|
21
|
+
Parameter
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
</th><th>
|
|
25
|
+
|
|
26
|
+
Type
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
</th><th>
|
|
30
|
+
|
|
31
|
+
Description
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
</th></tr></thead>
|
|
35
|
+
<tbody><tr><td>
|
|
36
|
+
|
|
37
|
+
options
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
</td><td>
|
|
41
|
+
|
|
42
|
+
{ reloadOnFailure?: boolean; }
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
</td><td>
|
|
46
|
+
|
|
47
|
+
_(Optional)_ Optional configuration
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
</td></tr>
|
|
51
|
+
</tbody></table>
|
|
52
|
+
|
|
53
|
+
**Returns:**
|
|
54
|
+
|
|
55
|
+
Promise<[SessionRefreshResult](./foundation-comms.sessionrefreshresult.md)<!-- -->>
|
|
56
|
+
|
|
57
|
+
The result of the refresh attempt
|
|
58
|
+
|
|
@@ -17,8 +17,8 @@ import { Listener } from '@genesislcap/foundation-utils';
|
|
|
17
17
|
import { Logger } from '@genesislcap/foundation-logger';
|
|
18
18
|
import type { LogLevel } from '@genesislcap/foundation-utils';
|
|
19
19
|
import { Observable } from 'rxjs';
|
|
20
|
-
import { Observer } from '
|
|
21
|
-
import { Observer as Observer_2 } from '
|
|
20
|
+
import { Observer } from 'rxjs';
|
|
21
|
+
import { Observer as Observer_2 } from '@genesislcap/foundation-utils';
|
|
22
22
|
import { SetUserProperties } from '@genesislcap/foundation-user';
|
|
23
23
|
import { Subscription as SocketSubscription } from 'rxjs';
|
|
24
24
|
import { Subject } from 'rxjs';
|
|
@@ -1140,11 +1140,11 @@ export class DefaultConnectEvents implements ConnectEventsEmitter {
|
|
|
1140
1140
|
// (undocumented)
|
|
1141
1141
|
addStreamListener(listener: Listener<StreamEvent>, complete: Listener<StreamCompleteEvent>, error: Listener<StreamErrorEvent>): () => void;
|
|
1142
1142
|
// @internal (undocumented)
|
|
1143
|
-
protected commitListeners:
|
|
1143
|
+
protected commitListeners: Observer_2<CommitEvent>;
|
|
1144
1144
|
// @internal (undocumented)
|
|
1145
|
-
protected commitResponseListeners:
|
|
1145
|
+
protected commitResponseListeners: Observer_2<CommitResponseEvent>;
|
|
1146
1146
|
// @internal (undocumented)
|
|
1147
|
-
protected metadataListeners:
|
|
1147
|
+
protected metadataListeners: Observer_2<MetadataEvent>;
|
|
1148
1148
|
// Warning: (ae-unresolved-inheritdoc-reference) The @inheritDoc reference could not be resolved: The reference is ambiguous because "ConnectEventsEmitter" has more than one declaration; you need to add a TSDoc member reference selector
|
|
1149
1149
|
//
|
|
1150
1150
|
// (undocumented)
|
|
@@ -1170,11 +1170,11 @@ export class DefaultConnectEvents implements ConnectEventsEmitter {
|
|
|
1170
1170
|
// (undocumented)
|
|
1171
1171
|
onStreamEvent(resourceName: string, message: Message<MessageDetails.DataserverRequest>, stream: SocketObservable<any>, functions: StreamEventFunctions): void;
|
|
1172
1172
|
// @internal (undocumented)
|
|
1173
|
-
protected streamCompleteListeners:
|
|
1173
|
+
protected streamCompleteListeners: Observer_2<StreamCompleteEvent>;
|
|
1174
1174
|
// @internal (undocumented)
|
|
1175
|
-
protected streamErrorListeners:
|
|
1175
|
+
protected streamErrorListeners: Observer_2<StreamErrorEvent>;
|
|
1176
1176
|
// @internal (undocumented)
|
|
1177
|
-
protected streamListeners:
|
|
1177
|
+
protected streamListeners: Observer_2<StreamEvent>;
|
|
1178
1178
|
}
|
|
1179
1179
|
|
|
1180
1180
|
// @public
|
|
@@ -1991,6 +1991,14 @@ export const Http: InterfaceSymbol<Http>;
|
|
|
1991
1991
|
// @internal
|
|
1992
1992
|
export const HttpConnect: InterfaceSymbol<Connect>;
|
|
1993
1993
|
|
|
1994
|
+
// @public
|
|
1995
|
+
export interface HttpError extends Error {
|
|
1996
|
+
// (undocumented)
|
|
1997
|
+
message: string;
|
|
1998
|
+
// (undocumented)
|
|
1999
|
+
status: number;
|
|
2000
|
+
}
|
|
2001
|
+
|
|
1994
2002
|
// @public
|
|
1995
2003
|
export interface HttpRequestInit extends RequestInit {
|
|
1996
2004
|
serializer?: JSONSerializer;
|
|
@@ -2426,6 +2434,9 @@ export const NetworkMonitorConfig: InterfaceSymbol<NetworkMonitorConfig>;
|
|
|
2426
2434
|
// @public
|
|
2427
2435
|
export function normaliseCriteria(criteria: string, delimiter?: string): string;
|
|
2428
2436
|
|
|
2437
|
+
// @public
|
|
2438
|
+
export function onOtherTabReauthComplete(callback: () => void): () => void;
|
|
2439
|
+
|
|
2429
2440
|
// @public (undocumented)
|
|
2430
2441
|
export type PingMessage = Pick<Message, 'MESSAGE_TYPE' | 'SOURCE_REF' | 'DETAILS' | 'SESSION_AUTH_TOKEN'> & {
|
|
2431
2442
|
VERBOSE?: boolean;
|
|
@@ -2660,6 +2671,14 @@ export class SessionMock implements Session {
|
|
|
2660
2671
|
setStorageKeyPrefix(prefix: string): void;
|
|
2661
2672
|
}
|
|
2662
2673
|
|
|
2674
|
+
// @public
|
|
2675
|
+
export enum SessionRefreshResult {
|
|
2676
|
+
ALREADY_VALID = "ALREADY_VALID",
|
|
2677
|
+
FAILED = "FAILED",
|
|
2678
|
+
HANDLED_BY_OTHER_TAB = "HANDLED_BY_OTHER_TAB",
|
|
2679
|
+
SUCCESS = "SUCCESS"
|
|
2680
|
+
}
|
|
2681
|
+
|
|
2663
2682
|
// Warning: (ae-internal-mixed-release-tag) Mixed release tags are not allowed for "Socket" because one of its declarations is marked as @internal
|
|
2664
2683
|
//
|
|
2665
2684
|
// @public
|
|
@@ -2685,7 +2704,7 @@ export const Socket: InterfaceSymbol<Socket>;
|
|
|
2685
2704
|
// @public
|
|
2686
2705
|
export type SocketConnectOptions = {
|
|
2687
2706
|
alwaysOn?: boolean;
|
|
2688
|
-
connectObserver?:
|
|
2707
|
+
connectObserver?: Observer<Message>;
|
|
2689
2708
|
enableHeartbeat?: boolean;
|
|
2690
2709
|
enableHeartbeatLogging?: boolean;
|
|
2691
2710
|
enableMessageLogging?: boolean;
|
|
@@ -2756,7 +2775,7 @@ export class SocketObservable<T> extends Observable<T> {
|
|
|
2756
2775
|
export type SocketReconnectOptions = {
|
|
2757
2776
|
reconnectAttempts?: number;
|
|
2758
2777
|
reconnectInterval?: number;
|
|
2759
|
-
reconnectObserver?:
|
|
2778
|
+
reconnectObserver?: Observer<any>;
|
|
2760
2779
|
reconnectStreams?: boolean;
|
|
2761
2780
|
reconnectStrategy?: SocketReconnectStrategy;
|
|
2762
2781
|
};
|
|
@@ -2876,6 +2895,11 @@ export type SystemHealthStatus = {
|
|
|
2876
2895
|
// @public
|
|
2877
2896
|
export const toFieldMetadata: (fieldDef: MetadataDetail[]) => FieldMetadata[];
|
|
2878
2897
|
|
|
2898
|
+
// @public
|
|
2899
|
+
export function tryRefreshSession(options?: {
|
|
2900
|
+
reloadOnFailure?: boolean;
|
|
2901
|
+
}): Promise<SessionRefreshResult>;
|
|
2902
|
+
|
|
2879
2903
|
// @public
|
|
2880
2904
|
export const TYPES_MAP: {
|
|
2881
2905
|
STRING: FieldTypeEnum;
|
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": "14.
|
|
4
|
+
"version": "14.373.0",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"license": "SEE LICENSE IN license.txt",
|
|
7
7
|
"main": "dist/esm/index.js",
|
|
@@ -75,23 +75,24 @@
|
|
|
75
75
|
}
|
|
76
76
|
},
|
|
77
77
|
"devDependencies": {
|
|
78
|
-
"@genesislcap/foundation-testing": "14.
|
|
79
|
-
"@genesislcap/genx": "14.
|
|
80
|
-
"@genesislcap/rollup-builder": "14.
|
|
81
|
-
"@genesislcap/ts-builder": "14.
|
|
82
|
-
"@genesislcap/uvu-playwright-builder": "14.
|
|
83
|
-
"@genesislcap/vite-builder": "14.
|
|
84
|
-
"@genesislcap/webpack-builder": "14.
|
|
78
|
+
"@genesislcap/foundation-testing": "14.373.0",
|
|
79
|
+
"@genesislcap/genx": "14.373.0",
|
|
80
|
+
"@genesislcap/rollup-builder": "14.373.0",
|
|
81
|
+
"@genesislcap/ts-builder": "14.373.0",
|
|
82
|
+
"@genesislcap/uvu-playwright-builder": "14.373.0",
|
|
83
|
+
"@genesislcap/vite-builder": "14.373.0",
|
|
84
|
+
"@genesislcap/webpack-builder": "14.373.0",
|
|
85
85
|
"@types/js-cookie": "^3.0.2",
|
|
86
86
|
"@types/json-schema": "^7.0.11",
|
|
87
87
|
"@types/webappsec-credential-management": "^0.6.2",
|
|
88
88
|
"sinon": "^17.0.1"
|
|
89
89
|
},
|
|
90
90
|
"dependencies": {
|
|
91
|
-
"@genesislcap/foundation-broadcast-channel": "14.
|
|
92
|
-
"@genesislcap/foundation-logger": "14.
|
|
93
|
-
"@genesislcap/foundation-user": "14.
|
|
94
|
-
"@genesislcap/foundation-utils": "14.
|
|
91
|
+
"@genesislcap/foundation-broadcast-channel": "14.373.0",
|
|
92
|
+
"@genesislcap/foundation-logger": "14.373.0",
|
|
93
|
+
"@genesislcap/foundation-user": "14.373.0",
|
|
94
|
+
"@genesislcap/foundation-utils": "14.373.0",
|
|
95
|
+
"@genesislcap/web-core": "14.373.0",
|
|
95
96
|
"@microsoft/fast-element": "1.14.0",
|
|
96
97
|
"@microsoft/fast-foundation": "2.49.6",
|
|
97
98
|
"analytics": "0.8.16",
|
|
@@ -110,5 +111,5 @@
|
|
|
110
111
|
"publishConfig": {
|
|
111
112
|
"access": "public"
|
|
112
113
|
},
|
|
113
|
-
"gitHead": "
|
|
114
|
+
"gitHead": "134490c6c8be9d443484692e1769bda61b00fa1e"
|
|
114
115
|
}
|