@genesislcap/foundation-comms 14.184.0 → 14.186.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/auth/auth.types.d.ts +1 -1
- package/dist/dts/auth/auth.types.d.ts.map +1 -1
- package/dist/dts/connect/connect.d.ts +14 -6
- package/dist/dts/connect/connect.d.ts.map +1 -1
- package/dist/dts/connect/connect.events.d.ts +28 -2
- package/dist/dts/connect/connect.events.d.ts.map +1 -1
- package/dist/dts/connect/connect.types.d.ts +5 -52
- package/dist/dts/connect/connect.types.d.ts.map +1 -1
- package/dist/dts/connect/http.connect.d.ts +4 -8
- package/dist/dts/connect/http.connect.d.ts.map +1 -1
- package/dist/dts/connect/http.connect.types.d.ts +62 -0
- package/dist/dts/connect/http.connect.types.d.ts.map +1 -0
- package/dist/dts/connect/index.d.ts +1 -0
- package/dist/dts/connect/index.d.ts.map +1 -1
- package/dist/dts/connect/message.d.ts +6 -2
- package/dist/dts/connect/message.d.ts.map +1 -1
- package/dist/dts/connect/socket.d.ts +3 -56
- package/dist/dts/connect/socket.d.ts.map +1 -1
- package/dist/dts/connect/socket.types.d.ts +57 -0
- package/dist/dts/connect/socket.types.d.ts.map +1 -0
- package/dist/dts/connect/updateState.d.ts +3 -0
- package/dist/dts/connect/updateState.d.ts.map +1 -0
- package/dist/dts/networkMonitor/service.d.ts.map +1 -1
- package/dist/dts/testing/mocks/auth/auth.d.ts +1 -1
- package/dist/dts/testing/mocks/auth/auth.d.ts.map +1 -1
- package/dist/dts/testing/mocks/connect/connect.d.ts +3 -1
- package/dist/dts/testing/mocks/connect/connect.d.ts.map +1 -1
- package/dist/dts/testing/mocks/connect/socket.d.ts +1 -1
- package/dist/dts/testing/mocks/connect/socket.d.ts.map +1 -1
- package/dist/dts/testing/mocks/datasource/datasource.d.ts +1 -1
- package/dist/dts/testing/mocks/datasource/datasource.d.ts.map +1 -1
- package/dist/esm/connect/connect.events.js +21 -2
- package/dist/esm/connect/connect.js +26 -28
- package/dist/esm/connect/connect.types.js +21 -5
- package/dist/esm/connect/http.connect.js +11 -23
- package/dist/esm/connect/http.connect.types.js +24 -0
- package/dist/esm/connect/index.js +1 -0
- package/dist/esm/connect/message.js +3 -2
- package/dist/esm/connect/socket.js +10 -5
- package/dist/esm/connect/socket.types.js +1 -0
- package/dist/esm/connect/updateState.js +26 -0
- package/dist/esm/networkMonitor/service.js +18 -8
- package/dist/esm/testing/mocks/connect/connect.js +3 -0
- package/dist/esm/testing/mocks/connect/socket.js +1 -1
- package/dist/foundation-comms.api.json +823 -384
- package/dist/foundation-comms.d.ts +63 -16
- package/docs/api/foundation-comms.connect.md +1 -0
- package/docs/api/foundation-comms.connect.streamstate.md +30 -0
- package/docs/api/foundation-comms.connectconfig.iswebsocketexpression.md +13 -0
- package/docs/api/foundation-comms.connectconfig.md +1 -0
- package/docs/api/foundation-comms.connectevents.addstreamlistener.md +2 -1
- package/docs/api/foundation-comms.connectevents.md +1 -1
- package/docs/api/foundation-comms.connecteventsemitter.md +1 -0
- package/docs/api/foundation-comms.connecteventsemitter.onstreamerrorevent.md +26 -0
- package/docs/api/foundation-comms.defaultconnect._constructor_.md +2 -2
- package/docs/api/foundation-comms.defaultconnect.md +1 -0
- package/docs/api/foundation-comms.defaultconnect.streamstate.md +26 -0
- package/docs/api/foundation-comms.defaultconnectevents.addstreamlistener.md +2 -1
- package/docs/api/foundation-comms.defaultconnectevents.md +2 -1
- package/docs/api/foundation-comms.defaultconnectevents.onstreamerrorevent.md +26 -0
- package/docs/api/foundation-comms.defaulthttpconnect._constructor_.md +2 -2
- package/docs/api/foundation-comms.defaulthttpconnect.md +1 -0
- package/docs/api/foundation-comms.defaulthttpconnect.streamstate.md +26 -0
- package/docs/api/foundation-comms.md +3 -4
- package/docs/api/foundation-comms.pingmessage.md +1 -1
- package/docs/api/foundation-comms.streamerrorevent.md +14 -0
- package/docs/api/foundation-comms.streamerroreventdetail.md +16 -0
- package/docs/api/foundation-comms.streamerroreventtype.md +12 -0
- package/docs/api-report.md +36 -38
- package/package.json +21 -13
- package/docs/api/foundation-comms.defaulthttpconnectconfig.md +0 -13
- package/docs/api/foundation-comms.httpconnectconfig.md +0 -20
- package/docs/api/foundation-comms.httpconnectconfig.polling.md +0 -13
- package/docs/api/foundation-comms.httppollingconfig.md +0 -22
- package/docs/api/foundation-comms.httppollingconfig.polling_frequency.md +0 -13
- package/docs/api/foundation-comms.httppollingconfig.polling_interval_map.md +0 -15
- package/docs/api/foundation-comms.httppollingconfig.polling_map.md +0 -15
- package/docs/api/foundation-comms.pollingconfiguration.amount_of_polls.md +0 -18
- package/docs/api/foundation-comms.pollingconfiguration.md +0 -22
- package/docs/api/foundation-comms.pollingconfiguration.queries.md +0 -13
- package/docs/api/foundation-comms.pollingconfiguration.temp_frequency.md +0 -13
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../src/networkMonitor/service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AAOpD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAG1D,OAAO,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAChF,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,EACL,iBAAiB,EAEjB,yBAAyB,EACzB,cAAc,EAEd,kBAAkB,EACnB,MAAM,SAAS,CAAC;AAEjB;;GAEG;AACH,eAAO,MAAM,aAAa,iDAA4D,CAAC;AAiCvF;;;;;;;GAOG;AACH,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,kBAAkB,CAAC;IAC3B,MAAM,IAAI,IAAI,CAAC;IACf,OAAO,IAAI,IAAI,CAAC;IAChB;;;OAGG;IACH,YAAY,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,C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,cAAc,sEAE1B,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,IAAI,cAAc,CAElD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../../../src/testing/mocks/auth/auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AAEzD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../../../src/testing/mocks/auth/auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AAEzD,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAE3E;;GAEG;AACH,qBAAa,QAAS,YAAW,IAAI;IACvB,SAAS,UAAS;IAClB,gBAAgB,EAAE,WAAW,CAAQ;IACrC,WAAW,EAAE,IAAI,CAAQ;IACzB,UAAU,EAAE,OAAO,CAAS;IAExC,eAAe,EAAE,WAAW,CAAC;IAC7B,gBAAgB,EAAE,YAAY,CAAC;IAC/B,gBAAgB,EAAE,OAAO,CAAC;IAEpB,KAAK,CAAC,WAAW,EAAE,QAAQ,GAAG,OAAO,CAAC,WAAW,CAAC;IAIlD,MAAM,IAAI,OAAO,CAAC,YAAY,CAAC;IAI/B,iBAAiB,IAAI,OAAO,CAAC,OAAO,CAAC;CAG5C"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BehaviorSubject, Observable } from 'rxjs';
|
|
2
|
-
import { CommitParams, Connect, Message, Metadata, RequestParams, SocketMock, SocketObservable } from '../../../';
|
|
2
|
+
import type { CommitParams, Connect, Message, Metadata, RequestParams, SocketMock, SocketObservable } from '../../../';
|
|
3
3
|
/**
|
|
4
4
|
* @internal
|
|
5
5
|
*/
|
|
@@ -16,6 +16,7 @@ export declare class ConnectMock implements Connect {
|
|
|
16
16
|
nextJSONSchema: any;
|
|
17
17
|
nextMessage: Message;
|
|
18
18
|
requestParams: RequestParams;
|
|
19
|
+
nextListState: any[];
|
|
19
20
|
commitEvent(eventName: string, params?: CommitParams): Promise<Message>;
|
|
20
21
|
connect(host: string): Promise<boolean>;
|
|
21
22
|
disconnect(): void;
|
|
@@ -24,6 +25,7 @@ export declare class ConnectMock implements Connect {
|
|
|
24
25
|
getAvailableResources(params?: RequestParams): Promise<Message>;
|
|
25
26
|
snapshot(resourceName: string, params?: any): Promise<Message>;
|
|
26
27
|
stream(resourceName: string, onMessage: Function, onError: Function, params?: any): SocketObservable<Message>;
|
|
28
|
+
streamState(resourceName: string, onMessage: Function, onError: Function, params?: any, initialState?: any[]): Observable<any[]>;
|
|
27
29
|
streamWithoutAutoTeardown(resourceName: string, onMessage: Function, onError: Function, params?: any): SocketObservable<Message>;
|
|
28
30
|
getMoreRows(sourceRef: string): Promise<Message<any>>;
|
|
29
31
|
getMoreColumns(sourceRef: string): Promise<Message<any>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connect.d.ts","sourceRoot":"","sources":["../../../../../src/testing/mocks/connect/connect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAQ,UAAU,EAAE,MAAM,MAAM,CAAC;AACzD,OAAO,
|
|
1
|
+
{"version":3,"file":"connect.d.ts","sourceRoot":"","sources":["../../../../../src/testing/mocks/connect/connect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAQ,UAAU,EAAE,MAAM,MAAM,CAAC;AACzD,OAAO,KAAK,EACV,YAAY,EACZ,OAAO,EACP,OAAO,EACP,QAAQ,EACR,aAAa,EACb,UAAU,EACV,gBAAgB,EACjB,MAAM,WAAW,CAAC;AAEnB;;GAEG;AACH,qBAAa,WAAY,YAAW,OAAO;IACzC,WAAW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;IAI5B,WAAW,CACT,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,QAAQ,EACnB,OAAO,EAAE,QAAQ,EACjB,MAAM,CAAC,EAAE,GAAG,EACZ,YAAY,CAAC,EAAE,GAAG,EAAE,GACnB,UAAU,CAAC,GAAG,EAAE,CAAC;IAIpB,yBAAyB,CACvB,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,QAAQ,EACnB,OAAO,EAAE,QAAQ,EACjB,MAAM,CAAC,EAAE,GAAG,GACX,gBAAgB,CAAC,OAAO,CAAC;IAI5B,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAIrD,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAIxD,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAIpD,aAAa,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;CAGlD"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BehaviorSubject, Observable } from 'rxjs';
|
|
2
2
|
import type { Message, Socket, SocketConnectOptions, SocketReconnectOptions } from '../../../connect';
|
|
3
|
-
import { SocketSubject } from '../../../connect';
|
|
3
|
+
import { SocketSubject } from '../../../connect/socket';
|
|
4
4
|
/**
|
|
5
5
|
* @internal
|
|
6
6
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"socket.d.ts","sourceRoot":"","sources":["../../../../../src/testing/mocks/connect/socket.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAQ,UAAU,EAAE,MAAM,MAAM,CAAC;AACzD,OAAO,KAAK,EACV,OAAO,EACP,MAAM,EACN,oBAAoB,EACpB,sBAAsB,EACvB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,
|
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AU,CAAC,OAAO,CAAC;IAIf,cAAc,IAAI,aAAa,CAAC,OAAO,CAAC;IAI/C,KAAK,IAAI,IAAI;CAGd"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SocketObservable } from '../../../connect';
|
|
2
|
-
import { Datasource, DatasourceOptions, Dataview, ResourceType } from '../../../datasource';
|
|
2
|
+
import type { Datasource, DatasourceOptions, Dataview, ResourceType } from '../../../datasource';
|
|
3
3
|
import { FieldMetadata, FilteredDataServerResult, RequestServerResult } from '../../../metadata';
|
|
4
4
|
/**
|
|
5
5
|
* @internal
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"datasource.d.ts","sourceRoot":"","sources":["../../../../../src/testing/mocks/datasource/datasource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"datasource.d.ts","sourceRoot":"","sources":["../../../../../src/testing/mocks/datasource/datasource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACjG,OAAO,EAAE,aAAa,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAEjG;;GAEG;AACH,qBAAa,cAAe,YAAW,UAAU;IAC/C,WAAW,EAAE,OAAO,CAAC;IACrB,aAAa,EAAE,aAAa,EAAE,CAAC;IAC/B,QAAQ,EAAE,OAAO,CAAC;IAClB,YAAY,EAAE,YAAY,CAAC;IAC3B,MAAM,EAAE,gBAAgB,CAAC,wBAAwB,GAAG,mBAAmB,CAAC,CAAC;IAEzE,IAAI,CAAC,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAItE,MAAM;IAEN,OAAO;IAEP,iBAAiB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO;IAMhD,WAAW,CAAC,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAI5D,QAAQ,CAAC,MAAM,CAAC,EAAE,GAAG;IAErB,gBAAgB,CAAC,KAAK,CAAC,EAAE,MAAM;IAE/B,UAAU,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAIvC,WAAW,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,GAAG,EAAE;IAIhC,OAAO,CAAC,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI;IAE9B,QAAQ,CAAC,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI;IAE/B,SAAS,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIlE,WAAW,CAAC,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIzC,UAAU,CAAC,CAAC,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC;IAIvC,UAAU,CAAC,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI1C,UAAU,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;CAGtD"}
|
|
@@ -8,6 +8,10 @@ export const CommitEventType = 'connect-commit-event';
|
|
|
8
8
|
* @public
|
|
9
9
|
*/
|
|
10
10
|
export const StreamEventType = 'connect-stream-event';
|
|
11
|
+
/**
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
export const StreamErrorEventType = 'connect-stream-error-event';
|
|
11
15
|
/**
|
|
12
16
|
* @public
|
|
13
17
|
*/
|
|
@@ -27,18 +31,22 @@ export class DefaultConnectEvents {
|
|
|
27
31
|
/** @internal */
|
|
28
32
|
this.streamCompleteListeners = createObserver();
|
|
29
33
|
/** @internal */
|
|
34
|
+
this.streamErrorListeners = createObserver();
|
|
35
|
+
/** @internal */
|
|
30
36
|
this.commitListeners = createObserver();
|
|
31
37
|
/** @internal */
|
|
32
38
|
this.metadataListeners = createObserver();
|
|
33
39
|
}
|
|
34
40
|
/** {@inheritDoc ConnectEvents.addStreamListener} */
|
|
35
|
-
addStreamListener(listener, complete) {
|
|
36
|
-
var _a, _b;
|
|
41
|
+
addStreamListener(listener, complete, error) {
|
|
42
|
+
var _a, _b, _c;
|
|
37
43
|
const unsubscribe = (_a = this.streamListeners) === null || _a === void 0 ? void 0 : _a.subscribe(listener);
|
|
38
44
|
const completeUnsubscribe = (_b = this.streamCompleteListeners) === null || _b === void 0 ? void 0 : _b.subscribe(complete);
|
|
45
|
+
const errorUnsubscribe = (_c = this.streamErrorListeners) === null || _c === void 0 ? void 0 : _c.subscribe(error);
|
|
39
46
|
return () => {
|
|
40
47
|
unsubscribe();
|
|
41
48
|
completeUnsubscribe();
|
|
49
|
+
errorUnsubscribe();
|
|
42
50
|
};
|
|
43
51
|
}
|
|
44
52
|
/** {@inheritDoc ConnectEventsEmitter.onStreamEvent} */
|
|
@@ -53,6 +61,17 @@ export class DefaultConnectEvents {
|
|
|
53
61
|
},
|
|
54
62
|
}));
|
|
55
63
|
}
|
|
64
|
+
/** {@inheritDoc ConnectEventsEmitter.onStreamErrorEvent} */
|
|
65
|
+
onStreamErrorEvent(resourceName, stream, error) {
|
|
66
|
+
var _a;
|
|
67
|
+
(_a = this.streamErrorListeners) === null || _a === void 0 ? void 0 : _a.publish(new CustomEvent(StreamErrorEventType, {
|
|
68
|
+
detail: {
|
|
69
|
+
resourceName,
|
|
70
|
+
stream,
|
|
71
|
+
error,
|
|
72
|
+
},
|
|
73
|
+
}));
|
|
74
|
+
}
|
|
56
75
|
/** {@inheritDoc ConnectEventsEmitter.onStreamCompleteEvent} */
|
|
57
76
|
onStreamCompleteEvent(resourceName, stream) {
|
|
58
77
|
var _a;
|
|
@@ -1,33 +1,16 @@
|
|
|
1
1
|
import { __awaiter, __decorate, __param } from "tslib";
|
|
2
2
|
import { FORCE_HTTP } from '@genesislcap/foundation-utils';
|
|
3
3
|
import { observable, volatile } from '@microsoft/fast-element';
|
|
4
|
-
import { DI
|
|
4
|
+
import { DI } from '@microsoft/fast-foundation';
|
|
5
|
+
import { scan } from 'rxjs';
|
|
5
6
|
import { MetaCache } from '../metadata';
|
|
6
|
-
import {
|
|
7
|
+
import { logger } from '../utils';
|
|
7
8
|
import { ConnectEventsEmitter } from './connect.events';
|
|
8
9
|
import { ConnectConfig } from './connect.types';
|
|
9
10
|
import { HttpConnect } from './http.connect';
|
|
10
11
|
import { EventMessageType, MessageBuilder } from './message';
|
|
11
12
|
import { Socket } from './socket';
|
|
12
|
-
|
|
13
|
-
* The default configuration for connecting to a WS service.
|
|
14
|
-
* @public
|
|
15
|
-
*/
|
|
16
|
-
export const defaultConnectConfig = {
|
|
17
|
-
connect: {
|
|
18
|
-
alwaysOn: false,
|
|
19
|
-
enableHeartbeat: true,
|
|
20
|
-
enableHeartbeatLogging: false,
|
|
21
|
-
heartbeatInterval: 10000,
|
|
22
|
-
verboseHeartbeat: false,
|
|
23
|
-
enableMessageLogging: false,
|
|
24
|
-
},
|
|
25
|
-
reconnect: {
|
|
26
|
-
reconnectAttempts: 10,
|
|
27
|
-
reconnectInterval: 10000,
|
|
28
|
-
reconnectStreams: true,
|
|
29
|
-
},
|
|
30
|
-
};
|
|
13
|
+
import { updateState } from './updateState';
|
|
31
14
|
/**
|
|
32
15
|
* The default implementation for the Connect interface (WS-only).
|
|
33
16
|
* @public
|
|
@@ -43,7 +26,7 @@ let DefaultConnect = class DefaultConnect {
|
|
|
43
26
|
var _a;
|
|
44
27
|
return (_a = this.socket.isConnectedSubject) === null || _a === void 0 ? void 0 : _a.asObservable();
|
|
45
28
|
}
|
|
46
|
-
constructor(socket, messageBuilder, metaCache, events, config
|
|
29
|
+
constructor(socket, messageBuilder, metaCache, events, config) {
|
|
47
30
|
this.socket = socket;
|
|
48
31
|
this.messageBuilder = messageBuilder;
|
|
49
32
|
this.metaCache = metaCache;
|
|
@@ -66,7 +49,7 @@ let DefaultConnect = class DefaultConnect {
|
|
|
66
49
|
connect(host) {
|
|
67
50
|
return __awaiter(this, void 0, void 0, function* () {
|
|
68
51
|
this.socket.reset();
|
|
69
|
-
if (!isWebSocketExpression.test(host)) {
|
|
52
|
+
if (!this.config.isWebSocketExpression.test(host)) {
|
|
70
53
|
logger.error(`Specified host (${host}) is not valid WebSocket url. Connection will not proceed.`);
|
|
71
54
|
logger.warn(`Make sure the host url starts with wss:// or ws://`);
|
|
72
55
|
return;
|
|
@@ -87,7 +70,10 @@ let DefaultConnect = class DefaultConnect {
|
|
|
87
70
|
stream(resourceName, onMessage, onError, params) {
|
|
88
71
|
const msg = this.messageBuilder.createDataLogonMessage(resourceName, params);
|
|
89
72
|
logger.debug(`${msg.MESSAGE_TYPE} (stream) message created -> `, msg);
|
|
90
|
-
const resource = this.socket.sendForStream(msg, onMessage,
|
|
73
|
+
const resource = this.socket.sendForStream(msg, onMessage, (error) => {
|
|
74
|
+
onError(error);
|
|
75
|
+
this.events.onStreamErrorEvent(resourceName, resource, error);
|
|
76
|
+
}, () => {
|
|
91
77
|
this.events.onStreamCompleteEvent(resourceName, resource);
|
|
92
78
|
});
|
|
93
79
|
this.events.onStreamEvent(resourceName, msg, resource, {
|
|
@@ -96,10 +82,22 @@ let DefaultConnect = class DefaultConnect {
|
|
|
96
82
|
});
|
|
97
83
|
return resource;
|
|
98
84
|
}
|
|
85
|
+
streamState(resourceName, onMessage = () => { }, onError = () => { }, params, initialState = []) {
|
|
86
|
+
return this.stream(resourceName, onMessage, onError, params).pipe(scan(updateState, initialState));
|
|
87
|
+
}
|
|
99
88
|
streamWithoutAutoTeardown(resourceName, onMessage, onError, params) {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
89
|
+
logger.deprecated('streamWithoutAutoTeardown', `Please use 'stream' api instead.`, '15.0.0');
|
|
90
|
+
const msg = this.messageBuilder.createDataLogonMessage(resourceName, params);
|
|
91
|
+
logger.debug(`${msg.MESSAGE_TYPE} (stream without auto-teardown) message created -> `, msg);
|
|
92
|
+
const resource = this.socket.sendForStreamWithoutTeardown(msg, onMessage, (error) => {
|
|
93
|
+
onError(error);
|
|
94
|
+
this.events.onStreamErrorEvent(resourceName, resource, error);
|
|
95
|
+
});
|
|
96
|
+
this.events.onStreamEvent(resourceName, msg, resource, {
|
|
97
|
+
onMessage,
|
|
98
|
+
onError,
|
|
99
|
+
});
|
|
100
|
+
return resource;
|
|
103
101
|
}
|
|
104
102
|
getMoreRows(sourceRef) {
|
|
105
103
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -213,7 +211,7 @@ DefaultConnect = __decorate([
|
|
|
213
211
|
__param(1, MessageBuilder),
|
|
214
212
|
__param(2, MetaCache),
|
|
215
213
|
__param(3, ConnectEventsEmitter),
|
|
216
|
-
__param(4,
|
|
214
|
+
__param(4, ConnectConfig)
|
|
217
215
|
], DefaultConnect);
|
|
218
216
|
export { DefaultConnect };
|
|
219
217
|
const useHttpConnect = FORCE_HTTP === 'true' || false;
|
|
@@ -1,11 +1,27 @@
|
|
|
1
1
|
import { DI } from '@microsoft/fast-foundation';
|
|
2
|
+
import { isWebSocketExpression } from '../utils';
|
|
2
3
|
/**
|
|
3
|
-
*
|
|
4
|
-
* @
|
|
4
|
+
* The default configuration for connecting to a WS service.
|
|
5
|
+
* @public
|
|
5
6
|
*/
|
|
6
|
-
export const
|
|
7
|
+
export const defaultConnectConfig = {
|
|
8
|
+
connect: {
|
|
9
|
+
alwaysOn: false,
|
|
10
|
+
enableHeartbeat: true,
|
|
11
|
+
enableHeartbeatLogging: false,
|
|
12
|
+
heartbeatInterval: 10000,
|
|
13
|
+
verboseHeartbeat: false,
|
|
14
|
+
enableMessageLogging: false,
|
|
15
|
+
},
|
|
16
|
+
reconnect: {
|
|
17
|
+
reconnectAttempts: 10,
|
|
18
|
+
reconnectInterval: 10000,
|
|
19
|
+
reconnectStreams: true,
|
|
20
|
+
},
|
|
21
|
+
isWebSocketExpression,
|
|
22
|
+
};
|
|
7
23
|
/**
|
|
8
|
-
* Configuration options for the Connect (
|
|
24
|
+
* Configuration options for the Connect (WS) instance.
|
|
9
25
|
* @internal
|
|
10
26
|
*/
|
|
11
|
-
export const
|
|
27
|
+
export const ConnectConfig = DI.createInterface((x) => x.instance(defaultConnectConfig));
|
|
@@ -1,31 +1,15 @@
|
|
|
1
1
|
import { __awaiter, __decorate, __param } from "tslib";
|
|
2
|
-
import {
|
|
2
|
+
import { JSONSerializer } from '@genesislcap/foundation-utils';
|
|
3
3
|
import { observable, volatile } from '@microsoft/fast-element';
|
|
4
|
-
import { DI
|
|
5
|
-
import { BehaviorSubject, concat, finalize, from, interval, switchMap, takeWhile, } from 'rxjs';
|
|
4
|
+
import { DI } from '@microsoft/fast-foundation';
|
|
5
|
+
import { BehaviorSubject, concat, finalize, from, interval, scan, switchMap, takeWhile, } from 'rxjs';
|
|
6
6
|
import { MetaCache } from '../metadata';
|
|
7
7
|
import { Session } from '../session';
|
|
8
8
|
import { logger } from '../utils';
|
|
9
|
-
import { HttpConnectConfig } from './connect.types';
|
|
10
9
|
import { Http } from './http';
|
|
10
|
+
import { HttpConnectConfig } from './http.connect.types';
|
|
11
11
|
import { EventMessageType, MessageBuilder, MessageType, } from './message';
|
|
12
|
-
|
|
13
|
-
* The default configuration for connecting to an HTTP service.
|
|
14
|
-
* @public
|
|
15
|
-
*/
|
|
16
|
-
export const defaultHttpConnectConfig = {
|
|
17
|
-
polling: Object.assign({ POLLING_MAP: {
|
|
18
|
-
EVENT_AMEND_USER: {
|
|
19
|
-
TEMP_FREQUENCY: 500,
|
|
20
|
-
AMOUNT_OF_POLLS: 5,
|
|
21
|
-
QUERIES: ['ALL_USERS'],
|
|
22
|
-
},
|
|
23
|
-
}, POLLING_INTERVAL_MAP: {
|
|
24
|
-
ALL_TRADES: 5000,
|
|
25
|
-
ALL_USERS: 5000,
|
|
26
|
-
ALL_PROCESSES_STATUS: 10000,
|
|
27
|
-
}, POLLING_FREQUENCY: 5000 }, (HTTP_CONFIG && HTTP_CONFIG.length ? JSON.parse(HTTP_CONFIG) : {})),
|
|
28
|
-
};
|
|
12
|
+
import { updateState } from './updateState';
|
|
29
13
|
/**
|
|
30
14
|
* The default implementation for the Connect interface (HTTP-only).
|
|
31
15
|
* @public
|
|
@@ -38,7 +22,7 @@ let DefaultHttpConnect = class DefaultHttpConnect {
|
|
|
38
22
|
this._isConnected = value;
|
|
39
23
|
this.isConnectedSubject.next(this._isConnected);
|
|
40
24
|
}
|
|
41
|
-
constructor(http, messageBuilder, session, metaCache, serializer, config
|
|
25
|
+
constructor(http, messageBuilder, session, metaCache, serializer, config) {
|
|
42
26
|
var _a;
|
|
43
27
|
this.http = http;
|
|
44
28
|
this.messageBuilder = messageBuilder;
|
|
@@ -148,7 +132,11 @@ let DefaultHttpConnect = class DefaultHttpConnect {
|
|
|
148
132
|
this.streams.get(SOURCE_REF).STREAM = stream;
|
|
149
133
|
return stream;
|
|
150
134
|
}
|
|
135
|
+
streamState(resourceName, onMessage = () => { }, onError = () => { }, params, initialState = []) {
|
|
136
|
+
return this.stream(resourceName, onMessage, onError, params).pipe(scan(updateState, initialState));
|
|
137
|
+
}
|
|
151
138
|
streamWithoutAutoTeardown(resourceName, onMessage, onError, params) {
|
|
139
|
+
logger.deprecated('streamWithoutAutoTeardown', `Please use 'stream' api instead.`, '15.0.0');
|
|
152
140
|
return this.stream(resourceName, onMessage, onError, params);
|
|
153
141
|
}
|
|
154
142
|
getMessage(message) {
|
|
@@ -314,7 +302,7 @@ DefaultHttpConnect = __decorate([
|
|
|
314
302
|
__param(2, Session),
|
|
315
303
|
__param(3, MetaCache),
|
|
316
304
|
__param(4, JSONSerializer),
|
|
317
|
-
__param(5,
|
|
305
|
+
__param(5, HttpConnectConfig)
|
|
318
306
|
], DefaultHttpConnect);
|
|
319
307
|
export { DefaultHttpConnect };
|
|
320
308
|
/**
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { HTTP_CONFIG } from '@genesislcap/foundation-utils';
|
|
2
|
+
import { DI } from '@microsoft/fast-foundation';
|
|
3
|
+
/**
|
|
4
|
+
* The default configuration for connecting to an HTTP service.
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export const defaultHttpConnectConfig = {
|
|
8
|
+
polling: Object.assign({ POLLING_MAP: {
|
|
9
|
+
EVENT_AMEND_USER: {
|
|
10
|
+
TEMP_FREQUENCY: 500,
|
|
11
|
+
AMOUNT_OF_POLLS: 5,
|
|
12
|
+
QUERIES: ['ALL_USERS'],
|
|
13
|
+
},
|
|
14
|
+
}, POLLING_INTERVAL_MAP: {
|
|
15
|
+
ALL_TRADES: 5000,
|
|
16
|
+
ALL_USERS: 5000,
|
|
17
|
+
ALL_PROCESSES_STATUS: 10000,
|
|
18
|
+
}, POLLING_FREQUENCY: 5000 }, (HTTP_CONFIG && HTTP_CONFIG.length ? JSON.parse(HTTP_CONFIG) : {})),
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Configuration options for the Connect (HTTP) instance.
|
|
22
|
+
* @internal
|
|
23
|
+
*/
|
|
24
|
+
export const HttpConnectConfig = DI.createInterface((x) => x.instance(defaultHttpConnectConfig));
|
|
@@ -67,12 +67,12 @@ export const messageOrThrow = (message) => {
|
|
|
67
67
|
/**
|
|
68
68
|
* Check if the message contains an error code.
|
|
69
69
|
* @param message - The message object.
|
|
70
|
-
* @param code - The error code.
|
|
70
|
+
* @param code - The error code. Either a {@link http-status-codes#StatusCodes | StatusCodes} number or an entire status code string.
|
|
71
71
|
* @public
|
|
72
72
|
*/
|
|
73
73
|
export const messageHasErrorCode = (message, code) => {
|
|
74
74
|
return Array.isArray(message === null || message === void 0 ? void 0 : message.ERROR)
|
|
75
|
-
? message === null || message === void 0 ? void 0 : message.ERROR.some((error) => error.CODE === code)
|
|
75
|
+
? message === null || message === void 0 ? void 0 : message.ERROR.some((error) => { var _a, _b; return ((_a = error.CODE) === null || _a === void 0 ? void 0 : _a.includes(`${code}`)) || ((_b = error.STATUS_CODE) === null || _b === void 0 ? void 0 : _b.includes(`${code}`)); })
|
|
76
76
|
: false;
|
|
77
77
|
};
|
|
78
78
|
/**
|
|
@@ -248,6 +248,7 @@ let DefaultMessageBuilder = class DefaultMessageBuilder {
|
|
|
248
248
|
SOURCE_REF: this.uuid.createId(),
|
|
249
249
|
VERBOSE: verbose,
|
|
250
250
|
DETAILS: {},
|
|
251
|
+
SESSION_AUTH_TOKEN: this.session.getSessionStorageItem('authToken'),
|
|
251
252
|
};
|
|
252
253
|
}
|
|
253
254
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __awaiter, __decorate, __param } from "tslib";
|
|
2
2
|
import { User } from '@genesislcap/foundation-user';
|
|
3
3
|
import { JSONSerializer, UUID } from '@genesislcap/foundation-utils';
|
|
4
|
-
import { observable } from '@microsoft/fast-element';
|
|
4
|
+
import { DOM, observable } from '@microsoft/fast-element';
|
|
5
5
|
import { DI } from '@microsoft/fast-foundation';
|
|
6
6
|
import { Observable, of, Subject, Subscription, takeUntil, throwError } from 'rxjs';
|
|
7
7
|
import { filter, mergeMap, switchMap, takeWhile } from 'rxjs/operators';
|
|
@@ -291,6 +291,9 @@ let DefaultSocket = class DefaultSocket {
|
|
|
291
291
|
}
|
|
292
292
|
this.heartbeatIsEnabled =
|
|
293
293
|
pong.MESSAGE_TYPE === MessageType.HEARTBEAT_PONG && pong.SOURCE_REF === ping.SOURCE_REF;
|
|
294
|
+
if (pong.IS_AUTHENTICATED !== undefined) {
|
|
295
|
+
this.hasValidSession = pong.IS_AUTHENTICATED;
|
|
296
|
+
}
|
|
294
297
|
});
|
|
295
298
|
if ((_b = (_a = this.connectOptions) === null || _a === void 0 ? void 0 : _a.enableHeartbeat) !== null && _b !== void 0 ? _b : this.heartbeatIsEnabled) {
|
|
296
299
|
const intervalInMillisecocnds = (_d = (_c = this.connectOptions) === null || _c === void 0 ? void 0 : _c.heartbeatInterval) !== null && _d !== void 0 ? _d : this.heartbeatInterval;
|
|
@@ -394,7 +397,12 @@ let DefaultSocket = class DefaultSocket {
|
|
|
394
397
|
const sendingMessageLog = `Sending Message (stream) for SourceRef: ${message.SOURCE_REF} | MessageType: ${message.MESSAGE_TYPE}`;
|
|
395
398
|
this.logMessageTypeFlow(message.MESSAGE_TYPE, logger.info, sendingMessageLog);
|
|
396
399
|
this.setMessageHandler(message, onMessage, onError, true);
|
|
397
|
-
|
|
400
|
+
/**
|
|
401
|
+
* We need to queue these outgoing messages to allow the consumers to subscribe in time. We should review the entire
|
|
402
|
+
* setup with late subscribers in mind, as we can't say when they will actually subscribe. The impact is grids and
|
|
403
|
+
* other components remaining stuck on Loading screens, as they miss the first `onMessage` reply.
|
|
404
|
+
*/
|
|
405
|
+
DOM.queueUpdate(() => this.websocket.next(message));
|
|
398
406
|
/**
|
|
399
407
|
* @privateRemarks
|
|
400
408
|
* Running the data logoff from here makes more sense given the network monitor actor is optionally added.
|
|
@@ -438,9 +446,6 @@ let DefaultSocket = class DefaultSocket {
|
|
|
438
446
|
this.wsMessageHandlers.set(message.SOURCE_REF, new SocketMessageHandler(message, onMessage, onError, isSubscription));
|
|
439
447
|
}
|
|
440
448
|
sendDataLogoff(sourceRef) {
|
|
441
|
-
if (this.user.isAnonymous) {
|
|
442
|
-
return;
|
|
443
|
-
}
|
|
444
449
|
this.send(this.messageBuilder.createDataLogoffMessage(sourceRef), false);
|
|
445
450
|
}
|
|
446
451
|
removeMessageHandler(sourceRef) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export const updateState = (state, update) => {
|
|
2
|
+
if ((update === null || update === void 0 ? void 0 : update.ROW) && state && state.length > 0) {
|
|
3
|
+
update.ROW.forEach((row) => {
|
|
4
|
+
const eventData = row;
|
|
5
|
+
if (eventData && eventData.DETAILS) {
|
|
6
|
+
const ref = eventData.DETAILS.ROW_REF;
|
|
7
|
+
const type = eventData.DETAILS.OPERATION;
|
|
8
|
+
if (type === 'INSERT') {
|
|
9
|
+
if (!state.find((x) => { var _a; return ((_a = x.DETAILS) === null || _a === void 0 ? void 0 : _a.ROW_REF) === ref; })) {
|
|
10
|
+
state.unshift(eventData);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
if (type === 'DELETE') {
|
|
14
|
+
state = state.filter((x) => { var _a, _b; return ((_a = row.DETAILS) === null || _a === void 0 ? void 0 : _a.ROW_REF) !== ((_b = x.DETAILS) === null || _b === void 0 ? void 0 : _b.ROW_REF); });
|
|
15
|
+
}
|
|
16
|
+
if (type === 'MODIFY') {
|
|
17
|
+
state = state.map((item) => { var _a; return ((_a = item.DETAILS) === null || _a === void 0 ? void 0 : _a.ROW_REF) === ref ? Object.assign(Object.assign({}, item), eventData) : item; });
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
else if (update && (!state || state.length === 0)) {
|
|
23
|
+
state = [...new Set(update.ROW)];
|
|
24
|
+
}
|
|
25
|
+
return state;
|
|
26
|
+
};
|
|
@@ -134,20 +134,16 @@ export class DefaultNetworkMonitor {
|
|
|
134
134
|
lastUpdated = result.lastUpdated;
|
|
135
135
|
lastMessage = result.lastMessage;
|
|
136
136
|
timeout = result.timeout;
|
|
137
|
-
attemptDataLogon =
|
|
138
|
-
timeout ||
|
|
139
|
-
(lastMessage === null || lastMessage === void 0 ? void 0 : lastMessage.MESSAGE_TYPE) === MessageType.MSG_NACK ||
|
|
140
|
-
messageHasErrorCode(lastMessage, StatusCodes.NOT_FOUND);
|
|
141
137
|
}
|
|
142
138
|
catch (e) {
|
|
143
139
|
isConnected = false;
|
|
144
140
|
lastUpdated = this.getNowTimestamp();
|
|
145
141
|
lastError = e;
|
|
146
142
|
lastMessage = (_a = e === null || e === void 0 ? void 0 : e.receivedMessage) !== null && _a !== void 0 ? _a : e;
|
|
147
|
-
attemptDataLogon =
|
|
148
|
-
(lastMessage === null || lastMessage === void 0 ? void 0 : lastMessage.MESSAGE_TYPE) === MessageType.MSG_NACK ||
|
|
149
|
-
messageHasErrorCode(lastMessage, StatusCodes.NOT_FOUND);
|
|
150
143
|
}
|
|
144
|
+
attemptDataLogon =
|
|
145
|
+
(lastMessage === null || lastMessage === void 0 ? void 0 : lastMessage.MESSAGE_TYPE) === MessageType.MSG_NACK ||
|
|
146
|
+
messageHasErrorCode(lastMessage, StatusCodes.NOT_FOUND);
|
|
151
147
|
formattedTimestamp = this.getFormattedTimestamp(lastUpdated !== null && lastUpdated !== void 0 ? lastUpdated : this.getNowTimestamp());
|
|
152
148
|
if (isConnected) {
|
|
153
149
|
networkLogger.debug(`${name} is healthy at ${formattedTimestamp}`);
|
|
@@ -289,6 +285,20 @@ export class DefaultNetworkMonitor {
|
|
|
289
285
|
return;
|
|
290
286
|
}
|
|
291
287
|
this.removeResource(stream);
|
|
288
|
+
}, ({ detail }) => {
|
|
289
|
+
var _a;
|
|
290
|
+
const { resourceName, stream, error } = detail;
|
|
291
|
+
const lastMessage = (_a = error.receivedMessage) !== null && _a !== void 0 ? _a : error;
|
|
292
|
+
let readableError = '';
|
|
293
|
+
if (messageHasErrorCode(lastMessage, StatusCodes.NOT_FOUND)) {
|
|
294
|
+
readableError = `Please check the resource is running.`;
|
|
295
|
+
}
|
|
296
|
+
else if (messageHasErrorCode(lastMessage, StatusCodes.FORBIDDEN)) {
|
|
297
|
+
readableError = `You are not authorised to access this resource, removing it from monitoring.`;
|
|
298
|
+
this.removeResource(stream);
|
|
299
|
+
}
|
|
300
|
+
networkLogger.error(`${resourceName} errored at ${this.getFormattedTimestamp(this.getNowTimestamp())}.`, readableError, error);
|
|
301
|
+
return;
|
|
292
302
|
}));
|
|
293
303
|
}
|
|
294
304
|
if (this.config.genesisConnectEvents.includes('commit')) {
|
|
@@ -307,7 +317,7 @@ export class DefaultNetworkMonitor {
|
|
|
307
317
|
* In such cases the stream / resource is never actually created, so the `onStreamEvent` is never fired.
|
|
308
318
|
* Meta/init failures are only reported in console logs, however, might be a good idea to show those here.
|
|
309
319
|
*/
|
|
310
|
-
networkLogger.error(`${resourceName} had an unrecoverable error at ${this.getFormattedTimestamp(this.getNowTimestamp())}
|
|
320
|
+
networkLogger.error(`${resourceName} had an unrecoverable error at ${this.getFormattedTimestamp(this.getNowTimestamp())}.`, `Please check the resource is running.`, error);
|
|
311
321
|
return;
|
|
312
322
|
}
|
|
313
323
|
}));
|
|
@@ -47,6 +47,9 @@ export class ConnectMock {
|
|
|
47
47
|
stream(resourceName, onMessage, onError, params) {
|
|
48
48
|
return from(Promise.resolve(this.nextMessage));
|
|
49
49
|
}
|
|
50
|
+
streamState(resourceName, onMessage, onError, params, initialState) {
|
|
51
|
+
return from(Promise.resolve(this.nextListState));
|
|
52
|
+
}
|
|
50
53
|
streamWithoutAutoTeardown(resourceName, onMessage, onError, params) {
|
|
51
54
|
return from(Promise.resolve(this.nextMessage));
|
|
52
55
|
}
|