@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
|
@@ -26550,6 +26550,92 @@
|
|
|
26550
26550
|
],
|
|
26551
26551
|
"extendsTokenRanges": []
|
|
26552
26552
|
},
|
|
26553
|
+
{
|
|
26554
|
+
"kind": "Interface",
|
|
26555
|
+
"canonicalReference": "@genesislcap/foundation-comms!HttpError:interface",
|
|
26556
|
+
"docComment": "/**\n * An error thrown when an HTTP request fails with a non-2xx status code.\n *\n * @public\n */\n",
|
|
26557
|
+
"excerptTokens": [
|
|
26558
|
+
{
|
|
26559
|
+
"kind": "Content",
|
|
26560
|
+
"text": "export interface HttpError extends "
|
|
26561
|
+
},
|
|
26562
|
+
{
|
|
26563
|
+
"kind": "Reference",
|
|
26564
|
+
"text": "Error",
|
|
26565
|
+
"canonicalReference": "!Error:interface"
|
|
26566
|
+
},
|
|
26567
|
+
{
|
|
26568
|
+
"kind": "Content",
|
|
26569
|
+
"text": " "
|
|
26570
|
+
}
|
|
26571
|
+
],
|
|
26572
|
+
"fileUrlPath": "src/connect/http.ts",
|
|
26573
|
+
"releaseTag": "Public",
|
|
26574
|
+
"name": "HttpError",
|
|
26575
|
+
"preserveMemberOrder": false,
|
|
26576
|
+
"members": [
|
|
26577
|
+
{
|
|
26578
|
+
"kind": "PropertySignature",
|
|
26579
|
+
"canonicalReference": "@genesislcap/foundation-comms!HttpError#message:member",
|
|
26580
|
+
"docComment": "",
|
|
26581
|
+
"excerptTokens": [
|
|
26582
|
+
{
|
|
26583
|
+
"kind": "Content",
|
|
26584
|
+
"text": "message: "
|
|
26585
|
+
},
|
|
26586
|
+
{
|
|
26587
|
+
"kind": "Content",
|
|
26588
|
+
"text": "string"
|
|
26589
|
+
},
|
|
26590
|
+
{
|
|
26591
|
+
"kind": "Content",
|
|
26592
|
+
"text": ";"
|
|
26593
|
+
}
|
|
26594
|
+
],
|
|
26595
|
+
"isReadonly": false,
|
|
26596
|
+
"isOptional": false,
|
|
26597
|
+
"releaseTag": "Public",
|
|
26598
|
+
"name": "message",
|
|
26599
|
+
"propertyTypeTokenRange": {
|
|
26600
|
+
"startIndex": 1,
|
|
26601
|
+
"endIndex": 2
|
|
26602
|
+
}
|
|
26603
|
+
},
|
|
26604
|
+
{
|
|
26605
|
+
"kind": "PropertySignature",
|
|
26606
|
+
"canonicalReference": "@genesislcap/foundation-comms!HttpError#status:member",
|
|
26607
|
+
"docComment": "",
|
|
26608
|
+
"excerptTokens": [
|
|
26609
|
+
{
|
|
26610
|
+
"kind": "Content",
|
|
26611
|
+
"text": "status: "
|
|
26612
|
+
},
|
|
26613
|
+
{
|
|
26614
|
+
"kind": "Content",
|
|
26615
|
+
"text": "number"
|
|
26616
|
+
},
|
|
26617
|
+
{
|
|
26618
|
+
"kind": "Content",
|
|
26619
|
+
"text": ";"
|
|
26620
|
+
}
|
|
26621
|
+
],
|
|
26622
|
+
"isReadonly": false,
|
|
26623
|
+
"isOptional": false,
|
|
26624
|
+
"releaseTag": "Public",
|
|
26625
|
+
"name": "status",
|
|
26626
|
+
"propertyTypeTokenRange": {
|
|
26627
|
+
"startIndex": 1,
|
|
26628
|
+
"endIndex": 2
|
|
26629
|
+
}
|
|
26630
|
+
}
|
|
26631
|
+
],
|
|
26632
|
+
"extendsTokenRanges": [
|
|
26633
|
+
{
|
|
26634
|
+
"startIndex": 1,
|
|
26635
|
+
"endIndex": 2
|
|
26636
|
+
}
|
|
26637
|
+
]
|
|
26638
|
+
},
|
|
26553
26639
|
{
|
|
26554
26640
|
"kind": "Interface",
|
|
26555
26641
|
"canonicalReference": "@genesislcap/foundation-comms!HttpRequestInit:interface",
|
|
@@ -31739,6 +31825,51 @@
|
|
|
31739
31825
|
],
|
|
31740
31826
|
"name": "normaliseCriteria"
|
|
31741
31827
|
},
|
|
31828
|
+
{
|
|
31829
|
+
"kind": "Function",
|
|
31830
|
+
"canonicalReference": "@genesislcap/foundation-comms!onOtherTabReauthComplete:function(1)",
|
|
31831
|
+
"docComment": "/**\n * Subscribes to storage events to detect when another tab has finished reauthenticating.\n *\n * @param callback - Called when the other tab finishes reauthentication\n *\n * @returns A function to unsubscribe from the storage events\n *\n * @public\n */\n",
|
|
31832
|
+
"excerptTokens": [
|
|
31833
|
+
{
|
|
31834
|
+
"kind": "Content",
|
|
31835
|
+
"text": "export declare function onOtherTabReauthComplete(callback: "
|
|
31836
|
+
},
|
|
31837
|
+
{
|
|
31838
|
+
"kind": "Content",
|
|
31839
|
+
"text": "() => void"
|
|
31840
|
+
},
|
|
31841
|
+
{
|
|
31842
|
+
"kind": "Content",
|
|
31843
|
+
"text": "): "
|
|
31844
|
+
},
|
|
31845
|
+
{
|
|
31846
|
+
"kind": "Content",
|
|
31847
|
+
"text": "() => void"
|
|
31848
|
+
},
|
|
31849
|
+
{
|
|
31850
|
+
"kind": "Content",
|
|
31851
|
+
"text": ";"
|
|
31852
|
+
}
|
|
31853
|
+
],
|
|
31854
|
+
"fileUrlPath": "src/connect/sessionRefresh.ts",
|
|
31855
|
+
"returnTypeTokenRange": {
|
|
31856
|
+
"startIndex": 3,
|
|
31857
|
+
"endIndex": 4
|
|
31858
|
+
},
|
|
31859
|
+
"releaseTag": "Public",
|
|
31860
|
+
"overloadIndex": 1,
|
|
31861
|
+
"parameters": [
|
|
31862
|
+
{
|
|
31863
|
+
"parameterName": "callback",
|
|
31864
|
+
"parameterTypeTokenRange": {
|
|
31865
|
+
"startIndex": 1,
|
|
31866
|
+
"endIndex": 2
|
|
31867
|
+
},
|
|
31868
|
+
"isOptional": false
|
|
31869
|
+
}
|
|
31870
|
+
],
|
|
31871
|
+
"name": "onOtherTabReauthComplete"
|
|
31872
|
+
},
|
|
31742
31873
|
{
|
|
31743
31874
|
"kind": "TypeAlias",
|
|
31744
31875
|
"canonicalReference": "@genesislcap/foundation-comms!PingMessage:type",
|
|
@@ -33756,6 +33887,107 @@
|
|
|
33756
33887
|
],
|
|
33757
33888
|
"extendsTokenRanges": []
|
|
33758
33889
|
},
|
|
33890
|
+
{
|
|
33891
|
+
"kind": "Enum",
|
|
33892
|
+
"canonicalReference": "@genesislcap/foundation-comms!SessionRefreshResult:enum",
|
|
33893
|
+
"docComment": "/**\n * Result of a session refresh attempt.\n *\n * @public\n */\n",
|
|
33894
|
+
"excerptTokens": [
|
|
33895
|
+
{
|
|
33896
|
+
"kind": "Content",
|
|
33897
|
+
"text": "export declare enum SessionRefreshResult "
|
|
33898
|
+
}
|
|
33899
|
+
],
|
|
33900
|
+
"fileUrlPath": "src/connect/sessionRefresh.ts",
|
|
33901
|
+
"releaseTag": "Public",
|
|
33902
|
+
"name": "SessionRefreshResult",
|
|
33903
|
+
"preserveMemberOrder": false,
|
|
33904
|
+
"members": [
|
|
33905
|
+
{
|
|
33906
|
+
"kind": "EnumMember",
|
|
33907
|
+
"canonicalReference": "@genesislcap/foundation-comms!SessionRefreshResult.ALREADY_VALID:member",
|
|
33908
|
+
"docComment": "/**\n * Session was already valid\n */\n",
|
|
33909
|
+
"excerptTokens": [
|
|
33910
|
+
{
|
|
33911
|
+
"kind": "Content",
|
|
33912
|
+
"text": "ALREADY_VALID = "
|
|
33913
|
+
},
|
|
33914
|
+
{
|
|
33915
|
+
"kind": "Content",
|
|
33916
|
+
"text": "\"ALREADY_VALID\""
|
|
33917
|
+
}
|
|
33918
|
+
],
|
|
33919
|
+
"initializerTokenRange": {
|
|
33920
|
+
"startIndex": 1,
|
|
33921
|
+
"endIndex": 2
|
|
33922
|
+
},
|
|
33923
|
+
"releaseTag": "Public",
|
|
33924
|
+
"name": "ALREADY_VALID"
|
|
33925
|
+
},
|
|
33926
|
+
{
|
|
33927
|
+
"kind": "EnumMember",
|
|
33928
|
+
"canonicalReference": "@genesislcap/foundation-comms!SessionRefreshResult.FAILED:member",
|
|
33929
|
+
"docComment": "/**\n * Refresh failed - page will reload\n */\n",
|
|
33930
|
+
"excerptTokens": [
|
|
33931
|
+
{
|
|
33932
|
+
"kind": "Content",
|
|
33933
|
+
"text": "FAILED = "
|
|
33934
|
+
},
|
|
33935
|
+
{
|
|
33936
|
+
"kind": "Content",
|
|
33937
|
+
"text": "\"FAILED\""
|
|
33938
|
+
}
|
|
33939
|
+
],
|
|
33940
|
+
"initializerTokenRange": {
|
|
33941
|
+
"startIndex": 1,
|
|
33942
|
+
"endIndex": 2
|
|
33943
|
+
},
|
|
33944
|
+
"releaseTag": "Public",
|
|
33945
|
+
"name": "FAILED"
|
|
33946
|
+
},
|
|
33947
|
+
{
|
|
33948
|
+
"kind": "EnumMember",
|
|
33949
|
+
"canonicalReference": "@genesislcap/foundation-comms!SessionRefreshResult.HANDLED_BY_OTHER_TAB:member",
|
|
33950
|
+
"docComment": "/**\n * Another tab is handling the refresh\n */\n",
|
|
33951
|
+
"excerptTokens": [
|
|
33952
|
+
{
|
|
33953
|
+
"kind": "Content",
|
|
33954
|
+
"text": "HANDLED_BY_OTHER_TAB = "
|
|
33955
|
+
},
|
|
33956
|
+
{
|
|
33957
|
+
"kind": "Content",
|
|
33958
|
+
"text": "\"HANDLED_BY_OTHER_TAB\""
|
|
33959
|
+
}
|
|
33960
|
+
],
|
|
33961
|
+
"initializerTokenRange": {
|
|
33962
|
+
"startIndex": 1,
|
|
33963
|
+
"endIndex": 2
|
|
33964
|
+
},
|
|
33965
|
+
"releaseTag": "Public",
|
|
33966
|
+
"name": "HANDLED_BY_OTHER_TAB"
|
|
33967
|
+
},
|
|
33968
|
+
{
|
|
33969
|
+
"kind": "EnumMember",
|
|
33970
|
+
"canonicalReference": "@genesislcap/foundation-comms!SessionRefreshResult.SUCCESS:member",
|
|
33971
|
+
"docComment": "/**\n * Session was successfully refreshed\n */\n",
|
|
33972
|
+
"excerptTokens": [
|
|
33973
|
+
{
|
|
33974
|
+
"kind": "Content",
|
|
33975
|
+
"text": "SUCCESS = "
|
|
33976
|
+
},
|
|
33977
|
+
{
|
|
33978
|
+
"kind": "Content",
|
|
33979
|
+
"text": "\"SUCCESS\""
|
|
33980
|
+
}
|
|
33981
|
+
],
|
|
33982
|
+
"initializerTokenRange": {
|
|
33983
|
+
"startIndex": 1,
|
|
33984
|
+
"endIndex": 2
|
|
33985
|
+
},
|
|
33986
|
+
"releaseTag": "Public",
|
|
33987
|
+
"name": "SUCCESS"
|
|
33988
|
+
}
|
|
33989
|
+
]
|
|
33990
|
+
},
|
|
33759
33991
|
{
|
|
33760
33992
|
"kind": "Interface",
|
|
33761
33993
|
"canonicalReference": "@genesislcap/foundation-comms!Socket:interface",
|
|
@@ -35713,6 +35945,65 @@
|
|
|
35713
35945
|
],
|
|
35714
35946
|
"name": "toFieldMetadata"
|
|
35715
35947
|
},
|
|
35948
|
+
{
|
|
35949
|
+
"kind": "Function",
|
|
35950
|
+
"canonicalReference": "@genesislcap/foundation-comms!tryRefreshSession:function(1)",
|
|
35951
|
+
"docComment": "/**\n * Attempts to refresh the session when authentication has expired. Uses a localStorage-based lock mechanism to prevent multiple tabs from trying to reauthenticate simultaneously.\n *\n * @param options - Optional configuration\n *\n * @param - options.reloadOnFailure - Whether to reload the page if refresh fails (default: true)\n *\n * @returns The result of the refresh attempt\n *\n * @public\n */\n",
|
|
35952
|
+
"excerptTokens": [
|
|
35953
|
+
{
|
|
35954
|
+
"kind": "Content",
|
|
35955
|
+
"text": "export declare function tryRefreshSession(options?: "
|
|
35956
|
+
},
|
|
35957
|
+
{
|
|
35958
|
+
"kind": "Content",
|
|
35959
|
+
"text": "{\n reloadOnFailure?: boolean;\n}"
|
|
35960
|
+
},
|
|
35961
|
+
{
|
|
35962
|
+
"kind": "Content",
|
|
35963
|
+
"text": "): "
|
|
35964
|
+
},
|
|
35965
|
+
{
|
|
35966
|
+
"kind": "Reference",
|
|
35967
|
+
"text": "Promise",
|
|
35968
|
+
"canonicalReference": "!Promise:interface"
|
|
35969
|
+
},
|
|
35970
|
+
{
|
|
35971
|
+
"kind": "Content",
|
|
35972
|
+
"text": "<"
|
|
35973
|
+
},
|
|
35974
|
+
{
|
|
35975
|
+
"kind": "Reference",
|
|
35976
|
+
"text": "SessionRefreshResult",
|
|
35977
|
+
"canonicalReference": "@genesislcap/foundation-comms!SessionRefreshResult:enum"
|
|
35978
|
+
},
|
|
35979
|
+
{
|
|
35980
|
+
"kind": "Content",
|
|
35981
|
+
"text": ">"
|
|
35982
|
+
},
|
|
35983
|
+
{
|
|
35984
|
+
"kind": "Content",
|
|
35985
|
+
"text": ";"
|
|
35986
|
+
}
|
|
35987
|
+
],
|
|
35988
|
+
"fileUrlPath": "src/connect/sessionRefresh.ts",
|
|
35989
|
+
"returnTypeTokenRange": {
|
|
35990
|
+
"startIndex": 3,
|
|
35991
|
+
"endIndex": 7
|
|
35992
|
+
},
|
|
35993
|
+
"releaseTag": "Public",
|
|
35994
|
+
"overloadIndex": 1,
|
|
35995
|
+
"parameters": [
|
|
35996
|
+
{
|
|
35997
|
+
"parameterName": "options",
|
|
35998
|
+
"parameterTypeTokenRange": {
|
|
35999
|
+
"startIndex": 1,
|
|
36000
|
+
"endIndex": 2
|
|
36001
|
+
},
|
|
36002
|
+
"isOptional": true
|
|
36003
|
+
}
|
|
36004
|
+
],
|
|
36005
|
+
"name": "tryRefreshSession"
|
|
36006
|
+
},
|
|
35716
36007
|
{
|
|
35717
36008
|
"kind": "Variable",
|
|
35718
36009
|
"canonicalReference": "@genesislcap/foundation-comms!TYPES_MAP:var",
|
|
@@ -11,8 +11,8 @@ import { Listener } from '@genesislcap/foundation-utils';
|
|
|
11
11
|
import { Logger } from '@genesislcap/foundation-logger';
|
|
12
12
|
import type { LogLevel } from '@genesislcap/foundation-utils';
|
|
13
13
|
import { Observable } from 'rxjs';
|
|
14
|
-
import { Observer } from '
|
|
15
|
-
import { Observer as Observer_2 } from '
|
|
14
|
+
import { Observer } from 'rxjs';
|
|
15
|
+
import { Observer as Observer_2 } from '@genesislcap/foundation-utils';
|
|
16
16
|
import { SetUserProperties } from '@genesislcap/foundation-user';
|
|
17
17
|
import { Subscription as SocketSubscription } from 'rxjs';
|
|
18
18
|
import { Subject } from 'rxjs';
|
|
@@ -1868,11 +1868,11 @@ export declare const defaultConnectConfig: ConnectConfig;
|
|
|
1868
1868
|
*/
|
|
1869
1869
|
export declare class DefaultConnectEvents implements ConnectEventsEmitter {
|
|
1870
1870
|
/** @internal */
|
|
1871
|
-
protected streamListeners:
|
|
1871
|
+
protected streamListeners: Observer_2<StreamEvent>;
|
|
1872
1872
|
/** @internal */
|
|
1873
|
-
protected streamCompleteListeners:
|
|
1873
|
+
protected streamCompleteListeners: Observer_2<StreamCompleteEvent>;
|
|
1874
1874
|
/** @internal */
|
|
1875
|
-
protected streamErrorListeners:
|
|
1875
|
+
protected streamErrorListeners: Observer_2<StreamErrorEvent>;
|
|
1876
1876
|
/** {@inheritDoc ConnectEvents.addStreamListener} */
|
|
1877
1877
|
addStreamListener(listener: Listener<StreamEvent>, complete: Listener<StreamCompleteEvent>, error: Listener<StreamErrorEvent>): () => void;
|
|
1878
1878
|
/** {@inheritDoc ConnectEventsEmitter.onStreamEvent} */
|
|
@@ -1882,19 +1882,19 @@ export declare class DefaultConnectEvents implements ConnectEventsEmitter {
|
|
|
1882
1882
|
/** {@inheritDoc ConnectEventsEmitter.onStreamCompleteEvent} */
|
|
1883
1883
|
onStreamCompleteEvent(resourceName: string, stream: SocketObservable<any>): void;
|
|
1884
1884
|
/** @internal */
|
|
1885
|
-
protected commitListeners:
|
|
1885
|
+
protected commitListeners: Observer_2<CommitEvent>;
|
|
1886
1886
|
/** {@inheritDoc ConnectEvents.addCommitListener} */
|
|
1887
1887
|
addCommitListener(listener: Listener<CommitEvent>): () => void;
|
|
1888
1888
|
/** {@inheritDoc ConnectEventsEmitter.onStreamEvent} */
|
|
1889
1889
|
onCommitEvent(eventName: string, message: Message): void;
|
|
1890
1890
|
/** @internal */
|
|
1891
|
-
protected metadataListeners:
|
|
1891
|
+
protected metadataListeners: Observer_2<MetadataEvent>;
|
|
1892
1892
|
/** {@inheritDoc ConnectEvents.addMetadataListener} */
|
|
1893
1893
|
addMetadataListener(listener: Listener<MetadataEvent>): () => void;
|
|
1894
1894
|
/** {@inheritDoc ConnectEventsEmitter.onMetadataEvent} */
|
|
1895
1895
|
onMetadataEvent(resourceName: string, message: Message<MessageDetails.MetaRequest>, error?: any): void;
|
|
1896
1896
|
/** @internal */
|
|
1897
|
-
protected commitResponseListeners:
|
|
1897
|
+
protected commitResponseListeners: Observer_2<CommitResponseEvent>;
|
|
1898
1898
|
/** {@inheritDoc ConnectEvents.addCommitResponseListener} */
|
|
1899
1899
|
addCommitResponseListener(listener: Listener<CommitResponseEvent>): () => void;
|
|
1900
1900
|
/** {@inheritDoc ConnectEventsEmitter.onCommitResponseEvent} */
|
|
@@ -2153,13 +2153,39 @@ export declare class DefaultHttpConnect implements Connect {
|
|
|
2153
2153
|
get isConnected(): boolean;
|
|
2154
2154
|
set isConnected(value: boolean);
|
|
2155
2155
|
private ongoingTurbo?;
|
|
2156
|
+
/**
|
|
2157
|
+
* Amount of time (in milliseconds) to wait when another tab is handling session reauthentication.
|
|
2158
|
+
*/
|
|
2159
|
+
private static readonly REAUTH_WAIT_MS;
|
|
2160
|
+
/**
|
|
2161
|
+
* Amount of time (in milliseconds) to wait before retrying a failed request.
|
|
2162
|
+
*/
|
|
2163
|
+
private static readonly RETRY_DELAY_MS;
|
|
2164
|
+
/**
|
|
2165
|
+
* Maximum number of retry attempts for failed requests.
|
|
2166
|
+
*/
|
|
2167
|
+
private static readonly MAX_RETRIES;
|
|
2156
2168
|
/**
|
|
2157
2169
|
* A map of active messages in "polling" mode.
|
|
2158
2170
|
* @remarks Equivalent to messaged being streamed in a WebSocket connection.
|
|
2159
2171
|
* @internal
|
|
2160
2172
|
*/
|
|
2161
2173
|
private streams;
|
|
2174
|
+
/**
|
|
2175
|
+
* Promise that tracks an ongoing session refresh to prevent concurrent refreshes from the same instance.
|
|
2176
|
+
* @internal
|
|
2177
|
+
*/
|
|
2178
|
+
private ongoingRefresh;
|
|
2162
2179
|
constructor(http: Http, messageBuilder: MessageBuilder, session: Session, metaCache: MetaCache, serializer: JSONSerializer, config: HttpConnectConfig);
|
|
2180
|
+
/**
|
|
2181
|
+
* Attempts to refresh the session when a 401 Unauthorized error is received.
|
|
2182
|
+
* Uses a lock mechanism to prevent multiple tabs from trying to reauthenticate simultaneously.
|
|
2183
|
+
* Also prevents concurrent refresh attempts from the same instance by reusing an ongoing refresh.
|
|
2184
|
+
* If another tab is handling the refresh, waits and retries once to verify the result.
|
|
2185
|
+
* @internal
|
|
2186
|
+
* @returns A Promise that resolves to `true` if session was refreshed successfully, `false` otherwise.
|
|
2187
|
+
*/
|
|
2188
|
+
private handleSessionRefresh;
|
|
2163
2189
|
/**
|
|
2164
2190
|
* Checks if the host is available by sending a heartbeat ping message and waiting for the response.
|
|
2165
2191
|
* @internal
|
|
@@ -2552,9 +2578,7 @@ export declare class DefaultSocket implements Socket {
|
|
|
2552
2578
|
* more info here https://docs.genesis.global/docs/develop/server-capabilities/access-control/authentication/#sessiontimeoutmins
|
|
2553
2579
|
*/
|
|
2554
2580
|
private handleExpiredSession;
|
|
2555
|
-
private static REAUTH_ACTION_LOCK_KEY;
|
|
2556
2581
|
private handleCookieBasedReauth;
|
|
2557
|
-
private onStorageEvent;
|
|
2558
2582
|
private updateSessionAndSubscriptions;
|
|
2559
2583
|
private prepareHeartbeat;
|
|
2560
2584
|
private reconnect;
|
|
@@ -3189,6 +3213,15 @@ declare interface HttpConnectConfig {
|
|
|
3189
3213
|
*/
|
|
3190
3214
|
declare const HttpConnectConfig: InterfaceSymbol<HttpConnectConfig>;
|
|
3191
3215
|
|
|
3216
|
+
/**
|
|
3217
|
+
* An error thrown when an HTTP request fails with a non-2xx status code.
|
|
3218
|
+
* @public
|
|
3219
|
+
*/
|
|
3220
|
+
export declare interface HttpError extends Error {
|
|
3221
|
+
status: number;
|
|
3222
|
+
message: string;
|
|
3223
|
+
}
|
|
3224
|
+
|
|
3192
3225
|
/**
|
|
3193
3226
|
* Configuration options for http connection.
|
|
3194
3227
|
* @public
|
|
@@ -4119,6 +4152,14 @@ export declare const NetworkMonitorConfig: InterfaceSymbol<NetworkMonitorConfig>
|
|
|
4119
4152
|
*/
|
|
4120
4153
|
export declare function normaliseCriteria(criteria: string, delimiter?: string): string;
|
|
4121
4154
|
|
|
4155
|
+
/**
|
|
4156
|
+
* Subscribes to storage events to detect when another tab has finished reauthenticating.
|
|
4157
|
+
* @public
|
|
4158
|
+
* @param callback - Called when the other tab finishes reauthentication
|
|
4159
|
+
* @returns A function to unsubscribe from the storage events
|
|
4160
|
+
*/
|
|
4161
|
+
export declare function onOtherTabReauthComplete(callback: () => void): () => void;
|
|
4162
|
+
|
|
4122
4163
|
/**
|
|
4123
4164
|
* @public
|
|
4124
4165
|
*/
|
|
@@ -4515,6 +4556,21 @@ export declare class SessionMock implements Session {
|
|
|
4515
4556
|
removeSessionStorageItem(key: string): void;
|
|
4516
4557
|
}
|
|
4517
4558
|
|
|
4559
|
+
/**
|
|
4560
|
+
* Result of a session refresh attempt.
|
|
4561
|
+
* @public
|
|
4562
|
+
*/
|
|
4563
|
+
export declare enum SessionRefreshResult {
|
|
4564
|
+
/** Session was successfully refreshed */
|
|
4565
|
+
SUCCESS = "SUCCESS",
|
|
4566
|
+
/** Refresh failed - page will reload */
|
|
4567
|
+
FAILED = "FAILED",
|
|
4568
|
+
/** Another tab is handling the refresh */
|
|
4569
|
+
HANDLED_BY_OTHER_TAB = "HANDLED_BY_OTHER_TAB",
|
|
4570
|
+
/** Session was already valid */
|
|
4571
|
+
ALREADY_VALID = "ALREADY_VALID"
|
|
4572
|
+
}
|
|
4573
|
+
|
|
4518
4574
|
/**
|
|
4519
4575
|
* Represents a WebSocket used to establish a communication channel between client and a Genesis server.
|
|
4520
4576
|
* Provides methods for socket connection, sending and receiving WS messages.
|
|
@@ -4563,7 +4619,7 @@ export declare type SocketConnectOptions = {
|
|
|
4563
4619
|
/**
|
|
4564
4620
|
* An observer to receive notifications of incoming messages from the server.
|
|
4565
4621
|
*/
|
|
4566
|
-
connectObserver?:
|
|
4622
|
+
connectObserver?: Observer<Message>;
|
|
4567
4623
|
/**
|
|
4568
4624
|
* Enable sending heartbeat messages to the server to prevent the connection from timing out.
|
|
4569
4625
|
*/
|
|
@@ -4698,7 +4754,7 @@ export declare type SocketReconnectOptions = {
|
|
|
4698
4754
|
* Observer to notify when reconnection occurs
|
|
4699
4755
|
* @public
|
|
4700
4756
|
*/
|
|
4701
|
-
reconnectObserver?:
|
|
4757
|
+
reconnectObserver?: Observer<any>;
|
|
4702
4758
|
/**
|
|
4703
4759
|
* Reconnect stream subscriptions on reconnection
|
|
4704
4760
|
* @public
|
|
@@ -4962,6 +5018,20 @@ export declare type SystemHealthStatus = {
|
|
|
4962
5018
|
*/
|
|
4963
5019
|
export declare const toFieldMetadata: (fieldDef: MetadataDetail[]) => FieldMetadata[];
|
|
4964
5020
|
|
|
5021
|
+
/**
|
|
5022
|
+
* Attempts to refresh the session when authentication has expired.
|
|
5023
|
+
* Uses a localStorage-based lock mechanism to prevent multiple tabs from
|
|
5024
|
+
* trying to reauthenticate simultaneously.
|
|
5025
|
+
*
|
|
5026
|
+
* @public
|
|
5027
|
+
* @param options - Optional configuration
|
|
5028
|
+
* @param options.reloadOnFailure - Whether to reload the page if refresh fails (default: true)
|
|
5029
|
+
* @returns The result of the refresh attempt
|
|
5030
|
+
*/
|
|
5031
|
+
export declare function tryRefreshSession(options?: {
|
|
5032
|
+
reloadOnFailure?: boolean;
|
|
5033
|
+
}): Promise<SessionRefreshResult>;
|
|
5034
|
+
|
|
4965
5035
|
/**
|
|
4966
5036
|
* Types map for FieldTypeEnum.
|
|
4967
5037
|
* @public
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@genesislcap/foundation-comms](./foundation-comms.md) > [HttpError](./foundation-comms.httperror.md)
|
|
4
|
+
|
|
5
|
+
## HttpError interface
|
|
6
|
+
|
|
7
|
+
An error thrown when an HTTP request fails with a non-2xx status code.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
export interface HttpError extends Error
|
|
13
|
+
```
|
|
14
|
+
**Extends:** Error
|
|
15
|
+
|
|
16
|
+
## Properties
|
|
17
|
+
|
|
18
|
+
<table><thead><tr><th>
|
|
19
|
+
|
|
20
|
+
Property
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
</th><th>
|
|
24
|
+
|
|
25
|
+
Modifiers
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
</th><th>
|
|
29
|
+
|
|
30
|
+
Type
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
</th><th>
|
|
34
|
+
|
|
35
|
+
Description
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
</th></tr></thead>
|
|
39
|
+
<tbody><tr><td>
|
|
40
|
+
|
|
41
|
+
[message](./foundation-comms.httperror.message.md)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
</td><td>
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
</td><td>
|
|
48
|
+
|
|
49
|
+
string
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
</td><td>
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
</td></tr>
|
|
56
|
+
<tr><td>
|
|
57
|
+
|
|
58
|
+
[status](./foundation-comms.httperror.status.md)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
</td><td>
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
</td><td>
|
|
65
|
+
|
|
66
|
+
number
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
</td><td>
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
</td></tr>
|
|
73
|
+
</tbody></table>
|
|
74
|
+
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@genesislcap/foundation-comms](./foundation-comms.md) > [HttpError](./foundation-comms.httperror.md) > [message](./foundation-comms.httperror.message.md)
|
|
4
|
+
|
|
5
|
+
## HttpError.message property
|
|
6
|
+
|
|
7
|
+
**Signature:**
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
message: string;
|
|
11
|
+
```
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@genesislcap/foundation-comms](./foundation-comms.md) > [HttpError](./foundation-comms.httperror.md) > [status](./foundation-comms.httperror.status.md)
|
|
4
|
+
|
|
5
|
+
## HttpError.status property
|
|
6
|
+
|
|
7
|
+
**Signature:**
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
status: number;
|
|
11
|
+
```
|
|
@@ -393,6 +393,17 @@ General Message types
|
|
|
393
393
|
Types of Genesis resources.
|
|
394
394
|
|
|
395
395
|
|
|
396
|
+
</td></tr>
|
|
397
|
+
<tr><td>
|
|
398
|
+
|
|
399
|
+
[SessionRefreshResult](./foundation-comms.sessionrefreshresult.md)
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
</td><td>
|
|
403
|
+
|
|
404
|
+
Result of a session refresh attempt.
|
|
405
|
+
|
|
406
|
+
|
|
396
407
|
</td></tr>
|
|
397
408
|
<tr><td>
|
|
398
409
|
|
|
@@ -584,6 +595,17 @@ Check if the provided message contains an error and throw an Error if it does
|
|
|
584
595
|
Normalise criteria.
|
|
585
596
|
|
|
586
597
|
|
|
598
|
+
</td></tr>
|
|
599
|
+
<tr><td>
|
|
600
|
+
|
|
601
|
+
[onOtherTabReauthComplete(callback)](./foundation-comms.onothertabreauthcomplete.md)
|
|
602
|
+
|
|
603
|
+
|
|
604
|
+
</td><td>
|
|
605
|
+
|
|
606
|
+
Subscribes to storage events to detect when another tab has finished reauthenticating.
|
|
607
|
+
|
|
608
|
+
|
|
587
609
|
</td></tr>
|
|
588
610
|
<tr><td>
|
|
589
611
|
|
|
@@ -606,6 +628,17 @@ Generate reconnect interval based on scheduler
|
|
|
606
628
|
Converts the field definitions to field metadata.
|
|
607
629
|
|
|
608
630
|
|
|
631
|
+
</td></tr>
|
|
632
|
+
<tr><td>
|
|
633
|
+
|
|
634
|
+
[tryRefreshSession(options)](./foundation-comms.tryrefreshsession.md)
|
|
635
|
+
|
|
636
|
+
|
|
637
|
+
</td><td>
|
|
638
|
+
|
|
639
|
+
Attempts to refresh the session when authentication has expired. Uses a localStorage-based lock mechanism to prevent multiple tabs from trying to reauthenticate simultaneously.
|
|
640
|
+
|
|
641
|
+
|
|
609
642
|
</td></tr>
|
|
610
643
|
<tr><td>
|
|
611
644
|
|
|
@@ -863,6 +896,17 @@ GenesisResourcesConfig DI interface.
|
|
|
863
896
|
An interface representing an HTTP client that can make GET and POST requests and return a promise with the response data.
|
|
864
897
|
|
|
865
898
|
|
|
899
|
+
</td></tr>
|
|
900
|
+
<tr><td>
|
|
901
|
+
|
|
902
|
+
[HttpError](./foundation-comms.httperror.md)
|
|
903
|
+
|
|
904
|
+
|
|
905
|
+
</td><td>
|
|
906
|
+
|
|
907
|
+
An error thrown when an HTTP request fails with a non-2xx status code.
|
|
908
|
+
|
|
909
|
+
|
|
866
910
|
</td></tr>
|
|
867
911
|
<tr><td>
|
|
868
912
|
|