@genesislcap/foundation-comms 14.167.2 → 14.167.3-alpha-b40d1e5.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/dts/auth/auth.d.ts.map +1 -1
- package/dist/dts/connect/connect.d.ts +11 -1
- package/dist/dts/connect/connect.d.ts.map +1 -1
- package/dist/dts/connect/connect.events.d.ts +173 -0
- package/dist/dts/connect/connect.events.d.ts.map +1 -0
- package/dist/dts/connect/http.connect.d.ts +1 -0
- package/dist/dts/connect/http.connect.d.ts.map +1 -1
- package/dist/dts/connect/index.d.ts +2 -0
- package/dist/dts/connect/index.d.ts.map +1 -1
- package/dist/dts/connect/message.d.ts +51 -0
- package/dist/dts/connect/message.d.ts.map +1 -1
- package/dist/dts/connect/socket.d.ts +72 -8
- package/dist/dts/connect/socket.d.ts.map +1 -1
- package/dist/dts/connect/socket.status.d.ts +79 -0
- package/dist/dts/connect/socket.status.d.ts.map +1 -0
- package/dist/dts/datasource/datasource.d.ts +9 -0
- package/dist/dts/datasource/datasource.d.ts.map +1 -1
- package/dist/dts/fdc3/fdc3.d.ts +17 -1
- package/dist/dts/fdc3/fdc3.d.ts.map +1 -1
- package/dist/dts/index.d.ts +1 -0
- package/dist/dts/index.d.ts.map +1 -1
- package/dist/dts/networkMonitor/config.d.ts +56 -0
- package/dist/dts/networkMonitor/config.d.ts.map +1 -0
- package/dist/dts/networkMonitor/index.d.ts +4 -0
- package/dist/dts/networkMonitor/index.d.ts.map +1 -0
- package/dist/dts/networkMonitor/service.d.ts +193 -0
- package/dist/dts/networkMonitor/service.d.ts.map +1 -0
- package/dist/dts/networkMonitor/types.d.ts +133 -0
- package/dist/dts/networkMonitor/types.d.ts.map +1 -0
- package/dist/dts/testing/mocks/connect/connect.d.ts +1 -0
- package/dist/dts/testing/mocks/connect/connect.d.ts.map +1 -1
- package/dist/dts/testing/mocks/connect/socket.d.ts +5 -1
- package/dist/dts/testing/mocks/connect/socket.d.ts.map +1 -1
- package/dist/dts/testing/mocks/datasource/datasource.d.ts +1 -0
- package/dist/dts/testing/mocks/datasource/datasource.d.ts.map +1 -1
- package/dist/dts/user/user.d.ts +15 -0
- package/dist/dts/user/user.d.ts.map +1 -1
- package/dist/esm/auth/auth.js +5 -2
- package/dist/esm/connect/connect.events.js +113 -0
- package/dist/esm/connect/connect.js +30 -8
- package/dist/esm/connect/http.connect.js +6 -0
- package/dist/esm/connect/index.js +2 -0
- package/dist/esm/connect/message.js +25 -4
- package/dist/esm/connect/socket.js +113 -44
- package/dist/esm/connect/socket.status.js +119 -0
- package/dist/esm/datasource/datasource.js +18 -8
- package/dist/esm/fdc3/fdc3.js +4 -4
- package/dist/esm/index.js +1 -0
- package/dist/esm/networkMonitor/config.js +46 -0
- package/dist/esm/networkMonitor/index.js +3 -0
- package/dist/esm/networkMonitor/service.js +432 -0
- package/dist/esm/networkMonitor/types.js +5 -0
- package/dist/esm/testing/mocks/connect/connect.js +3 -0
- package/dist/esm/testing/mocks/connect/socket.js +1 -1
- package/dist/esm/testing/mocks/datasource/datasource.js +1 -0
- package/dist/esm/user/user.js +22 -1
- package/dist/foundation-comms.api.json +14711 -8166
- package/dist/foundation-comms.d.ts +841 -13
- package/docs/api/foundation-comms.commitevent.md +14 -0
- package/docs/api/foundation-comms.commiteventdetail.md +17 -0
- package/docs/api/foundation-comms.commiteventtype.md +12 -0
- package/docs/api/foundation-comms.connect.getmorecolumns.md +26 -0
- package/docs/api/foundation-comms.connect.md +1 -0
- package/docs/api/foundation-comms.connectevents.addcommitlistener.md +24 -0
- package/docs/api/foundation-comms.connectevents.addmetadatalistener.md +24 -0
- package/docs/api/foundation-comms.connectevents.addstreamlistener.md +25 -0
- package/docs/api/foundation-comms.connectevents.md +22 -0
- package/docs/api/foundation-comms.connecteventsemitter.md +24 -0
- package/docs/api/foundation-comms.connecteventsemitter.oncommitevent.md +25 -0
- package/docs/api/foundation-comms.connecteventsemitter.onmetadataevent.md +26 -0
- package/docs/api/foundation-comms.connecteventsemitter.onstreamcompleteevent.md +24 -0
- package/docs/api/foundation-comms.connecteventsemitter.onstreamevent.md +27 -0
- package/docs/api/foundation-comms.currentuser.md +2 -0
- package/docs/api/foundation-comms.currentuser.set.md +22 -0
- package/docs/api/foundation-comms.currentuser.unset.md +15 -0
- package/docs/api/foundation-comms.datasource.destroy.md +17 -0
- package/docs/api/foundation-comms.datasource.md +1 -0
- package/docs/api/foundation-comms.defaultconnect._constructor_.md +2 -1
- package/docs/api/foundation-comms.defaultconnect.getmorecolumns.md +22 -0
- package/docs/api/foundation-comms.defaultconnect.md +2 -1
- package/docs/api/foundation-comms.defaultconnectevents.addcommitlistener.md +24 -0
- package/docs/api/foundation-comms.defaultconnectevents.addmetadatalistener.md +24 -0
- package/docs/api/foundation-comms.defaultconnectevents.addstreamlistener.md +25 -0
- package/docs/api/foundation-comms.defaultconnectevents.md +27 -0
- package/docs/api/foundation-comms.defaultconnectevents.oncommitevent.md +25 -0
- package/docs/api/foundation-comms.defaultconnectevents.onmetadataevent.md +26 -0
- package/docs/api/foundation-comms.defaultconnectevents.onstreamcompleteevent.md +24 -0
- package/docs/api/foundation-comms.defaultconnectevents.onstreamevent.md +27 -0
- package/docs/api/foundation-comms.defaultdatasource.destroy.md +17 -0
- package/docs/api/foundation-comms.defaultdatasource.md +1 -0
- package/docs/api/foundation-comms.defaulthttpconnect.getmorecolumns.md +22 -0
- package/docs/api/foundation-comms.defaulthttpconnect.md +1 -0
- package/docs/api/foundation-comms.defaultmessagebuilder._constructor_.md +21 -0
- package/docs/api/foundation-comms.defaultmessagebuilder.createchangepasswordmessage.md +24 -0
- package/docs/api/foundation-comms.defaultmessagebuilder.createcommitmessage.md +23 -0
- package/docs/api/foundation-comms.defaultmessagebuilder.createdatalogoffmessage.md +22 -0
- package/docs/api/foundation-comms.defaultmessagebuilder.createdatalogonmessage.md +23 -0
- package/docs/api/foundation-comms.defaultmessagebuilder.createforgotpasswordmessage.md +24 -0
- package/docs/api/foundation-comms.defaultmessagebuilder.createforgotpasswordtokenmessage.md +25 -0
- package/docs/api/foundation-comms.defaultmessagebuilder.createhttpheadersfrommessage.md +23 -0
- package/docs/api/foundation-comms.defaultmessagebuilder.createloginmessage.md +22 -0
- package/docs/api/foundation-comms.defaultmessagebuilder.createlogoutmessage.md +22 -0
- package/docs/api/foundation-comms.defaultmessagebuilder.createmetarequestmessage.md +23 -0
- package/docs/api/foundation-comms.defaultmessagebuilder.createmorecolumnsmessage.md +22 -0
- package/docs/api/foundation-comms.defaultmessagebuilder.createmorerowsmessage.md +22 -0
- package/docs/api/foundation-comms.defaultmessagebuilder.createrefreshtokenmessage.md +15 -0
- package/docs/api/foundation-comms.defaultmessagebuilder.createrequestmessage.md +23 -0
- package/docs/api/foundation-comms.defaultmessagebuilder.createresourcesmessage.md +22 -0
- package/docs/api/foundation-comms.defaultmessagebuilder.md +41 -0
- package/docs/api/foundation-comms.defaultnetworkmonitor.addresource.md +23 -0
- package/docs/api/foundation-comms.defaultnetworkmonitor.create.md +16 -0
- package/docs/api/foundation-comms.defaultnetworkmonitor.destroy.md +16 -0
- package/docs/api/foundation-comms.defaultnetworkmonitor.md +31 -0
- package/docs/api/foundation-comms.defaultnetworkmonitor.removeresource.md +22 -0
- package/docs/api/foundation-comms.defaultnetworkmonitor.runallchecks.md +11 -0
- package/docs/api/foundation-comms.defaultnetworkmonitor.status.md +12 -0
- package/docs/api/foundation-comms.defaultnetworkmonitorconfig.md +13 -0
- package/docs/api/foundation-comms.defaultsocket._constructor_.md +24 -0
- package/docs/api/foundation-comms.defaultsocket.connect.md +24 -0
- package/docs/api/foundation-comms.defaultsocket.hasvalidsession.md +13 -0
- package/docs/api/foundation-comms.defaultsocket.isconfigured.md +11 -0
- package/docs/api/foundation-comms.defaultsocket.isconnected.md +11 -0
- package/docs/api/foundation-comms.defaultsocket.isconnectedsubject.md +11 -0
- package/docs/api/foundation-comms.defaultsocket.isconnecting.md +11 -0
- package/docs/api/foundation-comms.defaultsocket.isdisconnected.md +11 -0
- package/docs/api/foundation-comms.defaultsocket.isdisconnectedbyserver.md +11 -0
- package/docs/api/foundation-comms.defaultsocket.isreconnecting.md +11 -0
- package/docs/api/foundation-comms.defaultsocket.md +44 -0
- package/docs/api/foundation-comms.defaultsocket.reset.md +15 -0
- package/docs/api/foundation-comms.defaultsocket.send.md +23 -0
- package/docs/api/foundation-comms.defaultsocket.sendforstream.md +25 -0
- package/docs/api/foundation-comms.defaultsocket.socketmessages.md +11 -0
- package/docs/api/foundation-comms.defaultsocketstatus.closedclean.md +11 -0
- package/docs/api/foundation-comms.defaultsocketstatus.closedcode.md +11 -0
- package/docs/api/foundation-comms.defaultsocketstatus.closedreason.md +11 -0
- package/docs/api/foundation-comms.defaultsocketstatus.hasvalidsession.md +11 -0
- package/docs/api/foundation-comms.defaultsocketstatus.isconfigured.md +11 -0
- package/docs/api/foundation-comms.defaultsocketstatus.isconnected.md +11 -0
- package/docs/api/foundation-comms.defaultsocketstatus.isconnectedchanged.md +15 -0
- package/docs/api/foundation-comms.defaultsocketstatus.isconnectedsubject.md +11 -0
- package/docs/api/foundation-comms.defaultsocketstatus.isconnecting.md +11 -0
- package/docs/api/foundation-comms.defaultsocketstatus.isdisconnected.md +11 -0
- package/docs/api/foundation-comms.defaultsocketstatus.isdisconnectedbyserver.md +11 -0
- package/docs/api/foundation-comms.defaultsocketstatus.isreconnecting.md +11 -0
- package/docs/api/foundation-comms.defaultsocketstatus.isreconnectingchanged.md +15 -0
- package/docs/api/foundation-comms.defaultsocketstatus.md +42 -0
- package/docs/api/foundation-comms.defaultsocketstatus.onclose.md +22 -0
- package/docs/api/foundation-comms.defaultsocketstatus.reconnectionlimitreached.md +11 -0
- package/docs/api/foundation-comms.defaultsocketstatus.resetclosedstate.md +15 -0
- package/docs/api/foundation-comms.defaultsocketstatus.serialize.md +15 -0
- package/docs/api/foundation-comms.genesisconnectevents.md +18 -0
- package/docs/api/foundation-comms.getnetworkmonitor.md +30 -0
- package/docs/api/foundation-comms.getsocket.md +30 -0
- package/docs/api/foundation-comms.getsocketstatus.md +30 -0
- package/docs/api/foundation-comms.md +39 -0
- package/docs/api/foundation-comms.messagebuilder.createmorecolumnsmessage.md +30 -0
- package/docs/api/foundation-comms.messagebuilder.md +1 -0
- package/docs/api/foundation-comms.messagehaserrorcode.md +13 -0
- package/docs/api/foundation-comms.messagetype.md +2 -0
- package/docs/api/foundation-comms.metadataevent.md +14 -0
- package/docs/api/foundation-comms.metadataeventdetail.md +18 -0
- package/docs/api/foundation-comms.metadataeventtype.md +12 -0
- package/docs/api/foundation-comms.monitoredresource.md +15 -0
- package/docs/api/foundation-comms.monitoredresourcechecks.md +15 -0
- package/docs/api/foundation-comms.monitoredresourcechecksresult.isconnected.md +11 -0
- package/docs/api/foundation-comms.monitoredresourcechecksresult.lastmessage.md +11 -0
- package/docs/api/foundation-comms.monitoredresourcechecksresult.lastupdated.md +11 -0
- package/docs/api/foundation-comms.monitoredresourcechecksresult.md +23 -0
- package/docs/api/foundation-comms.monitoredresourcechecksresult.timeout.md +11 -0
- package/docs/api/foundation-comms.monitoredresourcedatalogon.md +15 -0
- package/docs/api/foundation-comms.monitoredresourcemetadata.md +15 -0
- package/docs/api/foundation-comms.networklogger.md +12 -0
- package/docs/api/foundation-comms.networkmonitor.addresource.md +23 -0
- package/docs/api/foundation-comms.networkmonitor.create.md +15 -0
- package/docs/api/foundation-comms.networkmonitor.destroy.md +15 -0
- package/docs/api/foundation-comms.networkmonitor.md +34 -0
- package/docs/api/foundation-comms.networkmonitor.removeresource.md +22 -0
- package/docs/api/foundation-comms.networkmonitor.runallchecks.md +23 -0
- package/docs/api/foundation-comms.networkmonitor.status.md +11 -0
- package/docs/api/foundation-comms.networkmonitorconfig.checkinterval.md +13 -0
- package/docs/api/foundation-comms.networkmonitorconfig.checktimeout.md +13 -0
- package/docs/api/foundation-comms.networkmonitorconfig.documentevents.md +13 -0
- package/docs/api/foundation-comms.networkmonitorconfig.eventemitter.md +13 -0
- package/docs/api/foundation-comms.networkmonitorconfig.genesisconnectevents.md +13 -0
- package/docs/api/foundation-comms.networkmonitorconfig.md +27 -0
- package/docs/api/foundation-comms.networkmonitorconfig.resourcechecks.md +13 -0
- package/docs/api/foundation-comms.networkmonitorconfig.resourcedatalogon.md +18 -0
- package/docs/api/foundation-comms.networkmonitorconfig.windowevents.md +13 -0
- package/docs/api/foundation-comms.resourcehealth.md +19 -0
- package/docs/api/foundation-comms.serializedsocketstatus.closedclean.md +11 -0
- package/docs/api/foundation-comms.serializedsocketstatus.closedcode.md +11 -0
- package/docs/api/foundation-comms.serializedsocketstatus.closedreason.md +11 -0
- package/docs/api/foundation-comms.serializedsocketstatus.hasvalidsession.md +11 -0
- package/docs/api/foundation-comms.serializedsocketstatus.isconfigured.md +13 -0
- package/docs/api/foundation-comms.serializedsocketstatus.isconnected.md +11 -0
- package/docs/api/foundation-comms.serializedsocketstatus.isconnecting.md +11 -0
- package/docs/api/foundation-comms.serializedsocketstatus.isdisconnected.md +11 -0
- package/docs/api/foundation-comms.serializedsocketstatus.isdisconnectedbyserver.md +11 -0
- package/docs/api/foundation-comms.serializedsocketstatus.isreconnecting.md +11 -0
- package/docs/api/foundation-comms.serializedsocketstatus.md +30 -0
- package/docs/api/foundation-comms.serializedsocketstatus.reconnectionlimitreached.md +11 -0
- package/docs/api/foundation-comms.socket.md +3 -11
- package/docs/api/foundation-comms.socket.sendforstream.md +2 -1
- package/docs/api/{foundation-comms.socket.isconnectedsubject.md → foundation-comms.socketstatus.isconnectedsubject.md} +2 -2
- package/docs/api/foundation-comms.socketstatus.md +28 -0
- package/docs/api/foundation-comms.socketstatus.onclose.md +22 -0
- package/docs/api/foundation-comms.socketstatus.serialize.md +15 -0
- package/docs/api/foundation-comms.streamcompleteevent.md +14 -0
- package/docs/api/foundation-comms.streamcompleteeventtype.md +12 -0
- package/docs/api/foundation-comms.streamevent.md +14 -0
- package/docs/api/foundation-comms.streameventdetail.md +19 -0
- package/docs/api/foundation-comms.streameventfunctions.md +19 -0
- package/docs/api/foundation-comms.streameventtype.md +12 -0
- package/docs/api/foundation-comms.systemhealthchanged.md +13 -0
- package/docs/api/foundation-comms.systemhealthchangedevent.md +15 -0
- package/docs/api/foundation-comms.systemhealthstatus.md +29 -0
- package/docs/api/foundation-comms.user.md +2 -0
- package/docs/api/foundation-comms.user.set.md +22 -0
- package/docs/api/foundation-comms.user.unset.md +15 -0
- package/docs/api-report.md +520 -16
- package/package.json +13 -11
- package/docs/api/foundation-comms.socket.hasvalidsession.md +0 -11
- package/docs/api/foundation-comms.socket.isconnected.md +0 -11
- package/docs/api/foundation-comms.socket.isreconnecting.md +0 -11
@@ -0,0 +1,119 @@
|
|
1
|
+
import { __decorate } from "tslib";
|
2
|
+
import { observable } from '@microsoft/fast-element';
|
3
|
+
import { DI } from '@microsoft/fast-foundation';
|
4
|
+
import { BehaviorSubject } from 'rxjs';
|
5
|
+
/**
|
6
|
+
* Default SocketStatus implementation.
|
7
|
+
* @public
|
8
|
+
*/
|
9
|
+
export class DefaultSocketStatus {
|
10
|
+
constructor() {
|
11
|
+
this.isConfigured = false;
|
12
|
+
this.isConnecting = false;
|
13
|
+
this.isConnected = false;
|
14
|
+
this.isReconnecting = false;
|
15
|
+
this.reconnectionLimitReached = false;
|
16
|
+
this.hasValidSession = false;
|
17
|
+
this.isConnectedSubject = new BehaviorSubject(this.isConnected);
|
18
|
+
}
|
19
|
+
get isDisconnected() {
|
20
|
+
return !this.isConnected;
|
21
|
+
}
|
22
|
+
get isDisconnectedByServer() {
|
23
|
+
return this.closedClean !== undefined ? !this.closedClean : false;
|
24
|
+
}
|
25
|
+
isConnectedChanged() {
|
26
|
+
var _a;
|
27
|
+
if (this.isConnected) {
|
28
|
+
this.resetClosedState();
|
29
|
+
}
|
30
|
+
this.isConnecting = false;
|
31
|
+
this.isReconnecting = false;
|
32
|
+
(_a = this.isConnectedSubject) === null || _a === void 0 ? void 0 : _a.next(this.isConnected);
|
33
|
+
}
|
34
|
+
isReconnectingChanged() {
|
35
|
+
if (this.isReconnecting) {
|
36
|
+
this.reconnectionLimitReached = false;
|
37
|
+
}
|
38
|
+
}
|
39
|
+
resetClosedState() {
|
40
|
+
this.closedCode = undefined;
|
41
|
+
this.closedReason = undefined;
|
42
|
+
this.closedClean = undefined;
|
43
|
+
}
|
44
|
+
serialize() {
|
45
|
+
return {
|
46
|
+
isConfigured: this.isConfigured,
|
47
|
+
isConnecting: this.isConnecting,
|
48
|
+
isConnected: this.isConnected,
|
49
|
+
isDisconnected: this.isDisconnected,
|
50
|
+
isDisconnectedByServer: this.isDisconnectedByServer,
|
51
|
+
isReconnecting: this.isReconnecting,
|
52
|
+
reconnectionLimitReached: this.reconnectionLimitReached,
|
53
|
+
hasValidSession: this.hasValidSession,
|
54
|
+
closedCode: this.closedCode,
|
55
|
+
closedReason: this.closedReason,
|
56
|
+
closedClean: this.closedClean,
|
57
|
+
};
|
58
|
+
}
|
59
|
+
onClose(event) {
|
60
|
+
this.isConnected = false;
|
61
|
+
this.closedCode = event.code;
|
62
|
+
this.closedReason = event.reason;
|
63
|
+
this.closedClean = event.wasClean;
|
64
|
+
}
|
65
|
+
}
|
66
|
+
__decorate([
|
67
|
+
observable
|
68
|
+
], DefaultSocketStatus.prototype, "isConfigured", void 0);
|
69
|
+
__decorate([
|
70
|
+
observable
|
71
|
+
], DefaultSocketStatus.prototype, "isConnecting", void 0);
|
72
|
+
__decorate([
|
73
|
+
observable
|
74
|
+
], DefaultSocketStatus.prototype, "isConnected", void 0);
|
75
|
+
__decorate([
|
76
|
+
observable
|
77
|
+
], DefaultSocketStatus.prototype, "isReconnecting", void 0);
|
78
|
+
__decorate([
|
79
|
+
observable
|
80
|
+
], DefaultSocketStatus.prototype, "reconnectionLimitReached", void 0);
|
81
|
+
__decorate([
|
82
|
+
observable
|
83
|
+
], DefaultSocketStatus.prototype, "hasValidSession", void 0);
|
84
|
+
__decorate([
|
85
|
+
observable
|
86
|
+
], DefaultSocketStatus.prototype, "closedCode", void 0);
|
87
|
+
__decorate([
|
88
|
+
observable
|
89
|
+
], DefaultSocketStatus.prototype, "closedReason", void 0);
|
90
|
+
__decorate([
|
91
|
+
observable
|
92
|
+
], DefaultSocketStatus.prototype, "closedClean", void 0);
|
93
|
+
/**
|
94
|
+
* SocketStatus DI key.
|
95
|
+
*
|
96
|
+
* @privateRemarks
|
97
|
+
* Marked as internal to stop api-extractor becoming confused cross-linking tokens with the same name.
|
98
|
+
*
|
99
|
+
* @internal
|
100
|
+
*/
|
101
|
+
export const SocketStatus = DI.createInterface((x) => x.singleton(DefaultSocketStatus));
|
102
|
+
/**
|
103
|
+
* Gets SocketStatus from the DI container.
|
104
|
+
*
|
105
|
+
* @remarks
|
106
|
+
* A utility method for host applications that are not using decorators or the DI container.
|
107
|
+
*
|
108
|
+
* @example
|
109
|
+
* ```ts
|
110
|
+
* import { getSocketStatus } from '@genesislcap/foundation-comms';
|
111
|
+
* ...
|
112
|
+
* private socketStatus = getSocketStatus();
|
113
|
+
* ```
|
114
|
+
*
|
115
|
+
* @public
|
116
|
+
*/
|
117
|
+
export function getSocketStatus() {
|
118
|
+
return DI.getOrCreateDOMContainer().get(SocketStatus);
|
119
|
+
}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { __awaiter, __decorate, __param, __rest } from "tslib";
|
2
|
-
import { observable
|
2
|
+
import { observable } from '@microsoft/fast-element';
|
3
3
|
import { DI, optional } from '@microsoft/fast-foundation';
|
4
4
|
import { combineLatest, from, timer } from 'rxjs';
|
5
5
|
import { switchMap, takeWhile } from 'rxjs/operators';
|
@@ -60,11 +60,12 @@ let DefaultDatasource = class DefaultDatasource {
|
|
60
60
|
return false;
|
61
61
|
}
|
62
62
|
this.options = Object.assign(Object.assign({}, this.config.options), options);
|
63
|
+
const resourceName = this.options.resourceName;
|
63
64
|
if (fetchMeta) {
|
64
|
-
logger.debug(`Initializing ${
|
65
|
+
logger.debug(`Initializing ${resourceName} Datasource`);
|
65
66
|
const meta = yield this.connect
|
66
|
-
.getMetadata(
|
67
|
-
.catch((e) => logger.error(`Metadata Fetch failed for ${
|
67
|
+
.getMetadata(resourceName)
|
68
|
+
.catch((e) => logger.error(`Metadata Fetch failed for ${resourceName}:`, e));
|
68
69
|
if (!meta) {
|
69
70
|
this.deinit();
|
70
71
|
return false;
|
@@ -74,7 +75,7 @@ let DefaultDatasource = class DefaultDatasource {
|
|
74
75
|
this.originalFieldDef = extractFieldDefinitions(meta);
|
75
76
|
this.fieldMetadata = toFieldMetadata(this.originalFieldDef);
|
76
77
|
this.requestFields = meta.REQUEST_FIELD || [];
|
77
|
-
logger.debug(`Datasource for ${
|
78
|
+
logger.debug(`Datasource for ${resourceName} is ready`);
|
78
79
|
}
|
79
80
|
if (!this.options.isSnapshot) {
|
80
81
|
this._stream = yield this.createStream();
|
@@ -84,14 +85,23 @@ let DefaultDatasource = class DefaultDatasource {
|
|
84
85
|
});
|
85
86
|
}
|
86
87
|
deinit() {
|
88
|
+
var _a;
|
89
|
+
logger.debug('Datasource.deinit', (_a = this.options) === null || _a === void 0 ? void 0 : _a.resourceName);
|
87
90
|
this.initialized = false;
|
88
|
-
this.options =
|
91
|
+
this.options = {};
|
89
92
|
this.resourceType = undefined;
|
90
93
|
this.availableIndexes = [];
|
91
94
|
this.originalFieldDef = [];
|
92
95
|
this.fieldMetadata = [];
|
93
96
|
this.requestFields = [];
|
94
97
|
}
|
98
|
+
/** {@inheritDoc Datasource.destroy} */
|
99
|
+
destroy() {
|
100
|
+
var _a;
|
101
|
+
logger.debug('Datasource.destroy', (_a = this.options) === null || _a === void 0 ? void 0 : _a.resourceName);
|
102
|
+
this.deinit();
|
103
|
+
delete this._stream;
|
104
|
+
}
|
95
105
|
get stream() {
|
96
106
|
return this._stream;
|
97
107
|
}
|
@@ -190,8 +200,8 @@ __decorate([
|
|
190
200
|
observable
|
191
201
|
], DefaultDatasource.prototype, "readOnly", void 0);
|
192
202
|
__decorate([
|
193
|
-
|
194
|
-
], DefaultDatasource.prototype, "
|
203
|
+
observable
|
204
|
+
], DefaultDatasource.prototype, "_stream", void 0);
|
195
205
|
DefaultDatasource = __decorate([
|
196
206
|
__param(0, Connect),
|
197
207
|
__param(1, Auth),
|
package/dist/esm/fdc3/fdc3.js
CHANGED
@@ -10,7 +10,7 @@ import { logger } from '../utils';
|
|
10
10
|
* The FDC3 implementation.
|
11
11
|
* @internal
|
12
12
|
*/
|
13
|
-
class
|
13
|
+
export class DefaultFDC3 {
|
14
14
|
constructor() {
|
15
15
|
this.isReady = false;
|
16
16
|
this.connect();
|
@@ -71,9 +71,9 @@ class FDC3Service {
|
|
71
71
|
}
|
72
72
|
__decorate([
|
73
73
|
observable
|
74
|
-
],
|
74
|
+
], DefaultFDC3.prototype, "isReady", void 0);
|
75
75
|
/**
|
76
|
-
* The DI token for the
|
76
|
+
* The DI token for the FDC3 interface.
|
77
77
|
* @internal
|
78
78
|
*/
|
79
|
-
export const FDC3 = DI.createInterface((x) => x.singleton(
|
79
|
+
export const FDC3 = DI.createInterface((x) => x.singleton(DefaultFDC3));
|
package/dist/esm/index.js
CHANGED
@@ -0,0 +1,46 @@
|
|
1
|
+
import { __awaiter } from "tslib";
|
2
|
+
import { DI } from '@microsoft/fast-foundation';
|
3
|
+
import { getConnect, getSocket } from '../connect';
|
4
|
+
import { MessageType } from '../connect/message';
|
5
|
+
/**
|
6
|
+
* Default NetworkMonitorConfig DI implementation.
|
7
|
+
* @public
|
8
|
+
*/
|
9
|
+
export const defaultNetworkMonitorConfig = {
|
10
|
+
windowEvents: ['online', 'offline', 'pageshow'],
|
11
|
+
documentEvents: ['visibilitychange'],
|
12
|
+
genesisConnectEvents: ['stream', 'commit'],
|
13
|
+
checkInterval: 10000,
|
14
|
+
checkTimeout: 3000,
|
15
|
+
/**
|
16
|
+
* The default when a custom check function is not explicitly provided for a resource.
|
17
|
+
*/
|
18
|
+
resourceChecks: (sourceRef) => __awaiter(void 0, void 0, void 0, function* () {
|
19
|
+
var _a;
|
20
|
+
const connect = getConnect();
|
21
|
+
const message = yield connect.getMoreColumns(sourceRef);
|
22
|
+
const lastUpdated = Date.now();
|
23
|
+
const lastMessage = message;
|
24
|
+
const isConnected = (_a = (message === null || message === void 0 ? void 0 : message.MESSAGE_TYPE) === MessageType.MORE_COLUMNS_ACK) !== null && _a !== void 0 ? _a : false;
|
25
|
+
return {
|
26
|
+
isConnected,
|
27
|
+
lastUpdated,
|
28
|
+
lastMessage,
|
29
|
+
};
|
30
|
+
}),
|
31
|
+
/**
|
32
|
+
* The default when a custom data logon function is not explicitly provided for a resource.
|
33
|
+
*/
|
34
|
+
resourceDataLogon: ({ message, functions }) => {
|
35
|
+
const { onMessage, onError } = functions;
|
36
|
+
getSocket().sendForStream(message, onMessage, onError);
|
37
|
+
},
|
38
|
+
};
|
39
|
+
/**
|
40
|
+
* NetworkMonitorConfig DI key.
|
41
|
+
*
|
42
|
+
* @internal
|
43
|
+
* @privateRemarks
|
44
|
+
* Marked as internal to stop api-extractor becoming confused cross-linking tokens with the same name.
|
45
|
+
*/
|
46
|
+
export const NetworkMonitorConfig = DI.createInterface((x) => x.instance(defaultNetworkMonitorConfig));
|